Browse Source

Merge branch 'master' into jiaoyang

# Conflicts:
#	jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysBaseApiImpl.java
#	jeecg-boot-module-system/src/main/resources/application-dev.yml
#	jeecg-boot-module-system/src/main/resources/application-wps.yml
#	jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
#	module-job-kuaishou/src/main/resources/application.yml
#	module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouHistoryReportTaskServiceImpl.java
yumeng 5 years ago
parent
commit
63bc24a9e3
100 changed files with 6772 additions and 1432 deletions
  1. 8 8
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/PasswordUtil.java
  2. 1 1
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/db/DataSourceCachePool.java
  3. 4 4
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/oConvertUtils.java
  4. 0 324
      jeecg-boot-module-activiti/db/create/activiti.mysql.create.engine.sql
  5. 0 155
      jeecg-boot-module-activiti/db/create/activiti.mysql.create.history.sql
  6. 0 46
      jeecg-boot-module-activiti/db/create/activiti.mysql.create.identity.sql
  7. 3 1
      jeecg-boot-module-activiti/src/main/java/org/jeecg/modules/activiti/service/Impl/ActNodeServiceImpl.java
  8. 7 0
      jeecg-boot-module-system/pom.xml
  9. 3 0
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  10. 3 3
      jeecg-boot-module-system/src/main/java/org/jeecg/config/mybatis/MybatisInterceptor.java
  11. 42 24
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/append/xd_schedule/service/impl/XdScheduleServiceImpl.java
  12. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ActFormPorcessController.java
  13. 12 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ActorController.java
  14. 5 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AdvertiserController.java
  15. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BindAccountLoginController.java
  16. 186 116
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BytedanceMusicInfoController.java
  17. 37 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BytedanceMusicTypeController.java
  18. 0 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/DictMusicTypeController.java
  19. 0 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ImageCostController.java
  20. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  21. 4 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectMemberController.java
  22. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectTransferRecordController.java
  23. 12 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/PropController.java
  24. 47 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  25. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java
  26. 46 9
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/YardController.java
  27. 48 16
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ImageReportDailyServiceImpl.java
  28. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/MediaReportServiceImpl.java
  29. 6 6
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectMemberServiceImpl.java
  30. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ReleaseViewRecordServiceImpl.java
  31. 6 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/entity/PerformanceQuarter.java
  32. 6 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/service/impl/CalculatePerformanceServiceImpl.java
  33. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/service/impl/PerformanceInfoInfoServiceImpl.java
  34. 11 10
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/service/impl/PerformanceQuarterServiceImpl.java
  35. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/aspect/DictAspect.java
  36. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/LoginController.java
  37. 6 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/rule/OrgCodeRule.java
  38. 658 654
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysBaseApiImpl.java
  39. 33 6
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/controller/WpsFileController.java
  40. 12 10
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/entity/WpsFile.java
  41. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/service/impl/WpsFileVersionServiceImpl.java
  42. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/service/impl/WpsFileWatermarkServiceImpl.java
  43. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/service/impl/WpsUserAclServiceImpl.java
  44. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/util/SignatureUtil.java
  45. 53 0
      module-alarm/pom.xml
  46. 278 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/constant/MatchLogic.java
  47. 256 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/AlarmEventMetricController.java
  48. 274 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/AlarmEventRuleController.java
  49. 281 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/AlarmEventSendController.java
  50. 269 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/AlarmMetricValueController.java
  51. 231 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/AlarmRuleCampaignRelController.java
  52. 386 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/RuleAccountTemplateController.java
  53. 270 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/RuleAccountThresholdController.java
  54. 257 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/RuleBaseController.java
  55. 248 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/RuleConditionController.java
  56. 346 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/RuleGroupController.java
  57. 257 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/RuleIndicatorController.java
  58. 96 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/RuleSwitchController.java
  59. 404 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/RuleTemplateController.java
  60. 91 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/AlarmEventMetric.java
  61. 135 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/AlarmEventRule.java
  62. 81 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/AlarmEventSend.java
  63. 85 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/AlarmMetricValue.java
  64. 80 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/AlarmRuleCampaignRel.java
  65. 58 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/RuleAccountTemplate.java
  66. 67 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/RuleAccountThreshold.java
  67. 83 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/RuleBase.java
  68. 63 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/RuleCondition.java
  69. 89 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/RuleGroup.java
  70. 92 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/RuleIndicator.java
  71. 63 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/RuleTemplate.java
  72. 100 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/vo/TemplateAppliedVo.java
  73. 42 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/enums/StatusEnum.java
  74. 20 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/AlarmEventMetricMapper.java
  75. 22 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/AlarmEventRuleMapper.java
  76. 17 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/AlarmEventSendMapper.java
  77. 18 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/AlarmMetricValueMapper.java
  78. 20 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/AlarmRuleCampaignRelMapper.java
  79. 20 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/RuleAccountTemplateMapper.java
  80. 28 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/RuleAccountThresholdMapper.java
  81. 17 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/RuleBaseMapper.java
  82. 15 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/RuleConditionMapper.java
  83. 17 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/RuleGroupMapper.java
  84. 19 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/RuleIndicatorMapper.java
  85. 17 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/RuleTemplateMapper.java
  86. 15 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/AlarmEventMetricMapper.xml
  87. 60 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/AlarmEventRuleMapper.xml
  88. 5 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/AlarmEventSendMapper.xml
  89. 12 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/AlarmMetricValueMapper.xml
  90. 18 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/AlarmRuleCampaignRelMapper.xml
  91. 49 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/RuleAccountTemplateMapper.xml
  92. 37 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/RuleAccountThresholdMapper.xml
  93. 5 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/RuleBaseMapper.xml
  94. 5 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/RuleConditionMapper.xml
  95. 5 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/RuleGroupMapper.xml
  96. 22 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/RuleIndicatorMapper.xml
  97. 5 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/RuleTemplateMapper.xml
  98. 14 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/IAlarmEventMetricService.java
  99. 28 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/IAlarmEventRuleService.java
  100. 0 0
      module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/IAlarmEventSendService.java

+ 8 - 8
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/PasswordUtil.java

