浏览代码

Merge branch 'master' into jiaoyang

# Conflicts:
#	jeecg-boot-module-system/src/main/resources/application-dev.yml
#	jeecg-boot-module-system/src/main/resources/application-test.yml
#	jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
yumeng 4 年之前
父节点
当前提交
c1e60cd607
共有 100 个文件被更改,包括 2280 次插入2697 次删除
  1. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  2. 0 203
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialCutFrameController.java
  3. 64 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialVideoAuthorController.java
  4. 113 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialVideoCoverController.java
  5. 96 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialVideoFrameController.java
  6. 80 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialVideoInfoController.java
  7. 84 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialVideoProjectController.java
  8. 62 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialVideoWatermarkController.java
  9. 4 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/controller/DesignerCommitProcessCtrl.java
  10. 4 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/controller/OperatorApprovalProcessCtrl.java
  11. 40 6
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/controller/PlatformFileCtrl.java
  12. 63 10
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/controller/PlatformMaterialCtrl.java
  13. 124 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/controller/PlatformScriptController.java
  14. 76 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/controller/PlatformVideoController.java
  15. 41 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/entity/PlatformScript.java
  16. 46 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/entity/PlatformVideo.java
  17. 6 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/mapper/PlatformMaterialMapper.java
  18. 11 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/mapper/PlatformScriptMapper.java
  19. 14 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/mapper/PlatformVideoMapper.java
  20. 34 16
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/mapper/xml/PlatformMaterialMapper.xml
  21. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/mapper/xml/PlatformScriptMapper.xml
  22. 13 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/mapper/xml/PlatformVideoMapper.xml
  23. 17 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/service/IPlatformMaterialService.java
  24. 11 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/service/IPlatformScriptService.java
  25. 14 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/service/IPlatformVideoService.java
  26. 160 13
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/service/impl/PlatformMaterialServiceImpl.java
  27. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/service/impl/PlatformOrderServiceImpl.java
  28. 15 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/service/impl/PlatformScriptServiceImpl.java
  29. 146 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/service/impl/PlatformVideoServiceImpl.java
  30. 94 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/util/ApprovalNodeNoticeHandler.java
  31. 4 0
      jeecg-boot-module-system/src/main/resources/application-dev.yml
  32. 4 0
      jeecg-boot-module-system/src/main/resources/application-jiaoyang.yml
  33. 4 0
      jeecg-boot-module-system/src/main/resources/application-prod.yml
  34. 4 0
      jeecg-boot-module-system/src/main/resources/application-prod2.yml
  35. 4 0
      jeecg-boot-module-system/src/main/resources/application-test.yml
  36. 5 1
      jeecg-boot-module-system/src/main/resources/application-wps.yml
  37. 3 3
      jeecg-boot-module-system/src/main/resources/jeecg/jeecg_database.properties
  38. 41 17
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/constant/MatchLogic.java
  39. 0 274
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/AlarmEventRuleController.java
  40. 0 26
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/AlarmEventSendController.java
  41. 0 269
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/AlarmMetricValueController.java
  42. 0 231
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/AlarmRuleCampaignRelController.java
  43. 79 82
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/AlarmEventMetricController.java
  44. 0 91
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/AlarmEventMetric.java
  45. 0 135
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/AlarmEventRule.java
  46. 0 85
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/AlarmMetricValue.java
  47. 0 80
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/AlarmRuleCampaignRel.java
  48. 119 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/AlarmRuleRecord.java
  49. 45 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/enums/ConditEnum.java
  50. 0 20
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/AlarmEventMetricMapper.java
  51. 0 22
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/AlarmEventRuleMapper.java
  52. 0 18
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/AlarmMetricValueMapper.java
  53. 0 20
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/AlarmRuleCampaignRelMapper.java
  54. 15 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/AlarmRuleRecordMapper.java
  55. 0 15
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/AlarmEventMetricMapper.xml
  56. 0 60
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/AlarmEventRuleMapper.xml
  57. 0 12
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/AlarmMetricValueMapper.xml
  58. 0 18
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/AlarmRuleCampaignRelMapper.xml
  59. 5 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/AlarmRuleRecordMapper.xml
  60. 19 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/AlarmRuleRecordServiceImpl.java
  61. 0 14
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/IAlarmEventMetricService.java
  62. 0 28
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/IAlarmEventRuleService.java
  63. 0 3
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/IAlarmEventSendService.java
  64. 0 16
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/IAlarmMetricValueService.java
  65. 0 14
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/IAlarmRuleCampaignRelService.java
  66. 14 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/IAlarmRuleRecordService.java
  67. 0 19
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/impl/AlarmEventMetricServiceImpl.java
  68. 0 314
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/impl/AlarmEventRuleServiceImpl.java
  69. 0 449
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/impl/AlarmEventSendServiceImpl.java
  70. 0 62
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/impl/AlarmMetricValueServiceImpl.java
  71. 0 19
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/impl/AlarmRuleCampaignRelServiceImpl.java
  72. 79 21
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/impl/RuleGroupServiceImpl.java
  73. 6 6
      module-check/src/main/java/cn/com/ctop/notice/handler/SendWeChatHandle.java
  74. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/RuleDataTargetKuaishou.java
  75. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/RuleDatePlanKuaishou.java
  76. 1 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/RuleDateUnitKuaishou.java
  77. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/ProjectMapper.java
  78. 4 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/ProjectMapper.xml
  79. 46 0
      module-common/src/main/java/cn/com/ctop/common/module/material/entity/MaterialVideoAuthor.java
  80. 40 0
      module-common/src/main/java/cn/com/ctop/common/module/material/entity/MaterialVideoCover.java
  81. 30 0
      module-common/src/main/java/cn/com/ctop/common/module/material/entity/MaterialVideoFrame.java
  82. 46 0
      module-common/src/main/java/cn/com/ctop/common/module/material/entity/MaterialVideoInfo.java
  83. 28 0
      module-common/src/main/java/cn/com/ctop/common/module/material/entity/MaterialVideoProject.java
  84. 32 0
      module-common/src/main/java/cn/com/ctop/common/module/material/entity/MaterialVideoWatermark.java
  85. 11 0
      module-common/src/main/java/cn/com/ctop/common/module/material/mapper/MaterialVideoAuthorMapper.java
  86. 14 0
      module-common/src/main/java/cn/com/ctop/common/module/material/mapper/MaterialVideoCoverMapper.java
  87. 14 0
      module-common/src/main/java/cn/com/ctop/common/module/material/mapper/MaterialVideoFrameMapper.java
  88. 14 0
      module-common/src/main/java/cn/com/ctop/common/module/material/mapper/MaterialVideoInfoMapper.java
  89. 11 0
      module-common/src/main/java/cn/com/ctop/common/module/material/mapper/MaterialVideoProjectMapper.java
  90. 11 0
      module-common/src/main/java/cn/com/ctop/common/module/material/mapper/MaterialVideoWatermarkMapper.java
  91. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/material/mapper/xml/MaterialVideoAuthorMapper.xml
  92. 13 0
      module-common/src/main/java/cn/com/ctop/common/module/material/mapper/xml/MaterialVideoCoverMapper.xml
  93. 8 0
      module-common/src/main/java/cn/com/ctop/common/module/material/mapper/xml/MaterialVideoFrameMapper.xml
  94. 8 0
      module-common/src/main/java/cn/com/ctop/common/module/material/mapper/xml/MaterialVideoInfoMapper.xml
  95. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/material/mapper/xml/MaterialVideoProjectMapper.xml
  96. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/material/mapper/xml/MaterialVideoWatermarkMapper.xml
  97. 11 0
      module-common/src/main/java/cn/com/ctop/common/module/material/service/IMaterialVideoAuthorService.java
  98. 13 0
      module-common/src/main/java/cn/com/ctop/common/module/material/service/IMaterialVideoCoverService.java
  99. 15 0
      module-common/src/main/java/cn/com/ctop/common/module/material/service/IMaterialVideoFrameService.java
  100. 0 0
      module-common/src/main/java/cn/com/ctop/common/module/material/service/IMaterialVideoInfoService.java

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

@@ -183,6 +183,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/ruleGroup/*", "anon");
         filterChainDefinitionMap.put("/kuaishou/material/*", "anon");
         filterChainDefinitionMap.put("/kuaishou/create/*", "anon");
+        filterChainDefinitionMap.put("/template/kuaiShouBatchCampaignTemplate/*", "anon");
 
         // 添加自己的过滤器并且取名为jwt
         Map<String, Filter> filterMap = new HashMap<>(1);

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

@@ -47,12 +47,6 @@ public class MaterialCutFrameController {
 
     /**
      * 分页列表查询
-     *
-     * @param materialCutFrame
-     * @param pageNo
-     * @param pageSize
-     * @param req
-     * @return
      */
     @AutoLog(value = "截屏-分页列表查询")
     @ApiOperation(value = "截屏-分页列表查询", notes = "截屏-分页列表查询")
@@ -73,201 +67,4 @@ public class MaterialCutFrameController {
         result.setResult(pageList);
         return result;
     }
-
-
-    /**
-     * 添加
-     *
-     * @param materialCutFrame
-     * @return
-     */
-    @AutoLog(value = "截屏-添加")
-    @ApiOperation(value = "截屏-添加", notes = "截屏-添加")
-    @PostMapping(value = "/add")
-    public Result<MaterialCutFrame> add(@RequestBody MaterialCutFrame materialCutFrame) {
-        Result<MaterialCutFrame> result = new Result<MaterialCutFrame>();
-        try {
-            materialCutFrameService.save(materialCutFrame);
-            result.success("添加成功!");
-        } catch (Exception e) {
-            log.error(e.getMessage(), e);
-            result.error500("操作失败");
-        }
-        return result;
-    }
-
-    /**
-     * 编辑
-     *
-     * @param materialCutFrame
-     * @return
-     */
-    @AutoLog(value = "截屏-编辑")
-    @ApiOperation(value = "截屏-编辑", notes = "截屏-编辑")
-    @PutMapping(value = "/edit")
-    public Result<MaterialCutFrame> edit(@RequestBody MaterialCutFrame materialCutFrame) {
-        Result<MaterialCutFrame> result = new Result<MaterialCutFrame>();
-        MaterialCutFrame materialCutFrameEntity = materialCutFrameService.getById(materialCutFrame.getId());
-        if (materialCutFrameEntity == null) {
-            result.error500("未找到对应实体");
-        } else {
-            boolean ok = materialCutFrameService.updateById(materialCutFrame);
-            if (ok) {
-                result.success("修改成功!");
-            }
-        }
-
-        return result;
-    }
-
-    /**
-     * 通过id删除
-     *
-     * @param id
-     * @return
-     */
-    @AutoLog(value = "截屏-通过id删除")
-    @ApiOperation(value = "截屏-通过id删除", notes = "截屏-通过id删除")
-    @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
-        try {
-            materialCutFrameService.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<MaterialCutFrame> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<MaterialCutFrame> result = new Result<MaterialCutFrame>();
-        if (ids == null || "".equals(ids.trim())) {
-            result.error500("参数不识别!");
-        } else {
-            this.materialCutFrameService.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<MaterialCutFrame> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<MaterialCutFrame> result = new Result<MaterialCutFrame>();
-        MaterialCutFrame materialCutFrame = materialCutFrameService.getById(id);
-        if (materialCutFrame == null) {
-            result.error500("未找到对应实体");
-        } else {
-            result.setResult(materialCutFrame);
-            result.setSuccess(true);
-        }
-        return result;
-    }
-
-
-    @AutoLog(value = "腾讯云抽帧按照素材创建时间筛选素材进行抽帧操作")
-    @ApiOperation(value = "腾讯云抽帧", notes = "腾讯云抽帧")
-    @GetMapping(value = "/getCosCutFrameByTime")
-    public Result getCosCutFrameByTime(@RequestParam(name = "startDate", required = true) String startDate,
-                                 @RequestParam(name = "endDate", required = true) String endDate) {
-        Result result = new Result();
-        result.setSuccess(true);
-
-        try {
-            List<MaterialInfo> materialInfos = materialInfoService.getListByDate(startDate, endDate);
-            if (!Check.isNull(materialInfos)) {
-                for (MaterialInfo materialInfo : materialInfos) {
-                    if (!Check.isNull(materialInfo)) {
-                        String code = materialInfo.getCode();
-                        materialCutFrameService.getCosCutFrame(materialInfo.getUrl(), code);
-                    }
-                }
-            }
-        }catch (Exception e){
-            log.error(e.getMessage());
-            e.printStackTrace();
-            result.setSuccess(false);
-        }
-
-        return result;
-    }
-
-    @AutoLog(value = "腾讯云抽帧--根据md5抽帧")
-    @ApiOperation(value = "腾讯云抽帧", notes = "腾讯云抽帧")
-    @GetMapping(value = "/getCosCutFrame")
-    public Result getCosCutFrame(@RequestParam(name = "code", required = true) String code) {
-        Result result = new Result();
-        result.setSuccess(true);
-
-        try {
-            MaterialInfo materialInfo = materialInfoService.getMaterialInfoByCode(code);
-            if (!Check.isNull(materialInfo)) {
-                materialCutFrameService.getCosCutFrame(materialInfo.getUrl(), code);
-            }
-        }catch (Exception e){
-            log.error(e.getMessage());
-            e.printStackTrace();
-            result.setSuccess(false);
-        }
-
-        return result;
-    }
-
-
-    @AutoLog(value = "腾讯云抽帧--获取任务状态并将图片入库")
-    @ApiOperation(value = "腾讯云抽帧", notes = "腾讯云抽帧")
-    @GetMapping(value = "/loadCosCutFrame")
-    public Result loadCosCutFrame() {
-        Result result = new Result();
-        result.setSuccess(true);
-
-        log.info("开始抽帧定时任务");
-        QueryWrapper<MaterialCutFrameTask> taskQueryWrapper = new QueryWrapper<>();
-        taskQueryWrapper.eq("job_status", 0);
-        taskQueryWrapper.eq("cloud_type",2);  //2为腾讯云 1为阿里云
-        List<MaterialCutFrameTask> list = materialCutFrameTaskServiceTask.list(taskQueryWrapper);
-
-        if (Check.isNull(list)) {
-            result.setCode(500);
-            result.setSuccess(false);
-            return result;
-        }
-
-        ExecutorService executorService = Executors.newFixedThreadPool(5);
-        list.forEach(cutFrameTask -> {
-            executorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                    //获取广告计划信息数据
-                    materialCutFrameService.loadCosCutFrame(cutFrameTask.getJobId(), cutFrameTask.getVideoSignature());
-                    }catch (Exception e){
-                        log.error(e.getMessage());
-                        e.printStackTrace();
-                    }
-                }
-            });
-        });
-
-        return result;
-    }
-
-
-
 }

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