@@ -27,7 +27,7 @@ public class PasswordUtil {
 
 
 	/**
 	/**
 	 * 获取加密算法中使用的盐值,解密中使用的盐值必须与加密中使用的相同才能完成操作. 盐长度必须为8字节
 	 * 获取加密算法中使用的盐值,解密中使用的盐值必须与加密中使用的相同才能完成操作. 盐长度必须为8字节
-	 * 
+	 *
 	 * @return byte[] 盐值
 	 * @return byte[] 盐值
 	 * */
 	 * */
 	public static byte[] getSalt() throws Exception {
 	public static byte[] getSalt() throws Exception {
@@ -44,7 +44,7 @@ public class PasswordUtil {
 
 
 	/**
 	/**
 	 * 根据PBE密码生成一把密钥
 	 * 根据PBE密码生成一把密钥
-	 * 
+	 *
 	 * @param password
 	 * @param password
 	 *            生成密钥时所使用的密码
 	 *            生成密钥时所使用的密码
 	 * @return Key PBE算法密钥
 	 * @return Key PBE算法密钥
@@ -69,7 +69,7 @@ public class PasswordUtil {
 
 
 	/**
 	/**
 	 * 加密明文字符串
 	 * 加密明文字符串
-	 * 
+	 *
 	 * @param plaintext
 	 * @param plaintext
 	 *            待加密的明文字符串
 	 *            待加密的明文字符串
 	 * @param password
 	 * @param password
@@ -98,7 +98,7 @@ public class PasswordUtil {
 
 
 	/**
 	/**
 	 * 解密密文字符串
 	 * 解密密文字符串
-	 * 
+	 *
 	 * @param ciphertext
 	 * @param ciphertext
 	 *            待解密的密文字符串
 	 *            待解密的密文字符串
 	 * @param password
 	 * @param password
@@ -129,7 +129,7 @@ public class PasswordUtil {
 
 
 	/**
 	/**
 	 * 将字节数组转换为十六进制字符串
 	 * 将字节数组转换为十六进制字符串
-	 * 
+	 *
 	 * @param src
 	 * @param src
 	 *            字节数组
 	 *            字节数组
 	 * @return
 	 * @return
@@ -152,13 +152,13 @@ public class PasswordUtil {
 
 
 	/**
 	/**
 	 * 将十六进制字符串转换为字节数组
 	 * 将十六进制字符串转换为字节数组
-	 * 
+	 *
 	 * @param hexString
 	 * @param hexString
 	 *            十六进制字符串
 	 *            十六进制字符串
 	 * @return
 	 * @return
 	 */
 	 */
 	public static byte[] hexStringToBytes(String hexString) {
 	public static byte[] hexStringToBytes(String hexString) {
-		if (hexString == null || hexString.equals("")) {
+		if (hexString == null || "".equals(hexString)) {
 			return null;
 			return null;
 		}
 		}
 		hexString = hexString.toUpperCase();
 		hexString = hexString.toUpperCase();
@@ -177,4 +177,4 @@ public class PasswordUtil {
 	}
 	}
 
 
 
 
-}
+}

+ 1 - 1
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/db/DataSourceCachePool.java

@@ -19,7 +19,7 @@ public class DataSourceCachePool {
     private static Map<String, DruidDataSource> dbSources = new HashMap<>();
     private static Map<String, DruidDataSource> dbSources = new HashMap<>();
     private static RedisTemplate<String, Object> redisTemplate;
     private static RedisTemplate<String, Object> redisTemplate;
 
 
-    private static RedisTemplate<String, Object> getRedisTemplate() {
+    public static RedisTemplate<String, Object> getRedisTemplate() {
         if (redisTemplate == null) {
         if (redisTemplate == null) {
             redisTemplate = (RedisTemplate<String, Object>) SpringContextUtils.getBean("redisTemplate");
             redisTemplate = (RedisTemplate<String, Object>) SpringContextUtils.getBean("redisTemplate");
         }
         }

+ 4 - 4
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/oConvertUtils.java

@@ -38,7 +38,7 @@ public class oConvertUtils {
 	}
 	}
 
 
 	public static boolean isNotEmpty(Object object) {
 	public static boolean isNotEmpty(Object object) {
-		if (object != null && !object.equals("") && !object.equals("null")) {
+		if (object != null && !"".equals(object) && !"null".equals(object)) {
 			return (true);
 			return (true);
 		}
 		}
 		return (false);
 		return (false);
@@ -63,7 +63,7 @@ public class oConvertUtils {
 
 
 	private static String code2code(String strIn, String sourceCode, String targetCode) {
 	private static String code2code(String strIn, String sourceCode, String targetCode) {
 		String strOut = null;
 		String strOut = null;
-		if (strIn == null || (strIn.trim()).equals("")) {
+		if (strIn == null || "".equals(strIn.trim())) {
 			return strIn;
 			return strIn;
 		}
 		}
 		try {
 		try {
@@ -390,7 +390,7 @@ public class oConvertUtils {
 		long bEnd = getIpNum("172.31.255.255");
 		long bEnd = getIpNum("172.31.255.255");
 		long cBegin = getIpNum("192.168.0.0");
 		long cBegin = getIpNum("192.168.0.0");
 		long cEnd = getIpNum("192.168.255.255");
 		long cEnd = getIpNum("192.168.255.255");
-		isInnerIp = isInner(ipNum, aBegin, aEnd) || isInner(ipNum, bBegin, bEnd) || isInner(ipNum, cBegin, cEnd) || ipAddress.equals("127.0.0.1");
+		isInnerIp = isInner(ipNum, aBegin, aEnd) || isInner(ipNum, bBegin, bEnd) || isInner(ipNum, cBegin, cEnd) || "127.0.0.1".equals(ipAddress);
 		return isInnerIp;
 		return isInnerIp;
 	}
 	}
 
 
@@ -461,7 +461,7 @@ public class oConvertUtils {
 	 * @return 转换后的驼峰式命名的字符串
 	 * @return 转换后的驼峰式命名的字符串
 	 */
 	 */
 	public static String camelNames(String names) {
 	public static String camelNames(String names) {
-		if(names==null||names.equals("")){
+		if(names==null|| "".equals(names)){
 			return null;
 			return null;
 		}
 		}
 		StringBuffer sf = new StringBuffer();
 		StringBuffer sf = new StringBuffer();

+ 0 - 324
jeecg-boot-module-activiti/db/create/activiti.mysql.create.engine.sql

@@ -1,324 +0,0 @@
-create table ACT_GE_PROPERTY (
-    NAME_ varchar(64),
-    VALUE_ varchar(300),
-    REV_ integer,
-    primary key (NAME_)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
-
-insert into ACT_GE_PROPERTY
-values ('schema.version', '5.22.0.0', 1);
-
-insert into ACT_GE_PROPERTY
-values ('schema.history', 'create(5.22.0.0)', 1);
-
-insert into ACT_GE_PROPERTY
-values ('next.dbid', '1', 1);
-
-create table ACT_GE_BYTEARRAY (
-    ID_ varchar(64),
-    REV_ integer,
-    NAME_ varchar(255),
-    DEPLOYMENT_ID_ varchar(64),
-    BYTES_ LONGBLOB,
-    GENERATED_ TINYINT,
-    primary key (ID_)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
-
-create table ACT_RE_DEPLOYMENT (
-    ID_ varchar(64),
-    NAME_ varchar(255),
-    CATEGORY_ varchar(255),
-    TENANT_ID_ varchar(255) default '',
-    DEPLOY_TIME_ timestamp(3) NULL,
-    primary key (ID_)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
-
-create table ACT_RE_MODEL (
-    ID_ varchar(64) not null,
-    REV_ integer,
-    NAME_ varchar(255),
-    KEY_ varchar(255),
-    CATEGORY_ varchar(255),
-    CREATE_TIME_ timestamp(3) null,
-    LAST_UPDATE_TIME_ timestamp(3) null,
-    VERSION_ integer,
-    META_INFO_ varchar(4000),
-    DEPLOYMENT_ID_ varchar(64),
-    EDITOR_SOURCE_VALUE_ID_ varchar(64),
-    EDITOR_SOURCE_EXTRA_VALUE_ID_ varchar(64),
-    TENANT_ID_ varchar(255) default '',
-    primary key (ID_)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
-
-create table ACT_RU_EXECUTION (
-    ID_ varchar(64),
-    REV_ integer,
-    PROC_INST_ID_ varchar(64),
-    BUSINESS_KEY_ varchar(255),
-    PARENT_ID_ varchar(64),
-    PROC_DEF_ID_ varchar(64),
-    SUPER_EXEC_ varchar(64),
-    ACT_ID_ varchar(255),
-    IS_ACTIVE_ TINYINT,
-    IS_CONCURRENT_ TINYINT,
-    IS_SCOPE_ TINYINT,
-    IS_EVENT_SCOPE_ TINYINT,
-    SUSPENSION_STATE_ integer,
-    CACHED_ENT_STATE_ integer,
-    TENANT_ID_ varchar(255) default '',
-    NAME_ varchar(255),
-    LOCK_TIME_ timestamp(3) NULL,
-    primary key (ID_)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
-
-create table ACT_RU_JOB (
-    ID_ varchar(64) NOT NULL,
-    REV_ integer,
-    TYPE_ varchar(255) NOT NULL,
-    LOCK_EXP_TIME_ timestamp(3) NULL,
-    LOCK_OWNER_ varchar(255),
-    EXCLUSIVE_ boolean,
-    EXECUTION_ID_ varchar(64),
-    PROCESS_INSTANCE_ID_ varchar(64),
-    PROC_DEF_ID_ varchar(64),
-    RETRIES_ integer,
-    EXCEPTION_STACK_ID_ varchar(64),
-    EXCEPTION_MSG_ varchar(4000),
-    DUEDATE_ timestamp(3) NULL,
-    REPEAT_ varchar(255),
-    HANDLER_TYPE_ varchar(255),
-    HANDLER_CFG_ varchar(4000),
-    TENANT_ID_ varchar(255) default '',
-    primary key (ID_)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
-
-create table ACT_RE_PROCDEF (
-    ID_ varchar(64) not null,
-    REV_ integer,
-    CATEGORY_ varchar(255),
-    NAME_ varchar(255),
-    KEY_ varchar(255) not null,
-    VERSION_ integer not null,
-    DEPLOYMENT_ID_ varchar(64),
-    RESOURCE_NAME_ varchar(4000),
-    DGRM_RESOURCE_NAME_ varchar(4000),
-    DESCRIPTION_ varchar(4000),
-    HAS_START_FORM_KEY_ TINYINT,
-    HAS_GRAPHICAL_NOTATION_ TINYINT,
-    SUSPENSION_STATE_ integer,
-    TENANT_ID_ varchar(255) default '',
-    primary key (ID_)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
-
-create table ACT_RU_TASK (
-    ID_ varchar(64),
-    REV_ integer,
-    EXECUTION_ID_ varchar(64),
-    PROC_INST_ID_ varchar(64),
-    PROC_DEF_ID_ varchar(64),
-    NAME_ varchar(255),
-    PARENT_TASK_ID_ varchar(64),
-    DESCRIPTION_ varchar(4000),
-    TASK_DEF_KEY_ varchar(255),
-    OWNER_ varchar(255),
-    ASSIGNEE_ varchar(255),
-    DELEGATION_ varchar(64),
-    PRIORITY_ integer,
-    CREATE_TIME_ timestamp(3) NULL,
-    DUE_DATE_ datetime(3),
-    CATEGORY_ varchar(255),
-    SUSPENSION_STATE_ integer,
-    TENANT_ID_ varchar(255) default '',
-    FORM_KEY_ varchar(255),
-    primary key (ID_)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
-
-create table ACT_RU_IDENTITYLINK (
-    ID_ varchar(64),
-    REV_ integer,
-    GROUP_ID_ varchar(255),
-    TYPE_ varchar(255),
-    USER_ID_ varchar(255),
-    TASK_ID_ varchar(64),
-    PROC_INST_ID_ varchar(64),
-    PROC_DEF_ID_ varchar(64),    
-    primary key (ID_)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
-
-create table ACT_RU_VARIABLE (
-    ID_ varchar(64) not null,
-    REV_ integer,
-    TYPE_ varchar(255) not null,
-    NAME_ varchar(255) not null,
-    EXECUTION_ID_ varchar(64),
-    PROC_INST_ID_ varchar(64),
-    TASK_ID_ varchar(64),
-    BYTEARRAY_ID_ varchar(64),
-    DOUBLE_ double,
-    LONG_ bigint,
-    TEXT_ varchar(4000),
-    TEXT2_ varchar(4000),
-    primary key (ID_)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
-
-create table ACT_RU_EVENT_SUBSCR (
-    ID_ varchar(64) not null,
-    REV_ integer,
-    EVENT_TYPE_ varchar(255) not null,
-    EVENT_NAME_ varchar(255),
-    EXECUTION_ID_ varchar(64),
-    PROC_INST_ID_ varchar(64),
-    ACTIVITY_ID_ varchar(64),
-    CONFIGURATION_ varchar(255),
-    CREATED_ timestamp(3) not null DEFAULT CURRENT_TIMESTAMP(3),
-    PROC_DEF_ID_ varchar(64),
-    TENANT_ID_ varchar(255) default '',
-    primary key (ID_)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
-
-create table ACT_EVT_LOG (
-    LOG_NR_ bigint auto_increment,
-    TYPE_ varchar(64),
-    PROC_DEF_ID_ varchar(64),
-    PROC_INST_ID_ varchar(64),
-    EXECUTION_ID_ varchar(64),
-    TASK_ID_ varchar(64),
-    TIME_STAMP_ timestamp(3) not null,
-    USER_ID_ varchar(255),
-    DATA_ LONGBLOB,
-    LOCK_OWNER_ varchar(255),
-    LOCK_TIME_ timestamp(3) null,
-    IS_PROCESSED_ tinyint default 0,
-    primary key (LOG_NR_)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
-
-create table ACT_PROCDEF_INFO (
-	ID_ varchar(64) not null,
-    PROC_DEF_ID_ varchar(64) not null,
-    REV_ integer,
-    INFO_JSON_ID_ varchar(64),
-    primary key (ID_)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
-
-create index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION(BUSINESS_KEY_);
-create index ACT_IDX_TASK_CREATE on ACT_RU_TASK(CREATE_TIME_);
-create index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK(USER_ID_);
-create index ACT_IDX_IDENT_LNK_GROUP on ACT_RU_IDENTITYLINK(GROUP_ID_);
-create index ACT_IDX_EVENT_SUBSCR_CONFIG_ on ACT_RU_EVENT_SUBSCR(CONFIGURATION_);
-create index ACT_IDX_VARIABLE_TASK_ID on ACT_RU_VARIABLE(TASK_ID_);
-create index ACT_IDX_ATHRZ_PROCEDEF on ACT_RU_IDENTITYLINK(PROC_DEF_ID_);
-create index ACT_IDX_INFO_PROCDEF on ACT_PROCDEF_INFO(PROC_DEF_ID_);
-
-alter table ACT_GE_BYTEARRAY
-    add constraint ACT_FK_BYTEARR_DEPL 
-    foreign key (DEPLOYMENT_ID_) 
-    references ACT_RE_DEPLOYMENT (ID_);
-
-alter table ACT_RE_PROCDEF
-    add constraint ACT_UNIQ_PROCDEF
-    unique (KEY_,VERSION_, TENANT_ID_);
-    
-alter table ACT_RU_EXECUTION
-    add constraint ACT_FK_EXE_PROCINST 
-    foreign key (PROC_INST_ID_) 
-    references ACT_RU_EXECUTION (ID_) on delete cascade on update cascade;
-
-alter table ACT_RU_EXECUTION
-    add constraint ACT_FK_EXE_PARENT 
-    foreign key (PARENT_ID_) 
-    references ACT_RU_EXECUTION (ID_);
-    
-alter table ACT_RU_EXECUTION
-    add constraint ACT_FK_EXE_SUPER 
-    foreign key (SUPER_EXEC_) 
-    references ACT_RU_EXECUTION (ID_);
-
-alter table ACT_RU_EXECUTION
-    add constraint ACT_FK_EXE_PROCDEF 
-    foreign key (PROC_DEF_ID_) 
-    references ACT_RE_PROCDEF (ID_);
-    
-alter table ACT_RU_IDENTITYLINK
-    add constraint ACT_FK_TSKASS_TASK 
-    foreign key (TASK_ID_) 
-    references ACT_RU_TASK (ID_);
-    
-alter table ACT_RU_IDENTITYLINK
-    add constraint ACT_FK_ATHRZ_PROCEDEF 
-    foreign key (PROC_DEF_ID_) 
-    references ACT_RE_PROCDEF(ID_);
-    
-alter table ACT_RU_IDENTITYLINK
-    add constraint ACT_FK_IDL_PROCINST
-    foreign key (PROC_INST_ID_) 
-    references ACT_RU_EXECUTION (ID_);       
-    
-alter table ACT_RU_TASK
-    add constraint ACT_FK_TASK_EXE
-    foreign key (EXECUTION_ID_)
-    references ACT_RU_EXECUTION (ID_);
-    
-alter table ACT_RU_TASK
-    add constraint ACT_FK_TASK_PROCINST
-    foreign key (PROC_INST_ID_)
-    references ACT_RU_EXECUTION (ID_);
-    
-alter table ACT_RU_TASK
-  	add constraint ACT_FK_TASK_PROCDEF
-  	foreign key (PROC_DEF_ID_)
-  	references ACT_RE_PROCDEF (ID_);
-  
-alter table ACT_RU_VARIABLE 
-    add constraint ACT_FK_VAR_EXE 
-    foreign key (EXECUTION_ID_) 
-    references ACT_RU_EXECUTION (ID_);
-
-alter table ACT_RU_VARIABLE
-    add constraint ACT_FK_VAR_PROCINST
-    foreign key (PROC_INST_ID_)
-    references ACT_RU_EXECUTION(ID_);
-
-alter table ACT_RU_VARIABLE 
-    add constraint ACT_FK_VAR_BYTEARRAY 
-    foreign key (BYTEARRAY_ID_) 
-    references ACT_GE_BYTEARRAY (ID_);
-
-alter table ACT_RU_JOB 
-    add constraint ACT_FK_JOB_EXCEPTION 
-    foreign key (EXCEPTION_STACK_ID_) 
-    references ACT_GE_BYTEARRAY (ID_);
-
-alter table ACT_RU_EVENT_SUBSCR
-    add constraint ACT_FK_EVENT_EXEC
-    foreign key (EXECUTION_ID_)
-    references ACT_RU_EXECUTION(ID_);
-    
-alter table ACT_RE_MODEL 
-    add constraint ACT_FK_MODEL_SOURCE 
-    foreign key (EDITOR_SOURCE_VALUE_ID_) 
-    references ACT_GE_BYTEARRAY (ID_);
-
-alter table ACT_RE_MODEL 
-    add constraint ACT_FK_MODEL_SOURCE_EXTRA 
-    foreign key (EDITOR_SOURCE_EXTRA_VALUE_ID_) 
-    references ACT_GE_BYTEARRAY (ID_);
-    
-alter table ACT_RE_MODEL 
-    add constraint ACT_FK_MODEL_DEPLOYMENT 
-    foreign key (DEPLOYMENT_ID_) 
-    references ACT_RE_DEPLOYMENT (ID_);        
-
-alter table ACT_PROCDEF_INFO 
-    add constraint ACT_FK_INFO_JSON_BA 
-    foreign key (INFO_JSON_ID_) 
-    references ACT_GE_BYTEARRAY (ID_);
-
-alter table ACT_PROCDEF_INFO 
-    add constraint ACT_FK_INFO_PROCDEF 
-    foreign key (PROC_DEF_ID_) 
-    references ACT_RE_PROCDEF (ID_);
-    
-alter table ACT_PROCDEF_INFO
-    add constraint ACT_UNIQ_INFO_PROCDEF
-    unique (PROC_DEF_ID_);
-    

+ 0 - 155
jeecg-boot-module-activiti/db/create/activiti.mysql.create.history.sql

@@ -1,155 +0,0 @@
-create table ACT_HI_PROCINST (
-    ID_ varchar(64) not null,
-    PROC_INST_ID_ varchar(64) not null,
-    BUSINESS_KEY_ varchar(255),
-    PROC_DEF_ID_ varchar(64) not null,
-    START_TIME_ datetime(3) not null,
-    END_TIME_ datetime(3),
-    DURATION_ bigint,
-    START_USER_ID_ varchar(255),
-    START_ACT_ID_ varchar(255),
-    END_ACT_ID_ varchar(255),
-    SUPER_PROCESS_INSTANCE_ID_ varchar(64),
-    DELETE_REASON_ varchar(4000),
-    TENANT_ID_ varchar(255) default '',
-    NAME_ varchar(255),
-    primary key (ID_),
-    unique (PROC_INST_ID_)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
-
-create table ACT_HI_ACTINST (
-    ID_ varchar(64) not null,
-    PROC_DEF_ID_ varchar(64) not null,
-    PROC_INST_ID_ varchar(64) not null,
-    EXECUTION_ID_ varchar(64) not null,
-    ACT_ID_ varchar(255) not null,
-    TASK_ID_ varchar(64),
-    CALL_PROC_INST_ID_ varchar(64),
-    ACT_NAME_ varchar(255),
-    ACT_TYPE_ varchar(255) not null,
-    ASSIGNEE_ varchar(255),
-    START_TIME_ datetime(3) not null,
-    END_TIME_ datetime(3),
-    DURATION_ bigint,
-    TENANT_ID_ varchar(255) default '',
-    primary key (ID_)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
-
-create table ACT_HI_TASKINST (
-    ID_ varchar(64) not null,
-    PROC_DEF_ID_ varchar(64),
-    TASK_DEF_KEY_ varchar(255),
-    PROC_INST_ID_ varchar(64),
-    EXECUTION_ID_ varchar(64),
-    NAME_ varchar(255),
-    PARENT_TASK_ID_ varchar(64),
-    DESCRIPTION_ varchar(4000),
-    OWNER_ varchar(255),
-    ASSIGNEE_ varchar(255),
-    START_TIME_ datetime(3) not null,
-    CLAIM_TIME_ datetime(3),
-    END_TIME_ datetime(3),
-    DURATION_ bigint,
-    DELETE_REASON_ varchar(4000),
-    PRIORITY_ integer,
-    DUE_DATE_ datetime(3),
-    FORM_KEY_ varchar(255),
-    CATEGORY_ varchar(255),
-    TENANT_ID_ varchar(255) default '',
-    primary key (ID_)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
-
-create table ACT_HI_VARINST (
-    ID_ varchar(64) not null,
-    PROC_INST_ID_ varchar(64),
-    EXECUTION_ID_ varchar(64),
-    TASK_ID_ varchar(64),
-    NAME_ varchar(255) not null,
-    VAR_TYPE_ varchar(100),
-    REV_ integer,
-    BYTEARRAY_ID_ varchar(64),
-    DOUBLE_ double,
-    LONG_ bigint,
-    TEXT_ varchar(4000),
-    TEXT2_ varchar(4000),
-    CREATE_TIME_ datetime(3),
-    LAST_UPDATED_TIME_ datetime(3),
-    primary key (ID_)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
-
-create table ACT_HI_DETAIL (
-    ID_ varchar(64) not null,
-    TYPE_ varchar(255) not null,
-    PROC_INST_ID_ varchar(64),
-    EXECUTION_ID_ varchar(64),
-    TASK_ID_ varchar(64),
-    ACT_INST_ID_ varchar(64),
-    NAME_ varchar(255) not null,
-    VAR_TYPE_ varchar(255),
-    REV_ integer,
-    TIME_ datetime(3) not null,
-    BYTEARRAY_ID_ varchar(64),
-    DOUBLE_ double,
-    LONG_ bigint,
-    TEXT_ varchar(4000),
-    TEXT2_ varchar(4000),
-    primary key (ID_)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
-
-create table ACT_HI_COMMENT (
-    ID_ varchar(64) not null,
-    TYPE_ varchar(255),
-    TIME_ datetime(3) not null,
-    USER_ID_ varchar(255),
-    TASK_ID_ varchar(64),
-    PROC_INST_ID_ varchar(64),
-    ACTION_ varchar(255),
-    MESSAGE_ varchar(4000),
-    FULL_MSG_ LONGBLOB,
-    primary key (ID_)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
-
-create table ACT_HI_ATTACHMENT (
-    ID_ varchar(64) not null,
-    REV_ integer,
-    USER_ID_ varchar(255),
-    NAME_ varchar(255),
-    DESCRIPTION_ varchar(4000),
-    TYPE_ varchar(255),
-    TASK_ID_ varchar(64),
-    PROC_INST_ID_ varchar(64),
-    URL_ varchar(4000),
-    CONTENT_ID_ varchar(64),
-    TIME_ datetime(3),
-    primary key (ID_)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
-
-create table ACT_HI_IDENTITYLINK (
-    ID_ varchar(64),
-    GROUP_ID_ varchar(255),
-    TYPE_ varchar(255),
-    USER_ID_ varchar(255),
-    TASK_ID_ varchar(64),
-    PROC_INST_ID_ varchar(64),
-    primary key (ID_)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
-
-
-create index ACT_IDX_HI_PRO_INST_END on ACT_HI_PROCINST(END_TIME_);
-create index ACT_IDX_HI_PRO_I_BUSKEY on ACT_HI_PROCINST(BUSINESS_KEY_);
-create index ACT_IDX_HI_ACT_INST_START on ACT_HI_ACTINST(START_TIME_);
-create index ACT_IDX_HI_ACT_INST_END on ACT_HI_ACTINST(END_TIME_);
-create index ACT_IDX_HI_DETAIL_PROC_INST on ACT_HI_DETAIL(PROC_INST_ID_);
-create index ACT_IDX_HI_DETAIL_ACT_INST on ACT_HI_DETAIL(ACT_INST_ID_);
-create index ACT_IDX_HI_DETAIL_TIME on ACT_HI_DETAIL(TIME_);
-create index ACT_IDX_HI_DETAIL_NAME on ACT_HI_DETAIL(NAME_);
-create index ACT_IDX_HI_DETAIL_TASK_ID on ACT_HI_DETAIL(TASK_ID_);
-create index ACT_IDX_HI_PROCVAR_PROC_INST on ACT_HI_VARINST(PROC_INST_ID_);
-create index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST(NAME_, VAR_TYPE_);
-create index ACT_IDX_HI_PROCVAR_TASK_ID on ACT_HI_VARINST(TASK_ID_);
-create index ACT_IDX_HI_ACT_INST_PROCINST on ACT_HI_ACTINST(PROC_INST_ID_, ACT_ID_);
-create index ACT_IDX_HI_ACT_INST_EXEC on ACT_HI_ACTINST(EXECUTION_ID_, ACT_ID_);
-create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_);
-create index ACT_IDX_HI_IDENT_LNK_TASK on ACT_HI_IDENTITYLINK(TASK_ID_);
-create index ACT_IDX_HI_IDENT_LNK_PROCINST on ACT_HI_IDENTITYLINK(PROC_INST_ID_);
-create index ACT_IDX_HI_TASK_INST_PROCINST on ACT_HI_TASKINST(PROC_INST_ID_);

+ 0 - 46
jeecg-boot-module-activiti/db/create/activiti.mysql.create.identity.sql

@@ -1,46 +0,0 @@
-create table ACT_ID_GROUP (
-    ID_ varchar(64),
-    REV_ integer,
-    NAME_ varchar(255),
-    TYPE_ varchar(255),
-    primary key (ID_)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
-
-create table ACT_ID_MEMBERSHIP (
-    USER_ID_ varchar(64),
-    GROUP_ID_ varchar(64),
-    primary key (USER_ID_, GROUP_ID_)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
-
-create table ACT_ID_USER (
-    ID_ varchar(64),
-    REV_ integer,
-    FIRST_ varchar(255),
-    LAST_ varchar(255),
-    EMAIL_ varchar(255),
-    PWD_ varchar(255),
-    PICTURE_ID_ varchar(64),
-    primary key (ID_)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
-
-create table ACT_ID_INFO (
-    ID_ varchar(64),
-    REV_ integer,
-    USER_ID_ varchar(64),
-    TYPE_ varchar(64),
-    KEY_ varchar(255),
-    VALUE_ varchar(255),
-    PASSWORD_ LONGBLOB,
-    PARENT_ID_ varchar(255),
-    primary key (ID_)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
-
-alter table ACT_ID_MEMBERSHIP 
-    add constraint ACT_FK_MEMB_GROUP 
-    foreign key (GROUP_ID_) 
-    references ACT_ID_GROUP (ID_);
-
-alter table ACT_ID_MEMBERSHIP 
-    add constraint ACT_FK_MEMB_USER 
-    foreign key (USER_ID_) 
-    references ACT_ID_USER (ID_);

+ 3 - 1
jeecg-boot-module-activiti/src/main/java/org/jeecg/modules/activiti/service/Impl/ActNodeServiceImpl.java

@@ -31,7 +31,9 @@ public class ActNodeServiceImpl extends ServiceImpl<ActNodeMapper, ActNode> impl
 
 
     public List<LoginUser> findUserByNodeId(String nodeId) {
     public List<LoginUser> findUserByNodeId(String nodeId) {
         List<LoginUser> users = this.baseMapper.findUserByNodeId(nodeId);
         List<LoginUser> users = this.baseMapper.findUserByNodeId(nodeId);
-        if (users.size()==0) users = Lists.newArrayList();
+        if (users.size()==0){
+            users = Lists.newArrayList();
+        }
         return users;
         return users;
     }
     }
 
 

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

@@ -113,6 +113,13 @@
         </dependency>
         </dependency>
 
 
         <dependency>
         <dependency>
+            <groupId>cn.com.ctop</groupId>
+            <artifactId>module-alarm</artifactId>
+            <version>2.0.2</version>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
             <groupId>com.aliyun.oss</groupId>
             <groupId>com.aliyun.oss</groupId>
             <artifactId>aliyun-sdk-oss</artifactId>
             <artifactId>aliyun-sdk-oss</artifactId>
             <version>3.5.0</version>
             <version>3.5.0</version>

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

@@ -59,6 +59,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/sys/mLogin", "anon");
         filterChainDefinitionMap.put("/sys/mLogin", "anon");
         filterChainDefinitionMap.put("/sys/login", "anon");
         filterChainDefinitionMap.put("/sys/login", "anon");
         filterChainDefinitionMap.put("/sys/wxlogin", "anon");
         filterChainDefinitionMap.put("/sys/wxlogin", "anon");
+        filterChainDefinitionMap.put("/ctop/rule/**", "anon");
         //第三方登录
         //第三方登录
         filterChainDefinitionMap.put("/thirdLogin/**", "anon");
         filterChainDefinitionMap.put("/thirdLogin/**", "anon");
         //获取加密串
         //获取加密串
@@ -175,6 +176,8 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/ctop/checkTaskList/*", "anon");
         filterChainDefinitionMap.put("/ctop/checkTaskList/*", "anon");
         filterChainDefinitionMap.put("/ctop/report/bytedance/*", "anon");
         filterChainDefinitionMap.put("/ctop/report/bytedance/*", "anon");
         filterChainDefinitionMap.put("/shiwan/shiwanFileUpload/*", "anon");
         filterChainDefinitionMap.put("/shiwan/shiwanFileUpload/*", "anon");
+        filterChainDefinitionMap.put("/oa/wechatNoList/*", "anon");
+        filterChainDefinitionMap.put("/ruleGroup/*", "anon");
 
 
         // 添加自己的过滤器并且取名为jwt
         // 添加自己的过滤器并且取名为jwt
         Map<String, Filter> filterMap = new HashMap<>(1);
         Map<String, Filter> filterMap = new HashMap<>(1);

+ 3 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/config/mybatis/MybatisInterceptor.java

@@ -48,7 +48,7 @@ public class MybatisInterceptor implements Interceptor {
 						field.setAccessible(true);
 						field.setAccessible(true);
 						Object local_createBy = field.get(parameter);
 						Object local_createBy = field.get(parameter);
 						field.setAccessible(false);
 						field.setAccessible(false);
-						if (local_createBy == null || local_createBy.equals("")) {
+						if (local_createBy == null || "".equals(local_createBy)) {
 							if (sysUser != null) {
 							if (sysUser != null) {
 								// 登录人账号
 								// 登录人账号
 								field.setAccessible(true);
 								field.setAccessible(true);
@@ -62,7 +62,7 @@ public class MybatisInterceptor implements Interceptor {
 						field.setAccessible(true);
 						field.setAccessible(true);
 						Object local_createDate = field.get(parameter);
 						Object local_createDate = field.get(parameter);
 						field.setAccessible(false);
 						field.setAccessible(false);
-						if (local_createDate == null || local_createDate.equals("")) {
+						if (local_createDate == null || "".equals(local_createDate)) {
 							field.setAccessible(true);
 							field.setAccessible(true);
 							field.set(parameter, new Date());
 							field.set(parameter, new Date());
 							field.setAccessible(false);
 							field.setAccessible(false);
@@ -73,7 +73,7 @@ public class MybatisInterceptor implements Interceptor {
 						field.setAccessible(true);
 						field.setAccessible(true);
 						Object local_sysOrgCode = field.get(parameter);
 						Object local_sysOrgCode = field.get(parameter);
 						field.setAccessible(false);
 						field.setAccessible(false);
-						if (local_sysOrgCode == null || local_sysOrgCode.equals("")) {
+						if (local_sysOrgCode == null || "".equals(local_sysOrgCode)) {
 							// 获取登录用户信息
 							// 获取登录用户信息
 							if (sysUser != null) {
 							if (sysUser != null) {
 								field.setAccessible(true);
 								field.setAccessible(true);

+ 42 - 24
jeecg-boot-module-system/src/main/java/org/jeecg/modules/append/xd_schedule/service/impl/XdScheduleServiceImpl.java

@@ -34,16 +34,17 @@ public class XdScheduleServiceImpl extends ServiceImpl<XdScheduleMapper, XdSched
     @Autowired
     @Autowired
     RedisUtil redisUtil;
     RedisUtil redisUtil;
     /**单例 缓存,避免多次重复查*/
     /**单例 缓存,避免多次重复查*/
-    private List<XdSchedule> ScheduleList;
+    private List<XdSchedule> scheduleList;
     /**有效期*/
     /**有效期*/
-    private Date ScheduleListDate = new Date();
+    private Date scheduleListDate = new Date();
 
 
     public List<XdSchedule> getDays() {
     public List<XdSchedule> getDays() {
-        if (CollectionUtil.isEmpty(ScheduleList)||ScheduleListDate.getTime()<new Date().getTime()){
-            ScheduleList = this.list(new QueryWrapper<XdSchedule>().orderByAsc("day"));
-            ScheduleListDate = DateUtils.getDate(new Date().getTime()+60*1000);//缓存一分
+        if (CollectionUtil.isEmpty(scheduleList)||scheduleListDate.getTime()<System.currentTimeMillis()){
+            scheduleList = this.list(new QueryWrapper<XdSchedule>().orderByAsc("day"));
+            //缓存一分
+            scheduleListDate = DateUtils.getDate(System.currentTimeMillis()+60*1000);
         }
         }
-        return this.ScheduleList;
+        return this.scheduleList;
     }
     }
 
 
     /**
     /**
@@ -53,7 +54,7 @@ public class XdScheduleServiceImpl extends ServiceImpl<XdScheduleMapper, XdSched
      */
      */
     public List<XdSchedule> getDays(String weeknum) {
     public List<XdSchedule> getDays(String weeknum) {
         getDays();
         getDays();
-        List<XdSchedule> weekFilter = ScheduleList.stream().filter(o -> StrUtil.equals(o.getWeeknum().intValue() + "", weeknum)).collect(Collectors.toList());
+        List<XdSchedule> weekFilter = scheduleList.stream().filter(o -> StrUtil.equals(o.getWeeknum().intValue() + "", weeknum)).collect(Collectors.toList());
         return weekFilter;
         return weekFilter;
     }
     }
     /**
     /**
@@ -62,9 +63,9 @@ public class XdScheduleServiceImpl extends ServiceImpl<XdScheduleMapper, XdSched
     public List<XdSchedule> getDays(Integer yyyyMM) {
     public List<XdSchedule> getDays(Integer yyyyMM) {
         getDays();
         getDays();
         if (yyyyMM==null){
         if (yyyyMM==null){
-            return ScheduleList;
+            return scheduleList;
         }
         }
-       return ScheduleList.stream().filter(d->{
+       return scheduleList.stream().filter(d->{
             String formatDate = DateUtils.formatDate(d.getDay(),"yyyyMM");
             String formatDate = DateUtils.formatDate(d.getDay(),"yyyyMM");
             return formatDate.equals(yyyyMM+"");
             return formatDate.equals(yyyyMM+"");
         }).collect(Collectors.toList());
         }).collect(Collectors.toList());
@@ -108,33 +109,49 @@ public class XdScheduleServiceImpl extends ServiceImpl<XdScheduleMapper, XdSched
 
 
 
 
         //生成该年的数据信息
         //生成该年的数据信息
-        int year = Convert.toInt(yyyy);//定义一个字段,接收输入的年份
-        Calendar calendar = new GregorianCalendar();//定义一个日历,变量作为年初
-        Calendar calendarEnd = new GregorianCalendar();//定义一个日历,变量作为年末
+        //定义一个字段,接收输入的年份
+        int year = Convert.toInt(yyyy);
+        //定义一个日历,变量作为年初
+        Calendar calendar = new GregorianCalendar();
+        //定义一个日历,变量作为年末
+        Calendar calendarEnd = new GregorianCalendar();
         calendar.set(Calendar.YEAR, year);
         calendar.set(Calendar.YEAR, year);
         calendar.set(Calendar.MONTH, 0);
         calendar.set(Calendar.MONTH, 0);
-        calendar.set(Calendar.DAY_OF_MONTH, 1);//设置年初的日期为1月1日
+        //设置年初的日期为1月1日
+        calendar.set(Calendar.DAY_OF_MONTH, 1);
         calendarEnd.set(Calendar.YEAR, year);
         calendarEnd.set(Calendar.YEAR, year);
         calendarEnd.set(Calendar.MONTH, 11);
         calendarEnd.set(Calendar.MONTH, 11);
-        calendarEnd.set(Calendar.DAY_OF_MONTH, 31);//设置年末的日期为12月31日
+        //设置年末的日期为12月31日
+        calendarEnd.set(Calendar.DAY_OF_MONTH, 31);
 
 
         SimpleDateFormat sf = new SimpleDateFormat("yyyyMMdd");
         SimpleDateFormat sf = new SimpleDateFormat("yyyyMMdd");
         ArrayList<XdSchedule> addDays = Lists.newArrayList();
         ArrayList<XdSchedule> addDays = Lists.newArrayList();
-        while(calendar.getTime().getTime()<=calendarEnd.getTime().getTime()){//用一整年的日期循环
+        //用一整年的日期循环
+        while(calendar.getTime().getTime()<=calendarEnd.getTime().getTime()){
             Date date = calendar.getTime();
             Date date = calendar.getTime();
             String format = sf.format(date);
             String format = sf.format(date);
 
 
-            int weekOfYear = calendar.get(Calendar.WEEK_OF_YEAR);//第几周
-            int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR);//第几天
-            int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);//一周中第几周
-            int month = calendar.get(Calendar.MONTH)+1;//月份
+            //第几周
+            int weekOfYear = calendar.get(Calendar.WEEK_OF_YEAR);
+            //第几天
+            int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR);
+            //一周中第几周
+            int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
+            //月份
+            int month = calendar.get(Calendar.MONTH)+1;
             //是否工作日
             //是否工作日
-            boolean isworking = dayOfWeek!=1&&dayOfWeek!=7;//周末休息
+            //周末休息
+            boolean isworking = dayOfWeek!=1&&dayOfWeek!=7;
             if (StrUtil.isNotBlank(body)){
             if (StrUtil.isNotBlank(body)){
                 Integer dayType = apiData.getInteger(format);
                 Integer dayType = apiData.getInteger(format);
-                if (dayType!=null){ //1法定调休,2法定放假
-                    if (dayType==1) isworking = true;
-                    if (dayType==2) isworking = false;
+                //1法定调休,2法定放假
+                if (dayType!=null){
+                    if (dayType==1){
+                        isworking = true;
+                    }
+                    if (dayType==2){
+                        isworking = false;
+                    }
                 }
                 }
             }
             }
             String weekNum;
             String weekNum;
@@ -175,7 +192,8 @@ public class XdScheduleServiceImpl extends ServiceImpl<XdScheduleMapper, XdSched
             xdSchedule.setIsworking(isworking?"1":"0");
             xdSchedule.setIsworking(isworking?"1":"0");
             addDays.add(xdSchedule);
             addDays.add(xdSchedule);
 
 
-            calendar.add(Calendar.DAY_OF_MONTH, 1);//日期+1
+            //日期+1
+            calendar.add(Calendar.DAY_OF_MONTH, 1);
         }
         }
         this.remove(new LambdaQueryWrapper<XdSchedule>().likeRight(XdSchedule::getYear,year));
         this.remove(new LambdaQueryWrapper<XdSchedule>().likeRight(XdSchedule::getYear,year));
         this.saveBatch(addDays);
         this.saveBatch(addDays);

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

@@ -59,7 +59,7 @@ public class ActFormPorcessController {
 	@PostMapping("bindProcess")
 	@PostMapping("bindProcess")
 	public Map<String,Object>bindProcess(Long formId,String processId){
 	public Map<String,Object>bindProcess(Long formId,String processId){
 		Map<String,Object>result = new HashMap<>();
 		Map<String,Object>result = new HashMap<>();
-		if(null == formId||formId == 0||null == processId||processId.trim().equals("")){
+		if(null == formId||formId == 0||null == processId|| "".equals(processId.trim())){
 			ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
 			ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
 			return result;
 			return result;
 		}
 		}

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

@@ -63,6 +63,7 @@ public class ActorController {
                                               HttpServletRequest req) {
                                               HttpServletRequest req) {
         Result<IPage<Actor>> result = new Result<>();
         Result<IPage<Actor>> result = new Result<>();
         QueryWrapper<Actor> queryWrapper = QueryGenerator.initQueryWrapper(actor, req.getParameterMap());
         QueryWrapper<Actor> queryWrapper = QueryGenerator.initQueryWrapper(actor, req.getParameterMap());
+        queryWrapper.orderByDesc("create_time");
         Page<Actor> page = new Page<>(pageNo, pageSize);
         Page<Actor> page = new Page<>(pageNo, pageSize);
         IPage<Actor> pageList = actorService.page(page, queryWrapper);
         IPage<Actor> pageList = actorService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setSuccess(true);
@@ -274,4 +275,15 @@ public class ActorController {
         }
         }
         return result;
         return result;
     }
     }
+
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        try {
+            actorService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败",e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
 }
 }

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

@@ -426,34 +426,34 @@ public class AdvertiserController {
         HttpUtils.setResponseHeader(response, "快手效果报表" + date + ".xlsx");
         HttpUtils.setResponseHeader(response, "快手效果报表" + date + ".xlsx");
         ExcelWriter excelWriter = EasyExcelFactory.getWriter(outputStream);
         ExcelWriter excelWriter = EasyExcelFactory.getWriter(outputStream);
         String type = dto.getType();
         String type = dto.getType();
-        if (null != type && type.trim().equals("project")) {
+        if (null != type && "project".equals(type.trim())) {
             SheetInfoVo projectSheetVo = this.getProjectSheetVo(dto, "项目报表");
             SheetInfoVo projectSheetVo = this.getProjectSheetVo(dto, "项目报表");
             Sheet sheet = new Sheet(1, 0, EffecfReportProjectEntity.class);
             Sheet sheet = new Sheet(1, 0, EffecfReportProjectEntity.class);
             sheet.setSheetName(projectSheetVo.getSheetName());
             sheet.setSheetName(projectSheetVo.getSheetName());
             excelWriter.write(projectSheetVo.getDetails(), sheet);
             excelWriter.write(projectSheetVo.getDetails(), sheet);
         }
         }
-        if (null != type && type.trim().equals("account")) {
+        if (null != type && "account".equals(type.trim())) {
             SheetInfoVo accountSheetVo = this.getAccountSheetVo(dto, "账户报表");
             SheetInfoVo accountSheetVo = this.getAccountSheetVo(dto, "账户报表");
             Sheet sheet = new Sheet(1, 0, EffecfReportAccountEntity.class);
             Sheet sheet = new Sheet(1, 0, EffecfReportAccountEntity.class);
             sheet.setSheetName(accountSheetVo.getSheetName());
             sheet.setSheetName(accountSheetVo.getSheetName());
             excelWriter.write(accountSheetVo.getDetails(), sheet);
             excelWriter.write(accountSheetVo.getDetails(), sheet);
         }
         }
 
 
-        if (null != type && type.trim().equals("campaign")) {
+        if (null != type && "campaign".equals(type.trim())) {
             SheetInfoVo planSheetVo = this.getPlanSheetVo(dto, "广告计划报表");
             SheetInfoVo planSheetVo = this.getPlanSheetVo(dto, "广告计划报表");
             Sheet sheet = new Sheet(1, 0, EffecfReportPlanEntity.class);
             Sheet sheet = new Sheet(1, 0, EffecfReportPlanEntity.class);
             sheet.setSheetName(planSheetVo.getSheetName());
             sheet.setSheetName(planSheetVo.getSheetName());
             excelWriter.write(planSheetVo.getDetails(), sheet);
             excelWriter.write(planSheetVo.getDetails(), sheet);
         }
         }
 
 
-        if (null != type && type.trim().equals("group")) {
+        if (null != type && "group".equals(type.trim())) {
             SheetInfoVo campaignSheetVo = this.getGroupSheetVo(dto, "广告组报表");
             SheetInfoVo campaignSheetVo = this.getGroupSheetVo(dto, "广告组报表");
             Sheet sheet = new Sheet(1, 0, EffecfReportGroupEntity.class);
             Sheet sheet = new Sheet(1, 0, EffecfReportGroupEntity.class);
             sheet.setSheetName(campaignSheetVo.getSheetName());
             sheet.setSheetName(campaignSheetVo.getSheetName());
             excelWriter.write(campaignSheetVo.getDetails(), sheet);
             excelWriter.write(campaignSheetVo.getDetails(), sheet);
         }
         }
 
 
-        if (null != type && type.trim().equals("creative")) {
+        if (null != type && "creative".equals(type.trim())) {
             SheetInfoVo creativeSheetVo = this.getCreativeSheetVo(dto, "广告创意");
             SheetInfoVo creativeSheetVo = this.getCreativeSheetVo(dto, "广告创意");
             Sheet sheet = new Sheet(1, 0, EffecfReportCreativeEntity.class);
             Sheet sheet = new Sheet(1, 0, EffecfReportCreativeEntity.class);
             sheet.setSheetName(creativeSheetVo.getSheetName());
             sheet.setSheetName(creativeSheetVo.getSheetName());

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

@@ -138,7 +138,7 @@ public class BindAccountLoginController {
         }
         }
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String roleCode = sysRoleService.getRoleCodeByUserId(user.getId());
         String roleCode = sysRoleService.getRoleCodeByUserId(user.getId());
-        if(!roleCode.equals("admin")){
+        if(!"admin".equals(roleCode)){
             queryWrapper.eq("user_id", user.getId());
             queryWrapper.eq("user_id", user.getId());
         }
         }
         queryWrapper.orderByDesc("id");
         queryWrapper.orderByDesc("id");

+ 186 - 116
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BytedanceMusicInfoController.java

@@ -1,7 +1,9 @@
 package org.jeecg.modules.ctop.controller;
 package org.jeecg.modules.ctop.controller;
 
 
+import cn.com.ctop.common.module.service.IFileInfoService;
 import cn.com.ctop.crawler.modules.music.entity.BytedanceMusicInfo;
 import cn.com.ctop.crawler.modules.music.entity.BytedanceMusicInfo;
 import cn.com.ctop.crawler.modules.music.service.IBytedanceMusicInfoService;
 import cn.com.ctop.crawler.modules.music.service.IBytedanceMusicInfoService;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -14,137 +16,205 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.*;
+import java.net.URLEncoder;
 import java.util.Arrays;
 import java.util.Arrays;
 
 
- /**
+/**
  * 音乐信息
  * 音乐信息
+ *
  * @author jeecg-boot
  * @author jeecg-boot
- * @date   2020-10-28
  * @version V1.0
  * @version V1.0
+ * @date 2020-10-28
  */
  */
 @Slf4j
 @Slf4j
-@Api(tags="音乐信息")
+@Api(tags = "音乐信息")
 @RestController
 @RestController
 @RequestMapping("/ctop/bytedanceMusicInfo")
 @RequestMapping("/ctop/bytedanceMusicInfo")
 public class BytedanceMusicInfoController {
 public class BytedanceMusicInfoController {
-	@Autowired
-	private IBytedanceMusicInfoService bytedanceMusicInfoService;
+    @Autowired
+    private IBytedanceMusicInfoService bytedanceMusicInfoService;
+    @Autowired
+    private IFileInfoService fileInfoService;
 
 
-	/**
-	  * 分页列表查询
-	 * @param bytedanceMusicInfo
-	 * @param pageNo
-	 * @param pageSize
-	 * @param req
-	 * @return
-	 */
-	@ApiOperation(value="音乐信息-分页列表查询", notes="音乐信息-分页列表查询")
-	@GetMapping(value = "/list")
-	public Result<IPage<BytedanceMusicInfo>> queryPageList(BytedanceMusicInfo bytedanceMusicInfo,
-														   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
-														   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
-														   HttpServletRequest req) {
-		Result<IPage<BytedanceMusicInfo>> result = new Result<>();
-		QueryWrapper<BytedanceMusicInfo> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceMusicInfo, req.getParameterMap());
-		Page<BytedanceMusicInfo> page = new Page<>(pageNo, pageSize);
-		IPage<BytedanceMusicInfo> pageList = bytedanceMusicInfoService.page(page, queryWrapper);
-		result.setSuccess(true);
-		result.setResult(pageList);
-		return result;
-	}
+    @PostMapping(value = "/netEaseDownLoad")
+    public void netEasedownLoad(@RequestBody JSONObject data, HttpServletResponse response) throws Exception {
+        String fileName = data.getString("musicName");
+        String fileUrl = data.getString("musicUrl");
+        String filePath = fileInfoService.downLoadByUrl(fileUrl);
+        File file = new File(filePath);
+        InputStream fis = new BufferedInputStream(new FileInputStream(filePath));
+        byte[] buffer = new byte[fis.available()];
+        fis.read(buffer);
+        fis.close();
+        response.reset();
+        response.setCharacterEncoding("UTF-8");
+        fileName = URLEncoder.encode(fileName, "UTF-8");
+        response.addHeader("Content-Disposition", "attachment;filename=" + fileName);
+        response.addHeader("Content-Length", file.length()+ "");
+        OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
+        response.setContentType("audio/mp3");
+        toClient.write(buffer);
+        toClient.flush();
+        toClient.close();
+    }
 
 
-	/**
-	  *   添加
-	 * @param bytedanceMusicInfo
-	 * @return
-	 */
-	@ApiOperation(value="音乐信息-添加", notes="音乐信息-添加")
-	@PostMapping(value = "/add")
-	public Result<BytedanceMusicInfo> add(@RequestBody BytedanceMusicInfo bytedanceMusicInfo) {
-		Result<BytedanceMusicInfo> result = new Result<>();
-		try {
-			bytedanceMusicInfoService.save(bytedanceMusicInfo);
-			result.success("添加成功!");
-		} catch (Exception e) {
-			log.error(e.getMessage(),e);
-			result.error500("操作失败");
-		}
-		return result;
-	}
+    @PostMapping(value = "/downLoad")
+    public void downLoad(Long id, HttpServletResponse response) throws Exception {
+        if (null == id || id == 0) {
+            log.error("抖音音乐文件下载异常:参数异常");
+            return;
+        }
+        BytedanceMusicInfo musicInfo = bytedanceMusicInfoService.getById(id);
+        if (null == musicInfo) {
+            log.error("抖音音乐文件下载异常:音乐数据不存在");
+            return;
+        }
+        musicInfo.setDownloadNum(musicInfo.getDownloadNum() + 1);
+        bytedanceMusicInfoService.updateById(musicInfo);
+        String author = musicInfo.getAuthor();
+        String name = musicInfo.getName();
+        String fileName = author + "-" + name + ".mp3";
+        String filePath = fileInfoService.downLoadByUrl(musicInfo.getMusicUrl());
+        File file = new File(filePath);
+        InputStream fis = new BufferedInputStream(new FileInputStream(filePath));
+        byte[] buffer = new byte[fis.available()];
+        fis.read(buffer);
+        fis.close();
+        response.reset();
+        response.setCharacterEncoding("UTF-8");
+        fileName = URLEncoder.encode(fileName, "UTF-8");
+        response.addHeader("Content-Disposition", "attachment;filename=" + fileName);
+        response.addHeader("Content-Length", buffer.length + "");
+        OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
+        response.setContentType("audio/mp3");
+        toClient.write(buffer);
+        toClient.flush();
+        toClient.close();
+    }
 
 
-	/**
-	  *  编辑
-	 * @param bytedanceMusicInfo
-	 * @return
-	 */
-	@ApiOperation(value="音乐信息-编辑", notes="音乐信息-编辑")
-	@PutMapping(value = "/edit")
-	public Result<BytedanceMusicInfo> edit(@RequestBody BytedanceMusicInfo bytedanceMusicInfo) {
-		Result<BytedanceMusicInfo> result = new Result<BytedanceMusicInfo>();
-		BytedanceMusicInfo bytedanceMusicInfoEntity = bytedanceMusicInfoService.getById(bytedanceMusicInfo.getId());
-		if(bytedanceMusicInfoEntity==null) {
-			result.error500("未找到对应实体");
-		}else {
-			boolean ok = bytedanceMusicInfoService.updateById(bytedanceMusicInfo);
-			if(ok) {
-				result.success("修改成功!");
-			}
-		}
+    /**
+     * 分页列表查询
+     *
+     * @param bytedanceMusicInfo
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @ApiOperation(value = "音乐信息-分页列表查询", notes = "音乐信息-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<BytedanceMusicInfo>> queryPageList(BytedanceMusicInfo bytedanceMusicInfo,
+                                                           @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                           @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                           HttpServletRequest req) {
+        Result<IPage<BytedanceMusicInfo>> result = new Result<>();
+        QueryWrapper<BytedanceMusicInfo> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceMusicInfo, req.getParameterMap());
+        Page<BytedanceMusicInfo> page = new Page<>(pageNo, pageSize);
+        IPage<BytedanceMusicInfo> pageList = bytedanceMusicInfoService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
 
 
-		return result;
-	}
+    /**
+     * 添加
+     *
+     * @param bytedanceMusicInfo
+     * @return
+     */
+    @ApiOperation(value = "音乐信息-添加", notes = "音乐信息-添加")
+    @PostMapping(value = "/add")
+    public Result<BytedanceMusicInfo> add(@RequestBody BytedanceMusicInfo bytedanceMusicInfo) {
+        Result<BytedanceMusicInfo> result = new Result<>();
+        try {
+            bytedanceMusicInfoService.save(bytedanceMusicInfo);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
 
 
-	/**
-	  *   通过id删除
-	 * @param id
-	 * @return
-	 */
-	@ApiOperation(value="音乐信息-通过id删除", notes="音乐信息-通过id删除")
-	@DeleteMapping(value = "/delete")
-	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
-		try {
-			bytedanceMusicInfoService.removeById(id);
-		} catch (Exception e) {
-			log.error("删除失败",e.getMessage());
-			return Result.error("删除失败!");
-		}
-		return Result.ok("删除成功!");
-	}
+    /**
+     * 编辑
+     *
+     * @param bytedanceMusicInfo
+     * @return
+     */
+    @ApiOperation(value = "音乐信息-编辑", notes = "音乐信息-编辑")
+    @PutMapping(value = "/edit")
+    public Result<BytedanceMusicInfo> edit(@RequestBody BytedanceMusicInfo bytedanceMusicInfo) {
+        Result<BytedanceMusicInfo> result = new Result<BytedanceMusicInfo>();
+        BytedanceMusicInfo bytedanceMusicInfoEntity = bytedanceMusicInfoService.getById(bytedanceMusicInfo.getId());
+        if (bytedanceMusicInfoEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = bytedanceMusicInfoService.updateById(bytedanceMusicInfo);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
 
 
-	/**
-	  *  批量删除
-	 * @param ids
-	 * @return
-	 */
-	@ApiOperation(value="音乐信息-批量删除", notes="音乐信息-批量删除")
-	@DeleteMapping(value = "/deleteBatch")
-	public Result<BytedanceMusicInfo> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		Result<BytedanceMusicInfo> result = new Result<>();
-		if(ids==null || "".equals(ids.trim())) {
-			result.error500("参数不识别!");
-		}else {
-			this.bytedanceMusicInfoService.removeByIds(Arrays.asList(ids.split(",")));
-			result.success("删除成功!");
-		}
-		return result;
-	}
+        return result;
+    }
 
 
-	/**
-	  * 通过id查询
-	 * @param id
-	 * @return
-	 */
-	@ApiOperation(value="音乐信息-通过id查询", notes="音乐信息-通过id查询")
-	@GetMapping(value = "/queryById")
-	public Result<BytedanceMusicInfo> queryById(@RequestParam(name="id",required=true) String id) {
-		Result<BytedanceMusicInfo> result = new Result<>();
-		BytedanceMusicInfo bytedanceMusicInfo = bytedanceMusicInfoService.getById(id);
-		if(bytedanceMusicInfo==null) {
-			result.error500("未找到对应实体");
-		}else {
-			result.setResult(bytedanceMusicInfo);
-			result.setSuccess(true);
-		}
-		return result;
-	}
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "音乐信息-通过id删除", notes = "音乐信息-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        try {
+            bytedanceMusicInfoService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @ApiOperation(value = "音乐信息-批量删除", notes = "音乐信息-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<BytedanceMusicInfo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<BytedanceMusicInfo> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.bytedanceMusicInfoService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "音乐信息-通过id查询", notes = "音乐信息-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<BytedanceMusicInfo> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<BytedanceMusicInfo> result = new Result<>();
+        BytedanceMusicInfo bytedanceMusicInfo = bytedanceMusicInfoService.getById(id);
+        if (bytedanceMusicInfo == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(bytedanceMusicInfo);
+            result.setSuccess(true);
+        }
+        return result;
+    }
 }
 }

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

@@ -1,6 +1,8 @@
 package org.jeecg.modules.ctop.controller;
 package org.jeecg.modules.ctop.controller;
 
 
+import cn.com.ctop.crawler.modules.music.entity.BytedanceMusicInfo;
 import cn.com.ctop.crawler.modules.music.entity.BytedanceMusicType;
 import cn.com.ctop.crawler.modules.music.entity.BytedanceMusicType;
+import cn.com.ctop.crawler.modules.music.service.IBytedanceMusicInfoService;
 import cn.com.ctop.crawler.modules.music.service.IBytedanceMusicTypeService;
 import cn.com.ctop.crawler.modules.music.service.IBytedanceMusicTypeService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -12,9 +14,11 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Arrays;
+import java.util.List;
 
 
- /**
+/**
  * 音乐类型信息
  * 音乐类型信息
  * @author jeecg-boot
  * @author jeecg-boot
  * @date   2020-10-28
  * @date   2020-10-28
@@ -26,6 +30,8 @@ import java.util.Arrays;
 public class BytedanceMusicTypeController {
 public class BytedanceMusicTypeController {
 	@Autowired
 	@Autowired
 	private IBytedanceMusicTypeService bytedanceMusicTypeService;
 	private IBytedanceMusicTypeService bytedanceMusicTypeService;
+	@Autowired
+	private IBytedanceMusicInfoService bytedanceMusicInfoService;
 
 
 	/**
 	/**
 	  * 分页列表查询
 	  * 分页列表查询
@@ -35,15 +41,44 @@ public class BytedanceMusicTypeController {
 	 * @param req
 	 * @param req
 	 * @return
 	 * @return
 	 */
 	 */
-	@GetMapping(value = "/list")
+	@PostMapping(value = "/list")
 	public Result<IPage<BytedanceMusicType>> queryPageList(BytedanceMusicType bytedanceMusicType,
 	public Result<IPage<BytedanceMusicType>> queryPageList(BytedanceMusicType bytedanceMusicType,
 														   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 														   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 														   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
 														   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
 														   HttpServletRequest req) {
 														   HttpServletRequest req) {
+		String typeValue = bytedanceMusicType.getTypeValue();
+		String author = bytedanceMusicType.getAuthor();
+		String musicName = bytedanceMusicType.getMusicName();
+		bytedanceMusicType.setTypeValue(null);
+		bytedanceMusicType.setAuthor(null);
+		bytedanceMusicType.setMusicName(null);
 		Result<IPage<BytedanceMusicType>> result = new Result<>();
 		Result<IPage<BytedanceMusicType>> result = new Result<>();
 		QueryWrapper<BytedanceMusicType> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceMusicType, req.getParameterMap());
 		QueryWrapper<BytedanceMusicType> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceMusicType, req.getParameterMap());
+		if(null!=typeValue&&!"".equals(typeValue.trim())){
+			queryWrapper.like("type_value",typeValue);
+		}else {
+			queryWrapper.select("DISTINCT music_id");
+		}
+		if(null!=author&&!"".equals(author.trim())){
+			queryWrapper.like("author",author);
+		}
+		if(null!=musicName&&!"".equals(musicName.trim())){
+			queryWrapper.like("music_name",musicName);
+		}
 		Page<BytedanceMusicType> page = new Page<>(pageNo, pageSize);
 		Page<BytedanceMusicType> page = new Page<>(pageNo, pageSize);
 		IPage<BytedanceMusicType> pageList = bytedanceMusicTypeService.page(page, queryWrapper);
 		IPage<BytedanceMusicType> pageList = bytedanceMusicTypeService.page(page, queryWrapper);
+		List<BytedanceMusicType> records = pageList.getRecords();
+		if(null!=records&&!records.isEmpty()){
+			List<BytedanceMusicType> setRecords = new ArrayList<>();
+			for (BytedanceMusicType type:records) {
+				BytedanceMusicInfo musicInfo = bytedanceMusicInfoService.getById(type.getMusicId());
+				if(null!=musicInfo){
+					type.setMusicInfo(musicInfo);
+				}
+				setRecords.add(type);
+			}
+			pageList.setRecords(setRecords);
+		}
 		result.setSuccess(true);
 		result.setSuccess(true);
 		result.setResult(pageList);
 		result.setResult(pageList);
 		return result;
 		return result;

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

@@ -57,7 +57,6 @@ public class DictMusicTypeController {
 
 
 	/**
 	/**
 	  *   添加
 	  *   添加
-	 * @param dict_music_type
 	 * @return
 	 * @return
 	 */
 	 */
 	@PostMapping(value = "/add")
 	@PostMapping(value = "/add")

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

@@ -37,7 +37,6 @@ public class ImageCostController {
 
 
     @PostMapping("bytedance/cost/export")
     @PostMapping("bytedance/cost/export")
     public void bytedanceImageCostExport(@RequestBody JSONObject data, HttpServletResponse response) throws IOException {
     public void bytedanceImageCostExport(@RequestBody JSONObject data, HttpServletResponse response) throws IOException {
-
         SheetInfoVo vo = imageReportDailyService.getbytedanceImageCostVo(data);
         SheetInfoVo vo = imageReportDailyService.getbytedanceImageCostVo(data);
         OutputStream outputStream = response.getOutputStream();
         OutputStream outputStream = response.getOutputStream();
         String date = DateUtils.formatDate(new Date());
         String date = DateUtils.formatDate(new Date());

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

@@ -350,7 +350,7 @@ public class MaterialInfoController {
         List<Long> projectIds = null;
         List<Long> projectIds = null;
         String userId = user.getId();
         String userId = user.getId();
         String roleCode = roleService.getRoleCodeByUserId(userId);
         String roleCode = roleService.getRoleCodeByUserId(userId);
-        if (null == tagCode || tagCode.trim().equals("")) {
+        if (null == tagCode || "".equals(tagCode.trim())) {
             tagCode = null;
             tagCode = null;
         }
         }
         if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) || "operator".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "operationAssistant".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || roleCode.contains("sale")) {
         if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) || "operator".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "operationAssistant".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || roleCode.contains("sale")) {

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

@@ -584,5 +584,9 @@ public class ProjectMemberController {
 
 
     }
     }
 
 
+    public static void main(String[] args) {
+
+    }
+
 
 
 }
 }

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

@@ -65,7 +65,7 @@ public class ProjectTransferRecordController {
         QueryWrapper<ProjectTransferRecord> queryWrapper = QueryGenerator.initQueryWrapper(projectTransferRecord, req.getParameterMap());
         QueryWrapper<ProjectTransferRecord> queryWrapper = QueryGenerator.initQueryWrapper(projectTransferRecord, req.getParameterMap());
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String rodeCode = sysRoleService.getRoleCodeByUserId(sysUser.getId());
         String rodeCode = sysRoleService.getRoleCodeByUserId(sysUser.getId());
-        if (null != rodeCode && rodeCode.trim().equals("admin")) {
+        if (null != rodeCode && "admin".equals(rodeCode.trim())) {
             queryWrapper.eq("user_id", sysUser.getId());
             queryWrapper.eq("user_id", sysUser.getId());
         }
         }
         queryWrapper.ne("status", 0);
         queryWrapper.ne("status", 0);
@@ -100,7 +100,7 @@ public class ProjectTransferRecordController {
         QueryWrapper<ProjectTransferRecord> queryWrapper = QueryGenerator.initQueryWrapper(projectTransferRecord, req.getParameterMap());
         QueryWrapper<ProjectTransferRecord> queryWrapper = QueryGenerator.initQueryWrapper(projectTransferRecord, req.getParameterMap());
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String rodeCode = sysRoleService.getRoleCodeByUserId(sysUser.getId());
         String rodeCode = sysRoleService.getRoleCodeByUserId(sysUser.getId());
-        if (null != rodeCode && !rodeCode.trim().equals("admin")) {
+        if (null != rodeCode && !"admin".equals(rodeCode.trim())) {
             queryWrapper.eq("reviewer_id", sysUser.getId());
             queryWrapper.eq("reviewer_id", sysUser.getId());
         }
         }
         queryWrapper.ne("status", 0);
         queryWrapper.ne("status", 0);

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

@@ -37,6 +37,17 @@ public class PropController {
         return result;
         return result;
     }
     }
 
 
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        try {
+            propService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败",e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
     /**
     /**
      * 分页列表查询
      * 分页列表查询
      *
      *
@@ -53,6 +64,7 @@ public class PropController {
                                               HttpServletRequest req) {
                                               HttpServletRequest req) {
         Result<IPage<Prop>> result = new Result<>();
         Result<IPage<Prop>> result = new Result<>();
         QueryWrapper<Prop> queryWrapper = QueryGenerator.initQueryWrapper(prop, req.getParameterMap());
         QueryWrapper<Prop> queryWrapper = QueryGenerator.initQueryWrapper(prop, req.getParameterMap());
+        queryWrapper.orderByDesc("create_time");
         Page<Prop> page = new Page<>(pageNo, pageSize);
         Page<Prop> page = new Page<>(pageNo, pageSize);
         IPage<Prop> pageList = propService.page(page, queryWrapper);
         IPage<Prop> pageList = propService.page(page, queryWrapper);
 
 

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

@@ -99,6 +99,48 @@ public class TestController {
         }
         }
     }
     }
 
 
+    @GetMapping("getKuaishouPlanHourlyReport")
+    public Map<String,Object> getKuaishouPlanHourlyReport(String params){
+        Long start = System.currentTimeMillis();
+        Map<String,Object>result = new HashMap<>();
+        if(null == params||params.trim().equals("")){
+            ResultMapUtils.setResultMap(result,StatusCode.COMMON_PARAM_ERROR);
+            result.put("message","COMMON_PARAM_ERROR");
+            return result;
+        }
+        Long accountId = Long.parseLong(params);
+        CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
+        if(null == token){
+            ResultMapUtils.setResultMap(result,StatusCode.COMMON_PARAM_ERROR);
+            result.put("message","TOKEN_IS_NULL");
+            return result;
+        }
+        Date getDate = new Date();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH");
+        String hour = simpleDateFormat.format(getDate);
+        if ("00".equals(hour)) {
+            getDate = DateUtils.addDay(getDate, -1);
+        }
+        //1:查询当日数据
+        Date finalGetDate = getDate;
+        try {
+            kuaishouInterfaceService.getAdvertiserCampaignReportHourly(token, finalGetDate, finalGetDate);
+            ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
+            result.put("message","SUCCESS");
+            long end = System.currentTimeMillis();
+            log.info("执行时长:{}毫秒",end-start);
+            return result;
+        }catch (Exception e){
+            e.printStackTrace();
+            ResultMapUtils.setResultMap(result,StatusCode.COMMON_SERVER_ERROR);
+            result.put("message","COMMON_SERVER_ERROR");
+            return result;
+        }
+    }
+
+
+
+
     @GetMapping(value = "/getMd5")
     @GetMapping(value = "/getMd5")
     public void getMd5() {
     public void getMd5() {
         kuaiShouHistoryReportTaskService.getMd5(null, null);
         kuaiShouHistoryReportTaskService.getMd5(null, null);
@@ -666,7 +708,7 @@ public class TestController {
             List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(tokenQueryWrapper);
             List<CtopOauthToken> ctopOauthTokens = oauthTokenMapper.selectList(tokenQueryWrapper);
             if (!Check.isNull(ctopOauthTokens)) {
             if (!Check.isNull(ctopOauthTokens)) {
                 for (CtopOauthToken token : ctopOauthTokens) {
                 for (CtopOauthToken token : ctopOauthTokens) {
-                    historyReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), startDate, endDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
+                    historyReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), "2020-09-01", "2020-10-01", CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_HISTORY);
                 }
                 }
 
 
             }
             }
@@ -826,9 +868,11 @@ public class TestController {
         oauthTokenQueryWrapper.last("limit 1");
         oauthTokenQueryWrapper.last("limit 1");
         CtopOauthToken token = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
         CtopOauthToken token = oauthTokenMapper.selectOne(oauthTokenQueryWrapper);
         try {
         try {
-            kuaishouInterfaceService.getCampaignList(token, null, null);
+            // kuaishouInterfaceService.getCampaignList(token, null, null);
             //1:获取全量广告组数据
             //1:获取全量广告组数据
-            kuaishouInterfaceService.getGroupList(token, null, null);
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+            Date parse = simpleDateFormat.parse("2020-11-11");
+            kuaishouInterfaceService.getGroupList(token, parse, parse);
         } catch (Exception e) {
         } catch (Exception e) {
             e.printStackTrace();
             e.printStackTrace();
         }
         }

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

@@ -220,7 +220,7 @@ public class UserAllocationController {
             }
             }
 
 
             String authName = null;
             String authName = null;
-            if (mediaId.equals("2") || mediaId.equals("4")) {
+            if ("2".equals(mediaId) || "4".equals(mediaId)) {
                 Map<String, Object> advertiseBaseInfoMap = kuaishouInterfaceService.advertiserInfo(accountId, oauthToken.getAccessToken());
                 Map<String, Object> advertiseBaseInfoMap = kuaishouInterfaceService.advertiserInfo(accountId, oauthToken.getAccessToken());
                 Integer code = (Integer) advertiseBaseInfoMap.get("code");
                 Integer code = (Integer) advertiseBaseInfoMap.get("code");
                 if (code != 0) {
                 if (code != 0) {
@@ -228,7 +228,7 @@ public class UserAllocationController {
 
 
                 }
                 }
                 authName = (String) advertiseBaseInfoMap.get("userName");
                 authName = (String) advertiseBaseInfoMap.get("userName");
-            } else if (mediaId.equals("1") || mediaId.equals("3")) {
+            } else if ("1".equals(mediaId) || "3".equals(mediaId)) {
                 Map<String, Object> advertiserDataMap = advertiserDataService.getAdvertiserInfo(String.valueOf(accountId), oauthToken.getAccessToken());
                 Map<String, Object> advertiserDataMap = advertiserDataService.getAdvertiserInfo(String.valueOf(accountId), oauthToken.getAccessToken());
                 Integer code = (Integer) advertiserDataMap.get("code");
                 Integer code = (Integer) advertiserDataMap.get("code");
                 if (code != 0) {
                 if (code != 0) {

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

@@ -1,10 +1,12 @@
 package org.jeecg.modules.ctop.controller;
 package org.jeecg.modules.ctop.controller;
 
 
-import cn.com.ctop.manage.modules.actor.entity.Yard;
-import cn.com.ctop.manage.modules.actor.entity.YardComment;
-import cn.com.ctop.manage.modules.actor.entity.YardPhoto;
-import cn.com.ctop.manage.modules.actor.entity.YardVideo;
-import cn.com.ctop.manage.modules.actor.service.*;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.manage.modules.actor.entity.*;
+import cn.com.ctop.manage.modules.actor.service.IYardCommentService;
+import cn.com.ctop.manage.modules.actor.service.IYardPhotoService;
+import cn.com.ctop.manage.modules.actor.service.IYardService;
+import cn.com.ctop.manage.modules.actor.service.IYardVideoService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -15,7 +17,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
-import java.io.File;
 
 
 /**
 /**
  * @author yumeng
  * @author yumeng
@@ -28,8 +29,6 @@ public class YardController {
     @Autowired
     @Autowired
     private IYardPhotoService yardPhotoService;
     private IYardPhotoService yardPhotoService;
     @Autowired
     @Autowired
-    private IYardSchedulerService yardSchedulerService;
-    @Autowired
     private IYardService yardService;
     private IYardService yardService;
     @Autowired
     @Autowired
     private IYardVideoService yardVideoService;
     private IYardVideoService yardVideoService;
@@ -49,7 +48,31 @@ public class YardController {
     public Result<Yard> add(@RequestBody Yard yard) {
     public Result<Yard> add(@RequestBody Yard yard) {
         Result<Yard> result = new Result<>();
         Result<Yard> result = new Result<>();
         try {
         try {
+            String coverUrl = yard.getCoverUrl();
+            if (!Check.isNull(coverUrl) && !coverUrl.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
+                yard.setCoverUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + coverUrl);
+            }
             yardService.save(yard);
             yardService.save(yard);
+            if (null != yard.getImageUrl() && !yard.getImageUrl().isEmpty()) {
+                for (String url : yard.getImageUrl()) {
+                    YardPhoto photo = new YardPhoto();
+                    photo.setYardId(yard.getId());
+                    if (!Check.isNull(url) && !url.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
+                        photo.setPhotoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + url);
+                    }
+                    yardPhotoService.save(photo);
+                }
+            }
+            if (yard.getVideoUrl() != null && !yard.getVideoUrl().isEmpty()) {
+                for (String url : yard.getVideoUrl()) {
+                    YardVideo video = new YardVideo();
+                    video.setYardId(yard.getId());
+                    if (!Check.isNull(url) && !url.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
+                        video.setVideoUrl(KuaishouInterfaceConstant.HTTPS_PREFIX + url);
+                    }
+                    yardVideoService.save(video);
+                }
+            }
             result.success("添加成功!");
             result.success("添加成功!");
         } catch (Exception e) {
         } catch (Exception e) {
             log.error(e.getMessage(), e);
             log.error(e.getMessage(), e);
@@ -79,8 +102,9 @@ public class YardController {
                                              @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                              @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                              @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                              @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                              HttpServletRequest req) {
                                              HttpServletRequest req) {
-        Result<IPage<Yard>> result = new Result<IPage<Yard>>();
+        Result<IPage<Yard>> result = new Result<>();
         QueryWrapper<Yard> queryWrapper = QueryGenerator.initQueryWrapper(yard, req.getParameterMap());
         QueryWrapper<Yard> queryWrapper = QueryGenerator.initQueryWrapper(yard, req.getParameterMap());
+        queryWrapper.orderByDesc("create_time");
         Page<Yard> page = new Page<Yard>(pageNo, pageSize);
         Page<Yard> page = new Page<Yard>(pageNo, pageSize);
         IPage<Yard> pageList = yardService.page(page, queryWrapper);
         IPage<Yard> pageList = yardService.page(page, queryWrapper);
 
 
@@ -217,4 +241,17 @@ public class YardController {
         result.setResult(pageList);
         result.setResult(pageList);
         return result;
         return result;
     }
     }
+
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        try {
+            yardService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败",e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+
 }
 }

+ 48 - 16
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ImageReportDailyServiceImpl.java

@@ -31,12 +31,20 @@ public class ImageReportDailyServiceImpl implements IImageReportDailyService {
     @Override
     @Override
     public Map<String,Object> bytedanceImageCost(JSONObject data) {
     public Map<String,Object> bytedanceImageCost(JSONObject data) {
         Map<String,Object>result = new HashMap<>();
         Map<String,Object>result = new HashMap<>();
+        String order = data.getString("order");
+        if(null == order|| "".equals(order.trim())){
+            order = "desc";
+        }
+        String target = data.getString("target");
+        if(null == target|| "".equals(target.trim())){
+            target = "cost";
+        }
         String startDate = data.getString("startDate");
         String startDate = data.getString("startDate");
-        if(null == startDate||startDate.trim().equals("")){
+        if(null == startDate|| "".equals(startDate.trim())){
             startDate = null;
             startDate = null;
         }
         }
         String endDate = data.getString("endDate");
         String endDate = data.getString("endDate");
-        if(null == endDate||endDate.trim().equals("")){
+        if(null == endDate|| "".equals(endDate.trim())){
             endDate = null;
             endDate = null;
         }
         }
         JSONArray accountList = data.getJSONArray("accountList");
         JSONArray accountList = data.getJSONArray("accountList");
@@ -44,7 +52,7 @@ public class ImageReportDailyServiceImpl implements IImageReportDailyService {
             accountList = null;
             accountList = null;
         }
         }
         String code = data.getString("code");
         String code = data.getString("code");
-        if(null == code||code.trim().equals("")){
+        if(null == code|| "".equals(code.trim())){
             code = null;
             code = null;
         }
         }
         Integer pageSize = data.getInteger("pageSize");
         Integer pageSize = data.getInteger("pageSize");
@@ -56,7 +64,7 @@ public class ImageReportDailyServiceImpl implements IImageReportDailyService {
             pageSize = 10;
             pageSize = 10;
         }
         }
         PageHelper.startPage(pageNumber,pageSize);
         PageHelper.startPage(pageNumber,pageSize);
-        List<BytedanceImageCostVO> vos = bytedanceReportMaterialDailyMapper.bytedanceImageCost(startDate,endDate,accountList,code);
+        List<BytedanceImageCostVO> vos = bytedanceReportMaterialDailyMapper.bytedanceImageCost(startDate,endDate,accountList,code,order,target);
         PageInfo<BytedanceImageCostVO> pageInfo = new PageInfo<>(vos);
         PageInfo<BytedanceImageCostVO> pageInfo = new PageInfo<>(vos);
         result.put("data",pageInfo);
         result.put("data",pageInfo);
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
@@ -66,12 +74,20 @@ public class ImageReportDailyServiceImpl implements IImageReportDailyService {
     @Override
     @Override
     public SheetInfoVo getbytedanceImageCostVo(JSONObject data) {
     public SheetInfoVo getbytedanceImageCostVo(JSONObject data) {
         SheetInfoVo sheetInfoVo = new SheetInfoVo<BytedanceImageCostVOEntity>();
         SheetInfoVo sheetInfoVo = new SheetInfoVo<BytedanceImageCostVOEntity>();
+        String order = data.getString("order");
+        if(null == order|| "".equals(order.trim())){
+            order = "desc";
+        }
+        String target = data.getString("target");
+        if(null == target|| "".equals(target.trim())){
+            target = "cost";
+        }
         String startDate = data.getString("startDate");
         String startDate = data.getString("startDate");
-        if(null == startDate||startDate.trim().equals("")){
+        if(null == startDate|| "".equals(startDate.trim())){
             startDate = null;
             startDate = null;
         }
         }
         String endDate = data.getString("endDate");
         String endDate = data.getString("endDate");
-        if(null == endDate||endDate.trim().equals("")){
+        if(null == endDate|| "".equals(endDate.trim())){
             endDate = null;
             endDate = null;
         }
         }
         JSONArray accountList = data.getJSONArray("accountList");
         JSONArray accountList = data.getJSONArray("accountList");
@@ -79,10 +95,10 @@ public class ImageReportDailyServiceImpl implements IImageReportDailyService {
             accountList = null;
             accountList = null;
         }
         }
         String code = data.getString("code");
         String code = data.getString("code");
-        if(null == code||code.trim().equals("")){
+        if(null == code|| "".equals(code.trim())){
             code = null;
             code = null;
         }
         }
-        List<BytedanceImageCostVOEntity>details = bytedanceReportMaterialDailyMapper.bytedanceImageCostEntity(startDate,endDate,accountList,code);
+        List<BytedanceImageCostVOEntity>details = bytedanceReportMaterialDailyMapper.bytedanceImageCostEntity(startDate,endDate,accountList,code,order,target);
         sheetInfoVo.setDetails(details);
         sheetInfoVo.setDetails(details);
         return sheetInfoVo;
         return sheetInfoVo;
     }
     }
@@ -90,12 +106,20 @@ public class ImageReportDailyServiceImpl implements IImageReportDailyService {
     @Override
     @Override
     public Map<String, Object> kuaishouImageCost(JSONObject data) {
     public Map<String, Object> kuaishouImageCost(JSONObject data) {
         Map<String,Object>result = new HashMap<>();
         Map<String,Object>result = new HashMap<>();
+        String order = data.getString("order");
+        if(null == order|| "".equals(order.trim())){
+            order = "desc";
+        }
+        String target = data.getString("target");
+        if(null == target|| "".equals(target.trim())){
+            target = "cost";
+        }
         String startDate = data.getString("startDate");
         String startDate = data.getString("startDate");
-        if(null == startDate||startDate.trim().equals("")){
+        if(null == startDate|| "".equals(startDate.trim())){
             startDate = null;
             startDate = null;
         }
         }
         String endDate = data.getString("endDate");
         String endDate = data.getString("endDate");
-        if(null == endDate||endDate.trim().equals("")){
+        if(null == endDate|| "".equals(endDate.trim())){
             endDate = null;
             endDate = null;
         }
         }
         JSONArray accountList = data.getJSONArray("accountList");
         JSONArray accountList = data.getJSONArray("accountList");
@@ -103,7 +127,7 @@ public class ImageReportDailyServiceImpl implements IImageReportDailyService {
             accountList = null;
             accountList = null;
         }
         }
         String code = data.getString("code");
         String code = data.getString("code");
-        if(null == code||code.trim().equals("")){
+        if(null == code|| "".equals(code.trim())){
             code = null;
             code = null;
         }
         }
         Integer pageSize = data.getInteger("pageSize");
         Integer pageSize = data.getInteger("pageSize");
@@ -115,7 +139,7 @@ public class ImageReportDailyServiceImpl implements IImageReportDailyService {
             pageSize = 10;
             pageSize = 10;
         }
         }
         PageHelper.startPage(pageNumber,pageSize);
         PageHelper.startPage(pageNumber,pageSize);
-        List<KuaishouImageCostVO> vos = kuaishouReportDailyImageMapper.imageCost(startDate,endDate,accountList,code);
+        List<KuaishouImageCostVO> vos = kuaishouReportDailyImageMapper.imageCost(startDate,endDate,accountList,code,order,target);
         PageInfo<KuaishouImageCostVO> pageInfo = new PageInfo<>(vos);
         PageInfo<KuaishouImageCostVO> pageInfo = new PageInfo<>(vos);
         result.put("data",pageInfo);
         result.put("data",pageInfo);
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
@@ -125,12 +149,20 @@ public class ImageReportDailyServiceImpl implements IImageReportDailyService {
     @Override
     @Override
     public SheetInfoVo getkuaishouImageCostVo(JSONObject data) {
     public SheetInfoVo getkuaishouImageCostVo(JSONObject data) {
         SheetInfoVo sheetInfoVo = new SheetInfoVo<KuaishouImageCostVOEntity>();
         SheetInfoVo sheetInfoVo = new SheetInfoVo<KuaishouImageCostVOEntity>();
+        String order = data.getString("order");
+        if(null == order|| "".equals(order.trim())){
+            order = "desc";
+        }
+        String target = data.getString("target");
+        if(null == target|| "".equals(target.trim())){
+            target = "cost";
+        }
         String startDate = data.getString("startDate");
         String startDate = data.getString("startDate");
-        if(null == startDate||startDate.trim().equals("")){
+        if(null == startDate|| "".equals(startDate.trim())){
             startDate = null;
             startDate = null;
         }
         }
         String endDate = data.getString("endDate");
         String endDate = data.getString("endDate");
-        if(null == endDate||endDate.trim().equals("")){
+        if(null == endDate|| "".equals(endDate.trim())){
             endDate = null;
             endDate = null;
         }
         }
         JSONArray accountList = data.getJSONArray("accountList");
         JSONArray accountList = data.getJSONArray("accountList");
@@ -138,11 +170,11 @@ public class ImageReportDailyServiceImpl implements IImageReportDailyService {
             accountList = null;
             accountList = null;
         }
         }
         String code = data.getString("code");
         String code = data.getString("code");
-        if(null == code||code.trim().equals("")){
+        if(null == code|| "".equals(code.trim())){
             code = null;
             code = null;
         }
         }
         sheetInfoVo.setSheetName("快手图片消耗统计");
         sheetInfoVo.setSheetName("快手图片消耗统计");
-        List<KuaishouImageCostVOEntity> details = kuaishouReportDailyImageMapper.imageCostEntity(startDate,endDate,accountList,code);
+        List<KuaishouImageCostVOEntity> details = kuaishouReportDailyImageMapper.imageCostEntity(startDate,endDate,accountList,code,order,target);
         sheetInfoVo.setDetails(details);
         sheetInfoVo.setDetails(details);
         return sheetInfoVo;
         return sheetInfoVo;
     }
     }

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

@@ -38,7 +38,7 @@ public class MediaReportServiceImpl implements IMediaReportService {
     @Override
     @Override
     public PageInfo<JSONObject> queryReportByCondition(int pageNO, int pageSize, JSONObject requestBody) {
     public PageInfo<JSONObject> queryReportByCondition(int pageNO, int pageSize, JSONObject requestBody) {
         PageInfo<JSONObject> pageInfo;
         PageInfo<JSONObject> pageInfo;
-        if(requestBody.getString("companyId").equals("6weq589875c040119adst08751712368")){
+        if("6weq589875c040119adst08751712368".equals(requestBody.getString("companyId"))){
             pageInfo=getAgentReportByCondition(pageNO,pageSize,requestBody);
             pageInfo=getAgentReportByCondition(pageNO,pageSize,requestBody);
         }else {
         }else {
             pageInfo=getMediaReportByCondition(pageNO,pageSize,requestBody);
             pageInfo=getMediaReportByCondition(pageNO,pageSize,requestBody);
@@ -65,7 +65,7 @@ public class MediaReportServiceImpl implements IMediaReportService {
     @Override
     @Override
     public List<JSONObject> queryReportByCondition(JSONObject requestBody) {
     public List<JSONObject> queryReportByCondition(JSONObject requestBody) {
         List<JSONObject> list;
         List<JSONObject> list;
-        if(requestBody.getString("companyId").equals("6weq589875c040119adst08751712368")){
+        if("6weq589875c040119adst08751712368".equals(requestBody.getString("companyId"))){
             list=getAgentReportListByCondition(requestBody);
             list=getAgentReportListByCondition(requestBody);
         }else {
         }else {
             list=getMediaReportListByCondition(requestBody);
             list=getMediaReportListByCondition(requestBody);

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

@@ -84,13 +84,13 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
 
 
         //角色权限判断
         //角色权限判断
         List<ProjectMember> projectMemberList = null;
         List<ProjectMember> projectMemberList = null;
-        if (roleCode.equals("plan") || roleCode.equals("clip") || roleCode.equals("shot") || roleCode.equals("plane") || roleCode.equals("planeLeader")) {
+        if ("plan".equals(roleCode) || "clip".equals(roleCode) || "shot".equals(roleCode) || "plane".equals(roleCode) || "planeLeader".equals(roleCode)) {
             projectMemberList = memberMapper.designProjects(userId, mediaIds);
             projectMemberList = memberMapper.designProjects(userId, mediaIds);
-        } else if (roleCode.equals("designTeamLeader")) {
+        } else if ("designTeamLeader".equals(roleCode)) {
             projectMemberList = memberMapper.designLeaderProjects(companyId, mediaIds);
             projectMemberList = memberMapper.designLeaderProjects(companyId, mediaIds);
-        } else if (roleCode.equals("admin")) {
+        } else if ("admin".equals(roleCode)) {
             projectMemberList = memberMapper.adminProjects(mediaIds);
             projectMemberList = memberMapper.adminProjects(mediaIds);
-        } else if (roleCode.equals("operator") || roleCode.equals("operationAssistant") || roleCode.equals("touTiaoOperationManager")) {
+        } else if ("operator".equals(roleCode) || "operationAssistant".equals(roleCode) || "touTiaoOperationManager".equals(roleCode)) {
             projectMemberList = memberMapper.designProjects(userId, mediaIds);
             projectMemberList = memberMapper.designProjects(userId, mediaIds);
         } else {
         } else {
             //如果以上角色都不是的话直接查询此角色所属项目
             //如果以上角色都不是的话直接查询此角色所属项目
@@ -177,7 +177,7 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
 
 
         //角色权限判断
         //角色权限判断
         List<ProjectMember> projectMemberList = null;
         List<ProjectMember> projectMemberList = null;
-        if (roleCode.equals("admin")) {
+        if ("admin".equals(roleCode)) {
             projectMemberList = memberMapper.adminProjects(mediaIds);
             projectMemberList = memberMapper.adminProjects(mediaIds);
         } else {
         } else {
             //如果以上角色都不是的话直接查询此角色所属项目
             //如果以上角色都不是的话直接查询此角色所属项目
@@ -216,7 +216,7 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
 
 
         //角色权限判断
         //角色权限判断
         List<ProjectMember> projectMemberList = null;
         List<ProjectMember> projectMemberList = null;
-        if (roleCode.equals("admin")) {
+        if ("admin".equals(roleCode)) {
             projectMemberList = memberMapper.adminProjects(mediaIds);
             projectMemberList = memberMapper.adminProjects(mediaIds);
         } else {
         } else {
             //如果以上角色都不是的话直接查询此角色所属项目
             //如果以上角色都不是的话直接查询此角色所属项目

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

@@ -68,7 +68,7 @@ public class ReleaseViewRecordServiceImpl extends ServiceImpl<ReleaseViewRecordM
 
 
     public ReleaseViewRecord getRecordByParams(String userId,Long releaseId){
     public ReleaseViewRecord getRecordByParams(String userId,Long releaseId){
         QueryWrapper<ReleaseViewRecord> queryWrapper = new QueryWrapper<>();
         QueryWrapper<ReleaseViewRecord> queryWrapper = new QueryWrapper<>();
-        if(null!=userId&&!userId.trim().equals("")){
+        if(null!=userId&&!"".equals(userId.trim())){
             queryWrapper.eq("user_id",userId);
             queryWrapper.eq("user_id",userId);
         }
         }
         if(null!=releaseId&&releaseId!=0){
         if(null!=releaseId&&releaseId!=0){

+ 6 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/entity/PerformanceQuarter.java

@@ -92,8 +92,12 @@ public class PerformanceQuarter {
 
 
     @Override
     @Override
     public boolean equals(Object o) {
     public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
+        if (this == o){
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()){
+            return false;
+        }
         PerformanceQuarter that = (PerformanceQuarter) o;
         PerformanceQuarter that = (PerformanceQuarter) o;
         return Objects.equals(id, that.id) &&
         return Objects.equals(id, that.id) &&
                 Objects.equals(userId, that.userId) &&
                 Objects.equals(userId, that.userId) &&

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

@@ -30,8 +30,12 @@ public class CalculatePerformanceServiceImpl implements ICalculatePerformanceSer
     public void CalculateOperatePerformance(int year, String quarter, int mediaType) {
     public void CalculateOperatePerformance(int year, String quarter, int mediaType) {
         //TODO 查询配置的提成点
         //TODO 查询配置的提成点
         BigDecimal point =new BigDecimal(0);
         BigDecimal point =new BigDecimal(0);
-        if (mediaType == 1) point = RateConstant.THOUSAND_2;
-        if (mediaType == 2) point = RateConstant.THOUSAND_3;
+        if (mediaType == 1) {
+            point = RateConstant.THOUSAND_2;
+        }
+        if (mediaType == 2){
+            point = RateConstant.THOUSAND_3;
+        }
         String startDate= year+"-"+ PeriodConstant.valueOf(quarter).getStart();
         String startDate= year+"-"+ PeriodConstant.valueOf(quarter).getStart();
         String endDate= year+"-"+PeriodConstant.valueOf(quarter).getEnd();
         String endDate= year+"-"+PeriodConstant.valueOf(quarter).getEnd();
         List<JSONObject> operateCost = calculatePerformanceMapper.queryOperateCostGroupByUser(startDate, endDate, mediaType);
         List<JSONObject> operateCost = calculatePerformanceMapper.queryOperateCostGroupByUser(startDate, endDate, mediaType);

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

@@ -60,7 +60,7 @@ public class PerformanceInfoInfoServiceImpl implements IPerformanceInfoService {
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String userId = sysUser.getId();
         String userId = sysUser.getId();
         Map<String,Object> role=sysUserService.queryRoleCode(userId);
         Map<String,Object> role=sysUserService.queryRoleCode(userId);
-        if(role.get("roleName").equals("管理员")){
+        if("管理员".equals(role.get("roleName"))){
             result=sysCompanyService.list();
             result=sysCompanyService.list();
         }else {
         }else {
             String companyId=projectMemberMapper.getCompanyIdByUserId(userId);
             String companyId=projectMemberMapper.getCompanyIdByUserId(userId);

+ 11 - 10
jeecg-boot-module-system/src/main/java/org/jeecg/modules/performance/service/impl/PerformanceQuarterServiceImpl.java

@@ -48,10 +48,10 @@ public class PerformanceQuarterServiceImpl extends ServiceImpl<PerformanceQuarte
         String[] columns={"user_id","user_name","company_name","role_name","media_type","year","quarter","cost","point","performance","additional_fees"};
         String[] columns={"user_id","user_name","company_name","role_name","media_type","year","quarter","cost","point","performance","additional_fees"};
         quarterWrapper.select(columns);
         quarterWrapper.select(columns);
         Map<String,Object> map = new HashMap<>(10);
         Map<String,Object> map = new HashMap<>(10);
-        if(!requestBody.getString("company").equals("")) {
+        if(!"".equals(requestBody.getString("company"))) {
             map.put("company_id",requestBody.getString("company"));
             map.put("company_id",requestBody.getString("company"));
         }
         }
-        if(!requestBody.getString("department").equals("")) {
+        if(!"".equals(requestBody.getString("department"))) {
             map.put("department",requestBody.getString("department"));
             map.put("department",requestBody.getString("department"));
         }
         }
         if(requestBody.getInteger("mediaType")!=0) {
         if(requestBody.getInteger("mediaType")!=0) {
@@ -60,10 +60,10 @@ public class PerformanceQuarterServiceImpl extends ServiceImpl<PerformanceQuarte
         if(requestBody.getInteger("year")!=0) {
         if(requestBody.getInteger("year")!=0) {
             map.put("year",requestBody.getInteger("year"));
             map.put("year",requestBody.getInteger("year"));
         }
         }
-        if(!requestBody.getString("quarter").equals("")) {
+        if(!"".equals(requestBody.getString("quarter"))) {
             map.put("quarter",requestBody.getString("quarter"));
             map.put("quarter",requestBody.getString("quarter"));
         }
         }
-        if(!requestBody.getString("roleCode").equals("")) {
+        if(!"".equals(requestBody.getString("roleCode"))) {
             map.put("role_code",requestBody.getString("roleCode"));
             map.put("role_code",requestBody.getString("roleCode"));
         }
         }
         quarterWrapper.allEq(map);
         quarterWrapper.allEq(map);
@@ -77,10 +77,10 @@ public class PerformanceQuarterServiceImpl extends ServiceImpl<PerformanceQuarte
         String[] columns={"user_id","user_name","company_name","department","role_name","media_type","year","quarter","cost","point","performance","additional_fees"};
         String[] columns={"user_id","user_name","company_name","department","role_name","media_type","year","quarter","cost","point","performance","additional_fees"};
         quarterWrapper.select(columns);
         quarterWrapper.select(columns);
         Map<String,Object> map = new HashMap<>(16);
         Map<String,Object> map = new HashMap<>(16);
-        if(!requestBody.getString("company").equals("")) {
+        if(!"".equals(requestBody.getString("company"))) {
             map.put("company_id",requestBody.getString("company"));
             map.put("company_id",requestBody.getString("company"));
         }
         }
-        if(!requestBody.getString("department").equals("")) {
+        if(!"".equals(requestBody.getString("department"))) {
             map.put("department",requestBody.getString("department"));
             map.put("department",requestBody.getString("department"));
         }
         }
         if(requestBody.getInteger("mediaType")!=0) {
         if(requestBody.getInteger("mediaType")!=0) {
@@ -89,18 +89,19 @@ public class PerformanceQuarterServiceImpl extends ServiceImpl<PerformanceQuarte
         if(requestBody.getInteger("year")!=0) {
         if(requestBody.getInteger("year")!=0) {
             map.put("year",requestBody.getInteger("year"));
             map.put("year",requestBody.getInteger("year"));
         }
         }
-        if(!requestBody.getString("quarter").equals("")) {
+        if(!"".equals(requestBody.getString("quarter"))) {
             map.put("quarter",requestBody.getString("quarter"));
             map.put("quarter",requestBody.getString("quarter"));
         }
         }
-        if(!requestBody.getString("roleCode").equals("")) {
+        if(!"".equals(requestBody.getString("roleCode"))) {
             map.put("role_code",requestBody.getString("roleCode"));
             map.put("role_code",requestBody.getString("roleCode"));
         }
         }
         quarterWrapper.allEq(map);
         quarterWrapper.allEq(map);
         quarterWrapper.like("user_name",requestBody.getString("userName"));
         quarterWrapper.like("user_name",requestBody.getString("userName"));
-        if(order.equals("asc"))
+        if("asc".equals(order)){
             quarterWrapper.orderByAsc("cost");
             quarterWrapper.orderByAsc("cost");
-        else
+        } else{
             quarterWrapper.orderByDesc("cost");
             quarterWrapper.orderByDesc("cost");
+        }
         PageHelper.startPage(pageNo,pageSize);
         PageHelper.startPage(pageNo,pageSize);
         List<PerformanceQuarter> maps = performanceQuarterMapper.selectList(quarterWrapper);
         List<PerformanceQuarter> maps = performanceQuarterMapper.selectList(quarterWrapper);
         return (PageInfo<PerformanceQuarter>) new PageInfo(maps);
         return (PageInfo<PerformanceQuarter>) new PageInfo(maps);

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/aspect/DictAspect.java

@@ -104,11 +104,11 @@ public class DictAspect {
                             String text = field.getAnnotation(Dict.class).dicText();
                             String text = field.getAnnotation(Dict.class).dicText();
                             String table = field.getAnnotation(Dict.class).dictTable();
                             String table = field.getAnnotation(Dict.class).dictTable();
                             String extendsKey = field.getAnnotation(Dict.class).extendsKey();
                             String extendsKey = field.getAnnotation(Dict.class).extendsKey();
-                            if(extendsKey.trim().equals("")){
+                            if("".equals(extendsKey.trim())){
                                 extendsKey = null;
                                 extendsKey = null;
                             }
                             }
                             String extendsValue = field.getAnnotation(Dict.class).extendsValue();
                             String extendsValue = field.getAnnotation(Dict.class).extendsValue();
-                            if(extendsValue.trim().equals("")){
+                            if("".equals(extendsValue.trim())){
                                 extendsValue = null;
                                 extendsValue = null;
                             }
                             }
                             String key = String.valueOf(item.get(field.getName()));
                             String key = String.valueOf(item.get(field.getName()));

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

@@ -97,7 +97,7 @@ public class LoginController {
         Result<JSONObject> result = new Result<>();
         Result<JSONObject> result = new Result<>();
         //1:根据code值获取用户飞书信息
         //1:根据code值获取用户飞书信息
         try {
         try {
-            if(code.trim().equals("code")){
+            if("code".equals(code.trim())){
                 JSONObject setData = new JSONObject();
                 JSONObject setData = new JSONObject();
                 String url = AuthProvider.getAuthUrl("");
                 String url = AuthProvider.getAuthUrl("");
                 setData.put("url",url);
                 setData.put("url",url);
@@ -113,7 +113,7 @@ public class LoginController {
             JSONObject userData = AuthProvider.getUserInfo(accessToken);
             JSONObject userData = AuthProvider.getUserInfo(accessToken);
             JSONObject dataObject = userData.getJSONObject("data");
             JSONObject dataObject = userData.getJSONObject("data");
             String email = dataObject.getString("email");
             String email = dataObject.getString("email");
-            if(null == email||email.trim().equals("")){
+            if(null == email|| "".equals(email.trim())){
                 return result.error500(StatusCode.CTOP_FEISHU_EMAIL_NOT_EXIST.getDesc());
                 return result.error500(StatusCode.CTOP_FEISHU_EMAIL_NOT_EXIST.getDesc());
             }
             }
             SysUser sysUser = sysUserService.getUserByEmail(email);
             SysUser sysUser = sysUserService.getUserByEmail(email);

+ 6 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/rule/OrgCodeRule.java

@@ -38,11 +38,15 @@ public class OrgCodeRule implements IFillRuleHandler {
         String parentId = null;
         String parentId = null;
         if (formData != null && formData.size() > 0) {
         if (formData != null && formData.size() > 0) {
             Object obj = formData.get("parentId");
             Object obj = formData.get("parentId");
-            if (obj != null) parentId = obj.toString();
+            if (obj != null){
+                parentId = obj.toString();
+            }
         } else {
         } else {
             if (params != null) {
             if (params != null) {
                 Object obj = params.get("parentId");
                 Object obj = params.get("parentId");
-                if (obj != null) parentId = obj.toString();
+                if (obj != null) {
+                    parentId = obj.toString();
+                }
             }
             }
         }
         }
 
 

File diff suppressed because it is too large
+ 658 - 654
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysBaseApiImpl.java


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

@@ -60,7 +60,7 @@ public class WpsFileController {
 		}
 		}
 	}
 	}
 	/**
 	/**
-	  * 分页列表查询
+	 * 分页列表查询
 	 * @param wpsFile
 	 * @param wpsFile
 	 * @param pageNo
 	 * @param pageNo
 	 * @param pageSize
 	 * @param pageSize
@@ -81,6 +81,8 @@ public class WpsFileController {
 		if(null!=name&&!name.trim().equals("")){
 		if(null!=name&&!name.trim().equals("")){
 			queryWrapper.like("name",name);
 			queryWrapper.like("name",name);
 		}
 		}
+		//只查询题库的文件
+		queryWrapper.eq("is_script",0);
 		LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
 		LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
 		String roleCode = sysRoleService.getRoleCodeByUserId(sysUser.getId());
 		String roleCode = sysRoleService.getRoleCodeByUserId(sysUser.getId());
 		if(null==roleCode||!roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN)){
 		if(null==roleCode||!roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN)){
@@ -94,7 +96,7 @@ public class WpsFileController {
 	}
 	}
 
 
 	/**
 	/**
-	  *   添加
+	 *   添加
 	 * @param wpsFile
 	 * @param wpsFile
 	 * @return
 	 * @return
 	 */
 	 */
@@ -114,7 +116,7 @@ public class WpsFileController {
 	}
 	}
 
 
 	/**
 	/**
-	  *  编辑
+	 *  编辑
 	 * @param wpsFile
 	 * @param wpsFile
 	 * @return
 	 * @return
 	 */
 	 */
@@ -137,7 +139,7 @@ public class WpsFileController {
 	}
 	}
 
 
 	/**
 	/**
-	  *   通过id删除
+	 *   通过id删除
 	 * @param id
 	 * @param id
 	 * @return
 	 * @return
 	 */
 	 */
@@ -155,7 +157,7 @@ public class WpsFileController {
 	}
 	}
 
 
 	/**
 	/**
-	  *  批量删除
+	 *  批量删除
 	 * @param ids
 	 * @param ids
 	 * @return
 	 * @return
 	 */
 	 */
@@ -174,7 +176,7 @@ public class WpsFileController {
 	}
 	}
 
 
 	/**
 	/**
-	  * 通过id查询
+	 * 通过id查询
 	 * @param id
 	 * @param id
 	 * @return
 	 * @return
 	 */
 	 */
@@ -202,4 +204,29 @@ public class WpsFileController {
 		String newUrl = wpsFileService.createTemplateFile(template);
 		String newUrl = wpsFileService.createTemplateFile(template);
 		return Response.success(newUrl);
 		return Response.success(newUrl);
 	}
 	}
+
+	/**
+	 *  查询题库文件
+	 */
+	@GetMapping(value = "/queryQuestionBank")
+	public Result<IPage<WpsFile>> queryQuestionBank(WpsFile wpsFile,
+													@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+													@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+													HttpServletRequest req) {
+		String name = wpsFile.getName();
+		wpsFile.setName(null);
+		Result<IPage<WpsFile>> result = new Result<>();
+		QueryWrapper<WpsFile> queryWrapper = QueryGenerator.initQueryWrapper(wpsFile, req.getParameterMap());
+		if(null!=name&&!"".equals(name.trim())){
+			queryWrapper.like("name",name);
+		}
+		//只查询题库的文件
+		queryWrapper.eq("is_script",1);
+		Page<WpsFile> page = new Page<>(pageNo, pageSize);
+		IPage<WpsFile> pageList = wpsFileService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
 }
 }

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

@@ -26,38 +26,38 @@ public class WpsFile {
 
 
 	/**id*/
 	/**id*/
 	@TableId(type = IdType.UUID)
 	@TableId(type = IdType.UUID)
-    @ApiModelProperty(value = "id")
+	@ApiModelProperty(value = "id")
 	private String id;
 	private String id;
 	/**name*/
 	/**name*/
 	@Excel(name = "name", width = 15)
 	@Excel(name = "name", width = 15)
-    @ApiModelProperty(value = "name")
+	@ApiModelProperty(value = "name")
 	private String name;
 	private String name;
 	/**version*/
 	/**version*/
 	@Excel(name = "version", width = 15)
 	@Excel(name = "version", width = 15)
-    @ApiModelProperty(value = "version")
+	@ApiModelProperty(value = "version")
 	private Integer version;
 	private Integer version;
 	/**size*/
 	/**size*/
 	@Excel(name = "size", width = 15)
 	@Excel(name = "size", width = 15)
-    @ApiModelProperty(value = "size")
+	@ApiModelProperty(value = "size")
 	private Integer size;
 	private Integer size;
 	/**creator*/
 	/**creator*/
 	@Dict(dicCode = "id",dictTable="sys_user",dicText="realname")
 	@Dict(dicCode = "id",dictTable="sys_user",dicText="realname")
-    private String creator;
+	private String creator;
 	/**createTime*/
 	/**createTime*/
 	@Excel(name = "createTime", width = 15)
 	@Excel(name = "createTime", width = 15)
-    @ApiModelProperty(value = "createTime")
+	@ApiModelProperty(value = "createTime")
 	private Long createTime;
 	private Long createTime;
 	/**modifier*/
 	/**modifier*/
 	@Excel(name = "modifier", width = 15)
 	@Excel(name = "modifier", width = 15)
-    @ApiModelProperty(value = "modifier")
+	@ApiModelProperty(value = "modifier")
 	private String modifier;
 	private String modifier;
 	/**modifyTime*/
 	/**modifyTime*/
 	@Excel(name = "modifyTime", width = 15)
 	@Excel(name = "modifyTime", width = 15)
-    @ApiModelProperty(value = "modifyTime")
+	@ApiModelProperty(value = "modifyTime")
 	private Long modifyTime;
 	private Long modifyTime;
 	/**downloadUrl*/
 	/**downloadUrl*/
 	@Excel(name = "downloadUrl", width = 15)
 	@Excel(name = "downloadUrl", width = 15)
-    @ApiModelProperty(value = "downloadUrl")
+	@ApiModelProperty(value = "downloadUrl")
 	private String downloadUrl;
 	private String downloadUrl;
 	/**deleted*/
 	/**deleted*/
 	private String deleted;
 	private String deleted;
@@ -68,10 +68,12 @@ public class WpsFile {
 
 
 	private String code;
 	private String code;
 
 
+	private Integer isScript;
+
 	public WpsFile(){super();}
 	public WpsFile(){super();}
 
 
 	public WpsFile(String name, int version, int size, String creator,
 	public WpsFile(String name, int version, int size, String creator,
-					  String modifier, long create_time, long modify_time, String download_url) {
+				   String modifier, long create_time, long modify_time, String download_url) {
 		this.name = name;
 		this.name = name;
 		this.version = version;
 		this.version = version;
 		this.size = size;
 		this.size = size;

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

@@ -21,7 +21,7 @@ public class WpsFileVersionServiceImpl extends ServiceImpl<WpsFileVersionMapper,
     @Override
     @Override
     public WpsFileVersion findByFileIdAndVersion(String fileId, Integer version) {
     public WpsFileVersion findByFileIdAndVersion(String fileId, Integer version) {
         QueryWrapper<WpsFileVersion>queryWrapper = new QueryWrapper<>();
         QueryWrapper<WpsFileVersion>queryWrapper = new QueryWrapper<>();
-        if(null!=fileId&&!fileId.trim().equals("")){
+        if(null!=fileId&&!"".equals(fileId.trim())){
             queryWrapper.eq("file_id",fileId);
             queryWrapper.eq("file_id",fileId);
         }
         }
         if(null!=version&&version!=0){
         if(null!=version&&version!=0){
@@ -34,7 +34,7 @@ public class WpsFileVersionServiceImpl extends ServiceImpl<WpsFileVersionMapper,
     @Override
     @Override
     public List<WpsFileVersion> findByFileIdOrderByVersionDesc(String fileId) {
     public List<WpsFileVersion> findByFileIdOrderByVersionDesc(String fileId) {
         QueryWrapper<WpsFileVersion>queryWrapper = new QueryWrapper<>();
         QueryWrapper<WpsFileVersion>queryWrapper = new QueryWrapper<>();
-        if(null!=fileId&&fileId.trim().equals("")){
+        if(null!=fileId&& "".equals(fileId.trim())){
             queryWrapper.eq("file_id",fileId);
             queryWrapper.eq("file_id",fileId);
         }
         }
         queryWrapper.orderByDesc("version");
         queryWrapper.orderByDesc("version");

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

@@ -19,7 +19,7 @@ public class WpsFileWatermarkServiceImpl extends ServiceImpl<WpsFileWatermarkMap
     @Override
     @Override
     public WpsFileWatermark findFirstByFileId(String fileId) {
     public WpsFileWatermark findFirstByFileId(String fileId) {
         QueryWrapper<WpsFileWatermark>queryWrapper = new QueryWrapper<>();
         QueryWrapper<WpsFileWatermark>queryWrapper = new QueryWrapper<>();
-        if(null!=fileId&&!fileId.trim().equals("")){
+        if(null!=fileId&&!"".equals(fileId.trim())){
             queryWrapper.eq("file_id",fileId);
             queryWrapper.eq("file_id",fileId);
         }
         }
         queryWrapper.orderByDesc("id").last("limit 1");
         queryWrapper.orderByDesc("id").last("limit 1");

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

@@ -18,10 +18,10 @@ public class WpsUserAclServiceImpl extends ServiceImpl<WpsUserAclMapper, WpsUser
     @Override
     @Override
     public WpsUserAcl findFirstByFileIdAndUserId(String fileId, String userId) {
     public WpsUserAcl findFirstByFileIdAndUserId(String fileId, String userId) {
         QueryWrapper<WpsUserAcl> queryWrapper = new QueryWrapper<>();
         QueryWrapper<WpsUserAcl> queryWrapper = new QueryWrapper<>();
-        if(null!=fileId&&!fileId.trim().equals("")){
+        if(null!=fileId&&!"".equals(fileId.trim())){
             queryWrapper.eq("file_id",fileId);
             queryWrapper.eq("file_id",fileId);
         }
         }
-        if(null!=userId&&!userId.trim().equals("")){
+        if(null!=userId&&!"".equals(userId.trim())){
             queryWrapper.eq("user_id",userId);
             queryWrapper.eq("user_id",userId);
         }
         }
         queryWrapper.last("limit 1");
         queryWrapper.last("limit 1");

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

@@ -38,7 +38,7 @@ public class SignatureUtil {
         // 构造签名的源字符串
         // 构造签名的源字符串
         StringBuilder contents = new StringBuilder();
         StringBuilder contents = new StringBuilder();
         for (String key : keys) {
         for (String key : keys) {
-            if (key.equals("_w_signature")) {
+            if ("_w_signature".equals(key)) {
                 continue;
                 continue;
             }
             }
             contents.append(key).append("=").append(params.get(key));
             contents.append(key).append("=").append(params.get(key));

+ 53 - 0
module-alarm/pom.xml

@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>jeecg-boot-parent</artifactId>
+        <groupId>org.jeecgframework.boot</groupId>
+        <version>2.0.2</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>cn.com.ctop</groupId>
+    <artifactId>module-alarm</artifactId>
+    <version>2.0.2</version>
+    <name>module-alarm</name>
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <maven.compiler.source>1.7</maven.compiler.source>
+        <maven.compiler.target>1.7</maven.compiler.target>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>cn.com.ctop</groupId>
+            <artifactId>module-common</artifactId>
+            <version>2.0.2</version>
+        </dependency>
+        <dependency>
+            <groupId>cn.com.ctop</groupId>
+            <artifactId>module-kuaishou</artifactId>
+            <version>2.0.2</version>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <resources>
+            <!-- 解决MyBatis配置文件引入问题 -->
+            <resource>
+                <directory>src/main/java</directory>
+                <includes>
+                    <include>**/*.properties</include>
+                    <include>**/*.xml</include>
+                </includes>
+                <!-- 是否替换资源中的属性-->
+                <filtering>false</filtering>
+            </resource>
+            <resource>
+                <directory>src/main/resources</directory>
+            </resource>
+        </resources>
+    </build>
+
+</project>

+ 278 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/constant/MatchLogic.java

@@ -0,0 +1,278 @@
+package cn.com.ctop.alarm.modules.constant;
+
+import cn.com.ctop.alarm.modules.entity.RuleGroup;
+import cn.com.ctop.common.module.utils.Check;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.xxl.job.core.enums.NoEn;
+import lombok.extern.slf4j.Slf4j;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * TODO
+ *
+ * @ClassName MatchLogic
+ * @Author ZHAOXA
+ * @date 2020-11-17 10:54
+ */
+@Slf4j
+public class MatchLogic {
+
+    /**
+     * @param type      数据类型
+     * @param condition 条件
+     * @param threshold 阈值
+     * @param value     比对值
+     * @return boolean
+     * @throws
+     * @author ZHAOXA
+     */
+    public static boolean matchCondition(JSONObject indicator, String condition, String threshold, String value, JSONObject obj) {
+        //阈值数据类型类型
+        String type = indicator.getString("dataType");
+        try {
+            if (Check.isNull(threshold) || "[]".equals(threshold)) {
+                return false;
+            }
+            if (Check.isNull(value) || "[]".equals(value)) {
+                obj.put("isNull", true);
+                return true;
+            }
+            obj.put("isNull", false);
+            if ("number".equals(type)) {
+                BigDecimal bigThr = new BigDecimal(threshold);
+                BigDecimal bigVal = new BigDecimal(value);
+                switch (condition) {
+                    case "equal":
+                        return bigVal.compareTo(bigThr) == 0;
+                    case "not_equal":
+                        return bigVal.compareTo(bigThr) != 0;
+                    case "greater":
+                        return bigVal.compareTo(bigThr) > 0;
+                    case "less":
+                        return bigVal.compareTo(bigThr) < 0;
+                    case "greater_equal":
+                        return bigVal.compareTo(bigThr) >= 0;
+                    case "less_equal":
+                        return bigVal.compareTo(bigThr) <= 0;
+                    default:
+                        log.warn("关系不匹配 type={},condition={},threshold={},value={},", type, condition, threshold, value);
+                        break;
+                }
+            } else if ("string".equals(type)) {
+                if (threshold.contains("[")) {
+                    boolean flag = false;
+                    List<String> thresholds = strToList(threshold);
+                    if ("equal".equals(condition)) {
+                        return value.equals(thresholds.get(0));
+                    } else if ("not_equal".equals(condition)) {
+                        return !value.equals(thresholds.get(0));
+                    }
+                    for (String thro : thresholds) {
+                        if ("contain".equals(condition)) {
+                            if (value.contains(thro)) {
+                                return true;
+                            }
+                        } else if ("no_contain".equals(condition)) {
+                            if (!value.contains(thro)) {
+                                return true;
+                            }
+                        }
+                    }
+                    return flag;
+                } else {
+                    switch (condition) {
+                        case "equal":
+                            return value.equals(threshold);
+                        case "not_equal":
+                            return !value.equals(threshold);
+                        case "contain":
+                            return value.contains(threshold);
+                        case "no_contain":
+                            return !value.contains(threshold);
+                        default:
+                            log.warn("关系不匹配 type={},condition={},threshold={},value={},", type, condition, threshold, value);
+                            break;
+                    }
+                }
+            } else {
+                String logicalType = indicator.getString("logicalType");
+                if (NoEn.NO1.valueStr().equals(logicalType)) {
+                    if (value.contains("[") && threshold.contains("[")) {
+                        List<String> values = strToList(value);
+                        List<String> thresholds = strToList(threshold);
+                        if (values.size() != thresholds.size()) {
+                            return true;
+                        }
+                        for (String v : values) {
+                            if (!threshold.contains(v)) {
+                                return true;
+                            }
+                        }
+                    } else {
+                        if ("contain".equals(condition)) {
+                            return threshold.contains(value);
+                        } else {
+                            return !threshold.contains(value);
+                        }
+                    }
+                } else {
+                    if (value.contains("[") && threshold.contains("[")) {
+                        List<String> values = strToList(value);
+                        if ("contain".equals(condition)) {
+                            for (String v : values) {
+                                if (!threshold.contains(v)) {
+                                    return true;
+                                }
+                            }
+                        } else {
+                            for (String v : values) {
+                                if (threshold.contains(v)) {
+                                    return true;
+                                }
+                            }
+                        }
+                    } else {
+                        if ("contain".equals(condition)) {
+                            return threshold.contains(value);
+                        } else {
+                            return !threshold.contains(value);
+                        }
+                    }
+                }
+            }
+        } catch (Exception e) {
+            log.error("条件匹配异常,入参为:type={},condition={},threshold={},value={},", type, condition, threshold, value, e);
+        }
+        return false;
+    }
+
+    /**
+     * 整理发送的消息
+     */
+    public static String getMsg(RuleGroup ruleGroup, JSONObject user, JSONObject obj, boolean isPause, String accountName) {
+        Long creativeId = obj.getLong("creativeId");
+        Long planId = obj.getLong("planId");
+        Long accountId = obj.getLong("accountId");
+        boolean isNull = obj.getBoolean("isNull");
+        StringBuffer header = new StringBuffer();
+        header.append(ruleGroup.getGroupName()).append("预警").append("<br/>").
+                append("预警账户:").append(accountId).append(",授权名称为:").append(accountName).append("<br/>");
+        if (!Check.isNull(planId) && !Check.isNull(creativeId)) {
+            header.append("预警计划:").append(planId).append("<br/>").append("预警创意:").append(creativeId).append("<br/>");
+        } else if (!Check.isNull(planId) && Check.isNull(creativeId)) {
+            header.append("预警计划:").append(planId).append("<br/>");
+        } else if (!Check.isNull(creativeId)) {
+            header.append("预警创意:").append(creativeId).append("<br/>");
+        }
+        if (isNull) {
+            header.append("该规则未匹配到投放数据").append("<br/>");
+        }
+        if (isPause) {
+            header.append("现已被关停,请您及时查看并调整!");
+        } else {
+            header.append("请您及时查看并调整!");
+        }
+        return header.toString();
+    }
+
+    /**
+     * 整理发送的消息
+     */
+    public static String getMessage(String ruleGroupName, Long accountId, String accountName, String type, String codes, boolean isNull) {
+        StringBuffer buf = new StringBuffer();
+        buf.append(ruleGroupName).append("预警").append("<br/>").
+                append("所属账户:").append(accountId).append(",授权名称为:").append(accountName).append("<br/>");
+        if ("plan".equals(type)) {
+            buf.append("预警的计划:").append(codes).append("<br/>");
+        } else if ("creative".equals(type)) {
+            buf.append("预警的创意:").append(codes).append("<br/>");
+        }
+        if (isNull) {
+            buf.append("该规则未匹配到投放数据").append("<br/>");
+        }
+        return buf.toString();
+    }
+
+    //拆分逗号拼接数据
+    public static List<String> strToList(String strings) {
+        List<String> ids = null;
+        try {
+            if (Check.isNull(strings)) {
+                return null;
+            }
+            JSONObject job = new JSONObject();
+            job.put("list", strings);
+            ids = new ArrayList<>();
+            JSONArray idList = job.getJSONArray("list");
+            for (Object id : idList) {
+                ids.add(String.valueOf(id));
+            }
+        } catch (Exception e) {
+            log.error("数据({})转list异常", strings, e);
+        }
+        return ids;
+    }
+
+    public static JSONArray getSendData(JSONArray accountDatas, JSONArray planDatas, JSONArray creativeDatas, JSONArray targetDatas) {
+        JSONArray sendData = new JSONArray();
+        if (!Check.isNull(accountDatas) && Check.isNull(planDatas) && Check.isNull(creativeDatas) && Check.isNull(targetDatas)) {
+            sendData = accountDatas;
+        } else {
+            if (!Check.isNull(planDatas) && Check.isNull(creativeDatas) && Check.isNull(targetDatas)) {
+                sendData = planDatas;
+            } else if (!Check.isNull(creativeDatas) && Check.isNull(planDatas) && Check.isNull(targetDatas)) {
+                sendData = creativeDatas;
+            } else if (!Check.isNull(targetDatas) && Check.isNull(planDatas) && Check.isNull(creativeDatas)) {
+                sendData = targetDatas;
+            } else if (!Check.isNull(planDatas) && !Check.isNull(creativeDatas) && !Check.isNull(targetDatas)) {
+                for (int i = 0; i < planDatas.size(); i++) {
+                    Long pplanId = planDatas.getJSONObject(i).getLong("planId");
+                    for (int k = 0; k < targetDatas.size(); k++) {
+                        Long tplanId = targetDatas.getJSONObject(k).getLong("planId");
+                        for (int j = 0; j < creativeDatas.size(); j++) {
+                            Long cplanId = creativeDatas.getJSONObject(j).getLong("planId");
+                            if (cplanId == tplanId && cplanId == pplanId) {
+                                sendData.add(creativeDatas.getJSONObject(j));
+                            }
+                        }
+                    }
+                }
+            } else if (!Check.isNull(planDatas) && !Check.isNull(targetDatas) && Check.isNull(creativeDatas)) {
+                for (int i = 0; i < planDatas.size(); i++) {
+                    Long pplanId = planDatas.getJSONObject(i).getLong("planId");
+                    for (int k = 0; k < targetDatas.size(); k++) {
+                        Long tplanId = targetDatas.getJSONObject(k).getLong("planId");
+                        if (tplanId == pplanId) {
+                            sendData.add(targetDatas.getJSONObject(k));
+                        }
+                    }
+                }
+            } else if (!Check.isNull(planDatas) && Check.isNull(targetDatas) && !Check.isNull(creativeDatas)) {
+                for (int i = 0; i < planDatas.size(); i++) {
+                    Long pplanId = planDatas.getJSONObject(i).getLong("planId");
+                    for (int k = 0; k < creativeDatas.size(); k++) {
+                        Long cplanId = creativeDatas.getJSONObject(k).getLong("planId");
+                        if (cplanId == pplanId) {
+                            sendData.add(creativeDatas.getJSONObject(k));
+                        }
+                    }
+                }
+            } else if (Check.isNull(planDatas) && !Check.isNull(targetDatas) && !Check.isNull(creativeDatas)) {
+                for (int i = 0; i < targetDatas.size(); i++) {
+                    Long tplanId = targetDatas.getJSONObject(i).getLong("planId");
+                    for (int k = 0; k < creativeDatas.size(); k++) {
+                        Long cplanId = creativeDatas.getJSONObject(k).getLong("planId");
+                        if (cplanId == tplanId) {
+                            sendData.add(creativeDatas.getJSONObject(k));
+                        }
+                    }
+                }
+            }
+        }
+        return sendData;
+    }
+}

+ 256 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/AlarmEventMetricController.java

@@ -0,0 +1,256 @@
+package cn.com.ctop.alarm.modules.controller;
+
+import cn.com.ctop.alarm.modules.entity.AlarmEventMetric;
+import cn.com.ctop.alarm.modules.service.IAlarmEventMetricService;
+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.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.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/alarmEventMetric")
+public class AlarmEventMetricController {
+    @Autowired
+    private IAlarmEventMetricService alarmEventMetricService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param alarmEventMetric
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @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);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param alarmEventMetric
+     * @return
+     */
+    @AutoLog(value = "制定详细规则表-添加")
+    @ApiOperation(value = "制定详细规则表-添加", notes = "制定详细规则表-添加")
+    @PostMapping(value = "/add")
+    public Result<AlarmEventMetric> add(@RequestBody AlarmEventMetric alarmEventMetric) {
+        Result<AlarmEventMetric> result = new Result<>();
+        try {
+            alarmEventMetricService.save(alarmEventMetric);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param alarmEventMetric
+     * @return
+     */
+    @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) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = alarmEventMetricService.updateById(alarmEventMetric);
+            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 {
+            alarmEventMetricService.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<AlarmEventMetric> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<AlarmEventMetric> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.alarmEventMetricService.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<AlarmEventMetric> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<AlarmEventMetric> result = new Result<>();
+        AlarmEventMetric alarmEventMetric = alarmEventMetricService.getById(id);
+        if (alarmEventMetric == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(alarmEventMetric);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<AlarmEventMetric> 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());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<AlarmEventMetric> pageList = alarmEventMetricService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "制定详细规则表列表");
+        mv.addObject(NormalExcelConstants.CLASS, AlarmEventMetric.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<AlarmEventMetric> listAlarmEventMetrics = ExcelImportUtil.importExcel(file.getInputStream(), AlarmEventMetric.class, params);
+                alarmEventMetricService.saveBatch(listAlarmEventMetrics);
+                return Result.ok("文件导入成功!数据行数:" + listAlarmEventMetrics.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("文件导入失败!");
+    }
+
+}

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

@@ -0,0 +1,274 @@
+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("文件导入失败!");
+    }
+
+}

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

@@ -0,0 +1,281 @@
+package cn.com.ctop.alarm.modules.controller;
+
+import cn.com.ctop.alarm.modules.entity.AlarmEventSend;
+import cn.com.ctop.alarm.modules.service.IAlarmEventSendService;
+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.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.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/alarmEventSend")
+public class AlarmEventSendController {
+    @Autowired
+    private IAlarmEventSendService alarmEventSendService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param alarmEventSend
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "预警事件发送表-分页列表查询")
+    @ApiOperation(value = "预警事件发送表-分页列表查询", notes = "预警事件发送表-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<AlarmEventSend>> queryPageList(AlarmEventSend alarmEventSend,
+                                                       @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                       @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                       HttpServletRequest req) {
+        Result<IPage<AlarmEventSend>> result = new Result<>();
+        QueryWrapper<AlarmEventSend> queryWrapper = QueryGenerator.initQueryWrapper(alarmEventSend, req.getParameterMap());
+        Page<AlarmEventSend> page = new Page<AlarmEventSend>(pageNo, pageSize);
+        IPage<AlarmEventSend> pageList = alarmEventSendService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param alarmEventSend
+     * @return
+     */
+    @AutoLog(value = "预警事件发送表-添加")
+    @ApiOperation(value = "预警事件发送表-添加", notes = "预警事件发送表-添加")
+    @PostMapping(value = "/add")
+    public Result<AlarmEventSend> add(@RequestBody AlarmEventSend alarmEventSend) {
+        Result<AlarmEventSend> result = new Result<>();
+        try {
+            alarmEventSendService.save(alarmEventSend);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        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;
+    }
+    /**
+     * 编辑
+     *
+     * @param alarmEventSend
+     * @return
+     */
+    @AutoLog(value = "预警事件发送表-编辑")
+    @ApiOperation(value = "预警事件发送表-编辑", notes = "预警事件发送表-编辑")
+    @PutMapping(value = "/edit")
+    public Result<AlarmEventSend> edit(@RequestBody AlarmEventSend alarmEventSend) {
+        Result<AlarmEventSend> result = new Result<AlarmEventSend>();
+        AlarmEventSend alarmEventSendEntity = alarmEventSendService.getById(alarmEventSend.getAlarmSendId());
+        if (alarmEventSendEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = alarmEventSendService.updateById(alarmEventSend);
+            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 {
+            alarmEventSendService.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<AlarmEventSend> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<AlarmEventSend> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.alarmEventSendService.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<AlarmEventSend> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<AlarmEventSend> result = new Result<>();
+        AlarmEventSend alarmEventSend = alarmEventSendService.getById(id);
+        if (alarmEventSend == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(alarmEventSend);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<AlarmEventSend> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                AlarmEventSend alarmEventSend = JSON.parseObject(deString, AlarmEventSend.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(alarmEventSend, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<AlarmEventSend> pageList = alarmEventSendService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "预警事件发送表列表");
+        mv.addObject(NormalExcelConstants.CLASS, AlarmEventSend.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<AlarmEventSend> listAlarmEventSends = ExcelImportUtil.importExcel(file.getInputStream(), AlarmEventSend.class, params);
+                alarmEventSendService.saveBatch(listAlarmEventSends);
+                return Result.ok("文件导入成功!数据行数:" + listAlarmEventSends.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("文件导入失败!");
+    }
+
+}

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

@@ -0,0 +1,269 @@
+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("文件导入失败!");
+    }
+
+}

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

@@ -0,0 +1,231 @@
+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("文件导入失败!");
+    }
+
+}

+ 386 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/RuleAccountTemplateController.java

@@ -0,0 +1,386 @@
+package cn.com.ctop.alarm.modules.controller;
+
+import cn.com.ctop.alarm.modules.entity.RuleAccountTemplate;
+import cn.com.ctop.alarm.modules.entity.RuleTemplate;
+import cn.com.ctop.alarm.modules.entity.vo.TemplateAppliedVo;
+import cn.com.ctop.alarm.modules.service.IRuleAccountTemplateService;
+import cn.com.ctop.alarm.modules.service.IRuleAccountThresholdService;
+import cn.com.ctop.alarm.modules.service.IRuleTemplateService;
+import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.common.module.service.ISysRoleExtService;
+import cn.com.ctop.common.module.utils.Check;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+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.apache.shiro.SecurityUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.system.vo.LoginUser;
+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.*;
+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.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 规则模板
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-11-15
+ */
+@Slf4j
+@Api(tags = "规则模板")
+@RestController
+@RequestMapping("/ruleAccountTemplate")
+public class RuleAccountTemplateController {
+    @Autowired
+    private IRuleAccountTemplateService ruleAccountTemplateService;
+    @Autowired
+    private IRuleTemplateService templateService;
+    @Autowired
+    private IRuleAccountThresholdService accountThresholdService;
+
+    @Autowired
+    private ISysRoleExtService sysRoleService;
+
+    /**
+     * 查询账户下关联的模板
+     *
+     * @param pageNo
+     * @param pageSize
+     * @return
+     */
+    @GetMapping(value = "/getTemplateApplied")
+    public Result<PageInfo<TemplateAppliedVo>> getTemplateApplied(int pageNo, int pageSize, Long accountId, String projectName, String userName) {
+        Result<PageInfo<TemplateAppliedVo>> result = new Result<>();
+        try {
+            LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            String roleCode = sysRoleService.getRoleCodeByUserId(sysUser.getId());
+            Map<String, Object> requestMap = new JSONObject();
+            if (!"admin".equals(roleCode)) {
+                requestMap.put("userId", sysUser.getId());
+            }
+            if (!Check.isNull(accountId)) {
+                requestMap.put("accountId", accountId);
+            }
+
+            if (!Check.isNull(projectName)) {
+                requestMap.put("projectName", projectName);
+            }
+            if (!Check.isNull(userName)) {
+                requestMap.put("userName", userName);
+            }
+            PageHelper.startPage(pageNo, pageSize);
+            List<TemplateAppliedVo> list = ruleAccountTemplateService.getTemplateApplied(requestMap);
+
+            PageInfo<TemplateAppliedVo> pageInfo = new PageInfo<>(list);
+            result.setSuccess(true);
+            result.setResult(pageInfo);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
+    }
+
+
+    @GetMapping(value = "/checkAccountTemplate")
+    public Result<JSONObject> checkAccountTemplate(Long accountId) {
+        Result<JSONObject> result = new Result<>();
+        JSONObject returnJson = new JSONObject();
+        QueryWrapper<RuleAccountTemplate> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("account_id", accountId);
+        queryWrapper.orderByDesc("create_time");
+        queryWrapper.last("limit 1");
+        RuleAccountTemplate ruleAccountTemplate = ruleAccountTemplateService.getOne(queryWrapper);
+        if (!Check.isNull(ruleAccountTemplate)) {
+            RuleTemplate ruleTemplate = templateService.getById(ruleAccountTemplate.getTemplateId());
+            returnJson.put("isApplication", true);
+            if (!Check.isNull(ruleTemplate)) {
+                returnJson.put("templateName", ruleTemplate.getTemplateName());
+            }
+        } else {
+            returnJson.put("isApplication", false);
+        }
+
+        result.setSuccess(true);
+        result.setResult(returnJson);
+        return result;
+    }
+
+
+    /**
+     * 推送 模板应用到某个账户
+     *
+     * @param ruleAccountTemplate
+     * @return
+     */
+    @PostMapping(value = "/pushTemplateToAccount")
+    public Result pushTemplateToAccount(@RequestBody RuleAccountTemplate ruleAccountTemplate) {
+        Result result = new Result<>();
+        try {
+            if (Check.isNull(ruleAccountTemplate.getAccountId())) {
+                throw new Exception("请选择需要推送的账户");
+            }
+
+            if (Check.isNull(ruleAccountTemplate.getTemplateId())) {
+                throw new Exception("请选择需要推送的模板");
+            }
+
+            JSONObject returnJson = ruleAccountTemplateService.pushTemplateToAccount(ruleAccountTemplate.getAccountId(), ruleAccountTemplate.getTemplateId());
+            result.setSuccess(true);
+            result.setResult(returnJson);
+        } catch (Exception e) {
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        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 {
+            RuleAccountTemplate accountTemplate = ruleAccountTemplateService.getById(id);
+            if (!Check.isNull(accountTemplate)) {
+                Map<String, Object> deleteMap = new HashMap<>();
+                deleteMap.put("account_id", accountTemplate.getAccountId());
+                accountThresholdService.removeByMap(deleteMap);
+                ruleAccountTemplateService.removeById(id);
+            }
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+
+    /**
+     * 分页列表查询
+     *
+     * @param ruleAccountTemplate
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "规则模板-分页列表查询")
+    @ApiOperation(value = "规则模板-分页列表查询", notes = "规则模板-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<RuleAccountTemplate>> queryPageList(RuleAccountTemplate ruleAccountTemplate,
+                                                            @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                            @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                            HttpServletRequest req) {
+        Result<IPage<RuleAccountTemplate>> result = new Result<>();
+        QueryWrapper<RuleAccountTemplate> queryWrapper = QueryGenerator.initQueryWrapper(ruleAccountTemplate, req.getParameterMap());
+        Page<RuleAccountTemplate> page = new Page<RuleAccountTemplate>(pageNo, pageSize);
+        IPage<RuleAccountTemplate> pageList = ruleAccountTemplateService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+
+    @GetMapping(value = "/getRelationAccountById")
+    public Result<JSONObject> getRelationAccountById(Long id) {
+        Result<JSONObject> result = new Result<>();
+        JSONObject returnJson = new JSONObject();
+        QueryWrapper<RuleAccountTemplate> accountTemplateQueryWrapper = new QueryWrapper<>();
+        accountTemplateQueryWrapper.eq("template_id", id);
+        List<RuleAccountTemplate> list = ruleAccountTemplateService.list(accountTemplateQueryWrapper);
+        returnJson.put("relationCount", list.size());
+        result.setSuccess(true);
+        result.setResult(returnJson);
+        return result;
+    }
+
+
+    /**
+     * 添加
+     *
+     * @param ruleAccountTemplate
+     * @return
+     */
+    @AutoLog(value = "规则模板-添加")
+    @ApiOperation(value = "规则模板-添加", notes = "规则模板-添加")
+    @PostMapping(value = "/add")
+    public Result<RuleAccountTemplate> add(@RequestBody RuleAccountTemplate ruleAccountTemplate) {
+        Result<RuleAccountTemplate> result = new Result<>();
+        try {
+            ruleAccountTemplateService.save(ruleAccountTemplate);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param ruleAccountTemplate
+     * @return
+     */
+    @AutoLog(value = "规则模板-编辑")
+    @ApiOperation(value = "规则模板-编辑", notes = "规则模板-编辑")
+    @PutMapping(value = "/edit")
+    public Result<RuleAccountTemplate> edit(@RequestBody RuleAccountTemplate ruleAccountTemplate) {
+        Result<RuleAccountTemplate> result = new Result<RuleAccountTemplate>();
+        RuleAccountTemplate ruleAccountTemplateEntity = ruleAccountTemplateService.getById(ruleAccountTemplate.getId());
+        if (ruleAccountTemplateEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = ruleAccountTemplateService.updateById(ruleAccountTemplate);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "规则模板-批量删除")
+    @ApiOperation(value = "规则模板-批量删除", notes = "规则模板-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<RuleAccountTemplate> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<RuleAccountTemplate> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.ruleAccountTemplateService.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<RuleAccountTemplate> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<RuleAccountTemplate> result = new Result<>();
+        RuleAccountTemplate ruleAccountTemplate = ruleAccountTemplateService.getById(id);
+        if (ruleAccountTemplate == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(ruleAccountTemplate);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<RuleAccountTemplate> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                RuleAccountTemplate ruleAccountTemplate = JSON.parseObject(deString, RuleAccountTemplate.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(ruleAccountTemplate, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<RuleAccountTemplate> pageList = ruleAccountTemplateService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "规则模板列表");
+        mv.addObject(NormalExcelConstants.CLASS, RuleAccountTemplate.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<RuleAccountTemplate> listRuleAccountTemplates = ExcelImportUtil.importExcel(file.getInputStream(), RuleAccountTemplate.class, params);
+                ruleAccountTemplateService.saveBatch(listRuleAccountTemplates);
+                return Result.ok("文件导入成功!数据行数:" + listRuleAccountTemplates.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("文件导入失败!");
+    }
+
+}

+ 270 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/RuleAccountThresholdController.java

@@ -0,0 +1,270 @@
+package cn.com.ctop.alarm.modules.controller;
+
+import cn.com.ctop.alarm.modules.entity.RuleAccountThreshold;
+import cn.com.ctop.alarm.modules.service.IRuleAccountThresholdService;
+import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.common.module.utils.Check;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+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.*;
+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-15
+ */
+@Slf4j
+@Api(tags = "规则关联账户 阈值")
+@RestController
+@RequestMapping("/ruleAccountThreshold")
+public class RuleAccountThresholdController {
+    @Autowired
+    private IRuleAccountThresholdService ruleAccountThresholdService;
+
+
+    @PostMapping(value = "/fillThreshold")
+    public Result<JSONObject> fillThreshold(@RequestBody JSONObject requestJson) {
+        Result<JSONObject> result = new Result<>();
+        try {
+            if (Check.isNull(requestJson)) {
+                throw new Exception("入参为空");
+            }
+            JSONObject returnJson = ruleAccountThresholdService.fillThreshold(requestJson);
+            result.setSuccess(true);
+            result.setResult(returnJson);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
+    }
+
+
+    /**
+     * 分页列表查询
+     *
+     * @param ruleAccountThreshold
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "规则关联账户 阈值-分页列表查询")
+    @ApiOperation(value = "规则关联账户 阈值-分页列表查询", notes = "规则关联账户 阈值-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<RuleAccountThreshold>> queryPageList(RuleAccountThreshold ruleAccountThreshold,
+                                                             @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                             @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                             HttpServletRequest req) {
+        Result<IPage<RuleAccountThreshold>> result = new Result<>();
+        QueryWrapper<RuleAccountThreshold> queryWrapper = QueryGenerator.initQueryWrapper(ruleAccountThreshold, req.getParameterMap());
+        Page<RuleAccountThreshold> page = new Page<RuleAccountThreshold>(pageNo, pageSize);
+        IPage<RuleAccountThreshold> pageList = ruleAccountThresholdService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param ruleAccountThreshold
+     * @return
+     */
+    @AutoLog(value = "规则关联账户 阈值-添加")
+    @ApiOperation(value = "规则关联账户 阈值-添加", notes = "规则关联账户 阈值-添加")
+    @PostMapping(value = "/add")
+    public Result<RuleAccountThreshold> add(@RequestBody RuleAccountThreshold ruleAccountThreshold) {
+        Result<RuleAccountThreshold> result = new Result<>();
+        try {
+            ruleAccountThresholdService.save(ruleAccountThreshold);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param ruleAccountThreshold
+     * @return
+     */
+    @AutoLog(value = "规则关联账户 阈值-编辑")
+    @ApiOperation(value = "规则关联账户 阈值-编辑", notes = "规则关联账户 阈值-编辑")
+    @PutMapping(value = "/edit")
+    public Result<RuleAccountThreshold> edit(@RequestBody RuleAccountThreshold ruleAccountThreshold) {
+        Result<RuleAccountThreshold> result = new Result<RuleAccountThreshold>();
+        RuleAccountThreshold ruleAccountThresholdEntity = ruleAccountThresholdService.getById(ruleAccountThreshold.getId());
+        if (ruleAccountThresholdEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = ruleAccountThresholdService.updateById(ruleAccountThreshold);
+            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 {
+            ruleAccountThresholdService.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<RuleAccountThreshold> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<RuleAccountThreshold> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.ruleAccountThresholdService.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<RuleAccountThreshold> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<RuleAccountThreshold> result = new Result<>();
+        RuleAccountThreshold ruleAccountThreshold = ruleAccountThresholdService.getById(id);
+        if (ruleAccountThreshold == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(ruleAccountThreshold);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<RuleAccountThreshold> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                RuleAccountThreshold ruleAccountThreshold = JSON.parseObject(deString, RuleAccountThreshold.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(ruleAccountThreshold, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<RuleAccountThreshold> pageList = ruleAccountThresholdService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "规则关联账户 阈值列表");
+        mv.addObject(NormalExcelConstants.CLASS, RuleAccountThreshold.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<RuleAccountThreshold> listRuleAccountThresholds = ExcelImportUtil.importExcel(file.getInputStream(), RuleAccountThreshold.class, params);
+                ruleAccountThresholdService.saveBatch(listRuleAccountThresholds);
+                return Result.ok("文件导入成功!数据行数:" + listRuleAccountThresholds.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("文件导入失败!");
+    }
+
+}

+ 257 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/RuleBaseController.java

@@ -0,0 +1,257 @@
+package cn.com.ctop.alarm.modules.controller;
+
+import cn.com.ctop.alarm.modules.entity.RuleBase;
+import cn.com.ctop.alarm.modules.service.IRuleAccountThresholdService;
+import cn.com.ctop.alarm.modules.service.IRuleBaseService;
+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.*;
+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.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 基础规则
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-11-15
+ */
+@Slf4j
+@Api(tags = "基础规则")
+@RestController
+@RequestMapping("/ruleBase")
+public class RuleBaseController {
+    @Autowired
+    private IRuleBaseService ruleBaseService;
+    @Autowired
+    private IRuleAccountThresholdService ruleAccountThresholdService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param ruleBase
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "基础规则-分页列表查询")
+    @ApiOperation(value = "基础规则-分页列表查询", notes = "基础规则-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<RuleBase>> queryPageList(RuleBase ruleBase,
+                                                 @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                 @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                 HttpServletRequest req) {
+        Result<IPage<RuleBase>> result = new Result<>();
+        QueryWrapper<RuleBase> queryWrapper = QueryGenerator.initQueryWrapper(ruleBase, req.getParameterMap());
+        Page<RuleBase> page = new Page<RuleBase>(pageNo, pageSize);
+        IPage<RuleBase> pageList = ruleBaseService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param ruleBase
+     * @return
+     */
+    @AutoLog(value = "基础规则-添加")
+    @ApiOperation(value = "基础规则-添加", notes = "基础规则-添加")
+    @PostMapping(value = "/add")
+    public Result<RuleBase> add(@RequestBody RuleBase ruleBase) {
+        Result<RuleBase> result = new Result<>();
+        try {
+            ruleBaseService.save(ruleBase);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param ruleBase
+     * @return
+     */
+    @AutoLog(value = "基础规则-编辑")
+    @ApiOperation(value = "基础规则-编辑", notes = "基础规则-编辑")
+    @PutMapping(value = "/edit")
+    public Result<RuleBase> edit(@RequestBody RuleBase ruleBase) {
+        Result<RuleBase> result = new Result<RuleBase>();
+        RuleBase ruleBaseEntity = ruleBaseService.getById(ruleBase.getId());
+        if (ruleBaseEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = ruleBaseService.updateById(ruleBase);
+            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 {
+            ruleBaseService.removeById(id);
+            Map<String, Object> deleteMap = new HashMap<>();
+            deleteMap.put("rule_id", id);
+            ruleAccountThresholdService.removeByMap(deleteMap);
+
+
+        } 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<RuleBase> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<RuleBase> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.ruleBaseService.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<RuleBase> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<RuleBase> result = new Result<>();
+        RuleBase ruleBase = ruleBaseService.getById(id);
+        if (ruleBase == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(ruleBase);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<RuleBase> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                RuleBase ruleBase = JSON.parseObject(deString, RuleBase.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(ruleBase, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<RuleBase> pageList = ruleBaseService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "基础规则列表");
+        mv.addObject(NormalExcelConstants.CLASS, RuleBase.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<RuleBase> listRuleBases = ExcelImportUtil.importExcel(file.getInputStream(), RuleBase.class, params);
+                ruleBaseService.saveBatch(listRuleBases);
+                return Result.ok("文件导入成功!数据行数:" + listRuleBases.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("文件导入失败!");
+    }
+
+}

+ 248 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/RuleConditionController.java

@@ -0,0 +1,248 @@
+package cn.com.ctop.alarm.modules.controller;
+
+import cn.com.ctop.alarm.modules.entity.RuleCondition;
+import cn.com.ctop.alarm.modules.service.IRuleConditionService;
+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.*;
+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-16
+ */
+@Slf4j
+@Api(tags = "规则运算符配置表")
+@RestController
+@RequestMapping("/rule/ruleCondition")
+public class RuleConditionController {
+    @Autowired
+    private IRuleConditionService ruleConditionService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param ruleCondition
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "规则运算符配置表-分页列表查询")
+    @ApiOperation(value = "规则运算符配置表-分页列表查询", notes = "规则运算符配置表-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<List<RuleCondition>> queryPageList(RuleCondition ruleCondition,
+                                                      @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                      @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                      HttpServletRequest req) {
+        Result<List<RuleCondition>> result = new Result<>();
+        QueryWrapper<RuleCondition> queryWrapper = QueryGenerator.initQueryWrapper(ruleCondition, req.getParameterMap());
+
+        List<RuleCondition> list = ruleConditionService.list(queryWrapper);
+        result.setSuccess(true);
+        result.setResult(list);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param ruleCondition
+     * @return
+     */
+    @AutoLog(value = "规则运算符配置表-添加")
+    @ApiOperation(value = "规则运算符配置表-添加", notes = "规则运算符配置表-添加")
+    @PostMapping(value = "/add")
+    public Result<RuleCondition> add(@RequestBody RuleCondition ruleCondition) {
+        Result<RuleCondition> result = new Result<>();
+        try {
+            ruleConditionService.save(ruleCondition);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param ruleCondition
+     * @return
+     */
+    @AutoLog(value = "规则运算符配置表-编辑")
+    @ApiOperation(value = "规则运算符配置表-编辑", notes = "规则运算符配置表-编辑")
+    @PutMapping(value = "/edit")
+    public Result<RuleCondition> edit(@RequestBody RuleCondition ruleCondition) {
+        Result<RuleCondition> result = new Result<RuleCondition>();
+        RuleCondition ruleConditionEntity = ruleConditionService.getById(ruleCondition.getId());
+        if (ruleConditionEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = ruleConditionService.updateById(ruleCondition);
+            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 {
+            ruleConditionService.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<RuleCondition> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<RuleCondition> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.ruleConditionService.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<RuleCondition> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<RuleCondition> result = new Result<>();
+        RuleCondition ruleCondition = ruleConditionService.getById(id);
+        if (ruleCondition == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(ruleCondition);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<RuleCondition> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                RuleCondition ruleCondition = JSON.parseObject(deString, RuleCondition.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(ruleCondition, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<RuleCondition> pageList = ruleConditionService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "规则运算符配置表列表");
+        mv.addObject(NormalExcelConstants.CLASS, RuleCondition.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<RuleCondition> listRuleConditions = ExcelImportUtil.importExcel(file.getInputStream(), RuleCondition.class, params);
+                ruleConditionService.saveBatch(listRuleConditions);
+                return Result.ok("文件导入成功!数据行数:" + listRuleConditions.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("文件导入失败!");
+    }
+
+}

+ 346 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/RuleGroupController.java

@@ -0,0 +1,346 @@
+package cn.com.ctop.alarm.modules.controller;
+
+import cn.com.ctop.alarm.modules.entity.RuleGroup;
+import cn.com.ctop.alarm.modules.entity.RuleTemplate;
+import cn.com.ctop.alarm.modules.service.IRuleAccountThresholdService;
+import cn.com.ctop.alarm.modules.service.IRuleBaseService;
+import cn.com.ctop.alarm.modules.service.IRuleGroupService;
+import cn.com.ctop.alarm.modules.service.IRuleTemplateService;
+import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.common.module.utils.Check;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+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.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.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 规则组
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-11-15
+ */
+@Slf4j
+@Api(tags = "规则组")
+@RestController
+@RequestMapping("/ruleGroup")
+public class RuleGroupController {
+    @Autowired
+    private IRuleGroupService ruleGroupService;
+    @Autowired
+    private IRuleBaseService ruleBaseService;
+    @Autowired
+    private IRuleAccountThresholdService ruleAccountThresholdService;
+    @Autowired
+    private IRuleTemplateService ruleTemplateService;
+
+
+    /**
+     * 创建规则组
+     *
+     * @param requestJson
+     * @return
+     */
+
+    @PostMapping(value = "/createRuleGroup")
+    public Result createRuleGroup(@RequestBody JSONObject requestJson) {
+        Result result = new Result<>();
+        try {
+            if (Check.isNull(requestJson)) {
+                throw new Exception("请输出需要创建的参数");
+            }
+            JSONObject returnJson = ruleGroupService.createRuleGroup(requestJson);
+            if (returnJson.getInteger("code") == 0) {
+                result.setSuccess(true);
+                result.setMessage(returnJson.getString("message"));
+            } else {
+                result.setSuccess(false);
+                result.setMessage(returnJson.getString("message"));
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        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 {
+            RuleGroup ruleGroup = ruleGroupService.getById(id);
+            if (!Check.isNull(ruleGroup)) {
+                JSONArray ruleIds = JSONArray.parseArray(ruleGroup.getRuleIds());
+                for (int i = 0; i < ruleIds.size(); i++) {
+                    Long ruleId = ruleIds.getLong(i);
+                    ruleBaseService.removeById(ruleId);
+                    Map<String, Object> deleteMap = new HashMap<>();
+                    deleteMap.put("rule_id", ruleId);
+                    ruleAccountThresholdService.removeByMap(deleteMap);
+                }
+                Long templateId = ruleGroup.getTemplateId();
+                RuleTemplate ruleTemplate = ruleTemplateService.getById(templateId);
+                if (!Check.isNull(ruleTemplate)) {
+                    JSONArray newGroupIds = new JSONArray();
+                    JSONArray groupIds = JSONArray.parseArray(ruleTemplate.getGroupIds());
+                    Iterator<Object> o = groupIds.iterator();
+                    while (o.hasNext()) {
+                        String groupId = String.valueOf(o.next());
+                        if (groupId.equals(id)) {
+                            continue;
+                        }
+                        newGroupIds.add(Long.valueOf(groupId));
+                    }
+                    ruleTemplate.setGroupIds(newGroupIds.toJSONString());
+                    ruleTemplateService.updateById(ruleTemplate);
+                }
+                ruleGroupService.removeById(id);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+
+    /**
+     * 分页列表查询
+     *
+     * @param ruleGroup
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "规则组-分页列表查询")
+    @ApiOperation(value = "规则组-分页列表查询", notes = "规则组-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<RuleGroup>> queryPageList(RuleGroup ruleGroup,
+                                                  @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                  @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                  HttpServletRequest req) {
+        Result<IPage<RuleGroup>> result = new Result<>();
+        QueryWrapper<RuleGroup> queryWrapper = QueryGenerator.initQueryWrapper(ruleGroup, req.getParameterMap());
+        Page<RuleGroup> page = new Page<RuleGroup>(pageNo, pageSize);
+        IPage<RuleGroup> pageList = ruleGroupService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param ruleGroup
+     * @return
+     */
+    @AutoLog(value = "规则组-添加")
+    @ApiOperation(value = "规则组-添加", notes = "规则组-添加")
+    @PostMapping(value = "/add")
+    public Result<RuleGroup> add(@RequestBody RuleGroup ruleGroup) {
+        Result<RuleGroup> result = new Result<>();
+        try {
+            ruleGroupService.save(ruleGroup);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    @GetMapping(value = "/checkRules")
+    public Result<RuleGroup> checkRules() {
+        Result<RuleGroup> result = new Result<>();
+        try {
+            ruleGroupService.checkRules();
+            result.success("成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param ruleGroup
+     * @return
+     */
+    @AutoLog(value = "规则组-编辑")
+    @ApiOperation(value = "规则组-编辑", notes = "规则组-编辑")
+    @PutMapping(value = "/edit")
+    public Result<RuleGroup> edit(@RequestBody RuleGroup ruleGroup) {
+        Result<RuleGroup> result = new Result<RuleGroup>();
+        RuleGroup ruleGroupEntity = ruleGroupService.getById(ruleGroup.getId());
+        if (ruleGroupEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = ruleGroupService.updateById(ruleGroup);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "规则组-批量删除")
+    @ApiOperation(value = "规则组-批量删除", notes = "规则组-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<RuleGroup> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<RuleGroup> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.ruleGroupService.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<RuleGroup> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<RuleGroup> result = new Result<>();
+        RuleGroup ruleGroup = ruleGroupService.getById(id);
+        if (ruleGroup == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(ruleGroup);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<RuleGroup> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                RuleGroup ruleGroup = JSON.parseObject(deString, RuleGroup.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(ruleGroup, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<RuleGroup> pageList = ruleGroupService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "规则组列表");
+        mv.addObject(NormalExcelConstants.CLASS, RuleGroup.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<RuleGroup> listRuleGroups = ExcelImportUtil.importExcel(file.getInputStream(), RuleGroup.class, params);
+                ruleGroupService.saveBatch(listRuleGroups);
+                return Result.ok("文件导入成功!数据行数:" + listRuleGroups.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("文件导入失败!");
+    }
+
+}

+ 257 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/RuleIndicatorController.java

@@ -0,0 +1,257 @@
+package cn.com.ctop.alarm.modules.controller;
+
+import cn.com.ctop.alarm.modules.entity.RuleIndicator;
+import cn.com.ctop.alarm.modules.service.IRuleIndicatorService;
+import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.common.module.utils.Check;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+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.*;
+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-14
+ */
+@Slf4j
+@Api(tags = "规则指标信息")
+@RestController
+@RequestMapping("/ruleIndicator")
+public class RuleIndicatorController {
+    @Autowired
+    private IRuleIndicatorService ruleIndicatorService;
+
+
+    @AutoLog(value = "规则指标信息-分页列表查询")
+    @ApiOperation(value = "规则指标信息-分页列表查询", notes = "规则指标信息-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<JSONArray> queryPageList(RuleIndicator ruleIndicator) {
+        Result<JSONArray> result = new Result<>();
+        Integer mediaType = ruleIndicator.getMediaType();
+        QueryWrapper<RuleIndicator> queryWrapper = new QueryWrapper();
+        queryWrapper.eq("media_type", mediaType);
+        queryWrapper.groupBy("dimension");
+        List<RuleIndicator> list = ruleIndicatorService.list(queryWrapper);
+        JSONArray dataArr = new JSONArray();
+        for (RuleIndicator indicator : list) {
+            String dimension = indicator.getDimension();
+            JSONObject dimensionJson = new JSONObject();
+            QueryWrapper<RuleIndicator> queryWrapperData = new QueryWrapper();
+            queryWrapperData.eq("media_type", mediaType);
+            queryWrapperData.eq("dimension", dimension);
+            List<RuleIndicator> dataList = ruleIndicatorService.list(queryWrapperData);
+            if (!Check.isNull(dataList)) {
+                dimensionJson.put("dimension", dimension);
+                // 获取指标名称
+                String dimensionName = ruleIndicatorService.getRuleIndicatorNameByMediaTypeAndDimension(mediaType, dimension);
+                dimensionJson.put("dimensionName", dimensionName);
+                dimensionJson.put("dimensionList", dataList);
+                dataArr.add(dimensionJson);
+            }
+        }
+        result.setSuccess(true);
+        result.setResult(dataArr);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param ruleIndicator
+     * @return
+     */
+    @AutoLog(value = "规则指标信息-添加")
+    @ApiOperation(value = "规则指标信息-添加", notes = "规则指标信息-添加")
+    @PostMapping(value = "/add")
+    public Result<RuleIndicator> add(@RequestBody RuleIndicator ruleIndicator) {
+        Result<RuleIndicator> result = new Result<>();
+        try {
+            ruleIndicatorService.save(ruleIndicator);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param ruleIndicator
+     * @return
+     */
+    @AutoLog(value = "规则指标信息-编辑")
+    @ApiOperation(value = "规则指标信息-编辑", notes = "规则指标信息-编辑")
+    @PutMapping(value = "/edit")
+    public Result<RuleIndicator> edit(@RequestBody RuleIndicator ruleIndicator) {
+        Result<RuleIndicator> result = new Result<RuleIndicator>();
+        RuleIndicator ruleIndicatorEntity = ruleIndicatorService.getById(ruleIndicator.getId());
+        if (ruleIndicatorEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = ruleIndicatorService.updateById(ruleIndicator);
+            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 {
+            ruleIndicatorService.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<RuleIndicator> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<RuleIndicator> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.ruleIndicatorService.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<RuleIndicator> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<RuleIndicator> result = new Result<>();
+        RuleIndicator ruleIndicator = ruleIndicatorService.getById(id);
+        if (ruleIndicator == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(ruleIndicator);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<RuleIndicator> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                RuleIndicator ruleIndicator = JSON.parseObject(deString, RuleIndicator.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(ruleIndicator, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<RuleIndicator> pageList = ruleIndicatorService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "规则指标信息列表");
+        mv.addObject(NormalExcelConstants.CLASS, RuleIndicator.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<RuleIndicator> listRuleIndicators = ExcelImportUtil.importExcel(file.getInputStream(), RuleIndicator.class, params);
+                ruleIndicatorService.saveBatch(listRuleIndicators);
+                return Result.ok("文件导入成功!数据行数:" + listRuleIndicators.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("文件导入失败!");
+    }
+
+}

+ 96 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/RuleSwitchController.java

@@ -0,0 +1,96 @@
+package cn.com.ctop.alarm.modules.controller;
+
+import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.service.IUserAllocationService;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import org.jeecg.common.api.vo.Result;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/rule/switch/")
+public class RuleSwitchController {
+
+    @Autowired
+    IUserAllocationService userAllocationService;
+
+    /**
+     *  账户添加内广监测链接预警
+     */
+    @PostMapping(value = "/onOrOffMonitoringLink")
+    public Result<Object> onOrOffMonitoringLink(@RequestParam Long accountId, @RequestParam String switchType){
+        Result<Object> result=new Result<>();
+        UserAllocation userAllocation=new UserAllocation();
+        userAllocation.setAccountId(accountId);
+        UpdateWrapper<UserAllocation> wrapper=new UpdateWrapper<>();
+        //开启预警
+        if(switchType.equals("on")){
+            wrapper.set("monitoring_link",0);
+            wrapper.setEntity(userAllocation);
+            boolean update = userAllocationService.update(wrapper);
+            if(update){
+                result.success("监测链接预警开启成功");
+            }
+        }else if(switchType.equals("off")){
+            wrapper.set("monitoring_link",1);
+            wrapper.setEntity(userAllocation);
+            boolean update = userAllocationService.update(wrapper);
+            if(update){
+                result.success("监测链接预警关闭成功");
+            }
+        }else {
+            result.error500("未知操作");
+        }
+        return result;
+    }
+
+    /**
+     *  账户添加落地页链接预警
+     */
+    @PostMapping(value = "/onOrOffLandingPage")
+    public Result<Object> onOrOffLandingPage(@RequestParam Long accountId, @RequestParam String switchType){
+        Result<Object> result=new Result<>();
+        UserAllocation userAllocation=new UserAllocation();
+        userAllocation.setAccountId(accountId);
+        UpdateWrapper<UserAllocation> wrapper=new UpdateWrapper<>();
+        //开启预警
+        if(switchType.equals("on")){
+            wrapper.set("landing_page",0);
+            wrapper.setEntity(userAllocation);
+            boolean update = userAllocationService.update(wrapper);
+            if(update){
+                result.success("落地页链接预警开启成功");
+            }
+        }else if(switchType.equals("off")){
+            wrapper.set("landing_page",1);
+            wrapper.setEntity(userAllocation);
+            boolean update = userAllocationService.update(wrapper);
+            if(update){
+                result.success("落地页链接预警关闭成功");
+            }
+        }else {
+            result.error500("未知操作");
+        }
+        return result;
+    }
+
+    /**
+     *  开关预警配置回显
+     */
+    @PostMapping(value = "/echoSwitchStatus")
+    public Result<JSONObject> echoSwitchStatus(Long accountId){
+        Result<JSONObject> result =new Result<>();
+        JSONObject switchStatus= userAllocationService.getSwitchStatusByAccount(accountId);
+        if(switchStatus.isEmpty()){
+            result.error500("未找到该账户");
+        }else {
+            result.setResult(switchStatus);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+}

+ 404 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/controller/RuleTemplateController.java

@@ -0,0 +1,404 @@
+package cn.com.ctop.alarm.modules.controller;
+
+import cn.com.ctop.alarm.modules.entity.RuleGroup;
+import cn.com.ctop.alarm.modules.entity.RuleTemplate;
+import cn.com.ctop.alarm.modules.service.*;
+import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.common.module.utils.Check;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+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.*;
+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.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 规则模板
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-11-15
+ */
+@Slf4j
+@Api(tags = "规则模板")
+@RestController
+@RequestMapping("/ruleTemplate")
+public class RuleTemplateController {
+    @Autowired
+    private IRuleTemplateService ruleTemplateService;
+    @Autowired
+    private IRuleGroupService ruleGroupService;
+    @Autowired
+    private IRuleBaseService ruleBaseService;
+    @Autowired
+    private IRuleAccountThresholdService ruleAccountThresholdService;
+    @Autowired
+    private IRuleAccountTemplateService accountTemplateService;
+
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "规则模板-通过id查询")
+    @ApiOperation(value = "规则模板-通过id查询", notes = "规则模板-通过id查询")
+    @GetMapping(value = "/queryDetailById")
+    public Result<JSONObject> queryDetailById(@RequestParam(name = "id", required = true) String id) {
+        Result<JSONObject> result = new Result<>();
+        try {
+            JSONObject ruleTemplateJson = ruleTemplateService.queryDetailById(id);
+            result.setSuccess(true);
+            result.setResult(ruleTemplateJson);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+
+        return result;
+    }
+
+
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "规则模板-通过id查询")
+    @ApiOperation(value = "规则模板-通过id查询", notes = "规则模板-通过id查询")
+    @GetMapping(value = "/previewTemplate")
+    public Result<JSONObject> previewTemplate(@RequestParam(name = "id", required = true) String id) {
+        Result<JSONObject> result = new Result<>();
+        try {
+            JSONObject ruleTemplateJson = ruleTemplateService.previewTemplate(id);
+            result.setSuccess(true);
+            result.setResult(ruleTemplateJson);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+
+        return result;
+    }
+
+    /**
+     * 根据 模板id  账户id 查询详情
+     *
+     * @param
+     * @return
+     */
+
+    @GetMapping(value = "/queryDetailByAccountIdAndTemplateId")
+    public Result<JSONObject> queryDetailByAccountIdAndTemplateId(Long accountId, Long templateId) {
+        Result<JSONObject> result = new Result<>();
+        try {
+            JSONObject ruleTemplateJson = ruleTemplateService.queryDetailByAccountIdAndTemplateId(accountId, templateId);
+            result.setSuccess(true);
+            result.setResult(ruleTemplateJson);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+
+        return result;
+    }
+
+
+    /**
+     * 分页列表查询
+     *
+     * @param ruleTemplate
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "规则模板-分页列表查询")
+    @ApiOperation(value = "规则模板-分页列表查询", notes = "规则模板-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<RuleTemplate>> queryPageList(RuleTemplate ruleTemplate,
+                                                     @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                     @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                     HttpServletRequest req) {
+        Result<IPage<RuleTemplate>> result = new Result<>();
+        String templateName = ruleTemplate.getTemplateName();
+        ruleTemplate.setTemplateName(null);
+        QueryWrapper<RuleTemplate> queryWrapper = QueryGenerator.initQueryWrapper(ruleTemplate, req.getParameterMap());
+        if (!Check.isNull(templateName)) {
+            queryWrapper.like("template_name", templateName);
+        }
+        Page<RuleTemplate> page = new Page<RuleTemplate>(pageNo, pageSize);
+        IPage<RuleTemplate> pageList = ruleTemplateService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+
+    /**
+     * 添加
+     *
+     * @param requestJson
+     * @return
+     */
+    @AutoLog(value = "创建规则模板")
+
+    @PostMapping(value = "/createTemplate")
+    public Result createTemplate(@RequestBody JSONObject requestJson) {
+        Result result = new Result<>();
+        try {
+            if (Check.isNull(requestJson)) {
+                throw new Exception("请传入模板入参");
+            }
+            JSONObject returnJson = ruleTemplateService.createTemplate(requestJson);
+            if (returnJson.getInteger("code") == 0) {
+                result.setSuccess(true);
+                result.setMessage(returnJson.getString("message"));
+            } else {
+                result.setSuccess(false);
+                result.setMessage(returnJson.getString("message"));
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
+    }
+
+
+    /**
+     * 添加
+     *
+     * @param ruleTemplate
+     * @return
+     */
+    @AutoLog(value = "规则模板-添加")
+    @ApiOperation(value = "规则模板-添加", notes = "规则模板-添加")
+    @PostMapping(value = "/add")
+    public Result<RuleTemplate> add(@RequestBody RuleTemplate ruleTemplate) {
+        Result<RuleTemplate> result = new Result<>();
+        try {
+            ruleTemplateService.save(ruleTemplate);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param ruleTemplate
+     * @return
+     */
+    @AutoLog(value = "规则模板-编辑")
+    @ApiOperation(value = "规则模板-编辑", notes = "规则模板-编辑")
+    @PutMapping(value = "/edit")
+    public Result<RuleTemplate> edit(@RequestBody RuleTemplate ruleTemplate) {
+        Result<RuleTemplate> result = new Result<RuleTemplate>();
+        RuleTemplate ruleTemplateEntity = ruleTemplateService.getById(ruleTemplate.getId());
+        if (ruleTemplateEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = ruleTemplateService.updateById(ruleTemplate);
+            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 {
+            RuleTemplate ruleTemplate = ruleTemplateService.getById(id);
+            if (!Check.isNull(ruleTemplate)) {
+                QueryWrapper<RuleGroup> groupQueryWrapper = new QueryWrapper<>();
+                groupQueryWrapper.eq("template_id", id);
+                List<RuleGroup> groupList = ruleGroupService.list(groupQueryWrapper);
+                if (!Check.isNull(groupList)) {
+                    for (RuleGroup group : groupList) {
+                        JSONArray ruleIds = JSONArray.parseArray(group.getRuleIds());
+                        if (Check.isNull(ruleIds)) {
+                            continue;
+                        }
+                        for (int i = 0; i < ruleIds.size(); i++) {
+                            Long ruleId = ruleIds.getLong(i);
+                            ruleBaseService.removeById(ruleId);
+                            Map<String, Object> deleteMap = new HashMap<>();
+                            deleteMap.put("rule_id", ruleId);
+                            ruleAccountThresholdService.removeByMap(deleteMap);
+                        }
+                        ruleGroupService.removeById(group.getId());
+                    }
+                }
+
+                Map<String, Object> deleteMap = new HashMap<>();
+                deleteMap.put("template_id", id);
+                accountTemplateService.removeByMap(deleteMap);
+                ruleTemplateService.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<RuleTemplate> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<RuleTemplate> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.ruleTemplateService.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<RuleTemplate> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<RuleTemplate> result = new Result<>();
+        RuleTemplate ruleTemplate = ruleTemplateService.getById(id);
+        if (ruleTemplate == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(ruleTemplate);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<RuleTemplate> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                RuleTemplate ruleTemplate = JSON.parseObject(deString, RuleTemplate.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(ruleTemplate, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<RuleTemplate> pageList = ruleTemplateService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "规则模板列表");
+        mv.addObject(NormalExcelConstants.CLASS, RuleTemplate.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<RuleTemplate> listRuleTemplates = ExcelImportUtil.importExcel(file.getInputStream(), RuleTemplate.class, params);
+                ruleTemplateService.saveBatch(listRuleTemplates);
+                return Result.ok("文件导入成功!数据行数:" + listRuleTemplates.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("文件导入失败!");
+    }
+
+}

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

@@ -0,0 +1,91 @@
+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;
+}

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

@@ -0,0 +1,135 @@
+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;
+
+}

+ 81 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/AlarmEventSend.java

@@ -0,0 +1,81 @@
+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_send")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_alarm_event_send对象", description = "预警事件发送表")
+public class AlarmEventSend {
+
+    /**
+     * 主键id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "主键id")
+    private Long alarmSendId;
+
+    private String userId;
+    /**
+     * 规则id
+     */
+    @Excel(name = "规则id", width = 15)
+    @ApiModelProperty(value = "规则id")
+    private Long groupId;
+    /**
+     * 预警指标
+     */
+    @Excel(name = "预警指标", width = 15)
+    @ApiModelProperty(value = "预警指标")
+    private String groupName;
+    /**
+     * 预警发送内容
+     */
+    @Excel(name = "预警发送内容", width = 15)
+    @ApiModelProperty(value = "预警发送内容")
+    private String alarmDetail;
+    /**
+     * 预警发送状态 0未发送,1已发送
+     */
+    @Excel(name = "预警发送状态 0未发送,1已发送", width = 15)
+    @ApiModelProperty(value = "预警发送状态 0未发送,1已发送")
+    private String alarmStatus;
+
+    private String ruleDimension;
+    /**
+     * 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;
+}

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

@@ -0,0 +1,85 @@
+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;
+
+}

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

@@ -0,0 +1,80 @@
+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;
+}

+ 58 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/RuleAccountTemplate.java

@@ -0,0 +1,58 @@
+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 io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 规则模板
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-11-15
+ */
+@Data
+@TableName("ctop_rule_account_template")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_rule_account_template对象", description = "规则模板")
+public class RuleAccountTemplate {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 账户id
+     */
+    @Excel(name = "账户id", width = 15)
+    @ApiModelProperty(value = "账户id")
+    private Long accountId;
+    /**
+     * 模板id
+     */
+    @Excel(name = "模板id", width = 15)
+    @ApiModelProperty(value = "模板id")
+    private Long templateId;
+
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

+ 67 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/RuleAccountThreshold.java

@@ -0,0 +1,67 @@
+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 io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 规则关联账户 阈值
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-11-15
+ */
+@Data
+@TableName("ctop_rule_account_threshold")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_rule_account_threshold对象", description = "规则关联账户 阈值")
+public class RuleAccountThreshold {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 账户id
+     */
+    @Excel(name = "账户id", width = 15)
+    @ApiModelProperty(value = "账户id")
+    private Long accountId;
+
+    private Long groupId; // 组id
+    private String batchNo; // 批次号
+
+    /**
+     * 规则id
+     */
+    @Excel(name = "规则id", width = 15)
+    @ApiModelProperty(value = "规则id")
+    private Long ruleId;
+    /**
+     * 阈值
+     */
+    @Excel(name = "阈值", width = 15)
+    @ApiModelProperty(value = "阈值")
+    private String threshold;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

+ 83 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/RuleBase.java

@@ -0,0 +1,83 @@
+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 io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 基础规则
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-11-15
+ */
+@Data
+@TableName("ctop_rule_base")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_rule_base对象", description = "基础规则")
+public class RuleBase {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+
+    private Long groupId;
+
+    /**
+     * 规则名称
+     */
+    @Excel(name = "规则名称", width = 15)
+    @ApiModelProperty(value = "规则名称")
+    private String ruleName;
+    /**
+     * 指标code
+     */
+    @Excel(name = "指标code", width = 15)
+    @ApiModelProperty(value = "指标code")
+    private String indicatorCode;
+    /**
+     * 判断条件 大于 等于 小于等
+     */
+    @Excel(name = "判断条件 大于 等于 小于等", width = 15)
+    @ApiModelProperty(value = "判断条件 大于 等于 小于等")
+    private String ruleCondition;
+    /**
+     * 阈值 比较值
+     */
+    @Excel(name = "阈值 比较值", width = 15)
+    @ApiModelProperty(value = "阈值 比较值")
+    private String threshold;
+    /**
+     * 规则维度 账户、计划、组、创意等维度
+     */
+    @Excel(name = "规则维度 账户、计划、组、创意等维度", width = 15)
+    @ApiModelProperty(value = "规则维度 账户、计划、组、创意等维度")
+    private String ruleDimension;
+
+    private Integer variableType;// 变量类型
+    private Integer judgeFormat;// 判断类型
+    private Integer isUnlimited;//  是否支持不限  true 是 false 否
+
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

+ 63 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/RuleCondition.java

@@ -0,0 +1,63 @@
+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 io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 规则运算符配置表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-11-16
+ */
+@Data
+@TableName("ctop_rule_condition")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_rule_condition对象", description = "规则运算符配置表")
+public class RuleCondition {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 运算名称
+     */
+    @Excel(name = "运算名称", width = 15)
+    @ApiModelProperty(value = "运算名称")
+    private String conditionName;
+    /**
+     * 运算符
+     */
+    @Excel(name = "运算符", width = 15)
+    @ApiModelProperty(value = "运算符")
+    private String ruleCondition;
+    /**
+     * 数据类型
+     */
+    @Excel(name = "数据类型", width = 15)
+    @ApiModelProperty(value = "数据类型")
+    private String dataType;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

+ 89 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/RuleGroup.java

@@ -0,0 +1,89 @@
+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 io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 规则组
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-11-15
+ */
+@Data
+@TableName("ctop_rule_group")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_rule_group对象", description = "规则组")
+public class RuleGroup {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    private Long templateId;
+    /**
+     * 规则id列表
+     */
+    @Excel(name = "规则id列表", width = 15)
+    @ApiModelProperty(value = "规则id列表")
+    private String ruleIds;
+    private String groupName;
+    /**
+     * 规则类型 group为组合规则 base 为单条规则
+     */
+    @Excel(name = "规则类型 group为组合规则 base 为单条规则", width = 15)
+    @ApiModelProperty(value = "规则类型 group为组合规则 base 为单条规则")
+    private String ruleType;
+    /**
+     * 规则关系 当rule_type 为group时必填 and同时命中  or 命中一条
+     */
+    @Excel(name = "规则关系 当rule_type 为group时必填 and同时命中  or 命中一条", width = 15)
+    @ApiModelProperty(value = "规则关系 当rule_type 为group时必填 and同时命中  or 命中一条")
+    private String ruleRelationship;
+    /**
+     * 操作内容:SEND发送,PAUSE关停并发送
+     */
+    private String operate;
+    /**
+     * 预警发送方式: SMS:短信,WeChat:企业微信,EMAIL:电子邮件,TEL:电话
+     */
+    private String sendType;
+
+    /**
+     * 规则解释
+     */
+    private String remark;
+
+
+    private Integer isRequired;//  是否必填  true 是 false 否
+    private Integer isCopy;//  是否可复制  true 是 false 否
+
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+
+    @TableField(exist = false)
+    private List<RuleBase> ruleBaseList;
+
+}

+ 92 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/RuleIndicator.java

@@ -0,0 +1,92 @@
+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 io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 规则指标信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-11-14
+ */
+@Data
+@TableName("ctop_rule_indicator")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_rule_indicator对象", description = "规则指标信息")
+public class RuleIndicator {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 1:头条2:快手
+     */
+    @Excel(name = "1:头条2:快手", width = 15)
+    @ApiModelProperty(value = "1:头条2:快手")
+    private Integer mediaType;
+    /**
+     * 指标名称
+     */
+    @Excel(name = "指标名称", width = 15)
+    @ApiModelProperty(value = "指标名称")
+    private String name;
+    /**
+     * 指标code(数据库字段名称)
+     */
+    @Excel(name = "指标code(数据库字段名称)", width = 15)
+    @ApiModelProperty(value = "指标code(数据库字段名称)")
+    private String code;
+    /**
+     * 数据类型
+     */
+    @Excel(name = "数据类型", width = 15)
+    @ApiModelProperty(value = "数据类型")
+    private String dataType;
+    private String modelType;
+    /**
+     * 数据单位
+     */
+    @Excel(name = "数据单位", width = 15)
+    @ApiModelProperty(value = "数据单位")
+    private String dataUnit;
+    /**
+     * 数据维度
+     */
+    @Excel(name = "数据维度", width = 15)
+    @ApiModelProperty(value = "数据维度")
+    private String dimension;
+    /**
+     * 对应数据字典id
+     */
+    @Excel(name = "对应数据字典id", width = 15)
+    @ApiModelProperty(value = "对应数据字典id")
+    private String dictId;
+    /**
+     * 对应数据表名称
+     */
+    @Excel(name = "对应数据表名称", width = 15)
+    @ApiModelProperty(value = "对应数据表名称")
+    /**
+     * 逻辑类型,针对流量排除包、排除人群包标识
+     */
+    private Integer logicalType;
+    private String tableName;
+    private Integer status;
+    private Integer sort;
+    private Date createTime;
+    private Date updateTime;
+}

+ 63 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/RuleTemplate.java

@@ -0,0 +1,63 @@
+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 io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.util.Date;
+
+/**
+ * 规则模板
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-11-15
+ */
+@Data
+@TableName("ctop_rule_template")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_rule_template对象", description = "规则模板")
+public class RuleTemplate {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 1:头条2:快手
+     */
+    @Excel(name = "1:头条2:快手", width = 15)
+    @ApiModelProperty(value = "1:头条2:快手")
+    private Integer mediaType;
+    /**
+     * 模板名称
+     */
+    @Excel(name = "模板名称", width = 15)
+    @ApiModelProperty(value = "模板名称")
+    private String templateName;
+    /**
+     * 规则组集合
+     */
+    @Excel(name = "规则组集合", width = 15)
+    @ApiModelProperty(value = "规则组集合")
+    private String groupIds;
+    /**
+     * createTime
+     */
+    @ApiModelProperty(value = "createTime")
+    private Date createTime;
+    /**
+     * updateTime
+     */
+    @ApiModelProperty(value = "updateTime")
+    private Date updateTime;
+}

+ 100 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/entity/vo/TemplateAppliedVo.java

@@ -0,0 +1,100 @@
+package cn.com.ctop.alarm.modules.entity.vo;
+
+public class TemplateAppliedVo {
+    private Long id;
+    private Long accountId;
+    private String authName;
+    private Long templateId;
+    private String templateName;
+    private Long projectId;
+    private String projectName;
+    private String userId;
+    private String userName;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getAccountId() {
+        return accountId;
+    }
+
+    public void setAccountId(Long accountId) {
+        this.accountId = accountId;
+    }
+
+    public String getAuthName() {
+        return authName;
+    }
+
+    public void setAuthName(String authName) {
+        this.authName = authName;
+    }
+
+    public Long getTemplateId() {
+        return templateId;
+    }
+
+    public void setTemplateId(Long templateId) {
+        this.templateId = templateId;
+    }
+
+    public String getTemplateName() {
+        return templateName;
+    }
+
+    public void setTemplateName(String templateName) {
+        this.templateName = templateName;
+    }
+
+    public Long getProjectId() {
+        return projectId;
+    }
+
+    public void setProjectId(Long projectId) {
+        this.projectId = projectId;
+    }
+
+    public String getProjectName() {
+        return projectName;
+    }
+
+    public void setProjectName(String projectName) {
+        this.projectName = projectName;
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    @Override
+    public String toString() {
+        return "TemplateAppliedVo{" +
+                "id=" + id +
+                ", accountId=" + accountId +
+                ", authName='" + authName + '\'' +
+                ", templateId=" + templateId +
+                ", templateName='" + templateName + '\'' +
+                ", projectId=" + projectId +
+                ", projectName='" + projectName + '\'' +
+                ", userId='" + userId + '\'' +
+                ", userName='" + userName + '\'' +
+                '}';
+    }
+}

+ 42 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/enums/StatusEnum.java

@@ -0,0 +1,42 @@
+package cn.com.ctop.alarm.modules.enums;
+
+public enum StatusEnum {
+    STATUSM1("-1", "不限"),
+    STATUS1("1", "已暂停"),
+    STATUS3("3", "超预算"),
+    STATUS4("4", "有效"),
+    STATUS5("5", "已删除"),
+    STATUS6("6", "余额不足"),
+    STATUS11("11", "审核中"),
+    STATUS12("12", "审核未通过"),
+    STATUS14("14", "已结束"),
+    STATUS15("15", "已暂停"),
+    STATUS17("17", "组超预算"),
+    STATUS19("19", "未达投放时间"),
+    STATUS20("20", "有效");
+
+    private String name;
+    private String code;
+
+    private StatusEnum(String code, String name) {
+        this.name = name;
+        this.code = code;
+    }
+
+    public static StatusEnum getEnumByCode(String code) {
+        for (StatusEnum em : StatusEnum.values()) {
+            if (em.code.equals(code)) {
+                return em;
+            }
+        }
+        return null;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getCode() {
+        return code;
+    }
+}

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

@@ -0,0 +1,20 @@
+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);
+}

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

@@ -0,0 +1,22 @@
+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);
+}

+ 17 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/AlarmEventSendMapper.java

@@ -0,0 +1,17 @@
+package cn.com.ctop.alarm.modules.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import cn.com.ctop.alarm.modules.entity.AlarmEventSend;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 预警事件发送表
+ * @author: jeecg-boot
+ * @date:   2020-10-29
+ * @cersion: V1.0
+ */
+public interface AlarmEventSendMapper extends BaseMapper<AlarmEventSend> {
+
+}

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

@@ -0,0 +1,18 @@
+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);
+}

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

@@ -0,0 +1,20 @@
+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);
+}

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

@@ -0,0 +1,20 @@
+package cn.com.ctop.alarm.modules.mapper;
+
+import java.util.List;
+import java.util.Map;
+
+import cn.com.ctop.alarm.modules.entity.vo.TemplateAppliedVo;
+import org.apache.ibatis.annotations.Param;
+import cn.com.ctop.alarm.modules.entity.RuleAccountTemplate;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 规则模板
+ * @author: jeecg-boot
+ * @date:   2020-11-15
+ * @cersion: V1.0
+ */
+public interface RuleAccountTemplateMapper extends BaseMapper<RuleAccountTemplate> {
+
+    List<TemplateAppliedVo> getTemplateApplied(@Param("params") Map<String, Object> requestMap);
+}

+ 28 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/RuleAccountThresholdMapper.java

@@ -0,0 +1,28 @@
+package cn.com.ctop.alarm.modules.mapper;
+
+import cn.com.ctop.alarm.modules.entity.RuleAccountThreshold;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 规则关联账户 阈值
+ *
+ * @author: jeecg-boot
+ * @date: 2020-11-15
+ * @cersion: V1.0
+ */
+public interface RuleAccountThresholdMapper extends BaseMapper<RuleAccountThreshold> {
+
+    List<RuleAccountThreshold> selectByAccountId(Long accountId);
+
+    List<Long> selectGroupIdsByAccountId(Long accountId);
+
+    List<String> selectbatchNosByGroupIdId(Long accountId, Long groupId);
+
+    List<RuleAccountThreshold> selectCopyThresholdByAccountId(Long accountId, Long groupId, String batchNo);
+    List<String> getBatchNo(@Param("accountId") Long accountId, @Param("groupId") Long groupId);
+
+    List<RuleAccountThreshold> selectBatchNoByAccountId(Long accountId);
+}

+ 17 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/RuleBaseMapper.java

@@ -0,0 +1,17 @@
+package cn.com.ctop.alarm.modules.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import cn.com.ctop.alarm.modules.entity.RuleBase;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 基础规则
+ * @author: jeecg-boot
+ * @date:   2020-11-15
+ * @cersion: V1.0
+ */
+public interface RuleBaseMapper extends BaseMapper<RuleBase> {
+
+}

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.alarm.modules.mapper;
+
+import cn.com.ctop.alarm.modules.entity.RuleCondition;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 规则运算符配置表
+ *
+ * @author: jeecg-boot
+ * @date: 2020-11-16
+ * @cersion: V1.0
+ */
+public interface RuleConditionMapper extends BaseMapper<RuleCondition> {
+
+}

+ 17 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/RuleGroupMapper.java

@@ -0,0 +1,17 @@
+package cn.com.ctop.alarm.modules.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import cn.com.ctop.alarm.modules.entity.RuleGroup;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 规则组
+ * @author: jeecg-boot
+ * @date:   2020-11-15
+ * @cersion: V1.0
+ */
+public interface RuleGroupMapper extends BaseMapper<RuleGroup> {
+
+}

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

@@ -0,0 +1,19 @@
+package cn.com.ctop.alarm.modules.mapper;
+
+import cn.com.ctop.alarm.modules.entity.RuleIndicator;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 规则指标信息
+ *
+ * @author: jeecg-boot
+ * @date: 2020-11-14
+ * @cersion: V1.0
+ */
+public interface RuleIndicatorMapper extends BaseMapper<RuleIndicator> {
+
+    String getRuleIndicatorNameByMediaTypeAndDimension(@Param("mediaType") Integer mediaType, @Param("dimension") String dimension);
+
+    String getDataTypeByRuleDimensionAndIndicatorCode(@Param("ruleDimension") String ruleDimension,@Param("indicatorCode") String indicatorCode);
+}

+ 17 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/RuleTemplateMapper.java

@@ -0,0 +1,17 @@
+package cn.com.ctop.alarm.modules.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import cn.com.ctop.alarm.modules.entity.RuleTemplate;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 规则模板
+ * @author: jeecg-boot
+ * @date:   2020-11-15
+ * @cersion: V1.0
+ */
+public interface RuleTemplateMapper extends BaseMapper<RuleTemplate> {
+
+}

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

@@ -0,0 +1,15 @@
+<?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>

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

@@ -0,0 +1,60 @@
+<?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>

+ 5 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/AlarmEventSendMapper.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.AlarmEventSendMapper">
+
+</mapper>

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

@@ -0,0 +1,12 @@
+<?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>

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

@@ -0,0 +1,18 @@
+<?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>

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

@@ -0,0 +1,49 @@
+<?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.RuleAccountTemplateMapper">
+
+    <select id="getTemplateApplied" parameterType="Map"
+            resultType="cn.com.ctop.alarm.modules.entity.vo.TemplateAppliedVo">
+        select
+        t1.id id,
+        t1.account_id accountId,
+        t2.auth_name authName,
+        t1.template_id templateId,
+        (
+        SELECT
+        template_name
+        FROM
+        ctop_rule_template
+        WHERE
+        id = t1.template_id
+        ) as templateName,
+        t3.id projectId,
+        t3.project_name projectName,
+        t2.user_id userId,
+        t4.realname userName
+        FROM
+        ctop_rule_account_template t1
+        LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
+        LEFT JOIN ctop_project t3 ON t2.project_id = t3.id
+        left join sys_user t4 on t2.user_id = t4.id
+        where 1 = 1
+        <if test="params.userId !=null and params.userId !='' ">
+            and t2.user_id = #{params.userId}
+        </if>
+
+        <if test="params.accountId !=null and params.accountId !='' ">
+            and t2.account_id = #{params.accountId}
+        </if>
+
+        <if test="params.accountId !=null and params.accountId !='' ">
+            and t2.account_id = #{params.accountId}
+        </if>
+        <if test="params.projectName !=null and params.projectName !='' ">
+            and t3.project_name like concat(concat('%',#{params.projectName}),'%')
+        </if>
+        <if test="params.userName !=null and params.userName !='' ">
+            and t4.realname like concat(concat('%',#{params.userName}),'%')
+        </if>
+    </select>
+
+</mapper>

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

@@ -0,0 +1,37 @@
+<?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.RuleAccountThresholdMapper">
+
+    <select id="selectByAccountId" resultType="cn.com.ctop.alarm.modules.entity.RuleAccountThreshold">
+       SELECT * FROM ctop_rule_account_threshold
+       WHERE account_id = #{accountId}
+       AND  (batch_no ='' or batch_no is null)
+    </select>
+    <select id="selectGroupIdsByAccountId" resultType="java.lang.Long">
+       SELECT group_id FROM `ctop_rule_account_threshold`
+        WHERE (batch_no !='' and batch_no is not null)
+        and  account_id = #{accountId}
+        group by group_id
+    </select>
+    <select id="selectbatchNosByGroupIdId" resultType="java.lang.String">
+       SELECT batch_no FROM `ctop_rule_account_threshold`
+        WHERE  (batch_no !='' and batch_no is not null)
+        and account_id = #{accountId}
+        and group_id = #{groupId}
+        GROUP BY batch_no
+    </select>
+    <select id="selectCopyThresholdByAccountId" resultType="cn.com.ctop.alarm.modules.entity.RuleAccountThreshold">
+       SELECT * FROM ctop_rule_account_threshold
+        WHERE account_id = #{accountId}
+        and group_id = #{groupId}
+        and batch_no = #{batchNo}
+    </select>
+
+    <select id="getBatchNo" resultType="java.lang.String">
+    select batch_no from ctop_rule_account_threshold
+    where  account_id = #{accountId}
+    and group_id = #{groupId}
+    and (batch_no !='' and batch_no is not null)
+    group by batch_no
+    </select>
+</mapper>

+ 5 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/RuleBaseMapper.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.RuleBaseMapper">
+
+</mapper>

+ 5 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/RuleConditionMapper.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.RuleConditionMapper">
+
+</mapper>

+ 5 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/RuleGroupMapper.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.RuleGroupMapper">
+
+</mapper>

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

@@ -0,0 +1,22 @@
+<?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.RuleIndicatorMapper">
+
+    <select id="getRuleIndicatorNameByMediaTypeAndDimension" resultType="java.lang.String">
+      select  dimension_name
+      from ctop_rule_media_dimension
+      where  media_type = #{mediaType}
+      and dimension = #{dimension}
+      limit 1
+    </select>
+
+    <select id="getDataTypeByRuleDimensionAndIndicatorCode" resultType="java.lang.String">
+      select  data_type
+      from ctop_rule_indicator
+      where  code = #{indicatorCode}
+      and dimension = #{ruleDimension}
+      limit 1
+    </select>
+
+
+</mapper>

+ 5 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/RuleTemplateMapper.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.RuleTemplateMapper">
+
+</mapper>

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

@@ -0,0 +1,14 @@
+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> {
+
+}

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

@@ -0,0 +1,28 @@
+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 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/IAlarmEventSendService.java


Some files were not shown because too many files changed in this diff