@@ -0,0 +1,64 @@
+package org.jeecg.modules.ctop.controller;
+
+import cn.com.ctop.common.module.material.entity.MaterialVideoAuthor;
+import cn.com.ctop.common.module.material.service.IMaterialVideoAuthorService;
+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;
+
+
+/**
+ * 视频素材作者信息
+ */
+@Slf4j
+@RestController
+@RequestMapping("/com.cn/materialVideoAuthor")
+public class MaterialVideoAuthorController {
+	@Autowired
+	private IMaterialVideoAuthorService materialVideoAuthorService;
+
+	/**
+     * 分页列表查询
+	 */
+	@GetMapping(value = "/list")
+	public Result<IPage<MaterialVideoAuthor>> queryPageList(MaterialVideoAuthor materialVideoAuthor,
+                                                            @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+                                                            @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+                                                            HttpServletRequest req) {
+		Result<IPage<MaterialVideoAuthor>> result = new Result<>();
+		QueryWrapper<MaterialVideoAuthor> queryWrapper = QueryGenerator.initQueryWrapper(materialVideoAuthor, req.getParameterMap());
+		Page<MaterialVideoAuthor> page = new Page<>(pageNo, pageSize);
+		IPage<MaterialVideoAuthor> pageList = materialVideoAuthorService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+     *  编辑
+	 */
+	@PostMapping(value = "/edit")
+	public Result<MaterialVideoAuthor> edit(@RequestBody MaterialVideoAuthor materialVideoAuthor) {
+		Result<MaterialVideoAuthor> result = new Result<MaterialVideoAuthor>();
+		MaterialVideoAuthor materialVideoAuthorEntity = materialVideoAuthorService.getById(materialVideoAuthor.getId());
+		if(materialVideoAuthorEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = materialVideoAuthorService.updateById(materialVideoAuthor);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+
+}

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

@@ -0,0 +1,113 @@
+package org.jeecg.modules.ctop.controller;
+
+import java.util.Arrays;
+
+import javax.servlet.http.HttpServletRequest;
+
+import cn.com.ctop.common.module.material.entity.MaterialVideoCover;
+import cn.com.ctop.common.module.material.service.IMaterialVideoCoverService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+
+import lombok.extern.slf4j.Slf4j;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import io.swagger.annotations.ApiOperation;
+
+ /**
+ * 视频素材封面信息
+ */
+@Slf4j
+@RestController
+@RequestMapping("/com.cn/materialVideoCover")
+public class MaterialVideoCoverController {
+
+	@Autowired
+	private IMaterialVideoCoverService materialVideoCoverService;
+
+	/**
+	 * 分页列表查询
+	 */
+	@GetMapping(value = "/list")
+	public Result<IPage<MaterialVideoCover>> queryPageList(MaterialVideoCover materialVideoCover,
+														   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+														   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+														   HttpServletRequest req) {
+		Result<IPage<MaterialVideoCover>> result = new Result<>();
+		QueryWrapper<MaterialVideoCover> queryWrapper = QueryGenerator.initQueryWrapper(materialVideoCover, req.getParameterMap());
+		Page<MaterialVideoCover> page = new Page<>(pageNo, pageSize);
+		IPage<MaterialVideoCover> pageList = materialVideoCoverService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	 *  编辑
+	 */
+	@PostMapping(value = "/edit")
+	public Result<MaterialVideoCover> edit(@RequestBody MaterialVideoCover materialVideoCover) {
+		Result<MaterialVideoCover> result = new Result<MaterialVideoCover>();
+		MaterialVideoCover materialVideoCoverEntity = materialVideoCoverService.getById(materialVideoCover.getId());
+		if(materialVideoCoverEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = materialVideoCoverService.updateById(materialVideoCover);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+		return result;
+	}
+
+	/**
+	 *   通过id删除
+	 */
+	@PostMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+		try {
+			materialVideoCoverService.removeById(id);
+		} catch (Exception e) {
+			log.error("删除失败",e.getMessage());
+			return Result.error("删除失败!");
+		}
+		return Result.ok("删除成功!");
+	}
+
+	/**
+	 *  批量删除
+	 */
+	@ApiOperation(value="视频素材封面信息-批量删除", notes="视频素材封面信息-批量删除")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<MaterialVideoCover> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<MaterialVideoCover> result = new Result<>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.materialVideoCoverService.removeByIds(Arrays.asList(ids.split(",")));
+			result.success("删除成功!");
+		}
+		return result;
+	}
+
+	/**
+	 * 通过id查询
+	 */
+	@GetMapping(value = "/queryById")
+	public Result<MaterialVideoCover> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<MaterialVideoCover> result = new Result<>();
+		MaterialVideoCover materialVideoCover = materialVideoCoverService.getById(id);
+		if(materialVideoCover==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(materialVideoCover);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+}

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

@@ -0,0 +1,96 @@
+package org.jeecg.modules.ctop.controller;
+
+import javax.servlet.http.HttpServletRequest;
+
+import cn.com.ctop.common.module.material.entity.MaterialVideoFrame;
+import cn.com.ctop.common.module.material.service.IMaterialVideoFrameService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+
+import lombok.extern.slf4j.Slf4j;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+ /**
+ * 视频素材截帧信息
+ */
+@Slf4j
+@RestController
+@RequestMapping("/com.cn/materialVideoFrame")
+public class MaterialVideoFrameController {
+	@Autowired
+	private IMaterialVideoFrameService materialVideoFrameService;
+
+	/**
+	  * 分页列表查询
+	 */
+	@GetMapping(value = "/list")
+	public Result<IPage<MaterialVideoFrame>> queryPageList(MaterialVideoFrame materialVideoFrame,
+														   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+														   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+														   HttpServletRequest req) {
+		Result<IPage<MaterialVideoFrame>> result = new Result<>();
+		QueryWrapper<MaterialVideoFrame> queryWrapper = QueryGenerator.initQueryWrapper(materialVideoFrame, req.getParameterMap());
+		Page<MaterialVideoFrame> page = new Page<>(pageNo, pageSize);
+		IPage<MaterialVideoFrame> pageList = materialVideoFrameService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	 *   添加
+	 */
+	@PostMapping(value = "/add")
+	public Result<MaterialVideoFrame> add(@RequestBody MaterialVideoFrame materialVideoFrame) {
+		Result<MaterialVideoFrame> result = new Result<>();
+		try {
+			materialVideoFrameService.save(materialVideoFrame);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	 *  编辑
+	 */
+	@PutMapping(value = "/edit")
+	public Result<MaterialVideoFrame> edit(@RequestBody MaterialVideoFrame materialVideoFrame) {
+		Result<MaterialVideoFrame> result = new Result<MaterialVideoFrame>();
+		MaterialVideoFrame materialVideoFrameEntity = materialVideoFrameService.getById(materialVideoFrame.getId());
+		if(materialVideoFrameEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = materialVideoFrameService.updateById(materialVideoFrame);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+
+	/**
+	 * 通过id查
+	 */
+	@GetMapping(value = "/queryById")
+	public Result<MaterialVideoFrame> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<MaterialVideoFrame> result = new Result<>();
+		MaterialVideoFrame materialVideoFrame = materialVideoFrameService.getById(id);
+		if(materialVideoFrame==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(materialVideoFrame);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+}

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

@@ -0,0 +1,80 @@
+package org.jeecg.modules.ctop.controller;
+
+import javax.servlet.http.HttpServletRequest;
+
+import cn.com.ctop.common.module.material.entity.MaterialVideoInfo;
+import cn.com.ctop.common.module.material.service.IMaterialVideoInfoService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+
+import lombok.extern.slf4j.Slf4j;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+ /**
+ * 视频素材基础信息
+ */
+@Slf4j
+@RestController
+@RequestMapping("/com.cn/materialVideoInfo")
+public class MaterialVideoInfoController {
+	@Autowired
+	private IMaterialVideoInfoService materialVideoInfoService;
+
+	/**
+	  * 分页列表查询
+	 */
+	@GetMapping(value = "/list")
+	public Result<IPage<MaterialVideoInfo>> queryPageList(MaterialVideoInfo materialVideoInfo,
+														  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+														  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+														  HttpServletRequest req) {
+		Result<IPage<MaterialVideoInfo>> result = new Result<>();
+		QueryWrapper<MaterialVideoInfo> queryWrapper = QueryGenerator.initQueryWrapper(materialVideoInfo, req.getParameterMap());
+		Page<MaterialVideoInfo> page = new Page(pageNo, pageSize);
+		IPage<MaterialVideoInfo> pageList = materialVideoInfoService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	 *   添加
+	 */
+	@PostMapping(value = "/add")
+	public Result<MaterialVideoInfo> add(@RequestBody MaterialVideoInfo materialVideoInfo) {
+		Result<MaterialVideoInfo> result = new Result<>();
+		try {
+			materialVideoInfoService.save(materialVideoInfo);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	  *  编辑
+	 */
+	@PutMapping(value = "/edit")
+	public Result<MaterialVideoInfo> edit(@RequestBody MaterialVideoInfo materialVideoInfo) {
+		Result<MaterialVideoInfo> result = new Result<MaterialVideoInfo>();
+		MaterialVideoInfo materialVideoInfoEntity = materialVideoInfoService.getById(materialVideoInfo.getId());
+		if(materialVideoInfoEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = materialVideoInfoService.updateById(materialVideoInfo);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+
+}

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

@@ -0,0 +1,84 @@
+package org.jeecg.modules.ctop.controller;
+
+import javax.servlet.http.HttpServletRequest;
+
+import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.common.module.material.entity.MaterialVideoProject;
+import cn.com.ctop.common.module.material.service.IMaterialVideoProjectService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+
+import lombok.extern.slf4j.Slf4j;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import io.swagger.annotations.ApiOperation;
+
+ /**
+ * 视频素材关联项目信息
+ */
+@Slf4j
+@RestController
+@RequestMapping("/com.cn/materialVideoProject")
+public class MaterialVideoProjectController {
+
+	@Autowired
+	private IMaterialVideoProjectService materialVideoProjectService;
+
+	/**
+	  * 分页列表查询
+	 */
+	@GetMapping(value = "/list")
+	public Result<IPage<MaterialVideoProject>> queryPageList(MaterialVideoProject materialVideoProject,
+															 @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+															 @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+															 HttpServletRequest req) {
+		Result<IPage<MaterialVideoProject>> result = new Result<>();
+		QueryWrapper<MaterialVideoProject> queryWrapper = QueryGenerator.initQueryWrapper(materialVideoProject, req.getParameterMap());
+		Page<MaterialVideoProject> page = new Page<>(pageNo, pageSize);
+		IPage<MaterialVideoProject> pageList = materialVideoProjectService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	 *   添加
+	 */
+	@AutoLog(value = "视频素材关联项目信息-添加")
+	@ApiOperation(value="视频素材关联项目信息-添加", notes="视频素材关联项目信息-添加")
+	@PostMapping(value = "/add")
+	public Result<MaterialVideoProject> add(@RequestBody MaterialVideoProject materialVideoProject) {
+		Result<MaterialVideoProject> result = new Result<>();
+		try {
+			materialVideoProjectService.save(materialVideoProject);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	  *  编辑
+	 */
+	@PutMapping(value = "/edit")
+	public Result<MaterialVideoProject> edit(@RequestBody MaterialVideoProject materialVideoProject) {
+		Result<MaterialVideoProject> result = new Result<MaterialVideoProject>();
+		MaterialVideoProject materialVideoProjectEntity = materialVideoProjectService.getById(materialVideoProject.getId());
+		if(materialVideoProjectEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = materialVideoProjectService.updateById(materialVideoProject);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+}

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

@@ -0,0 +1,62 @@
+package org.jeecg.modules.ctop.controller;
+
+import javax.servlet.http.HttpServletRequest;
+
+import cn.com.ctop.common.module.material.entity.MaterialVideoWatermark;
+import cn.com.ctop.common.module.material.service.IMaterialVideoWatermarkService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+
+import lombok.extern.slf4j.Slf4j;
+
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+ /**
+ * 视频素材水印信息
+ */
+@Slf4j
+@RestController
+@RequestMapping("/com.cn/materialVideoWatermark")
+public class MaterialVideoWatermarkController {
+	@Autowired
+	private IMaterialVideoWatermarkService materialVideoWatermarkService;
+
+	/**
+	  * 分页列表查询
+	 */
+	@GetMapping(value = "/list")
+	public Result<IPage<MaterialVideoWatermark>> queryPageList(MaterialVideoWatermark materialVideoWatermark,
+															   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+															   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+															   HttpServletRequest req) {
+		Result<IPage<MaterialVideoWatermark>> result = new Result<>();
+		QueryWrapper<MaterialVideoWatermark> queryWrapper = QueryGenerator.initQueryWrapper(materialVideoWatermark, req.getParameterMap());
+		Page<MaterialVideoWatermark> page = new Page<>(pageNo, pageSize);
+		IPage<MaterialVideoWatermark> pageList = materialVideoWatermarkService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	 *   添加
+	 */
+	@PostMapping(value = "/add")
+	public Result<MaterialVideoWatermark> add(@RequestBody MaterialVideoWatermark materialVideoWatermark) {
+		Result<MaterialVideoWatermark> result = new Result<>();
+		try {
+			materialVideoWatermarkService.save(materialVideoWatermark);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+}

+ 4 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/controller/DesignerCommitProcessCtrl.java

@@ -6,6 +6,7 @@ import org.jeecg.modules.orderplatform.entity.PlatformMaterial;
 import org.jeecg.modules.orderplatform.entity.PlatformOrder;
 import org.jeecg.modules.orderplatform.service.IPlatformMaterialService;
 import org.jeecg.modules.orderplatform.service.IPlatformOrderService;
+import org.jeecg.modules.orderplatform.util.ApprovalNodeNoticeHandler;
 import org.jeecg.modules.orderplatform.util.OperateRecordHandler;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -28,6 +29,9 @@ DesignerCommitProcessCtrl {
     @Autowired
     private OperateRecordHandler operateRecordHandler;
 
+    @Autowired
+    private ApprovalNodeNoticeHandler approvalNodeNoticeHandler;
+
     /**
      * 设计组长接单,根据订单中的物料数量按类型发起物料审批流程
      */

+ 4 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/controller/OperatorApprovalProcessCtrl.java

@@ -4,6 +4,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.orderplatform.entity.PlatformOrder;
 import org.jeecg.modules.orderplatform.service.IPlatformOrderService;
+import org.jeecg.modules.orderplatform.util.ApprovalNodeNoticeHandler;
 import org.jeecg.modules.orderplatform.util.OperateRecordHandler;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -24,6 +25,9 @@ public class OperatorApprovalProcessCtrl {
     @Autowired
     private OperateRecordHandler operateRecordHandler;
 
+    @Autowired
+    private ApprovalNodeNoticeHandler approvalNodeNoticeHandler;
+
     /**
      * 运营下单
      */

+ 40 - 6
jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/controller/PlatformFileCtrl.java

@@ -1,8 +1,8 @@
 package org.jeecg.modules.orderplatform.controller;
 
-import cn.com.ctop.common.module.service.IMaterialInfoService;
 import cn.com.ctop.common.module.utils.CosUtils;
 import com.alibaba.fastjson.JSONObject;
+import com.xxl.job.core.biz.model.ReturnT;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
@@ -10,6 +10,7 @@ import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.orderplatform.entity.PlatformMaterial;
 import org.jeecg.modules.orderplatform.service.IPlatformMaterialService;
+import org.jeecg.modules.orderplatform.service.IPlatformVideoService;
 import org.jeecg.modules.orderplatform.util.OperateRecordHandler;
 import org.jeecg.modules.wps.entity.WpsFile;
 import org.jeecg.modules.wps.service.IWpsFileService;
@@ -31,10 +32,10 @@ import java.util.Map;
 public class PlatformFileCtrl {
 
     @Autowired
-    private IWpsFileService wpsFileService;
+    private IPlatformVideoService platformVideoService;
 
     @Autowired
-    private IMaterialInfoService materialInfoService;
+    private IWpsFileService wpsFileService;
 
     @Autowired
     private IPlatformMaterialService platformMaterialService;
@@ -110,8 +111,8 @@ public class PlatformFileCtrl {
      * 剪辑上传视频
      * Todo 在下单制正式上线后,这个接口会改造
      */
-    @PostMapping("/uploadVideo")
-    public Result<Object> uploadVideo(@RequestBody JSONObject requestBody) {
+/*    @PostMapping("/uploadVideo")
+    public Result<Object> uploadVideoOld(@RequestBody JSONObject requestBody) {
         Result<Object> result = new Result<>();
         String videoId = materialInfoService.platformUploadVideo(requestBody);
         if (videoId.isEmpty()) {
@@ -130,6 +131,39 @@ public class PlatformFileCtrl {
             }
         }
         return result;
-    }
+    }*/
 
+    /*
+     * 改造上传视频接口,视频上传后会存在下单制视频列表,审核通过后会被写入汇创思拓素材库ctop_material_video_info
+     * 下单制视频列表不会有删除操作,被驳回后标记逻辑删除
+     *  审批通过后视频关联信息被写入ctop_material_video_project、ctop_material_video_author、ctop_material_video_frame
+     *  ctop_material_video_cover、ctop_material_video_tag、ctop_material_video_watermark
+     */
+    @PostMapping("/uploadVideo")
+    public Result<Object> uploadVideo(@RequestBody JSONObject requestBody){
+        Result<Object> result = new Result<>();
+        //同一个视频不能出现在不同的物料下
+        int repeat=platformMaterialService.queryCountByMaterialAndVideo(requestBody.getString("materialCode"),requestBody.getString("md5"));
+        if(repeat>0){
+            result.error500("视频已被其他物料上传,请重新选择视频");
+            return result;
+        }
+        String videoMd5 = platformVideoService.uploadVideo(requestBody);
+        if(videoMd5.isEmpty()){
+            result.error500("素材视频上传失败,参数为空");
+        }else {
+            //物料状态->视频已上传,待审核
+            PlatformMaterial platformMaterial = new PlatformMaterial();
+            platformMaterial.setId(requestBody.getLong("materialId"));
+            platformMaterial.setMaterialStatus(5);
+            platformMaterial.setVideoStatus(1);
+            platformMaterial.setVideoId(videoMd5);
+            boolean save = platformMaterialService.updateById(platformMaterial);
+            if (save) {
+                operateRecordHandler.Submit(platformMaterialService.getById(requestBody.getString("materialId")).getMaterialCode(), "VIDEO");
+                result.success("素材视频上传成功");
+            }
+        }
+        return result;
+    }
 }

+ 63 - 10
jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/controller/PlatformMaterialCtrl.java

@@ -7,6 +7,7 @@ import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.orderplatform.entity.PlatformMaterial;
+import org.jeecg.modules.orderplatform.entity.PlatformScript;
 import org.jeecg.modules.orderplatform.service.IPlatformMaterialService;
 import org.jeecg.modules.orderplatform.service.IPlatformOrderService;
 import org.jeecg.modules.orderplatform.util.DictHandler;
@@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 物料审批流程
@@ -42,14 +44,14 @@ public class PlatformMaterialCtrl {
      */
     @GetMapping(value = "/listByOrderCode")
     public Result<PageInfo<PlatformMaterial>> listByOrderCode(PlatformMaterial platformMaterial,
-                                                         @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
-                                                         @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
-                                                         HttpServletRequest req) {
+                                                              @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                              @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                              HttpServletRequest req) {
         Result<PageInfo<PlatformMaterial>> result = new Result<>();
         QueryWrapper<PlatformMaterial> queryWrapper = new QueryWrapper<>();
         queryWrapper.setEntity(platformMaterial);
-        PageHelper.startPage(pageNo,pageSize);
-        List<PlatformMaterial> platformMaterialList= platformMaterialService.list(queryWrapper);
+        PageHelper.startPage(pageNo, pageSize);
+        List<PlatformMaterial> platformMaterialList = platformMaterialService.list(queryWrapper);
         result.setSuccess(true);
         result.setResult(new PageInfo<>(dictHandler.dictHandlerMaterial(platformMaterialList)));
         return result;
@@ -86,6 +88,22 @@ public class PlatformMaterialCtrl {
         return result;
     }
 
+    /**
+     * 脚本是否可更新
+     */
+    @GetMapping(value = "/verifyScript")
+    public Result<Object> verifyScript(String materialCode, String scriptId) {
+        Result<Object> result = new Result<>();
+        QueryWrapper<PlatformMaterial> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("material_code", materialCode);
+        PlatformMaterial platformMaterial = platformMaterialService.getOne(queryWrapper);
+        if (platformMaterial.getScriptId().equals(scriptId)) {
+            result.setSuccess(true);
+        } else {
+            result.error500("脚本信息已被更改,请刷新后操作");
+        }
+        return result;
+    }
 
     /**
      * 运营审核脚本
@@ -99,7 +117,7 @@ public class PlatformMaterialCtrl {
         platformMaterial.setVideoStatus(0);
         boolean ok = platformMaterialService.updateById(platformMaterial);
         if (ok) {
-            operateRecordHandler.Approval(platformMaterial.getMaterialCode(),"ACCEPT_SCRIPT");
+            operateRecordHandler.Approval(platformMaterial.getMaterialCode(), "ACCEPT_SCRIPT");
             result.success("脚本审核通过!");
         } else {
             result.error500("脚本审核失败!请联系管理员");
@@ -116,7 +134,7 @@ public class PlatformMaterialCtrl {
         platformMaterial.setScriptStatus(2);
         boolean ok = platformMaterialService.updateById(platformMaterial);
         if (ok) {
-            operateRecordHandler.Approval(platformMaterial.getMaterialCode(),"REJECT_SCRIPT");
+            operateRecordHandler.Approval(platformMaterial.getMaterialCode(), "REJECT_SCRIPT");
             result.success("脚本已驳回!");
         } else {
             result.error500("脚本驳回失败!请联系管理员");
@@ -137,11 +155,34 @@ public class PlatformMaterialCtrl {
     }
 
     /**
+     * 视频是否可以更新
+     */
+    @GetMapping(value = "/verifyVideo")
+    public Result<Object> verifyVideo(String materialCode, String videoId) {
+        Result<Object> result = new Result<>();
+        QueryWrapper<PlatformMaterial> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("material_code", materialCode);
+        PlatformMaterial platformMaterial = platformMaterialService.getOne(queryWrapper);
+        if (platformMaterial.getVideoId().equals(videoId)) {
+            result.setSuccess(true);
+        } else {
+            result.error500("视频信息已被更改,请刷新后操作");
+        }
+        return result;
+    }
+
+    /**
      * 运营审核视频
      */
     @PostMapping(value = "/video/accept")
     public Result<Object> acceptVideo(@RequestBody PlatformMaterial platformMaterial) {
         Result<Object> result = new Result<>();
+        //视频通过同步到素材库
+        boolean sync = platformMaterialService.syncVideo2CTopMaterial(platformMaterial);
+        if (!sync) {
+            result.error500("视频同步素材库失败");
+            return result;
+        }
         //物料状态->视频审核通过
         platformMaterial.setMaterialStatus(7);
         platformMaterial.setVideoStatus(3);
@@ -150,9 +191,9 @@ public class PlatformMaterialCtrl {
             //更新订单的素材完成数
             boolean order = platformOrderService.updateOrderFinishAmount(platformMaterial.getOrderCode());
             if (order) {
-                operateRecordHandler.Approval(platformMaterial.getMaterialCode(),"ACCEPT_VIDEO");
+                operateRecordHandler.Approval(platformMaterial.getMaterialCode(), "ACCEPT_VIDEO");
                 //修改素材库审核状态
-                platformMaterialService.updateMaterialStatusById(platformMaterial.getVideoId());
+                //platformMaterialService.updateMaterialStatusById(platformMaterial.getVideoId());
                 result.success("视频审核通过!");
             }
         } else {
@@ -170,7 +211,7 @@ public class PlatformMaterialCtrl {
         platformMaterial.setVideoStatus(2);
         boolean ok = platformMaterialService.updateById(platformMaterial);
         if (ok) {
-            operateRecordHandler.Approval(platformMaterial.getMaterialCode(),"REJECT_VIDEO");
+            operateRecordHandler.Approval(platformMaterial.getMaterialCode(), "REJECT_VIDEO");
             result.success("视频已驳回!");
         } else {
             result.error500("视频驳回失败!请联系管理员");
@@ -190,4 +231,16 @@ public class PlatformMaterialCtrl {
         return result;
     }
 
+    /**
+     * 视频修改回显
+     */
+    @GetMapping(value = "/videoEcho")
+    public Result<Map<String, Object>> videoEcho(String videoId) {
+        Result<Map<String, Object>> result = new Result<>();
+        Map<String, Object> scriptDetail = platformMaterialService.videoEcho(videoId);
+        result.setResult(scriptDetail);
+        result.setSuccess(true);
+        return result;
+    }
+
 }

+ 124 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/controller/PlatformScriptController.java

@@ -0,0 +1,124 @@
+package org.jeecg.modules.orderplatform.controller;
+
+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.jeecg.modules.orderplatform.entity.PlatformScript;
+import org.jeecg.modules.orderplatform.service.IPlatformScriptService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Arrays;
+
+/**
+ * 下单平台关联脚本
+ */
+@Slf4j
+@RestController
+@RequestMapping("/com.cn/platformScript")
+public class PlatformScriptController {
+	@Autowired
+	private IPlatformScriptService platformScriptService;
+
+	/**
+	 * 分页列表查询
+	 */
+	@GetMapping(value = "/list")
+	public Result<IPage<PlatformScript>> queryPageList(PlatformScript platformScript,
+													   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+													   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+													   HttpServletRequest req) {
+		Result<IPage<PlatformScript>> result = new Result<>();
+		QueryWrapper<PlatformScript> queryWrapper = QueryGenerator.initQueryWrapper(platformScript, req.getParameterMap());
+		Page<PlatformScript> page = new Page<>(pageNo, pageSize);
+		IPage<PlatformScript> pageList = platformScriptService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	 *   添加
+	 */
+	@PostMapping(value = "/add")
+	public Result<PlatformScript> add(@RequestBody PlatformScript platformScript) {
+		Result<PlatformScript> result = new Result<>();
+		try {
+			platformScriptService.save(platformScript);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	 *  编辑
+	 */
+	@PostMapping(value = "/edit")
+	public Result<PlatformScript> edit(@RequestBody PlatformScript platformScript) {
+		Result<PlatformScript> result = new Result<PlatformScript>();
+		PlatformScript platformScriptEntity = platformScriptService.getById(platformScript.getId());
+		if(platformScriptEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = platformScriptService.updateById(platformScript);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+
+	/**
+	 * 通过id删除
+	 */
+	@PostMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+		try {
+			platformScriptService.removeById(id);
+		} catch (Exception e) {
+			log.error("删除失败",e.getMessage());
+			return Result.error("删除失败!");
+		}
+		return Result.ok("删除成功!");
+	}
+
+	/**
+	 *  批量删除
+	 */
+	@PostMapping(value = "/deleteBatch")
+	public Result<PlatformScript> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<PlatformScript> result = new Result<>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.platformScriptService.removeByIds(Arrays.asList(ids.split(",")));
+			result.success("删除成功!");
+		}
+		return result;
+	}
+
+	/**
+	 * 通过id查询
+	 */
+	@GetMapping(value = "/queryById")
+	public Result<PlatformScript> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<PlatformScript> result = new Result<>();
+		PlatformScript platformScript = platformScriptService.getById(id);
+		if(platformScript==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(platformScript);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+}

+ 76 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/controller/PlatformVideoController.java

@@ -0,0 +1,76 @@
+package org.jeecg.modules.orderplatform.controller;
+
+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.jeecg.modules.orderplatform.entity.PlatformVideo;
+import org.jeecg.modules.orderplatform.service.IPlatformVideoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Arrays;
+
+/**
+  * 下单平台关联视频
+  */
+@Slf4j
+@RestController
+@RequestMapping("/platformVideo")
+public class PlatformVideoController {
+
+	@Autowired
+	private IPlatformVideoService platformVideoService;
+
+	@PostMapping(value = "/updateVideo")
+	public Result<PlatformVideo> add(@RequestBody PlatformVideo platformVideo) {
+		Result<PlatformVideo> result = new Result<>();
+		try {
+			platformVideoService.save(platformVideo);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+
+	/**
+	 *  通过id删除
+	 */
+	@DeleteMapping(value = "/delete")
+	public Result<?> delete(@RequestParam Integer id) {
+		try {
+			PlatformVideo  platformVideo=new PlatformVideo();
+			platformVideo.setId(id);
+			platformVideo.setIsDelete(1);
+			boolean result = platformVideoService.updateById(platformVideo);
+		} catch (Exception e) {
+			log.error("删除失败",e.getMessage());
+			return Result.error("删除失败!");
+		}
+		return Result.ok("删除成功!");
+	}
+
+
+	/**
+	 * 通过id查询
+	 */
+	@GetMapping(value = "/queryById")
+	public Result<PlatformVideo> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<PlatformVideo> result = new Result<>();
+		PlatformVideo platformVideo = platformVideoService.getById(id);
+		if(platformVideo==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(platformVideo);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+}

+ 41 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/entity/PlatformScript.java

@@ -0,0 +1,41 @@
+package org.jeecg.modules.orderplatform.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+
+/**
+ * 下单平台关联脚本
+ */
+@Data
+@TableName("ctop_platform_script")
+public class PlatformScript {
+    
+	/**id*/
+	@TableId(type = IdType.AUTO)
+	private String id;
+	/**name*/
+	private String name;
+	/**version*/
+	private Integer version;
+	/**size*/
+	private Integer size;
+	/**creator*/
+	private String creator;
+	/**createTime*/
+	private Integer createTime;
+	/**modifier*/
+	private String modifier;
+	/**modifyTime*/
+	private Integer modifyTime;
+	/**downloadUrl*/
+	private Object downloadUrl;
+	/**projectId*/
+	private Integer projectId;
+	/**deleted*/
+	private String deleted;
+	/**canDelete*/
+	private String canDelete;
+}

+ 46 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/entity/PlatformVideo.java

@@ -0,0 +1,46 @@
+package org.jeecg.modules.orderplatform.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 下单平台关联视频
+ */
+@Data
+@TableName("ctop_platform_video")
+public class PlatformVideo {
+    
+	/**id*/
+	@TableId(type = IdType.AUTO)
+	private Integer id;
+	/**物料code*/
+	private String materialCode;
+	/**物料code*/
+	private String name;
+	/**视频md5*/
+	private String md5;
+	/**视频url*/
+	private String url;
+	/**封面url*/
+	private String coverUrl;
+	/**视频描述*/
+	private String description;
+	/**格式*/
+	private String format;
+	/**时长(秒)*/
+	private Integer duration;
+	/**大小(kb)*/
+	private Integer size;
+	/**高*/
+	private Integer height;
+	/**宽*/
+	private Integer width;
+	/**是否已删除*/
+	private Integer isDelete;
+	/**createTime*/
+	private Date createTime;
+}

+ 6 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/mapper/PlatformMaterialMapper.java

@@ -18,13 +18,17 @@ public interface PlatformMaterialMapper extends BaseMapper<PlatformMaterial> {
 
     List<JSONObject> queryMaterialsByDesignUserId(@Param("materialStatus") JSONArray materialStatus, @Param("designUserId") String designUserId);
 
-    //指派的物料
+    //指派的物料
     List<JSONObject> queryMaterialsByDesignLeader(@Param("materialStatus") JSONArray materialStatus, @Param("designLeader") String designLeader);
 
     List<JSONObject> queryMaterialsByOperatorUserId(@Param("operatorUserId") String designUserId);
 
     JSONObject queryScriptDetailById(@Param("scriptId") String scriptId);
 
-    JSONObject queryVideoDetailById(@Param("videoId") String videoId);
+    JSONObject queryVideoDetailById(@Param("md5") String md5);
+
+    PlatformMaterial queryByCode(@Param("materialCode") String materialCode);
+
+    int queryCountByMaterialAndVideo(@Param("materialCode") String materialCode,@Param("videoMd5") String videoMd5);
 
 }

+ 11 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/mapper/PlatformScriptMapper.java

@@ -0,0 +1,11 @@
+package org.jeecg.modules.orderplatform.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.orderplatform.entity.PlatformScript;
+
+/**
+ * 下单平台关联脚本
+ */
+public interface PlatformScriptMapper extends BaseMapper<PlatformScript> {
+
+}

+ 14 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/mapper/PlatformVideoMapper.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.orderplatform.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.orderplatform.entity.PlatformVideo;
+
+/**
+ * 下单平台关联
+ */
+public interface PlatformVideoMapper extends BaseMapper<PlatformVideo> {
+
+    int deleteByMd5(@Param("md5") String  md5);
+
+}

+ 34 - 16
jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/mapper/xml/PlatformMaterialMapper.xml

@@ -115,7 +115,7 @@
             t1.shot,
             (SELECT realname from sys_user where id=t1.shot) as shotName,
             t1.clip,
-            (SELECT realname from sys_user where id=t1.shot) as clipName,
+            (SELECT realname from sys_user where id=t1.clip) as clipName,
             t1.plan,
             (SELECT realname from sys_user where id=t1.plan) as planName
         FROM
@@ -144,25 +144,43 @@
 
     <select id="queryVideoDetailById" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-            t.code,
+            t.md5,
             t.url,
             t1.video_id as videoId,
             t1.video_status as videoStatus,
             t1.video_advise as videoAdvise,
-            t2.second,
-            t2.width,
-            t2.height,
-            t2.size,
-            (SELECT realname from sys_user where id=t3.clip_id limit 1) as clipName,
-            (SELECT realname from sys_user where id=t3.shot_id limit 1) as shotName,
-            (SELECT realname from sys_user where id=t3.plan_id limit 1) as planName,
-            (SELECT GROUP_CONCAT(tag_name) from ctop_material_tag_info where code=t.code) as tag,
-            (SELECT GROUP_CONCAT(url) from ctop_material_image_info where video_id=t.code) as imageUrl
+            t.duration,
+            t.width,
+            t.height,
+            t.size,
+            t1.project_id as projectId,
+            t1.clip,
+            t1.shot,
+            t1.plan,
+            (SELECT realname from sys_user where id=t1.clip limit 1) as clipName,
+            (SELECT realname from sys_user where id=t1.shot limit 1) as shotName,
+            (SELECT realname from sys_user where id=t1.plan limit 1) as planName,
+            (SELECT GROUP_CONCAT(tag_name) from ctop_material_tag_info where code=t.md5 and status=1) as tag,
+            (SELECT GROUP_CONCAT(url) from ctop_material_video_cover where video_md5=t.md5) as imageUrl
+        FROM
+            ctop_platform_video t
+                LEFT JOIN  ctop_platform_material t1 on t.md5=t1.video_id
+        where t.md5=#{md5}
+          and t.is_delete=0
+        limit 1
+    </select>
+
+    <select id="queryByCode" resultType="org.jeecg.modules.orderplatform.entity.PlatformMaterial">
+        select * from ctop_platform_material where material_code=#{materialCode}
+    </select>
+
+    <select id="queryCountByMaterialAndVideo" resultType="java.lang.Integer">
+        SELECT
+            count(id)
         FROM
-            ctop_material_info t
-                LEFT JOIN  ctop_platform_material t1 on t.id=t1.video_id
-                LEFT JOIN  ctop_material_parameter t2 ON t. CODE = t2.material_id
-                left join  ctop_material_ascription t3 on t.code=t3. material_id
-        where t.id=#{videoId}
+            ctop_platform_material
+        WHERE
+            material_code != #{materialCode}
+          AND video_id = #{videoMd5}
     </select>
 </mapper>

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/mapper/xml/PlatformScriptMapper.xml

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

+ 13 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/mapper/xml/PlatformVideoMapper.xml

@@ -0,0 +1,13 @@
+<?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.orderplatform.mapper.PlatformVideoMapper">
+
+    <update id="deleteByMd5" >
+        UPDATE
+            ctop_platform_video
+        SET is_delete = 1
+        WHERE
+            md5 = #{md5}
+    </update>
+
+</mapper>

+ 17 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/service/IPlatformMaterialService.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.orderplatform.entity.PlatformMaterial;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * 物料审批流程
@@ -36,8 +37,22 @@ public interface IPlatformMaterialService extends IService<PlatformMaterial> {
     JSONObject queryVideoDetailById(String videoId);
 
     /**
-     *  视频审核通过后修改素材库审核状态
+     *  查询上传视频是否出现在其他物料中
      */
-    void updateMaterialStatusById(String id);
+    int queryCountByMaterialAndVideo(String  materialCode, String videoMd5);
+    /**
+     *  同步视频到汇创素材库(包括关联的项目)
+     */
+    boolean syncVideo2CTopMaterial(PlatformMaterial platformMaterial);
+
+    /**
+     *  视频驳回编辑回显
+     */
+    Map<String,Object> videoEcho(String videoId);
+
+    /**
+     *  根据
+     */
+
 
 }

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

@@ -0,0 +1,11 @@
+package org.jeecg.modules.orderplatform.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.orderplatform.entity.PlatformScript;
+
+/**
+ *  下单平台关联脚本
+ */
+public interface IPlatformScriptService extends IService<PlatformScript> {
+
+}

+ 14 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/service/IPlatformVideoService.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.orderplatform.service;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.orderplatform.entity.PlatformVideo;
+
+/**
+ *  下单平台关联视频
+ */
+public interface IPlatformVideoService extends IService<PlatformVideo> {
+
+    String uploadVideo (JSONObject params);
+
+}

+ 160 - 13
jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/service/impl/PlatformMaterialServiceImpl.java

@@ -1,19 +1,32 @@
 package org.jeecg.modules.orderplatform.service.impl;
 
-import cn.com.ctop.common.module.entity.MaterialInfo;
-import cn.com.ctop.common.module.service.IMaterialInfoService;
+import cn.com.ctop.common.module.entity.MaterialTagInfo;
+import cn.com.ctop.common.module.material.entity.MaterialVideoAuthor;
+import cn.com.ctop.common.module.material.entity.MaterialVideoCover;
+import cn.com.ctop.common.module.material.entity.MaterialVideoInfo;
+import cn.com.ctop.common.module.material.entity.MaterialVideoProject;
+import cn.com.ctop.common.module.material.service.*;
+import cn.com.ctop.common.module.service.IMaterialCutFrameService;
+import cn.com.ctop.common.module.service.IMaterialTagInfoService;
+import cn.com.ctop.common.module.service.IProjectService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.jeecg.modules.orderplatform.entity.PlatformMaterial;
+import org.jeecg.modules.orderplatform.entity.PlatformVideo;
 import org.jeecg.modules.orderplatform.mapper.PlatformMaterialMapper;
 import org.jeecg.modules.orderplatform.service.IPlatformMaterialService;
+import org.jeecg.modules.orderplatform.service.IPlatformVideoService;
 import org.jeecg.modules.orderplatform.util.JsonArrayUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.net.URLDecoder;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 物料审批流程
@@ -25,16 +38,40 @@ public class PlatformMaterialServiceImpl extends ServiceImpl<PlatformMaterialMap
     PlatformMaterialMapper platformMaterialMapper;
 
     @Autowired
-    IMaterialInfoService materialInfoService;
+    IPlatformVideoService platformVideoService;
+
+    @Autowired
+    IMaterialVideoInfoService materialVideoInfoService;
+
+    @Autowired
+    IMaterialVideoCoverService materialVideoCoverService;
+
+    @Autowired
+    IMaterialTagInfoService materialTagInfoService;
+
+    @Autowired
+    IMaterialVideoAuthorService materialVideoAuthorService;
+
+    @Autowired
+    IMaterialVideoProjectService materialVideoProjectService;
+
+    @Autowired
+    IMaterialVideoFrameService materialVideoFrameService;
+
+    @Autowired
+    IMaterialCutFrameService materialCutFrameService;
+
+    @Autowired
+    IProjectService projectService;
 
     @Override
     public List<JSONObject> queryMaterialsByDesignUserId(String materialStatus, String designUserId) {
         JSONArray materialStatusJsonArray = JsonArrayUtil.Varchar2JSONArray(materialStatus);
-        List<JSONObject> result=new ArrayList<>();
-        if(materialStatus.equals("0")){
-            result=platformMaterialMapper.queryMaterialsByDesignLeader(materialStatusJsonArray,designUserId);
-        }else {
-            result=platformMaterialMapper.queryMaterialsByDesignUserId(materialStatusJsonArray, designUserId);
+        List<JSONObject> result = new ArrayList<>();
+        if (materialStatus.equals("0")) {
+            result = platformMaterialMapper.queryMaterialsByDesignLeader(materialStatusJsonArray, designUserId);
+        } else {
+            result = platformMaterialMapper.queryMaterialsByDesignUserId(materialStatusJsonArray, designUserId);
         }
         return result;
     }
@@ -55,10 +92,120 @@ public class PlatformMaterialServiceImpl extends ServiceImpl<PlatformMaterialMap
     }
 
     @Override
-    public void updateMaterialStatusById(String id) {
-        MaterialInfo materialInfo = new MaterialInfo();
-        materialInfo.setId(id);
-        materialInfo.setStatus(1);
-        materialInfoService.updateById(materialInfo);
+    public int queryCountByMaterialAndVideo(String materialCode, String videoMd5) {
+
+        return platformMaterialMapper.queryCountByMaterialAndVideo(materialCode, videoMd5);
+    }
+
+    @Override
+    public boolean syncVideo2CTopMaterial(PlatformMaterial platformMaterial) {
+        boolean result=false;
+        //step1: 查询下单制物料、视频信息
+        QueryWrapper<PlatformVideo> wrapperPV = new QueryWrapper<>();
+        wrapperPV.eq("md5", platformMaterial.getVideoId());
+        wrapperPV.eq("is_delete", 0);
+        PlatformVideo video = platformVideoService.getOne(wrapperPV);
+        //查询物料信息
+        QueryWrapper<PlatformMaterial> wrapper = new QueryWrapper<>();
+        wrapper.eq("material_code", platformMaterial.getMaterialCode());
+        platformMaterial= this.getOne(wrapper);
+        boolean mv = materialVideoInfoHandle(video, platformMaterial.getMaterialType(), projectService.getSupplierCodeById(platformMaterial.getProjectId()));
+        if(mv){
+            result = materialVideoCorrelateHandle(video.getMd5());
+            if(result){
+                //启动截帧
+                materialCutFrameHandle(video);
+            }
+        }else {
+            materialVideoInfoService.deleteByMd5(video.getMd5());
+        }
+        return result;
+    }
+
+    @Override
+    public Map<String, Object> videoEcho(String videoId) {
+        Map<String, Object> result = new HashMap<>();
+        QueryWrapper<PlatformVideo> wrapperPV = new QueryWrapper<>();
+        wrapperPV.eq("md5", videoId);
+        wrapperPV.eq("is_delete", 0);
+        result.put("video", platformVideoService.getOne(wrapperPV));
+        QueryWrapper<MaterialVideoCover> wrapperMVC = new QueryWrapper<>();
+        wrapperMVC.eq("video_md5", videoId);
+        result.put("covers", materialVideoCoverService.list(wrapperMVC));
+        MaterialTagInfo materialTagInfo = new MaterialTagInfo();
+        materialTagInfo.setCode(videoId);
+        materialTagInfo.setStatus(1);
+        result.put("tags", materialTagInfoService.getTagDetail(materialTagInfo));
+        return result;
+    }
+
+    /**
+     * 同步素材视频
+     */
+    private boolean materialVideoInfoHandle(PlatformVideo platformVideo, int materialType, String supplierCode) {
+
+        MaterialVideoInfo materialVideoInfo = new MaterialVideoInfo();
+        materialVideoInfo.setName(platformVideo.getName());
+        materialVideoInfo.setMd5(platformVideo.getMd5());
+        materialVideoInfo.setUrl(platformVideo.getUrl());
+        materialVideoInfo.setCoverUrl(platformVideo.getCoverUrl());
+        materialVideoInfo.setMaterialType(materialType);
+        materialVideoInfo.setSupplierCode(supplierCode);
+        materialVideoInfo.setDescription(platformVideo.getDescription());
+        materialVideoInfo.setFormat(platformVideo.getFormat());
+        materialVideoInfo.setDuration(platformVideo.getDuration());
+        materialVideoInfo.setSize(platformVideo.getSize());
+        materialVideoInfo.setHeight(platformVideo.getHeight());
+        materialVideoInfo.setWidth(platformVideo.getWidth());
+        //先验证是否有重复
+        materialVideoInfoService.deleteByMd5(platformVideo.getMd5());
+        //再同步视频
+        return materialVideoInfoService.save(materialVideoInfo);
+    }
+
+    /**
+     * 保存视频素材关联项目、作者信息
+     */
+    private boolean materialVideoCorrelateHandle(String videoMd5) {
+
+        JSONObject videoDetail = platformMaterialMapper.queryVideoDetailById(videoMd5);
+        //项目绑定
+        MaterialVideoProject materialVideoProject = new MaterialVideoProject();
+        materialVideoProject.setProjectId(videoDetail.getLong("projectId"));
+        materialVideoProject.setVideoMd5(videoMd5);
+        //作者信息绑定
+        MaterialVideoAuthor materialVideoAuthor = new MaterialVideoAuthor();
+        materialVideoAuthor.setVideoMd5(videoMd5);
+        materialVideoAuthor.setClipId(videoDetail.getString("clip"));
+        materialVideoAuthor.setClipName(videoDetail.getString("clipName"));
+        materialVideoAuthor.setShotId(videoDetail.getString("shot"));
+        materialVideoAuthor.setShotName(videoDetail.getString("shotName"));
+        materialVideoAuthor.setPlanId(videoDetail.getString("plan"));
+        materialVideoAuthor.setPlanName(videoDetail.getString("planName"));
+        materialVideoAuthor.setPlaneId(videoDetail.getString("plane"));
+        materialVideoAuthor.setPlaneName(videoDetail.getString("plane_name"));
+
+        return materialVideoProjectService.save(materialVideoProject) && materialVideoAuthorService.save(materialVideoAuthor);
+    }
+
+    /**
+     * 开启截帧任务
+     */
+    private void materialCutFrameHandle(PlatformVideo platformVideo) {
+        int cutFrame = materialVideoFrameService.getFrameCountByCode(platformVideo.getMd5());
+        if (cutFrame == 0) {
+            String videoUrl = URLDecoder.decode(platformVideo.getUrl()).replace("https://media-1301855440.cos.ap-chongqing.myqcloud.com/", "");
+            Thread thread = new Thread() {
+                @Override
+                public void run() {
+                    try {
+                        materialVideoFrameService.getTencentCutFrame(videoUrl, platformVideo.getMd5(), platformVideo.getCoverUrl());
+                    } catch (Exception e) {
+                        log.error("智能抽帧任务失败,视频md5:" + platformVideo.getMd5());
+                    }
+                }
+            };
+            thread.start();
+        }
     }
 }

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

@@ -55,7 +55,7 @@ public class PlatformOrderServiceImpl extends ServiceImpl<PlatformOrderMapper, P
         PlatformOrder platformOrder= this.getOne(queryWrapper);
         platformOrder.setMaterialFinishAmount(platformOrder.getMaterialFinishAmount()+1);
         platformOrder.setMaterialFinishTime(DateUtils.getDate());
-        if(platformOrder.getMaterialAmount()==platformOrder.getMaterialFinishAmount()+1){
+        if(platformOrder.getMaterialAmount().equals(platformOrder.getMaterialFinishAmount())){
             platformOrder.setOrderStatus(3);
             platformOrder.setOrderFinishTime(DateUtils.getDate());
         }

+ 15 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/service/impl/PlatformScriptServiceImpl.java

@@ -0,0 +1,15 @@
+package org.jeecg.modules.orderplatform.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.orderplatform.entity.PlatformScript;
+import org.jeecg.modules.orderplatform.mapper.PlatformScriptMapper;
+import org.jeecg.modules.orderplatform.service.IPlatformScriptService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 下单平台关联脚本
+ */
+@Service
+public class PlatformScriptServiceImpl extends ServiceImpl<PlatformScriptMapper, PlatformScript> implements IPlatformScriptService {
+
+}

+ 146 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/service/impl/PlatformVideoServiceImpl.java

@@ -0,0 +1,146 @@
+package org.jeecg.modules.orderplatform.service.impl;
+
+import cn.com.ctop.common.module.entity.*;
+import cn.com.ctop.common.module.material.entity.MaterialVideoCover;
+import cn.com.ctop.common.module.material.service.IMaterialVideoCoverService;
+import cn.com.ctop.common.module.service.IMaterialTagInfoService;
+import cn.com.ctop.common.module.service.ITagInfoService;
+import cn.com.ctop.common.module.utils.CloudVideoProcessUtil;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import org.jeecg.modules.orderplatform.entity.PlatformVideo;
+import org.jeecg.modules.orderplatform.mapper.PlatformMaterialMapper;
+import org.jeecg.modules.orderplatform.mapper.PlatformVideoMapper;
+import org.jeecg.modules.orderplatform.service.IPlatformVideoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.net.URLDecoder;
+import java.util.Map;
+
+
+/**
+ * 下单平台关联视频
+ */
+@Service
+public class PlatformVideoServiceImpl extends ServiceImpl<PlatformVideoMapper, PlatformVideo> implements IPlatformVideoService {
+
+    @Autowired
+    IMaterialVideoCoverService materialVideoCoverService;
+
+    @Autowired
+    IMaterialTagInfoService materialTagInfoService;
+
+    @Autowired
+    private ITagInfoService tagInfoService;
+
+    @Autowired
+    PlatformMaterialMapper platformMaterialMapper;
+
+    @Autowired
+    PlatformVideoMapper platformVideoMapper;
+
+    @Override
+    public String uploadVideo(JSONObject params) {
+        String md5 = params.getString("md5");
+        if (null == md5 || md5.isEmpty()) {
+            return "";
+        }
+        //入库下单制视频库
+        boolean result = videoHandle(params);
+        if (result) {
+            //封面入库
+            coverHandler(params);
+            //标签相关入库
+            tagHandler(params);
+            return md5;
+        }
+        return "";
+    }
+
+    /**
+     * 视频入库
+     */
+    private boolean videoHandle(JSONObject params) {
+
+        PlatformVideo platformVideo = new PlatformVideo();
+        //查询视频关联的物料信息
+        platformVideo.setMaterialCode(params.getString("materialCode"));
+        platformVideo.setName(params.getString("name"));
+        platformVideo.setMd5(params.getString("md5"));
+        platformVideo.setUrl(params.getString("url") == null ? "" : "https:" + params.getString("url"));
+        platformVideo.setCoverUrl(getFirstFrame(platformVideo.getUrl(), params.getString("md5")));
+        platformVideo.setDescription(params.getString("description"));
+        platformVideo.setFormat(params.getString("format"));
+        platformVideo.setDuration(params.getInteger("duration"));
+        platformVideo.setSize(params.getInteger("size"));
+        platformVideo.setHeight(params.getInteger("height"));
+        platformVideo.setWidth(params.getInteger("width"));
+
+        //查看是否已有
+        platformVideoMapper.deleteByMd5(params.getString("md5"));
+
+        return this.save(platformVideo);
+    }
+
+    /**
+     * 封面处理
+     */
+    private void coverHandler(JSONObject params) {
+        //删除以重复
+        materialVideoCoverService.deleteByVideoMd5(params.getString("md5"));
+        JSONArray covers = params.getJSONArray("covers");
+        String videoMd5 = params.getString("md5");
+        covers.forEach(cover -> {
+            insertCover((Map)cover, videoMd5);
+        });
+    }
+
+    private void insertCover(Map<String,Object> cover, String videoMd5) {
+        MaterialVideoCover materialVideoCover = new MaterialVideoCover();
+        materialVideoCover.setVideoMd5(videoMd5);
+        materialVideoCover.setName(cover.get("name").toString());
+        materialVideoCover.setMd5(cover.get("md5").toString());
+        materialVideoCover.setUrl(cover.get("url").toString());
+        materialVideoCover.setFormat(cover.get("format").toString());
+        materialVideoCover.setSize((int) cover.get("size"));
+        materialVideoCover.setHeight((int) cover.get("height"));
+        materialVideoCover.setWidth((int)cover.get("width"));
+        materialVideoCoverService.save(materialVideoCover);
+    }
+
+    /**
+     * 标签处理
+     */
+    private void tagHandler(JSONObject params) {
+        //处理标签。延续之前的逻辑,每次上传视频先删后加
+        materialTagInfoService.deleteByCode(params.getString("md5"));
+        insertTagList(params.getString("md5"), params.getString("userId"), params.getJSONArray("modalityTagList"));
+        insertTagList(params.getString("md5"), params.getString("userId"), params.getJSONArray("contentTagList"));
+        insertTagList(params.getString("md5"), params.getString("userId"), params.getJSONArray("senceTagList"));
+        insertTagList(params.getString("md5"), params.getString("userId"), params.getJSONArray("modTagList"));
+    }
+
+    private void insertTagList(String code, String userId, JSONArray tagList) {
+        if (null != tagList && !tagList.isEmpty()) {
+            for (int m = 0; m < tagList.size(); m++) {
+                Long tagId = tagList.getLong(m);
+                TagInfo tagInfo = tagInfoService.getById(tagId);
+                MaterialTagInfo setTag = new MaterialTagInfo(code, tagInfo, userId);
+                setTag.setCategoryId(tagInfo.getTagCategoryId());
+                materialTagInfoService.save(setTag);
+            }
+        }
+    }
+
+    /**
+     * 获取视频首帧封面
+     */
+    private String getFirstFrame(String initialUrl, String videoMd5) {
+        String decoderUrl = URLDecoder.decode(initialUrl).replace("https://media-1301855440.cos.ap-chongqing.myqcloud.com/", "");
+        String loadImage = "cutFrame/" + videoMd5 + "/zero.jpg";
+        return CloudVideoProcessUtil.videoCutPictureHandle(decoderUrl, loadImage);
+    }
+}

+ 94 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/orderplatform/util/ApprovalNodeNoticeHandler.java

@@ -0,0 +1,94 @@
+package org.jeecg.modules.orderplatform.util;
+
+import cn.com.ctop.common.module.mapper.MailLogMapper;
+import cn.com.ctop.common.module.utils.CorpWexinUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.modules.orderplatform.service.IPlatformMaterialService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+@Slf4j
+@Service
+public class ApprovalNodeNoticeHandler {
+
+    @Autowired
+    MailLogMapper mailLogMapper;
+
+    @Autowired
+    IPlatformMaterialService platformMaterialService;
+
+    /**
+     * 审批节点发送
+     */
+    public void notice(String operate, Set<String> acceptor) {
+        switch (operate) {
+            //设计组长接单,暂时不通知
+            case "ACCEPT_ORDER":
+                sendWeChat(acceptor, "您发起的订单接单成功");
+                break;
+            //设计组长驳回订单,通知下单运营订单已被驳回
+            case "REJECT_ORDER":
+                sendWeChat(acceptor, "您有订单被驳回,请前往汇创平台处理");
+                break;
+            //脚本审批通过,通知剪辑上传视频
+            case "ACCEPT_SCRIPT":
+                sendWeChat(acceptor, "有物料需要您上传视频,请前往汇创平台处理");
+                break;
+            //脚本被驳回,通知编导重新上传脚本
+            case "REJECT_SCRIPT":
+                sendWeChat(acceptor, "您上传的脚本被驳回,请前往汇创平台处理");
+                break;
+            //视频通过暂不通知
+            case "ACCEPT_VIDEO":
+                sendWeChat(acceptor, "审批通过了视频,请前往汇创平台处理");
+                break;
+            //视频被驳回,通知剪辑重新上传视频
+            case "REJECT_VIDEO":
+                sendWeChat(acceptor, "您上传的视频被驳回,请前往汇创平台处理");
+                break;
+            //运营下单,通知设计组长接单派单
+            case "PAYOUT":
+                sendWeChat(acceptor, "有一个订单需要您审批,请前往汇创平台处理");
+                break;
+            //设计上传脚本,通知运营审核
+            case "SCRIPT":
+                sendWeChat(acceptor, "有一个脚本需要您审批,请前往汇创平台处理");
+                break;
+            //设计上传视频,通知运营审核
+            case "VIDEO":
+                sendWeChat(acceptor, "有一个视频需要您审批,请前往汇创平台处理");
+                break;
+        }
+    }
+
+    /**
+     *  查询消息接收者
+     */
+    private Map<String, Map<String,String>> relatePerson(String orderCode,String materialCode){
+        Map<String,Map<String,String>> result= new HashMap<>();
+        if(materialCode.isEmpty()){
+
+        }else {
+
+        }
+        return result;
+    }
+    /**
+     *  发送通知消息到企业微信
+     */
+    private void sendWeChat(Set<String> users, String message) {
+        users.forEach(userId->{
+            String weChatId = mailLogMapper.getWChatIdByUserId(userId);
+            if (weChatId.isEmpty()) {
+                log.error(String.format("User WeChat not found. userId =%s", userId));
+                //TODO 通知管理员添加邮箱
+            } else {
+                CorpWexinUtils.sendMessageByWeChatId(weChatId, message);
+            }
+        });
+    }
+}

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

@@ -286,3 +286,7 @@ bytedance:
     ad-report-get: /2/report/ad/get/
     ad-creative-get: /2/report/creative/get/
     advertiser-fund-daily-stat: /2/advertiser/fund/daily_stat/
+ai:
+  callback:
+    callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
+    callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative

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

@@ -244,3 +244,7 @@ bytedance:
     ad-report-get: /2/report/ad/get/
     ad-creative-get: /2/report/creative/get/
     advertiser-fund-daily-stat: /2/advertiser/fund/daily_stat/
+ai:
+  callback:
+    callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
+    callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative

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

@@ -257,3 +257,7 @@ bytedance:
     ad-report-get: /2/report/ad/get/
     ad-creative-get: /2/report/creative/get/
     advertiser-fund-daily-stat: /2/advertiser/fund/daily_stat/
+ai:
+  callback:
+    callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
+    callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative

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

@@ -249,3 +249,7 @@ bytedance:
     ad-report-get: /2/report/ad/get/
     ad-creative-get: /2/report/creative/get/
     advertiser-fund-daily-stat: /2/advertiser/fund/daily_stat/
+ai:
+  callback:
+    callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
+    callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative

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

@@ -240,3 +240,7 @@ bytedance:
     ad-report-get: /2/report/ad/get/
     ad-creative-get: /2/report/creative/get/
     advertiser-fund-daily-stat: /2/advertiser/fund/daily_stat/
+ai:
+  callback:
+    callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
+    callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative

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

@@ -102,7 +102,7 @@ spring:
   #redis 配置
   redis:
     database: 0
-#    host: 172.30.0.17
+    #    host: 172.30.0.17
     host: 127.0.0.1
     lettuce:
       pool:
@@ -233,4 +233,8 @@ bytedance:
     ad-report-get: /2/report/ad/get/
     ad-creative-get: /2/report/creative/get/
     advertiser-fund-daily-stat: /2/advertiser/fund/daily_stat/
+ai:
+  callback:
+    callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
+    callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative
 

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

@@ -1,8 +1,8 @@
 #mysql
 diver_name=com.mysql.jdbc.Driver
-url=jdbc:mysql://139.186.27.96:4000/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-username=data
-password=hcst@2021
+url=jdbc:mysql://139.186.151.174:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+username=hcst
+password=hcst@2020
 database_name=jeecg-boot
 #oracle
 #diver_name=oracle.jdbc.driver.OracleDriver

+ 41 - 17
module-alarm/src/main/java/cn/com/ctop/alarm/modules/constant/MatchLogic.java

@@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j;
 
 import java.math.BigDecimal;
 import java.util.ArrayList;
+import java.util.Comparator;
 import java.util.List;
 
 /**
@@ -18,7 +19,6 @@ import java.util.List;
  */
 @Slf4j
 public class MatchLogic {
-
     /**
      * @param type      数据类型
      * @param condition 条件
@@ -28,7 +28,7 @@ public class MatchLogic {
      * @throws
      * @author ZHAOXA
      */
-    public static boolean matchCondition(JSONObject indicator, String condition, String threshold, String value, JSONObject obj) {
+    public static boolean matchCondition(JSONObject indicator, String condition, String threshold, String value, JSONObject obj, String indicatorCode) {
         //阈值数据类型类型
         String type = indicator.getString("dataType");
         try {
@@ -104,31 +104,39 @@ public class MatchLogic {
                  包含逻辑通用: 任一存在则报警
                  */
                 if (value.contains("[") && threshold.contains("[")) {
+                    String logicalType = indicator.getString("logicalType");
                     List<String> values = strToList(value);
                     List<String> thresholds = strToList(threshold);
                     //包含 任一存在则报警
                     if ("contain".equals(condition)) {
-                        for (String v : values) {
-                            if (threshold.contains(v)) {
-                                return true;
+                        //人群包、流量包判断的是对象
+                        if (NoEn.NO1.valueStr().equals(logicalType) || "retargetingTagsInclude".equals(indicatorCode) || "population".equals(indicatorCode) || "district".equals(indicatorCode) || "region".equals(indicatorCode)) {
+                            for (String thr : thresholds) {
+                                if (values.contains(thr)) {
+                                    return true;
+                                }
+                            }
+                        } else {
+                            for (String thr : thresholds) {
+                                if (values.toString().contains(thr)) {
+                                    return true;
+                                }
                             }
                         }
                     } else {
-                        String logicalType = indicator.getString("logicalType");
-                        //排除人群包、流量排除包逻辑
+                        //排除人群包、流量排除包逻辑,不包含,所选必须都存在,否则报警
                         if (NoEn.NO1.valueStr().equals(logicalType)) {
-                            //不包含,所选必须都存在,否则报警
                             if (values.size() != thresholds.size()) {
                                 return true;
                             }
-                            for (String v : values) {
-                                if (!threshold.contains(v)) {
-                                    return true;
-                                }
-                            }
+                            values.sort(Comparator.comparing(String::hashCode));
+                            thresholds.sort(Comparator.comparing(String::hashCode));
+                            return !values.toString().equals(thresholds.toString());
+
                         } else {
-                            boolean flag = true;
                             //不包含,阈值中,存在任一目标则不报警,都不存在时则报警,出现阈值之外的亦报警
+                            boolean flag = true;
+                            //人群包判断是否存在该对象
                             for (String v : values) {
                                 if (threshold.contains(v)) {
                                     flag = false;
@@ -139,15 +147,31 @@ public class MatchLogic {
                             return flag;
                         }
                     }
+                } else if (threshold.contains("[")) {
+                    List<String> thresholds = strToList(threshold);
+                    if ("contain".equals(condition)) {
+                        for (String thr : thresholds) {
+                            if (value.toString().contains(thr)) {
+                                return true;
+                            }
+                        }
+                    } else {
+                        for (String thr : thresholds) {
+                            if (!value.contains(thr)) {
+                                return true;
+                            }
+                        }
+                    }
                 } else {
                     if ("contain".equals(condition)) {
-                        return threshold.contains(value);
+                        return value.contains(threshold);
                     } else {
-                        return !threshold.contains(value);
+                        return !value.contains(threshold);
                     }
                 }
             }
-        } catch (Exception e) {
+        } catch (
+                Exception e) {
             log.error("条件匹配异常,入参为:type={},condition={},threshold={},value={},", type, condition, threshold, value, e);
         }
         return false;

+ 0 - 274
module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/AlarmEventRuleController.java

@@ -1,274 +0,0 @@
-package cn.com.ctop.alarm.modules.controller;
-
-import cn.com.ctop.alarm.modules.entity.AlarmEventRule;
-import cn.com.ctop.alarm.modules.service.IAlarmEventRuleService;
-import cn.com.ctop.common.module.annotation.AutoLog;
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.github.pagehelper.PageHelper;
-import com.github.pagehelper.PageInfo;
-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.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 预警事件规则表
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2020-10-29
- */
-@Slf4j
-@Api(tags = "预警事件规则表")
-@RestController
-@RequestMapping("/alarm/alarmEventRule")
-public class AlarmEventRuleController {
-    @Autowired
-    private IAlarmEventRuleService alarmEventRuleService;
-
-    /**
-     * 分页列表查询
-     *
-     * @param alarmEventRule
-     * @param pageNo
-     * @param pageSize
-     * @param req
-     * @return
-     */
-    @AutoLog(value = "预警事件规则表-分页列表查询")
-    @ApiOperation(value = "预警事件规则表-分页列表查询", notes = "预警事件规则表-分页列表查询")
-    @GetMapping(value = "/list")
-    public Result<PageInfo<AlarmEventRule>> queryPageList(AlarmEventRule alarmEventRule,
-                                                          @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
-                                                          @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
-                                                          HttpServletRequest req) {
-        Result<PageInfo<AlarmEventRule>> result = new Result<>();
-        PageHelper.startPage(pageNo, pageSize);
-        PageInfo<AlarmEventRule> pageList = alarmEventRuleService.selectListPage(alarmEventRule);
-        result.setSuccess(true);
-        result.setResult(pageList);
-        return result;
-    }
-
-    /**
-     * 分页列表查询
-     *
-     * @param alarmEventRule
-     * @param pageNo
-     * @param pageSize
-     * @param req
-     * @return
-     */
-    @AutoLog(value = "获取规则运行记录数据-分页列表查询")
-    @ApiOperation(value = "获取规则运行记录数据-分页列表查询", notes = "获取规则运行记录数据-分页列表查询")
-    @GetMapping(value = "/getRunningRecords")
-    public Result<PageInfo<AlarmEventRule>> getRunningRecord(AlarmEventRule alarmEventRule,
-                                                             @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
-                                                             @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
-                                                             HttpServletRequest req) {
-        Result<PageInfo<AlarmEventRule>> result = new Result<>();
-        PageHelper.startPage(pageNo, pageSize);
-        PageInfo<AlarmEventRule> pageList = alarmEventRuleService.queryRunningRecordPage(alarmEventRule);
-        result.setSuccess(true);
-        result.setResult(pageList);
-        return result;
-    }
-
-    /**
-     * 添加
-     *
-     * @param alarmEventRule
-     * @return
-     */
-    @AutoLog(value = "预警事件规则表-添加")
-    @ApiOperation(value = "预警事件规则表-添加", notes = "预警事件规则表-添加")
-    @PostMapping(value = "/add")
-    public Result<Object> addAlarmEventRule(@RequestBody JSONObject obj) {
-        Result<Object> result = new Result<>();
-        try {
-            result = alarmEventRuleService.addAlarmEventRule(obj);
-        } catch (Exception e) {
-            log.error(e.getMessage(), e);
-            result.error500("操作失败");
-        }
-        return result;
-    }
-
-    /**
-     * 编辑
-     *
-     * @param alarmEventRule
-     * @return
-     */
-    @AutoLog(value = "预警事件规则表-编辑")
-    @ApiOperation(value = "预警事件规则表-编辑", notes = "预警事件规则表-编辑")
-    @PostMapping(value = "/edit")
-    public Result<Object> editAlarmEventRule(@RequestBody JSONObject obj) {
-        Result<Object> result = new Result<>();
-        try {
-            result = alarmEventRuleService.editAlarmEventRule(obj);
-        } catch (Exception e) {
-            log.error(e.getMessage(), e);
-            result.error500("操作失败");
-        }
-        return result;
-    }
-
-    /**
-     * 通过id删除
-     *
-     * @param id
-     * @return
-     */
-    @AutoLog(value = "预警事件规则表-通过id删除")
-    @ApiOperation(value = "预警事件规则表-通过id删除", notes = "预警事件规则表-通过id删除")
-    @GetMapping(value = "/delete")
-    public Result<?> delete(Long id) {
-        try {
-            alarmEventRuleService.deleteById(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<AlarmEventRule> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<AlarmEventRule> result = new Result<>();
-        if (ids == null || "".equals(ids.trim())) {
-            result.error500("参数不识别!");
-        } else {
-            this.alarmEventRuleService.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<AlarmEventRule> queryById(@RequestParam(name = "id", required = true) Long id) {
-        Result<AlarmEventRule> result = new Result<>();
-        AlarmEventRule alarmEventRule = alarmEventRuleService.selectById(id);
-        if (alarmEventRule == null) {
-            result.error500("未找到对应实体");
-        } else {
-            result.setResult(alarmEventRule);
-            result.setSuccess(true);
-        }
-        return result;
-    }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<AlarmEventRule> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                AlarmEventRule alarmEventRule = JSON.parseObject(deString, AlarmEventRule.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(alarmEventRule, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<AlarmEventRule> pageList = alarmEventRuleService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "预警事件规则表列表");
-        mv.addObject(NormalExcelConstants.CLASS, AlarmEventRule.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("预警事件规则表列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<AlarmEventRule> listAlarmEventRules = ExcelImportUtil.importExcel(file.getInputStream(), AlarmEventRule.class, params);
-                alarmEventRuleService.saveBatch(listAlarmEventRules);
-                return Result.ok("文件导入成功!数据行数:" + listAlarmEventRules.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("文件导入失败!");
-    }
-
-}

+ 0 - 26
module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/AlarmEventSendController.java

@@ -143,32 +143,6 @@ public class AlarmEventSendController {
         return result;
     }
 
-    @GetMapping(value = "/matchAlarmRules")
-    public Result<?> matchAlarmRules(String type) {
-        Result<AlarmEventSend> result = new Result<>();
-        try {
-            alarmEventSendService.matchAlarmRules(type);
-            result.success("操作成功!");
-        } catch (Exception e) {
-            log.error(e.getMessage(), e);
-            result.error500("操作失败");
-        }
-        return result;
-    }
-
-    @GetMapping(value = "/rechangeValue")
-    public Result<?> rechangeValue(String type) {
-        Result<AlarmEventSend> result = new Result<>();
-        try {
-            alarmEventSendService.getAlarmValue(type);
-            result.success("操作成功!");
-        } catch (Exception e) {
-            log.error(e.getMessage(), e);
-            result.error500("操作失败");
-        }
-        return result;
-    }
-
     /**
      * 编辑
      *

+ 0 - 269
module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/AlarmMetricValueController.java

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

+ 0 - 231
module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/AlarmRuleCampaignRelController.java

@@ -1,231 +0,0 @@
-package cn.com.ctop.alarm.modules.controller;
-
-import cn.com.ctop.alarm.modules.entity.AlarmRuleCampaignRel;
-import cn.com.ctop.alarm.modules.service.IAlarmRuleCampaignRelService;
-import cn.com.ctop.common.module.annotation.AutoLog;
-import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.def.NormalExcelConstants;
-import org.jeecgframework.poi.excel.entity.ExportParams;
-import org.jeecgframework.poi.excel.entity.ImportParams;
-import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 规则和计划、组关系表
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2020-11-09
- */
-@Slf4j
-@Api(tags = "规则和计划、组关系表")
-@RestController
-@RequestMapping("/alarm.modules/alarmRuleCampaignRel")
-public class AlarmRuleCampaignRelController {
-    @Autowired
-    private IAlarmRuleCampaignRelService alarmRuleCampaignRelService;
-
-    /**
-     * 分页列表查询
-     *
-     * @param alarmRuleCampaignRel
-     * @param pageNo
-     * @param pageSize
-     * @param req
-     * @return
-     */
-    @AutoLog(value = "规则和计划、组关系表-分页列表查询")
-    @ApiOperation(value = "规则和计划、组关系表-分页列表查询", notes = "规则和计划、组关系表-分页列表查询")
-    @GetMapping(value = "/list")
-    public Result<IPage<AlarmRuleCampaignRel>> queryPageList(AlarmRuleCampaignRel alarmRuleCampaignRel,
-                                                             @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
-                                                             @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
-                                                             HttpServletRequest req) {
-        Result<IPage<AlarmRuleCampaignRel>> result = new Result<>();
-        QueryWrapper<AlarmRuleCampaignRel> queryWrapper = QueryGenerator.initQueryWrapper(alarmRuleCampaignRel, req.getParameterMap());
-        Page<AlarmRuleCampaignRel> page = new Page<AlarmRuleCampaignRel>(pageNo, pageSize);
-        IPage<AlarmRuleCampaignRel> pageList = alarmRuleCampaignRelService.page(page, queryWrapper);
-        result.setSuccess(true);
-        result.setResult(pageList);
-        return result;
-    }
-
-    /**
-     * 添加
-     *
-     * @param alarmRuleCampaignRel
-     * @return
-     */
-    @AutoLog(value = "规则和计划、组关系表-添加")
-    @ApiOperation(value = "规则和计划、组关系表-添加", notes = "规则和计划、组关系表-添加")
-    @PostMapping(value = "/add")
-    public Result<AlarmRuleCampaignRel> add(@RequestBody AlarmRuleCampaignRel alarmRuleCampaignRel) {
-        Result<AlarmRuleCampaignRel> result = new Result<>();
-        try {
-            alarmRuleCampaignRelService.save(alarmRuleCampaignRel);
-            result.success("添加成功!");
-        } catch (Exception e) {
-            log.error(e.getMessage(), e);
-            result.error500("操作失败");
-        }
-        return result;
-    }
-
-    /**
-     * 通过id删除
-     *
-     * @param id
-     * @return
-     */
-    @AutoLog(value = "规则和计划、组关系表-通过id删除")
-    @ApiOperation(value = "规则和计划、组关系表-通过id删除", notes = "规则和计划、组关系表-通过id删除")
-    @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
-        try {
-            alarmRuleCampaignRelService.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<AlarmRuleCampaignRel> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<AlarmRuleCampaignRel> result = new Result<>();
-        if (ids == null || "".equals(ids.trim())) {
-            result.error500("参数不识别!");
-        } else {
-            this.alarmRuleCampaignRelService.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<AlarmRuleCampaignRel> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<AlarmRuleCampaignRel> result = new Result<>();
-        AlarmRuleCampaignRel alarmRuleCampaignRel = alarmRuleCampaignRelService.getById(id);
-        if (alarmRuleCampaignRel == null) {
-            result.error500("未找到对应实体");
-        } else {
-            result.setResult(alarmRuleCampaignRel);
-            result.setSuccess(true);
-        }
-        return result;
-    }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<AlarmRuleCampaignRel> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                AlarmRuleCampaignRel alarmRuleCampaignRel = JSON.parseObject(deString, AlarmRuleCampaignRel.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(alarmRuleCampaignRel, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<AlarmRuleCampaignRel> pageList = alarmRuleCampaignRelService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "规则和计划、组关系表列表");
-        mv.addObject(NormalExcelConstants.CLASS, AlarmRuleCampaignRel.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("规则和计划、组关系表列表数据", "导出人:Jeecg", "导出信息"));
-        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
-        return mv;
-    }
-
-    /**
-     * 通过excel导入数据
-     *
-     * @param request
-     * @param response
-     * @return
-     */
-    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
-        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
-        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
-            MultipartFile file = entity.getValue();
-            ImportParams params = new ImportParams();
-            params.setTitleRows(2);
-            params.setHeadRows(1);
-            params.setNeedSave(true);
-            try {
-                List<AlarmRuleCampaignRel> listAlarmRuleCampaignRels = ExcelImportUtil.importExcel(file.getInputStream(), AlarmRuleCampaignRel.class, params);
-                alarmRuleCampaignRelService.saveBatch(listAlarmRuleCampaignRels);
-                return Result.ok("文件导入成功!数据行数:" + listAlarmRuleCampaignRels.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("文件导入失败!");
-    }
-
-}

+ 79 - 82
module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/AlarmEventMetricController.java

@@ -1,81 +1,78 @@
 package cn.com.ctop.alarm.modules.controller;
 
-import cn.com.ctop.alarm.modules.entity.AlarmEventMetric;
-import cn.com.ctop.alarm.modules.service.IAlarmEventMetricService;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import cn.com.ctop.alarm.modules.entity.AlarmRuleRecord;
+import cn.com.ctop.alarm.modules.service.IAlarmRuleRecordService;
 import cn.com.ctop.common.module.annotation.AutoLog;
-import com.alibaba.fastjson.JSON;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+
+import java.util.Date;
+
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import 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.system.query.QueryGenerator;
-import org.jeecg.common.util.oConvertUtils;
+
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
 import org.jeecgframework.poi.excel.entity.ExportParams;
 import org.jeecgframework.poi.excel.entity.ImportParams;
 import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.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;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 
 /**
- * 制定详细规则
+ * 预警规则记录表
  *
  * @author jeecg-boot
  * @version V1.0
- * @date 2020-10-29
+ * @date 2021-01-18
  */
 @Slf4j
-@Api(tags = "制定详细规则表")
+@Api(tags = "预警规则记录表")
 @RestController
-@RequestMapping("/alarm/alarmEventMetric")
-public class AlarmEventMetricController {
+@RequestMapping("/kuaishou/alarmRuleRecord")
+public class AlarmRuleRecordController {
     @Autowired
-    private IAlarmEventMetricService alarmEventMetricService;
+    private IAlarmRuleRecordService alarmRuleRecordService;
 
     /**
      * 分页列表查询
      *
-     * @param alarmEventMetric
+     * @param alarmRuleRecord
      * @param pageNo
      * @param pageSize
      * @param req
      * @return
      */
-    @AutoLog(value = "制定详细规则表-分页列表查询")
-    @ApiOperation(value = "制定详细规则表-分页列表查询", notes = "制定详细规则表-分页列表查询")
+    @AutoLog(value = "预警规则记录表-分页列表查询")
+    @ApiOperation(value = "预警规则记录表-分页列表查询", notes = "预警规则记录表-分页列表查询")
     @GetMapping(value = "/list")
-    public Result<IPage<AlarmEventMetric>> queryPageList(AlarmEventMetric alarmEventMetric,
-                                                         @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
-                                                         @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
-                                                         HttpServletRequest req) {
-        Result<IPage<AlarmEventMetric>> result = new Result<>();
-        QueryWrapper<AlarmEventMetric> queryWrapper = QueryGenerator.initQueryWrapper(alarmEventMetric, req.getParameterMap());
-        Page<AlarmEventMetric> page = new Page<AlarmEventMetric>(pageNo, pageSize);
-        IPage<AlarmEventMetric> pageList = alarmEventMetricService.page(page, queryWrapper);
+    public Result<IPage<AlarmRuleRecord>> queryPageList(AlarmRuleRecord alarmRuleRecord,
+                                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                        HttpServletRequest req) {
+        Result<IPage<AlarmRuleRecord>> result = new Result<>();
+        QueryWrapper<AlarmRuleRecord> queryWrapper = QueryGenerator.initQueryWrapper(alarmRuleRecord, req.getParameterMap());
+        Page<AlarmRuleRecord> page = new Page<AlarmRuleRecord>(pageNo, pageSize);
+        IPage<AlarmRuleRecord> pageList = alarmRuleRecordService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
         return result;
@@ -84,16 +81,16 @@ public class AlarmEventMetricController {
     /**
      * 添加
      *
-     * @param alarmEventMetric
+     * @param alarmRuleRecord
      * @return
      */
-    @AutoLog(value = "制定详细规则表-添加")
-    @ApiOperation(value = "制定详细规则表-添加", notes = "制定详细规则表-添加")
+    @AutoLog(value = "预警规则记录表-添加")
+    @ApiOperation(value = "预警规则记录表-添加", notes = "预警规则记录表-添加")
     @PostMapping(value = "/add")
-    public Result<AlarmEventMetric> add(@RequestBody AlarmEventMetric alarmEventMetric) {
-        Result<AlarmEventMetric> result = new Result<>();
+    public Result<AlarmRuleRecord> add(@RequestBody AlarmRuleRecord alarmRuleRecord) {
+        Result<AlarmRuleRecord> result = new Result<>();
         try {
-            alarmEventMetricService.save(alarmEventMetric);
+            alarmRuleRecordService.save(alarmRuleRecord);
             result.success("添加成功!");
         } catch (Exception e) {
             log.error(e.getMessage(), e);
@@ -105,19 +102,19 @@ public class AlarmEventMetricController {
     /**
      * 编辑
      *
-     * @param alarmEventMetric
+     * @param alarmRuleRecord
      * @return
      */
-    @AutoLog(value = "制定详细规则表-编辑")
-    @ApiOperation(value = "制定详细规则表-编辑", notes = "制定详细规则表-编辑")
+    @AutoLog(value = "预警规则记录表-编辑")
+    @ApiOperation(value = "预警规则记录表-编辑", notes = "预警规则记录表-编辑")
     @PutMapping(value = "/edit")
-    public Result<AlarmEventMetric> edit(@RequestBody AlarmEventMetric alarmEventMetric) {
-        Result<AlarmEventMetric> result = new Result<AlarmEventMetric>();
-        AlarmEventMetric alarmEventMetricEntity = alarmEventMetricService.getById(alarmEventMetric.getEventMetricId());
-        if (alarmEventMetricEntity == null) {
+    public Result<AlarmRuleRecord> edit(@RequestBody AlarmRuleRecord alarmRuleRecord) {
+        Result<AlarmRuleRecord> result = new Result<AlarmRuleRecord>();
+        AlarmRuleRecord alarmRuleRecordEntity = alarmRuleRecordService.getById(alarmRuleRecord.getId());
+        if (alarmRuleRecordEntity == null) {
             result.error500("未找到对应实体");
         } else {
-            boolean ok = alarmEventMetricService.updateById(alarmEventMetric);
+            boolean ok = alarmRuleRecordService.updateById(alarmRuleRecord);
             if (ok) {
                 result.success("修改成功!");
             }
@@ -132,12 +129,12 @@ public class AlarmEventMetricController {
      * @param id
      * @return
      */
-    @AutoLog(value = "制定详细规则表-通过id删除")
-    @ApiOperation(value = "制定详细规则表-通过id删除", notes = "制定详细规则表-通过id删除")
+    @AutoLog(value = "预警规则记录表-通过id删除")
+    @ApiOperation(value = "预警规则记录表-通过id删除", notes = "预警规则记录表-通过id删除")
     @DeleteMapping(value = "/delete")
     public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
         try {
-            alarmEventMetricService.removeById(id);
+            alarmRuleRecordService.removeById(id);
         } catch (Exception e) {
             log.error("删除失败", e.getMessage());
             return Result.error("删除失败!");
@@ -151,15 +148,15 @@ public class AlarmEventMetricController {
      * @param ids
      * @return
      */
-    @AutoLog(value = "制定详细规则表-批量删除")
-    @ApiOperation(value = "制定详细规则表-批量删除", notes = "制定详细规则表-批量删除")
+    @AutoLog(value = "预警规则记录表-批量删除")
+    @ApiOperation(value = "预警规则记录表-批量删除", notes = "预警规则记录表-批量删除")
     @DeleteMapping(value = "/deleteBatch")
-    public Result<AlarmEventMetric> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<AlarmEventMetric> result = new Result<>();
+    public Result<AlarmRuleRecord> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<AlarmRuleRecord> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
-            this.alarmEventMetricService.removeByIds(Arrays.asList(ids.split(",")));
+            this.alarmRuleRecordService.removeByIds(Arrays.asList(ids.split(",")));
             result.success("删除成功!");
         }
         return result;
@@ -171,16 +168,16 @@ public class AlarmEventMetricController {
      * @param id
      * @return
      */
-    @AutoLog(value = "制定详细规则表-通过id查询")
-    @ApiOperation(value = "制定详细规则表-通过id查询", notes = "制定详细规则表-通过id查询")
+    @AutoLog(value = "预警规则记录表-通过id查询")
+    @ApiOperation(value = "预警规则记录表-通过id查询", notes = "预警规则记录表-通过id查询")
     @GetMapping(value = "/queryById")
-    public Result<AlarmEventMetric> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<AlarmEventMetric> result = new Result<>();
-        AlarmEventMetric alarmEventMetric = alarmEventMetricService.getById(id);
-        if (alarmEventMetric == null) {
+    public Result<AlarmRuleRecord> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<AlarmRuleRecord> result = new Result<>();
+        AlarmRuleRecord alarmRuleRecord = alarmRuleRecordService.getById(id);
+        if (alarmRuleRecord == null) {
             result.error500("未找到对应实体");
         } else {
-            result.setResult(alarmEventMetric);
+            result.setResult(alarmRuleRecord);
             result.setSuccess(true);
         }
         return result;
@@ -195,13 +192,13 @@ public class AlarmEventMetricController {
     @RequestMapping(value = "/exportXls")
     public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
         // Step.1 组装查询条件
-        QueryWrapper<AlarmEventMetric> queryWrapper = null;
+        QueryWrapper<AlarmRuleRecord> queryWrapper = null;
         try {
             String paramsStr = request.getParameter("paramsStr");
             if (oConvertUtils.isNotEmpty(paramsStr)) {
                 String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                AlarmEventMetric alarmEventMetric = JSON.parseObject(deString, AlarmEventMetric.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(alarmEventMetric, request.getParameterMap());
+                AlarmRuleRecord alarmRuleRecord = JSON.parseObject(deString, AlarmRuleRecord.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(alarmRuleRecord, request.getParameterMap());
             }
         } catch (UnsupportedEncodingException e) {
             e.printStackTrace();
@@ -209,11 +206,11 @@ public class AlarmEventMetricController {
 
         //Step.2 AutoPoi 导出Excel
         ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<AlarmEventMetric> pageList = alarmEventMetricService.list(queryWrapper);
+        List<AlarmRuleRecord> pageList = alarmRuleRecordService.list(queryWrapper);
         //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "制定详细规则表列表");
-        mv.addObject(NormalExcelConstants.CLASS, AlarmEventMetric.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("制定详细规则表列表数据", "导出人:Jeecg", "导出信息"));
+        mv.addObject(NormalExcelConstants.FILE_NAME, "预警规则记录表列表");
+        mv.addObject(NormalExcelConstants.CLASS, AlarmRuleRecord.class);
+        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("预警规则记录表列表数据", "导出人:Jeecg", "导出信息"));
         mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
         return mv;
     }
@@ -236,9 +233,9 @@ public class AlarmEventMetricController {
             params.setHeadRows(1);
             params.setNeedSave(true);
             try {
-                List<AlarmEventMetric> listAlarmEventMetrics = ExcelImportUtil.importExcel(file.getInputStream(), AlarmEventMetric.class, params);
-                alarmEventMetricService.saveBatch(listAlarmEventMetrics);
-                return Result.ok("文件导入成功!数据行数:" + listAlarmEventMetrics.size());
+                List<AlarmRuleRecord> listAlarmRuleRecords = ExcelImportUtil.importExcel(file.getInputStream(), AlarmRuleRecord.class, params);
+                alarmRuleRecordService.saveBatch(listAlarmRuleRecords);
+                return Result.ok("文件导入成功!数据行数:" + listAlarmRuleRecords.size());
             } catch (Exception e) {
                 log.error(e.getMessage(), e);
                 return Result.error("文件导入失败:" + e.getMessage());

+ 0 - 91
module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/AlarmEventMetric.java

@@ -1,91 +0,0 @@
-package cn.com.ctop.alarm.modules.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-import org.jeecgframework.poi.excel.annotation.Excel;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.util.Date;
-
-/**
- * 制定详细规则表
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2020-10-29
- */
-@Data
-@TableName("ctop_alarm_event_metric")
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
-@ApiModel(value = "ctop_alarm_event_metric对象", description = "制定详细规则表")
-public class AlarmEventMetric {
-
-    /**
-     * 主键id
-     */
-    @TableId(type = IdType.AUTO)
-    @ApiModelProperty(value = "主键id")
-    private Long eventMetricId;
-    /**
-     * 规则id
-     */
-    @Excel(name = "规则id", width = 15)
-    @ApiModelProperty(value = "规则id")
-    private Long eventRuleId;
-    /**
-     * 指标标识
-     */
-    @Excel(name = "指标标识", width = 15)
-    @ApiModelProperty(value = "指标标识")
-    private String metricValueCode;
-
-    private String metricValueName;
-    /**
-     * 判断方式 > >= < <= =
-     */
-    @Excel(name = "判断方式 > >= < <= =", width = 15)
-    @ApiModelProperty(value = "判断方式 > >= < <= =")
-    private String judgeMethod;
-    /**
-     * 判断类型 1-金额
-     */
-    private String judgeType;
-    /**
-     * 阈值
-     */
-    @Excel(name = "阈值", width = 15)
-    @ApiModelProperty(value = "阈值")
-    private String threshold;
-    /**
-     * 下限阈值
-     */
-    private String minThreshold;
-    /**
-     * createTime
-     */
-    @Excel(name = "createTime", 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 = "createTime")
-    private Date createTime;
-    /**
-     * updateTime
-     */
-    @Excel(name = "updateTime", 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 = "updateTime")
-    private Date updateTime;
-    /**
-     * 数据范围:TODAY_DATA-当天数据
-     */
-    private String dataRange;
-}

+ 0 - 135
module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/AlarmEventRule.java

@@ -1,135 +0,0 @@
-package cn.com.ctop.alarm.modules.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-import org.jeecgframework.poi.excel.annotation.Excel;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.util.Date;
-import java.util.List;
-
-/**
- * 预警事件规则表
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2020-10-29
- */
-@Data
-@TableName("ctop_alarm_event_rule")
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
-@ApiModel(value = "ctop_alarm_event_rule对象", description = "预警事件规则表")
-public class AlarmEventRule {
-    /**
-     * 规则id
-     */
-    @TableId(type = IdType.AUTO)
-    @ApiModelProperty(value = "规则id")
-    private Long eventRuleId;
-    /**
-     * 账户编号
-     */
-    @Excel(name = "账户编号", width = 15)
-    @ApiModelProperty(value = "账户编号")
-    private Long accountId;
-
-    private Long campaignId;
-
-    /**
-     * 规则名称
-     */
-    @Excel(name = "规则名称", width = 15)
-    @ApiModelProperty(value = "规则名称")
-    private String eventRuleName;
-    /**
-     * 预警事件规则级别 1-普通预警 2-严重预警
-     */
-    @Excel(name = "预警事件规则级别 1-普通预警 2-严重预警", width = 15)
-    @ApiModelProperty(value = "预警事件规则级别 1-普通预警 2-严重预警")
-    private String eventRuleLevel;
-    /**
-     * 检查频率 1每小时,2每半小时
-     */
-    @Excel(name = "检查频率 1每小时,2每半小时", width = 15)
-    @ApiModelProperty(value = "检查频率 1每小时,2每半小时")
-    private String checkFrequency;
-    /**
-     * 预警达标处理方式1发送,2关停并发送
-     */
-    @Excel(name = "预警达标处理方式1发送,2关停并发送", width = 15)
-    @ApiModelProperty(value = "预警达标处理方式1发送,2关停并发送")
-    private String processMethod;
-    /**
-     * 规则状态
-     */
-    @Excel(name = "规则状态", width = 15)
-    @ApiModelProperty(value = "规则状态")
-    private String eventRuleStatus;
-
-    private String appStatus;
-
-    private String createrId;
-
-    private String metricValueCode;
-
-    private String metricValueName;
-    /**
-     * createTime
-     */
-    @Excel(name = "createTime", 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 = "createTime")
-    private Date createTime;
-    /**
-     * updateTime
-     */
-    @Excel(name = "updateTime", 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 = "updateTime")
-    private Date updateTime;
-
-    @TableField(exist = false)
-    private String createrName;
-
-    @TableField(exist = false)
-    private String userId;
-
-    @TableField(exist = false)
-    private String accountName;
-
-    @TableField(exist = false)
-    private String UserName;
-
-    @TableField(exist = false)
-    private Date runningTime;
-
-    @TableField(exist = false)
-    private String alarmCondition;
-
-    @TableField(exist = false)
-    private String campaignName;
-
-    @TableField(exist = false)
-    private Long unitId;
-
-    @TableField(exist = false)
-    private String unitName;
-
-    @TableField(exist = false)
-    private List<AlarmRuleCampaignRel> rel;
-
-    @TableField(exist = false)
-    private List<AlarmEventMetric> alarmEventMetrics;
-
-}

+ 0 - 85
module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/AlarmMetricValue.java

@@ -1,85 +0,0 @@
-package cn.com.ctop.alarm.modules.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-import org.jeecgframework.poi.excel.annotation.Excel;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.util.Date;
-import java.util.List;
-
-/**
- * 指标字段记录表
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2020-10-29
- */
-@Data
-@TableName("ctop_alarm_metric_value")
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
-@ApiModel(value = "ctop_alarm_metric_value对象", description = "指标字段记录表")
-public class AlarmMetricValue {
-
-    /**
-     * 指标值编号
-     */
-    @TableId(type = IdType.AUTO)
-    @ApiModelProperty(value = "指标值编号")
-    private Integer metricValueId;
-    /**
-     * 父级编码
-     */
-    @Excel(name = "父级编码", width = 15)
-    @ApiModelProperty(value = "父级编码")
-    private Integer metricParentId;
-    /**
-     * 指标值名称
-     */
-    @Excel(name = "指标值名称", width = 15)
-    @ApiModelProperty(value = "指标值名称")
-    private String metricValueName;
-    /**
-     * 指标值编码
-     */
-    @Excel(name = "指标值编码", width = 15)
-    @ApiModelProperty(value = "指标值编码")
-    private String metricValueCode;
-    //数据级别;1账户计划组可见,2账户计划可见,3账户可见
-    private String metricValueLevel;
-
-    private String msgValueType;
-
-    private String msgValueUnit;
-
-    private String msgTemplate;
-    /**
-     * createTime
-     */
-    @Excel(name = "createTime", 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 = "createTime")
-    private Date createTime;
-    /**
-     * updateTime
-     */
-    @Excel(name = "updateTime", 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 = "updateTime")
-    private Date updateTime;
-
-    @TableField(exist = false)
-    private List<AlarmMetricValue> childs;
-
-}

+ 0 - 80
module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/AlarmRuleCampaignRel.java

@@ -1,80 +0,0 @@
-package cn.com.ctop.alarm.modules.entity;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-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;
-
-/**
- * 规则和计划、组关系表
- *alarm_rule_campaign_rel
- * @author jeecg-boot
- * @version V1.0
- * @date 2020-11-09
- */
-@Data
-@TableName("ctop_alarm_rule_campaign_rel")
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
-@ApiModel(value = "ctop_alarm_rule_campaign_rel对象", description = "规则和计划、组关系表")
-public class AlarmRuleCampaignRel {
-
-    /**
-     * 规则id
-     */
-    @Excel(name = "规则id", width = 15)
-    @ApiModelProperty(value = "规则id")
-    private Long eventRuleId;
-    /**
-     * 账户id
-     */
-    @Excel(name = "账户id", width = 15)
-    @ApiModelProperty(value = "账户id")
-    private Long accountId;
-    /**
-     * 计划id
-     */
-    @Excel(name = "计划id", width = 15)
-    @ApiModelProperty(value = "计划id")
-    private Long campaignId;
-    @TableField(exist = false)
-    private String campaignName;
-    /**
-     * 组id
-     */
-    @Excel(name = "组id", width = 15)
-    @ApiModelProperty(value = "组id")
-    private Long unitId;
-    @TableField(exist = false)
-    private String unitName;
-    /**
-     * 规则级别 account-账户级;unit-组级;campaign-计划级
-     */
-    @Excel(name = "规则级别 ACCOUNT-账户级;UNIT-组级;CAMPAIGN-计划级", width = 15)
-    @ApiModelProperty(value = "规则级别 account-账户级;unit-组级;campaign-计划级")
-    private String eventRuleLevel;
-    /**
-     * createTime
-     */
-    @Excel(name = "createTime", 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 = "createTime")
-    private Date createTime;
-    /**
-     * updateTime
-     */
-    @Excel(name = "updateTime", 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 = "updateTime")
-    private Date updateTime;
-}

+ 119 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/AlarmRuleRecord.java

@@ -0,0 +1,119 @@
+package cn.com.ctop.alarm.modules.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;
+
+/**
+ * 预警规则记录表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-01-18
+ */
+@Data
+@TableName("ctop_alarm_rule_record")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_alarm_rule_record对象", description = "预警规则记录表")
+public class AlarmRuleRecord {
+
+    /**
+     * 主键id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "主键id")
+    private java.lang.Long id;
+
+    private java.lang.Long accountId;
+
+    private java.lang.Long planId;
+
+    private java.lang.Long unitId;
+
+    private java.lang.Long creativeId;
+    /**
+     * 规则id
+     */
+    @Excel(name = "规则id", width = 15)
+    @ApiModelProperty(value = "规则id")
+    private java.lang.Long baseId;
+    /**
+     * 规则组id
+     */
+    @Excel(name = "规则组id", width = 15)
+    @ApiModelProperty(value = "规则组id")
+    private java.lang.Long groupId;
+
+    private java.lang.String groupName;
+    /**
+     * 指标code
+     */
+    @Excel(name = "指标code", width = 15)
+    @ApiModelProperty(value = "指标code")
+    private java.lang.String indicatorCode;
+    /**
+     * 指标名称
+     */
+    @Excel(name = "指标名称", width = 15)
+    @ApiModelProperty(value = "指标名称")
+    private java.lang.String indicatorName;
+    /**
+     * 阈值
+     */
+    @Excel(name = "阈值", width = 15)
+    @ApiModelProperty(value = "阈值")
+    private java.lang.String threshold;
+    //判断条件 大于 等于 小于等
+    private java.lang.String ruleCondition;
+    /**
+     * 实际值
+     */
+    @Excel(name = "实际值", width = 15)
+    @ApiModelProperty(value = "实际值")
+    private java.lang.String dataValue;
+    /**
+     * 获取值时间
+     */
+    @Excel(name = "获取值时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "获取值时间")
+    private java.util.Date valueTime;
+    /**
+     * 操作内容:SEND发送,PAUSE关停并发送
+     */
+    @Excel(name = "操作内容:SEND发送,PAUSE关停并发送", width = 15)
+    @ApiModelProperty(value = "操作内容:SEND发送,PAUSE关停并发送")
+    private java.lang.String operate;
+    /**
+     * 媒体类型
+     */
+    @Excel(name = "媒体类型", width = 15)
+    @ApiModelProperty(value = "媒体类型")
+    private java.lang.String mediaType;
+    /**
+     * createTime
+     */
+    @Excel(name = "createTime", 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 = "createTime")
+    private java.util.Date createTime;
+    /**
+     * updateTime
+     */
+    @Excel(name = "updateTime", 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 = "updateTime")
+    private java.util.Date updateTime;
+}

+ 45 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/enums/ConditEnum.java

@@ -0,0 +1,45 @@
+package cn.com.ctop.alarm.modules.enums;
+
+/**
+ * 条件枚举
+ *
+ * @param
+ * @author ZHAOXA
+ * @return
+ * @throws
+ */
+public enum ConditEnum {
+    EQUAL("equal", "等于"),
+    NOT_EQUAL("not_equal", "不等于"),
+    GREATER("greater", "大于"),
+    LESS("less", "小于"),
+    GREATER_EQUAL("greater_equal", "大于等于"),
+    LESS_EQUAL("less_equal", "小于等于"),
+    NO_CONTAIN("no_contain", "不包含"),
+    CONTAIN("contain", "包含");
+
+    private String name;
+    private String code;
+
+    private ConditEnum(String code, String name) {
+        this.name = name;
+        this.code = code;
+    }
+
+    public static ConditEnum getEnumByCode(String code) {
+        for (ConditEnum em : ConditEnum.values()) {
+            if (em.code.equals(code)) {
+                return em;
+            }
+        }
+        return null;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getCode() {
+        return code;
+    }
+}

+ 0 - 20
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/AlarmEventMetricMapper.java

@@ -1,20 +0,0 @@
-package cn.com.ctop.alarm.modules.mapper;
-
-import cn.com.ctop.alarm.modules.entity.AlarmEventMetric;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-import java.util.List;
-
-/**
- * 制定详细规则表
- *
- * @author: jeecg-boot
- * @date: 2020-10-29
- * @cersion: V1.0
- */
-public interface AlarmEventMetricMapper extends BaseMapper<AlarmEventMetric> {
-
-    List<AlarmEventMetric> selectByEventRuleId(Long id);
-
-    void deleteByRuleId(Long id);
-}

+ 0 - 22
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/AlarmEventRuleMapper.java

@@ -1,22 +0,0 @@
-package cn.com.ctop.alarm.modules.mapper;
-
-import cn.com.ctop.alarm.modules.entity.AlarmEventRule;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-import java.util.List;
-
-/**
- * 预警事件规则表
- *
- * @author: jeecg-boot
- * @date: 2020-10-29
- * @cersion: V1.0
- */
-public interface AlarmEventRuleMapper extends BaseMapper<AlarmEventRule> {
-
-    List<AlarmEventRule> selectListPage(AlarmEventRule alarmEventRule);
-
-    AlarmEventRule queryById(Long id);
-
-    List<AlarmEventRule> queryRunningRecordPage(AlarmEventRule alarmEventRule);
-}

+ 0 - 18
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/AlarmMetricValueMapper.java

@@ -1,18 +0,0 @@
-package cn.com.ctop.alarm.modules.mapper;
-
-import java.util.List;
-
-import org.apache.ibatis.annotations.Param;
-import cn.com.ctop.alarm.modules.entity.AlarmMetricValue;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-/**
- * 指标字段记录表
- * @author: jeecg-boot
- * @date:   2020-10-29
- * @cersion: V1.0
- */
-public interface AlarmMetricValueMapper extends BaseMapper<AlarmMetricValue> {
-
-    List<AlarmMetricValue> queryListByLevel(AlarmMetricValue alarmMetricValue);
-}

+ 0 - 20
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/AlarmRuleCampaignRelMapper.java

@@ -1,20 +0,0 @@
-package cn.com.ctop.alarm.modules.mapper;
-
-import java.util.List;
-
-import org.apache.ibatis.annotations.Param;
-import cn.com.ctop.alarm.modules.entity.AlarmRuleCampaignRel;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-/**
- * 规则和计划、组关系表
- * @author: jeecg-boot
- * @date:   2020-11-09
- * @cersion: V1.0
- */
-public interface AlarmRuleCampaignRelMapper extends BaseMapper<AlarmRuleCampaignRel> {
-
-    void deleteByRuleId(Long id);
-
-    List<AlarmRuleCampaignRel> selectByRuleId(Long id);
-}

+ 15 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/AlarmRuleRecordMapper.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.alarm.modules.mapper;
+
+import cn.com.ctop.alarm.modules.entity.AlarmRuleRecord;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 预警规则记录表
+ *
+ * @author: jeecg-boot
+ * @date: 2021-01-18
+ * @cersion: V1.0
+ */
+public interface AlarmRuleRecordMapper extends BaseMapper<AlarmRuleRecord> {
+
+}

+ 0 - 15
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/AlarmEventMetricMapper.xml

@@ -1,15 +0,0 @@
-<?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.alarm.modules.mapper.AlarmEventMetricMapper">
-
-    <select id="selectByEventRuleId" resultType="cn.com.ctop.alarm.modules.entity.AlarmEventMetric">
-        SELECT *
-        FROM ctop_alarm_event_metric
-        WHERE event_rule_id = #{id}
-    </select>
-
-    <delete id="deleteByRuleId">
-        delete from ctop_alarm_event_metric
-        where event_rule_id = #{id}
-    </delete>
-</mapper>

+ 0 - 60
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/AlarmEventRuleMapper.xml

@@ -1,60 +0,0 @@
-<?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.alarm.modules.mapper.AlarmEventRuleMapper">
-
-    <select id="selectListPage" parameterType="cn.com.ctop.alarm.modules.entity.AlarmEventRule"
-            resultType="cn.com.ctop.alarm.modules.entity.AlarmEventRule">
-        SELECT DISTINCT
-        t1.*,t3.realname AS 'createrName',t2.user_id,t2.user_name,t2.auth_name AS 'accountName' FROM
-        ctop_alarm_event_rule t1
-        LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
-        LEFT JOIN sys_user t3 ON t1.creater_id = t3.id
-        <where>
-            <if test="eventRuleStatus != null and eventRuleStatus !='' ">
-                AND t1.event_rule_status = #{eventRuleStatus}
-            </if>
-            <if test="checkFrequency != null and checkFrequency !='' ">
-                AND t1.check_frequency = #{checkFrequency}
-            </if>
-            <if test="unitId != null and unitId !='' ">
-                AND t1.event_rule_id != #{unitId}
-            </if>
-            <if test="accountId != null and accountId !='' ">
-                AND t1.account_id = #{accountId}
-            </if>
-            <if test="eventRuleName != null and eventRuleName !='' ">
-                AND t1.event_rule_name = #{eventRuleName}
-            </if>
-        </where>
-        order by t1.create_time desc
-    </select>
-    <select id="queryRunningRecordPage" parameterType="cn.com.ctop.alarm.modules.entity.AlarmEventRule"
-            resultType="cn.com.ctop.alarm.modules.entity.AlarmEventRule">
-        SELECT t1.*,
-        t3.user_id,t2.create_time AS 'runningTime',
-        t3.auth_name AS 'accountName',
-        t2.alarm_condition AS 'alarmCondition',
-        t3.user_name AS 'userName',t4.realname AS 'createrName'
-        FROM ctop_alarm_event_rule t1
-        INNER JOIN ctop_alarm_event_send t2 ON t1.event_rule_id = t2.event_rule_id
-        LEFT JOIN ctop_user_allocation t3 ON t1.account_id = t3.account_id
-        LEFT JOIN sys_user t4 ON t1.creater_id = t4.id
-        WHERE t1.event_rule_status = '1'
-        <if test="eventRuleId!=null">
-            AND t1.event_rule_id = #{eventRuleId}
-        </if>
-        <if test="eventRuleName!=null">
-            AND t1.event_rule_name LIKE CONCAT('%',#{eventRuleName},'%')
-        </if>
-        ORDER BY t2.create_time DESC
-    </select>
-    <select id="queryById" resultType="cn.com.ctop.alarm.modules.entity.AlarmEventRule">
-       SELECT DISTINCT t1.*,
-       t3.realname AS 'createrName',t2.user_id,t2.user_name,t2.auth_name AS accountName
-       FROM
-        ctop_alarm_event_rule t1
-        LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
-         LEFT JOIN sys_user t3 ON t1.creater_id = t3.id
-        WHERE t1.event_rule_id = #{id}
-    </select>
-</mapper>

+ 0 - 12
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/AlarmMetricValueMapper.xml

@@ -1,12 +0,0 @@
-<?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.alarm.modules.mapper.AlarmMetricValueMapper">
-    <select id="queryListByLevel" parameterType="cn.com.ctop.alarm.modules.entity.AlarmMetricValue"
-            resultType="cn.com.ctop.alarm.modules.entity.AlarmMetricValue">
-        SELECT
-        *
-        FROM
-        ctop_alarm_metric_value t1
-        WHERE metric_value_level LIKE CONCAT("%",#{metricValueLevel},"%")
-    </select>
-</mapper>

+ 0 - 18
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/AlarmRuleCampaignRelMapper.xml

@@ -1,18 +0,0 @@
-<?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.alarm.modules.mapper.AlarmRuleCampaignRelMapper">
-
-    <delete id="deleteByRuleId">
-        delete from ctop_alarm_rule_campaign_rel
-        where event_rule_id = #{id}
-    </delete>
-
-    <select id="selectByRuleId" resultType="cn.com.ctop.alarm.modules.entity.AlarmRuleCampaignRel">
-       SELECT t1.*,t2.unit_name AS unitName,t3.campaign_name AS campaignName
-       FROM
-        ctop_alarm_rule_campaign_rel t1
-        LEFT JOIN ctop_kuaishou_group t2 ON t1.unit_id =  t2.unit_id
-		LEFT JOIN ctop_kuaishou_campaign t3 ON t1.campaign_id = t3.campaign_id
-        WHERE event_rule_id = #{id}
-    </select>
-</mapper>

+ 5 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/AlarmRuleRecordMapper.xml

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

+ 19 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/AlarmRuleRecordServiceImpl.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.alarm.modules.mapper.xml;
+
+import cn.com.ctop.alarm.modules.entity.AlarmRuleRecord;
+import cn.com.ctop.alarm.modules.mapper.AlarmRuleRecordMapper;
+import cn.com.ctop.alarm.modules.service.IAlarmRuleRecordService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 预警规则记录表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-01-18
+ */
+@Service
+public class AlarmRuleRecordServiceImpl extends ServiceImpl<AlarmRuleRecordMapper, AlarmRuleRecord> implements IAlarmRuleRecordService {
+
+}

+ 0 - 14
module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/IAlarmEventMetricService.java

@@ -1,14 +0,0 @@
-package cn.com.ctop.alarm.modules.service;
-
-import cn.com.ctop.alarm.modules.entity.AlarmEventMetric;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-/**
- * @Description: 制定详细规则表
- * @Author: jeecg-boot
- * @Date: 2020-10-29
- * @Version: V1.0
- */
-public interface IAlarmEventMetricService extends IService<AlarmEventMetric> {
-
-}

+ 0 - 28
module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/IAlarmEventRuleService.java

@@ -1,28 +0,0 @@
-package cn.com.ctop.alarm.modules.service;
-
-import cn.com.ctop.alarm.modules.entity.AlarmEventRule;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.github.pagehelper.PageInfo;
-import org.jeecg.common.api.vo.Result;
-
-/**
- * @Description: 预警事件规则表
- * @Author: jeecg-boot
- * @Date: 2020-10-29
- * @Version: V1.0
- */
-public interface IAlarmEventRuleService extends IService<AlarmEventRule> {
-
-    Result<Object> addAlarmEventRule(JSONObject obj);
-
-    Result<Object> editAlarmEventRule(JSONObject obj);
-
-    AlarmEventRule selectById(Long id);
-
-    PageInfo<AlarmEventRule> selectListPage(AlarmEventRule alarmEventRule);
-
-    void deleteById(Long id);
-
-    PageInfo<AlarmEventRule> queryRunningRecordPage(AlarmEventRule alarmEventRule);
-}

+ 0 - 3
module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/IAlarmEventSendService.java

@@ -12,7 +12,4 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IAlarmEventSendService extends IService<AlarmEventSend> {
 
-    void matchAlarmRules(String checkType);
-
-    JSONObject getAlarmValue(String type);
 }

+ 0 - 16
module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/IAlarmMetricValueService.java

@@ -1,16 +0,0 @@
-package cn.com.ctop.alarm.modules.service;
-
-import cn.com.ctop.alarm.modules.entity.AlarmMetricValue;
-import com.baomidou.mybatisplus.extension.service.IService;
-import org.jeecg.common.api.vo.Result;
-
-/**
- * @Description: 指标字段记录表
- * @Author: jeecg-boot
- * @Date:   2020-10-29
- * @Version: V1.0
- */
-public interface IAlarmMetricValueService extends IService<AlarmMetricValue> {
-
-    Result<Object> queryParentChildList(AlarmMetricValue alarmMetricValue);
-}

+ 0 - 14
module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/IAlarmRuleCampaignRelService.java

@@ -1,14 +0,0 @@
-package cn.com.ctop.alarm.modules.service;
-
-import cn.com.ctop.alarm.modules.entity.AlarmRuleCampaignRel;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-/**
- * @Description: 规则和计划、组关系表
- * @Author: jeecg-boot
- * @Date: 2020-11-09
- * @Version: V1.0
- */
-public interface IAlarmRuleCampaignRelService extends IService<AlarmRuleCampaignRel> {
-
-}

+ 14 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/IAlarmRuleRecordService.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.alarm.modules.service;
+
+import cn.com.ctop.alarm.modules.entity.AlarmRuleRecord;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 预警规则记录表
+ * @Author: jeecg-boot
+ * @Date: 2021-01-18
+ * @Version: V1.0
+ */
+public interface IAlarmRuleRecordService extends IService<AlarmRuleRecord> {
+
+}

+ 0 - 19
module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/impl/AlarmEventMetricServiceImpl.java

@@ -1,19 +0,0 @@
-package cn.com.ctop.alarm.modules.service.impl;
-
-import cn.com.ctop.alarm.modules.entity.AlarmEventMetric;
-import cn.com.ctop.alarm.modules.mapper.AlarmEventMetricMapper;
-import cn.com.ctop.alarm.modules.service.IAlarmEventMetricService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.stereotype.Service;
-
-/**
- * 制定详细规则表
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2020-10-29
- */
-@Service
-public class AlarmEventMetricServiceImpl extends ServiceImpl<AlarmEventMetricMapper, AlarmEventMetric> implements IAlarmEventMetricService {
-
-}

+ 0 - 314
module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/impl/AlarmEventRuleServiceImpl.java

@@ -1,314 +0,0 @@
-package cn.com.ctop.alarm.modules.service.impl;
-
-import cn.com.ctop.alarm.modules.entity.AlarmEventMetric;
-import cn.com.ctop.alarm.modules.entity.AlarmEventRule;
-import cn.com.ctop.alarm.modules.entity.AlarmRuleCampaignRel;
-import cn.com.ctop.alarm.modules.mapper.AlarmEventMetricMapper;
-import cn.com.ctop.alarm.modules.mapper.AlarmEventRuleMapper;
-import cn.com.ctop.alarm.modules.mapper.AlarmRuleCampaignRelMapper;
-import cn.com.ctop.alarm.modules.service.IAlarmEventRuleService;
-import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouCampaignMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.github.pagehelper.PageInfo;
-import com.xxl.job.core.enums.NoEn;
-import org.apache.shiro.SecurityUtils;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.system.vo.LoginUser;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import javax.transaction.Transactional;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 预警事件规则表
- * 完成Condition
- * CURRENT_TODAY_DATA
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2020-10-29
- */
-@Transactional
-@Service
-public class AlarmEventRuleServiceImpl extends ServiceImpl<AlarmEventRuleMapper, AlarmEventRule> implements IAlarmEventRuleService {
-
-    @Autowired
-    private AlarmEventRuleMapper alarmEventRuleMapper;
-
-    @Autowired
-    private AlarmEventMetricMapper alarmEventMetricMapper;
-
-    @Autowired
-    private AlarmRuleCampaignRelMapper alarmRuleCampaignRelMapper;
-
-    @Autowired
-    private KuaiShouCampaignMapper kuaiShouCampaignMapper;
-
-    @Autowired
-    private KuaiShouGroupMapper kuaiShouGroupMapper;
-
-    @Override
-    public PageInfo<AlarmEventRule> selectListPage(AlarmEventRule alarmEventRule) {
-        return new PageInfo<AlarmEventRule>(alarmEventRuleMapper.selectListPage(alarmEventRule));
-    }
-
-    @Override
-    public void deleteById(Long id) {
-        alarmEventRuleMapper.deleteById(id);
-        alarmEventMetricMapper.deleteByRuleId(id);
-        alarmRuleCampaignRelMapper.deleteByRuleId(id);
-    }
-
-    @Override
-    public PageInfo<AlarmEventRule> queryRunningRecordPage(AlarmEventRule alarmEventRule) {
-        return new PageInfo<AlarmEventRule>(alarmEventRuleMapper.queryRunningRecordPage(alarmEventRule));
-    }
-
-    @Override
-    public Result<Object> addAlarmEventRule(JSONObject obj) {
-        Map<String, Object> map = new HashMap<>();
-        map.put("account_id", obj.getLong("accountId"));
-        map.put("event_rule_name", obj.getString("eventRuleName"));
-        if (!Check.isNull(alarmEventRuleMapper.selectByMap(map))) {
-            return Result.error(1, "添加失败,重复的规则名,请重新输入");
-        }
-
-        //1。新增rule表
-        AlarmEventRule rule = new AlarmEventRule();
-        reSetRuleEntity(rule, obj);
-        JSONArray metrics = obj.getJSONArray("alarmEventMetric");
-        if (Check.isNull(metrics)) {
-            return Result.error(1, "请选择具体规则指标");
-        }
-        rule.setEventRuleStatus(NoEn.NO1.valueStr());//默认新增为激活状态
-        alarmEventRuleMapper.insert(rule);
-        //2。新增metric表
-        AlarmEventMetric metric = null;
-        for (int i = 0; i < metrics.size(); i++) {
-            metric = new AlarmEventMetric();
-            reSetMetricEntity(metric, metrics.getJSONObject(i), rule.getEventRuleId());
-            alarmEventMetricMapper.insert(metric);
-        }
-        //2。新增rel表
-        //通过指定选择应用
-        JSONArray rels = obj.getJSONArray("rel");
-        if (!Check.isNull(rels)) {
-            addRelByIds(rels, rule);
-        }
-        return new Result<>().success("添加成功!");
-    }
-
-    @Override
-    public Result<Object> editAlarmEventRule(JSONObject obj) {
-        AlarmEventRule alarmEventRule = new AlarmEventRule();
-        alarmEventRule.setUnitId(obj.getLong("eventRuleId"));
-        alarmEventRule.setAccountId(obj.getLong("accountId"));
-        alarmEventRule.setEventRuleName(obj.getString("eventRuleName"));
-        if (!Check.isNull(alarmEventRuleMapper.selectListPage(alarmEventRule))) {
-            return Result.error(1, "修改失败,重复的规则名,请重新输入");
-        }
-        //1.更改rule表
-        AlarmEventRule rule = new AlarmEventRule();
-        reSetRuleEntity(rule, obj);
-        QueryWrapper<AlarmEventRule> ruleWrapper = new QueryWrapper<>();
-        ruleWrapper.eq("event_rule_id", obj.getLong("eventRuleId"));
-        alarmEventRuleMapper.update(rule, ruleWrapper);
-        rule.setEventRuleId(obj.getLong("eventRuleId"));
-        //2.更改metric表
-        JSONArray metrics = obj.getJSONArray("alarmEventMetric");
-        if (Check.isNull(metrics)) {
-            return Result.error(1, "请选择具体规则指标");
-        }
-        AlarmEventMetric metric = null;
-        QueryWrapper<AlarmEventMetric> metricWrapper = null;
-        for (int i = 0; i < metrics.size(); i++) {
-            JSONObject mo = metrics.getJSONObject(i);
-            metric = new AlarmEventMetric();
-            reSetMetricEntity(metric, mo, rule.getEventRuleId());
-            metricWrapper = new QueryWrapper<>();
-            metricWrapper.eq("event_metric_id", mo.getLong("eventMetricId"));
-            metricWrapper.eq("event_rule_id", obj.getLong("eventRuleId"));
-            alarmEventMetricMapper.update(metric, metricWrapper);
-        }
-        //3.更改rel表
-        //通过指定,传参ids绑定应用
-        JSONArray rels = obj.getJSONArray("rel");
-        if (!Check.isNull(rels)) {
-            alarmRuleCampaignRelMapper.deleteByRuleId(rule.getEventRuleId());
-            addRelByIds(rels, rule);
-        }
-        return new Result<>().success("修改成功!");
-    }
-
-    @Override
-    public AlarmEventRule selectById(Long id) {
-        AlarmEventRule alarmEventRule = alarmEventRuleMapper.queryById(id);
-        if (Check.isNull(alarmEventRule)) {
-            return null;
-        }
-        alarmEventRule.setAlarmEventMetrics(alarmEventMetricMapper.selectByEventRuleId(id));
-        if (("CAMPAIGN".equals(alarmEventRule.getEventRuleLevel()) || "UNIT".equals(alarmEventRule.getEventRuleLevel())) && !NoEn.NO1.valueStr().equals(alarmEventRule.getAppStatus())) {
-            alarmEventRule.setRel(alarmRuleCampaignRelMapper.selectByRuleId(id));
-        }
-        return alarmEventRule;
-    }
-
-    //通过状态+level绑定应用
-    private void addRelByStatus(AlarmEventRule rule, Long campaignId) {
-        if ("CAMPAIGN".equals(rule.getEventRuleLevel())) {
-            List<Long> ids = kuaiShouCampaignMapper.queryIdsByPutStatus(rule.getAccountId(), NoEn.NO1.valueStr());
-            if (Check.isNull(ids)) {
-                return;
-            }
-            for (Long id : ids) {
-                AlarmRuleCampaignRel relEntity = new AlarmRuleCampaignRel();
-                relEntity.setEventRuleId(rule.getEventRuleId());
-                relEntity.setAccountId(rule.getAccountId());
-                relEntity.setEventRuleLevel(rule.getEventRuleLevel());
-                relEntity.setCampaignId(id);
-                alarmRuleCampaignRelMapper.insert(relEntity);
-            }
-        }
-        if ("UNIT".equals(rule.getEventRuleLevel())) {
-            Map<String, Object> map = new HashMap<>();
-            map.put("put_status", NoEn.NO1.valueStr());
-            map.put("account_id", rule.getAccountId());
-            if (Check.isNull(campaignId)) {
-                map.put("campaign_id", campaignId);
-            }
-            List<KuaiShouGroup> kuaiShouGroups = kuaiShouGroupMapper.selectByMap(map);
-            if (Check.isNull(kuaiShouGroups)) {
-                return;
-            }
-            for (KuaiShouGroup kuaiShouGroup : kuaiShouGroups) {
-                AlarmRuleCampaignRel relEntity = new AlarmRuleCampaignRel();
-                relEntity.setEventRuleId(rule.getEventRuleId());
-                relEntity.setAccountId(rule.getAccountId());
-                relEntity.setEventRuleLevel(rule.getEventRuleLevel());
-                relEntity.setCampaignId(kuaiShouGroup.getCampaignId());
-                relEntity.setUnitId(kuaiShouGroup.getUnitId());
-                alarmRuleCampaignRelMapper.insert(relEntity);
-            }
-        }
-    }
-
-    //通过指定,传参IDS绑定应用
-    private void addRelByIds(JSONArray rels, AlarmEventRule rule) {
-        for (int k = 0; k < rels.size(); k++) {
-            AlarmRuleCampaignRel relEntity = new AlarmRuleCampaignRel();
-            JSONObject rel = rels.getJSONObject(k);
-            relEntity.setEventRuleId(rule.getEventRuleId());
-            relEntity.setAccountId(rule.getAccountId());
-            relEntity.setEventRuleLevel(rule.getEventRuleLevel());
-            relEntity.setCampaignId(rel.getLong("campaignId"));
-            relEntity.setUnitId(rel.getLong("unitId"));
-            alarmRuleCampaignRelMapper.insert(relEntity);
-        }
-    }
-
-    /**
-     * 规则实体类封装
-     * Message template
-     *
-     * @param
-     * @return void
-     * @throws
-     * @author ZHAOXA
-     */
-    private void reSetRuleEntity(AlarmEventRule rule, JSONObject obj) {
-        Long accountId = obj.getLong("accountId");
-        if (!Check.isNull(accountId)) {
-            rule.setAccountId(accountId);
-        }
-        Long campaignId = obj.getLong("campaignId");
-        if (!Check.isNull(campaignId)) {
-            rule.setCampaignId(campaignId);
-        }
-        String eventRuleName = obj.getString("eventRuleName");
-        if (!Check.isNull(eventRuleName)) {
-            rule.setEventRuleName(eventRuleName);
-        }
-        String eventRuleLevel = obj.getString("eventRuleLevel");
-        if (!Check.isNull(eventRuleLevel)) {
-            rule.setEventRuleLevel(eventRuleLevel);
-        }
-        String checkFrequency = obj.getString("checkFrequency");
-        if (!Check.isNull(checkFrequency)) {
-            rule.setCheckFrequency(checkFrequency);
-        }
-        String metricValueCode = obj.getString("metricValueCode");
-        if (!Check.isNull(metricValueCode)) {
-            rule.setMetricValueCode(metricValueCode);
-        }
-        String metricValueName = obj.getString("metricValueName");
-        if (!Check.isNull(metricValueName)) {
-            rule.setMetricValueName(metricValueName);
-        }
-        String processMethod = obj.getString("processMethod");
-        if (!Check.isNull(processMethod)) {
-            rule.setProcessMethod(processMethod);
-        }
-        String eventRuleStatus = obj.getString("eventRuleStatus");
-        if (!Check.isNull(eventRuleStatus)) {
-            rule.setEventRuleStatus(eventRuleStatus);
-        }
-        rule.setCreaterId(obj.getString("createrId"));
-        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        if (!Check.isNull(sysUser)) {
-            rule.setCreaterId(sysUser.getId());
-        }
-        if (!Check.isNull(obj.getString("appStatus")) && Check.isNull(obj.getJSONArray("rel"))) {
-            rule.setAppStatus(obj.getString("appStatus"));
-        }
-    }
-
-    /**
-     * 填充规则详细实体类
-     *
-     * @param
-     * @return void
-     * @throws
-     * @author ZHAOXA
-     */
-    private void reSetMetricEntity(AlarmEventMetric metric, JSONObject mo, Long ruleId) {
-        metric.setEventRuleId(ruleId);
-        String valueCode = mo.getString("metricValueCode");
-        if (!Check.isNull(valueCode)) {
-            metric.setMetricValueCode(valueCode);
-        }
-        String valueName = mo.getString("metricValueName");
-        if (!Check.isNull(valueName)) {
-            metric.setMetricValueName(valueName);
-        }
-        String judgeType = mo.getString("judgeType");
-        if (!Check.isNull(judgeType)) {
-            metric.setJudgeType(judgeType);
-        }
-        String judgeMethod = mo.getString("judgeMethod");
-        if (!Check.isNull(judgeMethod)) {
-            metric.setJudgeMethod(judgeMethod);
-        }
-        String threshold = mo.getString("threshold");
-        if (!Check.isNull(threshold)) {
-            metric.setThreshold(threshold);
-        }
-        String minThreshold = mo.getString("minThreshold");
-        if (!Check.isNull(minThreshold)) {
-            metric.setMinThreshold(minThreshold);
-        }
-        String dataRange = mo.getString("dataRange");
-        if (!Check.isNull(dataRange)) {
-            metric.setDataRange(dataRange);
-        }
-    }
-
-}

+ 0 - 449
module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/impl/AlarmEventSendServiceImpl.java

@@ -1,42 +1,13 @@
 package cn.com.ctop.alarm.modules.service.impl;
 
-import cn.com.ctop.alarm.modules.entity.AlarmEventMetric;
-import cn.com.ctop.alarm.modules.entity.AlarmEventRule;
 import cn.com.ctop.alarm.modules.entity.AlarmEventSend;
-import cn.com.ctop.alarm.modules.entity.AlarmMetricValue;
-import cn.com.ctop.alarm.modules.entity.AlarmRuleCampaignRel;
-import cn.com.ctop.alarm.modules.enums.StatusEnum;
-import cn.com.ctop.alarm.modules.mapper.AlarmEventMetricMapper;
-import cn.com.ctop.alarm.modules.mapper.AlarmEventRuleMapper;
 import cn.com.ctop.alarm.modules.mapper.AlarmEventSendMapper;
-import cn.com.ctop.alarm.modules.mapper.AlarmMetricValueMapper;
-import cn.com.ctop.alarm.modules.mapper.AlarmRuleCampaignRelMapper;
 import cn.com.ctop.alarm.modules.service.IAlarmEventSendService;
-import cn.com.ctop.common.module.entity.CtopOauthToken;
-import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.service.IMessageTemplate;
-import cn.com.ctop.common.module.service.ISendMessageService;
-import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouCampaignMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouUpdateService;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.xxl.job.core.enums.NoEn;
 import lombok.extern.slf4j.Slf4j;
-import org.jeecg.common.util.db.DataSourceCachePool;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.core.HashOperations;
 import org.springframework.stereotype.Service;
 
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 /**
  * 预警事件发送表
  *
@@ -48,424 +19,4 @@ import java.util.Map;
 @Service
 public class AlarmEventSendServiceImpl extends ServiceImpl<AlarmEventSendMapper, AlarmEventSend> implements IAlarmEventSendService {
 
-    @Autowired
-    private AlarmEventRuleMapper alarmEventRuleMapper;
-
-    @Autowired
-    private AlarmEventMetricMapper alarmEventMetricMapper;
-
-    @Autowired
-    private AlarmRuleCampaignRelMapper alarmRuleCampaignRelMapper;
-
-    @Autowired
-    private AlarmMetricValueMapper alarmMetricValueMapper;
-
-    @Autowired
-    private AlarmEventSendMapper alarmEventSendMapper;
-
-    @Autowired
-    private IMessageTemplate messageTemplate;
-
-    @Autowired
-    private ISendMessageService sendMessageService;
-
-    @Autowired
-    private KuaiShouCampaignMapper kuaiShouCampaignMapper;
-
-    @Autowired
-    private IKuaiShouUpdateService kuaiShouUpdateService;
-
-    @Autowired
-    private ICtopOauthTokenService oauthTokenService;
-
-    @Autowired
-    private KuaiShouGroupMapper kuaiShouGroupMapper;
-
-    private static JSONObject alarmValue;
-
-    /**
-     * value数据存储到内存
-     *
-     * @param
-     * @return com.alibaba.fastjson.JSONObject
-     * @throws
-     * @author ZHAOXA
-     */
-    @Override
-    public JSONObject getAlarmValue(String type) {
-        if (NoEn.NO1.valueStr().equals(type)) {
-            alarmValue = null;
-        }
-        if (Check.isNull(alarmValue)) {
-            alarmValue = new JSONObject();
-            List<AlarmMetricValue> valueList = alarmMetricValueMapper.selectList(null);
-            if (!Check.isNull(valueList)) {
-                for (AlarmMetricValue value : valueList) {
-                    alarmValue.put(value.getMetricValueCode(), value);
-                }
-            }
-            return alarmValue;
-        }
-        return alarmValue;
-    }
-
-    @Override
-    public void matchAlarmRules(String checkType) {
-        log.info("------匹配规则start----------");
-        long startTime = System.currentTimeMillis();
-        List<AlarmEventRule> allRules = getAllAlarmRules(checkType);
-        List<JSONObject> accountCosts = getCostInfo("ACCOUNT");
-        List<JSONObject> campaignCosts = getCostInfo("CAMPAIGN");
-        List<JSONObject> unitCosts = getCostInfo("UNIT");
-        if (Check.isNull(allRules)) {
-            return;
-        }
-        //判断账户级
-        for (AlarmEventRule rule : allRules) {
-            for (JSONObject accountCost : accountCosts) {
-                if ("ACCOUNT".equals(rule.getEventRuleLevel()) && accountCost.getLong("accountId") - rule.getAccountId() == 0) {
-                    matchRules(rule, accountCost, "ACCOUNT");
-                }
-            }
-            //判断计划级
-            for (JSONObject campaignCost : campaignCosts) {
-                if ("CAMPAIGN".equals(rule.getEventRuleLevel()) && campaignCost.getLong("accountId") - rule.getAccountId() == 0) {
-                    List<AlarmRuleCampaignRel> rel = rule.getRel();
-                    if (!Check.isNull(rel)) {
-                        for (AlarmRuleCampaignRel campaignRel : rel) {
-                            if (campaignRel.getCampaignId() - campaignCost.getLong("campaignId") == 0) {
-                                rule.setCampaignId(campaignRel.getCampaignId());
-                                rule.setCampaignName(campaignRel.getCampaignName());
-                                matchRules(rule, campaignCost, "CAMPAIGN");
-                            }
-                        }
-                    }
-                }
-            }
-            //判断组级
-            for (JSONObject unitCost : unitCosts) {
-                if ("UNIT".equals(rule.getEventRuleLevel()) && unitCost.getLong("accountId") - rule.getAccountId() == 0) {
-                    List<AlarmRuleCampaignRel> rel = rule.getRel();
-                    if (!Check.isNull(rel)) {
-                        for (AlarmRuleCampaignRel unitRel : rel) {
-                            if (unitRel.getUnitId() - unitCost.getLong("unitId") == 0) {
-                                rule.setCampaignId(unitRel.getCampaignId());
-                                rule.setCampaignName(unitRel.getCampaignName());
-                                rule.setUnitId(unitRel.getUnitId());
-                                rule.setUnitName(unitRel.getUnitName());
-                                matchRules(rule, unitCost, "UNIT");
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        long endTime = System.currentTimeMillis();
-        log.info("---end---匹配规则用时:{} ms", endTime - startTime);
-    }
-
-    /**
-     * 匹配规则
-     *
-     * @param
-     * @return void
-     * @throws
-     * @author ZHAOXA
-     */
-    private void matchRules(AlarmEventRule rule, JSONObject cost, String level) {
-        try {
-            //目标值
-            String goal = cost.getString(rule.getMetricValueCode());
-            if (Check.isNull(goal)) {
-                log.warn("规则中指标不匹配");
-                return;
-            }
-            //总消耗
-            BigDecimal totalCost = cost.getBigDecimal("totalCost");
-            BigDecimal value = new BigDecimal(goal);
-            List<AlarmEventMetric> metrics = rule.getAlarmEventMetrics();
-            if (Check.isNull(metrics)) {
-                return;
-            }
-            //value配置数据
-            JSONObject alarmValue = getAlarmValue(NoEn.NO0.valueStr());
-            boolean flag = true;
-            StringBuffer _depletion = new StringBuffer();
-            StringBuffer _roi = new StringBuffer();
-            StringBuffer _value = new StringBuffer();
-            for (AlarmEventMetric metric : metrics) {
-                if (flag) {
-                    //阈值
-                    BigDecimal threshold = new BigDecimal(metric.getThreshold());
-                    String judgeMethod = metric.getJudgeMethod();
-                    String metricValue = metric.getMetricValueCode();
-                    JSONObject valObj = alarmValue.getJSONObject(metricValue);
-                    //模板
-                    String msgTemplate = valObj.getString("msgTemplate");
-                    //单位 元、%
-                    String msgValueUnit = valObj.getString("msgValueUnit");
-                    //阈值类型 1-字符串,2-数字(BigDecimal),3-百分数',
-                    String showValue = getThreshold(valObj.getString("msgValueType"), threshold, msgValueUnit);
-                    String judgment = "低于";
-                    //大于等于
-                    if ("GT_EQ".equals(judgeMethod)) {
-                        judgment = "高于";
-                        //判断阈值类型(cost-成本;depletion-消耗;roi)
-                        if (metricValue.contains("_depletion")) {
-                            flag = totalCost.compareTo(threshold) >= 0;
-                            getMsgTemplate(_depletion, msgTemplate, judgment, "消耗值", showValue);
-                        } else if (metricValue.contains("_roi")) {
-                            flag = value.compareTo(threshold) >= 0;
-                            getMsgTemplate(_roi, msgTemplate, judgment, "ROI", showValue);
-                        } else {
-                            flag = value.compareTo(threshold) >= 0;
-                            getMsgTemplate(_value, msgTemplate, judgment, "阈值", showValue);
-                        }
-                        //小于等于
-                    } else if ("LT_EQ".equals(judgeMethod)) {
-                        if (metricValue.contains("_depletion")) {
-                            flag = totalCost.compareTo(threshold) <= 0;
-                            getMsgTemplate(_depletion, msgTemplate, judgment, "消耗值", showValue);
-                        } else if (metricValue.contains("_roi")) {
-                            flag = value.compareTo(threshold) <= 0;
-                            getMsgTemplate(_roi, msgTemplate, judgment, "ROI", showValue);
-                        } else {
-                            flag = value.compareTo(threshold) <= 0;
-                            getMsgTemplate(_value, msgTemplate, judgment, "阈值", showValue);
-                        }
-                        //介于
-                    } else if ("BETWEEN".equals(judgeMethod)) {
-                        BigDecimal minThreshold = new BigDecimal(metric.getMinThreshold());
-                        String minshowValue = getThreshold(valObj.getString("msgValueType"), minThreshold, msgValueUnit);
-                        if (metricValue.contains("_depletion")) {
-                            flag = (totalCost.compareTo(threshold) > 0) || (totalCost.compareTo(minThreshold) < 0);
-                            if (totalCost.compareTo(threshold) > 0) {
-                                judgment = "高于";
-                            }
-                            getMsgTemplate(_depletion, msgTemplate, judgment, "消耗区间", minshowValue.concat("-").concat(showValue));
-                        } else if (metricValue.contains("_roi")) {
-                            flag = (value.compareTo(threshold) > 0) || (value.compareTo(minThreshold) < 0);
-                            if (value.compareTo(threshold) > 0) {
-                                judgment = "高于";
-                            }
-                            getMsgTemplate(_roi, msgTemplate, judgment, "ROI区间", minshowValue.concat("-").concat(showValue));
-                            continue;
-                        } else {
-                            flag = (value.compareTo(threshold) > 0) || (value.compareTo(minThreshold) < 0);
-                            if (value.compareTo(threshold) > 0) {
-                                judgment = "高于";
-                            }
-                            getMsgTemplate(_value, msgTemplate, judgment, "阈值区间", minshowValue.concat("-").concat(showValue));
-                        }
-                        //等于
-                    } else if ("EQ".equals(judgeMethod)) {
-                        judgment = "等于";
-                        flag = value.compareTo(threshold) == 0;
-                        String name = StatusEnum.getEnumByCode(threshold.toString()).getName();
-                        getMsgTemplate(_value, msgTemplate, judgment, "阈值", name);
-                    } else {
-                        log.warn("缺失判断条件");
-                        break;
-                    }
-                } else {
-                    break;
-                }
-            }
-            //规则满足,产生预警
-            if (flag) {
-                String detail = getDetail(_depletion, _roi, _value);
-                String msg = getMsg(level, detail, cost, rule);
-                if (!Check.isNull(msg)) {
-                    sendMessageService.sendMessage(rule.getUserId(), msg);
-                    AlarmEventSend send = new AlarmEventSend();
-                    send.setAlarmDetail(msg);
-
-                    send.setRuleDimension(rule.getMetricValueCode());send.setAlarmStatus(NoEn.NO1.valueStr());
-                    send.setGroupId(rule.getEventRuleId());
-                    send.setGroupName(rule.getMetricValueName().concat("预警:").concat(detail.replace("<br/>", ";")));
-                    send.setUserId(rule.getUserId());
-                    alarmEventSendMapper.insert(send);
-                }
-            }
-        } catch (Exception e) {
-            log.error("匹配规则异常", e);
-        }
-    }
-
-    private boolean shutDown(AlarmEventRule rule, String level) {
-        CtopOauthToken token = oauthTokenService.getTokenByAccountId(rule.getAccountId());
-        Map<String, Object> updateMap = new HashMap<>();
-        if (!Check.isNull(token)) {
-            if ("CAMPAIGN".equals(level)) {
-                updateMap = kuaiShouUpdateService.updateCampaignStatus(token.getAccessToken(), rule.getAccountId(), rule.getCampaignId(), NoEn.NO2.valueInt(), rule.getUserId());
-                log.info("---------规则关停快手计划:{}", rule.getCampaignId());
-            } else if ("UNIT".equals(level)) {
-                updateMap = kuaiShouUpdateService.updateUnitStatus(token.getAccessToken(), rule.getAccountId(), rule.getUnitId(), NoEn.NO2.valueInt(), rule.getUserId());
-                log.info("---------规则关停快手组:{}", rule.getUnitId());
-            }
-        }
-        return (boolean) updateMap.get("success");
-    }
-
-    /**
-     * 判断模板中阈值展示格式(含单位)
-     * 例如:100.0元、55.53%
-     */
-    private String getThreshold(String msgValueType, BigDecimal value, String msgValueUnit) {
-        //1-字符串,2-数字(BigDecimal),3-百分数
-        if ("3".equals(msgValueType)) {
-            return value.multiply(new BigDecimal(100)).setScale(2).toString().concat(msgValueUnit);
-        }
-        return value.toString().concat(msgValueUnit);
-    }
-
-    /**
-     * 匹配消息模板
-     */
-    private void getMsgTemplate(StringBuffer buf, String msgTemplate, String jud, String name, String value) {
-        buf.append(msgTemplate.replace("{judgment}", jud).replace("{name}", name).replace("{value}", value));
-    }
-
-    /**
-     * 组合消息内容
-     */
-    private String getDetail(StringBuffer _depletion, StringBuffer _roi, StringBuffer _value) {
-        StringBuffer detail = new StringBuffer();
-        if (_depletion.length() > 0) {
-            detail.append(_depletion);
-            if (_roi.length() > 0) {
-                detail.append("并且").append(_roi);
-                if (_value.length() > 0) {
-                    detail.append("并且").append(_value);
-                }
-            } else {
-                if (_value.length() > 0) {
-                    detail.append("并且").append(_value);
-                }
-            }
-        } else {
-            if (_roi.length() > 0) {
-                detail.append(_roi);
-                if (_value.length() > 0) {
-                    detail.append("并且").append(_value);
-                }
-            } else {
-                if (_value.length() > 0) {
-                    detail.append(_value);
-                }
-            }
-        }
-        return detail.toString();
-    }
-
-    /**
-     * 整理发送的消息
-     */
-    private String getMsg(String level, String detail, JSONObject cost, AlarmEventRule rule) {
-        StringBuffer header = new StringBuffer();
-        header.append(rule.getMetricValueName()).append("预警").append("<br/>").
-                append("您的账户:").append(cost.getString("accountId")).append(",授权名称为:").append(rule.getAccountName()).append("<br/>");
-        if ("ACCOUNT".equals(level)) {
-            header.append(detail);
-        } else if ("CAMPAIGN".equals(level)) {
-            header.append("计划ID:").append(rule.getCampaignId()).append(",计划名称为:").append(rule.getCampaignName()).append("<br/>").append(detail);
-        } else {
-            header.append("计划ID:").append(rule.getCampaignId()).append(",计划名称为:").append(rule.getCampaignName()).append("<br/>")
-                    .append("组ID:").append(rule.getUnitId()).append(",组名称为:").append(rule.getUnitName()).append("<br/>").append(detail);
-        }
-        String msg = null;
-        if ("PAUSE".equals(rule.getProcessMethod())) {
-            header.append("现已被关停,请您及时查看并调整!");
-            if (shutDown(rule, level)) {
-                msg = header.toString();
-            }
-        } else {
-            header.append("请您及时查看并调整!");
-            msg = header.toString();
-        }
-        return msg;
-    }
-
-
-    /**
-     * 获取成本数据。
-     *
-     * @param code : unit 组级数据,account 账户级数据
-     * @return java.util.List<cn.com.ctop.kuaishou.modules.report.entity.KuaishouCostGroup>
-     * @throws
-     * @author ZHAOXA
-     */
-    private List<JSONObject> getCostInfo(String code) {
-        HashOperations<String, Object, Object> hahs = DataSourceCachePool.getRedisTemplate().opsForHash();
-        return (List<JSONObject>) hahs.get("KS_COST", code);
-    }
-
-    /**
-     * 获取告警规则集合
-     *
-     * @param
-     * @return java.util.List<cn.com.ctop.alarm.modules.entity.AlarmEventRules>
-     * @throws
-     * @author ZHAOXA
-     */
-    private List<AlarmEventRule> getAllAlarmRules(String checkType) {
-        AlarmEventRule alarmEventRule = new AlarmEventRule();
-        alarmEventRule.setEventRuleStatus(NoEn.NO1.valueStr());
-        alarmEventRule.setCheckFrequency(checkType);
-        List<AlarmEventRule> ruleList = alarmEventRuleMapper.selectListPage(alarmEventRule);
-        if (!Check.isNull(ruleList)) {
-            for (AlarmEventRule rule : ruleList) {
-                rule.setAlarmEventMetrics(alarmEventMetricMapper.selectByEventRuleId(rule.getEventRuleId()));
-                if (!"ACCOUNT".equals(rule.getEventRuleLevel())) {
-                    if (NoEn.NO1.valueStr().equals(rule.getAppStatus())) {
-                        rule.setRel(getRel(rule));
-                    } else {
-                        rule.setRel(alarmRuleCampaignRelMapper.selectByRuleId(rule.getEventRuleId()));
-                    }
-                }
-            }
-        }
-        return ruleList;
-    }
-
-    private List<AlarmRuleCampaignRel> getRel(AlarmEventRule rule) {
-        List<AlarmRuleCampaignRel> relList = new ArrayList<>();
-        AlarmRuleCampaignRel rel = null;
-        if ("CAMPAIGN".equals(rule.getEventRuleLevel())) {
-            Map<String, Object> map = new HashMap<>();
-            map.put("put_status", NoEn.NO1.valueStr());
-            map.put("account_id", rule.getAccountId());
-            List<KuaiShouCampaign> kuaiShouCampaigns = kuaiShouCampaignMapper.selectByMap(map);
-            if (!Check.isNull(kuaiShouCampaigns)) {
-                for (KuaiShouCampaign campaign : kuaiShouCampaigns) {
-                    rel = new AlarmRuleCampaignRel();
-                    rel.setCampaignId(campaign.getCampaignId());
-                    rel.setCampaignName(campaign.getCampaignName());
-                    rel.setEventRuleLevel("CAMPAIGN");
-                    relList.add(rel);
-                }
-            }
-        }
-        if ("UNIT".equals(rule.getEventRuleLevel())) {
-            Map<String, Object> map = new HashMap<>();
-            map.put("putStatus", NoEn.NO1.valueStr());
-            map.put("accountId", rule.getAccountId());
-            if (Check.isNull(rule.getCampaignId())) {
-                map.put("campaignId", rule.getCampaignId());
-            }
-            List<KuaiShouGroup> kuaiShouGroups = kuaiShouGroupMapper.queryByMap(map);
-            if (!Check.isNull(kuaiShouGroups)) {
-                for (KuaiShouGroup kuaiShouGroup : kuaiShouGroups) {
-                    rel = new AlarmRuleCampaignRel();
-                    rel.setCampaignId(kuaiShouGroup.getCampaignId());
-                    rel.setCampaignName(kuaiShouGroup.getCampaignName());
-                    rel.setEventRuleLevel("CAMPAIGN");
-                    rel.setUnitId(kuaiShouGroup.getUnitId());
-                    rel.setUnitName(kuaiShouGroup.getUnitName());
-                    relList.add(rel);
-                }
-            }
-        }
-        return relList;
-    }
 }

+ 0 - 62
module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/impl/AlarmMetricValueServiceImpl.java

@@ -1,62 +0,0 @@
-package cn.com.ctop.alarm.modules.service.impl;
-
-import cn.com.ctop.alarm.modules.entity.AlarmMetricValue;
-import cn.com.ctop.alarm.modules.mapper.AlarmMetricValueMapper;
-import cn.com.ctop.alarm.modules.service.IAlarmMetricValueService;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import lombok.extern.slf4j.Slf4j;
-import org.jeecg.common.api.vo.Result;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 指标字段记录表
- * depletion
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2020-10-29
- */
-@Slf4j
-@Service
-public class AlarmMetricValueServiceImpl extends ServiceImpl<AlarmMetricValueMapper, AlarmMetricValue> implements IAlarmMetricValueService {
-
-    @Autowired
-    private AlarmMetricValueMapper alarmMetricValueMapper;
-
-    @Override
-    public Result<Object> queryParentChildList(AlarmMetricValue alarmMetricValue) {
-        Result<Object> result = new Result<>();
-        List<AlarmMetricValue> list = alarmMetricValueMapper.queryListByLevel(alarmMetricValue);
-        List<AlarmMetricValue> resultList = new ArrayList<>();
-        Map<Integer, List<AlarmMetricValue>> map = new HashMap<>();
-        List<Integer> parents = new ArrayList<>();
-        for (AlarmMetricValue metricValue : list) {
-            if (0 == metricValue.getMetricParentId()) {
-                parents.add(metricValue.getMetricValueId());
-                resultList.add(metricValue);
-            }
-        }
-        for (Integer id : parents) {
-            List<AlarmMetricValue> childs = new ArrayList<>();
-            for (AlarmMetricValue metricValue : list) {
-                if (0 != metricValue.getMetricParentId()) {
-                    if (id == metricValue.getMetricParentId()) {
-                        childs.add(metricValue);
-                    }
-                }
-                map.put(id, childs);
-            }
-        }
-        for (AlarmMetricValue metricValue : resultList) {
-            metricValue.setChilds(map.get(metricValue.getMetricValueId()));
-        }
-        return Result.ok(resultList);
-    }
-}

+ 0 - 19
module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/impl/AlarmRuleCampaignRelServiceImpl.java

@@ -1,19 +0,0 @@
-package cn.com.ctop.alarm.modules.service.impl;
-
-import cn.com.ctop.alarm.modules.entity.AlarmRuleCampaignRel;
-import cn.com.ctop.alarm.modules.mapper.AlarmRuleCampaignRelMapper;
-import cn.com.ctop.alarm.modules.service.IAlarmRuleCampaignRelService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.stereotype.Service;
-
-/**
- * 规则和计划、组关系表
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2020-11-09
- */
-@Service
-public class AlarmRuleCampaignRelServiceImpl extends ServiceImpl<AlarmRuleCampaignRelMapper, AlarmRuleCampaignRel> implements IAlarmRuleCampaignRelService {
-
-}

+ 79 - 21
module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/impl/RuleGroupServiceImpl.java

@@ -2,12 +2,14 @@ package cn.com.ctop.alarm.modules.service.impl;
 
 import cn.com.ctop.alarm.modules.constant.MatchLogic;
 import cn.com.ctop.alarm.modules.entity.AlarmEventSend;
+import cn.com.ctop.alarm.modules.entity.AlarmRuleRecord;
 import cn.com.ctop.alarm.modules.entity.RuleAccountTemplate;
 import cn.com.ctop.alarm.modules.entity.RuleAccountThreshold;
 import cn.com.ctop.alarm.modules.entity.RuleBase;
 import cn.com.ctop.alarm.modules.entity.RuleGroup;
 import cn.com.ctop.alarm.modules.entity.RuleIndicator;
 import cn.com.ctop.alarm.modules.entity.RuleTemplate;
+import cn.com.ctop.alarm.modules.enums.ConditEnum;
 import cn.com.ctop.alarm.modules.mapper.AlarmEventSendMapper;
 import cn.com.ctop.alarm.modules.mapper.RuleAccountTemplateMapper;
 import cn.com.ctop.alarm.modules.mapper.RuleAccountThresholdMapper;
@@ -15,6 +17,7 @@ import cn.com.ctop.alarm.modules.mapper.RuleBaseMapper;
 import cn.com.ctop.alarm.modules.mapper.RuleGroupMapper;
 import cn.com.ctop.alarm.modules.mapper.RuleIndicatorMapper;
 import cn.com.ctop.alarm.modules.mapper.RuleTemplateMapper;
+import cn.com.ctop.alarm.modules.service.IAlarmRuleRecordService;
 import cn.com.ctop.alarm.modules.service.IRuleAccountTemplateService;
 import cn.com.ctop.alarm.modules.service.IRuleGroupService;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
@@ -46,6 +49,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.StringJoiner;
 import java.util.UUID;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 
 /**
  * 规则组
@@ -93,6 +98,8 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
     @Autowired
     private IByteDanceCreativeService byteDanceCreativeService;
     @Autowired
+    private IAlarmRuleRecordService alarmRuleRecordService;
+    @Autowired
     private ICtopOauthTokenService tokenService;
 
     private JSONObject userObj = null;
@@ -101,6 +108,8 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
     private final static String PLAN = "plan";
     private final static String CREATIVE = "creative";
 
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
+
     @Override
     public void checkRules() {
         log.info("------start------");
@@ -126,9 +135,11 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
             log.error("获取指标内容失败");
             return;
         }
-        for (RuleAccountTemplate templates : ruleAccountTemplates) {
+
+        ruleAccountTemplates.forEach(templates -> executorService.submit(() -> {
             matchAlarmRules(ruleGroupMap, indicators, templates);
-        }
+        }));
+
         Long endTime = System.currentTimeMillis();
         log.info("------end------共耗时: {} ms", endTime - startTime);
     }
@@ -215,14 +226,14 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
                 for (Map.Entry<String, Object> entry : batchNo.entrySet()) {
                     JSONObject thresholdJn = (JSONObject) entry.getValue();
                     if (!Check.isNull(thresholdJn)) {
-                        CombinationRule(ruleBaseList, thresholdJn, indicators, matchData, complianceList, type);
+                        CombinationRule(ruleGroup, thresholdJn, indicators, matchData, complianceList, type);
                     }
                 }
             } else {
                 boolean isGroup = "group".equals(ruleGroup.getRuleType());
                 //匹配组合规则
                 if (isGroup) {
-                    CombinationRule(ruleBaseList, thresholdObj, indicators, matchData, complianceList, type);
+                    CombinationRule(ruleGroup, thresholdObj, indicators, matchData, complianceList, type);
                     //匹配单规则
                 } else {
                     RuleBase ruleBase = ruleBaseList.get(0);
@@ -243,7 +254,8 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
                         for (int i = 0; i < dimensionData.size(); i++) {
                             JSONObject obj = dimensionData.getJSONObject(i);
                             String value = obj.getString(ruleBase.getIndicatorCode());
-                            if (MatchLogic.matchCondition(indicator, ruleBase.getRuleCondition(), threshold, value, obj)) {
+                            if (MatchLogic.matchCondition(indicator, ruleBase.getRuleCondition(), threshold, value, obj, ruleBase.getIndicatorCode())) {
+                                alarmRuleRecord(obj, ruleGroup, ruleBase, indicator, type, threshold);
                                 complianceList.add(obj);
                             }
                         }
@@ -257,6 +269,48 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
     }
 
     /**
+     * 添加预警规则记录
+     *
+     * @param
+     * @return void
+     * @throws
+     * @author ZHAOXA
+     */
+    private void alarmRuleRecord(JSONObject obj, RuleGroup ruleGroup, RuleBase ruleBase, JSONObject indicator, Integer mediaType, String threshold) {
+        try {
+            Long planId = obj.getLong("planId");
+            Long unidId = null;
+            Long creativeId = null;
+            String mediaTypeName = "快手";
+            if ((NoEn.NO1.valueInt() == mediaType || NoEn.NO3.valueInt() == mediaType)) {
+                mediaTypeName = "头条";
+                creativeId = obj.getLong("creativeId");
+            } else {
+                unidId = obj.getLong("unitId");
+            }
+            AlarmRuleRecord alarmRuleRecord = new AlarmRuleRecord();
+            alarmRuleRecord.setBaseId(ruleBase.getId());
+            alarmRuleRecord.setAccountId(obj.getLong("accountId"));
+            alarmRuleRecord.setPlanId(planId);
+            alarmRuleRecord.setUnitId(unidId);
+            alarmRuleRecord.setCreativeId(creativeId);
+            alarmRuleRecord.setGroupId(ruleGroup.getId());
+            alarmRuleRecord.setIndicatorCode(indicator.getString("code"));
+            alarmRuleRecord.setIndicatorName(indicator.getString("name"));
+            alarmRuleRecord.setGroupName(ruleGroup.getGroupName());
+            alarmRuleRecord.setThreshold(threshold);
+            alarmRuleRecord.setRuleCondition(ConditEnum.getEnumByCode(ruleBase.getRuleCondition()).getName());
+            alarmRuleRecord.setDataValue(obj.getString(ruleBase.getIndicatorCode()));
+            alarmRuleRecord.setValueTime(obj.getDate("createTime"));
+            alarmRuleRecord.setOperate("PAUSE".equals(ruleGroup.getOperate()) ? "关停" : "仅发送");
+            alarmRuleRecord.setMediaType(mediaTypeName);
+            alarmRuleRecordService.save(alarmRuleRecord);
+        } catch (Exception e) {
+            log.error("insert ctop_alarm_rule_record error ", e);
+        }
+    }
+
+    /**
      * 组合规则匹配逻辑
      *
      * @param ruleGroup    规则组对象
@@ -270,7 +324,8 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
      * @throws
      * @author ZHAOXA
      */
-    private void CombinationRule(List<RuleBase> ruleBaseList, JSONObject thresholdObj, JSONObject indicators, JSONObject matchData, JSONArray complianceList, Integer type) {
+    private void CombinationRule(RuleGroup ruleGroup, JSONObject thresholdObj, JSONObject indicators, JSONObject matchData, JSONArray complianceList, Integer type) {
+        List<RuleBase> ruleBaseList = ruleGroup.getRuleBaseList();
         //符合规则的数据集
         JSONArray groupDatas = new JSONArray();
         JSONArray targetDatas = new JSONArray();
@@ -323,8 +378,9 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
             //账户维度数据
             if (ACCOUNT.equals(ruleBase.getRuleDimension())) {
                 JSONObject accountEntity = dimensionData.getJSONObject(0);
-                if (MatchLogic.matchCondition(indicator, ruleBase.getRuleCondition(), threshold, accountEntity.getString(ruleBase.getIndicatorCode()), accountEntity)) {
+                if (MatchLogic.matchCondition(indicator, ruleBase.getRuleCondition(), threshold, accountEntity.getString(ruleBase.getIndicatorCode()), accountEntity, ruleBase.getIndicatorCode())) {
                     if (Check.isNull(accountDatas)) {
+                        alarmRuleRecord(accountEntity, ruleGroup, ruleBase, indicator, type, threshold);
                         accountDatas.add(accountEntity);
                     }
                 } else {
@@ -346,7 +402,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
                     break;
                 }
             } else if (PLAN.equals(ruleBase.getRuleDimension())) {
-                planDatas = getOKData(planDatas, dimensionData, ruleBase, indicator, threshold);
+                planDatas = getOKData(planDatas, dimensionData, ruleBase, indicator, threshold, ruleGroup, type);
                 if (Check.isNull(planDatas)) {
                     if (!Check.isNull(accountDatas)) {
                         accountDatas = null;
@@ -366,7 +422,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
                     break;
                 }
             } else if (CREATIVE.equals(ruleBase.getRuleDimension())) {
-                creativeDatas = getOKData(creativeDatas, dimensionData, ruleBase, indicator, threshold);
+                creativeDatas = getOKData(creativeDatas, dimensionData, ruleBase, indicator, threshold, ruleGroup, type);
                 if (Check.isNull(creativeDatas)) {
                     if (!Check.isNull(accountDatas)) {
                         accountDatas = null;
@@ -386,7 +442,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
                     break;
                 }
             } else if ("target".equals(ruleBase.getRuleDimension())) {
-                targetDatas = getOKData(targetDatas, dimensionData, ruleBase, indicator, threshold);
+                targetDatas = getOKData(targetDatas, dimensionData, ruleBase, indicator, threshold, ruleGroup, type);
                 if (Check.isNull(targetDatas)) {
                     if (!Check.isNull(accountDatas)) {
                         accountDatas = null;
@@ -406,7 +462,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
                     break;
                 }
             } else if (UNIT.equals(ruleBase.getRuleDimension())) {
-                groupDatas = getOKData(groupDatas, dimensionData, ruleBase, indicator, threshold);
+                groupDatas = getOKData(groupDatas, dimensionData, ruleBase, indicator, threshold, ruleGroup, type);
                 if (Check.isNull(groupDatas)) {
                     if (!Check.isNull(accountDatas)) {
                         accountDatas = null;
@@ -449,23 +505,25 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
      * @throws
      * @author ZHAOXA
      */
-    private JSONArray getOKData(JSONArray ruleDatas, JSONArray dimensionData, RuleBase ruleBase, JSONObject indicator, String threshold) {
+    private JSONArray getOKData(JSONArray ruleDatas, JSONArray dimensionData, RuleBase ruleBase, JSONObject indicator, String threshold, RuleGroup ruleGroup, Integer type) {
         if (!Check.isNull(ruleDatas)) {
             JSONArray okData = new JSONArray();
             for (int i = 0; i < ruleDatas.size(); i++) {
-                JSONObject targetEntity = ruleDatas.getJSONObject(i);
-                String value = targetEntity.getString(ruleBase.getIndicatorCode());
-                if (MatchLogic.matchCondition(indicator, ruleBase.getRuleCondition(), threshold, value, targetEntity)) {
-                    okData.add(targetEntity);
+                JSONObject obj = ruleDatas.getJSONObject(i);
+                String value = obj.getString(ruleBase.getIndicatorCode());
+                if (MatchLogic.matchCondition(indicator, ruleBase.getRuleCondition(), threshold, value, obj, ruleBase.getIndicatorCode())) {
+                    alarmRuleRecord(obj, ruleGroup, ruleBase, indicator, type, threshold);
+                    okData.add(obj);
                 }
             }
             return okData;
         }
         for (int i = 0; i < dimensionData.size(); i++) {
-            JSONObject targetEntity = dimensionData.getJSONObject(i);
-            String value = targetEntity.getString(ruleBase.getIndicatorCode());
-            if (MatchLogic.matchCondition(indicator, ruleBase.getRuleCondition(), threshold, value, targetEntity)) {
-                ruleDatas.add(targetEntity);
+            JSONObject obj = dimensionData.getJSONObject(i);
+            String value = obj.getString(ruleBase.getIndicatorCode());
+            if (MatchLogic.matchCondition(indicator, ruleBase.getRuleCondition(), threshold, value, obj, ruleBase.getIndicatorCode())) {
+                alarmRuleRecord(obj, ruleGroup, ruleBase, indicator, type, threshold);
+                ruleDatas.add(obj);
             }
         }
         return ruleDatas;
@@ -642,7 +700,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
      * @throws
      * @author ZHAOXA
      */
-    private JSONObject getUserByAccountId(Long accountId) {
+    private synchronized JSONObject getUserByAccountId(Long accountId) {
         JSONObject obj = userObj.getJSONObject(accountId.toString());
         if (Check.isNull(obj)) {
             JSONObject user = sysUserMapper.selectUserByAccount(accountId);

+ 6 - 6
module-check/src/main/java/cn/com/ctop/notice/handler/SendWeChatHandle.java

@@ -20,13 +20,13 @@ public class SendWeChatHandle {
     public void sendWeChatByMail(String mail,String message){
         String weChatId=mailLogMapper.getWeChatByMail(mail);
         if(weChatId.isEmpty()){
-            log.error(String.format("mail's WeChat not found. mail =%s", mail));
-            //TODO 通知管理员添加邮箱
-        }else{
-            List<String> messageList= splitMessage(message);
-            messageList.forEach(it->CorpWexinUtils.sendMessageByWeChatId(weChatId,it));
-        }
+        log.error(String.format("mail's WeChat not found. mail =%s", mail));
+        //TODO 通知管理员添加邮箱
+    }else{
+        List<String> messageList= splitMessage(message);
+        messageList.forEach(it->CorpWexinUtils.sendMessageByWeChatId(weChatId,it));
     }
+}
 
     /**
      * 发送多人,邮箱逗号隔开

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/RuleDataTargetKuaishou.java

@@ -58,4 +58,6 @@ public class RuleDataTargetKuaishou {
 	/**网络环境*/
 	private Integer network;
 
+	private java.util.Date createTime;
+
 }

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/RuleDatePlanKuaishou.java

@@ -24,4 +24,6 @@ public class RuleDatePlanKuaishou {
 
 	private Integer status;
 
+	private java.util.Date createTime;
+
 }

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

@@ -47,4 +47,5 @@ public class RuleDateUnitKuaishou {
 
     private Integer status;
 
+	private java.util.Date createTime;
 }

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

@@ -17,4 +17,6 @@ public interface ProjectMapper extends BaseMapper<Project> {
     String getNameByAccountId(@Param("accountId") Long accountId);
 
     JSONObject getWarningInfoByProjectId(@Param("projectId") Long projectId);
+
+    String querySupplierCodeById(@Param("projectId") Long projectId);
 }

+ 4 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/ProjectMapper.xml

@@ -21,4 +21,8 @@
      where id = #{projectId}
     </select>
 
+    <select id="querySupplierCodeById" resultType="java.lang.String">
+        select supplier_code from ctop_project where id=#{projectId}
+    </select>
+
 </mapper>

+ 46 - 0
module-common/src/main/java/cn/com/ctop/common/module/material/entity/MaterialVideoAuthor.java

@@ -0,0 +1,46 @@
+package cn.com.ctop.common.module.material.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 视频素材作者信息
+ */
+@Data
+@TableName("ctop_material_video_author")
+public class MaterialVideoAuthor {
+    
+	/**id*/
+	@TableId(type = IdType.AUTO)
+	private Integer id;
+	/**视频md5*/
+	private String videoMd5;
+	/**运营id*/
+	private String operatorId;
+	/**运营姓名*/
+	private String operatorName;
+	/**剪辑id*/
+	private String clipId;
+	/**剪辑姓名*/
+	private String clipName;
+	/**拍摄id*/
+	private String shotId;
+	/**拍摄姓名*/
+	private String shotName;
+	/**编导id*/
+	private String planId;
+	/**编导姓名*/
+	private String planName;
+	/**平面id*/
+	private String planeId;
+	/**平面姓名*/
+	private String planeName;
+	/**createTime*/
+	private Date createTime;
+	/**updateTime*/
+	private Date updateTime;
+}

+ 40 - 0
module-common/src/main/java/cn/com/ctop/common/module/material/entity/MaterialVideoCover.java

@@ -0,0 +1,40 @@
+package cn.com.ctop.common.module.material.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 视频素材封面信息
+ */
+@Data
+@TableName("ctop_material_video_cover")
+public class MaterialVideoCover {
+    
+	/**id*/
+	@TableId(type = IdType.AUTO)
+	private Integer id;
+	/**视频md5*/
+	private String videoMd5;
+	/**封面名称*/
+	private String name;
+	/**封面唯一标识*/
+	private String md5;
+	/**封面url地址*/
+	private String url;
+	/**封面描述*/
+	private String description;
+	/**格式*/
+	private String format;
+	/**大小(kb)*/
+	private Integer size;
+	/**高*/
+	private Integer height;
+	/**宽*/
+	private Integer width;
+	/**createTime*/
+	private Date createTime;
+}

+ 30 - 0
module-common/src/main/java/cn/com/ctop/common/module/material/entity/MaterialVideoFrame.java

@@ -0,0 +1,30 @@
+package cn.com.ctop.common.module.material.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 视频素材截帧信息
+ */
+@Data
+@TableName("ctop_material_video_frame")
+public class MaterialVideoFrame {
+    
+	/**id*/
+	@TableId(type = IdType.AUTO)
+	private Integer id;
+	/**视频md5*/
+	private String videoMd5;
+	/**图片唯一标识*/
+	private String md5;
+	/**图片url地址*/
+	private String url;
+	/**图片截帧顺序*/
+	private Integer frameIndex;
+	/**createTime*/
+	private Date createTime;
+}

+ 46 - 0
module-common/src/main/java/cn/com/ctop/common/module/material/entity/MaterialVideoInfo.java

@@ -0,0 +1,46 @@
+package cn.com.ctop.common.module.material.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 视频素材基础信息
+ */
+@Data
+@TableName("ctop_material_video_info")
+public class MaterialVideoInfo {
+    
+	/**id*/
+	@TableId(type = IdType.AUTO)
+	private Integer id;
+	/**视频名称*/
+	private String name;
+	/**视频md5*/
+	private String md5;
+	/**视频url*/
+	private String url;
+	/**封面url*/
+	private String coverUrl;
+	/**素材类型*/
+	private Integer materialType;
+	/**代理商信息*/
+	private String supplierCode;
+	/**视频描述*/
+	private String description;
+	/**格式*/
+	private String format;
+	/**时长(秒)*/
+	private Integer duration;
+	/**大小(kb)*/
+	private Integer size;
+	/**高*/
+	private Integer height;
+	/**宽*/
+	private Integer width;
+	/**createTime*/
+	private Date createTime;
+}

+ 28 - 0
module-common/src/main/java/cn/com/ctop/common/module/material/entity/MaterialVideoProject.java

@@ -0,0 +1,28 @@
+package cn.com.ctop.common.module.material.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 视频素材关联项目信息
+ */
+@Data
+@TableName("ctop_material_video_project")
+public class MaterialVideoProject {
+    
+	/**id*/
+	@TableId(type = IdType.AUTO)
+	private Integer id;
+	/**视频md5*/
+	private String videoMd5;
+	/**关联项目id*/
+	private Long projectId;
+	/**createTime*/
+	private Date createTime;
+	/**updateTime*/
+	private Date updateTime;
+}

+ 32 - 0
module-common/src/main/java/cn/com/ctop/common/module/material/entity/MaterialVideoWatermark.java

@@ -0,0 +1,32 @@
+package cn.com.ctop.common.module.material.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 视频素材水印信息
+ */
+@Data
+@TableName("ctop_material_video_watermark")
+public class MaterialVideoWatermark {
+    
+	/**id*/
+	@TableId(type = IdType.AUTO)
+	private Integer id;
+	/**视频md5*/
+	private String videoMd5;
+	/**水印视频名称*/
+	private String name;
+	/**水印视频唯一标识*/
+	private String md5;
+	/**水印视频url*/
+	private String url;
+	/**水印创建人*/
+	private String createBy;
+	/**createTime*/
+	private Date createTime;
+}

+ 11 - 0
module-common/src/main/java/cn/com/ctop/common/module/material/mapper/MaterialVideoAuthorMapper.java

@@ -0,0 +1,11 @@
+package cn.com.ctop.common.module.material.mapper;
+
+import cn.com.ctop.common.module.material.entity.MaterialVideoAuthor;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 视频素材作者信息
+ */
+public interface MaterialVideoAuthorMapper extends BaseMapper<MaterialVideoAuthor> {
+
+}

+ 14 - 0
module-common/src/main/java/cn/com/ctop/common/module/material/mapper/MaterialVideoCoverMapper.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.common.module.material.mapper;
+
+import cn.com.ctop.common.module.material.entity.MaterialVideoCover;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 视频素材封面信息
+ */
+public interface MaterialVideoCoverMapper extends BaseMapper<MaterialVideoCover> {
+
+    void deleteByVideoMd5(@Param("videoMd5") String videoMd5);
+
+}

+ 14 - 0
module-common/src/main/java/cn/com/ctop/common/module/material/mapper/MaterialVideoFrameMapper.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.common.module.material.mapper;
+
+import cn.com.ctop.common.module.material.entity.MaterialVideoFrame;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 视频素材截帧信息
+ */
+public interface MaterialVideoFrameMapper extends BaseMapper<MaterialVideoFrame> {
+
+    int queryFrameCountByCode(@Param("videoMd5") String videoMd5);
+
+}

+ 14 - 0
module-common/src/main/java/cn/com/ctop/common/module/material/mapper/MaterialVideoInfoMapper.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.common.module.material.mapper;
+
+import cn.com.ctop.common.module.material.entity.MaterialVideoInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 视频素材基础信息
+ */
+public interface MaterialVideoInfoMapper extends BaseMapper<MaterialVideoInfo> {
+
+    void deleteByMd5(@Param("md5") String md5);
+
+}

+ 11 - 0
module-common/src/main/java/cn/com/ctop/common/module/material/mapper/MaterialVideoProjectMapper.java

@@ -0,0 +1,11 @@
+package cn.com.ctop.common.module.material.mapper;
+
+import cn.com.ctop.common.module.material.entity.MaterialVideoProject;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 视频素材关联项目信息
+ */
+public interface MaterialVideoProjectMapper extends BaseMapper<MaterialVideoProject> {
+
+}

+ 11 - 0
module-common/src/main/java/cn/com/ctop/common/module/material/mapper/MaterialVideoWatermarkMapper.java

@@ -0,0 +1,11 @@
+package cn.com.ctop.common.module.material.mapper;
+
+import cn.com.ctop.common.module.material.entity.MaterialVideoWatermark;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 视频素材水印信息
+ */
+public interface MaterialVideoWatermarkMapper extends BaseMapper<MaterialVideoWatermark> {
+
+}

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/material/mapper/xml/MaterialVideoAuthorMapper.xml

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

+ 13 - 0
module-common/src/main/java/cn/com/ctop/common/module/material/mapper/xml/MaterialVideoCoverMapper.xml

@@ -0,0 +1,13 @@
+<?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.material.mapper.MaterialVideoCoverMapper">
+
+    <delete id="deleteByVideoMd5">
+        DELETE
+        FROM
+            ctop_material_video_cover
+        WHERE
+            video_md5 = #{videoMd5}
+    </delete>
+
+</mapper>

+ 8 - 0
module-common/src/main/java/cn/com/ctop/common/module/material/mapper/xml/MaterialVideoFrameMapper.xml

@@ -0,0 +1,8 @@
+<?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.material.mapper.MaterialVideoFrameMapper">
+
+    <select id="queryFrameCountByCode" resultType="java.lang.Integer">
+        select count(id) from ctop_material_video_frame where video_md5=#{videoMd5}
+    </select>
+</mapper>

+ 8 - 0
module-common/src/main/java/cn/com/ctop/common/module/material/mapper/xml/MaterialVideoInfoMapper.xml

@@ -0,0 +1,8 @@
+<?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.material.mapper.MaterialVideoInfoMapper">
+
+    <delete id="deleteByMd5" >
+        delete from ctop_material_video_info where md5=#{md5}
+    </delete>
+</mapper>

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/material/mapper/xml/MaterialVideoProjectMapper.xml

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

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/material/mapper/xml/MaterialVideoWatermarkMapper.xml

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

+ 11 - 0
module-common/src/main/java/cn/com/ctop/common/module/material/service/IMaterialVideoAuthorService.java

@@ -0,0 +1,11 @@
+package cn.com.ctop.common.module.material.service;
+
+import cn.com.ctop.common.module.material.entity.MaterialVideoAuthor;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ *  视频素材作者信息
+ */
+public interface IMaterialVideoAuthorService extends IService<MaterialVideoAuthor> {
+
+}

+ 13 - 0
module-common/src/main/java/cn/com/ctop/common/module/material/service/IMaterialVideoCoverService.java

@@ -0,0 +1,13 @@
+package cn.com.ctop.common.module.material.service;
+
+import cn.com.ctop.common.module.material.entity.MaterialVideoCover;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ *  视频素材封面信息
+ */
+public interface IMaterialVideoCoverService extends IService<MaterialVideoCover> {
+
+    void deleteByVideoMd5(String videoMd5);
+
+}

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.common.module.material.service;
+
+import cn.com.ctop.common.module.material.entity.MaterialVideoFrame;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ *  视频素材截帧信息
+ */
+public interface IMaterialVideoFrameService extends IService<MaterialVideoFrame> {
+
+    int getFrameCountByCode(String videoMd5);
+
+    void getTencentCutFrame(String videoUrl, String videoMd5, String coverUrl);
+
+}

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


部分文件因为文件数量过多而无法显示