diff --git a/doc/sql/riskmanage.sql b/doc/sql/riskmanage.sql deleted file mode 100644 index 4d17fc5..0000000 --- a/doc/sql/riskmanage.sql +++ /dev/null @@ -1,2609 +0,0 @@ -/* -Navicat MySQL Data Transfer - -Source Server : enginex -Source Server Version : 50724 -Source Host : 47.102.125.25:3306 -Source Database : riskmanage - -Target Server Type : MYSQL -Target Server Version : 50724 -File Encoding : 65001 - -Date: 2022-06-20 10:30:04 -*/ - -SET FOREIGN_KEY_CHECKS=0; - --- ---------------------------- --- Table structure for organ_46_b_112 --- ---------------------------- -DROP TABLE IF EXISTS `organ_46_b_112`; -CREATE TABLE `organ_46_b_112` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', - `t0` varchar(100) DEFAULT NULL COMMENT '704', - `t1` varchar(100) DEFAULT NULL, - `t2` varchar(100) DEFAULT NULL, - `t3` varchar(100) DEFAULT NULL, - `t4` varchar(100) DEFAULT NULL, - `t5` varchar(100) DEFAULT NULL, - `t6` varchar(100) DEFAULT NULL, - `t7` varchar(100) DEFAULT NULL, - `t8` varchar(100) DEFAULT NULL, - `t9` varchar(100) DEFAULT NULL, - `t10` varchar(100) DEFAULT NULL, - `t11` varchar(100) DEFAULT NULL, - `t12` varchar(100) DEFAULT NULL, - `t13` varchar(100) DEFAULT NULL, - `t14` varchar(100) DEFAULT NULL, - `t15` varchar(100) DEFAULT NULL, - `t16` varchar(100) DEFAULT NULL, - `t17` varchar(100) DEFAULT NULL, - `t18` varchar(100) DEFAULT NULL, - `t19` varchar(100) DEFAULT NULL, - `user_id` int(11) NOT NULL COMMENT '创建人编号', - `nick_name` varchar(50) DEFAULT NULL COMMENT '创建人昵称', - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`) USING BTREE, - KEY `idx_top4` (`t0`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - --- ---------------------------- --- Table structure for organ_46_b_113 --- ---------------------------- -DROP TABLE IF EXISTS `organ_46_b_113`; -CREATE TABLE `organ_46_b_113` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', - `t0` varchar(100) DEFAULT NULL COMMENT '703', - `t1` varchar(100) DEFAULT NULL, - `t2` varchar(100) DEFAULT NULL, - `t3` varchar(100) DEFAULT NULL, - `t4` varchar(100) DEFAULT NULL, - `t5` varchar(100) DEFAULT NULL, - `t6` varchar(100) DEFAULT NULL, - `t7` varchar(100) DEFAULT NULL, - `t8` varchar(100) DEFAULT NULL, - `t9` varchar(100) DEFAULT NULL, - `t10` varchar(100) DEFAULT NULL, - `t11` varchar(100) DEFAULT NULL, - `t12` varchar(100) DEFAULT NULL, - `t13` varchar(100) DEFAULT NULL, - `t14` varchar(100) DEFAULT NULL, - `t15` varchar(100) DEFAULT NULL, - `t16` varchar(100) DEFAULT NULL, - `t17` varchar(100) DEFAULT NULL, - `t18` varchar(100) DEFAULT NULL, - `t19` varchar(100) DEFAULT NULL, - `user_id` int(11) NOT NULL COMMENT '创建人编号', - `nick_name` varchar(50) DEFAULT NULL COMMENT '创建人昵称', - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`) USING BTREE, - KEY `idx_top4` (`t0`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=214 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - --- ---------------------------- --- Table structure for organ_46_b_114 --- ---------------------------- -DROP TABLE IF EXISTS `organ_46_b_114`; -CREATE TABLE `organ_46_b_114` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', - `t0` varchar(100) DEFAULT NULL COMMENT '703', - `t1` varchar(100) DEFAULT NULL, - `t2` varchar(100) DEFAULT NULL, - `t3` varchar(100) DEFAULT NULL, - `t4` varchar(100) DEFAULT NULL, - `t5` varchar(100) DEFAULT NULL, - `t6` varchar(100) DEFAULT NULL, - `t7` varchar(100) DEFAULT NULL, - `t8` varchar(100) DEFAULT NULL, - `t9` varchar(100) DEFAULT NULL, - `t10` varchar(100) DEFAULT NULL, - `t11` varchar(100) DEFAULT NULL, - `t12` varchar(100) DEFAULT NULL, - `t13` varchar(100) DEFAULT NULL, - `t14` varchar(100) DEFAULT NULL, - `t15` varchar(100) DEFAULT NULL, - `t16` varchar(100) DEFAULT NULL, - `t17` varchar(100) DEFAULT NULL, - `t18` varchar(100) DEFAULT NULL, - `t19` varchar(100) DEFAULT NULL, - `user_id` int(11) NOT NULL COMMENT '创建人编号', - `nick_name` varchar(50) DEFAULT NULL COMMENT '创建人昵称', - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`) USING BTREE, - KEY `idx_top4` (`t0`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=216 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - --- ---------------------------- --- Table structure for organ_46_b_115 --- ---------------------------- -DROP TABLE IF EXISTS `organ_46_b_115`; -CREATE TABLE `organ_46_b_115` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', - `t0` varchar(100) DEFAULT NULL COMMENT '698', - `t1` varchar(100) DEFAULT NULL, - `t2` varchar(100) DEFAULT NULL, - `t3` varchar(100) DEFAULT NULL, - `t4` varchar(100) DEFAULT NULL, - `t5` varchar(100) DEFAULT NULL, - `t6` varchar(100) DEFAULT NULL, - `t7` varchar(100) DEFAULT NULL, - `t8` varchar(100) DEFAULT NULL, - `t9` varchar(100) DEFAULT NULL, - `t10` varchar(100) DEFAULT NULL, - `t11` varchar(100) DEFAULT NULL, - `t12` varchar(100) DEFAULT NULL, - `t13` varchar(100) DEFAULT NULL, - `t14` varchar(100) DEFAULT NULL, - `t15` varchar(100) DEFAULT NULL, - `t16` varchar(100) DEFAULT NULL, - `t17` varchar(100) DEFAULT NULL, - `t18` varchar(100) DEFAULT NULL, - `t19` varchar(100) DEFAULT NULL, - `user_id` int(11) NOT NULL COMMENT '创建人编号', - `nick_name` varchar(50) DEFAULT NULL COMMENT '创建人昵称', - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`) USING BTREE, - KEY `idx_top4` (`t0`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=329 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - --- ---------------------------- --- Table structure for organ_46_b_148 --- ---------------------------- -DROP TABLE IF EXISTS `organ_46_b_148`; -CREATE TABLE `organ_46_b_148` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', - `t0` varchar(100) DEFAULT NULL COMMENT '1067', - `t1` varchar(100) DEFAULT NULL, - `t2` varchar(100) DEFAULT NULL, - `t3` varchar(100) DEFAULT NULL, - `t4` varchar(100) DEFAULT NULL, - `t5` varchar(100) DEFAULT NULL, - `t6` varchar(100) DEFAULT NULL, - `t7` varchar(100) DEFAULT NULL, - `t8` varchar(100) DEFAULT NULL, - `t9` varchar(100) DEFAULT NULL, - `t10` varchar(100) DEFAULT NULL, - `t11` varchar(100) DEFAULT NULL, - `t12` varchar(100) DEFAULT NULL, - `t13` varchar(100) DEFAULT NULL, - `t14` varchar(100) DEFAULT NULL, - `t15` varchar(100) DEFAULT NULL, - `t16` varchar(100) DEFAULT NULL, - `t17` varchar(100) DEFAULT NULL, - `t18` varchar(100) DEFAULT NULL, - `t19` varchar(100) DEFAULT NULL, - `user_id` int(11) NOT NULL COMMENT '创建人编号', - `nick_name` varchar(50) DEFAULT NULL COMMENT '创建人昵称', - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`), - KEY `idx_top4` (`t0`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for organ_46_b_149 --- ---------------------------- -DROP TABLE IF EXISTS `organ_46_b_149`; -CREATE TABLE `organ_46_b_149` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', - `t0` varchar(100) DEFAULT NULL COMMENT '1055', - `t1` varchar(100) DEFAULT NULL, - `t2` varchar(100) DEFAULT NULL, - `t3` varchar(100) DEFAULT NULL, - `t4` varchar(100) DEFAULT NULL, - `t5` varchar(100) DEFAULT NULL, - `t6` varchar(100) DEFAULT NULL, - `t7` varchar(100) DEFAULT NULL, - `t8` varchar(100) DEFAULT NULL, - `t9` varchar(100) DEFAULT NULL, - `t10` varchar(100) DEFAULT NULL, - `t11` varchar(100) DEFAULT NULL, - `t12` varchar(100) DEFAULT NULL, - `t13` varchar(100) DEFAULT NULL, - `t14` varchar(100) DEFAULT NULL, - `t15` varchar(100) DEFAULT NULL, - `t16` varchar(100) DEFAULT NULL, - `t17` varchar(100) DEFAULT NULL, - `t18` varchar(100) DEFAULT NULL, - `t19` varchar(100) DEFAULT NULL, - `user_id` int(11) NOT NULL COMMENT '创建人编号', - `nick_name` varchar(50) DEFAULT NULL COMMENT '创建人昵称', - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`), - KEY `idx_top4` (`t0`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for organ_46_b_151 --- ---------------------------- -DROP TABLE IF EXISTS `organ_46_b_151`; -CREATE TABLE `organ_46_b_151` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', - `t0` varchar(100) DEFAULT NULL COMMENT '1070', - `t1` varchar(100) DEFAULT NULL, - `t2` varchar(100) DEFAULT NULL, - `t3` varchar(100) DEFAULT NULL, - `t4` varchar(100) DEFAULT NULL, - `t5` varchar(100) DEFAULT NULL, - `t6` varchar(100) DEFAULT NULL, - `t7` varchar(100) DEFAULT NULL, - `t8` varchar(100) DEFAULT NULL, - `t9` varchar(100) DEFAULT NULL, - `t10` varchar(100) DEFAULT NULL, - `t11` varchar(100) DEFAULT NULL, - `t12` varchar(100) DEFAULT NULL, - `t13` varchar(100) DEFAULT NULL, - `t14` varchar(100) DEFAULT NULL, - `t15` varchar(100) DEFAULT NULL, - `t16` varchar(100) DEFAULT NULL, - `t17` varchar(100) DEFAULT NULL, - `t18` varchar(100) DEFAULT NULL, - `t19` varchar(100) DEFAULT NULL, - `user_id` int(11) NOT NULL COMMENT '创建人编号', - `nick_name` varchar(50) DEFAULT NULL COMMENT '创建人昵称', - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`), - KEY `idx_top4` (`t0`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for organ_46_b_152 --- ---------------------------- -DROP TABLE IF EXISTS `organ_46_b_152`; -CREATE TABLE `organ_46_b_152` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', - `t0` varchar(100) DEFAULT NULL COMMENT '1070', - `t1` varchar(100) DEFAULT NULL, - `t2` varchar(100) DEFAULT NULL, - `t3` varchar(100) DEFAULT NULL, - `t4` varchar(100) DEFAULT NULL, - `t5` varchar(100) DEFAULT NULL, - `t6` varchar(100) DEFAULT NULL, - `t7` varchar(100) DEFAULT NULL, - `t8` varchar(100) DEFAULT NULL, - `t9` varchar(100) DEFAULT NULL, - `t10` varchar(100) DEFAULT NULL, - `t11` varchar(100) DEFAULT NULL, - `t12` varchar(100) DEFAULT NULL, - `t13` varchar(100) DEFAULT NULL, - `t14` varchar(100) DEFAULT NULL, - `t15` varchar(100) DEFAULT NULL, - `t16` varchar(100) DEFAULT NULL, - `t17` varchar(100) DEFAULT NULL, - `t18` varchar(100) DEFAULT NULL, - `t19` varchar(100) DEFAULT NULL, - `user_id` int(11) NOT NULL COMMENT '创建人编号', - `nick_name` varchar(50) DEFAULT NULL COMMENT '创建人昵称', - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`), - KEY `idx_top4` (`t0`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for organ_46_b_153 --- ---------------------------- -DROP TABLE IF EXISTS `organ_46_b_153`; -CREATE TABLE `organ_46_b_153` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', - `t0` varchar(100) DEFAULT NULL COMMENT '1080', - `t1` varchar(100) DEFAULT NULL, - `t2` varchar(100) DEFAULT NULL, - `t3` varchar(100) DEFAULT NULL, - `t4` varchar(100) DEFAULT NULL, - `t5` varchar(100) DEFAULT NULL, - `t6` varchar(100) DEFAULT NULL, - `t7` varchar(100) DEFAULT NULL, - `t8` varchar(100) DEFAULT NULL, - `t9` varchar(100) DEFAULT NULL, - `t10` varchar(100) DEFAULT NULL, - `t11` varchar(100) DEFAULT NULL, - `t12` varchar(100) DEFAULT NULL, - `t13` varchar(100) DEFAULT NULL, - `t14` varchar(100) DEFAULT NULL, - `t15` varchar(100) DEFAULT NULL, - `t16` varchar(100) DEFAULT NULL, - `t17` varchar(100) DEFAULT NULL, - `t18` varchar(100) DEFAULT NULL, - `t19` varchar(100) DEFAULT NULL, - `user_id` int(11) NOT NULL COMMENT '创建人编号', - `nick_name` varchar(50) DEFAULT NULL COMMENT '创建人昵称', - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`), - KEY `idx_top4` (`t0`) -) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for organ_46_b_156 --- ---------------------------- -DROP TABLE IF EXISTS `organ_46_b_156`; -CREATE TABLE `organ_46_b_156` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', - `t0` varchar(100) DEFAULT NULL COMMENT '1077', - `t1` varchar(100) DEFAULT NULL, - `t2` varchar(100) DEFAULT NULL, - `t3` varchar(100) DEFAULT NULL, - `t4` varchar(100) DEFAULT NULL, - `t5` varchar(100) DEFAULT NULL, - `t6` varchar(100) DEFAULT NULL, - `t7` varchar(100) DEFAULT NULL, - `t8` varchar(100) DEFAULT NULL, - `t9` varchar(100) DEFAULT NULL, - `t10` varchar(100) DEFAULT NULL, - `t11` varchar(100) DEFAULT NULL, - `t12` varchar(100) DEFAULT NULL, - `t13` varchar(100) DEFAULT NULL, - `t14` varchar(100) DEFAULT NULL, - `t15` varchar(100) DEFAULT NULL, - `t16` varchar(100) DEFAULT NULL, - `t17` varchar(100) DEFAULT NULL, - `t18` varchar(100) DEFAULT NULL, - `t19` varchar(100) DEFAULT NULL, - `user_id` int(11) NOT NULL COMMENT '创建人编号', - `nick_name` varchar(50) DEFAULT NULL COMMENT '创建人昵称', - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`), - KEY `idx_top4` (`t0`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for organ_46_b_157 --- ---------------------------- -DROP TABLE IF EXISTS `organ_46_b_157`; -CREATE TABLE `organ_46_b_157` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', - `t0` varchar(100) DEFAULT NULL COMMENT '1055', - `t1` varchar(100) DEFAULT NULL, - `t2` varchar(100) DEFAULT NULL, - `t3` varchar(100) DEFAULT NULL, - `t4` varchar(100) DEFAULT NULL, - `t5` varchar(100) DEFAULT NULL, - `t6` varchar(100) DEFAULT NULL, - `t7` varchar(100) DEFAULT NULL, - `t8` varchar(100) DEFAULT NULL, - `t9` varchar(100) DEFAULT NULL, - `t10` varchar(100) DEFAULT NULL, - `t11` varchar(100) DEFAULT NULL, - `t12` varchar(100) DEFAULT NULL, - `t13` varchar(100) DEFAULT NULL, - `t14` varchar(100) DEFAULT NULL, - `t15` varchar(100) DEFAULT NULL, - `t16` varchar(100) DEFAULT NULL, - `t17` varchar(100) DEFAULT NULL, - `t18` varchar(100) DEFAULT NULL, - `t19` varchar(100) DEFAULT NULL, - `user_id` int(11) NOT NULL COMMENT '创建人编号', - `nick_name` varchar(50) DEFAULT NULL COMMENT '创建人昵称', - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`), - KEY `idx_top4` (`t0`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for organ_46_b_158 --- ---------------------------- -DROP TABLE IF EXISTS `organ_46_b_158`; -CREATE TABLE `organ_46_b_158` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', - `t0` varchar(100) DEFAULT NULL COMMENT '1087', - `t1` varchar(100) DEFAULT NULL, - `t2` varchar(100) DEFAULT NULL, - `t3` varchar(100) DEFAULT NULL, - `t4` varchar(100) DEFAULT NULL, - `t5` varchar(100) DEFAULT NULL, - `t6` varchar(100) DEFAULT NULL, - `t7` varchar(100) DEFAULT NULL, - `t8` varchar(100) DEFAULT NULL, - `t9` varchar(100) DEFAULT NULL, - `t10` varchar(100) DEFAULT NULL, - `t11` varchar(100) DEFAULT NULL, - `t12` varchar(100) DEFAULT NULL, - `t13` varchar(100) DEFAULT NULL, - `t14` varchar(100) DEFAULT NULL, - `t15` varchar(100) DEFAULT NULL, - `t16` varchar(100) DEFAULT NULL, - `t17` varchar(100) DEFAULT NULL, - `t18` varchar(100) DEFAULT NULL, - `t19` varchar(100) DEFAULT NULL, - `user_id` int(11) NOT NULL COMMENT '创建人编号', - `nick_name` varchar(50) DEFAULT NULL COMMENT '创建人昵称', - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`), - KEY `idx_top4` (`t0`) -) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for organ_46_list_db_148_16 --- ---------------------------- -DROP TABLE IF EXISTS `organ_46_list_db_148_16`; -CREATE TABLE `organ_46_list_db_148_16` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', - `t0` varchar(100) DEFAULT NULL COMMENT '1067', - `t1` varchar(100) DEFAULT NULL, - `t2` varchar(100) DEFAULT NULL, - `t3` varchar(100) DEFAULT NULL, - `t4` varchar(100) DEFAULT NULL, - `t5` varchar(100) DEFAULT NULL, - `t6` varchar(100) DEFAULT NULL, - `t7` varchar(100) DEFAULT NULL, - `t8` varchar(100) DEFAULT NULL, - `t9` varchar(100) DEFAULT NULL, - `t10` varchar(100) DEFAULT NULL, - `t11` varchar(100) DEFAULT NULL, - `t12` varchar(100) DEFAULT NULL, - `t13` varchar(100) DEFAULT NULL, - `t14` varchar(100) DEFAULT NULL, - `t15` varchar(100) DEFAULT NULL, - `t16` varchar(100) DEFAULT NULL, - `t17` varchar(100) DEFAULT NULL, - `t18` varchar(100) DEFAULT NULL, - `t19` varchar(100) DEFAULT NULL, - `user_id` int(11) NOT NULL COMMENT '创建人编号', - `nick_name` varchar(50) DEFAULT NULL COMMENT '创建人昵称', - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`), - KEY `idx_top4` (`t0`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for organ_46_list_db_148_17 --- ---------------------------- -DROP TABLE IF EXISTS `organ_46_list_db_148_17`; -CREATE TABLE `organ_46_list_db_148_17` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', - `t0` varchar(100) DEFAULT NULL COMMENT '1072', - `t1` varchar(100) DEFAULT NULL, - `t2` varchar(100) DEFAULT NULL, - `t3` varchar(100) DEFAULT NULL, - `t4` varchar(100) DEFAULT NULL, - `t5` varchar(100) DEFAULT NULL, - `t6` varchar(100) DEFAULT NULL, - `t7` varchar(100) DEFAULT NULL, - `t8` varchar(100) DEFAULT NULL, - `t9` varchar(100) DEFAULT NULL, - `t10` varchar(100) DEFAULT NULL, - `t11` varchar(100) DEFAULT NULL, - `t12` varchar(100) DEFAULT NULL, - `t13` varchar(100) DEFAULT NULL, - `t14` varchar(100) DEFAULT NULL, - `t15` varchar(100) DEFAULT NULL, - `t16` varchar(100) DEFAULT NULL, - `t17` varchar(100) DEFAULT NULL, - `t18` varchar(100) DEFAULT NULL, - `t19` varchar(100) DEFAULT NULL, - `user_id` int(11) NOT NULL COMMENT '创建人编号', - `nick_name` varchar(50) DEFAULT NULL COMMENT '创建人昵称', - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`), - KEY `idx_top4` (`t0`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for organ_46_list_db_150_10 --- ---------------------------- -DROP TABLE IF EXISTS `organ_46_list_db_150_10`; -CREATE TABLE `organ_46_list_db_150_10` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', - `t0` varchar(100) DEFAULT NULL COMMENT '1067', - `t1` varchar(100) DEFAULT NULL, - `t2` varchar(100) DEFAULT NULL, - `t3` varchar(100) DEFAULT NULL, - `t4` varchar(100) DEFAULT NULL, - `t5` varchar(100) DEFAULT NULL, - `t6` varchar(100) DEFAULT NULL, - `t7` varchar(100) DEFAULT NULL, - `t8` varchar(100) DEFAULT NULL, - `t9` varchar(100) DEFAULT NULL, - `t10` varchar(100) DEFAULT NULL, - `t11` varchar(100) DEFAULT NULL, - `t12` varchar(100) DEFAULT NULL, - `t13` varchar(100) DEFAULT NULL, - `t14` varchar(100) DEFAULT NULL, - `t15` varchar(100) DEFAULT NULL, - `t16` varchar(100) DEFAULT NULL, - `t17` varchar(100) DEFAULT NULL, - `t18` varchar(100) DEFAULT NULL, - `t19` varchar(100) DEFAULT NULL, - `user_id` int(11) NOT NULL COMMENT '创建人编号', - `nick_name` varchar(50) DEFAULT NULL COMMENT '创建人昵称', - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`), - KEY `idx_top4` (`t0`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for organ_46_list_db_150_11 --- ---------------------------- -DROP TABLE IF EXISTS `organ_46_list_db_150_11`; -CREATE TABLE `organ_46_list_db_150_11` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', - `t0` varchar(100) DEFAULT NULL COMMENT '1067', - `t1` varchar(100) DEFAULT NULL, - `t2` varchar(100) DEFAULT NULL, - `t3` varchar(100) DEFAULT NULL, - `t4` varchar(100) DEFAULT NULL, - `t5` varchar(100) DEFAULT NULL, - `t6` varchar(100) DEFAULT NULL, - `t7` varchar(100) DEFAULT NULL, - `t8` varchar(100) DEFAULT NULL, - `t9` varchar(100) DEFAULT NULL, - `t10` varchar(100) DEFAULT NULL, - `t11` varchar(100) DEFAULT NULL, - `t12` varchar(100) DEFAULT NULL, - `t13` varchar(100) DEFAULT NULL, - `t14` varchar(100) DEFAULT NULL, - `t15` varchar(100) DEFAULT NULL, - `t16` varchar(100) DEFAULT NULL, - `t17` varchar(100) DEFAULT NULL, - `t18` varchar(100) DEFAULT NULL, - `t19` varchar(100) DEFAULT NULL, - `user_id` int(11) NOT NULL COMMENT '创建人编号', - `nick_name` varchar(50) DEFAULT NULL COMMENT '创建人昵称', - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`), - KEY `idx_top4` (`t0`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for organ_46_list_db_150_12 --- ---------------------------- -DROP TABLE IF EXISTS `organ_46_list_db_150_12`; -CREATE TABLE `organ_46_list_db_150_12` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', - `t0` varchar(100) DEFAULT NULL COMMENT '1067', - `t1` varchar(100) DEFAULT NULL, - `t2` varchar(100) DEFAULT NULL, - `t3` varchar(100) DEFAULT NULL, - `t4` varchar(100) DEFAULT NULL, - `t5` varchar(100) DEFAULT NULL, - `t6` varchar(100) DEFAULT NULL, - `t7` varchar(100) DEFAULT NULL, - `t8` varchar(100) DEFAULT NULL, - `t9` varchar(100) DEFAULT NULL, - `t10` varchar(100) DEFAULT NULL, - `t11` varchar(100) DEFAULT NULL, - `t12` varchar(100) DEFAULT NULL, - `t13` varchar(100) DEFAULT NULL, - `t14` varchar(100) DEFAULT NULL, - `t15` varchar(100) DEFAULT NULL, - `t16` varchar(100) DEFAULT NULL, - `t17` varchar(100) DEFAULT NULL, - `t18` varchar(100) DEFAULT NULL, - `t19` varchar(100) DEFAULT NULL, - `user_id` int(11) NOT NULL COMMENT '创建人编号', - `nick_name` varchar(50) DEFAULT NULL COMMENT '创建人昵称', - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`), - KEY `idx_top4` (`t0`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for organ_46_list_db_150_13 --- ---------------------------- -DROP TABLE IF EXISTS `organ_46_list_db_150_13`; -CREATE TABLE `organ_46_list_db_150_13` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', - `t0` varchar(100) DEFAULT NULL COMMENT '1067', - `t1` varchar(100) DEFAULT NULL, - `t2` varchar(100) DEFAULT NULL, - `t3` varchar(100) DEFAULT NULL, - `t4` varchar(100) DEFAULT NULL, - `t5` varchar(100) DEFAULT NULL, - `t6` varchar(100) DEFAULT NULL, - `t7` varchar(100) DEFAULT NULL, - `t8` varchar(100) DEFAULT NULL, - `t9` varchar(100) DEFAULT NULL, - `t10` varchar(100) DEFAULT NULL, - `t11` varchar(100) DEFAULT NULL, - `t12` varchar(100) DEFAULT NULL, - `t13` varchar(100) DEFAULT NULL, - `t14` varchar(100) DEFAULT NULL, - `t15` varchar(100) DEFAULT NULL, - `t16` varchar(100) DEFAULT NULL, - `t17` varchar(100) DEFAULT NULL, - `t18` varchar(100) DEFAULT NULL, - `t19` varchar(100) DEFAULT NULL, - `user_id` int(11) NOT NULL COMMENT '创建人编号', - `nick_name` varchar(50) DEFAULT NULL COMMENT '创建人昵称', - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`), - KEY `idx_top4` (`t0`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for organ_46_list_db_150_14 --- ---------------------------- -DROP TABLE IF EXISTS `organ_46_list_db_150_14`; -CREATE TABLE `organ_46_list_db_150_14` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', - `t0` varchar(100) DEFAULT NULL COMMENT '1067', - `t1` varchar(100) DEFAULT NULL, - `t2` varchar(100) DEFAULT NULL, - `t3` varchar(100) DEFAULT NULL, - `t4` varchar(100) DEFAULT NULL, - `t5` varchar(100) DEFAULT NULL, - `t6` varchar(100) DEFAULT NULL, - `t7` varchar(100) DEFAULT NULL, - `t8` varchar(100) DEFAULT NULL, - `t9` varchar(100) DEFAULT NULL, - `t10` varchar(100) DEFAULT NULL, - `t11` varchar(100) DEFAULT NULL, - `t12` varchar(100) DEFAULT NULL, - `t13` varchar(100) DEFAULT NULL, - `t14` varchar(100) DEFAULT NULL, - `t15` varchar(100) DEFAULT NULL, - `t16` varchar(100) DEFAULT NULL, - `t17` varchar(100) DEFAULT NULL, - `t18` varchar(100) DEFAULT NULL, - `t19` varchar(100) DEFAULT NULL, - `user_id` int(11) NOT NULL COMMENT '创建人编号', - `nick_name` varchar(50) DEFAULT NULL COMMENT '创建人昵称', - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`), - KEY `idx_top4` (`t0`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for organ_46_list_db_150_15 --- ---------------------------- -DROP TABLE IF EXISTS `organ_46_list_db_150_15`; -CREATE TABLE `organ_46_list_db_150_15` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', - `t0` varchar(100) DEFAULT NULL COMMENT '1067', - `t1` varchar(100) DEFAULT NULL, - `t2` varchar(100) DEFAULT NULL, - `t3` varchar(100) DEFAULT NULL, - `t4` varchar(100) DEFAULT NULL, - `t5` varchar(100) DEFAULT NULL, - `t6` varchar(100) DEFAULT NULL, - `t7` varchar(100) DEFAULT NULL, - `t8` varchar(100) DEFAULT NULL, - `t9` varchar(100) DEFAULT NULL, - `t10` varchar(100) DEFAULT NULL, - `t11` varchar(100) DEFAULT NULL, - `t12` varchar(100) DEFAULT NULL, - `t13` varchar(100) DEFAULT NULL, - `t14` varchar(100) DEFAULT NULL, - `t15` varchar(100) DEFAULT NULL, - `t16` varchar(100) DEFAULT NULL, - `t17` varchar(100) DEFAULT NULL, - `t18` varchar(100) DEFAULT NULL, - `t19` varchar(100) DEFAULT NULL, - `user_id` int(11) NOT NULL COMMENT '创建人编号', - `nick_name` varchar(50) DEFAULT NULL COMMENT '创建人昵称', - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`), - KEY `idx_top4` (`t0`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for organ_46_list_db_150_8 --- ---------------------------- -DROP TABLE IF EXISTS `organ_46_list_db_150_8`; -CREATE TABLE `organ_46_list_db_150_8` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', - `t0` varchar(100) DEFAULT NULL COMMENT '1067', - `t1` varchar(100) DEFAULT NULL, - `t2` varchar(100) DEFAULT NULL, - `t3` varchar(100) DEFAULT NULL, - `t4` varchar(100) DEFAULT NULL, - `t5` varchar(100) DEFAULT NULL, - `t6` varchar(100) DEFAULT NULL, - `t7` varchar(100) DEFAULT NULL, - `t8` varchar(100) DEFAULT NULL, - `t9` varchar(100) DEFAULT NULL, - `t10` varchar(100) DEFAULT NULL, - `t11` varchar(100) DEFAULT NULL, - `t12` varchar(100) DEFAULT NULL, - `t13` varchar(100) DEFAULT NULL, - `t14` varchar(100) DEFAULT NULL, - `t15` varchar(100) DEFAULT NULL, - `t16` varchar(100) DEFAULT NULL, - `t17` varchar(100) DEFAULT NULL, - `t18` varchar(100) DEFAULT NULL, - `t19` varchar(100) DEFAULT NULL, - `user_id` int(11) NOT NULL COMMENT '创建人编号', - `nick_name` varchar(50) DEFAULT NULL COMMENT '创建人昵称', - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`), - KEY `idx_top4` (`t0`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for organ_46_list_db_150_9 --- ---------------------------- -DROP TABLE IF EXISTS `organ_46_list_db_150_9`; -CREATE TABLE `organ_46_list_db_150_9` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', - `t0` varchar(100) DEFAULT NULL COMMENT '1067', - `t1` varchar(100) DEFAULT NULL, - `t2` varchar(100) DEFAULT NULL, - `t3` varchar(100) DEFAULT NULL, - `t4` varchar(100) DEFAULT NULL, - `t5` varchar(100) DEFAULT NULL, - `t6` varchar(100) DEFAULT NULL, - `t7` varchar(100) DEFAULT NULL, - `t8` varchar(100) DEFAULT NULL, - `t9` varchar(100) DEFAULT NULL, - `t10` varchar(100) DEFAULT NULL, - `t11` varchar(100) DEFAULT NULL, - `t12` varchar(100) DEFAULT NULL, - `t13` varchar(100) DEFAULT NULL, - `t14` varchar(100) DEFAULT NULL, - `t15` varchar(100) DEFAULT NULL, - `t16` varchar(100) DEFAULT NULL, - `t17` varchar(100) DEFAULT NULL, - `t18` varchar(100) DEFAULT NULL, - `t19` varchar(100) DEFAULT NULL, - `user_id` int(11) NOT NULL COMMENT '创建人编号', - `nick_name` varchar(50) DEFAULT NULL COMMENT '创建人昵称', - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`), - KEY `idx_top4` (`t0`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for organ_46_w_150 --- ---------------------------- -DROP TABLE IF EXISTS `organ_46_w_150`; -CREATE TABLE `organ_46_w_150` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id', - `t0` varchar(100) DEFAULT NULL COMMENT '1067', - `t1` varchar(100) DEFAULT NULL, - `t2` varchar(100) DEFAULT NULL, - `t3` varchar(100) DEFAULT NULL, - `t4` varchar(100) DEFAULT NULL, - `t5` varchar(100) DEFAULT NULL, - `t6` varchar(100) DEFAULT NULL, - `t7` varchar(100) DEFAULT NULL, - `t8` varchar(100) DEFAULT NULL, - `t9` varchar(100) DEFAULT NULL, - `t10` varchar(100) DEFAULT NULL, - `t11` varchar(100) DEFAULT NULL, - `t12` varchar(100) DEFAULT NULL, - `t13` varchar(100) DEFAULT NULL, - `t14` varchar(100) DEFAULT NULL, - `t15` varchar(100) DEFAULT NULL, - `t16` varchar(100) DEFAULT NULL, - `t17` varchar(100) DEFAULT NULL, - `t18` varchar(100) DEFAULT NULL, - `t19` varchar(100) DEFAULT NULL, - `user_id` int(11) NOT NULL COMMENT '创建人编号', - `nick_name` varchar(50) DEFAULT NULL COMMENT '创建人昵称', - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`), - KEY `idx_top4` (`t0`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_analyse_decision_result --- ---------------------------- -DROP TABLE IF EXISTS `t_analyse_decision_result`; -CREATE TABLE `t_analyse_decision_result` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id', - `call_date` datetime NOT NULL COMMENT '调用时间', - `engine_id` int(11) NOT NULL DEFAULT '0' COMMENT '引擎id', - `engine_name` varchar(255) DEFAULT NULL COMMENT '引擎名', - `engine_description` varchar(255) DEFAULT NULL COMMENT '引擎表述', - `version_id` int(11) NOT NULL DEFAULT '0' COMMENT '引擎版本id', - `version_code` varchar(255) DEFAULT NULL COMMENT '引擎版本code', - `result` varchar(255) DEFAULT NULL COMMENT '结果', - `result_count` int(11) NOT NULL DEFAULT '0' COMMENT '次数', - `organ_id` int(11) NOT NULL DEFAULT '0' COMMENT '组织id', - `create_user_id` int(11) NOT NULL DEFAULT '0' COMMENT '创建者id', - `update_user_id` int(11) NOT NULL DEFAULT '0' COMMENT '修改者id', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改日期', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - --- ---------------------------- --- Table structure for t_analyse_decision_tables --- ---------------------------- -DROP TABLE IF EXISTS `t_analyse_decision_tables`; -CREATE TABLE `t_analyse_decision_tables` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id', - `call_date` datetime NOT NULL COMMENT '调用时间', - `engine_id` int(11) NOT NULL DEFAULT '0' COMMENT '引擎id', - `engine_name` varchar(255) DEFAULT NULL COMMENT '引擎名', - `engine_description` varchar(255) DEFAULT NULL COMMENT '引擎表述', - `version_id` int(11) NOT NULL DEFAULT '0' COMMENT '引擎版本id', - `version_code` varchar(255) DEFAULT NULL COMMENT '引擎版本code', - `decison_tables_id` int(11) NOT NULL COMMENT '决策表id', - `decison_tables_name` varchar(255) DEFAULT NULL COMMENT '决策表名', - `decison_tables_version_id` int(11) NOT NULL DEFAULT '0' COMMENT '决策表版本id', - `decison_tables_version_code` varchar(255) DEFAULT NULL COMMENT '决策表版本code', - `result` varchar(255) DEFAULT NULL COMMENT '结果', - `result_count` int(11) NOT NULL DEFAULT '0' COMMENT '次数', - `organ_id` int(11) NOT NULL DEFAULT '0' COMMENT '组织id', - `create_user_id` int(11) NOT NULL DEFAULT '0' COMMENT '创建者id', - `update_user_id` int(11) NOT NULL DEFAULT '0' COMMENT '修改者id', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改日期', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - --- ---------------------------- --- Table structure for t_analyse_engine_call --- ---------------------------- -DROP TABLE IF EXISTS `t_analyse_engine_call`; -CREATE TABLE `t_analyse_engine_call` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '引擎调用表主键id', - `call_date` datetime NOT NULL COMMENT '调用时间', - `engine_id` int(11) NOT NULL DEFAULT '0' COMMENT '引擎id', - `engine_name` varchar(255) DEFAULT NULL COMMENT '引擎名', - `engine_description` varchar(255) DEFAULT NULL COMMENT '引擎表述', - `version_id` int(11) NOT NULL DEFAULT '0' COMMENT '引擎版本id', - `version_code` varchar(255) DEFAULT NULL COMMENT '引擎版本code', - `call_count` int(11) NOT NULL DEFAULT '0' COMMENT '调用次数', - `organ_id` int(11) NOT NULL DEFAULT '0' COMMENT '组织id', - `create_user_id` int(11) NOT NULL DEFAULT '0' COMMENT '创建者id', - `update_user_id` int(11) NOT NULL DEFAULT '0' COMMENT '修改者id', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改日期', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=2048 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - --- ---------------------------- --- Table structure for t_analyse_engine_node --- ---------------------------- -DROP TABLE IF EXISTS `t_analyse_engine_node`; -CREATE TABLE `t_analyse_engine_node` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id', - `call_date` datetime NOT NULL COMMENT '调用时间', - `engine_id` int(11) NOT NULL DEFAULT '0' COMMENT '引擎id', - `engine_name` varchar(255) DEFAULT NULL COMMENT '引擎名', - `engine_description` varchar(255) DEFAULT NULL COMMENT '引擎表述', - `version_id` int(11) NOT NULL DEFAULT '0' COMMENT '引擎版本id', - `version_code` varchar(255) DEFAULT NULL COMMENT '引擎版本code', - `node_id` int(11) NOT NULL COMMENT '节点id', - `node_name` varchar(255) DEFAULT NULL COMMENT '节点名', - `pass_count` int(11) NOT NULL DEFAULT '0' COMMENT '经过次数', - `organ_id` int(11) NOT NULL DEFAULT '0' COMMENT '组织id', - `create_user_id` int(11) NOT NULL DEFAULT '0' COMMENT '创建者id', - `update_user_id` int(11) NOT NULL DEFAULT '0' COMMENT '修改者id', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改日期', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - --- ---------------------------- --- Table structure for t_analyse_engine_summary --- ---------------------------- -DROP TABLE IF EXISTS `t_analyse_engine_summary`; -CREATE TABLE `t_analyse_engine_summary` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '引擎概况主键id', - `engine_version_id` int(11) NOT NULL DEFAULT '0' COMMENT '引擎版本id', - `engine_name` varchar(255) DEFAULT NULL COMMENT '引擎名称', - `statistics_dimension` varchar(255) NOT NULL COMMENT '统计维度(1.调用次数 engine_call,2.决策结果 decision_result,3规则命中 rule_hit 4.评分卡 scorecard 5.决策表 decision_tables6.名单库 list_db 7.节点命中 node_hit)', - `statistics_count` int(11) NOT NULL DEFAULT '0' COMMENT '统计数量(截至创建日期的当天的总数)', - `organ_id` int(11) NOT NULL DEFAULT '0' COMMENT '组织id', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=5509 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_analyse_rule --- ---------------------------- -DROP TABLE IF EXISTS `t_analyse_rule`; -CREATE TABLE `t_analyse_rule` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id', - `call_date` datetime NOT NULL COMMENT '调用时间', - `engine_id` int(11) NOT NULL DEFAULT '0' COMMENT '引擎id', - `engine_name` varchar(255) DEFAULT NULL COMMENT '引擎名', - `engine_description` varchar(255) DEFAULT NULL COMMENT '引擎表述', - `version_id` int(11) NOT NULL DEFAULT '0' COMMENT '引擎版本id', - `version_code` varchar(255) DEFAULT NULL COMMENT '引擎版本code', - `rule_id` int(11) NOT NULL COMMENT '规则id', - `rule_name` varchar(255) DEFAULT NULL COMMENT '规则名', - `rule_version_id` int(11) DEFAULT NULL COMMENT '规则版本id', - `rule_version_code` varchar(255) DEFAULT NULL COMMENT '规则版本code', - `hit_count` int(11) NOT NULL DEFAULT '0' COMMENT '命中次数', - `organ_id` int(11) NOT NULL DEFAULT '0' COMMENT '组织id', - `create_user_id` int(11) NOT NULL DEFAULT '0' COMMENT '创建者id', - `update_user_id` int(11) NOT NULL DEFAULT '0' COMMENT '修改者id', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改日期', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - --- ---------------------------- --- Table structure for t_analyse_scorecard --- ---------------------------- -DROP TABLE IF EXISTS `t_analyse_scorecard`; -CREATE TABLE `t_analyse_scorecard` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id', - `call_date` datetime NOT NULL COMMENT '调用时间', - `engine_id` int(11) NOT NULL DEFAULT '0' COMMENT '引擎id', - `engine_name` varchar(255) DEFAULT NULL COMMENT '引擎名', - `engine_description` varchar(255) DEFAULT NULL COMMENT '引擎表述', - `version_id` int(11) NOT NULL DEFAULT '0' COMMENT '引擎版本id', - `version_code` varchar(255) DEFAULT NULL COMMENT '引擎版本code', - `scorecard_id` int(11) NOT NULL COMMENT '评分卡id', - `scorecard_name` varchar(255) DEFAULT NULL COMMENT '评分卡名', - `scorecard_version_id` int(11) NOT NULL DEFAULT '0' COMMENT '评分卡版本id', - `scorecard_version_code` varchar(255) DEFAULT NULL COMMENT '评分卡版本code', - `result` varchar(255) DEFAULT NULL COMMENT '结果', - `result_count` int(11) NOT NULL DEFAULT '0' COMMENT '次数', - `organ_id` int(11) NOT NULL DEFAULT '0' COMMENT '组织id', - `create_user_id` int(11) NOT NULL DEFAULT '0' COMMENT '创建者id', - `update_user_id` int(11) NOT NULL DEFAULT '0' COMMENT '修改者id', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改日期', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - --- ---------------------------- --- Table structure for t_approval --- ---------------------------- -DROP TABLE IF EXISTS `t_approval`; -CREATE TABLE `t_approval` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键', - `apply_type` varchar(255) DEFAULT NULL, - `create_user_id` int(11) DEFAULT NULL COMMENT '创建人id', - `create_user_name` varchar(255) DEFAULT NULL COMMENT '创建人名称', - `update_user_id` int(11) DEFAULT NULL COMMENT '修改人id', - `update_user_name` varchar(255) DEFAULT NULL COMMENT '修改人名称', - `organ_id` int(11) DEFAULT NULL COMMENT '组织id', - `apply_status` smallint(1) NOT NULL DEFAULT '0' COMMENT '申请单的状态:(-1取消申请。 0 待审批,1 审批通过,2 审批不通过)', - `status` int(11) NOT NULL DEFAULT '1' COMMENT '状态:0冻结 -1 删除 1正常', - `approval_user_id` int(11) DEFAULT NULL COMMENT '审批人id', - `approval_user_name` varchar(255) DEFAULT NULL COMMENT '审批人名称', - `approval_time` datetime DEFAULT NULL COMMENT '审批时间', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `apply_detail` json DEFAULT NULL COMMENT '申请详情', - `apply_desc` json DEFAULT NULL COMMENT '申请描述', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=39 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_approval_config --- ---------------------------- -DROP TABLE IF EXISTS `t_approval_config`; -CREATE TABLE `t_approval_config` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键', - `approval_type` varchar(255) DEFAULT NULL COMMENT '审批类型', - `approval_name` varchar(255) DEFAULT NULL COMMENT '审批名称', - `approval_desc` varchar(255) DEFAULT NULL COMMENT '描述', - `approval_status` int(1) DEFAULT NULL COMMENT '审批状态(1开启,0关闭,-1删除)', - `organ_id` int(11) DEFAULT NULL COMMENT '组织id', - `create_user_id` int(11) DEFAULT NULL COMMENT '创建人id', - `update_user_id` int(11) DEFAULT NULL COMMENT '修改人id', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`), - UNIQUE KEY `organ_approval_type` (`organ_id`,`approval_type`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=36 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_app_template --- ---------------------------- -DROP TABLE IF EXISTS `t_app_template`; -CREATE TABLE `t_app_template` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', - `template_name` varchar(100) NOT NULL COMMENT '模板名称', - `template_code` varchar(100) NOT NULL COMMENT '模板编码', - `push_subject` varchar(200) NOT NULL COMMENT '推送标题', - `push_content` varchar(500) NOT NULL COMMENT '推送内容', - `click_action` int(2) NOT NULL DEFAULT '1' COMMENT '点击推送后动作 1:唤醒应用,2:打开指定链接,3:自定义跳转', - `jump_url` varchar(200) DEFAULT NULL COMMENT '点击推送后跳转地址', - `status` int(2) NOT NULL DEFAULT '1' COMMENT '状态 0:无效,1:有效', - `creator` int(11) DEFAULT NULL COMMENT '创建人', - `modifier` int(11) DEFAULT NULL COMMENT '修改人', - `organ_id` int(11) NOT NULL COMMENT '组织编号', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`), - UNIQUE KEY `template_code` (`template_code`) -) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COMMENT='APP推送模板表'; - --- ---------------------------- --- Table structure for t_base_rule --- ---------------------------- -DROP TABLE IF EXISTS `t_base_rule`; -CREATE TABLE `t_base_rule` ( - `id` bigint(20) NOT NULL COMMENT '主键id', - `rule_type` enum('strategy_complex_rule','strategy_decision_tables','strategy_decision_tree','strategy_custom_output','engine_node_group','engine_node_decision_operation','engine_terminal_condition','strategy_tag_condition','data_flow_engine') NOT NULL COMMENT '规则类型:', - `organ_id` int(11) NOT NULL COMMENT '组织id', - `create_user_id` int(11) NOT NULL COMMENT '创建人id', - `update_user_id` int(11) DEFAULT NULL COMMENT '修改人id', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_base_rule_condition --- ---------------------------- -DROP TABLE IF EXISTS `t_base_rule_condition`; -CREATE TABLE `t_base_rule_condition` ( - `id` bigint(20) NOT NULL COMMENT '自增主键', - `rule_id` bigint(20) NOT NULL COMMENT '规则id', - `cond_type` int(11) NOT NULL COMMENT '规则节点的类型:1-关系节点,2-表达式节点 3-for表达式 4-for的结果项 5条件组 6条件组的结果条件', - `logic` enum('leaf','&&','||','for','condGroup','') DEFAULT NULL COMMENT '逻辑符号:leaf、&&、||、for、condGroup', - `left_type` int(2) DEFAULT NULL COMMENT '条件左边值的类型', - `left_id` int(11) DEFAULT NULL COMMENT '左边条件引用的指标id', - `left_value` varchar(255) DEFAULT NULL COMMENT '左边的值', - `operator` varchar(255) DEFAULT NULL COMMENT '操作符', - `right_type` int(2) DEFAULT NULL COMMENT '右边值类型', - `right_id` int(11) DEFAULT NULL COMMENT '右边值引用的指标id', - `right_value` varchar(255) DEFAULT NULL COMMENT '右边的值', - `parent_id` bigint(20) NOT NULL COMMENT '父id', - PRIMARY KEY (`id`), - KEY `rule_id_idx` (`rule_id`) USING BTREE COMMENT '规则id' -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_business_event_log --- ---------------------------- -DROP TABLE IF EXISTS `t_business_event_log`; -CREATE TABLE `t_business_event_log` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', - `batch_no` varchar(100) NOT NULL COMMENT '批次号', - `event_request_id` varchar(100) NOT NULL COMMENT '事件流水id', - `event_id` varchar(100) NOT NULL COMMENT '事件ID', - `event_name` varchar(100) NOT NULL COMMENT '事件名称', - `template_id` varchar(100) NOT NULL COMMENT '模板ID', - `template_name` varchar(100) NOT NULL COMMENT '模板名称', - `business_name` varchar(100) NOT NULL COMMENT '业务类型名称', - `business_code` varchar(100) NOT NULL COMMENT '业务类型编码', - `business_child_name` varchar(100) NOT NULL COMMENT '业务子类型名称', - `business_child_code` varchar(100) NOT NULL COMMENT '业务子类型编码', - `customer_name` varchar(100) DEFAULT NULL COMMENT '客户姓名', - `customer_mobile` varchar(100) NOT NULL COMMENT '客户手机号', - `policy_no` varchar(100) DEFAULT NULL COMMENT '保单号', - `send_platform` varchar(100) DEFAULT NULL COMMENT '发送平台', - `call_start_time` datetime NOT NULL COMMENT '规则执行开始时间', - `call_end_time` datetime NOT NULL COMMENT '规则执行结束时间', - `call_time` int(10) NOT NULL COMMENT '耗时,单位毫秒', - `call_status` int(2) NOT NULL DEFAULT '1' COMMENT '执行结果 1:成功,0:失败', - `rule_log_ids` varchar(200) DEFAULT NULL COMMENT '规则执行记录表ids', - `organ_id` int(11) NOT NULL COMMENT '企业编号', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=464 DEFAULT CHARSET=utf8 COMMENT='事件调用记录'; - --- ---------------------------- --- Table structure for t_business_rule_log --- ---------------------------- -DROP TABLE IF EXISTS `t_business_rule_log`; -CREATE TABLE `t_business_rule_log` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', - `batch_no` varchar(100) NOT NULL COMMENT '批次号', - `rule_name` varchar(100) NOT NULL COMMENT '规则名称', - `rule_code` varchar(100) NOT NULL COMMENT '规则编号', - `rule_type` varchar(100) NOT NULL COMMENT '规则类型', - `business_name` varchar(100) NOT NULL COMMENT '业务类型名称', - `business_code` varchar(100) NOT NULL COMMENT '业务类型编码', - `business_child_name` varchar(100) NOT NULL COMMENT '业务子类型名称', - `business_child_code` varchar(100) NOT NULL COMMENT '业务子类型编码', - `rule_result` varchar(1000) DEFAULT NULL COMMENT '规则输出结果', - `rule_description` varchar(500) DEFAULT NULL COMMENT '规则描述', - `execute_switch` int(2) DEFAULT NULL COMMENT '执行开关 1:开启,0:关闭', - `valid_start_time` datetime DEFAULT NULL COMMENT '执行有效期,开始时间', - `valid_end_time` datetime DEFAULT NULL COMMENT '执行有效期,结束时间', - `organ_id` int(11) NOT NULL COMMENT '企业编号', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=301 DEFAULT CHARSET=utf8 COMMENT='规则执行记录'; - --- ---------------------------- --- Table structure for t_business_rule_rel --- ---------------------------- -DROP TABLE IF EXISTS `t_business_rule_rel`; -CREATE TABLE `t_business_rule_rel` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', - `business_name` varchar(100) NOT NULL COMMENT '业务类型名称', - `business_code` varchar(100) NOT NULL COMMENT '业务类型编码', - `business_child_name` varchar(100) NOT NULL COMMENT '业务子类型名称', - `business_child_code` varchar(100) NOT NULL COMMENT '业务子类型编码', - `send_type` varchar(50) NOT NULL COMMENT '发送方式:自动/手动', - `is_unsubscribe` varchar(50) NOT NULL COMMENT '是否取消订阅', - `event_type` varchar(50) NOT NULL COMMENT '事件类型:通知/待办/系统类', - `backlog` varchar(200) DEFAULT NULL COMMENT '待办任务', - `is_manual_intervention` varchar(50) DEFAULT NULL COMMENT '是否需人工干预', - `rule_info` varchar(2000) DEFAULT NULL COMMENT '5大类规则信息', - `status` int(2) NOT NULL DEFAULT '1' COMMENT '状态 0:无效,1:有效', - `creator` int(11) DEFAULT NULL COMMENT '创建人', - `modifier` int(11) DEFAULT NULL COMMENT '修改人', - `organ_id` int(11) NOT NULL COMMENT '企业编号', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8 COMMENT='业务类型与规则关联表'; - --- ---------------------------- --- Table structure for t_data_clean --- ---------------------------- -DROP TABLE IF EXISTS `t_data_clean`; -CREATE TABLE `t_data_clean` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', - `name` varchar(200) DEFAULT NULL COMMENT '集合操作名称', - `code` varchar(200) DEFAULT NULL COMMENT '集合操作代码', - `description` text COMMENT '集合操作描述', - `op_type` int(4) DEFAULT NULL COMMENT '集合操作类型:1 集合规则,2 集合处理', - `folder_id` int(11) NOT NULL DEFAULT '0' COMMENT '文件夹id', - `status` int(4) NOT NULL DEFAULT '1' COMMENT '状态:0 停用 1 启用 -1删除(默认启用)', - `start_time` datetime DEFAULT NULL COMMENT '有效期开始时间', - `end_time` datetime DEFAULT NULL COMMENT '有效期结束时间', - `create_user_id` int(11) NOT NULL COMMENT '创建者id', - `update_user_id` int(11) DEFAULT NULL COMMENT '修改者id', - `organ_id` int(11) NOT NULL COMMENT '组织id', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=54 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_data_clean_block --- ---------------------------- -DROP TABLE IF EXISTS `t_data_clean_block`; -CREATE TABLE `t_data_clean_block` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id', - `data_clean_version_id` int(11) DEFAULT NULL COMMENT '版本id', - `name` varchar(100) DEFAULT NULL COMMENT '条件区域名称', - `op_type` varchar(50) DEFAULT NULL COMMENT '选择来源:original原数据,data_op原数据操作,handle_collection选择集合', - `handle_collection` varchar(100) DEFAULT NULL COMMENT '处理集合', - `group_fields` text COMMENT '分组字段', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=283 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_data_clean_condition --- ---------------------------- -DROP TABLE IF EXISTS `t_data_clean_condition`; -CREATE TABLE `t_data_clean_condition` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `data_clean_id` int(11) NOT NULL DEFAULT '0' COMMENT '列表操作的id', - `data_clean_version_id` int(11) NOT NULL DEFAULT '0' COMMENT '列表操作版本的id', - `data_clean_block_id` int(11) NOT NULL DEFAULT '0' COMMENT '条件区域块id', - `logical` varchar(10) DEFAULT NULL COMMENT '关系节点的逻辑符号:&&(并关系),||(或关系)', - `op_type` varchar(50) DEFAULT NULL COMMENT '选择来源:original原数据,data_op原数据操作,handle_collection选择集合', - `op_key` varchar(255) DEFAULT NULL COMMENT '计算的参数key{循环中对象的key}', - `operator` varchar(50) DEFAULT NULL COMMENT '表达式节点的操作符', - `variable_type` int(2) DEFAULT NULL COMMENT '变量类型,1常量,2变量 3自定义', - `variable_value` text COMMENT '表达式节点对应字段的限定值', - `parent_id` int(11) DEFAULT '0' COMMENT '父节点的id 此项为0的是根节点', - `condition_type` int(2) NOT NULL COMMENT '规则节点的类型:1-关系节点,2-表达式节点', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=561 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_data_clean_filter_condition --- ---------------------------- -DROP TABLE IF EXISTS `t_data_clean_filter_condition`; -CREATE TABLE `t_data_clean_filter_condition` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `data_clean_id` int(11) NOT NULL DEFAULT '0' COMMENT '列表操作的id', - `data_clean_version_id` int(11) NOT NULL DEFAULT '0' COMMENT '列表操作版本的id', - `data_clean_block_id` int(11) NOT NULL DEFAULT '0' COMMENT '条件区域块id', - `filter_type` varchar(50) DEFAULT NULL COMMENT '条件类型:选择集合处过滤:input、集合处理规则处过滤:result。', - `logical` varchar(10) DEFAULT NULL COMMENT '关系节点的逻辑符号:&&(并关系),||(或关系)', - `op_type` varchar(50) DEFAULT NULL COMMENT '选择来源:original原数据,data_op原数据操作,handle_collection选择集合', - `op_key` varchar(100) DEFAULT NULL COMMENT '计算的参数key{循环中对象的key}', - `operator` varchar(50) DEFAULT NULL COMMENT '表达式节点的操作符', - `variable_type` int(2) DEFAULT '1' COMMENT '变量类型,1常量,2变量 3自定义', - `variable_value` text COMMENT '表达式节点对应字段的限定值', - `parent_id` int(11) DEFAULT '0' COMMENT '父节点的id 此项为0的是根节点', - `condition_type` int(2) NOT NULL COMMENT '规则节点的类型:1-关系节点,2-表达式节点', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=442 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_data_clean_original_data_op --- ---------------------------- -DROP TABLE IF EXISTS `t_data_clean_original_data_op`; -CREATE TABLE `t_data_clean_original_data_op` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', - `data_clean_version_id` bigint(20) NOT NULL COMMENT '数据清洗的版本id', - `op_type` varchar(20) DEFAULT NULL COMMENT '操作类型:1.首元素:first_element,2.尾元素:last_element,3.迭代处理:iteration ', - `op_field` varchar(100) DEFAULT NULL COMMENT '操作字段:此字段为数据清洗版本中存储的源数据指标内部字段', - `parent_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '父id', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=54 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_data_clean_output --- ---------------------------- -DROP TABLE IF EXISTS `t_data_clean_output`; -CREATE TABLE `t_data_clean_output` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键', - `data_clean_version_id` int(11) NOT NULL DEFAULT '0' COMMENT '列表操作版本id', - `data_clean_condition_id` int(11) NOT NULL DEFAULT '0' COMMENT '列表操作条件根节点id', - `data_clean_block_id` int(11) NOT NULL DEFAULT '0' COMMENT '列表操作块id', - `output_type` int(11) DEFAULT NULL COMMENT '输出类型:1 命中输出,2未命中输出,3默认输出', - `output_key` varchar(200) DEFAULT NULL COMMENT '输出的key', - `op_type` varchar(100) DEFAULT NULL COMMENT '选择来源:original原数据,data_op原数据操作,handle_collection选择集合', - `output_value` text COMMENT '输出的值', - `variable_type` int(11) DEFAULT NULL COMMENT '输出类型: 1.常量 2.变量 3.自定义', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=413 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_data_clean_version --- ---------------------------- -DROP TABLE IF EXISTS `t_data_clean_version`; -CREATE TABLE `t_data_clean_version` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '数据清洗版本表id', - `data_clean_id` int(11) NOT NULL COMMENT '数据清洗id', - `version_code` varchar(50) NOT NULL COMMENT '版本code', - `description` varchar(200) DEFAULT NULL COMMENT '版本描述', - `input_field_en` varchar(200) DEFAULT NULL COMMENT '数据源数组或者map的en', - `input_field_type` varchar(200) DEFAULT NULL COMMENT '数据源类型:map、list', - `status` int(4) NOT NULL DEFAULT '1' COMMENT '状态:-1删除 ,1启用,0停用', - `result_field_en` varchar(255) DEFAULT NULL COMMENT '存放执行结果的变量', - `organ_id` int(11) NOT NULL COMMENT '所属组织id', - `create_user_id` int(20) NOT NULL COMMENT '创建者id', - `update_user_id` int(20) DEFAULT NULL COMMENT '修改者id', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `snapshot` json DEFAULT NULL COMMENT '集合操作版本配置快照', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=72 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_decision_tables --- ---------------------------- -DROP TABLE IF EXISTS `t_decision_tables`; -CREATE TABLE `t_decision_tables` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '决策表id', - `parent_id` int(11) DEFAULT NULL COMMENT '文件夹id', - `name` varchar(100) DEFAULT NULL COMMENT '决策表名称', - `code` varchar(50) DEFAULT NULL COMMENT '决策表代码(英文)', - `description` text COMMENT '决策表描述', - `version` varchar(10) DEFAULT NULL COMMENT '决策表版本', - `status` int(2) DEFAULT '1' COMMENT '决策表状态:0 停用 1 启用 -1删除(默认启用)', - `creator` int(20) DEFAULT NULL COMMENT '决策表创建者', - `modifier` int(20) DEFAULT NULL COMMENT '决策表修改者', - `organ_id` int(11) DEFAULT NULL COMMENT '所属组织id', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `result_field_en` varchar(255) DEFAULT NULL COMMENT '存放执行结果的变量', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_decision_tables_detail --- ---------------------------- -DROP TABLE IF EXISTS `t_decision_tables_detail`; -CREATE TABLE `t_decision_tables_detail` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '详情节点id', - `decision_tables_id` int(11) DEFAULT NULL COMMENT '决策表id', - `version_id` int(11) NOT NULL DEFAULT '0' COMMENT '决策表版本id', - `dimensionality` int(2) DEFAULT NULL COMMENT '条件维度(1-左侧,2-顶部)', - `field_id` int(11) DEFAULT NULL COMMENT '字段id', - `field_en` varchar(50) DEFAULT NULL COMMENT '字段en', - `parent_id` int(11) DEFAULT NULL COMMENT '父节点id', - `logical` varchar(50) DEFAULT NULL COMMENT '逻辑关系,如(&&,||)', - `type` int(2) DEFAULT NULL COMMENT '节点类型:1-普通节点,2-叶子节点', - `index_value` int(11) DEFAULT NULL COMMENT '所在维度的值,不能为负数', - `content` text COMMENT '执行串', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=5535 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_decision_tables_detail_condition --- ---------------------------- -DROP TABLE IF EXISTS `t_decision_tables_detail_condition`; -CREATE TABLE `t_decision_tables_detail_condition` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '决策表详情条件id', - `detail_id` int(11) DEFAULT NULL COMMENT '详情id', - `operator` varchar(50) DEFAULT NULL COMMENT '操作符', - `variable_type` int(2) DEFAULT NULL COMMENT '变量类型:1常量,2变量', - `field_value` longtext NOT NULL, - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=6856 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_decision_tables_result --- ---------------------------- -DROP TABLE IF EXISTS `t_decision_tables_result`; -CREATE TABLE `t_decision_tables_result` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '决策表结果集id', - `decision_tables_id` int(11) DEFAULT NULL COMMENT '决策表id', - `version_id` int(11) NOT NULL DEFAULT '0' COMMENT '决策表版本id', - `rows` int(11) DEFAULT NULL COMMENT '行数', - `columns` int(11) DEFAULT NULL COMMENT '列数', - `result_value` longtext COMMENT '结果集二维数组', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=258 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_decision_tables_version --- ---------------------------- -DROP TABLE IF EXISTS `t_decision_tables_version`; -CREATE TABLE `t_decision_tables_version` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '版本主鍵id', - `decision_tables_id` int(11) NOT NULL COMMENT '决策表id', - `version_code` varchar(255) NOT NULL COMMENT '版本号', - `description` varchar(255) NOT NULL COMMENT '版本描述', - `status` int(4) NOT NULL DEFAULT '1' COMMENT '状态:-1删除 ,1启用,0停用', - `result_field_en` varchar(255) DEFAULT NULL COMMENT '存放执行结果的变量', - `organ_id` int(11) NOT NULL DEFAULT '0' COMMENT '所属组织id', - `create_user_id` int(20) NOT NULL DEFAULT '0' COMMENT '创建者id', - `update_user_id` int(20) NOT NULL DEFAULT '0' COMMENT '修改者id', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `snapshot` json DEFAULT NULL COMMENT '决策表版本配置快照', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=78 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - --- ---------------------------- --- Table structure for t_decision_tree --- ---------------------------- -DROP TABLE IF EXISTS `t_decision_tree`; -CREATE TABLE `t_decision_tree` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '决策树主表id', - `code` varchar(255) NOT NULL COMMENT '决策树code', - `name` varchar(255) NOT NULL COMMENT '决策树名称', - `description` varchar(255) DEFAULT NULL COMMENT '决策树描述', - `folder_id` int(11) NOT NULL DEFAULT '0' COMMENT '文件夹id', - `status` int(4) NOT NULL DEFAULT '1' COMMENT '状态:0 停用 1 启用 -1删除(默认启用)', - `create_user_id` int(11) NOT NULL COMMENT '创建者id', - `update_user_id` int(11) DEFAULT NULL COMMENT '修改者id', - `organ_id` int(11) NOT NULL COMMENT '组织id', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_decision_tree_detail --- ---------------------------- -DROP TABLE IF EXISTS `t_decision_tree_detail`; -CREATE TABLE `t_decision_tree_detail` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '决策树详情id', - `decision_tree_version_id` int(11) DEFAULT NULL COMMENT '决策表id', - `field_id` int(11) DEFAULT NULL COMMENT '字段id', - `field_en` varchar(50) DEFAULT NULL COMMENT '字段en', - `parent_id` int(11) NOT NULL DEFAULT '0' COMMENT '父节点id', - `logical` varchar(50) DEFAULT NULL COMMENT '逻辑关系,如(&&,||)', - `node_type` int(2) DEFAULT NULL COMMENT '节点类型:1-普通节点,2-叶子节点', - `result_value` text COMMENT '叶子节点对应决策结果值', - `variable_type` int(4) NOT NULL COMMENT '结果值1、常量 2、变量 3、自定义', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=248 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - --- ---------------------------- --- Table structure for t_decision_tree_detail_condition --- ---------------------------- -DROP TABLE IF EXISTS `t_decision_tree_detail_condition`; -CREATE TABLE `t_decision_tree_detail_condition` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '决策树详情条件id', - `detail_id` int(11) NOT NULL COMMENT '详情id', - `operator` varchar(50) NOT NULL COMMENT '操作符', - `variable_type` int(2) NOT NULL DEFAULT '1' COMMENT '变量类型:1常量,2变量', - `field_value` text NOT NULL COMMENT '变量值(常量为值,变量为字段en)', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=296 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_decision_tree_version --- ---------------------------- -DROP TABLE IF EXISTS `t_decision_tree_version`; -CREATE TABLE `t_decision_tree_version` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '决策树版本表id', - `decision_tree_id` int(11) NOT NULL COMMENT '决策树id', - `version_code` varchar(255) NOT NULL COMMENT '版本code', - `description` varchar(255) DEFAULT NULL COMMENT '版本描述', - `status` int(4) NOT NULL DEFAULT '1' COMMENT '状态:-1删除 ,1启用,0停用', - `result_field_en` varchar(255) DEFAULT NULL COMMENT '存放执行结果的变量', - `organ_id` int(11) NOT NULL COMMENT '所属组织id', - `create_user_id` int(20) NOT NULL COMMENT '创建者id', - `update_user_id` int(20) DEFAULT NULL COMMENT '修改者id', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `snapshot` json DEFAULT NULL COMMENT '决策树版本配置快照', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_dictionary --- ---------------------------- -DROP TABLE IF EXISTS `t_dictionary`; -CREATE TABLE `t_dictionary` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键', - `dict_key` varchar(200) NOT NULL COMMENT '字典key', - `dict_value` text COMMENT '字典value', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`), - UNIQUE KEY `key_idx` (`dict_key`) USING BTREE COMMENT '字典key唯一' -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_email_template --- ---------------------------- -DROP TABLE IF EXISTS `t_email_template`; -CREATE TABLE `t_email_template` ( - `template_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', - `subject` varchar(100) NOT NULL COMMENT '标题', - `nid` varchar(100) NOT NULL DEFAULT '' COMMENT '模板唯一的nid', - `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '模板状态,1:有效、0:无效', - `address` varchar(200) NOT NULL COMMENT '收件地址', - `content` text NOT NULL COMMENT '模板内容', - `use_type` tinyint(2) NOT NULL DEFAULT '1' COMMENT '发送类型,1:通知', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - PRIMARY KEY (`template_id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='邮件模板'; - --- ---------------------------- --- Table structure for t_engine --- ---------------------------- -DROP TABLE IF EXISTS `t_engine`; -CREATE TABLE `t_engine` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', - `code` varchar(64) DEFAULT NULL COMMENT '编号', - `name` varchar(64) DEFAULT NULL COMMENT '名称', - `description` varchar(200) DEFAULT NULL COMMENT '描述', - `engine_type` varchar(50) DEFAULT 'rule_engine' COMMENT '引擎类型:', - `status` int(11) DEFAULT NULL COMMENT '状态:0被删除1正常使用', - `create_datetime` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_datetime` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `creator` int(11) DEFAULT NULL COMMENT '创建者', - `organ_id` int(11) DEFAULT NULL COMMENT '企业编号', - `user_id` int(11) DEFAULT NULL COMMENT '修改人', - `callback_type` int(4) DEFAULT '1' COMMENT '调用方式 1:同步,2:异步', - `callback_url` varchar(200) DEFAULT NULL COMMENT '回调地址', - `exception_callback_url` varchar(200) DEFAULT NULL COMMENT '异常回调地址', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=358 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - --- ---------------------------- --- Table structure for t_engine_node --- ---------------------------- -DROP TABLE IF EXISTS `t_engine_node`; -CREATE TABLE `t_engine_node` ( - `node_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '节点信息编号', - `version_id` int(11) DEFAULT NULL COMMENT '版本编号', - `node_name` varchar(100) NOT NULL COMMENT '节点名称', - `node_code` varchar(100) NOT NULL COMMENT '节点代号', - `node_order` int(11) DEFAULT NULL COMMENT '节点顺序', - `node_type` int(11) DEFAULT NULL COMMENT '节点类型', - `node_json` longtext COMMENT '节点信息', - `node_x` decimal(7,2) DEFAULT NULL COMMENT '节点横坐标', - `node_y` decimal(7,2) DEFAULT NULL COMMENT '节点纵坐标', - `node_script` text COMMENT '节点脚本', - `next_nodes` longtext COMMENT '下个节点(可能是多个)', - `params` longtext COMMENT '节点用到的参数列表', - `parent_id` varchar(100) DEFAULT NULL COMMENT '上一个节点的id,多个节点逗号分隔', - `snapshot` json DEFAULT NULL COMMENT '节点配置快照', - PRIMARY KEY (`node_id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=4955 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='存储版本模型的信息包括(使用的参数,节点的位置,节点的执行逻辑)'; - --- ---------------------------- --- Table structure for t_engine_version --- ---------------------------- -DROP TABLE IF EXISTS `t_engine_version`; -CREATE TABLE `t_engine_version` ( - `version_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '版本编号', - `engine_id` int(11) DEFAULT NULL COMMENT '引擎编号', - `engine_type` varchar(50) DEFAULT NULL COMMENT '引擎类型', - `version` int(11) NOT NULL COMMENT '版本', - `sub_version` int(5) DEFAULT NULL COMMENT '子版本', - `boot_state` smallint(1) NOT NULL COMMENT '是否部署(0:未部署1:正在运行,2申请部署)', - `status` smallint(1) DEFAULT NULL COMMENT '是否删除(0:在回收站中,可恢复,1:正常,2彻底删除)', - `layout` smallint(1) DEFAULT NULL COMMENT '布局方式(1,2,预留通用布局方式,0自定义布局)', - `user_id` int(11) DEFAULT NULL COMMENT '创建者', - `create_time` varchar(100) DEFAULT NULL COMMENT '创建时间', - `latest_user` int(11) DEFAULT NULL COMMENT '最新修改者', - `latest_time` varchar(100) DEFAULT NULL COMMENT '最后修改时间', - PRIMARY KEY (`version_id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=679 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='不同场景下的多个模型版本'; - --- ---------------------------- --- Table structure for t_engine_version_content --- ---------------------------- -DROP TABLE IF EXISTS `t_engine_version_content`; -CREATE TABLE `t_engine_version_content` ( - `engine_version_id` int(11) NOT NULL COMMENT '引擎版本id', - `engine_type` varchar(50) DEFAULT NULL COMMENT '引擎类型', - `engine_content` text COMMENT '引擎内容', - `engine_script` text COMMENT '引擎执行内容', - `create_user_id` int(11) DEFAULT NULL COMMENT '创建人id', - `update_user_id` int(11) DEFAULT NULL COMMENT '修改人id', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`engine_version_id`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_field --- ---------------------------- -DROP TABLE IF EXISTS `t_field`; -CREATE TABLE `t_field` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '字段编号', - `field_en` varchar(100) NOT NULL DEFAULT '' COMMENT '字段英文名', - `field_cn` varchar(100) NOT NULL COMMENT '字段中文名', - `field_typeid` int(11) NOT NULL COMMENT '字段类型编号,来源t_fieldtype表主键', - `value_type` int(4) DEFAULT NULL COMMENT '字段存值类型,待选(0),数值型(1),字符型(2),枚举型(3),小数型(4),原数组形(5),json形(6)', - `value_scope` varchar(255) DEFAULT NULL COMMENT '字段约束范围', - `is_derivative` int(4) NOT NULL DEFAULT '0' COMMENT '是否衍生字段,0代表不是,1代表是,默认不是(0)', - `is_output` int(4) NOT NULL DEFAULT '0' COMMENT '是否输出字段,0代表不是,1代表是,默认不是(0)', - `is_common` int(4) NOT NULL DEFAULT '0' COMMENT '是否组织定义的通用字段,0代表不是,1代表是,默认不是(0)', - `formula` text COMMENT '公式', - `formula_show` text COMMENT '公式回显信息存值', - `used_fieldid` varchar(200) DEFAULT NULL COMMENT '该衍生字段引用的字段id,逗号分割', - `orig_fieldid` varchar(200) DEFAULT NULL COMMENT '衍生字段用到的所有原生字段编号,逗号分割', - `author` int(11) NOT NULL COMMENT '创建人', - `organ_id` int(11) DEFAULT NULL COMMENT '组织id', - `created` datetime NOT NULL COMMENT '创建时间', - `is_use_sql` tinyint(1) DEFAULT '0' COMMENT '是否使用sql', - `data_source_id` int(11) DEFAULT NULL COMMENT '数据源id', - `sql_statement` text COMMENT 'sql语句', - `sql_variable` varchar(200) DEFAULT NULL COMMENT 'sql变量配置', - `is_interface` tinyint(1) DEFAULT '0' COMMENT '是否使用接口', - `interface_id` int(11) DEFAULT NULL COMMENT '接口id', - `interface_parse_field` varchar(100) DEFAULT NULL COMMENT '接口指标解析字段', - `json_value` longtext COMMENT 'json类型对应的json值', - `dict_variable` text COMMENT '字典变量如:日期字符串', - `mq_source_id` int(11) DEFAULT NULL COMMENT '消息队列源id', - `source_type` int(11) DEFAULT '1' COMMENT '指标的类型:(默认)1基础类型,2sql类型,3衍生类型,4.接口 5.常量指标,6实时指标', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=1157 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='用户字段表'; - --- ---------------------------- --- Table structure for t_field_call_log --- ---------------------------- -DROP TABLE IF EXISTS `t_field_call_log`; -CREATE TABLE `t_field_call_log` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键', - `field_id` int(11) NOT NULL COMMENT '指标id', - `field_type` enum('basics','const','database','interface','derive') DEFAULT NULL COMMENT '指标类型', - `source_type` varchar(20) DEFAULT NULL COMMENT '数据源类型 mysql、redis、interface', - `source_id` int(11) DEFAULT NULL COMMENT '数据源id', - `input_param` text COMMENT '入参', - `field_value` text COMMENT '获取到的指标值', - `duration` int(11) NOT NULL COMMENT '消耗时长,单位:毫秒', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`), - KEY `field_idx` (`field_id`,`create_time`) USING BTREE COMMENT '指标id索引' -) ENGINE=InnoDB AUTO_INCREMENT=43 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_field_condition --- ---------------------------- -DROP TABLE IF EXISTS `t_field_condition`; -CREATE TABLE `t_field_condition` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '条件编号', - `field_id` int(11) NOT NULL COMMENT '字段字段编号', - `condition_value` varchar(100) NOT NULL COMMENT '字段条件值', - `content` text NOT NULL COMMENT '字段条件区域设置json格式', - `cond_field_id` int(11) DEFAULT NULL, - `cond_field_operator` varchar(100) DEFAULT NULL, - `cond_field_value` varchar(100) DEFAULT NULL, - `cond_field_logical` varchar(100) DEFAULT NULL, - `created` datetime NOT NULL COMMENT '创建时间', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='用户字段条件区域设置表'; - --- ---------------------------- --- Table structure for t_field_data_source --- ---------------------------- -DROP TABLE IF EXISTS `t_field_data_source`; -CREATE TABLE `t_field_data_source` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', - `name` varchar(100) NOT NULL COMMENT '数据库连接名称', - `type` varchar(50) NOT NULL DEFAULT 'MySQL' COMMENT '数据源类型:MySQL、Oracle、SQLServer、Hive、Spark、Redis', - `url` varchar(200) DEFAULT NULL COMMENT '连接地址', - `host` varchar(200) DEFAULT NULL COMMENT '数据库地址', - `user_name` varchar(100) DEFAULT NULL COMMENT '用户名', - `password` varchar(100) DEFAULT NULL COMMENT '密码', - `port` varchar(100) DEFAULT NULL COMMENT '端口', - `db_name` varchar(100) DEFAULT NULL COMMENT '数据库名称', - `spark_home` varchar(200) DEFAULT NULL COMMENT 'spark路径', - `app_name` varchar(200) DEFAULT NULL COMMENT 'spark应用程序的名称', - `master_url` varchar(200) DEFAULT NULL COMMENT 'spark地址', - `status` int(2) NOT NULL DEFAULT '1' COMMENT '状态 0:无效,1:有效', - `creator` int(11) DEFAULT NULL COMMENT '创建人', - `modifier` int(11) DEFAULT NULL COMMENT '修改人', - `organ_id` int(11) NOT NULL COMMENT '企业编号', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8 COMMENT='指标数据源表'; - --- ---------------------------- --- Table structure for t_field_interface --- ---------------------------- -DROP TABLE IF EXISTS `t_field_interface`; -CREATE TABLE `t_field_interface` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '接口id', - `name` varchar(20) DEFAULT NULL COMMENT '接口名称', - `url` varchar(200) DEFAULT NULL COMMENT '请求地址', - `method` char(10) DEFAULT NULL COMMENT '请求方法', - `request_headers` varchar(200) DEFAULT NULL COMMENT '请求体类型', - `request_body` text COMMENT '请求参数体', - `bind_param` text COMMENT '绑定参数', - `response_body` text COMMENT '请求响应体', - `creator` int(11) NOT NULL COMMENT '创建者id', - `modifier` int(11) DEFAULT NULL COMMENT '修改者id', - `organ_id` int(11) DEFAULT NULL COMMENT '企业编号', - `status` int(11) DEFAULT NULL COMMENT '请求状态', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `request_type` varchar(20) DEFAULT NULL COMMENT '请求体类型', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_field_mq_source --- ---------------------------- -DROP TABLE IF EXISTS `t_field_mq_source`; -CREATE TABLE `t_field_mq_source` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键', - `name` varchar(100) NOT NULL COMMENT '消息队列连接名称', - `type` varchar(50) NOT NULL DEFAULT 'kafka' COMMENT '消息队列类型:kafka', - `server_addrs` varchar(200) DEFAULT NULL COMMENT '连接地址', - `topic` varchar(200) DEFAULT NULL COMMENT '数据库地址', - `group_id` varchar(100) DEFAULT NULL COMMENT '用户名', - `auto_offset_reset` varchar(100) DEFAULT 'earliest' COMMENT 'offset设置:earliest,latest,none', - `enable_auto_commit` tinyint(1) DEFAULT '1' COMMENT '自动提交0:false 1:true', - `timeout` int(11) DEFAULT '20000' COMMENT '超时时间', - `auto_commit_interval` int(11) DEFAULT '100' COMMENT '自动提交延时', - `concurrency` int(2) DEFAULT '1' COMMENT '消费线程数', - `key_deserializer` varchar(200) DEFAULT 'org.apache.kafka.common.serialization.StringDeserializer' COMMENT 'key解析器默认:StringDeserializer', - `value_deserializer` varchar(200) DEFAULT 'org.apache.kafka.common.serialization.StringDeserializer' COMMENT 'value解码器默认:StringDeserializer', - `message_body` text COMMENT '消息体类型', - `status` int(2) NOT NULL DEFAULT '1' COMMENT '状态 0:无效,1:有效,-1删除', - `creator` int(11) DEFAULT NULL COMMENT '创建人', - `modifier` int(11) DEFAULT NULL COMMENT '修改人', - `organ_id` int(11) NOT NULL COMMENT '企业编号', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_field_type --- ---------------------------- -DROP TABLE IF EXISTS `t_field_type`; -CREATE TABLE `t_field_type` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '字段类型编号', - `field_type` varchar(100) NOT NULL COMMENT '字段类型名', - `parent_id` int(11) NOT NULL DEFAULT '0' COMMENT '父节点编号', - `is_common` int(4) NOT NULL DEFAULT '0' COMMENT '是否组织定义的通用字段类型', - `type` int(4) DEFAULT '1' COMMENT '指标的类型:(默认)1基础类型,2sql类型,3衍生类型,4.接口 5.常量指标', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=430 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='字段类型表'; - --- ---------------------------- --- Table structure for t_field_type_user_rel --- ---------------------------- -DROP TABLE IF EXISTS `t_field_type_user_rel`; -CREATE TABLE `t_field_type_user_rel` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `field_typeid` int(11) NOT NULL COMMENT '字段类型编号', - `organ_id` int(11) NOT NULL COMMENT '归属的组织编号', - `engine_id` int(11) DEFAULT NULL COMMENT '引擎表主键id,用来与引擎绑定,该字段为空代表组织内通用字段', - `status` int(4) NOT NULL DEFAULT '1' COMMENT '启用、删除标志,启用用1表示,删除用-1表示,默认启用', - `user_id` int(11) NOT NULL COMMENT '创建该字段类型的用户编号', - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '该字段分类的创建时间', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=3006 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='字段类型表'; - --- ---------------------------- --- Table structure for t_field_user_rel --- ---------------------------- -DROP TABLE IF EXISTS `t_field_user_rel`; -CREATE TABLE `t_field_user_rel` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户字段映射关系表主键', - `field_id` int(11) NOT NULL COMMENT '字段编号', - `organ_id` int(11) DEFAULT NULL COMMENT '归属的组织编号', - `engine_id` int(11) DEFAULT NULL COMMENT '引擎表主键id,用来与引擎绑定,该字段为空代表组织内通用字段', - `user_id` int(11) NOT NULL COMMENT '创建或修改该字段的用户编号', - `status` int(4) NOT NULL DEFAULT '1' COMMENT '启用停用删除标志,启用用1表示,停用用0表示,删除用-1表示,默认启用', - `created` datetime NOT NULL COMMENT '创建时间', - `updated` datetime NOT NULL COMMENT '更新时间', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=10767 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='用户字段关联关系表'; - --- ---------------------------- --- Table structure for t_knowledge_tree --- ---------------------------- -DROP TABLE IF EXISTS `t_knowledge_tree`; -CREATE TABLE `t_knowledge_tree` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', - `name` varchar(100) DEFAULT NULL COMMENT '目录名称', - `parent_id` int(11) DEFAULT NULL COMMENT '父节点id', - `user_id` int(11) DEFAULT NULL COMMENT '创建人id', - `organ_id` int(11) DEFAULT NULL COMMENT '组织id', - `engine_id` int(11) DEFAULT NULL COMMENT '引擎id', - `status` int(2) DEFAULT NULL COMMENT '状态 0:停用 ,1:启用 ,-1 :删除', - `type` int(2) DEFAULT NULL COMMENT '目录类型 0 : 系统的目录 1:组织的目录 2: 引擎的目录', - `tree_type` int(2) DEFAULT NULL COMMENT '树形分类:0:基础规则树 1:评分卡的树 2:回收站的树 3:决策表树,4:决策树的树5:复杂规则树,6.名单库,7脚本规则集', - `created` datetime DEFAULT NULL COMMENT '创建时间', - `updated` datetime DEFAULT NULL COMMENT '修改时间', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=1530 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='知识库目录表'; - --- ---------------------------- --- Table structure for t_list_db --- ---------------------------- -DROP TABLE IF EXISTS `t_list_db`; -CREATE TABLE `t_list_db` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '名单库编号', - `list_code` varchar(50) DEFAULT NULL COMMENT '所属文件夹id', - `list_type` varchar(10) NOT NULL COMMENT '名单库区分,用b表示黑名单,w表示白名单,其它待扩展', - `list_name` varchar(100) NOT NULL COMMENT '名单库名称', - `data_source` int(4) DEFAULT NULL COMMENT '数据来源:外部黑(白)名单(1)、内部黑(白)名单(2)、待选(0)', - `list_attr` varchar(100) DEFAULT NULL COMMENT '名单库类型属性,用户输入', - `list_desc` varchar(100) DEFAULT NULL COMMENT '名单库描述', - `table_column` varchar(200) NOT NULL COMMENT '名单库表中列字段,字段id逗号分隔', - `match_type` int(4) DEFAULT NULL COMMENT '检索匹配类型,精确匹配(1),模糊匹配(0)', - `query_type` int(4) DEFAULT NULL COMMENT '查询字段间逻辑,and(1),or(0)', - `query_field` varchar(200) DEFAULT NULL COMMENT '查询主键,字段编号逗号分割', - `organ_id` int(11) DEFAULT NULL COMMENT '归属的组织编号', - `status` int(4) NOT NULL DEFAULT '0' COMMENT '启用(1),停用(0),删除(-1)', - `user_id` int(11) NOT NULL COMMENT '创建该名单的用户编号', - `created` datetime NOT NULL COMMENT '创建时间', - `result_field_en` varchar(255) DEFAULT NULL COMMENT '名单库命中结果的en', - `snapshot` json DEFAULT NULL COMMENT '名单库版本配置快照', - `folder_id` int(11) NOT NULL DEFAULT '0' COMMENT '所属文件夹id', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=159 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='黑白名单库配置记录表'; - --- ---------------------------- --- Table structure for t_list_db_version --- ---------------------------- -DROP TABLE IF EXISTS `t_list_db_version`; -CREATE TABLE `t_list_db_version` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '名单库版本表id', - `list_db_id` int(11) NOT NULL COMMENT '名单库id', - `version_code` varchar(255) DEFAULT NULL COMMENT '版本号', - `description` varchar(255) DEFAULT NULL COMMENT '版本描述', - `status` int(4) NOT NULL DEFAULT '1' COMMENT '状态:-1删除 ,1启用,0停用', - `result_field_en` varchar(255) DEFAULT NULL COMMENT '固定输出的指标en', - `table_column` varchar(200) NOT NULL COMMENT '名单库表中列字段,字段id逗号分隔', - `match_type` int(4) DEFAULT NULL COMMENT '检索匹配类型,精确匹配(1),模糊匹配(0)', - `query_type` int(4) DEFAULT NULL COMMENT '查询字段间逻辑,and(1),or(0)', - `query_field` varchar(200) DEFAULT NULL COMMENT '查询主键,字段编号逗号分割', - `organ_id` int(11) NOT NULL COMMENT '所属组织id', - `create_user_id` int(11) NOT NULL COMMENT '创建者id', - `update_user_id` int(11) DEFAULT NULL COMMENT '修改者id', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `snapshot` json DEFAULT NULL COMMENT '名单库版本配置快照', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - --- ---------------------------- --- Table structure for t_list_operation --- ---------------------------- -DROP TABLE IF EXISTS `t_list_operation`; -CREATE TABLE `t_list_operation` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', - `name` varchar(200) DEFAULT NULL COMMENT '集合操作名称', - `code` varchar(200) DEFAULT NULL COMMENT '集合操作代码', - `description` text COMMENT '集合操作描述', - `op_type` int(4) DEFAULT NULL COMMENT '集合操作类型:1 集合规则,2 集合处理', - `folder_id` int(11) NOT NULL DEFAULT '0' COMMENT '文件夹id', - `status` int(4) NOT NULL DEFAULT '1' COMMENT '状态:0 停用 1 启用 -1删除(默认启用)', - `start_time` datetime DEFAULT NULL COMMENT '有效期开始时间', - `end_time` datetime DEFAULT NULL COMMENT '有效期结束时间', - `create_user_id` int(11) NOT NULL COMMENT '创建者id', - `update_user_id` int(11) DEFAULT NULL COMMENT '修改者id', - `organ_id` int(11) NOT NULL COMMENT '组织id', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=39 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_list_operation_block --- ---------------------------- -DROP TABLE IF EXISTS `t_list_operation_block`; -CREATE TABLE `t_list_operation_block` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id', - `list_op_version_id` int(11) DEFAULT NULL COMMENT '版本id', - `name` varchar(100) DEFAULT NULL COMMENT '条件区域名称', - `group_fields` text COMMENT '分组字段', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=224 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_list_operation_condition --- ---------------------------- -DROP TABLE IF EXISTS `t_list_operation_condition`; -CREATE TABLE `t_list_operation_condition` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `list_op_id` int(11) NOT NULL DEFAULT '0' COMMENT '列表操作的id', - `list_op_version_id` int(11) NOT NULL DEFAULT '0' COMMENT '列表操作版本的id', - `list_op_block_id` int(11) NOT NULL DEFAULT '0' COMMENT '条件区域块id', - `logical` varchar(10) DEFAULT NULL COMMENT '关系节点的逻辑符号:&&(并关系),||(或关系)', - `op_type` varchar(50) DEFAULT NULL COMMENT '计算维度:1 count 2distinct_count 3 max 4min 5avg 6custom', - `op_key` varchar(255) DEFAULT NULL COMMENT '计算的参数key{循环中对象的key}', - `operator` varchar(50) DEFAULT NULL COMMENT '表达式节点的操作符', - `variable_type` int(2) DEFAULT NULL COMMENT '变量类型,1常量,2变量 3自定义', - `variable_value` text COMMENT '表达式节点对应字段的限定值', - `parent_id` int(11) DEFAULT '0' COMMENT '父节点的id 此项为0的是根节点', - `condition_type` int(2) NOT NULL COMMENT '规则节点的类型:1-关系节点,2-表达式节点', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=442 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_list_operation_filter_condition --- ---------------------------- -DROP TABLE IF EXISTS `t_list_operation_filter_condition`; -CREATE TABLE `t_list_operation_filter_condition` ( - `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `list_op_id` int(11) NOT NULL DEFAULT '0' COMMENT '列表操作的id', - `list_op_version_id` int(11) NOT NULL DEFAULT '0' COMMENT '列表操作版本的id', - `list_op_block_id` int(11) NOT NULL DEFAULT '0' COMMENT '条件区域块id', - `logical` varchar(10) DEFAULT NULL COMMENT '关系节点的逻辑符号:&&(并关系),||(或关系)', - `op_type` varchar(50) DEFAULT NULL COMMENT '计算维度:1 count 2distinct_count 3 max 4min 5avg 6custom', - `op_key` varchar(255) DEFAULT NULL COMMENT '计算的参数key{循环中对象的key}', - `operator` varchar(50) DEFAULT NULL COMMENT '表达式节点的操作符', - `variable_type` int(2) DEFAULT '1' COMMENT '变量类型,1常量,2变量 3自定义', - `variable_value` text COMMENT '表达式节点对应字段的限定值', - `parent_id` int(11) DEFAULT '0' COMMENT '父节点的id 此项为0的是根节点', - `condition_type` int(2) NOT NULL COMMENT '规则节点的类型:1-关系节点,2-表达式节点', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=232 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_list_operation_output --- ---------------------------- -DROP TABLE IF EXISTS `t_list_operation_output`; -CREATE TABLE `t_list_operation_output` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键', - `list_op_version_id` int(11) NOT NULL DEFAULT '0' COMMENT '列表操作版本id', - `list_op_condition_id` int(11) NOT NULL DEFAULT '0' COMMENT '列表操作条件根节点id', - `list_op_block_id` int(11) NOT NULL DEFAULT '0' COMMENT '列表操作块id', - `output_type` int(11) DEFAULT NULL COMMENT '输出类型:1 命中输出,2未命中输出,3默认输出', - `output_key` varchar(255) DEFAULT NULL COMMENT '输出的key', - `output_op` varchar(50) DEFAULT NULL COMMENT '输出操作:1 count 2count 去重 3 max 4min 5avg ,6 list_element', - `output_op_key` varchar(255) DEFAULT NULL COMMENT '操作字段', - `output_value` text COMMENT '输出的值', - `variable_type` int(11) DEFAULT NULL COMMENT '输出类型: 1.常量 2.变量 3.自定义', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=361 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_list_operation_version --- ---------------------------- -DROP TABLE IF EXISTS `t_list_operation_version`; -CREATE TABLE `t_list_operation_version` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '集合操作版本表id', - `list_op_id` int(11) NOT NULL COMMENT '集合操作id', - `version_code` varchar(255) NOT NULL COMMENT '版本code', - `description` varchar(255) DEFAULT NULL COMMENT '版本描述', - `input_field_en` varchar(255) DEFAULT NULL COMMENT '数据源数组或者map的en', - `input_field_type` varchar(255) DEFAULT NULL COMMENT '数据源类型:map、list', - `group_fields` varchar(255) DEFAULT NULL COMMENT '分组指标列表,逗号分割的en列表', - `status` int(4) NOT NULL DEFAULT '1' COMMENT '状态:-1删除 ,1启用,0停用', - `result_field_en` varchar(255) DEFAULT NULL COMMENT '存放执行结果的变量', - `organ_id` int(11) NOT NULL COMMENT '所属组织id', - `create_user_id` int(20) NOT NULL COMMENT '创建者id', - `update_user_id` int(20) DEFAULT NULL COMMENT '修改者id', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `snapshot` json DEFAULT NULL COMMENT '集合操作版本配置快照', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=53 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_logger --- ---------------------------- -DROP TABLE IF EXISTS `t_logger`; -CREATE TABLE `t_logger` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', - `op_type` varchar(200) DEFAULT NULL COMMENT '操作类型', - `op_name` varchar(500) DEFAULT NULL COMMENT '操作名称', - `op_user_id` int(11) DEFAULT NULL COMMENT '操作人员id', - `organ_id` int(11) DEFAULT NULL COMMENT '组织id', - `method` varchar(500) DEFAULT NULL COMMENT '方法名', - `request_path` text COMMENT '请求地址', - `request_param` text COMMENT '请求参数', - `response_param` longtext COMMENT '响应参数', - `ip` varchar(200) DEFAULT NULL COMMENT 'ip地址', - `start_time` datetime DEFAULT NULL COMMENT '开始时间', - `end_time` datetime DEFAULT NULL COMMENT '结束时间', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=31583 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - --- ---------------------------- --- Table structure for t_machine_learning_models --- ---------------------------- -DROP TABLE IF EXISTS `t_machine_learning_models`; -CREATE TABLE `t_machine_learning_models` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', - `model_name` varchar(100) NOT NULL COMMENT '模型名称', - `description` varchar(200) DEFAULT NULL COMMENT '描述', - `model_type` varchar(50) NOT NULL DEFAULT 'pmml' COMMENT '模型类型', - `file_name` varchar(100) NOT NULL COMMENT '模型文件名称', - `file_path` varchar(200) NOT NULL COMMENT '模型文件路径', - `model_field` varchar(500) NOT NULL DEFAULT '' COMMENT '模型解析字段', - `mapping_field` varchar(500) NOT NULL DEFAULT '' COMMENT '模型字段对应的系统指标字段', - `status` int(2) NOT NULL DEFAULT '1' COMMENT '状态 0:无效,1:有效', - `creator` int(11) DEFAULT NULL COMMENT '创建人', - `modifier` int(11) DEFAULT NULL COMMENT '修改人', - `organ_id` int(11) NOT NULL COMMENT '企业编号', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `result_field_en` varchar(255) DEFAULT NULL COMMENT '模型执行结果的en', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_marketing_engine_node_date_result --- ---------------------------- -DROP TABLE IF EXISTS `t_marketing_engine_node_date_result`; -CREATE TABLE `t_marketing_engine_node_date_result` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', - `engine_id` int(11) NOT NULL COMMENT '引擎id', - `engine_version_id` int(11) NOT NULL COMMENT '引擎版本id', - `engine_name` varchar(100) NOT NULL COMMENT '引擎名称', - `node_id` int(11) NOT NULL COMMENT '节点id', - `current_date` date NOT NULL COMMENT '当前日期', - `enter_num` int(11) NOT NULL DEFAULT '0' COMMENT '累计进入数', - `touch_num` int(11) NOT NULL DEFAULT '0' COMMENT '累计触发数', - `complete_num` int(11) NOT NULL DEFAULT '0' COMMENT '累计目标完成数', - `complete_rate` float(4,2) NOT NULL DEFAULT '0.00' COMMENT '目标完成率', - `organ_id` int(11) NOT NULL COMMENT '组织编号', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='营销引擎节点当天结果表'; - --- ---------------------------- --- Table structure for t_marketing_engine_node_result --- ---------------------------- -DROP TABLE IF EXISTS `t_marketing_engine_node_result`; -CREATE TABLE `t_marketing_engine_node_result` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', - `engine_id` int(11) NOT NULL COMMENT '引擎id', - `engine_version_id` int(11) NOT NULL COMMENT '引擎版本id', - `engine_name` varchar(100) NOT NULL COMMENT '引擎名称', - `node_id` int(11) NOT NULL COMMENT '节点id', - `enter_num` int(11) NOT NULL DEFAULT '0' COMMENT '累计进入数', - `touch_num` int(11) NOT NULL DEFAULT '0' COMMENT '累计触发数', - `complete_num` int(11) NOT NULL DEFAULT '0' COMMENT '累计目标完成数', - `complete_rate` float(4,2) NOT NULL DEFAULT '0.00' COMMENT '目标完成率', - `organ_id` int(11) NOT NULL COMMENT '组织编号', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='营销引擎节点结果表'; - --- ---------------------------- --- Table structure for t_marketing_engine_result --- ---------------------------- -DROP TABLE IF EXISTS `t_marketing_engine_result`; -CREATE TABLE `t_marketing_engine_result` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', - `engine_id` int(11) NOT NULL COMMENT '引擎id', - `engine_version_id` int(11) NOT NULL COMMENT '引擎版本id', - `engine_name` varchar(100) NOT NULL COMMENT '引擎名称', - `enter_num` int(11) NOT NULL DEFAULT '0' COMMENT '累计进入数', - `touch_num` int(11) NOT NULL DEFAULT '0' COMMENT '累计触发数', - `complete_num` int(11) NOT NULL DEFAULT '0' COMMENT '累计目标完成数', - `complete_rate` float(4,2) NOT NULL DEFAULT '0.00' COMMENT '目标完成率', - `organ_id` int(11) NOT NULL COMMENT '组织编号', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`), - UNIQUE KEY `engine_version_id` (`engine_version_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='营销引擎结果表'; - --- ---------------------------- --- Table structure for t_message_send_record --- ---------------------------- -DROP TABLE IF EXISTS `t_message_send_record`; -CREATE TABLE `t_message_send_record` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', - `touch_type` varchar(30) NOT NULL COMMENT '触达方式 Sms、App、WebHook、WeChat', - `user_id` int(11) NOT NULL COMMENT '触达用户id', - `template_name` varchar(100) NOT NULL COMMENT '模板名称', - `template_code` varchar(100) NOT NULL COMMENT '模板编码', - `send_status` int(2) NOT NULL DEFAULT '0' COMMENT '发送状态 0:未处理,1:已发送,2:发送成功,-1:发送失败', - `send_content` varchar(500) NOT NULL COMMENT '发送内容', - `organ_id` int(11) NOT NULL COMMENT '组织编号', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='消息发送记录表'; - --- ---------------------------- --- Table structure for t_monitor_engine --- ---------------------------- -DROP TABLE IF EXISTS `t_monitor_engine`; -CREATE TABLE `t_monitor_engine` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', - `business_id` varchar(200) DEFAULT NULL COMMENT '业务id', - `monitor_parent_id` varchar(50) NOT NULL COMMENT '执行结果id', - `engine_id` int(11) DEFAULT NULL COMMENT '引擎id', - `engine_name` varchar(200) DEFAULT NULL, - `organ_id` int(11) DEFAULT NULL COMMENT '组织id', - `engine_version_id` int(11) DEFAULT NULL COMMENT '引擎版本id', - `process` varchar(500) DEFAULT NULL COMMENT '决策流执行轨迹', - `snapshot` json DEFAULT NULL COMMENT '决策引擎快照信息', - `input` text COMMENT '入参', - `output` longtext COMMENT '出参', - `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '时间', - PRIMARY KEY (`id`) USING BTREE, - KEY `create_time` (`create_time`) -) ENGINE=InnoDB AUTO_INCREMENT=188 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='决策流监控'; - --- ---------------------------- --- Table structure for t_monitor_node --- ---------------------------- -DROP TABLE IF EXISTS `t_monitor_node`; -CREATE TABLE `t_monitor_node` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', - `business_id` varchar(200) DEFAULT NULL COMMENT '业务id', - `monitor_parent_id` varchar(50) NOT NULL COMMENT '引擎监控id', - `engine_id` int(11) DEFAULT NULL COMMENT '引擎id', - `organ_id` int(11) DEFAULT NULL COMMENT '组织id', - `engine_version_id` int(11) DEFAULT NULL COMMENT '引擎版本id', - `node_id` int(11) DEFAULT NULL COMMENT '节点id', - `node_name` varchar(200) DEFAULT NULL COMMENT '节点名称', - `node_type` varchar(4) DEFAULT NULL COMMENT '节点类型', - `snapshot` json DEFAULT NULL COMMENT '决策引擎快照信息', - `input` text COMMENT '入参', - `output` longtext COMMENT '出参', - `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '时间', - PRIMARY KEY (`id`) USING BTREE, - KEY `create_time` (`create_time`) -) ENGINE=InnoDB AUTO_INCREMENT=266 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='决策流节点层面监控'; - --- ---------------------------- --- Table structure for t_monitor_strategy --- ---------------------------- -DROP TABLE IF EXISTS `t_monitor_strategy`; -CREATE TABLE `t_monitor_strategy` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', - `business_id` varchar(200) DEFAULT NULL COMMENT '业务id', - `monitor_parent_id` varchar(50) NOT NULL COMMENT '引擎监控id', - `engine_id` int(11) DEFAULT NULL COMMENT '引擎id', - `organ_id` int(11) DEFAULT NULL COMMENT '组织id', - `engine_version_id` int(11) DEFAULT NULL COMMENT '引擎版本id', - `node_id` int(11) DEFAULT NULL COMMENT '节点id', - `node_type` varchar(4) DEFAULT NULL COMMENT '节点类型', - `strategy_id` int(11) DEFAULT NULL COMMENT '策略id', - `strategy_name` varchar(200) DEFAULT NULL COMMENT '策略名称', - `strategy_type` varchar(4) DEFAULT NULL COMMENT '策略类型', - `snapshot` json DEFAULT NULL COMMENT '决策引擎快照信息', - `input` longtext COMMENT '入参', - `output` longtext COMMENT '出参', - `result` longtext COMMENT '执行输出结果', - `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '时间', - PRIMARY KEY (`id`) USING BTREE, - KEY `create_time` (`create_time`) -) ENGINE=InnoDB AUTO_INCREMENT=191 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='决策流策略层面监控'; - --- ---------------------------- --- Table structure for t_organization --- ---------------------------- -DROP TABLE IF EXISTS `t_organization`; -CREATE TABLE `t_organization` ( - `organ_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '组织编号', - `name` varchar(100) NOT NULL COMMENT '组织名称', - `code` varchar(100) NOT NULL COMMENT '组织代号', - `email` varchar(100) DEFAULT NULL COMMENT '邮箱', - `telephone` varchar(100) DEFAULT NULL COMMENT '电话', - `status` tinyint(1) DEFAULT '1' COMMENT '0禁用1启用', - `author` varchar(100) DEFAULT NULL COMMENT '创建者', - `birth` datetime DEFAULT NULL COMMENT '创建时间', - `token` varchar(100) DEFAULT NULL COMMENT '唯一标识', - PRIMARY KEY (`organ_id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=55 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - --- ---------------------------- --- Table structure for t_personas_engine_result --- ---------------------------- -DROP TABLE IF EXISTS `t_personas_engine_result`; -CREATE TABLE `t_personas_engine_result` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键', - `engine_id` int(11) NOT NULL COMMENT '引擎id', - `engine_version_id` int(11) NOT NULL COMMENT '引擎版本id', - `engine_name` varchar(100) NOT NULL COMMENT '引擎名称', - `batch_no` int(11) NOT NULL COMMENT '批次号', - `batch_num` int(11) NOT NULL COMMENT '批次数据量', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_personas_engine_result_detail --- ---------------------------- -DROP TABLE IF EXISTS `t_personas_engine_result_detail`; -CREATE TABLE `t_personas_engine_result_detail` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键', - `engine_id` int(11) NOT NULL COMMENT '引擎id\r\n\r\n', - `engine_version_id` int(11) NOT NULL COMMENT '引擎版本id\r\n', - `batch_no` int(11) NOT NULL COMMENT '批次号', - `user_id` int(11) NOT NULL DEFAULT '0' COMMENT '用户id', - `tag_id` int(11) NOT NULL COMMENT '标签id', - `tag_version_id` int(11) DEFAULT NULL COMMENT '标签版本id', - `tag_value` varchar(100) NOT NULL DEFAULT '' COMMENT '标签值', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_resource --- ---------------------------- -DROP TABLE IF EXISTS `t_resource`; -CREATE TABLE `t_resource` ( - `resource_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '资源编号', - `user_id` bigint(20) DEFAULT NULL COMMENT '分配人', - `name` varchar(100) NOT NULL COMMENT '资源名称', - `code` varchar(100) DEFAULT NULL COMMENT '资源代号', - `url` varchar(100) DEFAULT NULL COMMENT '资源路径', - `parent_id` bigint(20) DEFAULT NULL COMMENT '父节点', - `des` varchar(100) DEFAULT NULL COMMENT '资源描述', - `resource_system` enum('EngineX','DataX','Auth','ModuleX') NOT NULL DEFAULT 'EngineX' COMMENT '资源所在系统', - `birth` datetime DEFAULT NULL COMMENT '创建时间', - `icon` varchar(100) DEFAULT NULL COMMENT '图标', - `sort` int(4) DEFAULT '0' COMMENT '菜单顺序', - `status` tinyint(1) DEFAULT '1' COMMENT '状态', - PRIMARY KEY (`resource_id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=86 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - --- ---------------------------- --- Table structure for t_resultset --- ---------------------------- -DROP TABLE IF EXISTS `t_resultset`; -CREATE TABLE `t_resultset` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', - `uid` varchar(200) DEFAULT NULL COMMENT '用户id', - `pid` varchar(200) DEFAULT NULL COMMENT '项目id', - `input` text COMMENT '入参', - `output` longtext COMMENT '出参', - `create_datetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '时间', - `result` varchar(200) DEFAULT NULL COMMENT '1,通过。2,拒绝', - `engine_id` int(11) DEFAULT NULL COMMENT '引擎编号', - `engine_version` int(11) DEFAULT NULL COMMENT '引擎版本', - `uuid` varchar(11) DEFAULT NULL COMMENT '用户id', - `engine_name` varchar(200) DEFAULT NULL COMMENT '引擎名称', - `engine_code` varchar(64) DEFAULT NULL COMMENT '引擎编号', - `type` int(2) DEFAULT NULL COMMENT '1.页面填写 2.api', - `sub_version` int(2) DEFAULT NULL COMMENT '子版本', - `scorecardscore` varchar(10) DEFAULT NULL COMMENT '评分卡评分', - `batch_no` varchar(200) DEFAULT NULL COMMENT '引擎批量测试批次号', - `datilResult` varchar(200) DEFAULT NULL COMMENT '决策详情', - `hbase_row_key` varchar(30) DEFAULT NULL COMMENT 'hbase行键', - PRIMARY KEY (`id`) USING BTREE, - KEY `create_datetime` (`create_datetime`) -) ENGINE=InnoDB AUTO_INCREMENT=21693 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - --- ---------------------------- --- Table structure for t_role --- ---------------------------- -DROP TABLE IF EXISTS `t_role`; -CREATE TABLE `t_role` ( - `role_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '角色编号', - `organ_id` bigint(20) DEFAULT NULL COMMENT '组织编号', - `role_name` varchar(100) NOT NULL COMMENT '角色名称', - `role_code` varchar(100) DEFAULT NULL COMMENT '角色代号', - `role_desc` varchar(100) DEFAULT NULL COMMENT '角色描述', - `author` varchar(100) DEFAULT NULL COMMENT '创建者', - `birth` datetime DEFAULT NULL COMMENT '创建时间', - `status` tinyint(1) DEFAULT '1' COMMENT '0禁用1启用', - PRIMARY KEY (`role_id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=86 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - --- ---------------------------- --- Table structure for t_role_resource_rel --- ---------------------------- -DROP TABLE IF EXISTS `t_role_resource_rel`; -CREATE TABLE `t_role_resource_rel` ( - `rel_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', - `role_id` bigint(20) DEFAULT NULL COMMENT '角色id', - `resource_id` bigint(20) DEFAULT NULL COMMENT '资源id', - PRIMARY KEY (`rel_id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=4803 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - --- ---------------------------- --- Table structure for t_rule --- ---------------------------- -DROP TABLE IF EXISTS `t_rule`; -CREATE TABLE `t_rule` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', - `name` varchar(200) DEFAULT NULL COMMENT '规则名称', - `code` varchar(200) DEFAULT NULL COMMENT '规则代码', - `description` text COMMENT '规则描述', - `priority` int(4) DEFAULT NULL COMMENT '规则优先级', - `parent_id` int(11) DEFAULT NULL COMMENT '父节点id', - `author` int(11) DEFAULT NULL COMMENT '创建人id', - `user_id` int(11) DEFAULT NULL COMMENT '修改人id', - `organ_id` int(11) DEFAULT NULL COMMENT '组织id', - `engine_id` int(11) DEFAULT NULL, - `status` int(2) DEFAULT NULL COMMENT '状态 0 :停用 ,1 : 启用,-1:删除 ', - `type` int(2) DEFAULT NULL COMMENT '规则类型 0 : 系统的规则 1:组织的规则 2: 引擎的规则', - `is_non` int(2) DEFAULT NULL COMMENT '逻辑关系“非”,0:否 ,1:是', - `content` longtext COMMENT '规则具体内容', - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `updated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `rule_type` smallint(2) DEFAULT NULL COMMENT '0硬性拒绝规则1加减分规则', - `rule_audit` smallint(2) DEFAULT NULL, - `score` int(11) DEFAULT NULL COMMENT '得分', - `score_field_en` varchar(255) DEFAULT NULL COMMENT '接收规则得分的字段en', - `last_logical` varchar(50) DEFAULT NULL COMMENT '逻辑关系符', - `difficulty` int(2) NOT NULL DEFAULT '1' COMMENT '1-简单规则,2-复杂规则,3-脚本规则', - `script_type` varchar(255) DEFAULT NULL COMMENT '脚本类型:groovy,python,js', - `result_field_en` varchar(255) DEFAULT NULL COMMENT '接收规则命中结果的字段en', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=1089 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='组织规则维护表'; - --- ---------------------------- --- Table structure for t_rule_condition --- ---------------------------- -DROP TABLE IF EXISTS `t_rule_condition`; -CREATE TABLE `t_rule_condition` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `rule_id` int(11) NOT NULL COMMENT '规则表的id', - `version_id` int(11) NOT NULL DEFAULT '0' COMMENT '规则版本的id', - `logical` varchar(10) DEFAULT NULL COMMENT '关系节点的逻辑符号:&&(并关系),||(或关系)', - `field_id` int(11) DEFAULT NULL COMMENT '表达式节点对应的字段id', - `field_en` varchar(255) DEFAULT NULL COMMENT '指标的en,或者json的某个key形如(obj.a.b)', - `field_type` int(2) DEFAULT '2' COMMENT '指标类型1.中间变量,2.入参变量', - `operator` varchar(50) DEFAULT NULL COMMENT '表达式节点的操作符', - `variable_type` int(2) DEFAULT NULL COMMENT '变量类型,1常量,2变量', - `field_value` varchar(50) DEFAULT NULL COMMENT '表达式节点对应字段的限定值', - `execution_logic` text COMMENT '执行逻辑,每个表达式对应一个用于执行器执行逻辑', - `parent_id` int(11) DEFAULT NULL COMMENT '父节点的id 此项为0的是根节点', - `condition_type` int(2) NOT NULL COMMENT '规则节点的类型:1-关系节点,2-表达式节点 3-for表达式 4-for的结果项 5条件组 6条件组的结果条件', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=5758 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_rule_loop_group_action --- ---------------------------- -DROP TABLE IF EXISTS `t_rule_loop_group_action`; -CREATE TABLE `t_rule_loop_group_action` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '循环组动作表主键', - `condition_for_id` int(11) NOT NULL COMMENT '对应条件表中for的id', - `condition_group_id` int(11) NOT NULL COMMENT '对应条件表中条件id', - `action_type` int(3) DEFAULT NULL COMMENT '动作类型 1-求和,2-赋值,3-输出变量,4-输出常量 5-过滤 6添加元素', - `action_key` varchar(255) DEFAULT NULL COMMENT '动作的key', - `action_value` varchar(255) DEFAULT NULL COMMENT '动作的value', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=807 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_rule_script_version --- ---------------------------- -DROP TABLE IF EXISTS `t_rule_script_version`; -CREATE TABLE `t_rule_script_version` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键:规则版本id', - `rule_id` int(11) NOT NULL COMMENT '规则id', - `version_code` varchar(255) NOT NULL COMMENT '版本号', - `description` varchar(255) NOT NULL COMMENT '版本描述', - `status` int(4) NOT NULL DEFAULT '1' COMMENT '状态:-1删除 ,1启用,0停用', - `script_type` varchar(255) DEFAULT NULL COMMENT '脚本类型:groovy,python,js', - `script_content` longtext COMMENT '脚本规则集内容json,包含脚本内容和脚本所用字段两个值', - `organ_id` int(11) NOT NULL COMMENT '组织id', - `create_user_id` int(11) NOT NULL COMMENT '创建者id', - `update_user_id` int(11) NOT NULL COMMENT '修改者id', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `snapshot` json DEFAULT NULL COMMENT '规则版本配置快照', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - --- ---------------------------- --- Table structure for t_rule_version --- ---------------------------- -DROP TABLE IF EXISTS `t_rule_version`; -CREATE TABLE `t_rule_version` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键:规则版本id', - `rule_id` int(11) NOT NULL COMMENT '规则id', - `version_code` varchar(255) NOT NULL COMMENT '版本号', - `description` varchar(255) NOT NULL COMMENT '版本描述', - `status` int(4) NOT NULL DEFAULT '1' COMMENT '状态:-1删除 ,1启用,0停用', - `result_field_en` varchar(255) DEFAULT NULL COMMENT '存放执行结果的变量', - `score` int(11) NOT NULL COMMENT '规则分数', - `score_field_en` varchar(255) DEFAULT NULL COMMENT '存放得分的变量', - `organ_id` int(11) NOT NULL COMMENT '组织id', - `create_user_id` int(11) NOT NULL COMMENT '创建者id', - `update_user_id` int(11) NOT NULL COMMENT '修改者id', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `snapshot` json DEFAULT NULL COMMENT '规则版本配置快照', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=148 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - --- ---------------------------- --- Table structure for t_scorecard --- ---------------------------- -DROP TABLE IF EXISTS `t_scorecard`; -CREATE TABLE `t_scorecard` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', - `name` varchar(200) DEFAULT NULL COMMENT '名称', - `code` varchar(200) DEFAULT NULL COMMENT '代码', - `description` text COMMENT '描述', - `version` varchar(500) DEFAULT NULL COMMENT '版本号', - `parent_id` int(11) DEFAULT NULL COMMENT '父节点id', - `author` int(11) DEFAULT NULL COMMENT '创建人id', - `user_id` int(11) DEFAULT NULL COMMENT '修改人id', - `organ_id` int(11) DEFAULT NULL COMMENT '组织id', - `engine_id` int(11) DEFAULT NULL COMMENT '引擎id', - `type` int(2) DEFAULT NULL COMMENT '评分卡类型 0:系统的评分卡 1:组织的评分卡 2:引擎的评分卡', - `status` int(2) DEFAULT NULL COMMENT '状态 0:停用 ,1:启用,-1:删除', - `score` longtext COMMENT '得分', - `pd` longtext, - `odds` longtext, - `score_calculate_type` int(2) DEFAULT '1' COMMENT '得分计算方式', - `result_field_en` varchar(255) DEFAULT NULL COMMENT '存放执行结果的变量', - `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `updated` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=177 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='评分卡维护表'; - --- ---------------------------- --- Table structure for t_scorecard_detail --- ---------------------------- -DROP TABLE IF EXISTS `t_scorecard_detail`; -CREATE TABLE `t_scorecard_detail` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '内容id', - `dimension_id` int(11) DEFAULT NULL COMMENT '评分卡id', - `field_id` int(11) DEFAULT NULL COMMENT '指标id', - `parent_id` int(11) DEFAULT NULL COMMENT '父节点id', - `type` int(11) DEFAULT NULL COMMENT '0是根,1是叶子', - `score` decimal(10,2) DEFAULT NULL COMMENT '分数:type为1时有值', - `coefficient` decimal(10,2) DEFAULT NULL COMMENT '系数:type为2时有值', - `custom` longtext COMMENT '自定义:存储自定义公式', - `calculate_type` int(11) DEFAULT NULL COMMENT '计算方式:1为score,2为coefficient,3为自定义custom', - `logical` varchar(50) DEFAULT NULL COMMENT '逻辑运算符(一对二时才有),表示区间时使用', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=948 DEFAULT CHARSET=utf8 COMMENT='评分卡明细表'; - --- ---------------------------- --- Table structure for t_scorecard_detail_condition --- ---------------------------- -DROP TABLE IF EXISTS `t_scorecard_detail_condition`; -CREATE TABLE `t_scorecard_detail_condition` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id', - `detail_id` int(11) DEFAULT NULL COMMENT '内容id', - `operator` varchar(20) DEFAULT NULL COMMENT '关系运算符', - `field_value` varchar(20) DEFAULT NULL COMMENT '指标的值(实参)', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=1517 DEFAULT CHARSET=utf8 COMMENT='评分卡明细表的condition表'; - --- ---------------------------- --- Table structure for t_scorecard_dimension --- ---------------------------- -DROP TABLE IF EXISTS `t_scorecard_dimension`; -CREATE TABLE `t_scorecard_dimension` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id', - `card_id` int(11) DEFAULT NULL COMMENT '评分卡id', - `version_id` int(11) NOT NULL DEFAULT '0' COMMENT '评分卡版本id', - `dimension_name` varchar(30) DEFAULT NULL COMMENT '维度名称', - `weight` decimal(7,2) DEFAULT NULL COMMENT '权重', - `execute_type` varchar(30) DEFAULT NULL COMMENT '执行方式 预留字段', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=589 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_scorecard_version --- ---------------------------- -DROP TABLE IF EXISTS `t_scorecard_version`; -CREATE TABLE `t_scorecard_version` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键:评分卡版本id', - `scorecard_id` int(11) NOT NULL COMMENT '评分卡id', - `version_code` varchar(255) NOT NULL COMMENT '版本号', - `description` varchar(255) NOT NULL COMMENT '版本描述', - `status` int(4) NOT NULL DEFAULT '1' COMMENT '状态:-1删除 ,1启用,0停用', - `score_calculate_type` int(4) NOT NULL COMMENT '得分计算方式', - `result_field_en` varchar(255) NOT NULL COMMENT '存放执行结果的变量', - `organ_id` int(11) NOT NULL COMMENT '组织id', - `create_user_id` int(11) NOT NULL COMMENT '创建者id', - `update_user_id` int(11) NOT NULL COMMENT '修改者id', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `snapshot` json DEFAULT NULL COMMENT '评分卡版本配置快照', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=136 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - --- ---------------------------- --- Table structure for t_sms_template --- ---------------------------- -DROP TABLE IF EXISTS `t_sms_template`; -CREATE TABLE `t_sms_template` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', - `template_name` varchar(100) NOT NULL COMMENT '模板名称', - `template_code` varchar(100) NOT NULL COMMENT '模板编码', - `sms_type` varchar(50) NOT NULL COMMENT '短信类型', - `sms_sign` varchar(100) NOT NULL COMMENT '短信签名', - `template_content` varchar(500) NOT NULL COMMENT '模板内容', - `status` int(2) NOT NULL DEFAULT '1' COMMENT '状态 0:无效,1:有效', - `creator` int(11) DEFAULT NULL COMMENT '创建人', - `modifier` int(11) DEFAULT NULL COMMENT '修改人', - `organ_id` int(11) NOT NULL COMMENT '组织编号', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`), - UNIQUE KEY `template_code` (`template_code`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='短信模板表'; - --- ---------------------------- --- Table structure for t_strategy_output --- ---------------------------- -DROP TABLE IF EXISTS `t_strategy_output`; -CREATE TABLE `t_strategy_output` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', - `field_id` int(11) NOT NULL COMMENT '字段id', - `field_en` varchar(50) NOT NULL COMMENT '字段的en', - `field_value` longtext NOT NULL, - `variable_type` int(2) NOT NULL DEFAULT '1' COMMENT '字段值的类型:1 常量、2 变量、3自定义', - `strategy_id` int(11) DEFAULT NULL, - `strategy_type` varchar(20) DEFAULT NULL, - `out_condition` longtext COMMENT '输出条件,为null则无条件', - `out_type` varchar(255) DEFAULT NULL COMMENT '输出的类型:success成功时候输出,fail 失败时候的输出', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=7213 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='策略中心自定义输出表'; - --- ---------------------------- --- Table structure for t_tag --- ---------------------------- -DROP TABLE IF EXISTS `t_tag`; -CREATE TABLE `t_tag` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键', - `tag_code` varchar(100) NOT NULL COMMENT '标签代码', - `tag_name` varchar(100) NOT NULL COMMENT '标签名称', - `tag_desc` varchar(500) DEFAULT NULL COMMENT '标签描述', - `folder_id` int(11) DEFAULT NULL COMMENT '文件夹id', - `status` int(2) DEFAULT NULL COMMENT '状态:1正常,-1删除 0停用', - `organ_id` int(11) NOT NULL COMMENT '组织id', - `create_user_id` int(11) NOT NULL COMMENT '创建人id', - `update_user_id` int(11) DEFAULT NULL COMMENT '修改人id', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_tag_version --- ---------------------------- -DROP TABLE IF EXISTS `t_tag_version`; -CREATE TABLE `t_tag_version` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '版本主键id', - `tag_id` int(11) DEFAULT NULL COMMENT '标签id', - `version_code` varchar(50) NOT NULL COMMENT '版本code', - `version_name` varchar(50) DEFAULT NULL COMMENT '版本名称', - `description` varchar(500) DEFAULT NULL COMMENT '版本描述', - `status` int(2) NOT NULL COMMENT '状态:1正常,-1删除 0停用', - `organ_id` int(11) DEFAULT NULL COMMENT '组织id', - `create_user_id` int(11) NOT NULL COMMENT '创建人id', - `update_user_id` int(11) DEFAULT NULL COMMENT '修改人id', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `snapshot` text COMMENT '快照', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=49 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_tag_version_detail --- ---------------------------- -DROP TABLE IF EXISTS `t_tag_version_detail`; -CREATE TABLE `t_tag_version_detail` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id', - `tag_version_id` int(11) NOT NULL COMMENT '版本主表id', - `tag_value` varchar(200) NOT NULL COMMENT '标签值', - `tag_value_desc` varchar(500) DEFAULT NULL COMMENT '标签值描述', - `tag_rule_id` bigint(20) DEFAULT NULL COMMENT '条件块id', - `organ_id` int(11) NOT NULL COMMENT '组织id', - `create_user_id` int(11) NOT NULL COMMENT '创建人id', - `update_user_id` int(11) DEFAULT NULL COMMENT '修改人id', - `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=64 DEFAULT CHARSET=utf8; - --- ---------------------------- --- Table structure for t_user --- ---------------------------- -DROP TABLE IF EXISTS `t_user`; -CREATE TABLE `t_user` ( - `user_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键', - `organ_id` bigint(20) DEFAULT NULL COMMENT '组织编号', - `employee_id` varchar(100) DEFAULT NULL COMMENT '员工编号', - `account` varchar(100) NOT NULL COMMENT '账户(手机或者邮箱)', - `password` varchar(100) NOT NULL COMMENT '密码', - `nick_name` varchar(100) NOT NULL COMMENT '昵称', - `email` varchar(100) DEFAULT NULL COMMENT '电子邮箱', - `cellphone` varchar(100) DEFAULT NULL COMMENT '手机号', - `qq` varchar(100) DEFAULT NULL COMMENT 'qq', - `latest_time` varchar(100) DEFAULT NULL COMMENT '最后登录时间', - `latest_ip` varchar(100) DEFAULT NULL COMMENT '最后登录ip', - `remark` varchar(200) DEFAULT NULL COMMENT '备注', - `status` tinyint(1) DEFAULT '1' COMMENT '0禁用,1启用,-1假删', - `birth` datetime DEFAULT NULL COMMENT '创建时间', - `author` varchar(100) DEFAULT NULL COMMENT '创建者', - PRIMARY KEY (`user_id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=166 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - --- ---------------------------- --- Table structure for t_user_role_rel --- ---------------------------- -DROP TABLE IF EXISTS `t_user_role_rel`; -CREATE TABLE `t_user_role_rel` ( - `rel_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '关系主键', - `user_id` bigint(20) DEFAULT NULL COMMENT '用户编号', - `role_id` bigint(20) DEFAULT NULL COMMENT '角色编号', - `organ_id` bigint(20) DEFAULT NULL COMMENT '公司编号', - `status` int(10) DEFAULT '1' COMMENT '1.启用。0.停用。-1.删除', - PRIMARY KEY (`rel_id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=158 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC; - --- ---------------------------- --- Table structure for t_webhook_template --- ---------------------------- -DROP TABLE IF EXISTS `t_webhook_template`; -CREATE TABLE `t_webhook_template` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', - `template_name` varchar(100) NOT NULL COMMENT '模板名称', - `template_code` varchar(100) NOT NULL COMMENT '模板编码', - `request_url` varchar(200) NOT NULL COMMENT '请求地址', - `request_params` varchar(200) DEFAULT NULL COMMENT '请求参数(json格式)', - `status` int(2) NOT NULL DEFAULT '1' COMMENT '状态 0:无效,1:有效', - `creator` int(11) DEFAULT NULL COMMENT '创建人', - `modifier` int(11) DEFAULT NULL COMMENT '修改人', - `organ_id` int(11) NOT NULL COMMENT '组织编号', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`), - UNIQUE KEY `template_code` (`template_code`) -) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='webhook模板表'; - --- ---------------------------- --- Table structure for t_wechat_template --- ---------------------------- -DROP TABLE IF EXISTS `t_wechat_template`; -CREATE TABLE `t_wechat_template` ( - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', - `template_name` varchar(100) NOT NULL COMMENT '模板名称', - `template_code` varchar(100) NOT NULL COMMENT '模板编码', - `template_content` varchar(500) NOT NULL COMMENT '模板内容', - `status` int(2) NOT NULL DEFAULT '1' COMMENT '状态 0:无效,1:有效', - `creator` int(11) DEFAULT NULL COMMENT '创建人', - `modifier` int(11) DEFAULT NULL COMMENT '修改人', - `organ_id` int(11) NOT NULL COMMENT '组织编号', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - PRIMARY KEY (`id`), - UNIQUE KEY `template_code` (`template_code`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='微信服务号模板表'; diff --git a/jar-enginex-manager/.gitignore b/jar-enginex-manager/.gitignore deleted file mode 100644 index 1c430e5..0000000 --- a/jar-enginex-manager/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -.DS_Store -node_modules/ -npm-debug.log* -yarn-debug.log* -yarn-error.log* -.idea -.Archive/ -.vscode/ -dist -*.log -target/ -*.iml -apidoc/ diff --git a/jar-enginex-manager/README.md b/jar-enginex-manager/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/jar-enginex-manager/pom.xml b/jar-enginex-manager/pom.xml deleted file mode 100644 index 9899279..0000000 --- a/jar-enginex-manager/pom.xml +++ /dev/null @@ -1,306 +0,0 @@ - - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 2.4.2 - - - cn.fiboai - enginex-manager - 0.0.1-SNAPSHOT - jar-enginex-manager - http://maven.apache.org - - 4.0.0.RELEASE - 3.2.4 - 1.8.9 - 1.7.7 - 1.2.12 - 6.4.0.Final - - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-logging - - - - - - org.springframework.boot - spring-boot-starter-log4j2 - - - - org.springframework.boot - spring-boot-starter-test - test - - - - junit - junit - test - - - - com.github.pagehelper - pagehelper-spring-boot-starter - - 1.2.3 - - - org.mybatis - mybatis - - - org.mybatis - mybatis-spring - - - - - - - - com.baomidou - mybatis-plus-boot-starter - 3.3.2 - - - - mysql - mysql-connector-java - - - - com.alibaba - druid-spring-boot-starter - 1.1.21 - - - - org.codehaus.jackson - jackson-mapper-lgpl - 1.7.4 - - - - org.apache.commons - commons-lang3 - 3.1 - - - - com.alibaba - fastjson - 1.2.4 - - - - org.projectlombok - lombok - 1.18.0 - - - - org.springframework.boot - spring-boot-starter-aop - - - - - com.github.pagehelper - pagehelper-spring-boot-starter - - 1.2.3 - - - org.mybatis - mybatis - - - org.mybatis - mybatis-spring - - - - - - - - javax.servlet - jstl - 1.2 - - - javax.servlet - servlet-api - 2.5 - - - - org.apache.velocity - velocity - 1.7 - - - - org.apache.velocity - velocity-tools - 2.0 - - - - commons-fileupload - commons-fileupload - 1.3.1 - - - org.apache.httpcomponents - httpclient - 4.2.1 - - - commons-httpclient - commons-httpclient - 3.1 - - - commons-codec - commons-codec - 1.8 - - - - com.github.pagehelper - pagehelper - 5.0.0-rc - - - - - org.apache.poi - poi - 3.8 - - - org.apache.poi - poi-ooxml - 3.8 - - - - - org.apache.httpcomponents - httpclient - 4.5.2 - - - - net.sf.json-lib - json-lib - 2.4 - jdk15 - - - - com.itextpdf - itextpdf - 5.4.3 - - - com.itextpdf - itext-asian - 5.2.0 - - - - - redis.clients - jedis - 2.4.2 - - - - org.projectlombok - lombok - 1.18.0 - - - - org.jpmml - pmml-evaluator - 1.4.1 - - - org.jpmml - pmml-evaluator-extension - 1.4.1 - - - - - io.springfox - springfox-swagger2 - 2.5.0 - - - - com.github.xiaoymin - swagger-bootstrap-ui - 1.9.6 - - - org.springframework.boot - spring-boot-test - - - junit - junit - - - org.springframework - spring-test - - - com.alibaba - transmittable-thread-local - 2.2.0 - - - - - - - src/main/java - - - **/*.xml - - - - - src/main/resources - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/JarEnginexManagerApplication.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/JarEnginexManagerApplication.java deleted file mode 100644 index b14bd79..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/JarEnginexManagerApplication.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.risk.riskmanage; - -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -@SpringBootApplication -@EnableTransactionManagement -@MapperScan("com.risk.riskmanage.*.mapper") -@ComponentScan(basePackages = "com.risk.riskmanage.**") -public class JarEnginexManagerApplication { - - public static void main(String[] args) { - SpringApplication.run(JarEnginexManagerApplication.class, args); - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/basefactory/BaseController.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/basefactory/BaseController.java deleted file mode 100644 index 89b3322..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/basefactory/BaseController.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.risk.riskmanage.common.basefactory; - -/** - * @ClassName: BaseController
- */ -public abstract class BaseController extends CcpBaseController{ - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/basefactory/BaseService.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/basefactory/BaseService.java deleted file mode 100644 index 2629bc4..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/basefactory/BaseService.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.risk.riskmanage.common.basefactory; - -import com.risk.riskmanage.datamanage.mapper.*; -import com.risk.riskmanage.knowledge.mapper.*; -import com.risk.riskmanage.logger.mapper.LoggerMapper; -import com.risk.riskmanage.system.mapper.*; - -import javax.annotation.Resource; - - - -/** - * @ClassName: BaseService
- * @Description: 基础service,统一注入mapper接口.
- */ -public abstract class BaseService { - - - /** - * 后台角色管理mapper. - */ - @Resource - public RoleMapper roleMapper; - - /** - * 后台部门管理mapper. - */ - @Resource - public DepartmentMapper departmentMapper; - - /** - * 后台用户管理mapper. - */ - @Resource - public UserMapper userMapper; - - - /** - *菜单管理 - */ - @Resource - public MenuMapper menuMapper; - - /** - * 用户管理 - */ - @Resource - public SysUserMapper sysUserMapper; - - /** - * 角色管理 - */ - @Resource - public SysRoleMapper sysRoleMapper; - - /** - * 菜单管理 - */ - @Resource - public SysMenuMapper sysMenuMapper; - - /** - * 组织管理 - */ - @Resource - public SysOrganizationMapper sysOrganizationMapper; - - /** - * 知识库目录管理 - */ - @Resource - public KnowledgeTreeMapper knowledgeTreeMapper; - - /** - * 规则管理树形目录与引擎关系管理 - */ - @Resource - public KnowledgeTreeRelMapper knowledgeTreeRelMapper; - - /** - * 规则管理 - */ - @Resource - public RuleMapper ruleMapper; - - /** - * 规则字段管理 - */ - @Resource - public RuleFieldMapper ruleFieldMapper; - - /** - * 规则内容管理 - */ - @Resource - public RuleContentMapper ruleContentMapper; - /** - * 字段类型管理 - */ - @Resource - public FieldTypeMapper fieldTypeMapper; - - /** - * 字段类型用户关系管理 - */ - @Resource - public FieldTypeUserMapper fieldTypeUserMapper; - - /** - * 字段管理 - */ - @Resource - public FieldMapper fieldMapper; - - /** - * 字段用户关系管理 - */ - @Resource - public FieldUserMapper fieldUserMapper; - - /** - * 用户字段条件区域设置 - */ - @Resource - public FieldCondMapper fieldCondMapper; - - /** - * 引擎与引用规则关系 - */ - @Resource - public EngineRuleRelMapper engineRuleRelMapper; - - /** - * 日志mapper - */ - @Resource - public LoggerMapper loggerMapper; - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/basefactory/CcpBaseController.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/basefactory/CcpBaseController.java deleted file mode 100644 index 6cf77af..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/basefactory/CcpBaseController.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.risk.riskmanage.common.basefactory; - -import javax.annotation.Resource; - -/** - * @ClassName: CcpBaseController
- * @Description: TODO ADD FUNCTION.
- */ -public abstract class CcpBaseController { - /** - * 使用s可以获得所有service - */ - @Resource - public ServiceFactory s; -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/basefactory/ServiceFactory.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/basefactory/ServiceFactory.java deleted file mode 100644 index cfcbdfc..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/basefactory/ServiceFactory.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.risk.riskmanage.common.basefactory; - -import com.risk.riskmanage.config.ConfigHolder; -import com.risk.riskmanage.datamanage.service.FieldService; -import com.risk.riskmanage.datamanage.service.FieldTypeService; -import com.risk.riskmanage.knowledge.service.*; -import com.risk.riskmanage.logger.service.LogService; -import com.risk.riskmanage.system.service.*; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; - -/** - * @ClassName: ServiceFactory
- * @Description: TODO ADD FUNCTION.
- */ -@Service("s") -public class ServiceFactory { - - - /** - * 后台用户管理Service. - */ - @Resource - public UserService userService; - - - - /** - * 用户管理 - */ - @Resource - public SysUserService sysUserService; - - /** - * 角色管理 - */ - @Resource - public SysRoleService sysRoleService; - - /** - * 菜单管理 - */ - @Resource - public SysMenuService sysMenuService; - - - /** - * 组织管理 - */ - @Resource - public SysOrganizationService sysOrganizationService; - - /** - * 知识库目录管理service - * */ - @Resource - public KnowledgeTreeService knowledgeTreeService; - - - - /** - * 规则管理service - * */ - @Resource - public RuleService ruleService; - /** - * 字段类型管理 - */ - @Resource - public FieldTypeService fieldTypeService; - - /** - * 字段管理 - */ - @Resource - public FieldService fieldService; - /** - * 日志service - * */ - @Resource - public LogService loggerService; - - /** - * 配置中心 - */ - @Resource - public ConfigHolder configHolder; - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/constants/CommonConst.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/constants/CommonConst.java deleted file mode 100644 index 9c28a82..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/constants/CommonConst.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.risk.riskmanage.common.constants; - -public class CommonConst { - - /** - * 逗号 - */ - public static final String SYMBOL_COMMA = ","; - - /** - * 单引号 - */ - public static final String SYMBOL_SINGLE_QUOTA = "\'"; - - /** - * 空格 - */ - public static final String SYMBOL_BLANK = " "; - - /** - * 空字符串 - */ - public static final String STRING_EMPTY = ""; - - /** - * 评分卡前缀 - */ - public static final String SCORECARD_STARTION = "sc"; - - /** - * 字段前缀 - */ - public static final String SELF_FIELD_STARTION = "f"; - - /** - * 是否命中 - * */ - public static final String IS_HIT = "是否命中"; - - /** - * 得分 - * */ - public static final String SCORE = "得分"; - /** - * 30分钟(s) - * */ - public static final long MINUTE_30 = 1800000; -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/constants/Constants.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/constants/Constants.java deleted file mode 100644 index 13e51d8..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/constants/Constants.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.risk.riskmanage.common.constants; - -/** - * 公共变量约定 - */ -public class Constants { - // token名称 - public static final String SYSTEM_KEY_TOKEN = "token"; - // token时间 单位秒 - public static final Long LOGIN_TOKEN_TIME = 7200L; - // token最大剩余时间,需刷新 单位秒 - public static final Long LOGIN_TOKEN_REFRESH_TIME = 600L; - - // 规则集节点相关常量 - public interface ruleNode { - // 互斥组 - int MUTEXGROUP = 1; - // 执行组 - int EXECUTEGROUP = 2; - } -} \ No newline at end of file diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/constants/OpTypeConst.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/constants/OpTypeConst.java deleted file mode 100644 index cb5f9b7..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/constants/OpTypeConst.java +++ /dev/null @@ -1,322 +0,0 @@ -package com.risk.riskmanage.common.constants; - -public class OpTypeConst { - - /** - * 登入 - * */ - public static final String LOGIN = "登入"; - - /** - * 登出 - * */ - public static final String LOGOUT = "登出"; - - /** - * 保存菜单 - * */ - public static final String SAVE_MENU = " 保存菜单"; - - /** - * 修改菜单 - * */ - public static final String UPDATE_MENU = "修改菜单"; - - /** - * 删除菜单 - * */ - public static final String DELETE_MENU = " 删除菜单"; - - /** - * 保存相应角色的菜单权限 - * */ - public static final String SAVE_MENU_ROLE = "新增相应角色的菜单权限"; - - /** - * 保存系统菜单 - * */ - public static final String SAVE_SYS_MENU = "新增系统菜单"; - - /** - * 修改系统菜单 - * */ - public static final String UPDATE_SYS_MENU = "修改系统菜单"; - - /** - * 删除系统菜单 - * */ - public static final String DELETE_SYS_MENU = "删除系统菜单"; - - /** - * 批量删除系统菜单 - * */ - public static final String BATCH_DELETE_SYS_MENU = "批量删除系统菜单"; - - /** - * 保存、修改资源树 - * */ - public static final String SAVE_OR_UPDATE_MENU_ROLE = "保存、修改资源树"; - - /** - * 保存、修改引擎树 - * */ - public static final String SAVE_ROLE_ENGINE = "保存、修改引擎树"; - - /** - * 保存组织信息 - * */ - public static final String SAVE_ORGAN = "保存组织信息"; - - /** - * 修改组织信息 - * */ - public static final String UPDATE_ORGAN = " 修改组织信息"; - - /** - *删除组织信息 - * */ - public static final String DELTET_ORGAN = "删除组织信息"; - - /** - *批量删除组织信息 - * */ - public static final String BATCH_DELTET_ORGAN ="批量删除组织信息"; - - /** - *修改组织状态信息 - * */ - public static final String UPDATE_ORGAN_STATUS ="修改组织状态信息"; - - /** - *保存本组织角色 - * */ - public static final String SAVE_SYS_ROLE ="保存本组织角色"; - - /** - *修改本组织角色 - * */ - public static final String UPDATE_SYS_ROLE ="修改本组织角色"; - - /** - *删除本组织角色 - * */ - public static final String DELETE_SYS_ROLE ="删除本组织角色"; - - /** - *批量删除本组织角色 - * */ - public static final String BATCH_DELETE_SYS_ROLE ="批量删除本组织角色"; - - /** - *保存公司管理员角色 - * */ - public static final String SAVE_ORANG_MANAGER_ROLE ="保存公司管理员角色"; - - /** - *修改本组织角色状态 - * */ - public static final String UPDATE_SYS_ROLE_STATUS ="修改本组织角色状态"; - - /** - *保存用户信息 - * */ - public static final String SAVE_SYS_USER ="保存用户信息"; - - /** - *修改用户信息 - * */ - public static final String UPDATE_SYS_USER ="修改用户信息"; - - /** - *删除用户信息 - * */ - public static final String DELETE_SYS_USER ="删除用户信息"; - - /** - *批量删除用户信息 - * */ - public static final String BATCH_DELETE_SYS_USER ="批量删除用户信息"; - - /** - *修改用户状态 - * */ - public static final String UPDATE_SYS_USER_STATUS ="修改用户状态"; - - /** - *重置用户密码 - * */ - public static final String RESET_PASSWORD ="重置用户密码"; - - /** - *修改用户密码 - * */ - public static final String UPDTE_PASSWORD ="修改用户密码"; - - /** - * 保存字段映射或数据管理目录 - * */ - public static final String SAVE_FILED_TREE = "保存字段映射或数据管理目录"; - - /** - * 修改字段映射或数据管理目录 - * */ - public static final String UPDATE_FILED_TREE = "修改字段映射或数据管理目录"; - - /** - * 保存数据管理中的字段 - * */ - public static final String SAVE_FILED = "保存数据管理中的字段"; - - /** - * 修改数据管理中的字段 - * */ - public static final String UPDATE_FILED= "修改数据管理中的字段"; - - /** - * 修改数据管理中的字段 - * */ - public static final String UPDATE_FILED_STATUS = "修改数据管理中的字段"; - - /** - * 保存字段映射中的字段 - * */ - public static final String SAVE_MAPPING_FILED = "保存字段映射中的字段"; - - /** - * 修改字段映射中的字段 - * */ - public static final String UPDATE_MAPPING_FILED= "修改字段映射中的字段"; - - /** - * 修改字段映射中的字段状态 - * */ - public static final String UPDATE_MAPPING_FILED_STATUS= "修改字段映射中的字段状态"; - - /** - * 保存知识库或规则管理目录 - * */ - public static final String SAVE_KNOWLEDGE_TREE = "保存知识库或规则管理目录"; - - /** - * 修改规则知识库或规则管理目录 - * */ - public static final String UPDATE_KNOWLEDGE_TREE = "修改规则知识库或规则管理目录"; - - /** - * 保存规则 - * */ - public static final String SAVE_RULE = "保存规则"; - - /** - * 修改规则 - * */ - public static final String UPDATE_RULE = "修改规则"; - - /** - * 修改规则状态 - * */ - public static final String UPDATE_RULE_STATUS = "修改规则状态"; - - /** - *修改分卡状态 - * */ - public static final String UPDATE_SCORECARD_STATUS = "修改分卡状态"; - - /** - *节点重命名 - * */ - public static final String RENAME_NODE = "节点重命名"; - - /** - *保存节点 - * */ - public static final String SAVE_NODE = "保存节点"; - - /** - *修改节点 - * */ - public static final String UPDATE_NODE = "修改节点"; - - /** - *删除节点 - * */ - public static final String DELETE_NODE ="删除节点"; - - /** - * 批量删除节点 - * */ - public static final String BATCH_DELETE_NODE ="批量删除节点"; - - /** - * 删除节点之间的连线 - * */ - public static final String DELETE_NODE_LINK ="删除节点之间的连线"; - - /** - * 复制节点 - * */ - public static final String COPY_NODE ="复制节点"; - - /** - * 保存引擎 - * */ - public static final String SAVE_ENGINE ="保存引擎"; - - /** - * 保存或修改引擎 - * */ - public static final String UPDATE_ENGINE ="保存或修改引擎"; - - - /** - * 保存版本 - * */ - public static final String SAVE_VERSION ="保存版本"; - - /** - * 修改版本 - * */ - public static final String UPDATE_VERSION ="修改版本"; - - /** - * 删除版本 - * */ - public static final String DELETE_VERSION ="删除版本"; - - /** - * 引擎部署 - * */ - public static final String ENGINDE_DEPLOY="引擎部署"; - - /** - * 引擎停止部署 - * */ - public static final String ENGINDE_UNDEPLOY="引擎停止部署"; - - /** - * 清空引擎节点 - * */ - public static final String CLEAR_NODE ="清空引擎节点"; - - /** - * 添加引擎引用规则关系 - * */ - public static final String ADD_RULE_QUOTES_REL = "添加引擎引用规则关系"; - - - /** - * 批量修改引擎引用规则状态 - * */ - public static final String BATCH_UPDATE_STATUS_FOR_QUOTES_RULE ="批量修改引擎引用规则状态"; - - - /** - * 添加引擎引用字段关系 - * */ - public static final String ADD_FIELD_QUOTES_REL = "添加引擎引用字段关系"; - - /** - * 数据填写 - * */ - public static final String FILL_DATA="数据填写"; -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/constants/OpTypeEnum.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/constants/OpTypeEnum.java deleted file mode 100644 index 985ef50..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/constants/OpTypeEnum.java +++ /dev/null @@ -1,345 +0,0 @@ -package com.risk.riskmanage.common.constants; - -public enum OpTypeEnum { - - /** - * 登入 - * */ - LOGIN ("login",OpTypeConst.LOGIN), - - /** - * 登出 - * */ - LOGOUT("logout",OpTypeConst.LOGOUT), - - /** - * 保存菜单 - * */ - SAVE_MENU("saveMenu",OpTypeConst.SAVE_MENU), - - /** - * 修改菜单 - * */ - UPDATE_MENU("updateMenu",OpTypeConst.UPDATE_MENU), - - /** - * 删除菜单 - * */ - DELETE_MENU("deleteMenu",OpTypeConst.DELETE_MENU), - - - /** - * 保存相应角色的菜单权限 - * */ - SAVE_MENU_ROLE("saveMenuRole",OpTypeConst.SAVE_MENU_ROLE), - - - /** - * 保存系统菜单 - * */ - SAVE_SYS_MENU("saveSysMenu",OpTypeConst.SAVE_SYS_MENU), - - /** - * 修改系统菜单 - * */ - UPDATE_SYS_MENU("updateSysMenu",OpTypeConst.UPDATE_SYS_MENU), - - /** - * 删除系统菜单 - * */ - DELETE_SYS_MENU("deleteSysMenu",OpTypeConst.DELETE_SYS_MENU), - - /** - * 批量删除系统菜单 - * */ - BATCH_DELETE_SYS_MENU("batchDeleteSysMenu",OpTypeConst.BATCH_DELETE_SYS_MENU), - - /** - * 保存、修改资源树 - * */ - SAVE_OR_UPDATE_MENU_ROLE("saveOrUpdateMenuRole",OpTypeConst.SAVE_OR_UPDATE_MENU_ROLE), - - /** - * 保存、修改引擎树 - * */ - SAVE_ROLE_ENGINE("saveRoleEngine",OpTypeConst.SAVE_ROLE_ENGINE), - - /** - * 保存组织信息 - * */ - SAVE_ORGAN("saveOrgan",OpTypeConst.SAVE_ORGAN), - - /** - * 修改组织信息 - * */ - UPDATE_ORGAN("updateOrgan",OpTypeConst.UPDATE_ORGAN), - - /** - *删除组织信息 - * */ - DELTET_ORGAN("deleteOrgan",OpTypeConst.DELTET_ORGAN), - - /** - *批量删除组织信息 - * */ - BATCH_DELTET_ORGAN("batchDeleteOrgan",OpTypeConst.BATCH_DELTET_ORGAN), - - /** - *修改组织状态信息 - * */ - UPDATE_ORGAN_STATUS("updateOrganStatus",OpTypeConst.UPDATE_ORGAN_STATUS), - - /** - *保存本组织角色 - * */ - SAVE_SYS_ROLE("saveSysRole",OpTypeConst.SAVE_SYS_ROLE), - - /** - *修改本组织角色 - * */ - UPDATE_SYS_ROLE("updateSysRole",OpTypeConst.UPDATE_SYS_ROLE), - - /** - *删除本组织角色 - * */ - DELETE_SYS_ROLE("deleteSysRole",OpTypeConst.DELETE_SYS_ROLE), - - /** - *批量删除本组织角色 - * */ - BATCH_DELETE_SYS_ROLE("batchDeleteSysRole",OpTypeConst.BATCH_DELETE_SYS_ROLE), - - /** - *保存公司管理员角色 - * */ - SAVE_ORANG_MANAGER_ROLE("saveOrganManagerRole",OpTypeConst.SAVE_ORANG_MANAGER_ROLE), - - /** - *修改本组织角色状态 - * */ - UPDATE_SYS_ROLE_STATUS("updateSysRoleStatus",OpTypeConst.UPDATE_SYS_ROLE_STATUS), - - /** - *保存用户信息 - * */ - SAVE_SYS_USER("saveSysUser",OpTypeConst.SAVE_SYS_USER), - - /** - *修改用户信息 - * */ - UPDATE_SYS_USER("updateSysUser",OpTypeConst.UPDATE_SYS_USER), - - /** - *删除用户信息 - * */ - DELETE_SYS_USER("deleteSysUser",OpTypeConst.DELETE_SYS_USER), - - /** - *批量删除用户信息 - * */ - BATCH_DELETE_SYS_USER("batchDeleteSysUser",OpTypeConst.BATCH_DELETE_SYS_USER), - - /** - *修改用户状态 - * */ - UPDATE_SYS_USER_STATUS("updateSysUserStatus",OpTypeConst.UPDATE_SYS_USER_STATUS), - - /** - *重置用户密码 - * */ - RESET_PASSWORD("resetPassword",OpTypeConst.RESET_PASSWORD), - - /** - *修改用户密码 - * */ - UPDTE_PASSWORD("updatePassword",OpTypeConst.UPDTE_PASSWORD), - - /** - * 保存字段映射或数据管理目录 - * */ - SAVE_FILED_TREE("saveFieldTree",OpTypeConst.SAVE_FILED_TREE), - - /** - * 修改字段映射或数据管理目录 - * */ - UPDATE_FILED_TREE("updateFieldTree",OpTypeConst.UPDATE_FILED_TREE), - - /** - * 保存数据管理中的字段 - * */ - SAVE_FILED("saveField",OpTypeConst.SAVE_FILED), - - /** - * 修改数据管理中的字段 - * */ - UPDATE_FILED("updateField",OpTypeConst.UPDATE_FILED), - - /** - * 修改数据管理中的字段 - * */ - UPDATE_FILED_STATUS("updateFieldStatus",OpTypeConst.UPDATE_FILED_STATUS), - - /** - * 保存字段映射中的字段 - * */ - SAVE_MAPPING_FILED("saveMappingField",OpTypeConst.SAVE_MAPPING_FILED), - - /** - * 修改字段映射中的字段 - * */ - UPDATE_MAPPING_FILED("updateMappingField",OpTypeConst.UPDATE_MAPPING_FILED), - - /** - * 修改字段映射中的字段状态 - * */ - UPDATE_MAPPING_FILED_STATUS("updateMappingFieldStatus",OpTypeConst.UPDATE_MAPPING_FILED_STATUS), - /** - * 保存知识库或规则管理目录 - * */ - SAVE_KNOWLEDGE_TREE("saveKnowledgeTree",OpTypeConst.SAVE_KNOWLEDGE_TREE), - - /** - * 修改规则知识库或规则管理目录 - * */ - UPDATE_KNOWLEDGE_TREE("updateKnowledgeTree",OpTypeConst.UPDATE_KNOWLEDGE_TREE), - - /** - * 保存规则 - * */ - SAVE_RULE("saveRule",OpTypeConst.SAVE_RULE), - - /** - * 修改规则 - * */ - UPDATE_RULE("upadteRule",OpTypeConst.UPDATE_RULE), - - /** - * 修改规则状态 - * */ - UPDATE_RULE_STATUS("upadteRuleStatus",OpTypeConst.UPDATE_RULE_STATUS), - /** - *修改规则状态 - * */ - UPDATE_SCORECARD_STATUS("upadteScorecardStatus",OpTypeConst.UPDATE_SCORECARD_STATUS), - - /** - *节点重命名 - * */ - RENAME_NODE("renameNode",OpTypeConst.RENAME_NODE), - - /** - *保存节点 - * */ - SAVE_NODE("saveNode",OpTypeConst.SAVE_NODE), - - /** - *修改节点 - * */ - UPDATE_NODE("updateNode",OpTypeConst.UPDATE_NODE), - - /** - *删除节点 - * */ - DELETE_NODE("deleteNode",OpTypeConst.DELETE_NODE), - - /** - *批量删除节点 - * */ - BATCH_DELETE_NODE("batchDeleteNode",OpTypeConst.BATCH_DELETE_NODE), - - /** - *删除节点之间的连线 - * */ - DELETE_NODE_LINK("beleteNodeLink",OpTypeConst.DELETE_NODE_LINK), - - /** - *复制节点 - * */ - COPY_NODE("copyNode",OpTypeConst.COPY_NODE), - - /** - *保存引擎 - * */ - SAVE_ENGINE("saveEngine",OpTypeConst.SAVE_ENGINE), - - /** - *修改引擎 - * */ - UPDATE_ENGINE("updateEngine",OpTypeConst.UPDATE_ENGINE), - - /** - *保存版本 - * */ - SAVE_VERSION("saveVersion",OpTypeConst.SAVE_VERSION), - - /** - *修改版本 - * */ - UPDATE_VERSION("updateVersion",OpTypeConst.UPDATE_VERSION), - - /** - *删除版本 - * */ - DELETE_VERSION("deleteVersion",OpTypeConst.DELETE_VERSION), - - /** - * 引擎部署 - * */ - ENGINDE_DEPLOY("engineDepoly",OpTypeConst.ENGINDE_DEPLOY), - - /** - * 引擎停止部署 - * */ - ENGINDE_UNDEPLOY("engineUndepoly",OpTypeConst.ENGINDE_UNDEPLOY), - - /** - * 清空引擎节点 - * */ - CLEAR_NODE("clearNode",OpTypeConst.CLEAR_NODE), - - /** - * 添加引擎引用规则关系 - * */ - ADD_RULE_QUOTES_REL("addRuleQuotesRel",OpTypeConst.ADD_RULE_QUOTES_REL), - - /** - * 批量修改引擎引用规则状态 - * */ - BATCH_UPDATE_STATUS_FOR_QUOTES_RULE("batchUpadteStatusForQuotesRule",OpTypeConst.BATCH_UPDATE_STATUS_FOR_QUOTES_RULE), - - /** - * 添加引擎引用字段关系 - * */ - ADD_FIELD_QUOTES_REL("addFieldQuotesRel",OpTypeConst.ADD_FIELD_QUOTES_REL), - - /** - * 数据填写 - * */ - FILL_DATA("fillData",OpTypeConst.FILL_DATA); - - private String value; - - private String type; - - private OpTypeEnum(String value, String type) - { - this.value = value; - this.type = type; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/constants/ServiceFilterConstant.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/constants/ServiceFilterConstant.java deleted file mode 100644 index 0f7f70b..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/constants/ServiceFilterConstant.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.risk.riskmanage.common.constants; - -import java.util.HashSet; -import java.util.Set; - -/** - * 服务过滤配置 此处配置的uri都是不需要通过session管理,免token传参。 - */ -public class ServiceFilterConstant { - private static Set uriSet = new HashSet(); - static { - uriSet.add("/Riskmanage/v2/login/login");// 密码登录 - uriSet.add("/Riskmanage/v2/datamanage/field/downTemplate");// 指标模板下载 - uriSet.add("/Riskmanage/v2/datamanage/listmanage/downTemplate");// 名单库模板下载 - } - - public static boolean isSessionFilter(String uri) { - if (uriSet.contains(uri)) { - return true; - } - return false; - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/constants/StatusConst.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/constants/StatusConst.java deleted file mode 100644 index 05c356d..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/constants/StatusConst.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.risk.riskmanage.common.constants; - -public class StatusConst { - //状态 - public static final int STATUS_ENABLED = 1;//启用状态,默认 - public static final int STATUS_DEAD = 0;//停用状态 - public static final int STATUS_DELETE = -1;//删除状态 -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/controllor/CommonControllor.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/controllor/CommonControllor.java deleted file mode 100644 index 6bb6e29..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/controllor/CommonControllor.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.risk.riskmanage.common.controllor; - -import com.risk.riskmanage.util.SectionUtils; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Controller -@RequestMapping("/common/validate") -public class CommonControllor { - - @RequestMapping("/section") - @ResponseBody - public Map saveEngineNode(@RequestParam("sections[]") List sections) { - Map resultMap = new HashMap(); - // 验证区间完整性 - if (SectionUtils.checkSectionValid(sections)) { - if (SectionUtils.checkSectionCoincide(sections)) { - resultMap.put("result", "-1"); - resultMap.put("msg", "区间有重叠,请核准!"); - } else { - resultMap.put("result", "1"); - resultMap.put("msg", "区间有效!"); - } - } else { - resultMap.put("result", "-1"); - resultMap.put("msg", "区间不完整,请核准!"); - } - return resultMap; - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/enums/ErrorCodeEnum.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/enums/ErrorCodeEnum.java deleted file mode 100644 index b530081..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/enums/ErrorCodeEnum.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.risk.riskmanage.common.enums; - -public enum ErrorCodeEnum { - - SERVER_ERROR(ErrorCodeEnum.ERROR_CODE + 101, "服务繁忙,请稍后再试!"), - LOGIN_ERROR(ErrorCodeEnum.ERROR_CODE + 102, "登录失败"), - ERROR_TOKEN_EXPIRE(ErrorCodeEnum.ERROR_CODE + 103, "登录授权码已过期"), - FIELD_TYPE_REPEAT(ErrorCodeEnum.ERROR_CODE + 104, "字段类型已存在"), - FIELD_EN_REPEAT(ErrorCodeEnum.ERROR_CODE + 105, "字段英文名已存在"), - FIELD_CN_REPEAT(ErrorCodeEnum.ERROR_CODE + 106, "字段中文名已存在"), - FIELD_BE_USERD(ErrorCodeEnum.ERROR_CODE + 107, "字段被使用,无法修改"), - LIST_DB_NAME_REPEAT(ErrorCodeEnum.ERROR_CODE + 108, "黑白名单名称已存在"), - RULE_NAME_REPEAT(ErrorCodeEnum.ERROR_CODE + 109, "规则名称已存在"), - RULE_CODE_REPEAT(ErrorCodeEnum.ERROR_CODE + 110, "规则代码已存在"), - SCORECARD_NAME_REPEAT(ErrorCodeEnum.ERROR_CODE + 111, "评分卡名称已存在"), - SCORECARD_CODE_REPEAT(ErrorCodeEnum.ERROR_CODE + 112, "评分卡代码已存在"), - UN_PERMISSION(ErrorCodeEnum.ERROR_CODE + 113, "没有访问权限"), - CREATE_USER_NAME_ERROR(ErrorCodeEnum.ERROR_CODE + 114, "姓名不能为超级管理员"), - CREATE_USER_NAME_REPEAT(ErrorCodeEnum.ERROR_CODE + 115, "账号或员工编号已存在"), - CREATE_ROLE_ADMIN_REPEAT(ErrorCodeEnum.ERROR_CODE + 116, "每个公司只能创建一个公司管理员"), - CREATE_ROLE_NAME_REPEAT(ErrorCodeEnum.ERROR_CODE + 117, "角色名已存在"), - CREATE_MENU_NAME_REPEAT(ErrorCodeEnum.ERROR_CODE + 118, "名称或编号已存在"), - CREATE_ORGAN_NAME_REPEAT(ErrorCodeEnum.ERROR_CODE + 119, "名称或编号已存在"), - - UPDATE_RULE_ERROR(ErrorCodeEnum.ERROR_CODE+120,"修改规则内容失败"), - RULE_CONDITION_TYPE_ERROR(ErrorCodeEnum.ERROR_CODE+121,"规则条件类型错误"), - RULE_SAVE_ERROR(ErrorCodeEnum.ERROR_CODE+122,"规则保存失败"), - - RULE_UPLOAD_ERROR(ErrorCodeEnum.ERROR_CODE+123,"规则导入失败"), - DECISION_TABLES_CODE_REPEAT(ErrorCodeEnum.ERROR_CODE + 124, "决策表代码已存在"), - DECISION_TABLES_SAVE_ERROR(ErrorCodeEnum.ERROR_CODE+125,"决策表保存失败"), - DECISION_TABLES_UPDATE_ERROR(ErrorCodeEnum.ERROR_CODE+126,"决策表修改状态失败"), - DECISION_TABLES_NAME_REPEAT(ErrorCodeEnum.ERROR_CODE + 127, "决策表名称已存在"), - DECISION_TREE_SAVE_ERROR(ErrorCodeEnum.ERROR_CODE+130,"决策树保存失败"), - DECISION_TREE_UPDATE_ERROR(ErrorCodeEnum.ERROR_CODE+131,"决策树修改状态失败"), - LIST_OPERATION_NAME_REPEAT(ErrorCodeEnum.ERROR_CODE+132,"集合操作名称重复"), - LIST_OPERATION_Code_REPEAT(ErrorCodeEnum.ERROR_CODE+133,"集合操作代码重复"), - - PARAMS_EXCEPTION(ErrorCodeEnum.ERROR_CODE + 555, "参数异常"), - CLASS_CAST_EXCEPTION(ErrorCodeEnum.ERROR_CODE + 556, "类型转换异常"), - JSON_CAST_EXCEPTION(ErrorCodeEnum.ERROR_CODE + 557, "JSON转换异常"), - NULL_POINT_EREXCEPTION(ErrorCodeEnum.ERROR_CODE + 558, "NPE问题,请联系管理员"), - DATA_IS_NOT_EXIST(ErrorCodeEnum.ERROR_CODE + 559, "数据不存在"), - SECTION_ERROR(ErrorCodeEnum.ERROR_CODE + 560, "区间有误"), - - SCORECARD_NOT_SESECT(ErrorCodeEnum.ERROR_CODE + 561, "在本条路径上,评分卡节点有空值"), - NODECHILD_NOT_SESECT(ErrorCodeEnum.ERROR_CODE + 562, "在本条路径上,子引擎节点有空值"), - DECISION_TABLES_NOT_SELECT(ErrorCodeEnum.ERROR_CODE + 563, "在本条路径上,决策表节点有空值"), - FOLDER_NOT_EXIST(ErrorCodeEnum.ERROR_CODE+564,"文件夹不存在"), - - UPDATE_INTERFACE_ERROR(ErrorCodeEnum.ERROR_CODE+565,"修改接口内容失败"), - INTERFACE_CONDITION_TYPE_ERROR(ErrorCodeEnum.ERROR_CODE+566,"接口条件类型错误"), - INTERFACE_SAVE_ERROR(ErrorCodeEnum.ERROR_CODE+567,"接口保存失败"), - INTERFACE_NAME_REPEAT(ErrorCodeEnum.ERROR_CODE + 568, "接口名称已存在"), - FAIL_IN_LINK(ErrorCodeEnum.ERROR_CODE+600,"失败"), - SQL_FIELD_HAVE_RISK(ErrorCodeEnum.ERROR_CODE+601,"存在有风险sql关键词" ), - - FILE_UPLOAD_ERROR(ErrorCodeEnum.ERROR_CODE+602,"导入失败"); - - /** - * 默认ERROR_CODE.
- * 按公司要求8位长度,前两位产品。 - */ - public static final String ERROR_CODE = "01000"; - - private String code; - private String message; - - private ErrorCodeEnum(String code, String message) { - this.code = code; - this.message = message; - } - - public String getCode() { - return code; - } - - public String getMessage() { - return message; - } - -} \ No newline at end of file diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/exception/ApiException.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/exception/ApiException.java deleted file mode 100644 index a8fbe03..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/exception/ApiException.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.risk.riskmanage.common.exception; - - -/** - * 自定义异常消息处理 - */ -public class ApiException extends RuntimeException { - - /** - * - */ - private static final long serialVersionUID = 1136843834946392402L; - - /** - * 异常编码 - */ - public final String errCode; - - /** - * 异常消息 - */ - public final String message; - - /** - * data - */ - public final Object data; - - public ApiException(Throwable e) { - super(e); - errCode = ""; - message = ""; - data = null; - } - - public ApiException(String errCode, String message) { - super(message); - this.errCode = errCode; - this.message = message; - this.data = null; - } - - public ApiException(String errCode, String message, Object data) { - super(message); - this.errCode = errCode; - this.message = message; - this.data = data; - } - - public ApiException(String errCode, String message, Throwable e) { - super(message, e); - this.errCode = errCode; - this.message = message; - this.data = null; - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/mapper/BaseMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/mapper/BaseMapper.java deleted file mode 100644 index 2915ba8..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/mapper/BaseMapper.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.risk.riskmanage.common.mapper; - -import java.util.List; - -/** - * - * @ClassName: BaseMapper - * @Description: 公共的BaseMapper接口 - */ -public abstract interface BaseMapper { - - /** - * @Description: 根据对象删除数据 - * @param entity 对象 - * @return 是否删除成功 - */ - int deleteByExample(IdEntity entity); - - /** - * @Description: 根据对象主键ID删除数据 - * @param id 对象id编号 - * @return 是否删除成功 - */ - int deleteByPrimaryKey(Long id); - - /** - * @Description: 插入一条新的数据 - * @param entity 对象 - * @return 是否插入成功 - */ - int insertSelective(IdEntity entity); - - /** - * @Description: 根据对象主键更新对象信息 - * @param entity 对象 - * @return 是否修改成功标志 - */ - int updateByPrimaryKeySelective(IdEntity entity); - - /** - * @Description: 根据对象获取数据条数 - * @param entity 对象 - * @return 返回行数 - */ - int countByExample(IdEntity entity); - - /** - * @Description: 根据对象主键ID获取指定数据(多个) - * @param entity 对象 - * @return 对象列表 - */ - List selectByExample(IdEntity entity); - - /** - * @Description: 根据对象主键ID获取指定数据(单个) - * @param id id编号 - * @return 返回单个对象 - */ - IdEntity selectByPrimaryKey(Long id); -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/BasePage.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/BasePage.java deleted file mode 100644 index a2ea66e..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/BasePage.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.risk.riskmanage.common.model; - -/** - * - * @ClassName: BasePageVo
- * @Description: 分页公共基础bean.
- */ -public class BasePage { - - /** - * 当前页数 - */ - private int page; - - /** - * 每页显示的行数 - */ - private int rows; - - /** - * 开始行数 - */ - private Integer curRow; - - /** - * 结束行数 - */ - private Integer endRow; - - /** - * 总行数 - */ - private Integer total; - - public BasePage() { - - } - - public Integer getTotal() { - return total; - } - - public void setTotal(Integer total) { - this.total = total; - } - - /** - * setPagination:(设置当前页面和每页显示行数).
- * @author wz - * @param page 当前页数 - * @param rows 每页显示的行数 - */ - public void setPagination(int page,int rows){ - this.page = page; - this.rows = rows; - this.curRow = (page-1)*rows; - this.endRow = (page)*rows; - } - - - public int getPage() { - return page; - } - - public void setPage(int page) { - this.page = page; - } - - public int getRows() { - return rows; - } - - public void setRows(int rows) { - this.rows = rows; - } - - public void setCurRow(Integer curRow) { - this.curRow = curRow; - } - - public void setEndRow(Integer endRow) { - this.endRow = endRow; - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/BaseParam.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/BaseParam.java deleted file mode 100644 index 6a7c75b..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/BaseParam.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.risk.riskmanage.common.model; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; - -@Data -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = false) -public class BaseParam extends PageDto { - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/ExcelModel.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/ExcelModel.java deleted file mode 100644 index 54b19db..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/ExcelModel.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.risk.riskmanage.common.model; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.List; -@Data -@AllArgsConstructor -@NoArgsConstructor -public class ExcelModel { - private String name;//excel文件名 - private String type;//类型:xlsx,xls - private List sheets;//工作簿 -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/ExcelSheetModel.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/ExcelSheetModel.java deleted file mode 100644 index d4f9c71..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/ExcelSheetModel.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.risk.riskmanage.common.model; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.List; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class ExcelSheetModel { - private String sheetName;//sheet名 - private List headers;//sheet中第一行内容 - private List data;//sheet数据 -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/PageDto.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/PageDto.java deleted file mode 100644 index 3520943..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/PageDto.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.risk.riskmanage.common.model; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -public class PageDto implements Serializable { - - private static final long serialVersionUID = 1L; - - private Integer pageNo = 1; - - private Integer pageSize = 10; - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/ResponseEntityDto.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/ResponseEntityDto.java deleted file mode 100644 index 8ca6e0f..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/ResponseEntityDto.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.risk.riskmanage.common.model; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.ToString; - -import java.io.Serializable; - -@Data -@ToString(callSuper = true) -@ApiModel("返回对象统一封装") -public class ResponseEntityDto implements Serializable { - - private static final long serialVersionUID = -720807478055084231L; - - @ApiModelProperty("状态:1成功, 0失败") - private String status; - @ApiModelProperty("错误码") - private String error; - @ApiModelProperty("错误消息") - private String msg; - @ApiModelProperty("返回数据") - private T data; - - public ResponseEntityDto() { - - } - - public ResponseEntityDto(String status) { - this.status = status; - } - - public ResponseEntityDto(String status, String error) { - this.status = status; - this.error = error; - } - - public ResponseEntityDto(String status, T data) { - this.status = status; - this.data = data; - } - - public ResponseEntityDto(String status, String error, String msg, T data) { - this.status = status; - this.error = error; - this.msg = msg; - this.data = data; - } - - public String getStatus() { - return status; - } - - public ResponseEntityDto setStatus(String status) { - this.status = status; - return this; - } - - public String getError() { - return error; - } - - public ResponseEntityDto setError(String error) { - this.error = error; - return this; - } - - public String getMsg() { - return msg; - } - - public ResponseEntityDto setMsg(String msg) { - this.msg = msg; - return this; - } - - public T getData() { - return data; - } - - public ResponseEntityDto setData(T data) { - this.data = data; - return this; - } - - -} \ No newline at end of file diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/requestParam/QueryListParam.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/requestParam/QueryListParam.java deleted file mode 100644 index 691c4fc..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/requestParam/QueryListParam.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.risk.riskmanage.common.model.requestParam; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class QueryListParam { - private Integer pageNum = 1; // 第几页 - private Integer pageSize = 10; // 每页的数量 - private T entity;//查询实体对象 -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/requestParam/StatusParam.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/requestParam/StatusParam.java deleted file mode 100644 index 76c6b7d..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/requestParam/StatusParam.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.risk.riskmanage.common.model.requestParam; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.List; - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class StatusParam { - private static final long serialVersionUID = 8131487634836541557L; - - private Integer status;//状态 - - private List ids;//主键id - - private Long tacticsId;//相关策略id - - private List list;//针对需要指定类型的需要传入实体类 -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/requestParam/UpdateFolderParam.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/requestParam/UpdateFolderParam.java deleted file mode 100644 index 338cd66..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/requestParam/UpdateFolderParam.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.risk.riskmanage.common.model.requestParam; - - -import com.risk.riskmanage.common.enums.ErrorCodeEnum; -import com.risk.riskmanage.common.exception.ApiException; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -import java.util.List; - -@Data -@AllArgsConstructor -@NoArgsConstructor -@Accessors -public class UpdateFolderParam { - private List ids;//规则id - private Long folderId;//文件夹id - - public static boolean checkNotNull(UpdateFolderParam param){ - if (param==null||param.ids==null||param.ids.isEmpty()||param.folderId==null){ - throw new ApiException(ErrorCodeEnum.PARAMS_EXCEPTION.getCode(),"id或者文件夹id为空"); - } - return true; - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/requestParam/UpdateStatusParam.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/requestParam/UpdateStatusParam.java deleted file mode 100644 index e20d802..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/model/requestParam/UpdateStatusParam.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.risk.riskmanage.common.model.requestParam; - -import com.risk.riskmanage.common.enums.ErrorCodeEnum; -import com.risk.riskmanage.common.exception.ApiException; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -import java.util.ArrayList; -import java.util.List; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors -public class UpdateStatusParam { - private String ids; - private Integer status; - private List list; - - public static boolean checkParam(UpdateStatusParam param) { - try { - String[] split = param.getIds().split(","); - Integer status = param.getStatus(); - if (split == null || split.length == 0 || status == null) { - throw new ApiException(ErrorCodeEnum.PARAMS_EXCEPTION.getCode(), ErrorCodeEnum.PARAMS_EXCEPTION.getMessage()); - } - param.list = new ArrayList<>(); - for (String s : split) { - param.list.add(Long.valueOf(s)); - } - } catch (Exception e) { - e.printStackTrace(); - throw new ApiException(ErrorCodeEnum.PARAMS_EXCEPTION.getCode(), ErrorCodeEnum.PARAMS_EXCEPTION.getMessage()); - } - return true; - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/utils/ExcelUtil.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/utils/ExcelUtil.java deleted file mode 100644 index aa2c499..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/utils/ExcelUtil.java +++ /dev/null @@ -1,311 +0,0 @@ -package com.risk.riskmanage.common.utils; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.OutputStream; -import java.lang.reflect.Field; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Iterator; -import java.util.List; - -import com.risk.riskmanage.common.model.ExcelModel; -import com.risk.riskmanage.common.model.ExcelSheetModel; -import org.apache.poi.hssf.usermodel.HSSFDateUtil; -import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.apache.poi.ss.usermodel.Cell; -import org.apache.poi.ss.usermodel.CellStyle; -import org.apache.poi.ss.usermodel.Font; -import org.apache.poi.ss.usermodel.IndexedColors; -import org.apache.poi.ss.usermodel.Row; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.xssf.streaming.SXSSFWorkbook; -import org.apache.poi.xssf.usermodel.XSSFWorkbook; - -/** - * ClassName:ExcelUtil
- * Description: Excel实用类 - */ -@SuppressWarnings("rawtypes") -public class ExcelUtil { - - /** - * exportExcel:导出excel - * - * @param out 输出流 - * @param exlType 导出格式 - * @param headers 表头信息 - * @param list 要导出的数据 - * @return cell - * - */ - public static void exportExcel(OutputStream out, String exlType, String[] headers, String[] classNames, List list) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException { - Workbook workbook; - if (exlType.equalsIgnoreCase("xlsx")) { - // 2007以上 - workbook = new SXSSFWorkbook(200); - } else { - // 97-2003 - workbook = new HSSFWorkbook(); - } - - Sheet sheet = workbook.createSheet("title"); - for (short i = 0; i < headers.length; i++) { - if (i == headers.length - 1 || i == headers.length - 2) { - sheet.setColumnWidth(i, 50 * 256); - } else { - sheet.setColumnWidth(i, 25 * 256); - } - } - - CellStyle cellStyle = workbook.createCellStyle(); - CellStyle cellStyle1 = workbook.createCellStyle(); - - Font font = workbook.createFont(); - Font font1 = workbook.createFont(); - - //微软雅黑,字体10,加粗,背景灰色 - font.setFontName("微软雅黑"); - font.setFontHeight((short) 240); - font.setBoldweight(Font.BOLDWEIGHT_BOLD); - cellStyle.setFont(font); - cellStyle.setAlignment(CellStyle.ALIGN_CENTER); // 指定单元格居中对齐 - cellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER); - cellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); - cellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND); - cellStyle.setWrapText(true); - cellStyle.setBorderBottom(CellStyle.BORDER_THIN); // 设置单无格的边框为粗体 - cellStyle.setBorderLeft(CellStyle.BORDER_THIN); - cellStyle.setBorderRight(CellStyle.BORDER_THIN); - cellStyle.setBorderTop(CellStyle.BORDER_THIN); - - //微软雅黑,字体10,加粗,背景灰色 - font1.setFontName("微软雅黑"); - font1.setFontHeight((short) 240); - cellStyle1.setFont(font1); - cellStyle1.setAlignment(CellStyle.ALIGN_LEFT); // 指定单元格居中对齐 - cellStyle1.setVerticalAlignment(CellStyle.VERTICAL_CENTER); - cellStyle1.setWrapText(true); - cellStyle1.setBorderBottom(CellStyle.BORDER_THIN); // 设置单无格的边框为粗体 - cellStyle1.setBorderLeft(CellStyle.BORDER_THIN); - cellStyle1.setBorderRight(CellStyle.BORDER_THIN); - cellStyle1.setBorderTop(CellStyle.BORDER_THIN); - - Row row = sheet.createRow(0); - row.setHeight((short) 400); - - for (short i = 0; i < headers.length; i++) { - Cell cell = row.createCell(i); - cell.setCellStyle(cellStyle); - cell.setCellValue(headers[i]); - } - Iterator it = list.iterator(); - int index = 0; - while (it.hasNext()) { - index++; - row = sheet.createRow(index); - row.setHeight((short) 800); - T t = it.next(); - if (null != t) { - for (int j = 0; j < headers.length; j++) { - Cell cell = row.createCell(j); - Field field = t.getClass().getDeclaredField(classNames[j]); - field.setAccessible(true); - Class valType = field.getType(); - - cell.setCellStyle(cellStyle1); - if ("java.lang.String" - .equalsIgnoreCase(valType.getName())) { - cell.setCellValue((String) field.get(t)); - } else if ("java.lang.Integer" - .equalsIgnoreCase(valType.getName()) - || "int".equalsIgnoreCase(valType.getName())) { - cell.setCellValue((Integer) field.get(t)); - } else if ("java.lang.Double" - .equalsIgnoreCase(valType.getName()) - || "double".equalsIgnoreCase(valType.getName())) { - cell.setCellValue((Double) field.get(t) == null - ? 0 - : (Double) field.get(t)); - } else if ("java.lang.Long" - .equalsIgnoreCase(valType.getName()) - || "long".equalsIgnoreCase(valType.getName())) { - cell.setCellValue((Long) field.get(t) == null - ? 0 - : (Long) field.get(t)); - } else if ("java.util.Date" - .equalsIgnoreCase(valType.getName())) { - if (null == field.get(t)) { - cell.setCellValue(""); - } else { - SimpleDateFormat sdf = new SimpleDateFormat( - "yyyy/MM/dd"); - cell.setCellValue(sdf.format((Date) field.get(t))); - } - } - field.setAccessible(false); - } - } - } - try { - workbook.write(out); - out.flush(); - out.close(); - out = null; - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } finally { - try { - if (out != null) - out.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - - - /** - * 处理单元格格式 - * - * @param cell - * @return - * - */ - public static String formatCell(Cell cell) { - if (cell == null) { - return ""; - } - switch (cell.getCellType()) { - case Cell.CELL_TYPE_NUMERIC: - //日期格式的处理 - if (HSSFDateUtil.isCellDateFormatted(cell)) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - return sdf.format(HSSFDateUtil.getJavaDate(cell.getNumericCellValue())).toString(); - } - - return String.valueOf(cell.getNumericCellValue()); - - //字符串 - case Cell.CELL_TYPE_STRING: - return cell.getStringCellValue(); - - // 公式 - case Cell.CELL_TYPE_FORMULA: - return cell.getCellFormula(); - - // 空白 - case Cell.CELL_TYPE_BLANK: - return ""; - - // 布尔取值 - case Cell.CELL_TYPE_BOOLEAN: - return cell.getBooleanCellValue() + ""; - - //错误类型 - case Cell.CELL_TYPE_ERROR: - return cell.getErrorCellValue() + ""; - } - - return ""; - } - - - public static void exportExcelTemplate(OutputStream out, ExcelModel model) throws SecurityException, IllegalArgumentException { - Workbook workbook; - if ("xlsx".equalsIgnoreCase(model.getType())) { - // 2007以上 - workbook = new XSSFWorkbook(); - } else { - // 97-2003 - workbook = new HSSFWorkbook(); - } - List sheets = model.getSheets(); - if (sheets == null && sheets.size() == 0) { - return; - } - for (ExcelSheetModel info : sheets) { - Sheet sheet = workbook.createSheet(info.getSheetName()); - int headerSize = info.getHeaders().size(); - for (short i = 0; i < headerSize; i++) { - if (i == headerSize - 1 || i == headerSize - 2) { - sheet.setColumnWidth(i, 50 * 256); - } else { - sheet.setColumnWidth(i, 25 * 256); - } - } - CellStyle cellStyle = workbook.createCellStyle(); - CellStyle cellStyle1 = workbook.createCellStyle(); - - Font font = workbook.createFont(); - Font font1 = workbook.createFont(); - - //微软雅黑,字体10,加粗,背景灰色 - font.setFontName("微软雅黑"); - font.setFontHeight((short) 240); - font.setBoldweight(Font.BOLDWEIGHT_BOLD); - cellStyle.setFont(font); - cellStyle.setAlignment(CellStyle.ALIGN_CENTER); // 指定单元格居中对齐 - cellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER); - cellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); - cellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND); - cellStyle.setWrapText(true); - cellStyle.setBorderBottom(CellStyle.BORDER_THIN); // 设置单无格的边框为粗体 - cellStyle.setBorderLeft(CellStyle.BORDER_THIN); - cellStyle.setBorderRight(CellStyle.BORDER_THIN); - cellStyle.setBorderTop(CellStyle.BORDER_THIN); - - //微软雅黑,字体10,加粗,背景灰色 - font1.setFontName("微软雅黑"); - font1.setFontHeight((short) 240); - cellStyle1.setFont(font1); - cellStyle1.setAlignment(CellStyle.ALIGN_LEFT); // 指定单元格居中对齐 - cellStyle1.setVerticalAlignment(CellStyle.VERTICAL_CENTER); - cellStyle1.setWrapText(true); - cellStyle1.setBorderBottom(CellStyle.BORDER_THIN); // 设置单无格的边框为粗体 - cellStyle1.setBorderLeft(CellStyle.BORDER_THIN); - cellStyle1.setBorderRight(CellStyle.BORDER_THIN); - cellStyle1.setBorderTop(CellStyle.BORDER_THIN); - - Row row = sheet.createRow(0); - row.setHeight((short) 400); - - for (short i = 0; i < headerSize; i++) { - Cell cell = row.createCell(i); - cell.setCellStyle(cellStyle); - cell.setCellValue(info.getHeaders().get(i)); - } - List data = info.getData(); - for (int i = 0; i < data.size(); i++) { - List oneRow = data.get(i); - row = sheet.createRow(i+1); - for (int j = 0; j < oneRow.size(); j++) { - Object cellData = oneRow.get(j); - Cell cell = row.createCell(j); - cell.setCellStyle(cellStyle1); - cell.setCellValue(cellData.toString()); - } - } - try { - workbook.write(out); - out.flush(); - out.close(); - out = null; - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } finally { - try { - if (out != null) - out.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - } -} \ No newline at end of file diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/utils/ResponseEntityBuilder.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/utils/ResponseEntityBuilder.java deleted file mode 100644 index 134e443..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/common/utils/ResponseEntityBuilder.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.risk.riskmanage.common.utils; - -import com.risk.riskmanage.common.enums.ErrorCodeEnum; -import com.risk.riskmanage.common.model.ResponseEntityDto; -import org.apache.commons.lang3.StringUtils; - -import java.io.Serializable; - -public final class ResponseEntityBuilder { - /** - * 返回成功. - */ - public static final String RESPONSE_OK = "1"; - /** - * 返回失败. - */ - public static final String RESPONSE_FAIL = "0"; - - /** - * 构造一个失败响应.
- * 用于构造一个比较用见或是常用的失败响应。
- * - * @param enums - * 常见错误枚举类的一个实例.
- * @return - */ - public static ResponseEntityDto buildErrorResponse(ErrorCodeEnum enums) { - ResponseEntityDto entity = new ResponseEntityDto<>(); - entity.setStatus(RESPONSE_FAIL); - entity.setError(String.valueOf(enums.getCode())); - entity.setMsg(enums.getMessage()); - return entity; - } - -// /** -// * 构造一个失败响应.
-// * -// * @param enums -// * @return -// */ -// @Deprecated -// public static ResponseEntity buildErrorResponse(ErrorCodeEnum enums) { -// ResponseEntity model = new ResponseEntity(); -// model.setStatus(RESPONSE_FAIL); -// model.setError(String.valueOf(enums.getVersionCode())); -// model.setMsg(enums.getMessage()); -// return model; -// } - - /** - * 构造一个失败响应.
- * - * @param error - * 失败错误编码.
- * @param message - * 失败错误说明.
- * @return - * - */ - public static ResponseEntityDto buildErrorResponse(String error, String message) { - ResponseEntityDto entity = new ResponseEntityDto<>(); - entity.setStatus(RESPONSE_FAIL); - if(StringUtils.isBlank(error) || !StringUtils.isNumeric(error)){ - error = "401"; - } - entity.setError(error); - entity.setMsg(message); - return entity; - } - - /** - * 构造一个正常响应.
- * - * 响应数据.
- * @return - */ - public static ResponseEntityDto buildNormalResponse() { - //规范:所有正常请求(status="1",error="01000000"),code与pageCount属性被废弃. - return new ResponseEntityDto(RESPONSE_OK, "00000000"); - } - - /** - * 构造一个正常响应.
- * - * @param data - * 响应数据.
- * @return - */ - public static ResponseEntityDto buildNormalResponse(T data) { - ResponseEntityDto entity = buildNormalResponse(); - entity.setData(data); - return entity; - } - /** - * 构造一个错误响应.
- * - * @param data - * 响应数据.
- * @return - */ - public static ResponseEntityDto buildUnNormalResponse(T data,ErrorCodeEnum enums) { - ResponseEntityDto entity = buildErrorResponse(enums); - entity.setData(data); - return entity; - } -// public static ResponseEntityDto> buildNormalResponse(String key,T data) { -// Map result = new HashMap<>(); -// result.put(key, data); -// -// ResponseEntityDto> model = buildNormalResponse(); -// model.setData(result); -// return model; -// } - - public static Boolean isSuccess(ResponseEntityDto entity){ - return entity.getStatus().equals(RESPONSE_OK); - } - - public static Boolean isSuccess2(ResponseEntityDto entity){ - return entity.getStatus().equals(RESPONSE_OK) && entity.getError().equals("00000000"); - } - - /** - * 适用于接口返回data为null时业务不成功的场景 - */ - public static Boolean isSuccess3(ResponseEntityDto entity){ - return entity.getStatus().equals(RESPONSE_OK) && entity.getError().equals("200") && entity.getData() != null; - } - - public static T getEntity(ResponseEntityDto entity){ - if(isSuccess(entity)){ - return (T) entity.getData(); - - } - return null; - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/config/ConfigHolder.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/config/ConfigHolder.java deleted file mode 100644 index ab39ec5..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/config/ConfigHolder.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.risk.riskmanage.config; - -import lombok.Data; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Configuration; - -@Configuration -@Data -public class ConfigHolder { - - //redisConfig - @Value("${redis.host}") - private String redisHost; - @Value("${redis.port}") - private int redisPort; - @Value("${redis.db}") - private int redisDb; - @Value("${redis.password}") - private String redisPwd; - @Value("${redis.pool.maxTotal}") - private int redisMaxTotal; - @Value("${redis.pool.maxIdle}") - private int redisMaxIdle; - @Value("${redis.pool.maxWait}") - private int redisMaxWait; - @Value("${redis.pool.timeout}") - private int redisTimeout; - - @Value("${monitor.data.storage.type}") - private String monitorStoreType; - //jdbcConfig - /*@Value("${jdbc.url}") - private String jdbcUrl; - @Value("${jdbc.driver}") - private String DriverName; - @Value("${pool.maxPoolSize}") - private int maxPoolSize; - @Value("${jdbc.username}") - private String jdbcUserName; - @Value("${jdbc.password}") - private String jdbcPwd; - @Value("${pool.maxWait}") - private int jdbcMaxWait; - @Value("${pool.timeBetweenEvictionRunsMillis}") - private int timeBetweenEvictionRunsMillis; - @Value("${pool.minEvictableIdleTimeMillis}") - private int minEvictableIdleTimeMillis; - @Value("${pool.validationQuery}") - private String validationQuery; - - //rabbitconfig - @Value("${rabbitMQ.host}") - private String rabbitHost; - @Value("${rabbitMQ.port}") - private int rabbitPort; - @Value("${rabbitMQ.username}") - private String rabbitUsername; - @Value("${rabbitMQ.password}") - private String rabbitPassword;*/ - -} \ No newline at end of file diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/config/ConfigurationContainor.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/config/ConfigurationContainor.java deleted file mode 100644 index cf2c69e..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/config/ConfigurationContainor.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.risk.riskmanage.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; -import redis.clients.jedis.JedisPool; -import redis.clients.jedis.JedisPoolConfig; - -import javax.annotation.Resource; -import java.util.concurrent.ThreadPoolExecutor; - -@Configuration -public class ConfigurationContainor { - - @Resource - private ConfigHolder configHolder; - - @Bean(name = "threadPoolTaskExecutor") - ThreadPoolTaskExecutor threadPoolTaskExecutor(){ - ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); - executor.setCorePoolSize(500); - executor.setMaxPoolSize(1000); - executor.setQueueCapacity(200); - executor.setRejectedExecutionHandler(new ThreadPoolExecutor.DiscardPolicy()); - return executor; - } - - @Bean(name = "jedisPool") - public JedisPool jedisPool(){ - JedisPoolConfig config = new JedisPoolConfig(); - config.setMaxTotal(configHolder.getRedisMaxTotal()); - config.setMaxIdle(configHolder.getRedisMaxIdle()); - config.setMaxWaitMillis(configHolder.getRedisMaxWait()); - config.setTestOnBorrow(true); -// config.setTestOnReturn(true); - - JedisPool pool = new JedisPool(config, - configHolder.getRedisHost(), - configHolder.getRedisPort(), - configHolder.getRedisTimeout(), - configHolder.getRedisPwd(), - configHolder.getRedisDb()); - return pool; - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/config/DataSourceConfig.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/config/DataSourceConfig.java deleted file mode 100644 index b323b93..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/config/DataSourceConfig.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.risk.riskmanage.config; - -import com.alibaba.druid.pool.DruidDataSource; -import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean; -import org.apache.ibatis.session.SqlSessionFactory; -import org.mybatis.spring.SqlSessionTemplate; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.io.Resource; -import org.springframework.core.io.support.PathMatchingResourcePatternResolver; -import org.springframework.core.io.support.ResourcePatternResolver; - -import javax.sql.DataSource; - -@Configuration -public class DataSourceConfig { - - @Value("${spring.datasource.default.url}") - private String defaultDBUrl; - @Value("${spring.datasource.default.username}") - private String defaultDBUser; - @Value("${spring.datasource.default.password}") - private String defaultDBPassword; - @Value("${spring.datasource.default.driver-class-name}") - private String defaultDBDreiverName; - - @Bean - public DruidDataSource druidDataSource(){ - DruidDataSource defaultDataSource = new DruidDataSource(); - defaultDataSource.setUrl(defaultDBUrl); - defaultDataSource.setUsername(defaultDBUser); - defaultDataSource.setPassword(defaultDBPassword); - defaultDataSource.setDriverClassName(defaultDBDreiverName); - - return defaultDataSource; - } - - @Bean - public SqlSessionFactory sqlSessionFactory( - @Qualifier("druidDataSource") DataSource druidDataSource) - throws Exception { - MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean(); - ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); - Resource[] mapperXmlResource = resolver.getResources("classpath*:**/*Mapper.xml"); - bean.setDataSource(druidDataSource); - bean.setMapperLocations(mapperXmlResource); - bean.setTypeAliasesPackage("com.risk.riskmanage.**.model"); - bean.getObject().getConfiguration().setMapUnderscoreToCamelCase(true); - bean.getObject().getConfiguration().setCacheEnabled(false); - return bean.getObject(); - } - - @Bean(name = "sqlSessionTemplate") - public SqlSessionTemplate sqlSessionTemplate( - @Qualifier("sqlSessionFactory") SqlSessionFactory sqlSessionFactory) - throws Exception { - return new SqlSessionTemplate(sqlSessionFactory); - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/config/RestTemplateConfig.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/config/RestTemplateConfig.java deleted file mode 100644 index 461f6a7..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/config/RestTemplateConfig.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.risk.riskmanage.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.client.ClientHttpRequestFactory; -import org.springframework.http.client.SimpleClientHttpRequestFactory; -import org.springframework.web.client.RestTemplate; - -/** - * RestTemplate配置类 - */ -@Configuration -public class RestTemplateConfig { - - @Bean - public RestTemplate restTemplate(ClientHttpRequestFactory factory){ - return new RestTemplate(factory); - } - - @Bean - public ClientHttpRequestFactory simpleClientHttpRequestFactory(){ - SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); - factory.setReadTimeout(300000000);//单位为ms - factory.setConnectTimeout(500000000);//单位为ms - return factory; - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/config/WebMvcConfig.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/config/WebMvcConfig.java deleted file mode 100644 index 0f1fc62..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/config/WebMvcConfig.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.risk.riskmanage.config; - -import com.risk.riskmanage.spring.interceptor.SessionInterceptor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.servlet.config.annotation.InterceptorRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -@Configuration -public class WebMvcConfig implements WebMvcConfigurer { - - @Autowired - private SessionInterceptor sessionInterceptor; - - @Override - public void addInterceptors(InterceptorRegistry registry) { - // 添加拦截器 - registry.addInterceptor(sessionInterceptor) - .excludePathPatterns("") // 排除拦截器要拦截的路径 - .addPathPatterns("/**"); // 添加拦截器需要要拦截的路径 - - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/common/ExcelHeader.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/common/ExcelHeader.java deleted file mode 100644 index 8b8b041..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/common/ExcelHeader.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.risk.riskmanage.datamanage.common; - -public class ExcelHeader { - - public static final String[] fieldExcelHeader = { "字段编号", "字段名", "字段中文名", "字段类型", "字段值类型", "字段值范围", "是否衍生", "是否输出", "创建人" }; - - public static final String[] fieldExcelClass = { "id", "fieldEn", "fieldCn", "fieldType", "valueTypeName", "valueScope", "isDerivativeName", "isOutputName", "nickName" }; -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/common/ExcelUtil.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/common/ExcelUtil.java deleted file mode 100644 index 3380c4d..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/common/ExcelUtil.java +++ /dev/null @@ -1,666 +0,0 @@ -package com.risk.riskmanage.datamanage.common; - -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.lang.reflect.Field; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Iterator; -import java.util.List; - -import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.apache.poi.ss.usermodel.Cell; -import org.apache.poi.ss.usermodel.CellStyle; -import org.apache.poi.ss.usermodel.Font; -import org.apache.poi.ss.usermodel.IndexedColors; -import org.apache.poi.ss.usermodel.Row; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.ss.util.CellRangeAddress; -import org.apache.poi.xssf.streaming.SXSSFWorkbook; - -public class ExcelUtil { - - public static void exportFieldExcel(OutputStream out ,String exlType,String[] headers,String[] classNames, List list ) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException{ - Workbook workbook; - if (exlType.equalsIgnoreCase("xlsx")) { - // 2007以上 - workbook = new SXSSFWorkbook(200); - } else { - // 97-2003 - workbook = new HSSFWorkbook(); - } - Sheet sheet = workbook.createSheet("title"); - sheet.setColumnWidth((short)0, 10* 256); - sheet.setColumnWidth((short)1, 20* 256); - sheet.setColumnWidth((short)2, 20* 256); - sheet.setColumnWidth((short)3, 10* 256); - sheet.setColumnWidth((short)4, 10* 256); - sheet.setColumnWidth((short)5, 75* 256); -// sheet.setColumnWidth((short)6, 75* 256); - - - CellStyle cellStyle = workbook.createCellStyle(); - CellStyle cellStyle1 = workbook.createCellStyle(); - - Font font = workbook.createFont(); - Font font1 = workbook.createFont(); - - //微软雅黑,字体10,加粗,背景灰色 - font.setFontName("微软雅黑"); - font.setFontHeight((short) 240); - font.setBoldweight(Font.BOLDWEIGHT_BOLD); - cellStyle.setFont(font); - cellStyle.setAlignment(CellStyle.ALIGN_CENTER); // 指定单元格居中对齐 - cellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER); - cellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); - cellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND); - cellStyle.setWrapText(true); - cellStyle.setBorderBottom(CellStyle.BORDER_THIN); // 设置单无格的边框为粗体 - cellStyle.setBorderLeft(CellStyle.BORDER_THIN); - cellStyle.setBorderRight(CellStyle.BORDER_THIN); - cellStyle.setBorderTop(CellStyle.BORDER_THIN); - - //微软雅黑,字体10,加粗,背景灰色 - font1.setFontName("微软雅黑"); - font1.setFontHeight((short) 240); - cellStyle1.setFont(font1); - cellStyle1.setAlignment(CellStyle.ALIGN_LEFT); // 指定单元格居中对齐 - cellStyle1.setVerticalAlignment(CellStyle.VERTICAL_CENTER); - cellStyle1.setWrapText(true); - cellStyle1.setBorderBottom(CellStyle.BORDER_THIN); // 设置单无格的边框为粗体 - cellStyle1.setBorderLeft(CellStyle.BORDER_THIN); - cellStyle1.setBorderRight(CellStyle.BORDER_THIN); - cellStyle1.setBorderTop(CellStyle.BORDER_THIN); - - Row row = sheet.createRow(0); - row.setHeight((short) 400); - - for (short i = 0; i < headers.length; i++) { - Cell cell = row.createCell(i); - cell.setCellStyle(cellStyle); - cell.setCellValue(headers[i]); - } - Iterator it = list.iterator(); - int index = 0; - while (it.hasNext()) { - index++; - row = sheet.createRow(index); - row.setHeight((short) 400); - T t = it.next(); - if(null!=t){ - for (int j = 0; j < headers.length; j++) { - Cell cell = row.createCell(j); - Field field = t.getClass().getDeclaredField(classNames[j]); - field.setAccessible(true); - Class valType = field.getType(); - cell.setCellStyle(cellStyle1); - //数据转类型 - if("java.lang.String".equalsIgnoreCase( valType.getName())){ - cell.setCellValue((String) field.get(t)); - }else if("java.lang.Integer".equalsIgnoreCase(valType.getName())||"int".equalsIgnoreCase(valType.getName())){ - cell.setCellValue((Integer) field.get(t)); - }else if("java.lang.Double".equalsIgnoreCase(valType.getName())||"double".equalsIgnoreCase(valType.getName())){ - cell.setCellValue((Double) field.get(t)==null?0:(Double) field.get(t)); - }else if("java.lang.Long".equalsIgnoreCase(valType.getName())||"long".equalsIgnoreCase(valType.getName())){ - cell.setCellValue((Long) field.get(t)==null?0:(Long) field.get(t)); - }else if("java.util.Date".equalsIgnoreCase(valType.getName())) { - if(null==field.get(t)){ - cell.setCellValue(""); - }else { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); - cell.setCellValue(sdf.format((Date) field.get(t))); - } - } - field.setAccessible(false); - } - } - } - try { - workbook.write(out); - out.flush(); - out.close(); - out = null; - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } finally { - try { - if (out != null) - out.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - - /** - * 导出黑白名单库里的客户列表到excel(兼容黑白名单库的导入模版) - * - * @param sheet - * @param row - * @param column - * @return - */ - public static void exportCustListExcel(OutputStream out ,String exlType,String[] headers,String[] classNames, List list ) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException{ - Workbook workbook; - if (exlType.equalsIgnoreCase("xlsx")) { - // 2007以上 - workbook = new SXSSFWorkbook(200); - } else { - // 97-2003 - workbook = new HSSFWorkbook(); - } - Sheet sheet = workbook.createSheet("title"); - //默认20列 - sheet.setColumnWidth((short)0, 10* 256); - sheet.setColumnWidth((short)1, 10* 256); - sheet.setColumnWidth((short)2, 10* 256); - sheet.setColumnWidth((short)3, 10* 256); - sheet.setColumnWidth((short)4, 10* 256); - sheet.setColumnWidth((short)5, 10* 256); - sheet.setColumnWidth((short)6, 10* 256); - sheet.setColumnWidth((short)7, 10* 256); - sheet.setColumnWidth((short)8, 10* 256); - sheet.setColumnWidth((short)9, 10* 256); - sheet.setColumnWidth((short)10, 10* 256); - sheet.setColumnWidth((short)11, 10* 256); - sheet.setColumnWidth((short)12, 10* 256); - sheet.setColumnWidth((short)13, 10* 256); - sheet.setColumnWidth((short)14, 10* 256); - sheet.setColumnWidth((short)15, 10* 256); - sheet.setColumnWidth((short)16, 10* 256); - sheet.setColumnWidth((short)17, 10* 256); - sheet.setColumnWidth((short)18, 10* 256); - sheet.setColumnWidth((short)19, 10* 256); - - CellStyle cellStyle = workbook.createCellStyle(); - CellStyle cellStyle1 = workbook.createCellStyle(); - - Font font = workbook.createFont(); - Font font1 = workbook.createFont(); - - //微软雅黑,字体10,加粗,背景灰色 - font.setFontName("微软雅黑"); - font.setFontHeight((short) 240); - font.setBoldweight(Font.BOLDWEIGHT_BOLD); - cellStyle.setFont(font); - cellStyle.setAlignment(CellStyle.ALIGN_CENTER); // 指定单元格居中对齐 - cellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER); - cellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); - cellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND); - cellStyle.setWrapText(true); - cellStyle.setBorderBottom(CellStyle.BORDER_THIN); // 设置单无格的边框为粗体 - cellStyle.setBorderLeft(CellStyle.BORDER_THIN); - cellStyle.setBorderRight(CellStyle.BORDER_THIN); - cellStyle.setBorderTop(CellStyle.BORDER_THIN); - - //微软雅黑,字体10,加粗,背景灰色 - font1.setFontName("微软雅黑"); - font1.setFontHeight((short) 240); - cellStyle1.setFont(font1); - cellStyle1.setAlignment(CellStyle.ALIGN_LEFT); // 指定单元格居中对齐 - cellStyle1.setVerticalAlignment(CellStyle.VERTICAL_CENTER); - cellStyle1.setWrapText(true); - cellStyle1.setBorderBottom(CellStyle.BORDER_THIN); // 设置单无格的边框为粗体 - cellStyle1.setBorderLeft(CellStyle.BORDER_THIN); - cellStyle1.setBorderRight(CellStyle.BORDER_THIN); - cellStyle1.setBorderTop(CellStyle.BORDER_THIN); - - Row row = sheet.createRow(0); - row.setHeight((short) 400); - - for (short i = 0; i < headers.length; i++) { - Cell cell = row.createCell(i); - cell.setCellStyle(cellStyle); - cell.setCellValue(headers[i]); - } - Iterator it = list.iterator(); - int index = 0; - while (it.hasNext()) { - index++; - row = sheet.createRow(index); - row.setHeight((short) 400); - T t = it.next(); - if(null!=t){ - for (int j = 0; j < headers.length; j++) { - Cell cell = row.createCell(j); - Field field = t.getClass().getDeclaredField(classNames[j]); - field.setAccessible(true); - Class valType = field.getType(); - cell.setCellStyle(cellStyle1); - //数据转类型 - if("java.lang.String".equalsIgnoreCase( valType.getName())){ - cell.setCellValue((String) field.get(t)); - }else if("java.lang.Integer".equalsIgnoreCase(valType.getName())||"int".equalsIgnoreCase(valType.getName())){ - cell.setCellValue((Integer) field.get(t)); - }else if("java.lang.Double".equalsIgnoreCase(valType.getName())||"double".equalsIgnoreCase(valType.getName())){ - cell.setCellValue((Double) field.get(t)==null?0:(Double) field.get(t)); - }else if("java.lang.Long".equalsIgnoreCase(valType.getName())||"long".equalsIgnoreCase(valType.getName())){ - cell.setCellValue((Long) field.get(t)==null?0:(Long) field.get(t)); - }else if("java.util.Date".equalsIgnoreCase(valType.getName())) { - if(null==field.get(t)){ - cell.setCellValue(""); - }else { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); - cell.setCellValue(sdf.format((Date) field.get(t))); - } - } - field.setAccessible(false); - } - } - } - try { - workbook.write(out); - out.flush(); - out.close(); - out = null; - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } finally { - try { - if (out != null) - out.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - - /** - * 导出黑白名单库里的客户列表到excel(兼容黑白名单库的导入模版) - * - * @param sheet - * @param row - * @param column - * @return - */ - public static void createCustListExcel(String path, String exlType,String[] headers,String[] classNames, List list ) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException{ - Workbook workbook; - if (exlType.equalsIgnoreCase("xlsx")) { - // 2007以上 - workbook = new SXSSFWorkbook(200); - } else { - // 97-2003 - workbook = new HSSFWorkbook(); - } - Sheet sheet = workbook.createSheet("title"); - //默认20列 - sheet.setColumnWidth((short)0, 10* 256); - sheet.setColumnWidth((short)1, 10* 256); - sheet.setColumnWidth((short)2, 10* 256); - sheet.setColumnWidth((short)3, 10* 256); - sheet.setColumnWidth((short)4, 10* 256); - sheet.setColumnWidth((short)5, 10* 256); - sheet.setColumnWidth((short)6, 10* 256); - sheet.setColumnWidth((short)7, 10* 256); - sheet.setColumnWidth((short)8, 10* 256); - sheet.setColumnWidth((short)9, 10* 256); - sheet.setColumnWidth((short)10, 10* 256); - sheet.setColumnWidth((short)11, 10* 256); - sheet.setColumnWidth((short)12, 10* 256); - sheet.setColumnWidth((short)13, 10* 256); - sheet.setColumnWidth((short)14, 10* 256); - sheet.setColumnWidth((short)15, 10* 256); - sheet.setColumnWidth((short)16, 10* 256); - sheet.setColumnWidth((short)17, 10* 256); - sheet.setColumnWidth((short)18, 10* 256); - sheet.setColumnWidth((short)19, 10* 256); - - CellStyle cellStyle = workbook.createCellStyle(); - CellStyle cellStyle1 = workbook.createCellStyle(); - - Font font = workbook.createFont(); - Font font1 = workbook.createFont(); - - //微软雅黑,字体10,加粗,背景灰色 - font.setFontName("微软雅黑"); - font.setFontHeight((short) 240); - font.setBoldweight(Font.BOLDWEIGHT_BOLD); - cellStyle.setFont(font); - cellStyle.setAlignment(CellStyle.ALIGN_CENTER); // 指定单元格居中对齐 - cellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER); - cellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); - cellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND); - cellStyle.setWrapText(true); - cellStyle.setBorderBottom(CellStyle.BORDER_THIN); // 设置单无格的边框为粗体 - cellStyle.setBorderLeft(CellStyle.BORDER_THIN); - cellStyle.setBorderRight(CellStyle.BORDER_THIN); - cellStyle.setBorderTop(CellStyle.BORDER_THIN); - - //微软雅黑,字体10,加粗,背景灰色 - font1.setFontName("微软雅黑"); - font1.setFontHeight((short) 240); - cellStyle1.setFont(font1); - cellStyle1.setAlignment(CellStyle.ALIGN_LEFT); // 指定单元格居中对齐 - cellStyle1.setVerticalAlignment(CellStyle.VERTICAL_CENTER); - cellStyle1.setWrapText(true); - cellStyle1.setBorderBottom(CellStyle.BORDER_THIN); // 设置单无格的边框为粗体 - cellStyle1.setBorderLeft(CellStyle.BORDER_THIN); - cellStyle1.setBorderRight(CellStyle.BORDER_THIN); - cellStyle1.setBorderTop(CellStyle.BORDER_THIN); - - Row row = sheet.createRow(0); - row.setHeight((short) 400); - - for (short i = 0; i < headers.length; i++) { - Cell cell = row.createCell(i); - cell.setCellStyle(cellStyle); - cell.setCellValue(headers[i]); - } - Iterator it = list.iterator(); - int index = 0; - while (it.hasNext()) { - index++; - row = sheet.createRow(index); - row.setHeight((short) 400); - T t = it.next(); - if(null!=t){ - for (int j = 0; j < headers.length; j++) { - Cell cell = row.createCell(j); - Field field = t.getClass().getDeclaredField(classNames[j]); - field.setAccessible(true); - Class valType = field.getType(); - cell.setCellStyle(cellStyle1); - //数据转类型 - if("java.lang.String".equalsIgnoreCase( valType.getName())){ - cell.setCellValue((String) field.get(t)); - }else if("java.lang.Integer".equalsIgnoreCase(valType.getName())||"int".equalsIgnoreCase(valType.getName())){ - cell.setCellValue((Integer) field.get(t)); - }else if("java.lang.Double".equalsIgnoreCase(valType.getName())||"double".equalsIgnoreCase(valType.getName())){ - cell.setCellValue((Double) field.get(t)==null?0:(Double) field.get(t)); - }else if("java.lang.Long".equalsIgnoreCase(valType.getName())||"long".equalsIgnoreCase(valType.getName())){ - cell.setCellValue((Long) field.get(t)==null?0:(Long) field.get(t)); - }else if("java.util.Date".equalsIgnoreCase(valType.getName())) { - if(null==field.get(t)){ - cell.setCellValue(""); - }else { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); - cell.setCellValue(sdf.format((Date) field.get(t))); - } - } - field.setAccessible(false); - } - } - } - try { - FileOutputStream output=new FileOutputStream(path); - workbook.write(output); - output.close(); - output = null; - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } finally { - } - } - - /** - * 导出引擎批量测试结果到excel - * - * @param sheet - * @param row - * @param column - * @return - */ - public static void exportEngineTestResultExcel(OutputStream out ,String exlType,String[] headers,String[] classNames, List list ) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException{ - Workbook workbook; - if (exlType.equalsIgnoreCase("xlsx")) { - // 2007以上 - workbook = new SXSSFWorkbook(200); - } else { - // 97-2003 - workbook = new HSSFWorkbook(); - } - Sheet sheet = workbook.createSheet("title"); - - sheet.setColumnWidth((short)0, 10* 256); - sheet.setColumnWidth((short)1, 15* 256); - sheet.setColumnWidth((short)2, 15* 256); - sheet.setColumnWidth((short)3, 15* 256); - sheet.setColumnWidth((short)4, 15* 256); - sheet.setColumnWidth((short)5, 15* 256); - sheet.setColumnWidth((short)6, 20* 256); - sheet.setColumnWidth((short)7, 20* 256); - - CellStyle cellStyle = workbook.createCellStyle(); - CellStyle cellStyle1 = workbook.createCellStyle(); - - Font font = workbook.createFont(); - Font font1 = workbook.createFont(); - - //微软雅黑,字体10,加粗,背景灰色 - font.setFontName("微软雅黑"); - font.setFontHeight((short) 240); - font.setBoldweight(Font.BOLDWEIGHT_BOLD); - cellStyle.setFont(font); - cellStyle.setAlignment(CellStyle.ALIGN_CENTER); // 指定单元格居中对齐 - cellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER); - cellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); - cellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND); - cellStyle.setWrapText(true); - cellStyle.setBorderBottom(CellStyle.BORDER_THIN); // 设置单无格的边框为粗体 - cellStyle.setBorderLeft(CellStyle.BORDER_THIN); - cellStyle.setBorderRight(CellStyle.BORDER_THIN); - cellStyle.setBorderTop(CellStyle.BORDER_THIN); - - //微软雅黑,字体10,加粗,背景灰色 - font1.setFontName("微软雅黑"); - font1.setFontHeight((short) 240); - cellStyle1.setFont(font1); - cellStyle1.setAlignment(CellStyle.ALIGN_LEFT); // 指定单元格居中对齐 - cellStyle1.setVerticalAlignment(CellStyle.VERTICAL_CENTER); - cellStyle1.setWrapText(true); - cellStyle1.setBorderBottom(CellStyle.BORDER_THIN); // 设置单无格的边框为粗体 - cellStyle1.setBorderLeft(CellStyle.BORDER_THIN); - cellStyle1.setBorderRight(CellStyle.BORDER_THIN); - cellStyle1.setBorderTop(CellStyle.BORDER_THIN); - - Row row = sheet.createRow(0); - row.setHeight((short) 400); - - for (short i = 0; i < headers.length; i++) { - Cell cell = row.createCell(i); - cell.setCellStyle(cellStyle); - cell.setCellValue(headers[i]); - } - Iterator it = list.iterator(); - int index = 0; - while (it.hasNext()) { - index++; - row = sheet.createRow(index); - row.setHeight((short) 400); - T t = it.next(); - if(null!=t){ - for (int j = 0; j < headers.length; j++) { - Cell cell = row.createCell(j); - Field field = t.getClass().getDeclaredField(classNames[j]); - field.setAccessible(true); - Class valType = field.getType(); - cell.setCellStyle(cellStyle1); - //数据转类型 - if("java.lang.String".equalsIgnoreCase( valType.getName())){ - cell.setCellValue((String) field.get(t)); - }else if("java.lang.Integer".equalsIgnoreCase(valType.getName())||"int".equalsIgnoreCase(valType.getName())){ - cell.setCellValue((Integer) field.get(t)); - }else if("java.lang.Double".equalsIgnoreCase(valType.getName())||"double".equalsIgnoreCase(valType.getName())){ - cell.setCellValue((Double) field.get(t)==null?0:(Double) field.get(t)); - }else if("java.lang.Long".equalsIgnoreCase(valType.getName())||"long".equalsIgnoreCase(valType.getName())){ - cell.setCellValue((Long) field.get(t)==null?0:(Long) field.get(t)); - }else if("java.util.Date".equalsIgnoreCase(valType.getName())) { - if(null==field.get(t)){ - cell.setCellValue(""); - }else { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd"); - cell.setCellValue(sdf.format((Date) field.get(t))); - } - } - field.setAccessible(false); - } - } - } - try { - workbook.write(out); - out.flush(); - out.close(); - out = null; - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } finally { - try { - if (out != null) - out.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - - /** - * 获取合并单元格的值 - * - * @param sheet - * @param row - * @param column - * @return - */ - public static String getMergedRegionValue(Sheet sheet, int row, int column) { - int sheetMergeCount = sheet.getNumMergedRegions(); - - for (int i = 0; i < sheetMergeCount; i++) { - CellRangeAddress ca = sheet.getMergedRegion(i); - int firstColumn = ca.getFirstColumn(); - int lastColumn = ca.getLastColumn(); - int firstRow = ca.getFirstRow(); - int lastRow = ca.getLastRow(); - - if (row >= firstRow && row <= lastRow) { - - if (column >= firstColumn && column <= lastColumn) { - Row fRow = sheet.getRow(firstRow); - Cell fCell = fRow.getCell(firstColumn); - return getCellValue(fCell); - } - } - } - - return null; - } - - /** - * 判断合并行 - * - * @param sheet - * @param row - * @param column - * @return - */ - public static boolean isMergedRow(Sheet sheet, int row, int column) { - int sheetMergeCount = sheet.getNumMergedRegions(); - for (int i = 0; i < sheetMergeCount; i++) { - CellRangeAddress range = sheet.getMergedRegion(i); - int firstColumn = range.getFirstColumn(); - int lastColumn = range.getLastColumn(); - int firstRow = range.getFirstRow(); - int lastRow = range.getLastRow(); - if (row == firstRow && row == lastRow) { - if (column >= firstColumn && column <= lastColumn) { - return true; - } - } - } - return false; - } - - /** - * 判断合并列 - * - * @param sheet - * @param row - * @param column - * @return - */ - public static boolean isMergedCol(Sheet sheet, int row, int column) { - int sheetMergeCount = sheet.getNumMergedRegions(); - for (int i = 0; i < sheetMergeCount; i++) { - CellRangeAddress range = sheet.getMergedRegion(i); - int firstColumn = range.getFirstColumn(); - int lastColumn = range.getLastColumn(); - int firstRow = range.getFirstRow(); - int lastRow = range.getLastRow(); - if(column== firstColumn && column==lastColumn){ - if (row>=firstRow&& row<=lastRow){ - return true; - } - } - } - return false; - } - - /** - * 判断指定的单元格是否是合并单元格 - * - * @param sheet - * @param row - * 行下标 - * @param column - * 列下标 - * @return - */ - public static boolean isMergedRegion(Sheet sheet, int row, int column) { - int sheetMergeCount = sheet.getNumMergedRegions(); - for (int i = 0; i < sheetMergeCount; i++) { - CellRangeAddress range = sheet.getMergedRegion(i); - int firstColumn = range.getFirstColumn(); - int lastColumn = range.getLastColumn(); - int firstRow = range.getFirstRow(); - int lastRow = range.getLastRow(); - if (row >= firstRow && row <= lastRow) { - if (column >= firstColumn && column <= lastColumn) { - return true; - } - } - } - return false; - } - - /** - * 获取单元格的值 - * - * @param cell - * @return - */ - public static String getCellValue(Cell cell) { - - if (cell == null) - return ""; - - if (cell.getCellType() == Cell.CELL_TYPE_STRING) { - - return cell.getStringCellValue(); - - } else if (cell.getCellType() == Cell.CELL_TYPE_BOOLEAN) { - - return String.valueOf(cell.getBooleanCellValue()); - - } else if (cell.getCellType() == Cell.CELL_TYPE_FORMULA) { - - return cell.getCellFormula(); - - } else if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) { - - return String.valueOf(cell.getNumericCellValue()); - - } - return ""; - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/common/Status.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/common/Status.java deleted file mode 100644 index 34e9346..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/common/Status.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.risk.riskmanage.datamanage.common; - -public enum Status { - - enable(1), disable(0), delete(-1), yes(1), no(0); - public final int value; - - private Status(int value) { - this.value = value; - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/common/ValueType.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/common/ValueType.java deleted file mode 100644 index e200d41..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/common/ValueType.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.risk.riskmanage.datamanage.common; - -public enum ValueType { - - // 待选:0, 数值型:1, 字符型:2, 枚举型:3, 小数型:4, 数组型:5 - Unknown(0), Num(1), Char(2), Enum(3), Dec(4), Array(5); - - public final int value; - - private ValueType(int value) { - this.value = value; - } - - public int getValue(){ - return value; - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/controller/v2/FieldController.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/controller/v2/FieldController.java deleted file mode 100644 index 2257061..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/controller/v2/FieldController.java +++ /dev/null @@ -1,870 +0,0 @@ -package com.risk.riskmanage.datamanage.controller.v2; - -import com.alibaba.fastjson.JSONObject; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.risk.riskmanage.common.basefactory.BaseController; -import com.risk.riskmanage.common.constants.CommonConst; -import com.risk.riskmanage.common.constants.OpTypeConst; -import com.risk.riskmanage.common.enums.ErrorCodeEnum; -import com.risk.riskmanage.common.exception.ApiException; -import com.risk.riskmanage.common.model.ResponseEntityDto; -import com.risk.riskmanage.common.utils.ResponseEntityBuilder; -import com.risk.riskmanage.datamanage.common.ValueType; -import com.risk.riskmanage.datamanage.model.Field; -import com.risk.riskmanage.datamanage.model.FieldCond; -import com.risk.riskmanage.datamanage.model.FieldType; -import com.risk.riskmanage.datamanage.model.request.FieldSaveParam; -import com.risk.riskmanage.datamanage.model.request.FieldTreeParam; -import com.risk.riskmanage.datamanage.vo.FieldEnumVo; -import com.risk.riskmanage.datamanage.vo.FieldFormulaVo; -import com.risk.riskmanage.datamanage.vo.FieldSubCondVo; -import com.risk.riskmanage.logger.ArchivesLog; -import com.risk.riskmanage.system.model.User; -import com.risk.riskmanage.util.CollectionUtil; -import com.risk.riskmanage.util.SessionManager; -import com.risk.riskmanage.util.StringUtil; -import com.risk.riskmanage.common.model.requestParam.UpdateFolderParam; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.BeanUtils; -import org.springframework.core.io.ClassPathResource; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.multipart.MultipartHttpServletRequest; -import org.springframework.web.multipart.commons.CommonsMultipartResolver; - -import javax.servlet.http.HttpServletRequest; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.util.*; -import java.util.regex.Pattern; - -/** - * 提供field相关接口 - * - * @apiDefine field 2.指标管理 - */ -@Controller("fieldControllerV2") -@RequestMapping("/v2/datamanage/field") -@ResponseBody -public class FieldController extends BaseController { - - /** - * @api {POST} /v2/datamanage/field/listTree 2.01. 获取节点树 - * @apiGroup field - * @apiVersion 2.0.0 - * @apiParam {Integer} parentId parentId, 值为 0或 空字符串都行(此时获取的是所有文件夹目录) - * @apiParamExample {json} 请求示例: - * {} - * @apiSuccessExample {json} Success-Response: - * {"data":[{"userId":135,"organId":46,"status":1,"isCommon":1,"parentId":303,"children":[{"children":[{"children":[],"fieldType":"信用卡","icon":"../resource/images/authority/folder.png","id":306,"isCommon":1,"isParent":"true","page":0,"parentId":305,"rows":0}],"fieldType":"银行","icon":"../resource/images/authority/folder.png","id":305,"isCommon":1,"isParent":"true","page":0,"parentId":0,"rows":0},{"children":[{"children":[],"fieldType":"网点余额不足风险","icon":"../resource/images/authority/folder.png","id":304,"isCommon":1,"isParent":"true","page":0,"parentId":302,"rows":0},{"children":[],"fieldType":"代收货款与到付","icon":"../resource/images/authority/folder.png","id":303,"isCommon":1,"isParent":"true","page":0,"parentId":302,"rows":0}],"fieldType":"物流","icon":"../resource/images/authority/folder.png","id":302,"isCommon":1,"isParent":"true","page":0,"parentId":0,"rows":0}],"fieldType":"通用字段","id":99999999}],"error":"00000000","status":"1"} - */ - @RequestMapping(value = "/listTree", method = RequestMethod.POST) - public ResponseEntityDto listTree(@RequestBody Map paramMap) { - - User loginAccount = SessionManager.getLoginAccount(); - paramMap.put("userId", loginAccount.getUserId()); - paramMap.put("organId", loginAccount.getOrganId()); - paramMap.put("status", 1); - - Integer isCommon = 1; - Integer engineId = null; - if (paramMap.containsKey("engineId") && !paramMap.get("engineId").equals("")) { - isCommon = null; - engineId = Integer.valueOf((String) paramMap.get("engineId")).intValue(); - paramMap.put("engineId", engineId); - } else { - paramMap.put("engineId", null); - } - paramMap.put("isCommon", isCommon); - - List klist = s.fieldTypeService.getFieldTypeList(paramMap); - for (FieldType fieldTypeVo : klist) { - if (engineId != null && fieldTypeVo.getIsCommon() == 1) { - String fieldType = fieldTypeVo.getFieldType(); - fieldTypeVo.setFieldType(fieldType + "(通用)"); - } - paramMap.put("parentId", fieldTypeVo.getId()); - fieldTypeVo.setChildren(getChildren(paramMap)); - } - FieldType[] kArray = new FieldType[klist.size()]; - kArray = klist.toArray(kArray); - paramMap.put("children", kArray); - paramMap.put("fieldType", "通用字段"); - paramMap.put("id", 99999999); - - ArrayList list = new ArrayList<>(); - list.add(paramMap); - - return ResponseEntityBuilder.buildNormalResponse(list); - } - @RequestMapping(value = "/newListTree", method = RequestMethod.POST) - public ResponseEntityDto newListTree(@RequestBody FieldTreeParam param) { - if (param==null||param.getType()==null){ - throw new ApiException(ErrorCodeEnum.PARAMS_EXCEPTION.getCode(),ErrorCodeEnum.PARAMS_EXCEPTION.getMessage()); - } - List list = s.fieldTypeService.getTreeList(param); - Map paramMap=new HashMap<>(); - paramMap.put("children", list); - paramMap.put("fieldType", "通用字段"); - paramMap.put("id", 99999999); - List response= new ArrayList<>(); - response.add(paramMap); - return ResponseEntityBuilder.buildNormalResponse(response); - } - - /** - * getChildren:(获取树形节点的子节点信息) - * - * @param paramMap - * @return - */ - private FieldType[] getChildren(Map paramMap) { - List klist = s.fieldTypeService.getFieldTypeList(paramMap); - for (FieldType fieldTreeVo : klist) { - paramMap.put("parentId", fieldTreeVo.getId()); - fieldTreeVo.setChildren(getChildren(paramMap)); - } - FieldType[] kArray = new FieldType[klist.size()]; - kArray = klist.toArray(kArray); - return kArray; - } - - /** - * @api {POST} /v2/datamanage/field/addTree 2.02. 添加树节点 - * @apiGroup field - * @apiVersion 2.0.0 - * @apiParam {String} fieldType 文件夹的名字 - * @apiParam {String} parentId parentId - * @apiParam {Integer} [id] id可传可不传,无实际意义 - * @apiParamExample {json} Request: - * { - * "parentId": "302", - * "fieldType": "测试类型" - * } - * @apiSuccessExample {json} Success-Response: - * {"status":"1","error":"00000000","msg":null,"data":{"parentId":"302","fieldType":"测试类型","userId":135,"organId":46,"engineId":null,"isCommon":1,"fieldTypeId":365,"id":2810,"result":1}} - */ - @RequestMapping(value = "/addTree", method = RequestMethod.POST) - @ArchivesLog(operationType = OpTypeConst.SAVE_FILED_TREE) - public ResponseEntityDto addTree(@RequestBody Map paramMap) { - - // fieldTypeId, parentId, id - - User loginAccount = SessionManager.getLoginAccount(); - paramMap.put("userId", loginAccount.getUserId()); - paramMap.put("organId", loginAccount.getOrganId()); - - Integer isCommon = 1; - Integer engineId = null; - if (paramMap.containsKey("engineId") && !paramMap.get("engineId").equals("")) { - isCommon = 0; - engineId = Integer.valueOf((String) paramMap.get("engineId")).intValue(); - paramMap.put("engineId", engineId); - } else { - isCommon = 1; - paramMap.put("engineId", null); - } - paramMap.put("isCommon", isCommon); - - FieldType fieldTypeVo = new FieldType(); - fieldTypeVo.setIsCommon(isCommon); - fieldTypeVo.setParentId(Integer.valueOf( paramMap.get("parentId").toString())); - fieldTypeVo.setFieldType((String) paramMap.get("fieldType")); - fieldTypeVo.setType(Integer.valueOf(paramMap.get("type").toString())); - boolean flag = s.fieldTypeService.createFieldType(fieldTypeVo, paramMap); - if (flag) { - paramMap.put("result", 1); - } else { - paramMap.put("result", -1); - } - - return ResponseEntityBuilder.buildNormalResponse(paramMap); - } - - /** - * @api {POST} /v2/datamanage/field/updateTree 2.03. 修改树节点 - * @apiGroup field - * @apiVersion 2.0.0 - * @apiParam {Integer} id id - * @apiParam {String} fieldType 文件夹的名称 - * @apiParam {Integer} fieldType 文件夹的名称 - * @apiParam {String} [status] -1表示删除 - * @apiParamExample {json} Request: - * { - * "parentId":302, - * "fieldType": "测试哈哈类型", - * "id": 365, - * "status": 1 - * } - * @apiSuccessExample {json} Success-Response: - * {"status":"1","error":"00000000","msg":null,"data":{"parentId":302,"fieldType":"测试哈哈类型","id":365,"status":1,"userId":135,"engineId":null,"organId":46,"isCommon":1,"result":1}} - */ - @RequestMapping(value = "/updateTree", method = RequestMethod.POST) - @ArchivesLog(operationType = OpTypeConst.UPDATE_FILED_TREE) - public ResponseEntityDto updateTree(@RequestBody FieldTreeParam param) { - Integer status = param.getStatus(); - - boolean b = s.fieldTypeService.updateFieldType(param); - if (b){ - return ResponseEntityBuilder.buildNormalResponse(); - } - return ResponseEntityBuilder.buildErrorResponse("修改指标文件夹错误","修改指标文件夹错误"); -// int num = this.fieldTypeAjaxValidate(paramMap); -// if (num > 0) { -// throw new ApiException(ErrorCodeEnum.FIELD_TYPE_REPEAT.getVersionCode(), ErrorCodeEnum.FIELD_TYPE_REPEAT.getMessage()); -// } - -// User loginAccount = SessionManager.getLoginAccount(); -// paramMap.put("userId", loginAccount.getUserId()); -// paramMap.put("organId", loginAccount.getOrganId()); -// -// Integer isCommon = 1; -// Integer engineId = null; -// if (paramMap.containsKey("engineId") && paramMap.get("engineId") != null && !paramMap.get("engineId").equals("")) { -// isCommon = 0; -// engineId = Integer.valueOf((String) paramMap.get("engineId")).intValue(); -// paramMap.put("engineId", engineId); -// } else { -// isCommon = 1; -// paramMap.put("engineId", null); -// } -// -// paramMap.put("isCommon", isCommon); -// -// boolean flag = s.fieldTypeService.updateFieldType(paramMap); -// if (flag) { -// paramMap.put("result", 1); -// } else { -// paramMap.put("result", -1); -// } - - } - - private int fieldTypeAjaxValidate(Map paramMap) { - Long userId = SessionManager.getLoginAccount().getUserId(); - paramMap.put("userId", userId); - - if (!paramMap.containsKey("engineId")) { - paramMap.put("engineId", null); - } - - return s.fieldService.isExistsFieldType(paramMap); - } - - /** - * @api {POST} /v2/datamanage/field/list 2.04. 获取指标列表 - * @apiGroup field - * @apiVersion 2.0.0 - * @apiParam {Integer} isCommon isCommon 值为1时查询通用字段, 数据库管理不用传isCommon - * @apiParam {String} [fieldTypeId] 指标类型id,当fieldTypeId为空或不传时,查询的时整个通用字段下面的所有指标 - * @apiParam {Integer} pageNo 第几页,默认为 1 - * @apiParam {Integer} [pageSize] 每页的条数,默认为 10 - * @apiParamExample {json} Request: - * { - * "isCommon": 1, - * "fieldTypeId": 99999999, - * "pageNo": 1, - * "pageSize": 2 - * } - * @apiSuccessExample {json} Success-Response: - * {"status":"1","error":"00000000","msg":null,"data":{"fieldVos":[{"page":0,"rows":0,"total":null,"id":876,"fieldEn":"network_real_amount_derive","fieldCn":"网点余额衍生字段","fieldTypeId":302,"fieldType":"物流","valueType":1,"valueTypeName":null,"valueScope":"[-1,9999999)","isDerivative":1,"isDerivativeName":null,"isOutput":0,"isOutputName":null,"isCommon":1,"formula":"","formulaShow":"","usedFieldId":null,"origFieldId":null,"author":135,"nickName":"管理员","created":1615535468000,"engineId":null,"engineName":null,"status":"1","fieldCondList":null,"fieldRelId":null,"dataSourceId":null,"sqlStatement":null,"useSql":null},{"page":0,"rows":0,"total":null,"id":873,"fieldEn":"ziduan111733","fieldCn":"字段111733","fieldTypeId":327,"fieldType":"ddd","valueType":2,"valueTypeName":null,"valueScope":"qwer","isDerivative":0,"isDerivativeName":null,"isOutput":0,"isOutputName":null,"isCommon":1,"formula":"","formulaShow":"","usedFieldId":null,"origFieldId":null,"author":135,"nickName":"管理员","created":1615455268000,"engineId":null,"engineName":null,"status":"1","fieldCondList":null,"fieldRelId":null,"dataSourceId":null,"sqlStatement":null,"useSql":null}],"pager":{"pageNum":1,"pageSize":2,"size":2,"startRow":1,"endRow":2,"total":261,"pages":131,"list":[{"page":0,"rows":0,"total":null,"id":876,"fieldEn":"network_real_amount_derive","fieldCn":"网点余额衍生字段","fieldTypeId":302,"fieldType":"物流","valueType":1,"valueTypeName":null,"valueScope":"[-1,9999999)","isDerivative":1,"isDerivativeName":null,"isOutput":0,"isOutputName":null,"isCommon":1,"formula":"","formulaShow":"","usedFieldId":null,"origFieldId":null,"author":135,"nickName":"管理员","created":1615535468000,"engineId":null,"engineName":null,"status":"1","fieldCondList":null,"fieldRelId":null,"dataSourceId":null,"sqlStatement":null,"useSql":null},{"page":0,"rows":0,"total":null,"id":873,"fieldEn":"ziduan111733","fieldCn":"字段111733","fieldTypeId":327,"fieldType":"ddd","valueType":2,"valueTypeName":null,"valueScope":"qwer","isDerivative":0,"isDerivativeName":null,"isOutput":0,"isOutputName":null,"isCommon":1,"formula":"","formulaShow":"","usedFieldId":null,"origFieldId":null,"author":135,"nickName":"管理员","created":1615455268000,"engineId":null,"engineName":null,"status":"1","fieldCondList":null,"fieldRelId":null,"dataSourceId":null,"sqlStatement":null,"useSql":null}],"prePage":0,"nextPage":2,"isFirstPage":true,"isLastPage":false,"hasPreviousPage":false,"hasNextPage":true,"navigatePages":8,"navigatepageNums":[1,2,3,4,5,6,7,8],"navigateFirstPage":1,"navigateLastPage":8,"firstPage":1,"lastPage":8},"searchKey":null,"fieldTypeId":null,"engineId":null}} - */ - @RequestMapping(value = "/list", method = RequestMethod.POST) - public ResponseEntityDto list(@RequestBody HashMap paramMap) { - - if (paramMap.get("fieldTypeId") != null && paramMap.get("fieldTypeId").toString().equals("99999999")) { - paramMap.put("fieldTypeId", null); - } - - Integer pageNo = paramMap.get("pageNo") == null ? 1 : Integer.valueOf(paramMap.get("pageNo").toString()); - Integer pageSize = paramMap.get("pageSize") == null ? 10 : Integer.valueOf(paramMap.get("pageSize").toString()); - - User loginAccount = SessionManager.getLoginAccount(); - paramMap.put("userId", loginAccount.getUserId()); - paramMap.put("organId", loginAccount.getOrganId()); - - String searchKey = (String) paramMap.get("searchKey"); - paramMap.put("searchKey", null); - - if (!paramMap.containsKey("status")) - paramMap.put("status", null); - if (!paramMap.containsKey("engineId")) - paramMap.put("engineId", null); - - PageHelper.startPage(pageNo, pageSize); - List fieldList = s.fieldService.findByFieldType(paramMap); - PageInfo pageInfo = new PageInfo<>(fieldList); - - if (fieldList == null) { - return ResponseEntityBuilder.buildNormalResponse(null); - } - - HashMap modelMap = new HashMap<>(); - modelMap.put("pager", pageInfo); - modelMap.put("engineId", null); - modelMap.put("klist",pageInfo.getList()); - modelMap.put("searchKey", searchKey); - - return ResponseEntityBuilder.buildNormalResponse(modelMap); - } - - /** - * @api {POST} /v2/datamanage/field/updateStatus 2.05. 指标停用、启用、删除 - * @apiGroup field - * @apiVersion 2.0.0 - * @apiParam {Integer} status 0表示停用, 1表示启用, -1表示删除 - * @apiParam {String} ids id组成的字符串,用逗号分隔 - * @apiParam {Integer} fieldTypeId fieldTypeId 文件夹的id - * @apiParamExample {json} 请求示例: - * {"status":0,"ids":"820,819,818","fieldTypeId":303} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":{"status":0,"ids":"820,819,818","fieldTypeId":"303","userId":135,"organId":46,"engineId":null,"Ids":[820,819,818],"fieldId":818,"fieldIds":[818],"fieldList":[],"listDbList":[],"ruleList":[],"scorecardList":[],"nodelistDbList":[],"beUsed":false,"result":true}} - */ - @RequestMapping(value = "/updateStatus", method = RequestMethod.POST) - @ArchivesLog(operationType = OpTypeConst.UPDATE_FILED_STATUS) - public ResponseEntityDto updateStatus(@RequestBody Map param) { - - User loginAccount = SessionManager.getLoginAccount(); - param.put("userId", loginAccount.getUserId()); - param.put("organId", loginAccount.getOrganId()); - - param.put("engineId", null); - - String idsStr = (String) param.get("ids"); - List Ids = StringUtil.toLongList(idsStr); - param.put("Ids", Ids); - - String strFieldTypeId = String.valueOf(param.get("fieldTypeId")); - if (strFieldTypeId == null) { - strFieldTypeId = ""; - } - //Long fieldTypeId = s.fieldService.findFieldTypeId(param); - - s.fieldService.updateStatus(param); - - param.put("fieldTypeId", strFieldTypeId); - - return ResponseEntityBuilder.buildNormalResponse(param); - } - - /** - * @api {POST} /v2/datamanage/field/save 2.06. 添加指标 - * @apiGroup field - * @apiVersion 2.0.0 - * @apiParam {String} searchKey searchKey - * @apiParam {Long} [id] 指标ID - * @apiParam {String} formula 衍生字段公式 - * @apiParam {String} formulaShow 衍生字段公式回显信息 - * @apiParam {Long} engineId 归属的引擎ID - * @apiParam {String} fieldEn 指标英文名:拼接前缀"f_" - * @apiParam {String} fieldCn 指标中文名 - * @apiParam {Long} fieldTypeId 字段类型编号 - * @apiParam {Integer} valueType 字段存值类型,待选(0),数值型(1),字符型(2),枚举型(3),小数型(4) - * @apiParam {Integer} isDerivative 是否衍生字段,0代表不是,1代表是 - * @apiParam {Integer} isOutput 是否输出字段,0代表不是,1代表是 - * @apiParam {String} valueScope 字段约束范围 - * @apiParam {JSONArray} fieldCondList 条件区域内容(传字符串) - * @apiParam (fieldCondList) {String} conditionValue 字段条件值 - * @apiParam (fieldCondList) {JSONArray} fieldSubCond 字段列表 - * @apiParam (fieldSubCond) {String} fieldId 条件字段编号 - * @apiParam (fieldSubCond) {String} operator 条件字段的运算符 - * @apiParam (fieldSubCond) {String} fieldValue 条件字段的条件设置值 - * @apiParam (fieldSubCond) {String} logical 条件字段间的逻辑符 - * @apiParam {JSONArray} formulaHidden 公式编辑、groovy脚本内容(传字符串) - * @apiParam (formulaHidden) {String} formula 衍生字段公式 - * @apiParam (formulaHidden) {String} idx 下标 - * @apiParam (formulaHidden) {JSONArray} farr 字段列表 - * @apiParam (farr) {String} fieldCN 字段中文名 - * @apiParam (farr) {String} fieldCond 字段条件区域 - * @apiParam {Boolean} isUseSql 是否使用sql获取指标 - * @apiParam {Integer} dataSourceId 使用sql获取指标时对应的数据源 - * @apiParam {String} sqlStatement 使用sql获取指标时对应的sql语句 - * @apiSuccess {String} status 状态: 1成功, 0失败 - * @apiParamExample {json} 请求示例: - * {"searchKey":"","fieldTypeId":"302","id":"","formula":"","formulaShow":"","engineId":"","fieldEn":"f_f_f_network_real_amount_derive","fieldCn":"网点余额衍生字段","valueType":"1","isDerivative":"1","isOutput":"0","valueScope":"[-1,9999999)","fieldCondList":[{"fieldSubCond":[{"fieldId":"824","operator":">","fieldValue":"2000","logical":"&&"},{"fieldId":"826","operator":"<","fieldValue":"5000"}],"conditionValue":"666"},{"fieldSubCond":[{"fieldId":"824","operator":"<=","fieldValue":"2000","logical":"&&"},{"fieldId":"826","operator":"<","fieldValue":"5000"}],"conditionValue":"888"}],"formulaHidden":[{"fvalue":"","formula":"@同盾_评分@ - @第三方分值@ ","idx":"0","farr":[{"fieldCN":"同盾_评分","fieldCond":""},{"fieldCN":"第三方分值 ","fieldCond":""}]}],"isUseSql":"0","dataSourceId":null,"sqlStatement":""} - * @apiSuccessExample {json} 成功返回数据示例: - * {} - */ - @RequestMapping(value = "/save", method = RequestMethod.POST) - @ArchivesLog(operationType = OpTypeConst.SAVE_FILED) - public ResponseEntityDto save(@RequestBody FieldSaveParam fieldSaveParam) { - - Field fieldVo = new Field(); - BeanUtils.copyProperties(fieldSaveParam, fieldVo); - fieldVo.setUseSql(fieldSaveParam.getIsUseSql()); - fieldVo.setInterface(fieldSaveParam.getIsInterface());//是否使用接口 - Map param = JSONObject.parseObject(JSONObject.toJSONString(fieldSaveParam), Map.class); - s.fieldService.sqlFieldCheck(param); - // 校验 - HashMap fieldEnValidateMap = new HashMap<>(); - fieldEnValidateMap.put("fieldEn", param.get("fieldEn")); - fieldEnValidateMap.put("engineId", param.get("engineId")); - fieldEnValidateMap.put("Id", param.get("id")); - int fieldEnNum = fieldEnAjaxValidate(fieldEnValidateMap); - if (fieldEnNum > 0) { - throw new ApiException(ErrorCodeEnum.FIELD_EN_REPEAT.getCode(), ErrorCodeEnum.FIELD_EN_REPEAT.getMessage()); - } - - HashMap fieldCnValidateMap = new HashMap<>(); - fieldCnValidateMap.put("fieldCn", param.get("fieldCn")); - fieldCnValidateMap.put("engineId", param.get("engineId")); - fieldCnValidateMap.put("Id", param.get("id")); - int fieldCnNum = fieldCnAjaxValidate(fieldCnValidateMap); - if (fieldCnNum > 0) { - throw new ApiException(ErrorCodeEnum.FIELD_CN_REPEAT.getCode(), ErrorCodeEnum.FIELD_CN_REPEAT.getMessage()); - } - - Long userId = SessionManager.getLoginAccount().getUserId(); - Long organId = SessionManager.getLoginAccount().getOrganId(); - param.put("userId", userId); - fieldVo.setAuthor(userId); - fieldVo.setOrganId(organId); - - //校验字段英文名命名 - String fieldEn = fieldVo.getFieldEn(); - Pattern.matches("\\[A-z]|_|d+", fieldEn); - - param.put("fieldEn", fieldVo.getFieldEn()); - param.put("fieldCn", fieldVo.getFieldCn()); - param.put("organId", organId); - param.put("engineId", null); - //组织通用字段 - Integer isCommon = 1; - fieldVo.setIsCommon(isCommon); -// String formulaFields = "1,2,3,4"; -// param.put("formulaFields", formulaFields); - - s.fieldService.createField(fieldVo, param); - - // model.addAttribute("engineId", null); - // model.addAttribute("fieldTypeId", Long.valueOf(fieldVo.getFieldTypeId())); - // model.addAttribute("isCommon", 1); - HashMap modelMap = new HashMap<>(); - modelMap.put("engineId", null); - modelMap.put("fieldTypeId", Long.valueOf(fieldVo.getFieldTypeId())); - modelMap.put("isCommon", 1); - - return ResponseEntityBuilder.buildNormalResponse(modelMap); - } - - /** - * @api {POST} /v2/datamanage/field/getFieldInfo/{id} 2.07. 获取指标详情 - * @apiGroup field - * @apiVersion 2.0.0 - * @apiParam {Integer} id 路径参数{id}:指标的id - * @apiSuccess {String} status 状态: 1成功, 0失败 - * @apiParamExample {json} 请求示例: - * {} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":{"hasGroovy":null,"fieldFormulaList":[],"fieldVo":{"page":0,"rows":0,"total":null,"id":876,"fieldEn":"network_real_amount_derive","fieldCn":"网点余额衍生字段","fieldTypeId":302,"fieldType":"物流","valueType":1,"valueTypeName":null,"valueScope":"[-1,9999999)","isDerivative":1,"isDerivativeName":null,"isOutput":0,"isOutputName":null,"isCommon":1,"formula":"","formulaShow":"","usedFieldId":"824,826","origFieldId":"824,826","author":null,"nickName":null,"created":null,"engineId":null,"engineName":null,"status":null,"fieldCondList":[{"page":0,"rows":0,"total":null,"id":null,"fieldId":876,"conditionValue":"777","content":"[{\"fieldId\":\"824\",\"operator\":\">\",\"fieldValue\":\"2000\",\"logical\":\"&&\"},{\"fieldId\":\"826\",\"operator\":\"<\",\"fieldValue\":\"5000\"}]","condFieldId":null,"condFieldOperator":null,"condFieldValue":null,"condFieldLogical":null,"created":null,"fieldSubCond":[{"fieldId":824,"operator":">","fieldValue":"2000","logical":"&&","valueType":1,"valueScope":"[-1,9999999)","values":["[-1,9999999)"],"fieldCn":"网点实际余额"},{"fieldId":826,"operator":"<","fieldValue":"5000","logical":null,"valueType":1,"valueScope":"[-1,9999999)","values":["[-1,9999999)"],"fieldCn":"网点关闭余额"}]},{"page":0,"rows":0,"total":null,"id":null,"fieldId":876,"conditionValue":"999","content":"[{\"fieldId\":\"824\",\"operator\":\"<=\",\"fieldValue\":\"2000\",\"logical\":\"&&\"},{\"fieldId\":\"826\",\"operator\":\"<\",\"fieldValue\":\"5000\"}]","condFieldId":null,"condFieldOperator":null,"condFieldValue":null,"condFieldLogical":null,"created":null,"fieldSubCond":[{"fieldId":824,"operator":"<=","fieldValue":"2000","logical":"&&","valueType":1,"valueScope":"[-1,9999999)","values":["[-1,9999999)"],"fieldCn":"网点实际余额"},{"fieldId":826,"operator":"<","fieldValue":"5000","logical":null,"valueType":1,"valueScope":"[-1,9999999)","values":["[-1,9999999)"],"fieldCn":"网点关闭余额"}]}],"fieldRelId":null,"dataSourceId":null,"sqlStatement":null,"useSql":null},"scopeList":["[-1","9999999)"],"searchKey":null,"fieldTypeId":302,"hasFormula":null,"engineId":null}} - */ - @RequestMapping(value = "/getFieldInfo/{id}", method = RequestMethod.POST) - public ResponseEntityDto getFieldInfo(@PathVariable long id, @RequestBody Map param) { - - Map paramMap = new HashMap<>(); - Long userId = SessionManager.getLoginAccount().getUserId(); - Long organId = SessionManager.getLoginAccount().getOrganId(); - paramMap.put("userId", userId); - paramMap.put("organId", organId); - paramMap.put("engineId", null); - paramMap.put("id", id); - paramMap.put("searchKey", param.get("searchKey")); - - Field fieldVo = s.fieldService.findByFieldId(paramMap); - - String fieldEn = fieldVo.getFieldEn(); - if (!fieldEn.equals("") && fieldEn != null) { -// fieldEn = fieldEn.replace("f_", ""); - fieldVo.setFieldEn(fieldEn); - } - - for (FieldCond f : fieldVo.getFieldCondList()) { - - List fieldSubCondList = JSONObject.parseArray(f.getContent(), FieldSubCondVo.class); - for (FieldSubCondVo fs : fieldSubCondList) { - Map paramMap2 = new HashMap(); - paramMap2.put("userId", userId); - paramMap2.put("organId", organId); - paramMap2.put("id", fs.getFieldId()); - - Field subField = s.fieldService.findByFieldId(paramMap2); - - fs.setValueType(subField.getValueType()); - fs.setValueScope(subField.getValueScope()); - fs.setFieldCn(subField.getFieldCn()); - } - f.setFieldSubCond(fieldSubCondList); - } - - //编辑页面返回字段列表时去掉自己 - paramMap.put("fieldId", id); -// List flist = s.fieldService.findByUser(paramMap); - String valueScope = fieldVo.getValueScope(); - List scopeList = null; - if(StringUtils.isNotBlank(valueScope)){ - scopeList = Arrays.asList(valueScope.split(",")); - } - - List fieldFormulaList = new ArrayList(); - String hasGroovy = null; - if (fieldVo.getFormulaShow() != null && !fieldVo.getFormulaShow().equals("")) { - fieldFormulaList = JSONObject.parseArray(fieldVo.getFormulaShow(), FieldFormulaVo.class); - - for (FieldFormulaVo fieldFormulaVo : fieldFormulaList) { - if (fieldFormulaVo.getFormula() != null && fieldFormulaVo.getFormula().contains("def main")) { - hasGroovy = "y"; - } - } - } - - String hasFormula = null; - if (StringUtils.isNotBlank(fieldVo.getFormula())) { - hasFormula = "y"; - } - - // model.addAttribute("fieldVo", fieldVo); - // model.addAttribute("hasFormula", hasFormula); - // model.addAttribute("hasGroovy", hasGroovy); - // model.addAttribute("engineId", null); - // model.addAttribute("fieldTypeId", Long.valueOf(fieldVo.getFieldTypeId())); - // model.addAttribute("searchKey", param.get("searchKey")); - // model.addAttribute("flist", flist); - // model.addAttribute("scopeList", scopeList); - // model.addAttribute("fieldFormulaList", fieldFormulaList); - HashMap modelMap = new HashMap<>(); - modelMap.put("fieldVo", fieldVo); - modelMap.put("hasFormula", hasFormula); - modelMap.put("hasGroovy", hasGroovy); - modelMap.put("engineId", null); - modelMap.put("fieldTypeId", Long.valueOf(fieldVo.getFieldTypeId())); - modelMap.put("searchKey", param.get("searchKey")); -// modelMap.put("flist", flist); - modelMap.put("scopeList", scopeList); - modelMap.put("fieldFormulaList", fieldFormulaList); - - return ResponseEntityBuilder.buildNormalResponse(modelMap); - } - - /** - * @api {POST} /v2/datamanage/field/update 2.08. 编辑指标 - * @apiGroup field - * @apiVersion 2.0.0 - * @apiParam {String} searchKey searchKey - * @apiParam {Long} id 指标ID - * @apiParam {String} formula 衍生字段公式 - * @apiParam {String} formulaShow 衍生字段公式回显信息 - * @apiParam {Long} engineId 归属的引擎ID - * @apiParam {String} fieldEn 指标英文名:拼接前缀"f_" - * @apiParam {String} fieldCn 指标中文名 - * @apiParam {Long} fieldTypeId 字段类型编号 - * @apiParam {Integer} valueType 字段存值类型,待选(0),数值型(1),字符型(2),枚举型(3),小数型(4) - * @apiParam {Integer} isDerivative 是否衍生字段,0代表不是,1代表是 - * @apiParam {Integer} isOutput 是否输出字段,0代表不是,1代表是 - * @apiParam {String} valueScope 字段约束范围 - * @apiParam {JSONArray} fieldCondList 条件区域内容(传字符串) - * @apiParam (fieldCondList) {String} conditionValue 字段条件值 - * @apiParam (fieldCondList) {JSONArray} fieldSubCond 字段列表 - * @apiParam (fieldSubCond) {String} fieldId 条件字段编号 - * @apiParam (fieldSubCond) {String} operator 条件字段的运算符 - * @apiParam (fieldSubCond) {String} fieldValue 条件字段的条件设置值 - * @apiParam (fieldSubCond) {String} logical 条件字段间的逻辑符 - * @apiParam {JSONArray} formulaHidden 公式编辑、groovy脚本内容(传字符串) - * @apiParam (formulaHidden) {String} formula 衍生字段公式 - * @apiParam (formulaHidden) {String} idx 下标 - * @apiParam (formulaHidden) {JSONArray} farr 字段列表 - * @apiParam (farr) {String} fieldCN 字段中文名 - * @apiParam (farr) {String} fieldCond 字段条件区域 - * @apiParam {Boolean} isUseSql 是否使用sql获取指标 - * @apiParam {Integer} dataSourceId 使用sql获取指标时对应的数据源 - * @apiParam {String} sqlStatement 使用sql获取指标时对应的sql语句 - * @apiSuccess {String} status 状态: 1成功, 0失败 - * @apiParamExample {json} 请求示例: - * {"searchKey":"","fieldTypeId":"302","id":876,"formula":"","formulaShow":"","engineId":"","fieldEn":"f_f_f_network_real_amount_derive","fieldCn":"网点余额衍生字段","valueType":"1","isDerivative":"1","isOutput":"0","valueScope":"[-1,9999999)","fieldCondList":[{"fieldSubCond":[{"fieldId":"824","operator":">","fieldValue":"2000","logical":"&&"},{"fieldId":"826","operator":"<","fieldValue":"5000"}],"conditionValue":"666"},{"fieldSubCond":[{"fieldId":"824","operator":"<=","fieldValue":"2000","logical":"&&"},{"fieldId":"826","operator":"<","fieldValue":"5000"}],"conditionValue":"888"}],"formulaHidden":[{"fvalue":"","formula":"@同盾_评分@ - @第三方分值@ ","idx":"0","farr":[{"fieldCN":"同盾_评分","fieldCond":""},{"fieldCN":"第三方分值 ","fieldCond":""}]}],"isUseSql":"0","dataSourceId":null,"sqlStatement":""} - * @apiSuccessExample {json} 成功返回数据示例: - * {} - */ - @RequestMapping(value = "/update", method = RequestMethod.POST) - @ArchivesLog(operationType = OpTypeConst.UPDATE_FILED) - public ResponseEntityDto update(@RequestBody FieldSaveParam fieldSaveParam) { - - Map paramMap = JSONObject.parseObject(JSONObject.toJSONString(fieldSaveParam), Map.class); - - // 校验 - HashMap fieldEnValidateMap = new HashMap<>(); - fieldEnValidateMap.put("fieldEn", paramMap.get("fieldEn")); - fieldEnValidateMap.put("engineId", paramMap.get("engineId")); - fieldEnValidateMap.put("Id", paramMap.get("id")); - int fieldEnNum = fieldEnAjaxValidate(fieldEnValidateMap); - if (fieldEnNum > 0) { - throw new ApiException(ErrorCodeEnum.FIELD_EN_REPEAT.getCode(), ErrorCodeEnum.FIELD_EN_REPEAT.getMessage()); - } - s.fieldService.sqlFieldCheck(paramMap); - HashMap fieldCnValidateMap = new HashMap<>(); - fieldCnValidateMap.put("fieldCn", paramMap.get("fieldCn")); - fieldCnValidateMap.put("engineId", paramMap.get("engineId")); - fieldCnValidateMap.put("Id", paramMap.get("id")); - int fieldCnNum = fieldCnAjaxValidate(fieldCnValidateMap); - if (fieldCnNum > 0) { - throw new ApiException(ErrorCodeEnum.FIELD_CN_REPEAT.getCode(), ErrorCodeEnum.FIELD_CN_REPEAT.getMessage()); - } - - HashMap checkFieldMap = new HashMap<>(); - checkFieldMap.put("fieldId", paramMap.get("id").toString()); - Map checkFieldresult = checkField(checkFieldMap); - boolean beUsed = (boolean) checkFieldresult.get("beUsed"); - if (beUsed) { - throw new ApiException(ErrorCodeEnum.FIELD_BE_USERD.getCode(), ErrorCodeEnum.FIELD_BE_USERD.getMessage()); - } - - Long userId = SessionManager.getLoginAccount().getUserId(); - Long organId = SessionManager.getLoginAccount().getOrganId(); - paramMap.put("userId", userId); - paramMap.put("organId", organId); - - paramMap.put("engineId", null); - //组织通用字段 - Integer isCommon = 1; - paramMap.put("isCommon", isCommon); -// String formulaFields = "50,70,90"; -// paramMap.put("formulaFields", formulaFields); - - s.fieldService.updateField(paramMap); - - // model.addAttribute("engineId", null); - // model.addAttribute("fieldTypeId", fieldTypeId); - // model.addAttribute("searchKey", paramMap.get("searchKey")); - // model.addAttribute("isCommon", 1); - - HashMap modelMap = new HashMap<>(); - modelMap.put("engineId", null); - //modelMap.put("fieldTypeId",fieldTypeId); - modelMap.put("searchKey", paramMap.get("searchKey")); - modelMap.put("isCommon", 1); - - return ResponseEntityBuilder.buildNormalResponse(modelMap); - } - - /** - * @api {POST} /v2/datamanage/field/findFieldByUser 2.09. 获当前用户的所有指标 - * @apiGroup field - * @apiVersion 2.0.0 - * @apiParam {String} [searchKey] searchKey - * @apiParam {String} [engineId] engineId - * @apiParam {String} [fieldId] fieldId - * @apiSuccess {String} status 状态: 1成功, 0失败 - * @apiParamExample {json} 请求示例: - * {} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":{"organId":46,"isCommon":1,"searchKey":"","userId":135,"fieldList":[{"page":0,"rows":0,"total":null,"id":587,"fieldEn":"f_hr_age","fieldCn":"年龄准入","fieldTypeId":270,"fieldType":"准入","valueType":1,"valueTypeName":null,"valueScope":"(-1,999999]","isDerivative":null,"isDerivativeName":null,"isOutput":null,"isOutputName":null,"isCommon":null,"formula":null,"formulaShow":null,"usedFieldId":null,"origFieldId":null,"author":null,"nickName":null,"created":null,"engineId":null,"engineName":null,"status":null,"fieldCondList":null,"fieldRelId":8739,"dataSourceId":null,"sqlStatement":null,"useSql":null},{"page":0,"rows":0,"total":null,"id":871,"fieldEn":"f_ziduan111428","fieldCn":"字段111428","fieldTypeId":362,"fieldType":"3月11日测试","valueType":2,"valueTypeName":null,"valueScope":"qwer","isDerivative":null,"isDerivativeName":null,"isOutput":null,"isOutputName":null,"isCommon":null,"formula":null,"formulaShow":null,"usedFieldId":null,"origFieldId":null,"author":null,"nickName":null,"created":null,"engineId":null,"engineName":null,"status":null,"fieldCondList":null,"fieldRelId":10294,"dataSourceId":null,"sqlStatement":null,"useSql":null},{"page":0,"rows":0,"total":null,"id":872,"fieldEn":"f_ziduan111518","fieldCn":"字段111518","fieldTypeId":327,"fieldType":"ddd","valueType":2,"valueTypeName":null,"valueScope":"qwer","isDerivative":null,"isDerivativeName":null,"isOutput":null,"isOutputName":null,"isCommon":null,"formula":null,"formulaShow":null,"usedFieldId":null,"origFieldId":null,"author":null,"nickName":null,"created":null,"engineId":null,"engineName":null,"status":null,"fieldCondList":null,"fieldRelId":10295,"dataSourceId":null,"sqlStatement":null,"useSql":null},{"page":0,"rows":0,"total":null,"id":873,"fieldEn":"f_ziduan111733","fieldCn":"字段111733","fieldTypeId":327,"fieldType":"ddd","valueType":2,"valueTypeName":null,"valueScope":"qwer","isDerivative":null,"isDerivativeName":null,"isOutput":null,"isOutputName":null,"isCommon":null,"formula":null,"formulaShow":null,"usedFieldId":null,"origFieldId":null,"author":null,"nickName":null,"created":null,"engineId":null,"engineName":null,"status":null,"fieldCondList":null,"fieldRelId":10296,"dataSourceId":null,"sqlStatement":null,"useSql":null},{"page":0,"rows":0,"total":null,"id":876,"fieldEn":"f_f_f_network_real_amount_derive","fieldCn":"网点余额衍生字段","fieldTypeId":302,"fieldType":"物流","valueType":1,"valueTypeName":null,"valueScope":"[-1,9999999)","isDerivative":null,"isDerivativeName":null,"isOutput":null,"isOutputName":null,"isCommon":null,"formula":null,"formulaShow":null,"usedFieldId":null,"origFieldId":null,"author":null,"nickName":null,"created":null,"engineId":null,"engineName":null,"status":null,"fieldCondList":null,"fieldRelId":10299,"dataSourceId":null,"sqlStatement":null,"useSql":null}],"engineId":null,"fieldId":""}} - */ - @RequestMapping(value = "/findFieldByUser", method = RequestMethod.POST) - public ResponseEntityDto findFieldByUser(@RequestBody HashMap paramMap) { - - Long userId = SessionManager.getLoginAccount().getUserId(); - Long organId = SessionManager.getLoginAccount().getOrganId(); - paramMap.put("userId", userId); - paramMap.put("organId", organId); - - Integer isCommon = 1; - Integer engineId = null; - if (paramMap.containsKey("engineId") && !paramMap.get("engineId").equals("")) { - isCommon = 0; - engineId = Integer.valueOf((String) paramMap.get("engineId")).intValue(); - paramMap.put("engineId", engineId); - } else { - isCommon = 1; - paramMap.put("engineId", null); - } - paramMap.put("isCommon", isCommon); - - if (!paramMap.containsKey("fieldId")) { - paramMap.put("fieldId", null); - } - - List fieldList = s.fieldService.findByUser(paramMap); - - paramMap.put("fieldList", fieldList); - - return ResponseEntityBuilder.buildNormalResponse(paramMap); - } - - private Map checkField(Map param) { - - Long userId = SessionManager.getLoginAccount().getUserId(); - Long organId = SessionManager.getLoginAccount().getOrganId(); - param.put("userId", userId); - param.put("organId", organId); - param.put("engineId", null); - - return s.fieldService.checkField(param); - } - - public int fieldEnAjaxValidate(HashMap paramMap) { - - Long userId = SessionManager.getLoginAccount().getUserId(); - paramMap.put("userId", userId); - - if ("".equals(paramMap.get("engineId"))) { - paramMap.put("engineId", null); - } - - if ("".equals(paramMap.get("Id"))) { - paramMap.put("Id", null); - } - - paramMap.put("fieldCn", null); - - return s.fieldService.isExists(paramMap); - } - - public int fieldCnAjaxValidate(HashMap paramMap) { - - Long userId = SessionManager.getLoginAccount().getUserId(); - paramMap.put("userId", userId); - - if ("".equals(paramMap.get("engineId"))) { - paramMap.put("engineId", null); - } - - if ("".equals(paramMap.get("Id"))) { - paramMap.put("Id", null); - } - - paramMap.put("fieldEn", null); - - return s.fieldService.isExists(paramMap); - } - - /** - * @api {POST} /v2/datamanage/field/downTemplate 2.10. 指标导入模板下载 - * @apiGroup field - * @apiVersion 2.0.0 - */ - @RequestMapping("downTemplate") - public ResponseEntity downExcelTemplate() throws IOException { - ClassPathResource classPathResource = new ClassPathResource("excleTemplate/field.xlsx"); - InputStream inputStream = classPathResource.getInputStream(); - HttpHeaders headers = new HttpHeaders(); - String fileName = new String("基础指标导入模板.xlsx".getBytes("UTF-8"), "iso-8859-1");//为了解决中文名称乱码问题 - headers.setContentDispositionFormData("attachment", fileName); - headers.setContentType(MediaType.APPLICATION_OCTET_STREAM); - return new ResponseEntity(IOUtils.toByteArray(inputStream), headers, HttpStatus.CREATED); - } - - /** - * @api {POST} /v2/datamanage/field/upload 2.11. 批量导入指标 - * @apiGroup field - * @apiVersion 2.0.0 - */ - @RequestMapping(value = "upload", method = RequestMethod.POST) - public ResponseEntityDto upload(HttpServletRequest request) throws Exception { - //将当前上下文初始化给 CommonsMutipartResolver (多部分解析器) - CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver(request.getSession().getServletContext()); - //检查form中是否有enctype="multipart/form-data" - - String accessUrl = ""; - String fileName = ""; - if (multipartResolver.isMultipart(request)) { - //将request变成多部分request - MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request; - //获取multiRequest 中所有的文件名 - Iterator iter = multiRequest.getFileNames(); - while (iter.hasNext()) { - //一次遍历所有文件 - MultipartFile file = multiRequest.getFile(iter.next().toString()); - if (file != null) { - - String uploadDir = request.getSession().getServletContext().getRealPath("/") + "upload/fieldUpload/"; - if (!new File(uploadDir).exists()) { - File dir = new File(uploadDir); - dir.mkdirs(); - } - fileName = System.currentTimeMillis() + "_" + file.getOriginalFilename(); - String path = uploadDir + fileName; - //上传 - file.transferTo(new File(path)); - accessUrl = path; - } - } - } - - Long userId = SessionManager.getLoginAccount().getUserId(); - Long organId = SessionManager.getLoginAccount().getOrganId(); - Map paramMap = new HashMap<>(); - paramMap.put("userId", userId); - paramMap.put("author", userId); - paramMap.put("organId", organId); - Integer isCommon = 0; - if (paramMap.get("engineId") == null) { - isCommon = 1; - } else { - isCommon = 0; - } - paramMap.put("isCommon", isCommon); - - Map resultMap = s.fieldService.importExcel(accessUrl, paramMap); - return ResponseEntityBuilder.buildNormalResponse(resultMap); - } - - /** - * @api {POST} /v2/datamanage/field/getEngineFields 2.xx. 获取引擎可用字段 - * @apiGroup zzzzz01 - * @apiVersion 2.0.0 - * @apiParam {Integer} isOutput 是否输出字段,0代表不是,1代表是,默认不是(0) - * @apiParam {Integer} [engineId] 引擎id - * @apiSuccess {String} status 状态:1成功,0失败 - * @apiParamExample {json} 请求示例: - * {"isOutput":0} - * {"isOutput":1} - * {"isOutput":0,"engineId":211} - * {"isOutput":1,"engineId":211} - * @apiSuccessExample {json} 成功返回数据示例: - * {待完善} - */ - @RequestMapping(value = "/getEngineFields", method = RequestMethod.POST) - public ResponseEntityDto getEngineFields(@RequestBody Map paramMap) { - //通过引擎编号查询可用字段,后面可以放到缓存中 - User user = SessionManager.getLoginAccount(); - paramMap.put("userId", user.getUserId()); - paramMap.put("organId", user.getOrganId()); - List fields = s.fieldService.getFieldList(paramMap); - if (CollectionUtil.isNotNullOrEmpty(fields)) { - List fieldEnumVos = new ArrayList(); - FieldEnumVo fieldEnumVo = null; - for (Field field : fields) { - fieldEnumVo = new FieldEnumVo(); - fieldEnumVo.setField(field); - if (field.getValueType() == ValueType.Enum.getValue()) { - //如果是枚举 - String valueScope = field.getValueScope(); - if (StringUtil.isValidStr(valueScope)) { - //获取枚举值 - fieldEnumVo.setEnums(Arrays.asList(valueScope.split(CommonConst.SYMBOL_COMMA))); - } - } - fieldEnumVos.add(fieldEnumVo); - } - return ResponseEntityBuilder.buildNormalResponse(fieldEnumVos); - } - return ResponseEntityBuilder.buildNormalResponse(new ArrayList()); - } - - @PostMapping(value = "/updateFieldFolder") -// @ArchivesLog(operationType = OpTypeConst.UPDATE_FIELD_FOLDER) - public ResponseEntityDto updateFieldFolder(@RequestBody UpdateFolderParam param){ - UpdateFolderParam.checkNotNull(param); - int result = s.fieldService.updateFieldFolder(param); - if (result>0){ - return ResponseEntityBuilder.buildNormalResponse("成功移动"+result+"条数据"); - } - return ResponseEntityBuilder.buildErrorResponse("移动失败",""); - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/mapper/FieldCondMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/mapper/FieldCondMapper.java deleted file mode 100644 index cd8a05b..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/mapper/FieldCondMapper.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.risk.riskmanage.datamanage.mapper; - -import java.util.List; - -import com.risk.riskmanage.datamanage.model.FieldCond; -import com.risk.riskmanage.common.mapper.BaseMapper; - -public interface FieldCondMapper extends BaseMapper { - - /** - * createFieldCond:(生成条件关系).
- * - * @param - * @return 字段列表 - */ - public boolean createFieldCond(List fieldCondVoList); - - /** - * getFieldCondList:(找出字段条件设置(去重)).
- * - * @param - * @return 字段列表 - */ - public List getFieldCondList(Long fieldId); - - /** - * deleteFieldCondById:(删除字段的条件设置).
- * - * @param - * @return 是否删除成功 - */ - public boolean deleteFieldCondById(Long id); - - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/mapper/FieldMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/mapper/FieldMapper.java deleted file mode 100644 index b6c3b45..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/mapper/FieldMapper.java +++ /dev/null @@ -1,270 +0,0 @@ -package com.risk.riskmanage.datamanage.mapper; - -import java.util.Collection; -import java.util.List; -import java.util.Map; -import com.risk.riskmanage.common.mapper.BaseMapper; -import com.risk.riskmanage.datamanage.model.Field; -import com.risk.riskmanage.common.model.requestParam.UpdateFolderParam; -import org.apache.ibatis.annotations.Param; - -public interface FieldMapper extends BaseMapper { - - /** - * findByFieldType:(根据字段类型名找出该用户可用的字段列表).
- * - * @param paramMap 参数集合 - * @return 字段列表 - */ - public List findByFieldType(Map paramMap); - - /** - * checkField:(查找引用该字段的所有字段).
- * - * @param paramMap 参数集合 - * @return 字段id逗号分隔字符串 - */ - public String checkField(Map paramMap); - - /** - * getSourceField:(查找构成该字段的子字段及原生字段).
- * - * @param paramMap 参数集合 - * @return - */ - public String getSourceField(Map paramMap); - - /** - * findFieldByIds:(找出一批字段id对应的字段列表).
- * - * @param paramMap 参数集合 - * @return 字段列表 - */ - public List findFieldByIds(Map paramMap); - /** - * findFieldByIds:(找出一批字段id对应的字段列表).
- * @author caowenyu - * @param paramMap 参数集合 - * @return 字段列表 - */ - public List findFieldByIdsbyorganId(Map paramMap); - - /** - * findFieldIdsByTypeIds:(找出一批字段类型id对应的字段id列表).
- * - * @param paramMap 参数集合 - * @return 字段id逗号分隔字符串 - */ - public String findFieldIdsByTypeIds(Map paramMap); - - /** - * findFieldTypeIdsByFieldId:(在引擎里找出一批字段id对应的唯一字段类型id串).
- * - * @param paramMap 参数集合 - * @return 字段类型id逗号分隔字符串 - */ - public String findFieldTypeIdsByFieldId(Map paramMap); - - /** - * findOrgFieldTypeIdsByIds:(在通用字段里找出一批字段id对应的唯一字段类型id串).
- * - * @param paramMap 参数集合 - * @return 字段类型id逗号分隔字符串 - */ - public String findOrgFieldTypeIdsByIds(Map paramMap); - - /** - * findFieldByIdsForCheckField:(找出一批字段id的字段列表(包含引擎引用的通用字段,engineId为空是不加engineId=null条件)).
- * - * @param paramMap 参数集合 - * @return 字段列表 - */ - public List findFieldByIdsForCheckField(Map paramMap); - - /** - * findOrgFieldIdsByTypeIds:(在通用字段里找出一批字段类型id的字段id列表).
- * - * @param paramMap 参数集合 - * @return 字段列表 - */ - public String findOrgFieldIdsByTypeIds(Map paramMap); - - /** - * findByFieldName:(根据字段英文或中文名找出字段对象).
- * - * @param paramMap 参数集合 - * @return 字段对象 - */ - public Field findByFieldName(Map paramMap); - - /** - * findByFieldEn:(根据引擎和字段英文名找出引擎所用字段对象).
- * - * @param paramMap 参数集合 - * @return 字段对象 - */ - public Field findByFieldEn(Map paramMap); - /** - * findByFieldEn:(根据引擎和字段英文名找出引擎所用字段对象).
- * - * @param paramMap 参数集合 - * @return 字段对象 - */ - public Field findByFieldEnbyorganId(Map paramMap); - - - /** - * findByFieldCn:(根据字段中文名找出字段对象).
- * - * @param paramMap 参数集合 - * @return 字段对象 - */ - public Field findByFieldCn(Map paramMap); - /** - * findByFieldCn:(根据字段中文名找出字段对象).
- * - * @param paramMap 参数集合 - * @return 字段对象 - */ - public Field findByFieldCnbyorganId(Map paramMap); - - /** - * findByFieldCn:(按中文名查找通用字段).
- * - * @param paramMap 参数集合 - * @return 字段对象 - */ - public Field findByFieldCnNoEngineId(Map paramMap); - /** - * findByFieldCn:(按中文名查找通用字段).
- * - * @param paramMap 参数集合 - * @return 字段对象 - */ - public Field findByFieldCnNoEngineIdbyorganId(Map paramMap); - - - /** - * findByUser:(找出该用户可用字段列表).
- * - * @param paramMap 参数集合 - * @return 字段类型列表 - */ - public List findByUser(Map paramMap); - - /** - * searchByName:(模糊查找该用户可用字段列表).
- * - * @param paramMap 参数集合 - * @return 字段类型列表 - */ - public List searchByName(Map paramMap); - - /** - * findFieldTypeId:(根据批量选择的字段ID查找出它们的字段类型ID).
- * - * @param paramMap 参数集合 - * @return fieldTypeId - * */ - public Long findFieldTypeId(Map paramMap); - - /** - * countByParams:(字段列表记录数).
- * - * @param paramMap 参数集合 - * @return 字段列表记录条数 - */ - public int countByParams(Map paramMap); - - /** - * findByFieldId:(根据字段Id查找字段对象).
- * - * @param paramMap 参数集合 - * @return 字段对象 - */ - public Field findByFieldId(Map paramMap); - - /** - * findByFieldId:(根据字段Id查找字段对象).
- * @author caowenyu - * @param paramMap 参数集合 - * @return 字段对象 - */ - public Field findByFieldIdbyorganId(Map paramMap); - - - /** - * findByFieldIdNoEngineId:(根据字段Id查找组织通用字段对象).
- * - * @param paramMap 参数集合 - * @return 字段对象 - */ - public Field findByFieldIdNoEngineId(Map paramMap); - - /** - * createField:(添加字段).
- * - * @param fieldVo 字段实体对象 - * @return 插入是否成功 - */ - public boolean createField(Field fieldVo); - - /** - * batchCreateField:(批量添加字段).
- * - * @param fieldVoList 字段实体对象list集合 - * @return 字段类型列表 - */ - public boolean batchCreateField(List fieldVoList); - - /** - * updateField:(修改字段).
- * - * @param paramMap 参数集合 - * @return 更新是否成功 - */ - - public boolean updateField(Map paramMap); - - /** - * isExists:(根据字段英文或中文名查找字段是否存在).
- * - * @param paramMap 参数集合 - * @return 存在的记录条数 - */ - public int isExists(Map paramMap); - - /** - * getFieldList:(获取组织的所有字段).
- * - * @param paramMap 参数集合 - * @return - */ - public List getFieldList(Map paramMap); - - /** - * findFieldByIds:(找出一批字段id对应的字段,并且为衍生字段列表).
- * @author caowenyu - * @param paramMap 参数集合 - * @return 字段列表 - */ - public List findFieldByIdsAndIsderivative(Map paramMap); - - /** - * findExcelByFieldType:(获取导出Excel需要的字段信息).
- * - * @param paramMap 参数集合 - * @return - */ - public List findExcelByFieldType(Map paramMap); - - public String findFieldNameById(Long fieldId); - - int updateFieldFolder(UpdateFolderParam param); - - List selectByIds(@Param("ids") Collection ids); - - List selectByEns(@Param("ens") Collection ens); - - List selectByOrganCns(@Param("cns")Collection cns,@Param("organId")Long organId); -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/mapper/FieldTypeMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/mapper/FieldTypeMapper.java deleted file mode 100644 index d185b0f..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/mapper/FieldTypeMapper.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.risk.riskmanage.datamanage.mapper; - -import java.util.List; -import java.util.Map; - -import com.risk.riskmanage.common.mapper.BaseMapper; -import com.risk.riskmanage.datamanage.model.FieldType; -import com.risk.riskmanage.datamanage.model.request.FieldTreeParam; - -public interface FieldTypeMapper extends BaseMapper { - - /** - * getFieldTypeList:(查找用户的字段类型列表).
- * - * @param paramMap 参数集合 - * @return 字段类型列表 - */ - public List getFieldTypeList(Map paramMap); - - /** - * getSubFieldTypeList:(根据传入的字段父类型查找子类型列表).
- * - * @param paramMap 参数集合 - * @return 字段类型列表 - */ - public List getSubFieldTypeList(Map paramMap); - - /** - * findFieldTypeById:(根据传入的字段类型ID查找字段类型名).
- * - * @param paramMap 参数集合 - * @return 字段类型列表 - */ - public FieldType findFieldTypeById(Map paramMap); - - /** - * findTypeIdByParentId:(根据传入的字段类型父ID查找子类型ID).
- * - * @param paramMap 参数集合 - * @return 子字段类型ID - */ - public String findTypeIdByParentId(Map paramMap); - - /** - * findTypeIdByParentId:(根据传入的字段类型类型ID查找父ID).
- * - * @param paramMap 参数集合 - * @return 子字段类型ID - */ - public String findParentIdByTypeId(Map paramMap); - - /** - * findFieldType:(查找用户可用的字段类型列表,通用组织所有,引擎只有自定义).
- * - * @param paramMap 参数集合 - * @return 字段类型列表 - */ - public List findFieldType(Map paramMap); - - /** - * createFieldType:(新增字段类型).
- * - * @param fieldTypeVo 字段类型实体类 - * @return 插入成功 - */ - public boolean createFieldType(FieldType fieldTypeVo); - - /** - * findIdByFieldType:(新增字段类型).
- * - * @param paramMap paramMap - * @return 字段类型编号 - */ - public long findIdByFieldType(Map paramMap); - - /** - * updateFieldType:(更新字段类型名).
- * - * @param paramMap 参数集合 - * @return 更新成功 - */ - public boolean updateFieldType(FieldTreeParam param); - - /** - * updateFieldTypeByTypeIds:(更新字段类型为删除状态(-1)).
- * - * @param paramMap 参数集合 - * @return 更新成功 - */ - public boolean updateFieldTypeByTypeIds(Map paramMap); - - /** - * deleteFieldTypeByTypeIds:(删除字段类型下没有字段的空节点)).
- * - * @param paramMap 参数集合 - * @return 更新成功 - */ - public boolean deleteFieldTypeByTypeIds(Map paramMap); - - /** - * backFieldTypeByTypeIds:(更新字段类型状态为启用状态(1)).
- * - * @param paramMap 参数集合 - * @return 更新成功 - */ - public boolean backFieldTypeByTypeIds(Map paramMap); - - /** - * isExists:(查找字段名是否存在).
- * - * @param paramMap 参数集合 - * @return 存在的记录条数 - */ - public int isExists(Map paramMap); - - - /** - * isExistsDefaultTreeName:(查找默认节点名是否存在).
- * - * @param paramMap 参数集合 - * @return 存在的记录条数 - */ - public int isExistsDefaultTreeName(Map paramMap); - - List selectFieldTypeList(FieldTreeParam param); -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/mapper/FieldTypeUserMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/mapper/FieldTypeUserMapper.java deleted file mode 100644 index 24cf484..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/mapper/FieldTypeUserMapper.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.risk.riskmanage.datamanage.mapper; - -import java.util.Map; - -import com.risk.riskmanage.common.mapper.BaseMapper; -import com.risk.riskmanage.datamanage.model.FieldTypeUser; -import com.risk.riskmanage.datamanage.model.request.FieldTreeParam; - -public interface FieldTypeUserMapper extends BaseMapper { - - /** - * createFieldTypeUserRel:(新增字段类型).
- * - * @param paramMap 参数集合 - * @return 插入成功 - */ - public boolean createFieldTypeUserRel(Map paramMap); - - /** - * batchBindEngineFieldTypeUserRel:(把一批通用字段类型id中不存在的类型id批量绑定到引擎).
- * - * @param paramMap 参数集合 - * @return 插入成功 - */ - public boolean batchBindEngineFieldTypeUserRel(Map paramMap); - - /** - * deleteFieldTypeUserRel:(取消字段类型).
- * - * @param paramMap 参数集合 - * @return 删除成功 - */ - public boolean deleteFieldTypeUserRel(Map paramMap); - - /** - * updateFieldTypeUserRel:(更新字段类型名).
- * - * @param paramMap 参数集合 - * @return 更新成功 - */ - public boolean updateFieldTypeUserRel(FieldTreeParam param); - - /** - * findNodeIds:(查找引擎在用的节点集合).
- * - * @param paramMap 参数集合 - * @return - */ - public String findNodeIds(Map paramMap); - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/mapper/FieldUserMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/mapper/FieldUserMapper.java deleted file mode 100644 index ffe385e..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/mapper/FieldUserMapper.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.risk.riskmanage.datamanage.mapper; - -import java.util.Map; - -import com.risk.riskmanage.datamanage.model.FieldUser; -import com.risk.riskmanage.common.mapper.BaseMapper; - -public interface FieldUserMapper extends BaseMapper { - - /** - * createFieldUserRel:(绑定字段和用户关系).
- * - * @param fieldUser 用户字段实体类 - * @return 插入成功 - * */ - public boolean createFieldUserRel(FieldUser fieldUserVo); - - /** - * batchCreateFieldUserRel:(批量导入字段信息后批量绑定字段和用户关系).
- * - * @param paramMap 参数集合 - * @return 插入成功 - * */ - public boolean batchCreateFieldUserRel(Map paramMap); - - /** - * batchBindEngineFieldUserRel:(把一批通用字段id中未绑定的字段id批量绑定到引擎).
- * - * @param paramMap 参数集合 - * @return 插入成功 - * */ - public boolean batchBindEngineFieldUserRel(Map paramMap); - - /** - * batchCreateEngineFieldUserRel:(把id、英文名、中文名不重复的组织字段批量绑定到引擎).
- * - * @param paramMap 参数集合 - * @return 插入成功 - * */ - public boolean batchCreateEngineFieldUserRel(Map paramMap); - - /** - * updateFieldUserRel:(更新字段).
- * - * @param paramMap 参数集合 - * @return 更新成功 - * */ - public boolean updateFieldUserRel(Map paramMap); - - /** - * updateStatus:(单个或批量更新用户字段关系).
- * - * @param paramMap 参数集合 - * @return 更新成功 - * */ - public boolean updateStatus(Map paramMap); - - /** - * deleteFieldByIds:(批量修改字段启用状态为删除状态(-1)).
- * - * @param paramMap 参数集合 - * @return 更新是否成功 - */ - public boolean deleteFieldByIds(Map paramMap); - - /** - * deleteFieldByIds:(批量修改字段删除状态为启用状态(1)).
- * - * @param paramMap 参数集合 - * @return 更新是否成功 - */ - public boolean backFieldByIds(Map paramMap); - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/model/Field.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/model/Field.java deleted file mode 100644 index 9cc6169..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/model/Field.java +++ /dev/null @@ -1,456 +0,0 @@ -package com.risk.riskmanage.datamanage.model; - -import com.risk.riskmanage.common.model.BasePage; - -import java.io.Serializable; -import java.util.Date; -import java.util.List; - -public class Field extends BasePage implements Serializable { - - - private static final long serialVersionUID = 1L; - - /** - * 主键 - * */ - private Long id; - - /** - * 字段英文名 - * */ - private String fieldEn; - - /** - * 字段中文名 - * */ - private String fieldCn; - - /** - * 字段类型编号 - * */ - private Long fieldTypeId; - - /** - * 字段类型名 - * */ - private String fieldType; - - /** - * 字段存值类型 - * */ - private Integer valueType; - - /** - * 字段存值类型中文 - * */ - private String valueTypeName; - - /** - * 字段约束范围 - * */ - private String valueScope; - - /** - * 是否衍生字段 - * */ - private Integer isDerivative; - - /** - * 是否衍生字段 - * */ - private String isDerivativeName; - - /** - * 是否输出字段 - * */ - private Integer isOutput; - - /** - * 是否输出字段 - * */ - private String isOutputName; - - /** - * 是否组织定义的通用字段 - * */ - private Integer isCommon; - - /** - * 衍生字段公式 - * */ - private String formula; - - /** - * 衍生字段公式回显信息 - * */ - private String formulaShow; - - /** - * 衍生字段引用的字段id - * */ - private String usedFieldId; - - /** - * 衍生字段引用的原生字段id - * */ - private String origFieldId; - - /** - * 创建人 - * */ - private Long author; - - /** - * 创建人昵称 - * */ - private String nickName; - - /** - * 创建时间 - * */ - private Date created; - - /** - * 归属的引擎ID - * */ - private Long engineId; - - /** - * 归属的引擎名称 - * */ - private String engineName; - - /** - * 字段状态(启用、停用、删除、未知) - * */ - private String status; - - /** - * 字段条件设置集合 - * */ - private List fieldCondList; - - /** - * 字段用户关系编号 - * */ - private Long fieldRelId; - - /** - * 是否使用sql获取指标 - */ - private Boolean isUseSql; - - /** - * 使用sql获取指标时对应的数据源 - */ - private Integer dataSourceId; - - /** - * 使用sql获取指标时对应的sql语句 - */ - private String sqlStatement; - - /** - * sql变量配置 - */ - private String sqlVariable; - - //是否使用接口 - private Boolean isInterface; - - //接口id - private Integer interfaceId; - - //接口解析指标 - private String interfaceParseField; - - //json类型对应的json值 - private String jsonValue; - //字典变量如:日期字符串 - private String dictVariable; - - public String getDictVariable() { - return dictVariable; - } - - public void setDictVariable(String dicVariable) { - this.dictVariable = dicVariable; - } - - /** - * 该字段归属的组织编号 - * */ - private Long organId; - - public String getInterfaceParseField() { - return interfaceParseField; - } - - public void setInterfaceParseField(String interfaceParseField) { - this.interfaceParseField = interfaceParseField; - } - - public String getJsonValue() { - return jsonValue; - } - - public void setJsonValue(String jsonValue) { - this.jsonValue = jsonValue; - } - - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - public String getFieldEn() { - return fieldEn; - } - public void setFieldEn(String fieldEn) { - this.fieldEn = fieldEn; - } - public String getFieldCn() { - return fieldCn; - } - public void setFieldCn(String fieldCn) { - this.fieldCn = fieldCn; - } - public Long getFieldTypeId() { - return fieldTypeId; - } - public void setFieldTypeId(Long fieldTypeId) { - this.fieldTypeId = fieldTypeId; - } - public Integer getValueType() { - return valueType; - } - public void setValueType(Integer valueType) { - this.valueType = valueType; - } - public String getValueScope() { - return valueScope; - } - public void setValueScope(String valueScope) { - this.valueScope = valueScope; - } - - public Integer getIsDerivative() { - return isDerivative; - } - public void setIsDerivative(Integer isDerivative) { - this.isDerivative = isDerivative; - } - - public Integer getIsOutput() { - return isOutput; - } - public void setIsOutput(Integer isOutput) { - this.isOutput = isOutput; - } - public Integer getIsCommon() { - return isCommon; - } - public void setIsCommon(Integer isCommon) { - this.isCommon = isCommon; - } - public String getFormula() { - return formula; - } - public void setFormula(String formula) { - this.formula = formula; - } - public String getFormulaShow() { - return formulaShow; - } - public void setFormulaShow(String formulaShow) { - this.formulaShow = formulaShow; - } - public String getUsedFieldId() { - return usedFieldId; - } - public void setUsedFieldId(String usedFieldId) { - this.usedFieldId = usedFieldId; - } - public String getOrigFieldId() { - return origFieldId; - } - public void setOrigFieldId(String origFieldId) { - this.origFieldId = origFieldId; - } - public Long getAuthor() { - return author; - } - public void setAuthor(Long author) { - this.author = author; - } - public String getNickName() { - return nickName; - } - public void setNickName(String nickName) { - this.nickName = nickName; - } - public Date getCreated() { - return created; - } - public void setCreated(Date created) { - this.created = created; - } - public Long getEngineId() { - return engineId; - } - public void setEngineId(Long engineId) { - this.engineId = engineId; - } - public String getFieldType() { - return fieldType; - } - public void setFieldType(String fieldType) { - this.fieldType = fieldType; - } - public String getStatus() { - return status; - } - public void setStatus(String status) { - this.status = status; - } - public Long getFieldRelId() { - return fieldRelId; - } - public void setFieldRelId(Long fieldRelId) { - this.fieldRelId = fieldRelId; - } - public List getFieldCondList() { - return fieldCondList; - } - public void setFieldCondList(List fieldCondList) { - this.fieldCondList = fieldCondList; - } - public String getEngineName() { - return engineName; - } - public void setEngineName(String engineName) { - this.engineName = engineName; - } - - public String getValueTypeName() { - return valueTypeName; - } - - public void setValueTypeName(String valueTypeName) { - this.valueTypeName = valueTypeName; - } - - public String getIsDerivativeName() { - return isDerivativeName; - } - - public void setIsDerivativeName(String isDerivativeName) { - this.isDerivativeName = isDerivativeName; - } - - public String getIsOutputName() { - return isOutputName; - } - - public void setIsOutputName(String isOutputName) { - this.isOutputName = isOutputName; - } - - public Boolean getUseSql() { - return isUseSql; - } - - public void setUseSql(Boolean useSql) { - isUseSql = useSql; - } - - public Integer getDataSourceId() { - return dataSourceId; - } - - public void setDataSourceId(Integer dataSourceId) { - this.dataSourceId = dataSourceId; - } - - public String getSqlStatement() { - return sqlStatement; - } - - public void setSqlStatement(String sqlStatement) { - this.sqlStatement = sqlStatement; - } - - @Override - public String toString() { - return "Field{" + - "id=" + id + - ", fieldEn='" + fieldEn + '\'' + - ", fieldCn='" + fieldCn + '\'' + - ", fieldTypeId=" + fieldTypeId + - ", fieldType='" + fieldType + '\'' + - ", valueType=" + valueType + - ", valueTypeName='" + valueTypeName + '\'' + - ", valueScope='" + valueScope + '\'' + - ", isDerivative=" + isDerivative + - ", isDerivativeName='" + isDerivativeName + '\'' + - ", isOutput=" + isOutput + - ", isOutputName='" + isOutputName + '\'' + - ", isCommon=" + isCommon + - ", formula='" + formula + '\'' + - ", formulaShow='" + formulaShow + '\'' + - ", usedFieldId='" + usedFieldId + '\'' + - ", origFieldId='" + origFieldId + '\'' + - ", author=" + author + - ", nickName='" + nickName + '\'' + - ", created=" + created + - ", engineId=" + engineId + - ", engineName='" + engineName + '\'' + - ", status='" + status + '\'' + - ", fieldCondList=" + fieldCondList + - ", fieldRelId=" + fieldRelId + - ", isUseSql=" + isUseSql + - ", dataSourceId=" + dataSourceId + - ", sqlStatement='" + sqlStatement + '\'' + - ", isInterface=" + isInterface + - ", interfaceId=" + interfaceId + - '}'; - } - - public static long getSerialVersionUID() { - return serialVersionUID; - } - - public Boolean getInterface() { - return isInterface; - } - - public void setInterface(Boolean anInterface) { - isInterface = anInterface; - } - - public Integer getInterfaceId() { - return interfaceId; - } - - public void setInterfaceId(Integer interfaceId) { - this.interfaceId = interfaceId; - } - - public String getSqlVariable() { - return sqlVariable; - } - - public void setSqlVariable(String sqlVariable) { - this.sqlVariable = sqlVariable; - } - - public Long getOrganId() { - return organId; - } - - public void setOrganId(Long organId) { - this.organId = organId; - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/model/FieldCond.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/model/FieldCond.java deleted file mode 100644 index 7996936..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/model/FieldCond.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.risk.riskmanage.datamanage.model; - -import java.io.Serializable; -import java.util.Date; -import java.util.List; - -import com.risk.riskmanage.common.model.BasePage; -import com.risk.riskmanage.datamanage.vo.FieldSubCondVo; - -public class FieldCond extends BasePage implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 条件编号 - * */ - private Long id; - - /** - * 字段编号 - * */ - private Long fieldId; - - /** - * 字段条件值 - * */ - private String conditionValue; - - /** - * 字段条件区域设置json格式 - * */ - private String content; - - /** - * 条件字段编号 - * */ - private Long condFieldId; - - /** - * 条件字段的运算符 - * */ - private String condFieldOperator; - - /** - * 条件字段的条件设置值 - * */ - private String condFieldValue; - - /** - * 条件字段间的逻辑符 - * */ - private String condFieldLogical; - - /** - * 创建时间 - * */ - private Date created; - - private List fieldSubCond; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public Long getFieldId() { - return fieldId; - } - - public void setFieldId(Long fieldId) { - this.fieldId = fieldId; - } - - public String getConditionValue() { - return conditionValue; - } - - public void setConditionValue(String conditionValue) { - this.conditionValue = conditionValue; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public Date getCreated() { - return created; - } - - public void setCreated(Date created) { - this.created = created; - } - - public Long getCondFieldId() { - return condFieldId; - } - - public void setCondFieldId(Long condFieldId) { - this.condFieldId = condFieldId; - } - - public String getCondFieldOperator() { - return condFieldOperator; - } - - public void setCondFieldOperator(String condFieldOperator) { - this.condFieldOperator = condFieldOperator; - } - - public String getCondFieldValue() { - return condFieldValue; - } - - public void setCondFieldValue(String condFieldValue) { - this.condFieldValue = condFieldValue; - } - - public String getCondFieldLogical() { - return condFieldLogical; - } - - public void setCondFieldLogical(String condFieldLogical) { - this.condFieldLogical = condFieldLogical; - } - - public List getFieldSubCond() { - return fieldSubCond; - } - - public void setFieldSubCond(List fieldSubCond) { - this.fieldSubCond = fieldSubCond; - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/model/FieldType.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/model/FieldType.java deleted file mode 100644 index 3d917d1..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/model/FieldType.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.risk.riskmanage.datamanage.model; - -import com.risk.riskmanage.common.model.BasePage; - -import java.io.Serializable; - -public class FieldType extends BasePage implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 主键 - */ - private Integer id; - - /** - * 字段类型名 - */ - private String fieldType; - - /** - * 父节点编号 - */ - private Integer parentId; - - /** - * 是否组织定义的通用字段类型 - */ - private Integer isCommon; - - private Integer type; - - public Integer getType() { - return type; - } - - public void setType(Integer type) { - this.type = type; - } - - /** - * 字段类型的子类集合 - */ - private FieldType[] children; - - /** - * 是否为父类 - */ - private String isParent = "true"; - - /** - * 引擎编号 - */ - private Integer engineId; - - /** - * 文件夹图片路径 - */ - private String icon; - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getFieldType() { - return fieldType; - } - - public void setFieldType(String fieldType) { - this.fieldType = fieldType; - } - - public Integer getParentId() { - return parentId; - } - - public void setParentId(Integer parentId) { - this.parentId = parentId; - } - - public Integer getIsCommon() { - return isCommon; - } - - public void setIsCommon(Integer isCommon) { - this.isCommon = isCommon; - } - - public FieldType[] getChildren() { - return children; - } - - public void setChildren(FieldType[] children) { - this.children = children; - } - - public String getIsParent() { - return isParent; - } - - public void setIsParent(String isParent) { - this.isParent = isParent; - } - - public Integer getEngineId() { - return engineId; - } - - public void setEngineId(Integer engineId) { - this.engineId = engineId; - } - - public String getIcon() { -// if(engineId!=null) -// icon = "../../resource/images/authority/folder.png"; -// else - icon = "../resource/images/authority/folder.png"; - return icon; - } - - public void setIcon(String icon) { - this.icon = icon; - } - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/model/FieldTypeUser.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/model/FieldTypeUser.java deleted file mode 100644 index bbac6d7..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/model/FieldTypeUser.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.risk.riskmanage.datamanage.model; - -import java.io.Serializable; -import java.util.Date; - -import com.risk.riskmanage.common.model.BasePage; - -public class FieldTypeUser extends BasePage implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 主键 - * */ - private Integer id; - - /** - * 字段类型编号(表主键) - * */ - private Integer fieldTypeId; - - /** - * 该字段类型归属的组织编号 - * */ - private Long organId; - - /** - * 该字段类型归属的引擎id(表主键) - * */ - private Integer engineId; - - /** - * 创建或修改该字段的用户编号 - * */ - private Long userId; - - /** - * 创建时间 - * */ - private Date created; - - public Integer getId() { - return id; - } - public void setId(Integer id) { - this.id = id; - } - public Integer getFieldTypeId() { - return fieldTypeId; - } - public void setFieldTypeId(Integer fieldTypeId) { - this.fieldTypeId = fieldTypeId; - } - public Long getOrganId() { - return organId; - } - public void setOrganId(Long organId) { - this.organId = organId; - } - public Integer getEngineId() { - return engineId; - } - public void setEngineId(Integer engineId) { - this.engineId = engineId; - } - public Long getUserId() { - return userId; - } - public void setUserId(Long userId) { - this.userId = userId; - } - public Date getCreated() { - return created; - } - public void setCreated(Date created) { - this.created = created; - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/model/FieldUser.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/model/FieldUser.java deleted file mode 100644 index a2c8595..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/model/FieldUser.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.risk.riskmanage.datamanage.model; - -import java.io.Serializable; -import java.util.Date; - -import com.risk.riskmanage.common.model.BasePage; - -public class FieldUser extends BasePage implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 主键 - * */ - private Long id; - - /** - * 字段编号(表主键) - * */ - private Long fieldId; - - /** - * 该字段归属的组织编号 - * */ - private Long organId; - - /** - * 该字段归属的引擎id(表主键) - * */ - private Long engineId; - - /** - * 创建或修改该字段的用户编号 - * */ - private Long userId; - - /** - * 启用停用删除标志 - * */ - private int status; - - /** - * 创建时间 - * */ - private Date created; - - /** - * 更新时间 - * */ - private Date updated; - - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - public Long getFieldId() { - return fieldId; - } - public void setFieldId(Long fieldId) { - this.fieldId = fieldId; - } - public Long getOrganId() { - return organId; - } - public void setOrganId(Long organId) { - this.organId = organId; - } - public Long getEngineId() { - return engineId; - } - public void setEngineId(Long engineId) { - this.engineId = engineId; - } - public Long getUserId() { - return userId; - } - public void setUserId(Long userId) { - this.userId = userId; - } - public int getStatus() { - return status; - } - public void setStatus(int status) { - this.status = status; - } - public Date getCreated() { - return created; - } - public void setCreated(Date created) { - this.created = created; - } - public Date getUpdated() { - return updated; - } - public void setUpdated(Date updated) { - this.updated = updated; - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/model/FormulaField.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/model/FormulaField.java deleted file mode 100644 index 62f3ccf..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/model/FormulaField.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.risk.riskmanage.datamanage.model; - -import java.io.Serializable; - -import com.risk.riskmanage.common.model.BasePage; - -public class FormulaField extends BasePage implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 主键 - * */ - private Long id; - - /** - * 字段编号(表主键) - * */ - private Long fieldId; - /** - * 公式用到的字段编号(表主键) - * */ - private Long formulaFieldId; - - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - public Long getFieldId() { - return fieldId; - } - public void setFieldId(Long fieldId) { - this.fieldId = fieldId; - } - public Long getFormulaFieldId() { - return formulaFieldId; - } - public void setFormulaFieldId(Long formulaFieldId) { - this.formulaFieldId = formulaFieldId; - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/model/request/FieldSaveParam.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/model/request/FieldSaveParam.java deleted file mode 100644 index 2215674..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/model/request/FieldSaveParam.java +++ /dev/null @@ -1,97 +0,0 @@ -package com.risk.riskmanage.datamanage.model.request; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class FieldSaveParam implements Serializable { - - private static final long serialVersionUID = 1L; - - // http://47.102.125.25/apidoc/index.html#api-field-PostV2DatamanageFieldSave - - private String searchKey; // - private Long id; - private String formula; - private String formulaShow; - private Long engineId; - private String fieldEn; - private String fieldCn; - private Long fieldTypeId; - private Integer valueType; - private Integer isDerivative; - private Integer isOutput; - private String valueScope; - private String fieldCondList; // - private String formulaHidden; // - private Boolean isUseSql; - private Integer dataSourceId; - private String sqlStatement; - private String sqlVariable; - private Boolean isInterface; - private Integer interfaceId; - private String interfaceParseField; - private String jsonValue; - private String dictVariable; - -// -// public Field toField() { -// Field field = new Field(); -// -// field.setId(this.getId()); -// field.setFormula(this.getFormula()); -// field.setFormulaShow(this.getFormulaShow()); -// field.setEngineId(this.getEngineId()); -// field.setFieldEn(this.getFieldEn()); -// field.setFieldCn(this.getFieldCn()); -// field.setFieldTypeId(this.getFieldTypeId()); -// field.setValueType(this.getValueType()); -// field.setIsDerivative(this.getIsDerivative()); -// field.setIsOutput(this.getIsOutput()); -// field.setValueScope(this.getValueScope()); -// -// field.setUseSql(this.getIsUseSql()); -// field.setDataSourceId(this.getDataSourceId()); -// field.setSqlStatement(this.getSqlStatement()); -// -// return field; -// } -// -// public Map toMap() { -// HashMap hashMap = new HashMap<>(); -// hashMap.put("searchKey", this.getSearchKey()); -// hashMap.put("id", this.getId()); -// hashMap.put("formula", this.getFormula()); -// hashMap.put("formulaShow", this.getFormulaShow()); -// hashMap.put("engineId", this.getEngineId()); -// hashMap.put("formulaFields", this.getFormulaFields()); -// hashMap.put("fieldEn", this.getFieldEn()); -// hashMap.put("fieldCn", this.getFieldCn()); -// hashMap.put("fieldTypeId", this.getFieldId()); -// hashMap.put("valueType", this.getValueType()); -// hashMap.put("isDerivative", this.getIsDerivative()); -// hashMap.put("isOutput", this.getIsOutput()); -// hashMap.put("valueScope", this.getValueScope()); -// hashMap.put("fieldContent", this.getFieldContent()); -// hashMap.put("formulaHidden", this.getFormulaHidden()); -// hashMap.put("derType", this.getDerType()); -// hashMap.put("fieldContent2", this.getFieldContent2()); -// hashMap.put("conditionValue", this.getConditionValue()); -// hashMap.put("fieldId", this.getFieldId()); -// hashMap.put("operator", this.getOperator()); -// hashMap.put("fieldValue", this.getFieldValue()); -// hashMap.put("idx", this.getIdx()); -// -// hashMap.put("isUseSql", this.getIsUseSql()); -// hashMap.put("dataSourceId", this.getDataSourceId()); -// hashMap.put("sqlStatement", this.getSqlStatement()); -// -// return hashMap; -// } -// -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/model/request/FieldTreeParam.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/model/request/FieldTreeParam.java deleted file mode 100644 index a773b70..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/model/request/FieldTreeParam.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.risk.riskmanage.datamanage.model.request; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class FieldTreeParam { - //获取需要 - private Integer type; - //删除需要 - private Long id;//文件夹的id - private String fieldType;//文件夹名字 - private Integer status;//状态 -1 删除 - //新建时需要 - private String parentId;//上层文件夹id - private Integer isCommon;// - - private Long organId;//指标相关的组织id - private Long userId;//用户id -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/service/FieldService.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/service/FieldService.java deleted file mode 100644 index cb5622b..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/service/FieldService.java +++ /dev/null @@ -1,274 +0,0 @@ -package com.risk.riskmanage.datamanage.service; - -import com.risk.riskmanage.datamanage.model.Field; -import com.risk.riskmanage.common.model.requestParam.UpdateFolderParam; -import org.springframework.web.bind.annotation.RequestParam; - -import java.util.Collection; -import java.util.List; -import java.util.Map; - -public interface FieldService { - - /** - * createField:(插入新字段).
- * - * - * @param fieldVo - * 字段实体类 - * @return 字段插入成功 - * */ - public boolean createField(Field fieldVo, Map paramMap); - - /** - * isExists:(查找字段是否存在).
- * - * - * @param paramMap - * 参数集合 - * @return 存在的记录条数 - */ - public int isExists(Map paramMap); - - /** - * isExistsFieldType:(查找字段类型是否存在).
- * - * @param paramMap 参数集合 - * @return 存在的记录条数 - */ - public int isExistsFieldType(Map paramMap); - - /** - * isExistsDefaultTreeName:(查找默认节点名是否存在).
- * - * @param paramMap 参数集合 - * @return 存在的记录条数 - */ - public int isExistsDefaultTreeName(Map paramMap); - - /** - * updateField:(修改字段内容).
- * - * - * @param fieldVo - * 字段实体类 - * @return 更新成功 - */ - public boolean updateField(Map paramMap); - - /** - * findByFieldType:(按照字段类型查找字段列表).
- * - * - * @param paramMap - * 参数集合 - * @return 更新成功 - */ - public List findByFieldType(Map paramMap); - - /** - * findFieldByIds:(找出一批字段id对应的字段列表).
- * - * @param paramMap 参数集合 - * @return 字段列表 - */ - public List findFieldByIds(Map paramMap); - - /** - * searchByName:(模糊查找该用户可用字段列表).
- * - * @param paramMap 参数集合 - * @return 字段类型列表 - */ - public List searchByName(Map paramMap); - - /** - * findExcelByFieldType:(获取导出Excel需要的字段信息).
- * - * @param paramMap 参数集合 - * @return - */ - public List findExcelByFieldType(Map paramMap); - - /** - * findByFieldId:(根据Id查找字段).
- * - * @param paramMap 参数集合 - * @return 字段列表 - */ - public Field findByFieldId(Map paramMap); - - /** - * findByFieldEn:(根据引擎和字段英文名找出引擎所用字段对象).
- * - * @param paramMap 参数集合 - * @return 字段对象 - */ - public Field findByFieldEn(Map paramMap); - - /** - * findFieldTypeId:(根据传入参数查找字段类型ID).
- * - * @param paramMap 参数集合 - * @return 更新成功 - * */ - public Long findFieldTypeId(Map paramMap); - - /** - * findByUser:(查找用户可用字段).
- * - * @param paramMap 参数集合 - * @return 字段类型列表 - */ - public List findByUser(Map paramMap); - - - /** - * updateStatus:(单个或批量更新用户字段关系).
- * - * - * @param paramMap - * 参数集合 - * @return 插入成功 - * */ - //public boolean updateStatus(Map paramMap); - public Map updateStatus(Map paramMap); - - /** - * checkField:(公共方法:检查字段是否被引用).
- * - * - * @param paramMap - * 参数集合 - * @return 结果集合 - * */ - public Map checkField(Map paramMap); - - /** - * getSourceField:(公共方法:检查字段的所有构成字段).
- * - * - * @param paramMap - * 参数集合 - * @return - * */ - public String getSourceField(String fieldIds,String fieldId); - - /** - * checkFieldType:(公共方法:检查字段类型及其下所有子类型的所有字段是否被引用).
- * - * - * @param paramMap - * 参数集合 - * @return 结果集合 - * */ - public Map checkFieldType(Map paramMap); - - /** - * findFieldIdsByTypeIds:(找出一批字段类型id对应的字段id列表).
- * - * @param paramMap 参数集合 - * @return 字段id逗号分隔字符串 - */ - public String findFieldIdsByTypeIds(Map paramMap); - - /** - * findOrgFieldIdsByTypeIds:(在通用字段里找出一批字段类型id的字段id列表).
- * - * @param paramMap 参数集合 - * @return 字段列表 - */ - public String findOrgFieldIdsByTypeIds(Map paramMap); - - /** - * importExcel:(导入excel).
- * - * - * @param url - * @param paramMap - * 参数集合 - * @return 导入成功 - * */ - Map importExcel(String url,Map paramMap); - - /** - * getFieldList:(获取组织的所有字段).
- * - * @param paramMap 参数集合 - * @return - */ - public List getFieldList(Map paramMap); - - /** - * createEngineField:(批量拷贝组织通用字段到引擎字段).
- * - * @param paramMap 参数集合 - * @return 是否创建成功 - */ - public boolean createEngineField(Map paramMap); - - /** - * bindEngineField:(根据传入的engineId和字段id找到一连串的字段并绑定关系).
- * - * @param paramMap 参数集合 - * @return 是否创建成功 - */ - public boolean bindEngineField(Map paramMap); - - /** - * findByFieldEn:(根据引擎和字段中文名找出引擎所用字段对象).
- * - * @param paramMap 参数集合 - * @return 字段对象 - */ - public Field findByFieldCn(Map paramMap); - - /** - * getField:(根据引擎和字段中文名找出引擎所用字段对象).
- * - * @param - * @return 字段对象 - */ - public String getField(String fieldIds,String usedFieldId,String engineId); - - /** - * 查找某字段被引用的字段id并拼成逗号分隔的字符串 - * - * @return - */ - public String getAllFieldTypeId(String ids,String pid,String engineId); - - /** - * 查找某字段类型所有的<父类型>拼成逗号分隔的字符串 - * - * @return - */ - public String getAllParentFieldTypeId(String ids,String id,String engineId); - - /** - * 删除指定字段类型节点 - * - * @return - */ - public Map deleteNode(@RequestParam Map paramMap); - - /** - * 测试用:构造数据填写样本数据 - * - * @return - */ - public String createEngineTestData(@RequestParam Map paramMap); - -// public String createEngineTestResultPdf(@RequestParam Map paramMap); - - int fieldValidate(String fieldEn, String fieldCn, String engineId, Long fieldId); - - int updateFieldFolder(UpdateFolderParam param); - - String getFieldEnById(Long id); - - List queryByIds(Collection ids ); - List queryByEns(Collection ens ); - List queryByOrganAndCns(Collection cns ,Long organId); - void sqlFieldCheck(Map map); -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/service/FieldTypeService.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/service/FieldTypeService.java deleted file mode 100644 index 9e329a3..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/service/FieldTypeService.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.risk.riskmanage.datamanage.service; - -import java.util.List; -import java.util.Map; - -import com.risk.riskmanage.datamanage.model.FieldType; -import com.risk.riskmanage.datamanage.model.request.FieldTreeParam; - -public interface FieldTypeService { - - /** - * getFieldTypeList:(查找用户的字段类型列表). 支持查询组织通用字段类型、子类型 支持查询引擎自定义字段类型、子类型
- * - * @param paramMap 参数集合 - * @return 字段类型列表 - */ - public List getFieldTypeList(Map paramMap); - - /** - * findFieldTypeById:(根据传入的字段类型ID查找字段类型名).
- * - * @param paramMap 参数集合 - * @return 字段类型列表 - */ - public FieldType findFieldTypeById(Map paramMap); - - /** - * findFieldType:(查找用户可用的字段类型列表,通用组织所有,引擎只有自定义).
- * - * @param paramMap 参数集合 - * @return 字段类型列表 - */ - public List findFieldType(Map paramMap); - - /** - * createFieldType:(新增字段类型).
- * - * @param paramMap 参数集合 - * @return 插入成功 - */ - public boolean createFieldType(FieldType fieldTypeVo,Map paramMap); - - /** - * updateFieldType:(更新字段类型名).
- * - * @param paramMap 参数集合 - * @return 更新成功 - */ - public boolean updateFieldType(FieldTreeParam param); - - /** - * findNodeIds:(查找引擎在用的节点集合).
- * - * @param paramMap 参数集合 - * @return - */ - public String findNodeIds(Map paramMap); - - List getTreeList(FieldTreeParam param); -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/service/imp/FieldServiceImp.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/service/imp/FieldServiceImp.java deleted file mode 100644 index a82ffd2..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/service/imp/FieldServiceImp.java +++ /dev/null @@ -1,1633 +0,0 @@ -package com.risk.riskmanage.datamanage.service.imp; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; - -import com.risk.riskmanage.common.basefactory.BaseService; -import com.risk.riskmanage.common.enums.ErrorCodeEnum; -import com.risk.riskmanage.common.exception.ApiException; -import com.risk.riskmanage.datamanage.common.ExcelUtil; - -import com.risk.riskmanage.datamanage.common.Status; -import com.risk.riskmanage.datamanage.model.*; -import com.risk.riskmanage.datamanage.service.FieldService; -import com.risk.riskmanage.knowledge.model.Rule; -import com.risk.riskmanage.util.SessionManager; -import com.risk.riskmanage.util.StringUtil; -import com.risk.riskmanage.common.model.requestParam.UpdateFolderParam; -import org.apache.poi.openxml4j.exceptions.InvalidFormatException; -import org.apache.poi.ss.usermodel.*; -import org.dmg.pmml.scorecard.Scorecard; -import org.springframework.stereotype.Service; -import org.springframework.web.bind.annotation.RequestParam; - -import java.io.*; -import java.text.SimpleDateFormat; -import java.util.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -@Service -public class FieldServiceImp extends BaseService implements FieldService { - - protected static final Set KEY_WORDS = new HashSet(){{ - add("DELETE "); - add("DROP "); - add("TRUNCATE "); - add("UPDATE "); - add("ALTER "); - add("INSERT "); - add("CREATE "); - add("RENAME "); - }}; - /* - * 公共方法:去掉id串里重复id - */ - public StringBuffer getUniqueStr(String usedFieldStr) { - - String arrUsedFieldStr[] = usedFieldStr.split(","); - Set usedFieldSet = new HashSet<>(); - for (int k = 0; k < arrUsedFieldStr.length; k++) { - usedFieldSet.add(arrUsedFieldStr[k]); - } - String[] arrUsedField = (String[]) usedFieldSet.toArray(new String[usedFieldSet.size()]); - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < arrUsedField.length; i++) { - if (i != arrUsedField.length - 1) - sb.append(arrUsedField[i]).append(","); - else - sb.append(arrUsedField[i]); - } - return sb; - } - - @Override - public boolean createField(Field fieldVo, Map paramMap) { - - String formulaHidden = ""; - - //获取衍生字段公式编辑区域引用字段的原生字段 - if (paramMap.containsKey("formulaHidden") && !paramMap.get("formulaHidden").equals("")) { - - formulaHidden = (String) paramMap.get("formulaHidden"); - fieldVo.setFormula(formulaHidden); - - List formulaList = new ArrayList<>(); - formulaList = JSONObject.parseArray(formulaHidden); - - JSONArray jsonArrayFormula = new JSONArray(); - - String origFieldStr = ""; - String usedFieldStr = ""; - - for (int i = 0; i < formulaList.size(); i++) { - - JSONObject f = ((JSONArray) formulaList).getJSONObject(i); - JSONObject jsonObject = new JSONObject(); - jsonObject.put("fvalue", f.getString("fvalue")); - jsonObject.put("formula", f.getString("formula")); - jsonObject.put("idx", f.getString("idx")); - jsonArrayFormula.add(jsonObject); - - List farrList = new ArrayList<>(); -// if(!f.getString("farr").equals("")&&f.getString("farr")!=null){ -// farrList = JSONObject.parseArray(f.getString("farr")); -// for(int j = 0; j < farrList.size(); j++){ -// JSONObject field = ((JSONArray) farrList).getJSONObject(j); -// Map fieldMap = new HashMap(); -// fieldMap.put("userId",paramMap.get("userId")); -// fieldMap.put("engineId",paramMap.get("engineId")); -// fieldMap.put("fieldCn", field.get("fieldCN")); -// -// //公式里的字段对象 -// Field subField = fieldMapper.findByFieldCn(fieldMap); -// if(subField.getOrigFieldId()==null){ -// if(origFieldStr.equals("")){ -// origFieldStr = Long.toString(subField.getId()); -// }else{ -// origFieldStr = origFieldStr + "," + subField.getId(); -// } -// }else{ -// if(origFieldStr.equals("")){ -// origFieldStr = subField.getOrigFieldId(); -// }else{ -// origFieldStr = origFieldStr + "," + subField.getOrigFieldId(); -// } -// } -// usedFieldStr = usedFieldStr + subField.getId() + ","; //拼凑该字段引用的字段id -// } -// }else{//只从公式里提取字段 "formula":":在网时长: >=0 && :在网时长: <6" - //从公式里提取所用字段及原生字段 - String formula = f.getString("formula"); - Pattern pattern = Pattern.compile("@[a-zA-Z0-9_\u4e00-\u9fa5()()-]+@"); - Matcher matcher = pattern.matcher(formula); - while (matcher.find()) { - String fieldCN = matcher.group(0).replace("@", ""); - Map fieldMap = new HashMap(); - fieldMap.put("userId", paramMap.get("userId")); - fieldMap.put("engineId", paramMap.get("engineId")); - fieldMap.put("fieldCn", fieldCN); - - Field field = fieldMapper.findByFieldCn(fieldMap); - - if (field.getOrigFieldId() == null) { - if (origFieldStr.equals("")) { - origFieldStr = Long.toString(field.getId()); - } else { - origFieldStr = origFieldStr + "," + field.getId(); - } - } else { - if (origFieldStr.equals("")) { - origFieldStr = field.getOrigFieldId(); - } else { - origFieldStr = origFieldStr + "," + field.getOrigFieldId(); - } - } - usedFieldStr = usedFieldStr + field.getId() + ","; //拼凑该字段引用的字段id - } -// } - } - - fieldVo.setFormulaShow(JSON.toJSONString(jsonArrayFormula)); - - //合并原生字段id - if (!origFieldStr.equals("")) { - fieldVo.setOrigFieldId(getUniqueStr(origFieldStr).toString()); - } - - //合并引用字段id - if (!usedFieldStr.equals(",") && !usedFieldStr.equals("")) { - usedFieldStr = usedFieldStr.substring(0, usedFieldStr.length() - 1); - fieldVo.setUsedFieldId(getUniqueStr(usedFieldStr).toString()); - } - - } else if (paramMap.containsKey("fieldCondList") && !paramMap.get("fieldCondList").equals("")) { - //条件区域的使用字段和原生字段获取 - - /* - fieldContent=[{"fieldContent2":"[{\"fieldId\":\"3\",\"operator\":\">\",\"fieldValue\":\"200\",\"logical\":\"&&\"} - ,{\"fieldId\":\"11\",\"operator\":\"<\",\"fieldValue\":\"50\"}]","conditionValue":"5","fieldValue":"50"} - ,{"fieldContent2":"[{\"fieldId\":\"12\",\"operator\":\"in\",\"fieldValue\":\"z\",\"logical\":\"&&\"} - ,{\"fieldId\":\"11\",\"operator\":\">\",\"fieldValue\":\"200\",\"logical\":\"&&\"} - ,{\"fieldId\":\"31\",\"operator\":\">\",\"fieldValue\":\"1000\"}]","conditionValue":"8","fieldValue":"1000"} - ,{"fieldContent2":"[{\"fieldId\":\"31\",\"operator\":\">\",\"fieldValue\":\"4000\"}]","conditionValue":"9","fieldValue":"4000"}] - */ - String fieldContent = (String) paramMap.get("fieldCondList"); - List fieldContentList = new ArrayList<>(); - fieldContentList = JSONObject.parseArray(fieldContent); - - String origFieldStr = ""; - String usedFieldStr = ""; - - for (int i = 0; i < fieldContentList.size(); i++) { - JSONObject fc = ((JSONArray) fieldContentList).getJSONObject(i); - List farrList = new ArrayList<>(); - if (!fc.getString("fieldSubCond").equals("") && fc.getString("fieldSubCond") != null) { - farrList = JSONObject.parseArray(fc.getString("fieldSubCond")); - for (int j = 0; j < farrList.size(); j++) { - JSONObject ObjField = ((JSONArray) farrList).getJSONObject(j); - usedFieldStr = usedFieldStr + ObjField.get("fieldId") + ","; - - Map fieldMap = new HashMap(); - fieldMap.put("userId", paramMap.get("userId")); - fieldMap.put("engineId", paramMap.get("engineId")); - fieldMap.put("id", ObjField.get("fieldId")); - Field field = fieldMapper.findByFieldId(fieldMap); - - if (field.getOrigFieldId() == null) { - if (origFieldStr.equals("")) { - origFieldStr = Long.toString(field.getId()); - } else { - origFieldStr = origFieldStr + "," + field.getId(); - } - } else { - if (origFieldStr.equals("")) { - origFieldStr = field.getOrigFieldId(); - } else { - origFieldStr = origFieldStr + "," + field.getOrigFieldId(); - } - } - - - } - } - } - - //合并引用字段id - if (!usedFieldStr.equals(",") && !usedFieldStr.equals("")) { - usedFieldStr = usedFieldStr.substring(0, usedFieldStr.length() - 1); - fieldVo.setUsedFieldId(getUniqueStr(usedFieldStr).toString()); - } - - //合并原生字段id - if (!origFieldStr.equals("")) { - fieldVo.setOrigFieldId(getUniqueStr(origFieldStr).toString()); - } - } - - if (fieldMapper.isExists(paramMap) == 0) { - fieldMapper.createField(fieldVo); - FieldUser fieldUserVo = new FieldUser(); - fieldUserVo.setFieldId(fieldVo.getId()); - fieldUserVo.setOrganId((Long) paramMap.get("organId")); - if (paramMap.get("engineId") != null) { - fieldUserVo.setEngineId(Long.valueOf((String) paramMap.get("engineId"))); - } - fieldUserVo.setUserId((Long) paramMap.get("userId")); - fieldUserVo.setStatus(Status.enable.value); - fieldUserMapper.createFieldUserRel(fieldUserVo); - - //可能衍生字段只有公式,没有条件设置 - if (paramMap.containsKey("fieldCondList")) { - - String fieldContent = (String) paramMap.get("fieldCondList"); - if (!fieldContent.equals("")) { - List fieldCondVoList = new ArrayList(); - List condList = new ArrayList<>(); - condList = JSONObject.parseArray(fieldContent); - for (int i = 0; i < condList.size(); i++) { - JSONObject cond = ((JSONArray) condList).getJSONObject(i); - List subCondList = new ArrayList<>(); - if (!cond.getString("fieldSubCond").equals("")) { - subCondList = JSONObject.parseArray(cond.getString("fieldSubCond")); - for (int j = 0; j < subCondList.size(); j++) { - JSONObject subCond = ((JSONArray) subCondList).getJSONObject(j); - FieldCond fieldCondVo = new FieldCond(); - fieldCondVo.setFieldId(fieldVo.getId()); - fieldCondVo.setConditionValue(cond.getString("conditionValue")); - fieldCondVo.setContent(cond.getString("fieldSubCond")); - fieldCondVo.setCondFieldId(Long.valueOf(subCond.getString("fieldId"))); - fieldCondVo.setCondFieldOperator(subCond.getString("operator")); - fieldCondVo.setCondFieldValue(subCond.getString("fieldValue")); - fieldCondVo.setCondFieldLogical(subCond.getString("logical")); - fieldCondVoList.add(fieldCondVo); - } - } - fieldCondMapper.createFieldCond(fieldCondVoList); - } - - } - } - - - //可能衍生字段只有公式,没有条件设置 -/* if(paramMap.containsKey("formulaFields")){ - String formulaFields = (String) paramMap.get("formulaFields"); - Long fieldId = fieldVo.getId(); - if(!formulaFields.equals("")){ - String[] idArray = null; - idArray = formulaFields.split(","); - List formulaFieldVoList = new ArrayList(); - for(int i=0;i paramMap) { - - String formulaHidden = ""; - - if (paramMap.containsKey("formulaHidden") && !paramMap.get("formulaHidden").equals("")) { - - formulaHidden = (String) paramMap.get("formulaHidden"); - paramMap.put("formula", formulaHidden); - - List formulaList = new ArrayList<>(); - formulaList = JSONObject.parseArray(formulaHidden); - - JSONArray jsonArrayFormula = new JSONArray(); - - String origFieldStr = ""; - String usedFieldStr = ""; - - for (int i = 0; i < formulaList.size(); i++) { - - JSONObject f = ((JSONArray) formulaList).getJSONObject(i); - JSONObject jsonObject = new JSONObject(); - jsonObject.put("fvalue", f.getString("fvalue")); - jsonObject.put("formula", f.getString("formula")); - jsonObject.put("idx", f.getString("idx")); - jsonArrayFormula.add(jsonObject); - - List farrList = new ArrayList<>(); -// if(!f.getString("farr").equals("")&&f.getString("farr")!=null){ -// farrList = JSONObject.parseArray(f.getString("farr")); -// for(int j = 0; j < farrList.size(); j++){ -// JSONObject field = ((JSONArray) farrList).getJSONObject(j); -// Map fieldMap = new HashMap(); -// fieldMap.put("userId",paramMap.get("userId")); -// fieldMap.put("engineId",paramMap.get("engineId")); -// fieldMap.put("fieldCn", field.get("fieldCN")); -// -// //公式里的字段对象 -// Field subField = fieldMapper.findByFieldCn(fieldMap); -// if(subField.getOrigFieldId()==null){ -// if(origFieldStr.equals("")){ -// origFieldStr = Long.toString(subField.getId()); -// }else{ -// origFieldStr = origFieldStr + "," + subField.getId(); -// } -// }else{ -// if(origFieldStr.equals("")){ -// origFieldStr = subField.getOrigFieldId(); -// }else{ -// origFieldStr = origFieldStr + "," + subField.getOrigFieldId(); -// } -// } -// usedFieldStr = usedFieldStr + subField.getId() + ","; //拼凑该字段引用的字段id -// } -// }else{//只从公式里提取字段 "formula":":在网时长: >=0 && :在网时长: <6" - //从公式里提取所用字段及原生字段 - String formula = f.getString("formula"); - Pattern pattern = Pattern.compile("@[a-zA-Z0-9_\u4e00-\u9fa5()()-]+@"); - Matcher matcher = pattern.matcher(formula); - while (matcher.find()) { - String fieldCN = matcher.group(0).replace("@", ""); - Map fieldMap = new HashMap(); - fieldMap.put("userId", paramMap.get("userId")); - fieldMap.put("engineId", paramMap.get("engineId")); - fieldMap.put("fieldCn", fieldCN); - - Field field = fieldMapper.findByFieldCn(fieldMap); - - if (field.getOrigFieldId() == null) { - if (origFieldStr.equals("")) { - origFieldStr = Long.toString(field.getId()); - } else { - origFieldStr = origFieldStr + "," + field.getId(); - } - } else { - if (origFieldStr.equals("")) { - origFieldStr = field.getOrigFieldId(); - } else { - origFieldStr = origFieldStr + "," + field.getOrigFieldId(); - } - } - usedFieldStr = usedFieldStr + field.getId() + ","; //拼凑该字段引用的字段id - } -// } - } - - paramMap.put("formulaShow", JSON.toJSONString(jsonArrayFormula)); - //合并原生字段id - if (!origFieldStr.equals("")) { - -/* String arrOrigFieldStr[] = origFieldStr.split(","); - Set origFieldSet = new HashSet<>(); - for(int k=0;k\",\"fieldValue\":\"200\",\"logical\":\"&&\"} - ,{\"fieldId\":\"11\",\"operator\":\"<\",\"fieldValue\":\"50\"}]","conditionValue":"5","fieldValue":"50"} - ,{"fieldContent2":"[{\"fieldId\":\"12\",\"operator\":\"in\",\"fieldValue\":\"z\",\"logical\":\"&&\"} - ,{\"fieldId\":\"11\",\"operator\":\">\",\"fieldValue\":\"200\",\"logical\":\"&&\"} - ,{\"fieldId\":\"31\",\"operator\":\">\",\"fieldValue\":\"1000\"}]","conditionValue":"8","fieldValue":"1000"} - ,{"fieldContent2":"[{\"fieldId\":\"31\",\"operator\":\">\",\"fieldValue\":\"4000\"}]","conditionValue":"9","fieldValue":"4000"}] - */ - String fieldContent = (String) paramMap.get("fieldCondList"); - List fieldContentList = new ArrayList<>(); - fieldContentList = JSONObject.parseArray(fieldContent); - - String origFieldStr = ""; - String usedFieldStr = ""; - - for (int i = 0; i < fieldContentList.size(); i++) { - JSONObject fc = ((JSONArray) fieldContentList).getJSONObject(i); - List farrList = new ArrayList<>(); - if (!fc.getString("fieldSubCond").equals("") && fc.getString("fieldSubCond") != null) { - farrList = JSONObject.parseArray(fc.getString("fieldSubCond")); - for (int j = 0; j < farrList.size(); j++) { - JSONObject ObjField = ((JSONArray) farrList).getJSONObject(j); - usedFieldStr = usedFieldStr + ObjField.get("fieldId") + ","; - - Map fieldMap = new HashMap(); - fieldMap.put("userId", paramMap.get("userId")); - fieldMap.put("engineId", paramMap.get("engineId")); - fieldMap.put("id", ObjField.get("fieldId")); - Field field = fieldMapper.findByFieldId(fieldMap); - - if (field.getOrigFieldId() == null) { - if (origFieldStr.equals("")) { - origFieldStr = Long.toString(field.getId()); - } else { - origFieldStr = origFieldStr + "," + field.getId(); - } - } else { - if (origFieldStr.equals("")) { - origFieldStr = field.getOrigFieldId(); - } else { - origFieldStr = origFieldStr + "," + field.getOrigFieldId(); - } - } - } - } - } - //合并引用字段id - if (!usedFieldStr.equals(",") && !usedFieldStr.equals("")) { - usedFieldStr = usedFieldStr.substring(0, usedFieldStr.length() - 1); - paramMap.put("usedFieldId", getUniqueStr(usedFieldStr).toString()); - } - //合并原生字段id - if (!origFieldStr.equals("")) { - paramMap.put("origFieldId", getUniqueStr(origFieldStr).toString()); - } - } - - Long id = Long.valueOf(paramMap.get("id").toString()); - //检查字段id是否归属该用户存在 - Field oldFieldVo = new Field(); - oldFieldVo = fieldMapper.findByFieldId(paramMap); - if (!oldFieldVo.getId().equals(null)) { - fieldMapper.updateField(paramMap); - - fieldCondMapper.deleteFieldCondById(id); - - String fieldContent = (String) paramMap.get("fieldCondList"); - List fieldCondVoList = new ArrayList(); - List condList = new ArrayList<>(); - if (!fieldContent.equals("")) { - condList = JSONObject.parseArray(fieldContent); - for (int i = 0; i < condList.size(); i++) { - JSONObject cond = ((JSONArray) condList).getJSONObject(i); - List subCondList = new ArrayList<>(); - subCondList = JSONObject.parseArray(cond.getString("fieldSubCond")); - for (int j = 0; j < subCondList.size(); j++) { - JSONObject subCond = ((JSONArray) subCondList).getJSONObject(j); - FieldCond fieldCondVo = new FieldCond(); - fieldCondVo.setFieldId(id); - fieldCondVo.setConditionValue(cond.getString("conditionValue")); - fieldCondVo.setContent(cond.getString("fieldSubCond")); - fieldCondVo.setCondFieldId(Long.valueOf(subCond.getString("fieldId"))); - fieldCondVo.setCondFieldOperator(subCond.getString("operator")); - fieldCondVo.setCondFieldValue(subCond.getString("fieldValue")); - fieldCondVo.setCondFieldLogical(subCond.getString("logical")); - fieldCondVoList.add(fieldCondVo); - } - } - fieldCondMapper.createFieldCond(fieldCondVoList); - } - - //判断衍生字段的公式是否发生改变,改变了再执行相应操作 -/* if(paramMap.get("formula").equals(oldFieldVo.getFormula())){ - //do nothing. - }else if(paramMap.get("formula").equals("")){ - formulaFieldMapper.deleteFormulaField(paramMap); - }else { - if(!oldFieldVo.getFormula().equals("")){ - formulaFieldMapper.deleteFormulaField(paramMap); - } - String formulaFields = (String) paramMap.get("formulaFields"); - Long fieldId = (Long) paramMap.get("id"); - String[] idArray = null; - idArray = formulaFields.split(","); - List formulaFieldVoList = new ArrayList(); - for(int i=0;i getField(String usedFieldId){ - - //String fieldIds = ""; - Map paramMap = new HashMap(); - Long userId = SessionManager.getLoginAccount().getUserId(); - paramMap.put("userId", userId); - paramMap.put("fieldId", usedFieldId); - - List fieldList = fieldMapper.findUsedFieldId(paramMap); - for (Iterator iterator = fieldList.iterator(); iterator.hasNext();) { - Field fieldVo = (Field) iterator.next(); - paramMap.put("fieldId", fieldVo.getId()); - } - paramMap.put("fieldList",fieldList); - return paramMap; - }*/ - - /** - * 查找继承自某字段的所有字段id拼成逗号分隔的字符串返回 - * - * @return - */ - public String getField(String fieldIds, String usedFieldId, String engineId) { - - Map param = new HashMap(); -// Long userId = SessionManager.getLoginAccount().getUserId(); - Long userId = SessionManager.getLoginAccount().getUserId(); - param.put("userId", userId); - param.put("fieldId", usedFieldId); - param.put("engineId", engineId); - - fieldIds = ""; - - String str = fieldMapper.checkField(param); - - if (str != null && str.length() >= 0) { - - String arrIds[] = str.split(","); - for (int i = 0; i < arrIds.length; i++) { - if (fieldIds.equals("")) { - fieldIds = getField("", arrIds[i], engineId); - } else { - fieldIds = fieldIds + "," + getField("", arrIds[i], engineId); - } - - } - } else { - return usedFieldId; - } - return fieldIds; - } - - /** - * 查找某字段的所有组成字段id并与该字段一起拼成逗号分隔的字符串返回,用于拷贝字段时检查组成该字段的所有子字段 - * - * @return - */ - @Override - public String getSourceField(String fieldIds, String fieldId) { - - Map paramMap = new HashMap(); - Long userId = SessionManager.getLoginAccount().getUserId(); - paramMap.put("userId", userId); - paramMap.put("fieldId", fieldId); - - fieldIds = ""; - - //String origFieldId = param.get("origFieldId"); - String usedFieldId = fieldMapper.getSourceField(paramMap); - - if (usedFieldId != null && usedFieldId.length() >= 0) { - //fieldIds = usedFieldId; - String arrIds[] = usedFieldId.split(","); - for (int i = 0; i < arrIds.length; i++) { - if (fieldIds.equals("")) - fieldIds = getSourceField("", arrIds[i]); - else - fieldIds = fieldIds + "," + getSourceField("", arrIds[i]); - } - } else { - return fieldId; - } - - return fieldIds; - } - - /** - * 公共检查字段方法 供删除、停用、编辑提交时校验用 - * - * @return - */ - @Override - public Map checkField(Map paramMap) { - - boolean beUsed = false; - - List fieldList = new ArrayList(); - List ruleList = new ArrayList(); - - String fieldIds = ""; - - String fieldId = (String) paramMap.get("fieldId"); - String s = getField("", fieldId, (String) paramMap.get("engineId")); - - //如果字段没有被引用不做字段有效性校验 - if (!s.equals("") && !s.equals(fieldId)) { - fieldIds = getUniqueStr(s).toString(); - List Ids = new ArrayList(); - Ids = StringUtil.toLongList(fieldIds); - paramMap.put("Ids", Ids); - if (!fieldIds.equals("") && fieldIds != null) { - //校验字段,命中则b改为true - fieldList = fieldMapper.findFieldByIdsForCheckField(paramMap); - if (fieldList.size() > 0) - beUsed = true; - } - s = fieldId + "," + s; //把自身字段加入检查序列,为后续检查做准备 - } else { - s = fieldId; - } - - fieldIds = getUniqueStr(s).toString(); - List Ids = new ArrayList(); - Ids = StringUtil.toLongList(fieldIds); - paramMap.put("Ids", Ids); - - //校验规则管理的规则,命中则b改为true - paramMap.put("fieldIds", Ids); - ruleList = ruleMapper.checkByField(paramMap); - if (ruleList.size() > 0) - beUsed = true; - //<待完善>校验引擎管理-决策流节点(决策选项-客户分群) - - - paramMap.put("fieldList", fieldList); - paramMap.put("ruleList", ruleList); - paramMap.put("beUsed", beUsed); - - return paramMap; - - } - - @Override - public Map updateStatus(Map paramMap) { - - boolean result = false; - - List Ids = (List) paramMap.get("Ids"); - paramMap.put("Ids", Ids); - - if (paramMap.containsKey("status") && !paramMap.get("status").equals("1")) {//停用、删除特殊处理需要增加校验 - - for (Iterator iterator = Ids.iterator(); iterator.hasNext(); ) { - Long Id = (Long) iterator.next(); - paramMap.put("fieldId", Id.toString()); - checkField(paramMap); - if ((boolean) paramMap.get("beUsed")) { - break; // 遇到第一个被使用的就跳出循环来 - } - } - - if (!(boolean) paramMap.get("beUsed")) { - paramMap.put("Ids", Ids); - result = fieldUserMapper.updateStatus(paramMap); - } - - } else if (paramMap.containsKey("listType") && paramMap.get("listType").equals("cabage") - && paramMap.get("status").equals("1")) {//回收站里删除状态变为启用状态 - - result = backEngFieldType(paramMap); - - } else {//停用变启用 - result = fieldUserMapper.updateStatus(paramMap); - } - - paramMap.put("result", result); - - return paramMap; - } - - @Override - public List findByFieldType(Map paramMap) { - - if (!paramMap.containsKey("fType")) { - return null; - // throw new ApiException(ErrorCodeEnum.SERVER_ERROR.getVersionCode(), ErrorCodeEnum.SERVER_ERROR.getMessage()); - } - Integer fType = Integer.valueOf(paramMap.get("fType").toString()); - - switch (fType) { - case 1: - // paramMap.put("useSql", false); - // paramMap.put("derivative", false); - break; - case 2: - // paramMap.put("useSql", true); - break; - case 3: - // paramMap.put("derivative", true); - break; - case 4: - // paramMap.put("interface", true); - break; - default: - throw new ApiException(ErrorCodeEnum.SERVER_ERROR.getCode(), ErrorCodeEnum.SERVER_ERROR.getMessage()); - } - - return fieldMapper.findByFieldType(paramMap); - } - - @Override - public int isExists(Map paramMap) { - return fieldMapper.isExists(paramMap); - } - - - @Override - public Field findByFieldId(Map paramMap) { - return fieldMapper.findByFieldId(paramMap); - } - - @Override - public List findByUser(Map paramMap) { - return fieldMapper.findByUser(paramMap); - } - - @Override - public Long findFieldTypeId(Map paramMap) { - return fieldMapper.findFieldTypeId(paramMap); - } - - @Override - public List findExcelByFieldType(Map paramMap) { - return fieldMapper.findExcelByFieldType(paramMap); - } - @Override - public List getFieldList(Map paramMap) { - return fieldMapper.getFieldList(paramMap); - } - - @Override - public List searchByName(Map paramMap) { - return fieldMapper.searchByName(paramMap); - } - - @Override - public List findFieldByIds(Map paramMap) { - return fieldMapper.findFieldByIds(paramMap); - } - - @Override - public Field findByFieldEn(Map paramMap) { - return fieldMapper.findByFieldEn(paramMap); - } - - @Override - public boolean createEngineField(Map paramMap) { - - fieldTypeUserMapper.batchBindEngineFieldTypeUserRel(paramMap); - fieldUserMapper.batchCreateEngineFieldUserRel(paramMap); - - return true; - } - - @Override - public boolean bindEngineField(Map paramMap) { - - Long userId = SessionManager.getLoginAccount().getUserId(); - Long organId = SessionManager.getLoginAccount().getOrganId(); - paramMap.put("userId", userId); - paramMap.put("organId", organId); - - //获取所有字段id - String iFieldIds = (String) paramMap.get("fieldIds"); - String oFieldIds = iFieldIds; - if (iFieldIds != null && iFieldIds.length() >= 0) { - String arrIds[] = iFieldIds.split(","); - for (int i = 0; i < arrIds.length; i++) { - oFieldIds = oFieldIds + "," + getSourceField("", arrIds[i]); - } - } - String strFieldIds = getUniqueStr(oFieldIds).toString(); - - //把不存在字段关系绑定在一起 - if (!strFieldIds.equals("") && strFieldIds != null) { - //获取所有字段类型id - List fieldIds = StringUtil.toLongList(strFieldIds); - paramMap.put("fieldIds", fieldIds); - fieldUserMapper.batchBindEngineFieldUserRel(paramMap); - } - - - String strFieldTypeIds = fieldMapper.findOrgFieldTypeIdsByIds(paramMap); - if (!strFieldTypeIds.equals("") && strFieldTypeIds != null) { - - String parentFieldTypeIds = ""; - //查所有字段类型id的父id - if (!strFieldTypeIds.equals("")) { - strFieldTypeIds = getUniqueStr(strFieldTypeIds).toString(); - String arrIds[] = strFieldTypeIds.split(","); - - for (int i = 0; i < arrIds.length; i++) { - if (parentFieldTypeIds.equals("")) { - parentFieldTypeIds = getAllParentFieldTypeId("", arrIds[i], ""); - } else { - parentFieldTypeIds = parentFieldTypeIds + "," + getAllParentFieldTypeId("", arrIds[i], ""); - } - } - } - - if (!parentFieldTypeIds.equals("")) { - strFieldTypeIds = strFieldTypeIds + "," + parentFieldTypeIds; - } - List fieldTypeIds = StringUtil.toLongList(strFieldTypeIds); - - paramMap.put("fieldTypeIds", fieldTypeIds); - fieldTypeUserMapper.batchBindEngineFieldTypeUserRel(paramMap); - } - - return true; - } - - /** - * 判断表达式的运算结果是否数值型的公共方法 - */ - public boolean isNumeric(String str) { - Pattern pattern = Pattern.compile("^(-|\\+)?\\d+(\\.\\d+)?$"); - Matcher isNum = pattern.matcher(str); - if (!isNum.matches()) { - return false; - } - return true; - } - - @Override - public Map importExcel(String url, Map paramMap) { - Map resultMap = new HashMap<>(); - - InputStream is = null; - Workbook Workbook = null; - Sheet Sheet; - try { - is = new FileInputStream(url); - Workbook = WorkbookFactory.create(is); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (InvalidFormatException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - - List fieldVoList = new ArrayList(); - List fieldEnList = new ArrayList<>(); - int sucRows = 0; // 导入成功行数 - int failRows = 0; // 导入失败行数 - int repeatRows = 0; // 重复行数 - int existRows = 0; // 已存在的字段 - - // 循环工作表 Sheet - for (int numSheet = 0; numSheet < Workbook.getNumberOfSheets(); numSheet++) { - Sheet = Workbook.getSheetAt(numSheet); - if (Sheet == null) { - continue; - } - // 循环行 Row - for (int rowNum = 1; rowNum <= Sheet.getLastRowNum(); rowNum++) { - try { - Row Row = Sheet.getRow(rowNum); - if (Row == null) { - continue; - } - Field fieldVo = new Field(); - fieldVo.setAuthor(Long.valueOf(paramMap.get("author").toString())); - fieldVo.setIsCommon(Integer.valueOf(paramMap.get("isCommon").toString())); - - // 循环单元格 Cell - for (int cellNum = 0; cellNum <= Row.getLastCellNum(); cellNum++) { - Cell cell = Row.getCell(cellNum); - String cellStr = ExcelUtil.getCellValue(cell).trim(); - switch (cellNum) { // 逐单元格处理 - - case 0: - fieldVo.setFieldEn(cellStr); - break; - case 1: - fieldVo.setFieldCn(cellStr); - break; - case 2: - paramMap.put("fieldType", cellStr); - Long fieldTypeId = fieldTypeMapper.findIdByFieldType(paramMap); - if (fieldTypeId != 0) - fieldVo.setFieldTypeId(fieldTypeId); - else - fieldVo.setFieldTypeId(new Long(0)); //异常1:如果字段类型没法匹配,如何处理? - break; - case 3: - Integer valueType = 0; - if (cellStr.equals("数值型")) { - valueType = 1; - } - if (cellStr.equals("字符型")) { - valueType = 2; - } - if (cellStr.equals("枚举型")) { - valueType = 3; - } - if (cellStr.equals("小数型")) { - valueType = 4; - } - fieldVo.setValueType(valueType); - break; - case 4: - fieldVo.setValueScope(cellStr); - break; - case 5: - if (ExcelUtil.getCellValue(cell).equals("Y")) { - fieldVo.setIsDerivative(1); - } else { - fieldVo.setIsDerivative(0); - } - break; - case 6: - if (cellStr.equals("Y")) { - fieldVo.setIsOutput(1); - } else if (cellStr.equals("N")) { - fieldVo.setIsOutput(0); - } - break; - case 7://这里只处理公式原始值,不确定回显字段及字段绑定 - fieldVo.setFormula(cellStr); - break; - default: - break; - } - } - if (fieldVo.getFieldEn() != null) { - paramMap.put("fieldEn", fieldVo.getFieldEn()); - Field OldFieldVo = fieldMapper.findByFieldName(paramMap); - if (OldFieldVo != null) { - existRows++; - // fieldVo.setId(OldFieldVo.getId()); - // 不能直接更新字段,需先修改已使用到的地方 - // fieldMapper.updateField(paramMap); - } else { - // 防止重复字段 - if (fieldEnList.contains(fieldVo.getFieldEn())) { - repeatRows++; - } else { - sucRows++; - // 加入到list,等待批量更新 - fieldVoList.add(fieldVo); - fieldEnList.add(fieldVo.getFieldEn()); - } - } - } - } catch (Exception e) { - failRows++; - e.printStackTrace(); - } - }// end for Row - }// end first sheet - if (fieldVoList.size() > 0) { - fieldMapper.batchCreateField(fieldVoList); - paramMap.put("status", 1);// 导入后字段状态默认启用 - fieldUserMapper.batchCreateFieldUserRel(paramMap); - } - resultMap.put("sucRows", sucRows); - resultMap.put("failRows", failRows); - resultMap.put("repeatRows", repeatRows); - resultMap.put("existRows", existRows); - return resultMap; - } - - @Override - public Field findByFieldCn(Map paramMap) { - return fieldMapper.findByFieldCn(paramMap); - } - - /** - * 查找某字段类型所有的<子类型>拼成逗号分隔的字符串 - * - * @return - */ - public String getAllFieldTypeId(String ids, String pid, String engineId) { - - Map param = new HashMap(); - Long userId = SessionManager.getLoginAccount().getUserId(); - param.put("userId", userId); - param.put("engineId", engineId); - param.put("parentId", pid); - - String sid = fieldTypeMapper.findTypeIdByParentId(param); - if (sid != null && sid.length() > 0) { - if (ids.equals("")) - ids = sid; - else - ids = ids + "," + sid; - - String arrIds[] = sid.split(","); - for (int i = 0; i < arrIds.length; i++) { - String str = getAllFieldTypeId("", arrIds[i], engineId); - if (!str.equals("")) - ids = ids + "," + str; - } - } - return ids; - } - - /** - * 查找某字段类型所有的<父类型>拼成逗号分隔的字符串 - * - * @return - */ - public String getAllParentFieldTypeId(String ids, String id, String engineId) { - - Map param = new HashMap(); - Long userId = SessionManager.getLoginAccount().getUserId(); - param.put("userId", userId); - if (engineId == null || engineId.equals("")) { - engineId = null; - } - param.put("engineId", engineId); - param.put("fieldTypeId", id); - - String pid = fieldTypeMapper.findParentIdByTypeId(param); - String s = ""; - if (!pid.equals("0")) { - ids = id + "," + getAllParentFieldTypeId("", pid, engineId); - } else { - return id; - } - - return ids; - } - - /** - * 公共检查字段类型下的所有字段是否被使用 供删除时校验用 - * - * @return - */ - @Override - public Map checkFieldType(Map paramMap) { - - String pid = (String) paramMap.get("pid"); - String engineId = (String) paramMap.get("engineId"); - - String strfieldTypeIds = getAllFieldTypeId("", pid, engineId); - - - if (strfieldTypeIds != null && strfieldTypeIds.length() > 0) - strfieldTypeIds = pid + "," + strfieldTypeIds; //加上当前节点 - else - strfieldTypeIds = pid; - - List fieldTypeIds = StringUtil.toLongList(strfieldTypeIds); - paramMap.put("fieldTypeIds", fieldTypeIds); - - //获取所有字段类型下的所有启用和停用状态的字段id,逗号分割 - String fieldIds = ""; - fieldIds = fieldMapper.findFieldIdsByTypeIds(paramMap); - - if (fieldIds != null) { - String arrIds[] = fieldIds.split(","); - for (int i = 0; i < arrIds.length; i++) { - - paramMap.put("fieldId", arrIds[i]); - - checkField(paramMap); - if ((boolean) paramMap.get("beUsed")) { - break; // 遇到第一个字段存在被使用的情况就跳出循环来 - } - } - } - paramMap.put("fieldTypeIds", strfieldTypeIds); - paramMap.put("fieldIds", fieldIds); - return paramMap; - } - - public Map deleteNode(@RequestParam Map paramMap) { - - Long userId = SessionManager.getLoginAccount().getUserId(); - paramMap.put("userId", userId); - - String strFieldIds = ""; - strFieldIds = (String) paramMap.get("fieldIds"); - List fieldIds = StringUtil.toLongList(strFieldIds); - paramMap.put("fieldIds", fieldIds); - - List fieldTypeIds = StringUtil.toLongList((String) paramMap.get("fieldTypeIds")); - paramMap.put("fieldTypeIds", fieldTypeIds); - - //先更新字段状态状态为-1 - boolean f = false; - if (!strFieldIds.equals("")) - f = fieldUserMapper.deleteFieldByIds(paramMap); - else - f = true; - //再更新字段类型树状态为-1 - boolean ft = fieldTypeMapper.updateFieldTypeByTypeIds(paramMap); - //删除没有字段的空节点 - boolean ftd = fieldTypeMapper.deleteFieldTypeByTypeIds(paramMap); - - paramMap.put("fieldUpdate", f); - paramMap.put("fieldTypeUpdate", ft); - - Integer result = -1; - if (f && ft) { - result = 1; - } - paramMap.put("result", result); - - return paramMap; - } - - /** - * 从回收站还原一个或多个同类型或不同类型字段同时还原字段类型 - * - * @return - */ - public boolean backEngFieldType(Map paramMap) { - - Long userId = SessionManager.getLoginAccount().getUserId(); - paramMap.put("userId", userId); - - String basicFieldTypeIds = fieldMapper.findFieldTypeIdsByFieldId(paramMap); - - String strFieldTypeIds = basicFieldTypeIds; - - String arrIds[] = basicFieldTypeIds.split(","); - for (int i = 0; i < arrIds.length; i++) { - String str = getAllParentFieldTypeId("", arrIds[i], (String) paramMap.get("engineId")); - if (!str.equals("")) { - strFieldTypeIds = strFieldTypeIds + "," + str; - } - } - - //更新指定字段状态为1 - boolean f = fieldUserMapper.backFieldByIds(paramMap); - - //更新指定类型节点状态为1 - List fieldTypeIds = StringUtil.toLongList(strFieldTypeIds); - paramMap.put("fieldTypeIds", fieldTypeIds); - boolean ft = fieldTypeMapper.backFieldTypeByTypeIds(paramMap); - //ft 有两种情况:true是通过删除树节点还原会更新,如果通过删除字段还原,执行结果是false. - boolean result = false; - if (f) - result = true; - - return result; - - } - - @Override - public int isExistsFieldType(Map paramMap) { - return fieldTypeMapper.isExists(paramMap); - } - - @Override - public int isExistsDefaultTreeName(Map paramMap) { - return fieldTypeMapper.isExistsDefaultTreeName(paramMap); - } - - @Override - public String findFieldIdsByTypeIds(Map paramMap) { - return fieldMapper.findFieldIdsByTypeIds(paramMap); - } - - @Override - public String findOrgFieldIdsByTypeIds(Map paramMap) { - return fieldMapper.findOrgFieldIdsByTypeIds(paramMap); - } - - /** - * 生成引擎批量测试的样本数据 - * - * @return - */ - @Override - public String createEngineTestData(@RequestParam Map paramMap) { - - Long userId = SessionManager.getLoginAccount().getUserId(); - paramMap.put("userId", userId); - - //构造虚拟测试数据 输入字段id既是原生字段 - -// String strIds = (String) paramMap.get("Ids"); -// List Ids = StringUtil.toLongList(strIds); -// paramMap.put("Ids", Ids); -// List fieldList = fieldMapper.findFieldByIds(paramMap); - - List fieldList = (List) paramMap.get("fieldList"); - - Integer fieldCt = fieldList.size(); //获取字段个数 - - Long rowCt = Long.valueOf((String) paramMap.get("rowCt")).longValue(); //样本数 - double nullCtRatio = new Double((String) paramMap.get("nullCtRatio")); - Long nullCt = (long) (nullCtRatio * rowCt * fieldCt / 100); //所有样本参数中参数为空的总个数 - double elseCtRatio = new Double((String) paramMap.get("elseCtRatio")); - Long elseCt = (long) (elseCtRatio * rowCt * fieldCt / 100); //所有样本参数中超界参数的总个数 - - int iNullCt = 0; //初始化参数为空的计数器 - int iElseCt = 0; //初始化参数超界的计数器 - - Random random = new Random(); - StringBuffer testData = new StringBuffer(); - for (int i = 0; i < rowCt; i++) { - int colNums = fieldList.size(); - - int ct = 0; - for (Iterator iterator = fieldList.iterator(); iterator.hasNext(); ) { - - boolean flag = false; //异常开关 - - Field field = (Field) iterator.next(); - - String fieldEn = field.getFieldEn(); - Integer valueType = field.getValueType(); - String valueScope = field.getValueScope(); - - testData.append("\"").append(fieldEn).append("\"").append(":"); - - //优先按照随机情况赋值 - int nullKey = random.nextInt(2); //nullKey=1时表示用null - if (nullKey == 1 && iNullCt < nullCt) { - testData.append("\"\""); - iNullCt += 1; - flag = true; - } - - if (!flag) { - int elseKey = random.nextInt(2); //elseKey=1时表示用else - if (elseKey == 1 && iElseCt < elseCt && valueType != 2) { //超界的(字符类型字段没有超界) - if (valueType == 1) { - String minS = valueScope.substring(1, valueScope.indexOf(",")); //(1,5) 1 - String maxS = valueScope.substring(valueScope.indexOf(",") + 1, valueScope.length() - 1); //(1,5) 5 (1,) 右开区间 - if (!maxS.equals("")) {//超界 右边界存在加1 - int v = Integer.parseInt(maxS) + 1; - testData.append("\"" + v + "\""); - } else if (maxS.equals("") && !minS.equals("")) { - int v = Integer.parseInt(minS) - 1; - testData.append("\"" + v + "\"");//超界 左边界存在减1 - } - } - if (valueType == 3) { - testData.append("\"" + "-999999" + "\""); //按照统一枚举值处理 负数的最大位数 - } - iElseCt += 1; - flag = true; - } - } - - if (!flag) { - //按照正常取值范围赋值 - if (valueType == 1) {//数值型 - String minS = valueScope.substring(1, valueScope.indexOf(",")); //(1,5) 1 - String maxS = valueScope.substring(valueScope.indexOf(",") + 1, valueScope.length() - 1); //(1,5) 5 - testData.append("\"" + getRandomInt(minS, maxS) + "\""); - } else if (valueType == 2) {//字符型 - testData.append("\"" + getRandomString(6) + "\""); //6位长度随机数字字符 - } else if (valueType == 3) {//枚举型 - String arrValueScope[] = valueScope.split(","); - int l = arrValueScope.length; - int k = random.nextInt(l) % (l + 1); - //随机取值 - for (int j = 0; j < arrValueScope.length; j++) { - if (j == k) { - String value = arrValueScope[j]; - String tV = value.substring(value.indexOf(":") + 1, value.length()); - testData.append("\"" + tV + "\""); - } - } - } - } - - ct += 1; - if (ct != fieldCt) - testData.append(","); - - } - //每条样本数据缺少唯一id,将来结果查询如何对应? - testData.append("\r\n"); - - } - - //把生成的数据存入txt文件并返回路径 - String fileName = ""; - String fileUrl = ""; - try { - SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss"); - fileName = paramMap.get("engineId") + "_" + paramMap.get("versionId") + "_" + sdf.format(new Date()) + ".txt"; - fileUrl = paramMap.get("downloadDir") + "/" + fileName; - File newFile = new File(fileUrl); - if (newFile.createNewFile()) { - PrintWriter p = new PrintWriter(new FileOutputStream(newFile.getAbsolutePath())); - p.write(testData.toString()); - p.close(); - } - } catch (Exception e) { - e.printStackTrace(); - } - - return fileName; - } - -// /** -// * 引擎批量测试的结果转成pdf文件 -// * -// * @return -// */ -// @Override -// public String createEngineTestResultPdf(@RequestParam Map paramMap) { -// -// Integer id = Integer.valueOf(String.valueOf(paramMap.get("resultSetId"))); -// EngineResultSet resultSet = new EngineResultSet(); -// resultSet.setId(id); -// resultSet = resultSetMapper.getResultSetById(resultSet); -// -// //createPDFWithChinese(); -// String fileName = ""; -// String fileUrl = ""; -// SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_hhmmss"); -// fileName = sdf.format(new Date()) + ".pdf"; -// fileUrl = paramMap.get("path") + fileName; -// -// try { -// Document document = new Document(); -// PdfWriter.getInstance(document, new FileOutputStream(fileUrl)); -// document.open(); -// -// BaseFont bfChi = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED); -// Font fontChi = new Font(bfChi, 12, Font.NORMAL); -// -// document.add(new Paragraph("客户分析报告", fontChi)); -// -// document.add(new Paragraph("结果详情", fontChi)); -// PdfPTable table = new PdfPTable(2); -// table.setWidthPercentage(100); -// table.setWidthPercentage(100); -// table.addCell(new Paragraph("用户ID: " + id, fontChi)); -// table.addCell(new Paragraph("引擎名称: " + resultSet.getEngine_name(), fontChi)); -// -// String result = resultSet.getResult(); -// if (result == null || result.equals("") || result.equals("1")) { -// result = "通过"; -// } else if (result.equals("2")) { -// result = "拒绝"; -// } -// -// table.addCell(new Paragraph("决策建议:" + result, fontChi)); -// String score = resultSet.getScorecardscore(); -// if (score == null) score = ""; -// table.addCell(new Paragraph("信用评分: " + score + "分", fontChi)); -// document.add(table); -// -// document.add(new Paragraph("黑名单", fontChi)); -// PdfPTable table2 = new PdfPTable(3); -// table2.setWidthPercentage(100); -// table2.setWidthPercentage(100); -// table2.addCell(new Paragraph("名单类型", fontChi)); -// table2.addCell(new Paragraph("名单名称", fontChi)); -// table2.addCell(new Paragraph("名单描述", fontChi)); -// -// List resultSetLists = resultSet.getResultSetList(); -// -// //是否命中标志 -// boolean flag = false; -// if (resultSet.getResultSetList().size() > 0) { -// for (Iterator iterator = resultSetLists.iterator(); iterator.hasNext(); ) { -// ResultSetList resultSetList = (ResultSetList) iterator.next(); -// if (resultSetList.getType() == 1) { -// flag = true; -// table2.addCell(new Paragraph(resultSetList.getVersionCode(), fontChi)); -// table2.addCell(new Paragraph(resultSetList.getName(), fontChi)); -// table2.addCell(new Paragraph(resultSetList.getDescription(), fontChi)); -// } -// } -// } -// if (!flag) { -// PdfPCell cell = new PdfPCell(new Paragraph("未命中", fontChi)); -// cell.setColspan(3); -// table2.addCell(cell); -// } -// -// document.add(table2); -// -// document.add(new Paragraph("白名单", fontChi)); -// PdfPTable table3 = new PdfPTable(3); -// table3.setWidthPercentage(100); -// table3.setWidthPercentage(100); -// table3.addCell(new Paragraph("名单类型", fontChi)); -// table3.addCell(new Paragraph("名单名称", fontChi)); -// table3.addCell(new Paragraph("名单描述", fontChi)); -// -// flag = false; //重置为false -// if (resultSet.getResultSetList().size() > 0) { -// for (Iterator iterator = resultSetLists.iterator(); iterator.hasNext(); ) { -// ResultSetList resultSetList = (ResultSetList) iterator.next(); -// if (resultSetList.getType() == 2) { -// flag = true; -// table3.addCell(new Paragraph(resultSetList.getVersionCode(), fontChi)); -// table3.addCell(new Paragraph(resultSetList.getName(), fontChi)); -// table3.addCell(new Paragraph(resultSetList.getDescription(), fontChi)); -// } -// } -// } -// if (!flag) { -// PdfPCell cell = new PdfPCell(new Paragraph("未命中", fontChi)); -// cell.setColspan(3); -// table3.addCell(cell); -// } -// -// document.add(table3); -// -// document.add(new Paragraph("硬性拒绝规则", fontChi)); -// PdfPTable table4 = new PdfPTable(4); -// table4.setWidthPercentage(100); -// table4.setWidthPercentage(100); -// table4.addCell(new Paragraph("规则ID", fontChi)); -// table4.addCell(new Paragraph("规则名称", fontChi)); -// table4.addCell(new Paragraph("命中原因", fontChi)); -// table4.addCell(new Paragraph("指标表现", fontChi)); -// -// flag = false; //重置为false -// if (resultSet.getResultSetList().size() > 0) { -// for (Iterator iterator = resultSetLists.iterator(); iterator.hasNext(); ) { -// ResultSetList resultSetList = (ResultSetList) iterator.next(); -// if (resultSetList.getType() == 3) { -// flag = true; -// table4.addCell(new Paragraph(resultSetList.getVersionCode(), fontChi)); -// table4.addCell(new Paragraph(resultSetList.getName(), fontChi)); -// table4.addCell(new Paragraph(resultSetList.getDescription(), fontChi)); -// table4.addCell(new Paragraph("", fontChi)); -// } -// } -// } -// if (!flag) { -// PdfPCell cell = new PdfPCell(new Paragraph("未命中", fontChi)); -// cell.setColspan(4); -// table4.addCell(cell); -// } -// -// document.add(table4); -// -// document.add(new Paragraph("加减分规则", fontChi)); -// document.add(new Paragraph()); -// PdfPTable table5 = new PdfPTable(4); -// table5.setWidthPercentage(100); -// table5.setWidthPercentage(100); -// table5.addCell(new Paragraph("规则ID", fontChi)); -// table5.addCell(new Paragraph("规则名称", fontChi)); -// table5.addCell(new Paragraph("命中原因", fontChi)); -// table5.addCell(new Paragraph("指标表现", fontChi)); -// -// flag = false; //重置为false -// if (resultSet.getResultSetList().size() > 0) { -// for (Iterator iterator = resultSetLists.iterator(); iterator.hasNext(); ) { -// ResultSetList resultSetList = (ResultSetList) iterator.next(); -// if (resultSetList.getType() == 4) { -// flag = true; -// table5.addCell(new Paragraph(resultSetList.getVersionCode(), fontChi)); -// table5.addCell(new Paragraph(resultSetList.getName(), fontChi)); -// table5.addCell(new Paragraph(resultSetList.getDescription(), fontChi)); -// table5.addCell(new Paragraph("", fontChi)); -// } -// } -// } -// if (!flag) { -// PdfPCell cell = new PdfPCell(new Paragraph("未命中", fontChi)); -// cell.setColspan(4); -// table5.addCell(cell); -// } -// -// document.add(table5); -// -// document.close(); -// -// -// } catch (FileNotFoundException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } catch (DocumentException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } catch (IOException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } -// -// return fileName; -// -// } - - /** - * 生成字符型随机数 - * - * @return - */ - public static String getRandomString(int length) { - String base = "abcdefghijklmnopqrstuvwxyz0123456789"; - Random random = new Random(); - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < length; i++) { - int number = random.nextInt(base.length()); - sb.append(base.charAt(number)); - } - return sb.toString(); - } - - /** - * 生成指定范围内的随机整数 - * - * @return - */ - public static int getRandomInt(String minS, String maxS) { - - int min = 0, max = 0; - - if (minS.indexOf(".") >= 0) { // 3.90 | .9 - minS = minS.substring(0, minS.indexOf(".")); - } - - if (maxS.indexOf(".") >= 0) { // 3.90 - maxS = maxS.substring(0, maxS.indexOf(".")); - } - - if (maxS.equals("") && !minS.equals("")) { // (4,) 右开区间 - min = Integer.parseInt(minS); - max = min + 10000; - } else if (minS.equals("") && !maxS.equals("")) { // (,10) 左开区间 - max = Integer.parseInt(maxS); - min = max - 10000; - } else if (!minS.equals("") && !maxS.equals("")) {// (4,10) 左右闭区间 - min = Integer.parseInt(minS); - max = Integer.parseInt(maxS); - } - - Random random = new Random(); - int i = random.nextInt(max) % (max - min + 1) + min; - - return i; - - } - - @Override - public int fieldValidate(String fieldEn, String fieldCn, String engineId, Long fieldId) { - return 0; - } - - @Override - public int updateFieldFolder(UpdateFolderParam param) { - int result = fieldMapper.updateFieldFolder(param); - return result; - } - @Override - public String getFieldEnById(Long id) { - return fieldMapper.findFieldNameById(id); - } - - @Override - public List queryByIds(Collection ids) { - if (ids==null||ids.size()==0){ - return new ArrayList<>(); - } - return fieldMapper.selectByIds(ids); - } - - @Override - public List queryByEns(Collection ens) { - if (ens==null||ens.size()==0){ - return new ArrayList<>(); - } - return fieldMapper.selectByEns(ens); - } - - @Override - public List queryByOrganAndCns(Collection cns,Long organId) { - if (cns==null||cns.size()==0){ - return new ArrayList<>(); - } - return fieldMapper.selectByOrganCns(cns,organId); - } - - public void sqlFieldCheck(Map map){ - if (map.containsKey("sqlStatement")){ - Object sqlStatement = map.get("sqlStatement"); - if (sqlStatement!=null&&!"".equals(sqlStatement)){ - String param = sqlStatement.toString().toUpperCase(); - for (String match :KEY_WORDS) { - if ( param.contains(match)){ - throw new ApiException(ErrorCodeEnum.SQL_FIELD_HAVE_RISK.getCode(),ErrorCodeEnum.SQL_FIELD_HAVE_RISK.getMessage()+":"+match); - } - } - } - } - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/service/imp/FieldTypeServiceImp.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/service/imp/FieldTypeServiceImp.java deleted file mode 100644 index b4d8b37..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/service/imp/FieldTypeServiceImp.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.risk.riskmanage.datamanage.service.imp; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import com.risk.riskmanage.datamanage.model.FieldType; -import com.risk.riskmanage.datamanage.model.request.FieldTreeParam; -import com.risk.riskmanage.util.SessionManager; -import org.springframework.stereotype.Service; - -import com.risk.riskmanage.common.basefactory.BaseService; -import com.risk.riskmanage.datamanage.service.FieldTypeService; - -import javax.annotation.Resource; - -@Service -public class FieldTypeServiceImp extends BaseService implements FieldTypeService { - @Resource - - @Override - public List getFieldTypeList(Map paramMap) { - return fieldTypeMapper.getFieldTypeList(paramMap); - } - - @Override - public boolean createFieldType(FieldType fieldTypeVo, - Map paramMap) { - // 检查字段类型是否存在 - //if (fieldTypeMapper.findIdByFieldType(paramMap) == 0) { - if (fieldTypeMapper.createFieldType(fieldTypeVo)) { - paramMap.put("fieldTypeId", fieldTypeVo.getId()); - if (fieldTypeUserMapper.createFieldTypeUserRel(paramMap)) { - return true; - } else - return false; - } else - return false; -// } else -// return false; - } - - @Override - public boolean updateFieldType(FieldTreeParam param) { - param.setOrganId(SessionManager.getLoginAccount().getOrganId()); - param.setUserId(SessionManager.getLoginAccount().getUserId()); - fieldTypeMapper.updateFieldType(param); - fieldTypeUserMapper.updateFieldTypeUserRel(param); - return true; - } - - @Override - public FieldType findFieldTypeById(Map paramMap) { - return fieldTypeMapper.findFieldTypeById(paramMap); - } - - @Override - public String findNodeIds(Map paramMap) { - return fieldTypeUserMapper.findNodeIds(paramMap); - } - - @Override - public List findFieldType(Map paramMap) { - return fieldTypeMapper.findFieldType(paramMap); - } - @Override - public List getTreeList(FieldTreeParam param) { - param.setOrganId(SessionManager.getLoginAccount().getOrganId()); - param.setUserId(SessionManager.getLoginAccount().getUserId()); - List fieldTypes = fieldTypeMapper.selectFieldTypeList(param); - List collect = fieldTypes.stream().filter(fieldType -> fieldType.getParentId() == 0).collect(Collectors.toList()); - for (FieldType fieldType : collect) { - fieldType.setChildren(this.assembleTreeList(fieldTypes,fieldType)); - } - return collect; - } - - private FieldType[] assembleTreeList(List fieldTypes,FieldType root){ - List children = new ArrayList(); - for (FieldType fieldType : fieldTypes) { - if (fieldType.getParentId().equals(root.getId())){ - fieldType.setChildren(this.assembleTreeList(fieldTypes,fieldType)); - children.add(fieldType); - } - } - if (children.size()==0){ - return new FieldType[0]; - } - return children.toArray( new FieldType[children.size()]); - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/vo/FieldEnumVo.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/vo/FieldEnumVo.java deleted file mode 100644 index 59bd661..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/vo/FieldEnumVo.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.risk.riskmanage.datamanage.vo; - -import java.util.List; - -import com.risk.riskmanage.datamanage.model.Field; - -/** - * 字段枚举包装类 - * 主要用于决策选项中,选择字段要加载字段对应的枚举值(如果字段是枚举的话) - */ -public class FieldEnumVo { - - private Field field; - - private List enums; - - public Field getField() { - return field; - } - - public void setField(Field field) { - this.field = field; - } - - public List getEnums() { - return enums; - } - - public void setEnums(List enums) { - this.enums = enums; - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/vo/FieldExcelVo.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/vo/FieldExcelVo.java deleted file mode 100644 index 498bcec..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/vo/FieldExcelVo.java +++ /dev/null @@ -1,150 +0,0 @@ -package com.risk.riskmanage.datamanage.vo; - -import java.util.Date; - -public class FieldExcelVo { - - /** - * 主键 - * */ - private Integer id; - - /** - * 字段英文名 - * */ - private String fieldEn; - - /** - * 字段中文名 - * */ - private String fieldCn; - - /** - * 字段类型名称 - * */ - private String fieldType; - - /** - * 字段存值类型 - * */ - private String valueType; - - /** - * 字段约束范围 - * */ - private String valueScope; - - /** - * 是否衍生字段 - * */ - private String isDerivative; - - /** - * 是否输出字段 - * */ - private String isOutput; - - /** - * 衍生字段公式 - * */ - private String formula; - - /** - * 创建人 - * */ - private String author; - - /** - * 创建时间 - * */ - private Date created; - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getFieldEn() { - return fieldEn; - } - - public void setFieldEn(String fieldEn) { - this.fieldEn = fieldEn; - } - - public String getFieldCn() { - return fieldCn; - } - - public void setFieldCn(String fieldCn) { - this.fieldCn = fieldCn; - } - - public String getFieldType() { - return fieldType; - } - - public void setFieldType(String fieldType) { - this.fieldType = fieldType; - } - - public String getValueType() { - return valueType; - } - - public void setValueType(String valueType) { - this.valueType = valueType; - } - - public String getValueScope() { - return valueScope; - } - - public void setValueScope(String valueScope) { - this.valueScope = valueScope; - } - - public String getIsDerivative() { - return isDerivative; - } - - public void setIsDerivative(String isDerivative) { - this.isDerivative = isDerivative; - } - - public String getIsOutput() { - return isOutput; - } - - public void setIsOutput(String isOutput) { - this.isOutput = isOutput; - } - - public String getFormula() { - return formula; - } - - public void setFormula(String formula) { - this.formula = formula; - } - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } - - public Date getCreated() { - return created; - } - - public void setCreated(Date created) { - this.created = created; - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/vo/FieldFormulaVo.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/vo/FieldFormulaVo.java deleted file mode 100644 index 089e5cf..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/vo/FieldFormulaVo.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.risk.riskmanage.datamanage.vo; - -import java.io.Serializable; - -public class FieldFormulaVo implements Serializable { - - private static final long serialVersionUID = 1L; - - // [{fvalue: "0",formula: "a",farr: [{fieldCN:"引擎字段1-1",fieldCond:[{"inputOne":"c","inputThree":"5"},{"inputOne":"b","inputThree":"12"}]},{fieldCN:"通用字段2贷前",fieldCond:[{"inputOne":"(30,40]","inputThree":"5"},{"inputOne":"[45,51)","inputThree":"12"}]}]}]; - - /** - * 衍生字段公式设置对应的值 - * */ - private String fvalue; - - /** - * 衍生字段公式 - * */ - private String formula; - - /** - * 衍生字段公式里字段的条件区域设置 - * */ - private Integer idx; - - /** - * 衍生字段公式里字段的条件区域设置 - * */ - private String farr; - - /** - * 衍生字段公式里条件区域设置的某个字段中文名 - * */ - private String fieldCN; - - /** - * 衍生字段公式里条件区域设置的某个字段的具体设置 - * */ - private String fieldCond; - - public String getFvalue() { - return fvalue; - } - - public void setFvalue(String fvalue) { - this.fvalue = fvalue; - } - - public String getFormula() { - return formula; - } - - public void setFormula(String formula) { - this.formula = formula; - } - - public Integer getIdx() { - return idx; - } - - public void setIdx(Integer idx) { - this.idx = idx; - } - - public String getFarr() { - return farr; - } - - public void setFarr(String farr) { - this.farr = farr; - } - - public String getFieldCN() { - return fieldCN; - } - - public void setFieldCN(String fieldCN) { - this.fieldCN = fieldCN; - } - - public String getFieldCond() { - return fieldCond; - } - - public void setFieldCond(String fieldCond) { - this.fieldCond = fieldCond; - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/vo/FieldSubCondVo.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/vo/FieldSubCondVo.java deleted file mode 100644 index 66a341f..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datamanage/vo/FieldSubCondVo.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.risk.riskmanage.datamanage.vo; - -import java.io.Serializable; - -public class FieldSubCondVo implements Serializable{ - - private static final long serialVersionUID = 1L; - - //[{"fieldId":"43","operator":"in","fieldValue":"b","logical":"and"}] - - /** - * 条件字段编号 - * */ - private Integer fieldId; - - /** - * 条件字段的运算符 - * */ - private String operator; - - /** - * 条件字段的条件设置值 - * */ - private String fieldValue; - - /** - * 条件字段间的逻辑符 - * */ - private String logical; - - /** - * 条件字段的值类型 - * */ - private Integer valueType; - - /** - * 条件字段的取值范围 - * */ - private String valueScope; - - /** - * 条件字段的取值范围拆解后的数组 - * */ - private String[] values; - - /** - * 条件字段的字段名 - */ - private String fieldCn; - - - public Integer getFieldId() { - return fieldId; - } - public void setFieldId(Integer fieldId) { - this.fieldId = fieldId; - } - public String getOperator() { - return operator; - } - public void setOperator(String operator) { - this.operator = operator; - } - public String getFieldValue() { - return fieldValue; - } - public void setFieldValue(String fieldValue) { - this.fieldValue = fieldValue; - } - public String getLogical() { - return logical; - } - public void setLogical(String logical) { - this.logical = logical; - } - public Integer getValueType() { - return valueType; - } - public void setValueType(Integer valueType) { - this.valueType = valueType; - } - public String getValueScope() { - return valueScope; - } - public void setValueScope(String valueScope) { - this.valueScope = valueScope; - } - public String[] getValues() { - if(valueType == 3){ - values = valueScope.split(","); - }else{ - values = new String[]{valueScope}; - } - return values; - } - public void setValues(String[] values) { - this.values = values; - } - public String getFieldCn() { - return fieldCn; - } - public void setFieldCn(String fieldCn) { - this.fieldCn = fieldCn; - } - - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datasource/controller/DataSourceController.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datasource/controller/DataSourceController.java deleted file mode 100644 index 6dbc744..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datasource/controller/DataSourceController.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.risk.riskmanage.datasource.controller; - -import com.risk.riskmanage.common.constants.OpTypeConst; -import com.risk.riskmanage.common.model.ResponseEntityDto; -import com.risk.riskmanage.common.utils.ResponseEntityBuilder; -import com.risk.riskmanage.datasource.model.request.DataSourceListParam; -import com.risk.riskmanage.datasource.model.vo.DataSourceVo; -import com.risk.riskmanage.datasource.service.DataSourceService; -import com.risk.riskmanage.logger.ArchivesLog; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.Map; - -@RestController -@RequestMapping("/datasource") -public class DataSourceController { - - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - DataSourceService dataSourceService; - - @RequestMapping(value = "save", method = RequestMethod.POST) -// @ArchivesLog(operationType = OpTypeConst.DATA_SOURCE_SAVE) - public ResponseEntityDto save(@RequestBody DataSourceVo dataSourceVo) { - Integer result = dataSourceService.saveDataSource(dataSourceVo); - return ResponseEntityBuilder.buildNormalResponse(result); - } - - @RequestMapping(value = "update", method = RequestMethod.POST) -// @ArchivesLog(operationType = OpTypeConst.DATA_SOURCE_MODIFY) - public ResponseEntityDto update(@RequestBody DataSourceVo dataSourceVo) { - Integer result = dataSourceService.updateDataSource(dataSourceVo); - return ResponseEntityBuilder.buildNormalResponse(result); - } - - @RequestMapping(value = "/getDataSource/{id}", method = RequestMethod.GET) - public ResponseEntityDto getDataSourceById(@PathVariable Integer id) { - DataSourceVo dataSourceVo = dataSourceService.getDataSourceById(id); - return ResponseEntityBuilder.buildNormalResponse(dataSourceVo); - } - - @RequestMapping(value = "getDataSourceList", method = RequestMethod.POST) - public ResponseEntityDto getDataSourceList(@RequestBody DataSourceListParam param) { - Map result = dataSourceService.getDataSourceList(param); - return ResponseEntityBuilder.buildNormalResponse(result); - } - - @RequestMapping(value = "/{id}", method = RequestMethod.DELETE) -// @ArchivesLog(operationType = OpTypeConst.DATA_SOURCE_DELETE) - public ResponseEntityDto deleteDataSourceById(@PathVariable Integer id) { - Integer result = dataSourceService.deleteDataSourceById(id); - return ResponseEntityBuilder.buildNormalResponse(result); - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datasource/mapper/DataSourceMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datasource/mapper/DataSourceMapper.java deleted file mode 100644 index dd1cda4..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datasource/mapper/DataSourceMapper.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.risk.riskmanage.datasource.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.risk.riskmanage.datasource.model.DataSource; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface DataSourceMapper extends BaseMapper { -} \ No newline at end of file diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datasource/model/DataSource.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datasource/model/DataSource.java deleted file mode 100644 index 18f5233..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datasource/model/DataSource.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.risk.riskmanage.datasource.model; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; - -import java.io.Serializable; -import java.util.Date; - -@Data -@TableName("t_field_data_source") -public class DataSource implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 主键id - */ - @TableId(value = "id", type = IdType.AUTO) - private Integer id; - - /** - * 连接名称 - */ - private String name; - - /** - * 数据源类型:MySQL、Oracle、SQLServer、Hive、Spark、Redis - */ - private String type; - - /** - * 主机地址 - */ - private String host; - - /** - * 用户名 - */ - private String userName; - - /** - * 密码 - */ - private String password; - - /** - * 端口 - */ - private String port; - - /** - * 数据库名称 - */ - private String dbName; - - /** - * 状态 0:无效,1:有效 - */ - private Integer status; - - /** - * 创建人 - */ - private Integer creator; - - /** - * 修改人 - */ - private Integer modifier; - - /** - * 企业编号 - */ - private Integer organId; - - /** - * 创建时间 - */ - private Date createTime; - - /** - * 修改时间 - */ - private Date updateTime; - - /** - * 连接地址 - */ - private String url; - - /** - * spark路径 - */ - private String sparkHome; - - /** - * spark应用程序的名称 - */ - private String appName; - - /** - * spark地址 - */ - private String masterUrl; -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datasource/model/request/DataSourceListParam.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datasource/model/request/DataSourceListParam.java deleted file mode 100644 index 675048f..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datasource/model/request/DataSourceListParam.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.risk.riskmanage.datasource.model.request; - -import com.risk.riskmanage.common.model.PageDto; -import lombok.Data; - -import java.util.List; - -@Data -public class DataSourceListParam extends PageDto { - - /** - * 数据源类型 - */ - private List typeList; -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datasource/model/vo/DataSourceVo.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datasource/model/vo/DataSourceVo.java deleted file mode 100644 index 607b495..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datasource/model/vo/DataSourceVo.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.risk.riskmanage.datasource.model.vo; - -import lombok.Data; - -import java.io.Serializable; -import java.util.Date; - -@Data -public class DataSourceVo implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 主键id - */ - private Integer id; - - /** - * 连接名称 - */ - private String name; - - /** - * 数据源类型:MySQL、Oracle、SQLServer、Hive、Spark、Redis - */ - private String type; - - /** - * 主机地址 - */ - private String host; - - /** - * 用户名 - */ - private String userName; - - /** - * 密码 - */ - private String password; - - /** - * 端口 - */ - private String port; - - /** - * 数据库名称 - */ - private String dbName; - - /** - * 状态 0:无效,1:有效 - */ - private Integer status; - - /** - * 创建人 - */ - private Integer creator; - - /** - * 创建人名称 - */ - private String creatorName; - - /** - * 修改人 - */ - private Integer modifier; - - /** - * 修改人名称 - */ - private String modifierName; - - /** - * 企业编号 - */ - private Integer organId; - - /** - * 创建时间 - */ - private Date createTime; - - /** - * 修改时间 - */ - private Date updateTime; - - /** - * 连接地址 - */ - private String url; - - /** - * spark路径 - */ - private String sparkHome; - - /** - * spark应用程序的名称 - */ - private String appName; - - /** - * spark地址 - */ - private String masterUrl; -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datasource/service/DataSourceService.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datasource/service/DataSourceService.java deleted file mode 100644 index 126a59b..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datasource/service/DataSourceService.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.risk.riskmanage.datasource.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.risk.riskmanage.datasource.model.DataSource; -import com.risk.riskmanage.datasource.model.request.DataSourceListParam; -import com.risk.riskmanage.datasource.model.vo.DataSourceVo; - -import java.util.Map; - -public interface DataSourceService extends IService { - - Integer saveDataSource(DataSourceVo dataSource); - - Integer updateDataSource(DataSourceVo dataSource); - - DataSourceVo getDataSourceById(Integer id); - - Map getDataSourceList(DataSourceListParam param); - - Integer deleteDataSourceById(Integer id); -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datasource/service/impl/DataSourceServiceImpl.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/datasource/service/impl/DataSourceServiceImpl.java deleted file mode 100644 index c0ade57..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/datasource/service/impl/DataSourceServiceImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.risk.riskmanage.datasource.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.risk.riskmanage.datasource.mapper.DataSourceMapper; -import com.risk.riskmanage.datasource.model.DataSource; -import com.risk.riskmanage.datasource.model.request.DataSourceListParam; -import com.risk.riskmanage.datasource.model.vo.DataSourceVo; -import com.risk.riskmanage.datasource.service.DataSourceService; -import com.risk.riskmanage.system.mapper.UserMapper; -import com.risk.riskmanage.system.model.User; -import com.risk.riskmanage.util.SessionManager; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.BeanUtils; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Service -public class DataSourceServiceImpl extends ServiceImpl implements DataSourceService { - - @Resource - public DataSourceMapper dataSourceMapper; - - @Resource - public UserMapper userMapper; - - @Override - public Integer saveDataSource(DataSourceVo dataSourceVo) { - User user = SessionManager.getLoginAccount(); - Long organId = user.getOrganId(); - DataSource dataSource = new DataSource(); - BeanUtils.copyProperties(dataSourceVo, dataSource); - dataSource.setCreator(user.getUserId().intValue()); - dataSource.setModifier(user.getUserId().intValue()); - dataSource.setOrganId(organId.intValue()); - return dataSourceMapper.insert(dataSource); - } - - @Override - public Integer updateDataSource(DataSourceVo dataSourceVo) { - User user = SessionManager.getLoginAccount(); - DataSource dataSource = new DataSource(); - BeanUtils.copyProperties(dataSourceVo, dataSource); - dataSource.setModifier(user.getUserId().intValue()); - return dataSourceMapper.updateById(dataSource); - } - - @Override - public DataSourceVo getDataSourceById(Integer id) { - DataSource dataSource = dataSourceMapper.selectById(id); - DataSourceVo dataSourceVo = new DataSourceVo(); - BeanUtils.copyProperties(dataSource, dataSourceVo); - User creator = userMapper.findUserById(dataSource.getCreator()); - User modifier = userMapper.findUserById(dataSource.getModifier()); - dataSourceVo.setCreatorName(creator.getAccount()); - dataSourceVo.setModifierName(modifier.getAccount()); - return dataSourceVo; - } - - @Override - public Map getDataSourceList(DataSourceListParam param) { - Map result = new HashMap<>(); - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(DataSource::getStatus, 1); - if(param.getTypeList()!=null&&!param.getTypeList().isEmpty()){ - queryWrapper.in(DataSource::getType, param.getTypeList()); - } - queryWrapper.orderByDesc(DataSource::getUpdateTime); - if (param.getPageNo()>0 && param.getPageSize()>0){ - PageHelper.startPage(param.getPageNo(), param.getPageSize()); - } - List dataSourceList = dataSourceMapper.selectList(queryWrapper); - PageInfo pageInfo = new PageInfo<>(dataSourceList); - pageInfo.setList(null); - result.put("pager", pageInfo); - - List dataSourceVoList = new ArrayList<>(); - for (DataSource dataSource : dataSourceList) { - DataSourceVo dataSourceVo = new DataSourceVo(); - BeanUtils.copyProperties(dataSource, dataSourceVo); - User creator = userMapper.findUserById(dataSource.getCreator()); - User modifier = userMapper.findUserById(dataSource.getModifier()); - dataSourceVo.setCreatorName(creator.getAccount()); - dataSourceVo.setModifierName(modifier.getAccount()); - dataSourceVoList.add(dataSourceVo); - } - result.put("data", dataSourceVoList); - - return result; - } - - @Override - public Integer deleteDataSourceById(Integer id) { - DataSource dataSource = new DataSource(); - dataSource.setId(id); - dataSource.setStatus(0); - return dataSourceMapper.updateById(dataSource); - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/Engine.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/Engine.java deleted file mode 100644 index b7daea4..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/Engine.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.risk.riskmanage.engine.model; - -import lombok.Data; -import java.io.Serializable; -import java.util.Date; -import java.util.List; -/** - * - * 〈一句话功能简述〉 - * 〈功能详细描述〉 - */ -@Data -public class Engine implements Serializable { - private static final long serialVersionUID = -6611916471057697499L; - - /** - * 主键id - */ - private Long id; - /** - * 引擎编号 - */ - private String code; - /** - * 引擎名称 - */ - private String name; - /** - * 引擎描述 - */ - private String description; - /** - * 引擎状态 - */ - private Integer status; - /** - * 创建时间 - */ - private Date createDatetime; - /** - * 修改时间 - */ - private Date updateDatetime; - /** - * 创建人 - */ - private Long creator; - /** - * 修改人 - */ - private Long userId; - - /** - * 公司编号 - */ - private Long organId; - - /** - * 查询字段 - */ - private String searchString; - - /** - * 引擎版本集合 - * */ - private List engineVersionList; - - /** - * 运行状态 - */ - private int runState; - - /** - * 是否被选中 - */ - private boolean checked; - - /** - * 调用方式 1:同步,2:异步 - */ - private Integer callbackType; - - /** - * 回调地址 - */ - private String callbackUrl; - - /** - * 异常回调地址 - */ - private String exceptionCallbackUrl; - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/EngineNode.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/EngineNode.java deleted file mode 100644 index 3cc921d..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/EngineNode.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.risk.riskmanage.engine.model; -import lombok.Data; - -import java.io.Serializable; -import java.util.List; - -@Data -public class EngineNode implements Serializable{ - - private static final long serialVersionUID = -1867357850853531748L; - - /** - * 节点编号 - */ - private Long nodeId; - - /** - * 父节点编号 - */ - private String parentId; - - /** - * 版本编号 - */ - private Long versionId; - - /** - * 节点名称 - */ - private String nodeName; - - /** - * 节点code - */ - private String nodeCode; - - /** - * 节点顺序 - */ - private Integer nodeOrder; - - /** - * 节点类型 - */ - private Integer nodeType; - - /** - * 节点X轴 - */ - private double nodeX; - - /** - * 节点Y轴 - */ - private double nodeY; - - /** - * 节点脚本 - */ - private String nodeScript; - - /** - * 节点json - */ - private String nodeJson; - - /** - * 节点类型,图标等信息 - */ - private String params; - - /** - * 下一节点 - */ - private String nextNodes; - - /** - * 评分卡id - * - */ - private Long cardId; - - /** - * 规则集合 - */ - private List ruleList; - - private Integer lastNextnode; - /** - * 快照信息 - */ - private String snapshot; - -} \ No newline at end of file diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/EngineRule.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/EngineRule.java deleted file mode 100644 index 2cd2400..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/EngineRule.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.risk.riskmanage.engine.model; - -import java.util.Map; - -public class EngineRule { - - private String refused; - - private String code ; - - private String policyName; - - private String desc; - - private String Strtus; - - - private Mapfields; - - - public String getStrtus() { - return Strtus; - } - - public void setStrtus(String strtus) { - Strtus = strtus; - } - - public String getRefused() { - return refused; - } - - public void setRefused(String refused) { - this.refused = refused; - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getPolicyName() { - return policyName; - } - - public void setPolicyName(String policyName) { - this.policyName = policyName; - } - - public String getDesc() { - return desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - public Map getFields() { - return fields; - } - - public void setFields(Map fields) { - this.fields = fields; - } - - - - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/EngineVersion.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/EngineVersion.java deleted file mode 100644 index d692f09..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/EngineVersion.java +++ /dev/null @@ -1,203 +0,0 @@ -package com.risk.riskmanage.engine.model; - -import java.io.Serializable; -import java.util.List; - -public class EngineVersion implements Comparable, Serializable { - - private static final long serialVersionUID = 2923432053414979455L; - /** - * 版本编号 - */ - private Long versionId; - - /** - * 引擎编号 - */ - private Long engineId; - - /** - * 版本号 - */ - private Integer version; - - /** - * 子版本 - */ - private Integer subVersion; - - /** - * 部署状态 - */ - private Integer bootState; - - /** - * 版本状态 - */ - private Integer status; - - /** - * 布局方式 - */ - private Integer layout; - - /** - * 创建者 - */ - private Long userId; - - /** - * 创建时间 - */ - private String createTime; - - /** - * 修改人 - */ - private Long latestUser; - - /** - * 最后修改时间 - */ - private String latestTime; - - /** - * 节点集合 - * */ - private List engineNodeList; - - /** - * 引擎名称 - * */ - private String engineName; - - /** - * 引擎描述 - * */ - private String engineDesc; - - public Long getVersionId() { - return versionId; - } - - public void setVersionId(Long versionId) { - this.versionId = versionId; - } - - public Long getEngineId() { - return engineId; - } - - public void setEngineId(Long engineId) { - this.engineId = engineId; - } - - public Integer getVersion() { - return version; - } - - public void setVersion(Integer version) { - this.version = version; - } - - public Integer getBootState() { - return bootState; - } - - public void setBootState(Integer bootState) { - this.bootState = bootState; - } - - public Integer getStatus() { - return status; - } - - public void setStatus(Integer status) { - this.status = status; - } - - public Integer getLayout() { - return layout; - } - - public void setLayout(Integer layout) { - this.layout = layout; - } - - public Long getUserId() { - return userId; - } - - public void setUserId(Long userId) { - this.userId = userId; - } - - public String getCreateTime() { - return createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime == null ? null : createTime.trim(); - } - - public Long getLatestUser() { - return latestUser; - } - - public void setLatestUser(Long latestUser) { - this.latestUser = latestUser; - } - - public String getLatestTime() { - return latestTime; - } - - public void setLatestTime(String latestTime) { - this.latestTime = latestTime == null ? null : latestTime.trim(); - } - - public List getEngineNodeList() { - return engineNodeList; - } - - public void setEngineNodeList(List engineNodeList) { - this.engineNodeList = engineNodeList; - } - - public Integer getSubVersion() { - return subVersion; - } - - public void setSubVersion(Integer subVersion) { - this.subVersion = subVersion; - } - - public String getEngineName() { - return engineName; - } - - public void setEngineName(String engineName) { - this.engineName = engineName; - } - - public String getEngineDesc() { - return engineDesc; - } - - public void setEngineDesc(String engineDesc) { - this.engineDesc = engineDesc; - } - - @Override - public int compareTo(EngineVersion o) { - if(version!=o.getVersion()){ - return version-o.getVersion(); - }else if(!(subVersion == o.getSubVersion())){ - return subVersion - o.getSubVersion(); - }else { - return version-o.getVersion(); - } - } - - -} \ No newline at end of file diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/InputParam.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/InputParam.java deleted file mode 100644 index 8a75036..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/InputParam.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.risk.riskmanage.engine.model; - -import java.util.List; -import java.util.Map; - -public class InputParam { - private Map inputParam; - - private List result; - - public Map getInputParam() { - return inputParam; - } - - public void setInputParam(Map inputParam) { - this.inputParam = inputParam; - } - - public List getResult() { - return result; - } - - public void setResult(List result) { - this.result = result; - } - - - - - - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/NodeKnowledge.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/NodeKnowledge.java deleted file mode 100644 index 4f7803d..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/NodeKnowledge.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.risk.riskmanage.engine.model; - -import java.io.Serializable; - -/** - * 节点与知识库映射关系模型 - * - * - */ -public class NodeKnowledge implements Serializable { - private static final long serialVersionUID = -55965399064577379L; - /** - * 主键编号 - */ - private Long relId; - - /** - * 节点编号 - */ - private Long nodeId; - - /** - * 知识库信息编号 - */ - private Long knowledgeId; - - /** - * 知识库类型1规则2评分卡 - */ - private Integer knowledgeType; - - public Long getRelId() { - return relId; - } - - public void setRelId(Long relId) { - this.relId = relId; - } - - public Long getNodeId() { - return nodeId; - } - - public void setNodeId(Long nodeId) { - this.nodeId = nodeId; - } - - public Long getKnowledgeId() { - return knowledgeId; - } - - public void setKnowledgeId(Long knowledgeId) { - this.knowledgeId = knowledgeId; - } - - public Integer getKnowledgeType() { - return knowledgeType; - } - - public void setKnowledgeType(Integer knowledgeType) { - this.knowledgeType = knowledgeType; - } -} \ No newline at end of file diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/Result.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/Result.java deleted file mode 100644 index e8e8820..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/Result.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.risk.riskmanage.engine.model; - -import java.util.List; -import java.util.Map; - -public class Result { - private String resultType;//规则1代表加减法,2拒绝规则 - private Integer id;//规则编号 - private String code;//规则code - private String name; - private String value; - private Map map;//评分 - private List list; - - - public Map getMap() { - return map; - } - public void setMap(Map map) { - this.map = map; - } - public String getValue() { - return value; - } - public void setValue(String value) { - this.value = value; - } - public String getResultType() { - return resultType; - } - public void setResultType(String resultType) { - this.resultType = resultType; - } - public Integer getId() { - return id; - } - public void setId(Integer id) { - this.id = id; - } - - public String getCode() { - return code; - } - public void setCode(String code) { - this.code = code; - } - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public List getList() { - return list; - } - public void setList(List list) { - this.list = list; - } - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/request/KnowledgeTreeListParam.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/request/KnowledgeTreeListParam.java deleted file mode 100644 index 7ba3c3b..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/request/KnowledgeTreeListParam.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.risk.riskmanage.engine.model.request; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class KnowledgeTreeListParam { - private String treeType;//树形分类:0:基础规则树 1:评分卡的树 2:回收站的树 3:决策表树,4:复杂规则树(逗号分割) - private Long organId;//组织id - private Long userId;//用户id - private Integer status;//状态 -1删除 - private Integer type;//1组织通用 -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/response/param/DecisionFlowOutputResponse.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/response/param/DecisionFlowOutputResponse.java deleted file mode 100644 index 2eabde8..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/response/param/DecisionFlowOutputResponse.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.risk.riskmanage.engine.model.response.param; - -import lombok.Data; - -import java.util.List; - -/** - * 决策流输出内容 (节点类型-》节点列表-》节点输出字段) - * - */ -@Data -public class DecisionFlowOutputResponse { - - /** - * 节点类型集合 - */ - private List nodeTypeList; -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/response/param/ListDbInfoOutputResponse.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/response/param/ListDbInfoOutputResponse.java deleted file mode 100644 index 216c21f..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/response/param/ListDbInfoOutputResponse.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.risk.riskmanage.engine.model.response.param; - -import lombok.Data; -import java.util.List; - -@Data -public class ListDbInfoOutputResponse { - - /** - * 名单库id - */ - private Long id; - - /** - * 名单库名称 - */ - private String listName; - - /** - * 节点策略输出字段集合 - */ - private List listDbOutputList; -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/response/param/ListDbOutputResponse.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/response/param/ListDbOutputResponse.java deleted file mode 100644 index ff93fe0..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/response/param/ListDbOutputResponse.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.risk.riskmanage.engine.model.response.param; - -import lombok.Data; -import java.util.List; - -@Data -public class ListDbOutputResponse { - - /** - * 名单库的统计信息 - */ - private List statisticsOutputList; - - /** - * 名单库信息 - */ - private List listDbInfoOutput; -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/response/param/NodeInfoResponse.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/response/param/NodeInfoResponse.java deleted file mode 100644 index 7360bcc..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/response/param/NodeInfoResponse.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.risk.riskmanage.engine.model.response.param; - -import lombok.Data; -import java.util.List; - -/** - * 节点信息 - */ -@Data -public class NodeInfoResponse { - - /** - * 节点编号 - */ - private Long nodeId; - - /** - * 节点名称 - */ - private String nodeName; - - /** - * 节点策略输出字段集合 - */ - private List strategyOutputList; - - /** - * 规则集输出信息 - */ - private RuleOutputResponse ruleOutput; - - /** - * 名单库输出信息 - */ - private ListDbOutputResponse listDbOutput; -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/response/param/NodeStrategyOutputResponse.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/response/param/NodeStrategyOutputResponse.java deleted file mode 100644 index 4dc7c7e..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/response/param/NodeStrategyOutputResponse.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.risk.riskmanage.engine.model.response.param; - -import lombok.Data; - -/** - * 节点策略输出字段 - */ -@Data -public class NodeStrategyOutputResponse { - - /** - * 字段英文名 - * */ - private String fieldEn; - - /** - * 字段中文名 - * */ - private String fieldCn; - /** - * 字段类型 1数字,2字符串,6json - */ - private Integer valueType; -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/response/param/NodeTypeResponse.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/response/param/NodeTypeResponse.java deleted file mode 100644 index e81104f..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/response/param/NodeTypeResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.risk.riskmanage.engine.model.response.param; - -import lombok.Data; - -import java.util.List; - -/** - * 节点类型 - */ -@Data -public class NodeTypeResponse { - - /** - * 节点类型 - */ - private Integer nodeType; - - /** - * 节点类型名称 - */ - private String nodeTypeName; - - /** - * 节点信息集合 - */ - private List nodeInfoList; -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/response/param/RuleInfoOutputResponse.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/response/param/RuleInfoOutputResponse.java deleted file mode 100644 index 470336a..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/response/param/RuleInfoOutputResponse.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.risk.riskmanage.engine.model.response.param; - -import lombok.Data; - -import java.util.List; - -@Data -public class RuleInfoOutputResponse { - - /** - * 规则id - */ - private Long id; - - /** - * 名称 - * */ - private String name; - - /** - * 代码 - * */ - private String code; - - /** - * 节点策略输出字段集合 - */ - private List ruleOutputList; -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/response/param/RuleOutputResponse.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/response/param/RuleOutputResponse.java deleted file mode 100644 index 731ef81..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/engine/model/response/param/RuleOutputResponse.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.risk.riskmanage.engine.model.response.param; - -import lombok.Data; - -import java.util.List; - -@Data -public class RuleOutputResponse { - - /** - * 规则的统计信息 - */ - private List statisticsOutputList; - - /** - * 规则信息 - */ - private List ruleInfoList; -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/interfacemanage/controller/InterfaceController.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/interfacemanage/controller/InterfaceController.java deleted file mode 100644 index 8ec04e3..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/interfacemanage/controller/InterfaceController.java +++ /dev/null @@ -1,136 +0,0 @@ -package com.risk.riskmanage.interfacemanage.controller; - -import com.github.pagehelper.PageInfo; -import com.risk.riskmanage.common.constants.OpTypeConst; -import com.risk.riskmanage.common.enums.ErrorCodeEnum; -import com.risk.riskmanage.common.exception.ApiException; -import com.risk.riskmanage.common.model.ResponseEntityDto; -import com.risk.riskmanage.common.model.requestParam.QueryListParam; -import com.risk.riskmanage.common.utils.ResponseEntityBuilder; -import com.risk.riskmanage.interfacemanage.model.InterfaceInfo; -import com.risk.riskmanage.interfacemanage.model.request.InterfaceListParam; -import com.risk.riskmanage.interfacemanage.model.request.InterfaceUpdateStatusParam; -import com.risk.riskmanage.interfacemanage.model.vo.InterfaceVo; -import com.risk.riskmanage.interfacemanage.service.InterfaceService; -import com.risk.riskmanage.logger.ArchivesLog; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.HashMap; - -/** - * 提供interface相关接口 - * - * @apiDefine interface 2.接口管理 - */ -@RestController -@RequestMapping("v3/interface") -public class InterfaceController { - - @Autowired - InterfaceService interfaceService; - - @RequestMapping("testInterface") - public String test(){ - String str = "{\n" + - " \"status\": \"1\",\n" + - " \"error\": \"00000000\",\n" + - " \"msg\": null,\n" + - " \"data\": {\n" + - " \"name\": \"张三\",\n" + - " \"age\": 25\n" + - " }\n" + - "}"; - return str; - } - - /** - * @api {POST} /v3/interface/getInterfaceInfo/{id} 3.19. V3获取Interface信息 - * @apiGroup knowledge - * @apiVersion 2.0.0 - * @apiParam {Long} id : 规则id - * @apiSuccess {String} status 状态:1成功,0失败 - * @apiParamExample {json} 请求示例: - * {} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":{"id":666,"name":"2021_4_6测试接口","versionCode":"test2021_4_6第二次输入","description":"接口测试","priority":0,"parentId":0,"author":135,"userId":135,"organId":46,"engineId":null,"status":1,"type":1,"isNon":null,"content":"test","created":"2021-04-06T08:38:17.000+00:00","updated":"2021-04-07T05:12:52.000+00:00","ruleType":0,"ruleAudit":2,"score":0,"lastLogical":"","ruleConditionVo":{"id":14,"logical":"&&","fieldId":null,"operator":null,"fieldValue":null,"ruleId":666,"parentId":0,"conditionType":1,"createTime":"2021-04-06T08:38:26.000+00:00","updateTime":null,"insertTempId":null,"children":[{"id":15,"logical":null,"fieldId":null,"operator":">","fieldValue":"1000","ruleId":666,"parentId":14,"conditionType":1,"createTime":"2021-04-06T08:38:26.000+00:00","updateTime":null,"insertTempId":null,"children":[],"tempParentId":null},{"id":16,"logical":null,"fieldId":null,"operator":"<","fieldValue":"10000","ruleId":666,"parentId":14,"conditionType":1,"createTime":"2021-04-06T08:38:26.000+00:00","updateTime":null,"insertTempId":null,"children":[],"tempParentId":null}],"tempParentId":null},"ruleContentInfoList":[{"id":16,"fieldId":10000,"fieldValue":"test01","ruleId":666},{"id":17,"fieldId":10000,"fieldValue":"test02","ruleId":666}]}} - */ - @RequestMapping(value = "getInterfaceInfo/{id}", method = RequestMethod.POST) - public ResponseEntityDto getInterfaceById(@PathVariable Long id) { - if (id==null){ - throw new ApiException(ErrorCodeEnum.PARAMS_EXCEPTION.getCode(),ErrorCodeEnum.PARAMS_EXCEPTION.getMessage()); - } - InterfaceVo interfaceVo = interfaceService.getInterfaceById(id); - ResponseEntityDto ruleResponseEntityDto = ResponseEntityBuilder.buildNormalResponse(interfaceVo); - return ruleResponseEntityDto; - } - - //测试http请求,并获得响应 - @PostMapping("getHttpResponse") - public ResponseEntityDto getHttpResponse(@RequestBody InterfaceInfo interfaceInfo) { - String result = interfaceService.getHttpResponse(interfaceInfo); - ResponseEntityDto interfaceResponseEntityDto = ResponseEntityBuilder.buildNormalResponse(result); - return interfaceResponseEntityDto; - } - - //查询所有接口 - @PostMapping("getInterfaceList") - public ResponseEntityDto getInterfaceList(@RequestBody QueryListParam param) { -// PageBean pageBean = interfaceService.pageQuery(param.getPageNo(), param.getPageSize()); -// ResponseEntityDto ruleResponseEntityDto = ResponseEntityBuilder.buildNormalResponse(pageBean); - - PageInfo pageInfo = interfaceService.queryByEntity(param); - HashMap responseMap = new HashMap<>(); - responseMap.put("pageInfo",pageInfo); - responseMap.put("klist",pageInfo.getList()); - pageInfo.setList(null); - ResponseEntityDto interfaceResponseEntityDto = ResponseEntityBuilder.buildNormalResponse(responseMap); - - return interfaceResponseEntityDto; - } - - //添加接口 - @PostMapping("addInterface") -// @ArchivesLog(operationType = OpTypeConst.ADD_INTERFACE) - public ResponseEntityDto addInterface(@RequestBody InterfaceVo interfaceVo ) { - InterfaceVo insert = interfaceService.inserInterfaceInfo(interfaceVo); - ResponseEntityDto ruleResponseEntityDto = ResponseEntityBuilder.buildNormalResponse(insert); - return ruleResponseEntityDto; - } - - //删除接口 - @PostMapping("deleteInterface") -// @ArchivesLog(operationType = OpTypeConst.DELETE_INTERFACE) - public ResponseEntityDto deleteInterface(@RequestBody InterfaceVo interfaceVo ) { - Boolean bool = interfaceService.deleteInterfaceInfo(interfaceVo); - ResponseEntityDto ruleResponseEntityDto = ResponseEntityBuilder.buildNormalResponse(bool); - return ruleResponseEntityDto; - } - - //编辑接口 - @PostMapping("updateInterface") -// @ArchivesLog(operationType = OpTypeConst.UPDATE_INTERFACE) - public ResponseEntityDto updateInterface(@RequestBody InterfaceVo interfaceVo ) { - InterfaceVo insert = interfaceService.updateInterfaceInfo(interfaceVo); - ResponseEntityDto ruleResponseEntityDto = ResponseEntityBuilder.buildNormalResponse(insert); - return ruleResponseEntityDto; - } - - //批量更新接口状态 - @PostMapping("updateInterfaceStatus") -// @ArchivesLog(operationType = OpTypeConst.UPDATE_INTERFACE_STATUS) - public ResponseEntityDto updateStatus(@RequestBody InterfaceUpdateStatusParam param) { - Long[] ids = param.getIds(); - Integer status = param.getStatus(); - if (ids==null||ids.length==0||status==null){ - throw new ApiException(ErrorCodeEnum.PARAMS_EXCEPTION.getCode(),ErrorCodeEnum.PARAMS_EXCEPTION.getMessage()); - } - boolean updateResult = interfaceService.updateStatus(ids, status); - if (updateResult){ - return ResponseEntityBuilder.buildNormalResponse(updateResult); - }else { - return ResponseEntityBuilder.buildErrorResponse(ErrorCodeEnum.SERVER_ERROR); - } - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/interfacemanage/mapper/InterfaceMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/interfacemanage/mapper/InterfaceMapper.java deleted file mode 100644 index ef8fbe9..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/interfacemanage/mapper/InterfaceMapper.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.risk.riskmanage.interfacemanage.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.risk.riskmanage.interfacemanage.model.InterfaceInfo; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -@Mapper -public interface InterfaceMapper extends BaseMapper { - int updateStatus(@Param(value = "ids") Long[] ids, @Param(value = "status") Integer status); - - List queryInterfaceList(InterfaceInfo interfaceInfo); - - List queryLimit(@Param(value = "start")int start, @Param(value = "size")int size); - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/interfacemanage/model/InterfaceInfo.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/interfacemanage/model/InterfaceInfo.java deleted file mode 100644 index 2c4280c..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/interfacemanage/model/InterfaceInfo.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.risk.riskmanage.interfacemanage.model; - -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 lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.Date; - - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors -@TableName("t_field_interface") -public class InterfaceInfo implements Serializable { - - private static final long serialVersionUID = 1L; - - @TableId(type = IdType.AUTO) - private Integer id; //接口id - - private String name; //接口名称 - - private String url; //请求地址 - - private String method; //请求方法 - - private String requestHeaders; //请求体类型 - - private String requestBody; //请求参数体 - - private String bindParam; //绑定参数 - - private String responseBody; //请求响应体 - - private Long creator; //创建者 - - private Long modifier; //修改者 - - private Long organId; //企业编号 - - private Integer status; //请求状态 - - private Date createTime; //创建时间 - - private Date updateTime; //更新时间 - - private String requestType; - - @TableField(exist = false) - private String username; //用户名 - - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/interfacemanage/model/request/InterfaceListParam.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/interfacemanage/model/request/InterfaceListParam.java deleted file mode 100644 index 22530e9..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/interfacemanage/model/request/InterfaceListParam.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.risk.riskmanage.interfacemanage.model.request; - -import com.risk.riskmanage.interfacemanage.model.InterfaceInfo; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class InterfaceListParam { - protected Integer pageNo = 1; // 第几页 - protected Integer pageSize = 10; // 每页的数量 - - -// protected Boolean search = false; // 是否搜索 - - protected InterfaceInfo interfaceInfo;//查询实体对象 - -// protected Integer parentId = 0; // 文件夹的id -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/interfacemanage/model/request/InterfaceUpdateParent.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/interfacemanage/model/request/InterfaceUpdateParent.java deleted file mode 100644 index 7ed758b..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/interfacemanage/model/request/InterfaceUpdateParent.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.risk.riskmanage.interfacemanage.model.request; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -@Data -@AllArgsConstructor -@NoArgsConstructor -@Accessors -public class InterfaceUpdateParent { - private Long[] ids;//规则id - private Long parentId;//文件夹id -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/interfacemanage/model/request/InterfaceUpdateStatusParam.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/interfacemanage/model/request/InterfaceUpdateStatusParam.java deleted file mode 100644 index 137b868..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/interfacemanage/model/request/InterfaceUpdateStatusParam.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.risk.riskmanage.interfacemanage.model.request; - - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -@Data -@AllArgsConstructor -@NoArgsConstructor -@Accessors -public class InterfaceUpdateStatusParam { - private Long[] ids;//id - private Integer status;//状态 -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/interfacemanage/model/vo/InterfaceVo.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/interfacemanage/model/vo/InterfaceVo.java deleted file mode 100644 index 77b11ea..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/interfacemanage/model/vo/InterfaceVo.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.risk.riskmanage.interfacemanage.model.vo; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.Date; - - -@Data -@AllArgsConstructor -@NoArgsConstructor -@Accessors -@TableName("t_field_interface") -public class InterfaceVo implements Serializable { - - private static final long serialVersionUID = 1L; - - private Integer id; //接口id - - private String name; //接口名称 - - private String url; //请求地址 - - private String method; //请求方法 - - private String requestHeaders; //请求体类型 - - private String requestBody; //请求参数体 - - private String bindParam; //绑定参数 - - private String responseBody; //请求响应体 - - private Long creator; //创建者 - - private Long modifier; //修改者 - - private Long organId; //企业编号 - - private Long status; //请求状态 - - private Date createTime; //创建时间 - - private Date updateTime; //更新时间 - - private String requestType; - - @TableField(exist = false) - private String username; //用户名 - - @TableField(exist = false) - private String creatorName; //创建者姓名 - - @TableField(exist = false) - private String modifierName; //修改者姓名 - - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/interfacemanage/service/InterfaceService.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/interfacemanage/service/InterfaceService.java deleted file mode 100644 index 7817510..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/interfacemanage/service/InterfaceService.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.risk.riskmanage.interfacemanage.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.github.pagehelper.PageInfo; -import com.risk.riskmanage.common.model.requestParam.QueryListParam; -import com.risk.riskmanage.interfacemanage.model.InterfaceInfo; -import com.risk.riskmanage.interfacemanage.model.request.InterfaceListParam; -import com.risk.riskmanage.interfacemanage.model.vo.InterfaceVo; - -public interface InterfaceService extends IService { - InterfaceVo getInterfaceById(Long id); - -// Map getInterfaceList(PageDto pageDto); - - PageInfo queryByEntity( QueryListParam param); - - InterfaceVo inserInterfaceInfo(InterfaceVo interfaceVo); - - InterfaceVo updateInterfaceInfo(InterfaceVo interfaceVo); - - //更新接口 - boolean updateStatus(Long[] ids, Integer status); - - //删除接口 - Boolean deleteInterfaceInfo(InterfaceVo interfaceVo); - -// public PageBean pageQuery(int currentPage, int pageSize); - - //http请求 - String getHttpResponse(InterfaceInfo interfaceInfo); -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/interfacemanage/service/impl/InterfaceServiceImpl.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/interfacemanage/service/impl/InterfaceServiceImpl.java deleted file mode 100644 index 205f848..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/interfacemanage/service/impl/InterfaceServiceImpl.java +++ /dev/null @@ -1,207 +0,0 @@ -package com.risk.riskmanage.interfacemanage.service.impl; - -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.Wrapper; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.risk.riskmanage.common.enums.ErrorCodeEnum; -import com.risk.riskmanage.common.exception.ApiException; -import com.risk.riskmanage.common.model.requestParam.QueryListParam; -import com.risk.riskmanage.interfacemanage.mapper.InterfaceMapper; -import com.risk.riskmanage.interfacemanage.model.InterfaceInfo; -import com.risk.riskmanage.interfacemanage.model.request.InterfaceListParam; -import com.risk.riskmanage.interfacemanage.model.vo.InterfaceVo; -import com.risk.riskmanage.interfacemanage.service.InterfaceService; -import com.risk.riskmanage.system.mapper.UserMapper; -import com.risk.riskmanage.system.model.User; -import com.risk.riskmanage.util.SessionManager; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.client.RestTemplate; - -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; - -@Service -public class InterfaceServiceImpl extends ServiceImpl implements InterfaceService { - @Resource - InterfaceMapper interfaceMapper; - - @Resource - UserMapper userMapper; - - @Autowired - private RestTemplate restTemplate; - - @Value("${runner.url}") - private String runnerUrl; - - @Override - public String getHttpResponse(InterfaceInfo interfaceInfo) { - HttpHeaders httpHeaders = new HttpHeaders(); - // 设置请求头 - httpHeaders.setContentType(MediaType.APPLICATION_JSON); - // 封装请求体 - JSONObject body = JSONObject.parseObject(JSONObject.toJSONString(interfaceInfo)); - // 封装参数和头信息 - HttpEntity httpEntity = new HttpEntity(body, httpHeaders); - String url = runnerUrl + "/manager/invokeInterface"; - ResponseEntity responseEntity = restTemplate.postForEntity(url, httpEntity, String.class); - return responseEntity.getBody(); - } - - @Override - public Boolean deleteInterfaceInfo(InterfaceVo interfaceVo) { - interfaceMapper.deleteById(interfaceVo.getId()); - return true; - } - - @Override - public InterfaceVo updateInterfaceInfo(InterfaceVo interfaceVo) { - InterfaceInfo interfaceInfo = new InterfaceInfo(); - BeanUtils.copyProperties(interfaceVo,interfaceInfo); - User user = SessionManager.getLoginAccount(); - //设置创建者和修改者id - interfaceInfo.setModifier(user.getUserId()); - interfaceMapper.updateById(interfaceInfo); - return interfaceVo; - } - - @Override - @Transactional - public boolean updateStatus(Long[] ids, Integer status) { - int updateNum = interfaceMapper.updateStatus(ids, status); - if (updateNum>0){ - return true; - } - return false; - } - - //添加接口信息 - @Override - public InterfaceVo inserInterfaceInfo(InterfaceVo interfaceVo) { - //拷贝VO到Info对象 - InterfaceInfo interfaceInfo = new InterfaceInfo(); - BeanUtils.copyProperties(interfaceVo, interfaceInfo); - User user = SessionManager.getLoginAccount(); - //设置创建者和修改者id - interfaceInfo.setCreator(user.getUserId()); - interfaceInfo.setModifier(user.getUserId()); - interfaceInfo.setOrganId(user.getOrganId()); - interfaceInfo.setStatus(1); - //插入并获取insert后实体对象返回id - boolean save = this.save(interfaceInfo); - if (!save) { - throw new ApiException(ErrorCodeEnum.INTERFACE_SAVE_ERROR.getCode(), ErrorCodeEnum.INTERFACE_SAVE_ERROR.getMessage()); - } - return interfaceVo; - } - - @Override - public PageInfo queryByEntity(QueryListParam interfaceListParam) { - InterfaceInfo interfaceInfo = interfaceListParam.getEntity(); - - - Integer pageNo = interfaceListParam.getPageNum(); - Integer pageSize = interfaceListParam.getPageSize(); - if (pageNo > 0 && pageSize > 0) { - PageHelper.startPage(pageNo, pageSize); - } - Wrapper wrapper = createWrapper(interfaceListParam.getEntity()); - List interfaceList = interfaceMapper.selectList(wrapper); - PageInfo pageInfo = new PageInfo(interfaceList); - - -// 级联操作完成拼装 - List interfaceVos = new ArrayList<>(); - - User user = SessionManager.getLoginAccount(); - for(InterfaceInfo info: interfaceList){ - InterfaceVo interfaceVo = new InterfaceVo(); - BeanUtils.copyProperties(info,interfaceVo); - interfaceVo.setUsername(user.getNickName()); - //设置创建者昵称 - interfaceVo.setCreatorName(userMapper.findNickNameById(info.getCreator())); - //设置修改者昵称 - interfaceVo.setModifierName(userMapper.findNickNameById(info.getModifier())); - interfaceVos.add(interfaceVo); - } - pageInfo.setList(interfaceVos); - - - return pageInfo; - } - - @Override - public InterfaceVo getInterfaceById(Long id) { - InterfaceInfo info = interfaceMapper.selectById(id); - InterfaceVo interfaceVo = new InterfaceVo(); - BeanUtils.copyProperties(info,interfaceVo); - User user = SessionManager.getLoginAccount(); - interfaceVo.setUsername(user.getNickName()); - //设置创建者昵称 - interfaceVo.setCreatorName(userMapper.findNickNameById(info.getCreator())); - //设置修改者昵称 - interfaceVo.setModifierName(userMapper.findNickNameById(info.getModifier())); - return interfaceVo; - } - - //新插入数据的准备工作 -// private InterfaceVo initParam(InterfaceVo interfaceVo) { -// //加入用户信息 -// User user = SessionManager.getLoginAccount(); -// interfaceVo.setOrganId(user.getOrganId()); -// interfaceVo.setUsername(user.getNickName()); -// -// return interfaceVo; -// } - - //唯一性检查 - private boolean checkUniqueness(InterfaceVo vo) { - InterfaceInfo interfaceInfo = new InterfaceInfo(); - interfaceInfo.setName(vo.getName()); - InterfaceInfo info = this.getOne(new QueryWrapper<>(interfaceInfo)); - if (info != null) { - throw new ApiException(ErrorCodeEnum.INTERFACE_NAME_REPEAT.getCode(), ErrorCodeEnum.INTERFACE_NAME_REPEAT.getMessage()); - } - return true; - } - - //创建查询器 - private Wrapper createWrapper(InterfaceInfo query){ - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - if (query!=null){ - if (StringUtils.isNotBlank(query.getName())){ - wrapper.like(InterfaceInfo::getName,query.getName()); - } - if (StringUtils.isNotBlank(query.getMethod())){ - wrapper.eq(InterfaceInfo::getMethod,query.getMethod()); - } - if (StringUtils.isNotBlank(query.getUrl())){ - wrapper.eq(InterfaceInfo::getUrl,query.getUrl()); - } - if (query.getStatus()!=null){ - wrapper.eq(InterfaceInfo::getStatus,query.getStatus()); - }else { - wrapper.ne(InterfaceInfo::getStatus,-1); - } - }else { - wrapper.ne(InterfaceInfo::getStatus,-1); - } - wrapper.orderByDesc(InterfaceInfo::getId); - return wrapper; - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/common/consts/ExcelHeader.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/common/consts/ExcelHeader.java deleted file mode 100644 index eb2fef6..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/common/consts/ExcelHeader.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.risk.riskmanage.knowledge.common.consts; - -/** - * ClassName:ExcelHeader
- * Description: Excel表头配置.
- */ -public class ExcelHeader { - - /** - * 规则表头名称 - * */ - public static final String[] RULE_HEADER = {"规则名称","规则代码","规则描述","优先级","条件","输出"}; - - /** - * 规则表头对应属性名称 - * */ - public static final String[] RULE_ClASS = {"name","versionCode","description","priority","fieldContent","content"}; - - /** - * 评分卡表头名称 - * */ - public static final String[] SCORECARD_HEADER = {"评分卡名称","评分卡代码","评分卡描述","版本号","指标详情","评分卡规则内容"}; - - /** - * 评分卡表头对应属性名称 - * */ - public static final String[] SCORECARD_ClASS = {"name","versionCode","description","version","fieldContent","content"}; - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/common/consts/Status.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/common/consts/Status.java deleted file mode 100644 index aef53e4..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/common/consts/Status.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.risk.riskmanage.knowledge.common.consts; - -/** - * ClassName:ExcelHeader
- * Description: 通用状态.
- */ -public class Status { - - /** - * 启用 - * */ - public static final int ENABLED = 1; - - /** - * 停用 - * */ - public static final int DISABLE =0; - - /** - * 删除 - * */ - public static final int DELETE =-1; - - /** - * 输出 - * */ - public static final int IS_OUTPUT =1; - - /** - * 不输出 - * */ - public static final int IS_NOT_OUTPUT =0; - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/common/consts/Type.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/common/consts/Type.java deleted file mode 100644 index bf01eaa..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/common/consts/Type.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.risk.riskmanage.knowledge.common.consts; -/** - * ClassName:ExcelHeader
- * Description: 通用类型.
- * @see - */ -public class Type { - /** - * 系统的 - * */ - public static final int SYSTEMATIC =0; - - /** - * 组织的 - * */ - public static final int ORGANIZATIONAL =1; - - /** - * 引擎的 - * */ - public static final int ENGINE =2; - - /** - * 树类型为规则集 - * */ - public static final int RULE_TREE =0; - - /** - * 树类型为评分卡 - * */ - public static final int SCORECARD_TREE =0; - - /** - * 树类型为回收站 - * */ - public static final int RECYCLE_TREE =0; - - /** - * 知识库映射类型 - */ - public static final int POLICY = 1; - - public static final int SCORECARD = 2; -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/controller/v2/KnowledgeTreeController.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/controller/v2/KnowledgeTreeController.java deleted file mode 100644 index abd585b..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/controller/v2/KnowledgeTreeController.java +++ /dev/null @@ -1,206 +0,0 @@ -package com.risk.riskmanage.knowledge.controller.v2; - -import com.risk.riskmanage.common.basefactory.BaseController; -import com.risk.riskmanage.common.constants.OpTypeConst; -import com.risk.riskmanage.common.model.ResponseEntityDto; -import com.risk.riskmanage.common.utils.ResponseEntityBuilder; -import com.risk.riskmanage.knowledge.common.consts.Status; -import com.risk.riskmanage.knowledge.model.KnowledgeTree; -import com.risk.riskmanage.knowledge.model.Rule; -import com.risk.riskmanage.logger.ArchivesLog; -import com.risk.riskmanage.rule.service.RuleService; -import com.risk.riskmanage.system.model.User; -import com.risk.riskmanage.util.SessionManager; -import com.risk.riskmanage.util.StringUtil; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -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.ResponseBody; - -import java.util.*; - -/** - * 提供 knowledge 相关接口 - * - * @apiName knowledge - * @apiDefine knowledge 3.规则管理 - */ -@Controller("KnowledgeTreeControllerV2") -@RequestMapping("/v2/knowledge/tree") -@ResponseBody -public class KnowledgeTreeController extends BaseController { - @Autowired - private RuleService ruleService; - - - /** - * @api {POST} /v2/knowledge/tree/list 3.01. 节点 获取目录 list:规则集、物流、银行、回收站等 - * @apiGroup knowledge - * @apiVersion 2.0.0 - * @apiParam {Integer} parentId parentId - * @apiParam {String} tree_type 树形分类(默认为0) 0:规则树,1:评分卡的树,2:回收站的树。(多个逗号分割) - * @apiParam {Integer} [type] 目录类型(默认为1) 0:系统的目录、1:组织的目录、2:引擎的目录 - * @apiSuccess {String} status 状态:1成功, 0失败 - * @apiParamExample {json} 请求示例: - * {"parentId":0,"tree_type":"0,2","type":1} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":{"parentId":1155,"tree_type":[0,2],"engineId":null,"type":1,"userId":135,"organId":46,"sort":true,"kArray":[{"id":1038,"name":"规则集","parentId":0,"userId":1,"organId":46,"engineId":null,"created":1498722046000,"type":1,"treeType":0,"status":1,"updated":1610332377000,"children":[{"id":1052,"name":"准入规则","parentId":1038,"userId":135,"organId":46,"engineId":null,"created":1498725927000,"type":1,"treeType":0,"status":1,"updated":1498725963000,"children":[],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1},{"id":1055,"name":"首贷反欺诈1","parentId":1038,"userId":135,"organId":46,"engineId":null,"created":1498725941000,"type":1,"treeType":0,"status":1,"updated":1505019204000,"children":[],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1},{"id":1056,"name":"反欺诈2","parentId":1038,"userId":135,"organId":46,"engineId":null,"created":1498725943000,"type":1,"treeType":0,"status":1,"updated":1498725975000,"children":[],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1},{"id":1057,"name":"反欺诈3","parentId":1038,"userId":135,"organId":46,"engineId":null,"created":1498725945000,"type":1,"treeType":0,"status":1,"updated":1498725980000,"children":[],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1},{"id":1058,"name":"复贷反欺诈1","parentId":1038,"userId":135,"organId":46,"engineId":null,"created":1505021066000,"type":1,"treeType":0,"status":1,"updated":1505021076000,"children":[],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1},{"id":1070,"name":"储蓄卡","parentId":1038,"userId":135,"organId":46,"engineId":null,"created":1520228395000,"type":1,"treeType":0,"status":1,"updated":1520228402000,"children":[],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1},{"id":1079,"name":"有盾","parentId":1038,"userId":135,"organId":46,"engineId":null,"created":1523523861000,"type":1,"treeType":0,"status":1,"updated":1523523866000,"children":[],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1},{"id":1080,"name":"同盾","parentId":1038,"userId":135,"organId":46,"engineId":null,"created":1526268525000,"type":1,"treeType":0,"status":1,"updated":1526268530000,"children":[],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1},{"id":1081,"name":"富数","parentId":1038,"userId":135,"organId":46,"engineId":null,"created":1526537754000,"type":1,"treeType":0,"status":1,"updated":1526537758000,"children":[],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1},{"id":1082,"name":"通讯录","parentId":1038,"userId":135,"organId":46,"engineId":null,"created":1527823577000,"type":1,"treeType":0,"status":1,"updated":1527823583000,"children":[],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1},{"id":1083,"name":"规则集MS","parentId":1038,"userId":135,"organId":46,"engineId":null,"created":1527823577000,"type":1,"treeType":0,"status":1,"updated":1527823583000,"children":[],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1},{"id":1084,"name":"规则集MX","parentId":1038,"userId":135,"organId":46,"engineId":null,"created":1559825319000,"type":1,"treeType":0,"status":1,"updated":1559825347000,"children":[],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1},{"id":1087,"name":"规则集TZ","parentId":1038,"userId":135,"organId":46,"engineId":null,"created":1559825352000,"type":1,"treeType":0,"status":1,"updated":1559825370000,"children":[],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1},{"id":1088,"name":"规则集YD","parentId":1038,"userId":135,"organId":46,"engineId":null,"created":1559825373000,"type":1,"treeType":0,"status":1,"updated":1559825378000,"children":[],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1},{"id":1122,"name":"规则集DY","parentId":1038,"userId":136,"organId":46,"engineId":null,"created":1610701146000,"type":1,"treeType":0,"status":1,"updated":1610703786000,"children":[],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1}],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1},{"id":1103,"name":"物流","parentId":0,"userId":141,"organId":46,"engineId":null,"created":1609742341000,"type":1,"treeType":0,"status":1,"updated":1611304985000,"children":[{"id":1104,"name":"网点余额不足风险","parentId":1103,"userId":141,"organId":46,"engineId":null,"created":1610332019000,"type":1,"treeType":0,"status":1,"updated":1610332055000,"children":[],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1}],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1},{"id":1109,"name":"银行","parentId":0,"userId":142,"organId":46,"engineId":null,"created":1610503557000,"type":1,"treeType":0,"status":1,"updated":1610503562000,"children":[{"id":1110,"name":"信用卡","parentId":1109,"userId":142,"organId":46,"engineId":null,"created":1610503567000,"type":1,"treeType":0,"status":1,"updated":1610503576000,"children":[{"id":1111,"name":"客服智能营销服务","parentId":1110,"userId":142,"organId":46,"engineId":null,"created":1610503699000,"type":1,"treeType":0,"status":1,"updated":1610503702000,"children":[],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1},{"id":1112,"name":"智能短信服务","parentId":1110,"userId":142,"organId":46,"engineId":null,"created":1610503750000,"type":1,"treeType":0,"status":1,"updated":1610503752000,"children":[],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1},{"id":1113,"name":"信用卡新户礼客户准入","parentId":1110,"userId":142,"organId":46,"engineId":null,"created":1610503758000,"type":1,"treeType":0,"status":1,"updated":1610503760000,"children":[],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1}],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1}],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1},{"id":1039,"name":"回收站","parentId":0,"userId":1,"organId":46,"engineId":null,"created":1498722046000,"type":1,"treeType":2,"status":1,"updated":1498722046000,"children":[{"id":1123,"name":"新建文件夹","parentId":1039,"userId":136,"organId":46,"engineId":null,"created":1610701170000,"type":1,"treeType":0,"status":-1,"updated":1611643120000,"children":[],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1},{"id":1129,"name":"新建文件夹","parentId":1039,"userId":143,"organId":46,"engineId":null,"created":1611545787000,"type":1,"treeType":0,"status":-1,"updated":1611643122000,"children":[{"id":1130,"name":"新建文件夹","parentId":1129,"userId":143,"organId":46,"engineId":null,"created":1611545828000,"type":1,"treeType":0,"status":1,"updated":1611545828000,"children":[],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1}],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1},{"id":1131,"name":"新建文件夹","parentId":1039,"userId":144,"organId":46,"engineId":null,"created":1611573817000,"type":1,"treeType":0,"status":-1,"updated":1611643123000,"children":[],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1},{"id":1132,"name":"新建文件夹","parentId":1039,"userId":144,"organId":46,"engineId":null,"created":1611575638000,"type":1,"treeType":0,"status":-1,"updated":1612409450000,"children":[],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1},{"id":1155,"name":"新建文件夹","parentId":1039,"userId":145,"organId":46,"engineId":null,"created":1612494472000,"type":1,"treeType":0,"status":-1,"updated":1612494477000,"children":[],"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1}],"isParent":"true","icon":"../resource/images/datamanage/cabage.png","isLastNode":"true","directoryType":1}]}} - */ - @RequestMapping(value = "/list", method = RequestMethod.POST) - public ResponseEntityDto list(@RequestBody Map param) { - List list = s.knowledgeTreeService.getTreeList(param); - return ResponseEntityBuilder.buildNormalResponse(list); - } - /** - * save:(保存新增节点) - * @param param 请求参数集合 - * @return - * - */ - /** - * @api {POST} /v2/knowledge/tree/save 3.02. 节点 新增 - * @apiGroup knowledge - * @apiVersion 2.0.0 - * @apiParam {Integer} name 节点名字 - * @apiParam {Integer} parentId parentId - * @apiParam {Integer} treeType 树形分类 0:规则树、1:评分卡的树、2:回收站的树 - * @apiParam {Integer} [type] 默认值为1,表示组织的目录 - * @apiParam {Integer} engineId null - * @apiSuccess {String} status 状态: 1成功, 0失败 - * @apiParamExample {json} 请求示例: - * {"name":"我是文件夹1047","parentId":"0","treeType":"0","type":"1","engineId":""} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":{"name":"我是文件夹1047","parentId":"0","treeType":"0","type":"1","engineId":"","userId":135,"organId":46,"result":1,"node":{"id":1162,"name":"我是文件夹1047","parentId":0,"userId":135,"organId":46,"engineId":null,"created":null,"type":1,"treeType":0,"status":1,"updated":null,"children":null,"isParent":"true","icon":"../resource/images/authority/folder.png","isLastNode":"","directoryType":1}}} - */ - @RequestMapping(value = "/save", method = RequestMethod.POST) - @ArchivesLog(operationType = OpTypeConst.SAVE_KNOWLEDGE_TREE) - public ResponseEntityDto save(@RequestBody Map param) { - KnowledgeTree k = new KnowledgeTree(); - Map paramMap = getParam(param); - k.setName((String) param.get("name")); - if (param.containsKey("treeType") - && !StringUtil.isBlank(param.get("treeType").toString())) { - k.setTreeType(Integer.parseInt(param.get("treeType").toString())); - } - // 加 - if (null == paramMap.get("type") || "".equals(paramMap.get("type"))) { - paramMap.put("type", 1); - } - if (paramMap.containsKey("type") - && !StringUtil.isBlank(param.get("type").toString())) { - k.setType(Integer.parseInt(paramMap.get("type").toString())); - } - if (paramMap.containsKey("organId") - && !StringUtil.isBlank(param.get("organId").toString())) { - k.setOrganId(Long.parseLong(paramMap.get("organId").toString())); - } - if (paramMap.containsKey("engineId") - && !StringUtil.isBlank(param.get("engineId").toString())) { - k.setEngineId(Long.parseLong(paramMap.get("engineId").toString())); - } - if (param.containsKey("parentId") - && !StringUtil.isBlank(param.get("parentId").toString())) { - k.setParentId(Long.parseLong(param.get("parentId").toString())); - } - if (paramMap.containsKey("userId") - && !StringUtil.isBlank(param.get("userId").toString())) { - k.setUserId(Long.parseLong(paramMap.get("userId").toString())); - } - k.setStatus(Status.ENABLED); - boolean flag = s.knowledgeTreeService.insertTree(k); - if (flag) { - param.put("result", 1); - } else { - param.put("result", -1); - } - param.put("node", k); - return ResponseEntityBuilder.buildNormalResponse(param); - } - - /** - * @api {POST} /v2/knowledge/tree/update 3.03. 节点 修改/删除 - * @apiGroup knowledge - * @apiVersion 2.0.0 - * @apiParam {Integer} id 节点id - * @apiParam {String} name 节点名称 - * @apiParam {Integer} engineId engineId - * @apiSuccess {String} status 状态: 1成功, 0失败 - * @apiParamExample {json} 请求示例: - * 修改: - * {"id":1162,"name":"文件夹1127","engineId":""} - * 删除: - * {"id":1162,"status":"-1","type":"1","engineId":"","parentId":0} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":{"id":1162,"name":"文件夹1127","engineId":"","userId":135,"organId":46,"result":1}} - */ - @RequestMapping(value = "/update", method = RequestMethod.POST) - @ArchivesLog(operationType = OpTypeConst.UPDATE_KNOWLEDGE_TREE) - public ResponseEntityDto update(@RequestBody Map param) { - if (null == param.get("type") || "".equals(param.get("type"))) { - param.put("type", 1); - } - Long id = Long.parseLong(param.get("id").toString()); - KnowledgeTree k = s.knowledgeTreeService.findById(id); - param.putAll(getParam(param)); - if (param.containsKey("name")) { - k.setName((String) param.get("name")); - } - if (param.containsKey("status")) { - int status = Integer.parseInt(param.get("status").toString()); - k.setStatus(status); - List idList = new ArrayList(); - Map map = new HashMap(); - map.put("parentIds", StringUtil.toLongList(k.getId().toString())); - map.put("type", param.get("type")); - map.put("engineId", param.get("engineId")); - map.put("organId", k.getOrganId()); - if (status == -1) { - map.put("status", StringUtil.toLongList("0,1")); - } - if (status == 1) { - map.put("status", StringUtil.toLongList("-1")); - } - if (k.getTreeType() == 0) { - List rlist = s.ruleService.getRuleList(map); - if (rlist != null && rlist.size() > 0) { - for (Rule r : rlist) { - idList.add(r.getId()); - } - map.put("status", status); - map.put("idList", idList); -// s.ruleService.updateRuleStatus(map); - ruleService.updateStatus(idList, status); - } - } - if (k.getTreeType() == 3) { -// decisionTablesService.updateStatus(idList.toArray(new Long[idList.size()]),status); - } - } - if (param.containsKey("parentId")) { - k.setParentId(Long.parseLong(param.get("parentId").toString())); - } - boolean flag = s.knowledgeTreeService.updateTree(k); - if (flag) { - param.put("result", 1); - } else { - param.put("result", -1); - } - return ResponseEntityBuilder.buildNormalResponse(param); - } - - /** - * getParam:(根据用户角色或权限,获取所需参数集合) - * - * @return paramMap - */ - private Map getParam(Map paramMap) { - User user = SessionManager.getLoginAccount(); - paramMap.put("userId", user.getUserId()); - paramMap.put("organId", user.getOrganId()); - return paramMap; - } - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/mapper/EngineRuleRelMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/mapper/EngineRuleRelMapper.java deleted file mode 100644 index 0ee7ef5..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/mapper/EngineRuleRelMapper.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.risk.riskmanage.knowledge.mapper; - -import java.util.List; -import java.util.Map; - -import com.risk.riskmanage.knowledge.model.KnowledgeTreeRel; -import com.risk.riskmanage.common.mapper.BaseMapper; - -/** - * ClassName:KnowledgeTreeRelMapper
- * Description:引擎与引用规则关系 mapper - * @see - * */ -public interface EngineRuleRelMapper extends BaseMapper{ - - /** - * insertRel:(批量插入关系) - * - * @param param 关系集合 - * @return - * */ - public int insertRel(Map param); - - /** - * deleteRel:(批量删除关系) - * - * @param param 关系集合 - * @return - * */ - public int deleteRel(Map param); - - /** - * getRuleIdsByEngineId:(根据引擎id,获取引用规则id集合) - * - * @param param 关系集合 - * @return - * */ - public List getRuleIdsByEngineId(Long engineId); - -} \ No newline at end of file diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/mapper/KnowledgeTreeMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/mapper/KnowledgeTreeMapper.java deleted file mode 100644 index d4b32bb..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/mapper/KnowledgeTreeMapper.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.risk.riskmanage.knowledge.mapper; - -import com.risk.riskmanage.common.mapper.BaseMapper; -import com.risk.riskmanage.engine.model.request.KnowledgeTreeListParam; -import com.risk.riskmanage.knowledge.model.KnowledgeTree; - -import java.util.List; -import java.util.Map; - -/** - * ClassName:KnowledgeTreeMapper
- * Description:知识库目录mapper - * @see - * - * */ -public interface KnowledgeTreeMapper extends BaseMapper{ - - /** - * getTreeList:(根据父节点id和组织id,查询其下的所有子节点) - * - * @param paramMap 参数集合 - * @return 父节点下的所有子节点 - * */ - public List getTreeList(Map paramMap); - public List getTreeListV2(Map paramMap); - - /** - * batchInsert:(批量新增节点) - * - * @param k 节点信息集合 - * @return - * */ - public int batchInsert(List k); - - /** - * getTreeList:(根据父节点id和组织id,查询其下的所有子节点,若节点下规则,则过滤掉) - * - * @param paramMap 参数集合 - * @return 父节点下的所有子节点 - * */ - public List getTreeDataForEngine(Map paramMap); - - public List getTreeDataForEngineV2(Map paramMap); - - Long getTreeId(KnowledgeTree knowledgeTree); - - List selectFolderList(KnowledgeTreeListParam param); -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/mapper/KnowledgeTreeRelMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/mapper/KnowledgeTreeRelMapper.java deleted file mode 100644 index 33a9f36..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/mapper/KnowledgeTreeRelMapper.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.risk.riskmanage.knowledge.mapper; - -import java.util.List; -import java.util.Map; - -import com.risk.riskmanage.knowledge.model.KnowledgeTreeRel; -import com.risk.riskmanage.common.mapper.BaseMapper; - -/** - * ClassName:KnowledgeTreeRelMapper
- * Description:规则管理树形目录与引擎关系 mapper - * @see - * - * */ -public interface KnowledgeTreeRelMapper extends BaseMapper{ - - /** - * insertRel:(批量插入关系) - * - * @param list 关系集合 - * @return - * */ - public int insertRel(Map param); - - /** - * deleteRel:(批量删除关系) - * - * @param engineId 引擎id - * @return - * */ - public int deleteRel(Long engineId); - - /** - * findTreeIdsByEngineId:(根据引擎id,获取引擎使用的组织目录节点的id的集合) - * - * @param engineId 引擎id - * @return - * */ - public List findTreeIdsByEngineId(Long engineId); -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/mapper/RuleContentMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/mapper/RuleContentMapper.java deleted file mode 100644 index baa805c..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/mapper/RuleContentMapper.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.risk.riskmanage.knowledge.mapper; - -import java.util.List; - -import com.risk.riskmanage.knowledge.model.RuleContent; -import com.risk.riskmanage.common.mapper.BaseMapper; -import com.risk.riskmanage.engine.model.NodeKnowledge; - -/** - * ClassName:RuleContentInfoMapper
- * Description:规则内容mapper - * @see - * */ -public interface RuleContentMapper extends BaseMapper{ - - /** - * getRuleContentList : (根据规则id,,获取规则内容集合) - * - * @param ruleId 规则id - * @return 规则下的所有内容 - * */ - public List getRuleContentList(Long ruleId); - - /** - * insertRuleContent: (批量新增规则内容记录) - * - * @param ruleContentList 规则内容信息 - * @return - * */ - public int insertRuleContent(List ruleContentList); - - /** - * updateRuleContent : (批量修改规则内容记录) - * - * @param rlist 规则内容信息集合 - * @return - * */ - public boolean updateRuleContent(List rlist); - - /** - * deleteRuleContent : (批量删除规则内容记录) - * - * @param rlist 规则内容信息集合 - * @return - * */ - public boolean deleteRuleContent(List rlist); - - /** - * 根据引擎节点选择的规则查询字段 - * @param nodeKnowledge 引擎规则关系 - * @return 查询到在规则字段 - * @see - */ - public List selectNodeByRuleList(NodeKnowledge nodeKnowledge); -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/mapper/RuleFieldMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/mapper/RuleFieldMapper.java deleted file mode 100644 index 920ff5c..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/mapper/RuleFieldMapper.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.risk.riskmanage.knowledge.mapper; - -import java.util.List; -import java.util.Map; - -import com.risk.riskmanage.knowledge.model.RuleField; -import com.risk.riskmanage.common.mapper.BaseMapper; -import com.risk.riskmanage.engine.model.NodeKnowledge; - -/** - * ClassName:RuleFieldMapper
- * Description:规则字段mapper - * @see - * */ -public interface RuleFieldMapper extends BaseMapper{ - - /** - * getFieldList : (根据规则id,,获取规则下的所有字段) - * - * @param ruleId 规则id - * @return 规则下的所有字段 - * */ - public List getFieldList(Long ruleId); - - /** - * insertField : (批量新增字段记录) - * - * @param rlist 字段信息集合 - * @return - * */ - public int insertField(List ruleFieldlist); - - /** - * updateField : (批量修改字段记录) - * - * @param rlist 字段信息集合 - * @return - * */ - public boolean updateField(List rlist); - - /** - * deleteField : (批量删除字段记录) - * - * @param rlist 字段信息集合 - * @return - * */ - public boolean deleteField(List rlist); - - - /** - * getNodeByList : (根据引擎节点得到所用字段) - * @author wenyu.cao - * @param nodeid 节点编号 - * @return 返回字段list - * */ - public List getNodeByList(NodeKnowledge knowledge); - - /** - * - * 根据规则得到规则引用字段 - * @param nodeKnowledge - * @return - * @see - */ - public List selectNodeByRuleList( NodeKnowledge nodeKnowledge); - /** - * - * 根据规则id得到规则引用字段 - * @param paramMap 规则id集合 - * @return - * @see - */ - public List selectByRuleList(Map paramMap); -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/mapper/RuleMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/mapper/RuleMapper.java deleted file mode 100644 index 624e682..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/mapper/RuleMapper.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.risk.riskmanage.knowledge.mapper; - -import com.risk.riskmanage.common.mapper.BaseMapper; -import com.risk.riskmanage.engine.model.NodeKnowledge; -import com.risk.riskmanage.knowledge.model.Rule; - -import java.util.List; -import java.util.Map; - -/** - * ClassName:OrganRuleMapper
- * Description:规则mapper - * @see - * */ -public interface RuleMapper extends BaseMapper{ - - /** - * getRuleList:(获取规则集合) - * - * @param paramMap 参数集合 - * @return 规则集合 - * */ - public List getRuleList(Map paramMap); - - /** - * updateRuleStatus:(批量修改规则状态记录) - * - * @param paramMap 参数集合 - * @return - * */ - public int updateRuleStatus(Map paramMap); - /** - * getNodeByRuleList : (根据引擎节点得到所用规则) - * @author wenyu.cao - * @param nodeid 节点编号 - * @return 返回字段list - * */ - public List getNodeByRuleList(NodeKnowledge knowledge); - - /** - * 根据规则类型查询规则 - * @param list 规则编号 - * @return - * @see - */ - public List selectnodeByInRoleid(List list); - - /** - * 根据父节点id查找,节点下所有规则id的集合 - * @param list 规则编号 - * @return - * @see - */ - public List getRuleIdsByParentId(Map param); - - /** - * getRuleList:(查找引用了某些字段的规则集合) - * - * @param paramMap 参数集合 - * @return 规则集合 - * */ - public List checkByField(Map paramMap); - - /** - * 效验规则名称唯一性 - * @param param 参数集合 - * @return - * @see - */ - public int countOnlyRuleName(Map param); - - /** - * 效验规则代码唯一性 - * @param param 参数集合 - * @return - * @see - */ - public int countOnlyRuleCode(Map param); - - /** - * getFieldIdsByRuleId:(根据规则id,获取规则所用字段id和Key) - * - * @param idList 规则id集合 - * @return - * */ - public List getFieldIdsByRuleId(List idList); - - public List getRuleListByType(Map paramMap); - - public List getNodeAddOrSubRulesByNodeId(Long nodeId); - - List getRuleListByIds(Map xxx); - - List getAllCodeNameParentId(); -// Set getAllName(); -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/model/EngineRuleRel.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/model/EngineRuleRel.java deleted file mode 100644 index be32455..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/model/EngineRuleRel.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.risk.riskmanage.knowledge.model; - -import java.io.Serializable; -/** - * ClassName:KnowledgeTreeRel
- * Description: 引擎与引用规则关系实体类
- */ -public class EngineRuleRel implements Serializable{ - - private static final long serialVersionUID = 1L; - - /** - * 主键 - * */ - private Long id; - - /** - * 引擎id - * */ - private Long engineId; - - /** - * 树形目录id - * */ - private Long ruleId; - - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public Long getEngineId() { - return engineId; - } - - public void setEngineId(Long engineId) { - this.engineId = engineId; - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/model/KnowledgeTree.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/model/KnowledgeTree.java deleted file mode 100644 index 6bd39af..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/model/KnowledgeTree.java +++ /dev/null @@ -1,229 +0,0 @@ -package com.risk.riskmanage.knowledge.model; - -import java.io.Serializable; -import java.util.Arrays; -import java.util.Date; - -import org.codehaus.jackson.annotate.JsonIgnore; -/** - * ClassName:KnowledgeTreeVo
- * Description: 知识库树形菜单实体类.
- */ -public class KnowledgeTree implements Serializable{ - - private static final long serialVersionUID = 1L; - - /** - * 主键 - * */ - private Long id; - - /** - * 目录名称 - * */ - private String name; - - /** - * 父节点id - * */ - private Long parentId; - - /** - * 创建人id - * */ - private Long userId; - - /** - * 组织id - * */ - private Long organId; - - - /** - * 引擎id - * */ - private Long engineId; - - /** - * 创建日期 - * */ - private Date created; - - /** - * 目录类型 0 : 系统的目录 1:组织的目录 2: 引擎的目录 - * */ - private Integer type; - - /** - * 树形分类:0:规则树 1:评分卡的树 2:回收站的树 - * */ - private Integer treeType; - - /** - * 状态 0 :停用 ,1 : 启用,-1:删除 - * */ - private Integer status; - - /** - * 修改日期 - * */ - private Date updated; - - /** - * 子类集合 - * */ - private KnowledgeTree[] children; - - /** - * 是否为父类 - * */ - private String isParent = "true"; - - /** - *文件夹图片路径 - * */ - private String icon=""; - - private String isLastNode=""; - - private Integer directoryType; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Long getParentId() { - return parentId; - } - - public void setParentId(Long parentId) { - this.parentId = parentId; - } - - public Long getUserId() { - return userId; - } - - public void setUserId(Long userId) { - this.userId = userId; - } - - public Long getOrganId() { - return organId; - } - - public void setOrganId(Long organId) { - this.organId = organId; - } - - public Long getEngineId() { - return engineId; - } - - public void setEngineId(Long engineId) { - this.engineId = engineId; - } - - @JsonIgnore - public Date getCreated() { - return created; - } - - public void setCreated(Date created) { - this.created = created; - } - - public Integer getType() { - return type; - } - - public void setType(Integer type) { - this.type = type; - } - - public Integer getStatus() { - return status; - } - - public void setStatus(Integer status) { - this.status = status; - } - - @JsonIgnore - public Date getUpdated() { - return updated; - } - - public void setUpdated(Date updated) { - this.updated = updated; - } - - public KnowledgeTree[] getChildren() { - return children; - } - - public void setChildren(KnowledgeTree[] children) { - this.children = children; - } - - public String getIsParent() { - return isParent; - } - - public void setIsParent(String isParent) { - this.isParent = isParent; - } - - public Integer getTreeType() { - return treeType; - } - - public void setTreeType(Integer treeType) { - this.treeType = treeType; - } - - public String getIcon() { -// if((int)treeType == 2 || (int)treeType == 3){ -// icon = "../resource/images/datamanage/cabage.png"; -// isLastNode ="true"; -// }else{ -// icon = "../resource/images/authority/folder.png"; -// } - return icon; - } - - public Integer getDirectoryType() { - return directoryType = type ; - } - - public String getIsLastNode() { -// if((int)treeType == 2 || (int)treeType == 3){ -// isLastNode ="true"; -// } - return isLastNode; - } - - @Override - public String toString() { - return "KnowledgeTree [id=" + id + ", name=" + name + ", parentId=" - + parentId + ", userId=" + userId + ", organId=" + organId - + ", engineId=" + engineId + ", created=" + created + ", type=" - + type + ", treeType=" + treeType + ", status=" + status - + ", updated=" + updated + ", children=" - + Arrays.toString(children) + ", isParent=" + isParent - + ", icon=" + icon + ", isLastNode=" + isLastNode - + ", directoryType=" + directoryType + "]"; - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/model/KnowledgeTreeRel.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/model/KnowledgeTreeRel.java deleted file mode 100644 index a227ca6..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/model/KnowledgeTreeRel.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.risk.riskmanage.knowledge.model; - -import java.io.Serializable; -/** - * ClassName:KnowledgeTreeRel
- * Description: 规则管理树形目录与引擎关系实体类
- * @see - */ -public class KnowledgeTreeRel implements Serializable{ - - private static final long serialVersionUID = 1L; - - /** - * 主键 - * */ - private Long id; - - /** - * 引擎id - * */ - private Long engineId; - - /** - * 树形目录id - * */ - private Long treeId; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public Long getEngineId() { - return engineId; - } - - public void setEngineId(Long engineId) { - this.engineId = engineId; - } - - public Long getTreeId() { - return treeId; - } - - public void setTreeId(Long treeId) { - this.treeId = treeId; - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/model/Rule.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/model/Rule.java deleted file mode 100644 index 03d773a..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/model/Rule.java +++ /dev/null @@ -1,423 +0,0 @@ -package com.risk.riskmanage.knowledge.model; - -import java.io.Serializable; -import java.util.Date; -import java.util.List; - -/** - * ClassName:OrganRuleVo
- * Description: 规则实体类.
- * @see - */ -public class Rule implements Serializable,Cloneable { - - private static final long serialVersionUID = 1L; - - /** - * 主键 - * */ - private Long id; - - /** - * 名称 - * */ - private String name; - - /** - * 代码 - * */ - private String code; - - /** - * 描述 - * */ - private String description; - - /** - * 优先级 - * */ - private Integer priority; - - /** - * 父节点id - * */ - private Long parentId; - - /** - *修改人id - * */ - private Long userId; - - /** - *创建人id - * */ - private Long author; - - /** - *创建人名称 - * */ - private String authorName; - - /** - * 组织id - * */ - private Long organId; - - /** - * 引擎id - * */ - private Long engineId; - - /** - * 规则类型 0 : 系统的规则 1:组织的规则 2: 引擎的规则 - * */ - private Integer type; - - /** - * 逻辑关系"非" 0:不是非 1:是非 - * */ - private Integer isNon; - - /** - * 状态 0 :停用 ,1 : 启用,-1:删除 - * */ - private Integer status; - /** - * 审批规则 5 :通过 ,2 : 拒绝,3:人工审批 4:简化流程 - */ - public int ruleAudit; - /** - * 规则字段集合 - * */ - private List ruleFieldList; - - /** - * 规则内容集合 - * */ - private List ruleContentList; - - /** - * 创建日期 - * */ - private Date created; - - /** - * 修改日期 - * */ - private Date updated; - - /** - * 规则具体内容 - * */ - public String content; - - /** - * 0硬性拒绝规则1加减分规则 - */ - private Integer ruleType; - - /** - *得分 - */ - private Integer score; - - /** - *逻辑关系符,存储条件区域最后一个逻辑符号,值有')'、'))'、'-1' - */ - private String lastLogical; - - /** - * 引擎名 - * */ - private String engineName; - - /** - * 规则节点名称 - * */ - private String engineNodeName; - - /** - * 规则节点名称 - * */ - private Long engineNodeId; - - /** - * 区分规则集和规则 - * */ - private int showType = 0; - - private Integer difficulty;//规则难度:1-简单规则,2复杂规则 - - private String resultFieldEn;//存放是否命中的字段 - - private String scoreFieldEn;//存放得分的字段en - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public int getRuleAudit() { - return ruleAudit; - } - - public void setRuleAudit(int ruleAudit) { - this.ruleAudit = ruleAudit; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Integer getPriority() { - return priority; - } - - public void setPriority(Integer priority) { - this.priority = priority; - } - - public Long getParentId() { - return parentId; - } - - public void setParentId(Long parentId) { - this.parentId = parentId; - } - - public Long getUserId() { - return userId; - } - - public void setUserId(Long userId) { - this.userId = userId; - } - - public Long getAuthor() { - return author; - } - - public void setAuthor(Long author) { - this.author = author; - } - - public String getAuthorName() { - return authorName; - } - - public void setAuthorName(String authorName) { - this.authorName = authorName; - } - - public Long getOrganId() { - return organId; - } - - public void setOrganId(Long organId) { - this.organId = organId; - } - - public Long getEngineId() { - return engineId; - } - - public void setEngineId(Long engineId) { - this.engineId = engineId; - } - - public Integer getType() { - return type; - } - - public void setType(Integer type) { - this.type = type; - } - - public Integer getStatus() { - return status; - } - - public void setStatus(Integer status) { - this.status = status; - } - - public List getRuleFieldList() { - return ruleFieldList; - } - - public void setRuleFieldList(List ruleFieldList) { - this.ruleFieldList = ruleFieldList; - } - - public List getRuleContentList() { - return ruleContentList; - } - - public void setRuleContentList(List ruleContentList) { - this.ruleContentList = ruleContentList; - } - - public Date getCreated() { - return created; - } - - public void setCreated(Date created) { - this.created = created; - } - - public Date getUpdated() { - return updated; - } - - public void setUpdated(Date updated) { - this.updated = updated; - } - - public Integer getIsNon() { - return isNon; - } - - public void setIsNon(Integer isNon) { - this.isNon = isNon; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public Integer getRuleType() { - if(ruleAudit == 2) { - ruleType = 0; - }else{ - ruleType = 1; - } - return ruleType; - } - - public void setRuleType(Integer ruleType) { - this.ruleType = ruleType; - } - - public Integer getScore() { - return score; - } - - public void setScore(Integer score) { - this.score = score; - } - - public String getLastLogical() { - return lastLogical; - } - - public void setLastLogical(String lastLogical) { - this.lastLogical = lastLogical; - } - - public String getEngineName() { - return engineName; - } - - public void setEngineName(String engineName) { - this.engineName = engineName; - } - - - - public String getEngineNodeName() { - return engineNodeName; - } - - public void setEngineNodeName(String engineNodeName) { - this.engineNodeName = engineNodeName; - } - - public Long getEngineNodeId() { - return engineNodeId; - } - - public void setEngineNodeId(Long engineNodeId) { - this.engineNodeId = engineNodeId; - } - - public int getShowType() { - return showType; - } - - public void setShowType(int showType) { - this.showType = showType; - } - - public Integer getDifficulty() { - return difficulty; - } - - public void setDifficulty(Integer difficulty) { - this.difficulty = difficulty; - } - - @Override - public Object clone() throws CloneNotSupportedException { - // TODO Auto-generated method stub - return super.clone(); - } - - public String getResultFieldEn() { - return resultFieldEn; - } - - public void setResultFieldEn(String resultFieldEn) { - this.resultFieldEn = resultFieldEn; - } - - public String getScoreFieldEn() { - return scoreFieldEn; - } - - public void setScoreFieldEn(String scoreFieldEn) { - this.scoreFieldEn = scoreFieldEn; - } - - @Override - public String toString() { - return "EngineRule [id=" + id + ", name=" + name + ", versionCode=" + code + ", description=" + description + ", priority=" - + priority + ", parentId=" + parentId + ", userId=" + userId + ", author=" + author + ", authorName=" - + authorName + ", organId=" + organId + ", engineId=" + engineId + ", type=" + type + ", isNon=" + isNon - + ", status=" + status + ", ruleAudit=" + ruleAudit + ", ruleFieldList=" + ruleFieldList - + ", ruleContentList=" + ruleContentList + ", created=" + created + ", updated=" + updated - + ", content=" + content + ", ruleType=" + ruleType + ", score=" + score + ", lastLogical=" - + lastLogical + ", engineName=" + engineName + ", engineNodeName=" + engineNodeName + ", engineNodeId=" - + engineNodeId + ", showType=" + showType + "]"; - } - - - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/model/RuleContent.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/model/RuleContent.java deleted file mode 100644 index 8dac2eb..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/model/RuleContent.java +++ /dev/null @@ -1,156 +0,0 @@ -package com.risk.riskmanage.knowledge.model; - -import java.io.Serializable; - -import com.risk.riskmanage.util.StringUtil; - -/** - * ClassName:RuleContentVo
- * Description: 规则内容实体类.
- * @see - */ -public class RuleContent implements Serializable{ - - - private static final long serialVersionUID = 1L; - - /** - * 主键 - * */ - private Long id; - - /** - * 字段名 - * */ - private String field; - - /** - * 字段值 - * */ - private String fieldValue; - - /** - * 字段id - * */ - private String fieldId; - - /** - * 规则Id - * */ - private Long ruleId; - /** - * 类型:1 常量、2 变量 - */ - private Integer variableType; - - - /** - * 关联的字段的英文名称 - * */ - private String fieldEn; - - /** - * 关联的字段的值类型 - * */ - private Integer valueType; - - public Integer getVariableType() { - return variableType; - } - - public void setVariableType(Integer variableType) { - this.variableType = variableType; - } - - public void setValues(String[] values) { - this.values = values; - } - - /** - * 关联的字段的取值范围 - * */ - private String valueScope; - - /** - * 关联的字段的值拆解后的数组 - * */ - private String[] values; - - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getField() { - return field; - } - - public void setField(String field) { - this.field = field; - } - - public String getFieldValue() { - return fieldValue; - } - - public void setFieldValue(String fieldValue) { - this.fieldValue = fieldValue; - } - - public String getFieldId() { - return fieldId; - } - - public void setFieldId(String fieldId) { - this.fieldId = fieldId; - } - - public Long getRuleId() { - return ruleId; - } - - public void setRuleId(Long ruleId) { - this.ruleId = ruleId; - } - - public Integer getValueType() { - return valueType; - } - - public void setValueType(Integer valueType) { - this.valueType = valueType; - } - - public String getValueScope() { - return valueScope; - } - - public void setValueScope(String valueScope) { - this.valueScope = valueScope; - } - - public String[] getValues() { - if(!StringUtil.isBlank(valueScope)){ - if(valueType == 3){ - values = valueScope.split(","); - }else{ - values = new String[]{valueScope}; - } - }else{ - values = null; - } - return values; - } - - public String getFieldEn() { - return fieldEn; - } - - public void setFieldEn(String fieldEn) { - this.fieldEn = fieldEn; - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/model/RuleExcel.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/model/RuleExcel.java deleted file mode 100644 index 9b6e5ff..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/model/RuleExcel.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.risk.riskmanage.knowledge.model; - -public class RuleExcel { - - /** - * 规则名称 - * */ - private String name; - - /** - * 规则代码 - * */ - private String code; - - /** - * 规则描述 - * */ - private String description; - - /** - * 优先级 - * */ - private Integer priority; - - /** - * 规则字段内容 - * */ - private String fieldContent; - - /** - * 规则内容 - * */ - private String content; - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public String getCode() { - return code; - } - public void setCode(String code) { - this.code = code; - } - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - public Integer getPriority() { - return priority; - } - public void setPriority(Integer priority) { - this.priority = priority; - } - public String getFieldContent() { - return fieldContent; - } - public void setFieldContent(String fieldContent) { - this.fieldContent = fieldContent; - } - public String getContent() { - return content; - } - public void setContent(String content) { - this.content = content; - } - - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/model/RuleField.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/model/RuleField.java deleted file mode 100644 index 2a95589..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/model/RuleField.java +++ /dev/null @@ -1,167 +0,0 @@ -package com.risk.riskmanage.knowledge.model; - -import java.io.Serializable; - -import com.risk.riskmanage.util.StringUtil; - -/** - * ClassName:RuleFieldVo
- * Description: 规则字段实体类.
- * @see - */ -public class RuleField implements Serializable{ - - - private static final long serialVersionUID = 1L; - - /** - * 主键 - * */ - private Long id; - - /** - * 逻辑运算符 - * */ - private String logical; - - /** - * 字段内容 - * */ - private String field; - - /** - * 运算符 - * */ - private String operator; - - /** - * 字段值 - * */ - private String fieldValue; - - /** - * 关联的规则的id - * */ - private Long ruleId; - - /** - * 关联的字段的id - * */ - private String fieldId; - - /** - * 关联的字段的英文名称 - * */ - private String fieldEn; - - /** - * 关联的字段的值类型 - * */ - private Integer valueType; - - /** - * 关联的字段的取值范围 - * */ - private String valueScope; - - /** - * 关联的字段的值拆解后的数组 - * */ - private String[] values; - - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getLogical() { - return logical; - } - - public void setLogical(String logical) { - this.logical = logical; - } - - public String getField() { - return field; - } - - public void setField(String field) { - this.field = field; - } - - public String getOperator() { - return operator; - } - - public void setOperator(String operator) { - this.operator = operator; - } - - public String getFieldValue() { - return fieldValue; - } - - public void setFieldValue(String fieldValue) { - this.fieldValue = fieldValue; - } - - public Long getRuleId() { - return ruleId; - } - - public void setRuleId(Long ruleId) { - this.ruleId = ruleId; - } - - public String getFieldId() { - return fieldId; - } - - public void setFieldId(String fieldId) { - this.fieldId = fieldId; - } - - public Integer getValueType() { - return valueType; - } - - public void setValueType(Integer valueType) { - this.valueType = valueType; - } - - public String getValueScope() { - return valueScope; - } - - public void setValueScope(String valueScope) { - this.valueScope = valueScope; - } - - public String[] getValues() { - if(!StringUtil.isBlank(valueScope)){ - if(valueType == 3){ - values = valueScope.split(","); - }else{ - values = new String[]{valueScope}; - } - }else{ - values = null; - } - return values; - } - - public String getFieldEn() { - return fieldEn; - } - - public void setFieldEn(String fieldEn) { - this.fieldEn = fieldEn; - } - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/model/response/UploadResponse.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/model/response/UploadResponse.java deleted file mode 100644 index 8face32..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/model/response/UploadResponse.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.risk.riskmanage.knowledge.model.response; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.Map; - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class UploadResponse { - private Integer existRows;//已存在行数 - private Integer sucRows;//成功条数 - private Integer repeatRows;//重复条数 - private Integer failRows;//失败条数 - private Integer total; - private Map result;//执行结果 -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/service/KnowledgeTreeService.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/service/KnowledgeTreeService.java deleted file mode 100644 index 0b684ec..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/service/KnowledgeTreeService.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.risk.riskmanage.knowledge.service; - -import java.util.*; - -import com.risk.riskmanage.engine.model.request.KnowledgeTreeListParam; -import com.risk.riskmanage.knowledge.model.KnowledgeTree; - -/** - * ClassName:KnowledgeTreeService
- * Description: 知识库目录接口.
- * @see - */ -public interface KnowledgeTreeService { - - /** - * getTreeList:(根据父节点id和组织id,查询其下的所有子节点) - * - * @param paramMap 参数集合 - * @return 父节点下的所有子节点 - * */ - public List getTreeList(Map paramMap); - - /** - * findById:(根据id,查询节点记录) - * - * @param id 节点id - * @return - * */ - public KnowledgeTree findById(Long id); - - /** - * insertTree:(新增节点记录) - * - * @param k 节点信息 - * @return - * */ - public boolean insertTree(KnowledgeTree k); - - - - /** - * updateTree:(修改节点记录) - * - * @param k 节点信息 - * @return - * */ - public boolean updateTree(KnowledgeTree k); - - - - /** - * getTreeList:(根据父节点id和组织id,查询其下的所有子节点,若节点下规则,则过滤掉) - * - * @param paramMap 参数集合 - * @return 父节点下的所有子节点 - * */ - public List getTreeDataForEngine(Map paramMap); - - List getFolderList(KnowledgeTreeListParam param); -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/service/RuleService.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/service/RuleService.java deleted file mode 100644 index 1a36800..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/service/RuleService.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.risk.riskmanage.knowledge.service; - - -import com.risk.riskmanage.knowledge.model.Rule; - -import java.util.List; -import java.util.Map; - -/** - * ClassName:RuleService
- * Description: 规则接口.
- * @see - */ -public interface RuleService { - - /** - * getRuleList:(获取规则集合) - * - * @param paramMap 参数集合 - * @return 规则集合 - * */ - public List getRuleList(Map paramMap); - - - - - - - - - - - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/service/impl/KnowledgeTreeServiceImpl.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/service/impl/KnowledgeTreeServiceImpl.java deleted file mode 100644 index 0a1aee1..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/service/impl/KnowledgeTreeServiceImpl.java +++ /dev/null @@ -1,178 +0,0 @@ -package com.risk.riskmanage.knowledge.service.impl; - -import com.risk.riskmanage.common.basefactory.BaseService; -import com.risk.riskmanage.common.enums.ErrorCodeEnum; -import com.risk.riskmanage.common.exception.ApiException; -import com.risk.riskmanage.engine.model.request.KnowledgeTreeListParam; -import com.risk.riskmanage.knowledge.model.KnowledgeTree; -import com.risk.riskmanage.knowledge.service.KnowledgeTreeService; -import com.risk.riskmanage.system.model.User; -import com.risk.riskmanage.util.SessionManager; -import com.risk.riskmanage.util.StringUtil; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * ClassName:KnowledgeTreeServiceImpl
- * Description: 知识库目录接口实现类.
- */ -@Service -public class KnowledgeTreeServiceImpl extends BaseService implements KnowledgeTreeService { - - - @Override - public List getTreeList(Map param) { - - try { - if (param.get("parentId").toString().equals("99999999")) { - param.put("parentId", 0); - } - } catch (Exception e) { - } - - // if (this.isBlack(param.get("parentId"))) { - // param.put("parentId", 0); - // } - - if (null == param.get("parentId") || "".equals(param.get("parentId"))) { - param.put("parentId", 0); - } - if (null == param.get("type") || "".equals(param.get("type"))) { - param.put("type", 1); - } - if (null == param.get("status") || "".equals(param.get("status"))) { - param.put("status", new int[]{1}); - } - - if (param.get("treeType")!=null&&!"".equals(param.get("treeType").toString())){ - String name = param.get("treeType").toString(); - switch (name){ - case "0": - param.put("name", "基础规则集"); - param.put("tree_type", "0"); - break; - case "1": - param.put("name", "评分卡"); - param.put("tree_type", "1"); - break; - case "2": - param.put("name", "回收站"); - param.put("tree_type", "2"); - break; - case "3": - param.put("name", "决策表"); - param.put("tree_type", "3"); - break; - case "4": - param.put("name", "决策树"); - param.put("tree_type", "4"); - break; - case "5": - param.put("name", "复杂规则集合"); - param.put("tree_type", "5"); - break; - case "7": - param.put("name","脚本规则集"); - param.put("tree_type","7"); - break; - case "8": - param.put("name","集合操作"); - param.put("tree_type","8"); - break; - default: - throw new ApiException(ErrorCodeEnum.PARAMS_EXCEPTION.getCode(),ErrorCodeEnum.PARAMS_EXCEPTION.getMessage()); - } - }else { - throw new ApiException(ErrorCodeEnum.PARAMS_EXCEPTION.getCode(),ErrorCodeEnum.PARAMS_EXCEPTION.getMessage()); - } - param.putAll(getParam(param)); - param.put("sort", true); - param.put("tree_type", StringUtil.toLongList(param.get("tree_type").toString())); - List klist = knowledgeTreeMapper.getTreeListV2(param); - String engineIdStr = (String) param.get("engineId"); - for (KnowledgeTree knowledgeTree : klist) { - param.put("parentId", knowledgeTree.getId()); - if (!StringUtil.isBlank(engineIdStr) && (int) knowledgeTree.getType() == 1 && knowledgeTree.getTreeType() == 0) { - knowledgeTree.setName(knowledgeTree.getName() + "(通用)"); - } - knowledgeTree.setChildren(getChildren(param)); - } - KnowledgeTree[] kArray = new KnowledgeTree[klist.size()]; - kArray = klist.toArray(kArray); - param.put("children", kArray); - - param.put("id", 99999999); - - ArrayList list = new ArrayList<>(); - list.add(param); - return list; - } - - @Override - public KnowledgeTree findById(Long id) { - // TODO Auto-generated method stub - return knowledgeTreeMapper.selectByPrimaryKey(id); - } - - @Override - public boolean insertTree(KnowledgeTree k) { - knowledgeTreeMapper.insertSelective(k); - return true; - } - - @Override - public boolean updateTree(KnowledgeTree k) { - knowledgeTreeMapper.updateByPrimaryKeySelective(k); - return true; - } - - - - @Override - public List getTreeDataForEngine(Map paramMap) { - // TODO Auto-generated method stub - // return knowledgeTreeMapper.getTreeDataForEngine(paramMap); - return knowledgeTreeMapper.getTreeDataForEngineV2(paramMap); - } - - @Override - public List getFolderList(KnowledgeTreeListParam param) { - User user = SessionManager.getLoginAccount(); - param.setOrganId(user.getOrganId()); - - List list = knowledgeTreeMapper.selectFolderList(param); - return list; - } - - private Map getParam(Map paramMap) { - User user = SessionManager.getLoginAccount(); - paramMap.put("userId", user.getUserId()); - paramMap.put("organId", user.getOrganId()); - return paramMap; - } - - /** - * getChildren:(获取树形节点的子节点信息) - * - * @param param 请求参数集合 - * @return - * - */ - private KnowledgeTree[] getChildren(Map param) { - List klist = knowledgeTreeMapper.getTreeList(param); - String engineIdStr = (String) param.get("engineId"); - for (KnowledgeTree knowledgeTree : klist) { - param.put("parentId", knowledgeTree.getId()); - if (!StringUtil.isBlank(engineIdStr) && (int) knowledgeTree.getType() == 1 && knowledgeTree.getTreeType() == 0) { - knowledgeTree.setName(knowledgeTree.getName() + "(通用)"); - } - knowledgeTree.setChildren(getChildren(param)); - } - KnowledgeTree[] kArray = new KnowledgeTree[klist.size()]; - kArray = klist.toArray(kArray); - return kArray; - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/service/impl/RuleServiceImpl.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/service/impl/RuleServiceImpl.java deleted file mode 100644 index 8b588b6..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/knowledge/service/impl/RuleServiceImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.risk.riskmanage.knowledge.service.impl; - - -import com.risk.riskmanage.common.basefactory.BaseService; - - -import com.risk.riskmanage.knowledge.mapper.RuleMapper; -import com.risk.riskmanage.knowledge.model.*; - -import com.risk.riskmanage.knowledge.service.KnowledgeTreeService; - -import com.risk.riskmanage.knowledge.service.RuleService; - - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; - -import java.util.*; - - -/** - * ClassName:RuleServiceImpl
- * Description: 规则接口实现类.
- */ -@Service -public class RuleServiceImpl extends BaseService implements RuleService { - - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Resource - private RuleMapper ruleMapper; - - @Override - public List getRuleList(Map paramMap) { - return ruleMapper.getRuleList(paramMap); - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/logger/ArchivesLog.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/logger/ArchivesLog.java deleted file mode 100644 index d93341b..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/logger/ArchivesLog.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.risk.riskmanage.logger; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; -/** - * ClassName:ArchivesLog
- * Description: 日志操作类型注解.
- */ -@Target({ElementType.PARAMETER, ElementType.METHOD}) -@Retention(RetentionPolicy.RUNTIME) -@Documented -public @interface ArchivesLog { - - public String operationType() default ""; - - public String operationName() default ""; - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/logger/ArchivesLogAspect.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/logger/ArchivesLogAspect.java deleted file mode 100644 index 903ce42..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/logger/ArchivesLogAspect.java +++ /dev/null @@ -1,150 +0,0 @@ -package com.risk.riskmanage.logger; - -import com.risk.riskmanage.common.constants.OpTypeEnum; -import com.risk.riskmanage.logger.mapper.LoggerMapper; -import com.risk.riskmanage.logger.model.Logger; -import com.risk.riskmanage.system.model.User; -import com.risk.riskmanage.util.RequestUtil; -import com.risk.riskmanage.util.SessionManager; -import org.aspectj.lang.JoinPoint; -import org.aspectj.lang.annotation.*; -import org.springframework.stereotype.Component; -import org.springframework.web.context.request.RequestAttributes; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.Date; -import java.util.Map; - -@Aspect -@Component -public class ArchivesLogAspect { - - @Resource - private LoggerMapper loggerMapper; - - private Date startTime; // 开始时间 - private Date endTime; // 结束时间 - private HttpServletRequest request = null; - - @Pointcut("@annotation(com.risk.riskmanage.logger.ArchivesLog))") - public void controllerAspect() { - } - - @Before("controllerAspect()") - public void doBefore() { - request = getHttpServletRequest(); - startTime = new Date(); - } - - @AfterReturning(pointcut="controllerAspect()", returning="returnValue") - public void doAfter(JoinPoint joinPoint,Object returnValue) { - handleLog(joinPoint,null,returnValue); - } - - @AfterThrowing(value="controllerAspect()",throwing="e") - public void doAfter(JoinPoint joinPoint, Exception e) { - handleLog(joinPoint, e,null); - } - - - /** - * @Description: 方法调用后触发 记录结束时间 - * - * @param joinPoint - */ - @SuppressWarnings({ "rawtypes", "unchecked" }) - public void handleLog(JoinPoint joinPoint,Exception e,Object retValue) { - try { - User user = SessionManager.getLoginAccount(); - String targetName = joinPoint.getTarget().getClass().getName(); - String methodName = joinPoint.getSignature().getName(); - Object[] arguments = joinPoint.getArgs(); - Class targetClass = Class.forName(targetName); - Method[] methods = targetClass.getMethods(); - String operationName = ""; - for (Method method : methods) { - if (method.getName().equals(methodName)) { - Class[] clazzs = method.getParameterTypes(); - if (clazzs!=null&&clazzs.length == arguments.length&&method.getAnnotation(ArchivesLog.class)!=null) { - operationName = method.getAnnotation(ArchivesLog.class).operationType(); - break; - } - } - } - - endTime = new Date(); - Logger log = new Logger(); - log.setStartTime(startTime); - log.setEndTime(endTime); - if(user!=null){ - log.setOpUserId(user.getUserId()); - log.setOrganId(user.getOrganId()); - } - if (request.getScheme()!=null){ - log.setRequestPath(request.getRequestURL().toString()); - }else { - log.setRequestPath("npe"); - } - log.setMethod(methodName); - - //获取请求参数 - if(!operationName.equals("登入")){ - Map map = request.getParameterMap(); - StringBuffer sb = new StringBuffer(); - sb.append("{"); - for(String name : map.keySet()){ - String[] values=map.get(name); - String val = Arrays.toString(values); - sb.append(name+"="+val.substring(1,val.length()-1)).append(","); - } - sb = sb.deleteCharAt(sb.length()-1); - sb.append("}"); - log.setRequestParam(sb.toString()); - } - - //获取响应参数 - if(e !=null){ - log.setResponseParam(e.getMessage()); - }else{ - if(retValue!=null){ - log.setResponseParam(retValue.toString()); - } - } - - for (OpTypeEnum examType : OpTypeEnum.values()) { - if (operationName.equals(examType.getType()) ) { - log.setOpType(examType.getValue()); - } - } - log.setOpName(operationName); - log.setIp(RequestUtil.getClientIP(request)); - loggerMapper.insertSelective(log); - - } catch (ClassNotFoundException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } catch (SecurityException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - } - - /** - * @Description: 获取request - * - * @param - * @return HttpServletRequest - */ - public HttpServletRequest getHttpServletRequest(){ - RequestAttributes ra = RequestContextHolder.getRequestAttributes(); - ServletRequestAttributes sra = (ServletRequestAttributes)ra; - HttpServletRequest request = sra.getRequest(); - return request; - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/logger/controller/v2/LoggerController.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/logger/controller/v2/LoggerController.java deleted file mode 100644 index fe33741..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/logger/controller/v2/LoggerController.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.risk.riskmanage.logger.controller.v2; - -import com.alibaba.fastjson.JSONObject; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.risk.riskmanage.common.basefactory.BaseController; -import com.risk.riskmanage.common.model.ResponseEntityDto; -import com.risk.riskmanage.common.utils.ResponseEntityBuilder; -import com.risk.riskmanage.logger.model.Logger; -import com.risk.riskmanage.logger.model.request.LoggerParam; -import com.risk.riskmanage.system.model.User; -import com.risk.riskmanage.util.SessionManager; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.*; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Controller("loggerControllerV2") -@RequestMapping("v2/sysLog") -@ResponseBody -public class LoggerController extends BaseController { - - /** - * @api {POST} /v2/sysLog/getLogList 6.51. 获取日志列表 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiParam {Integer} pageNo 页数 - * @apiParam {Integer} pageSize 每页的条数 - * @apiParam {String} searchKey 搜索关键字 - * @apiParam {String} startDate 搜索开始时间 - * @apiParam {String} endDate 搜索结束时间 - * @apiSuccess {JSON} pager 分页信息 - * @apiSuccess {JSONArray} logList 日志列表 - * @apiSuccess (logList) {Long} id 日志Id - * @apiSuccess (logList) {String} opType 操作类型 - * @apiSuccess (logList) {String} organName 公司名称 - * @apiSuccess (logList) {String} opName 操作名称 - * @apiSuccess (logList) {Long} opUserId 操作人员id - * @apiSuccess (logList) {String} opUserName 操作人员名称 - * @apiSuccess (logList) {Long} organId 组织id - * @apiSuccess (logList) {String} method 方法名 - * @apiSuccess (logList) {String} requestPath 请求地址 - * @apiSuccess (logList) {String} requestParam 请求参数 - * @apiSuccess (logList) {String} responseParam 响应参数 - * @apiSuccess (logList) {String} ip 请求ip - * @apiSuccess (logList) {Long} startTime 开始时间 - * @apiSuccess (logList) {Long} endTime 结束时间 - * @apiParamExample {json} 请求示例: - * {"pageNo":1,"pageSize":2,"searchKey":"修改","startDate":"2021-3-11","endDate":"2021-3-21"} - * @apiSuccessExample {json} Success-Response: - * {"status":"1","error":"00000000","msg":null,"data":{"pager":{"pageNum":1,"pageSize":2,"size":2,"startRow":1,"endRow":2,"total":283,"pages":142,"list":null,"prePage":0,"nextPage":2,"isFirstPage":true,"isLastPage":false,"hasPreviousPage":false,"hasNextPage":true,"navigatePages":8,"navigatepageNums":[1,2,3,4,5,6,7,8],"navigateFirstPage":1,"navigateLastPage":8,"firstPage":1,"lastPage":8},"logList":[{"id":5345,"opType":"updateSysMenu","organName":"rik","opName":"修改系统菜单","opUserId":1,"opUserName":"超级管理员","organId":1,"method":"update","requestPath":"http://localhost:8080/Riskmanage/v2/sysMenu/update","requestParam":"}","responseParam":"ResponseEntityDto(super=com.risk.riskmanage.common.model.ResponseEntityDto@8bc7d62e, status=1, error=00000000, msg=null, data=1)","ip":"0:0:0:0:0:0:0:1","startTime":1616251925000,"endTime":1616251938000},{"id":5342,"opType":"updateOrgan","organName":"rik","opName":" 修改组织信息","opUserId":1,"opUserName":"超级管理员","organId":1,"method":"update","requestPath":"http://localhost:8080/Riskmanage/v2/sysOrganization/update","requestParam":"}","responseParam":"ResponseEntityDto(super=com.risk.riskmanage.common.model.ResponseEntityDto@8bc7d62e, status=1, error=00000000, msg=null, data=1)","ip":"0:0:0:0:0:0:0:1","startTime":1616234345000,"endTime":1616234352000}]}} - */ - @RequestMapping(value = "getLogList", method = RequestMethod.POST) - public ResponseEntityDto getLogList(@RequestBody LoggerParam loggerParam){ - Map param = JSONObject.parseObject(JSONObject.toJSONString(loggerParam), Map.class); - User user = SessionManager.getLoginAccount(); - if(!user.getNickName().equals("超级管理员")){ - param.put("organId", user.getOrganId()); - } - PageHelper.startPage(loggerParam.getPageNo(), loggerParam.getPageSize()); - List logList = s.loggerService.getLogList(param); - PageInfo pageInfo = new PageInfo(logList); - pageInfo.setList(null); - HashMap modelMap = new HashMap<>(); - modelMap.put("pager", pageInfo); - modelMap.put("logList", logList); - return ResponseEntityBuilder.buildNormalResponse(modelMap); - } - - /** - * @api {POST} /v2/sysLog/getLogInfo/{id} 6.52. 获取日志详情 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiParam {Long} id 日志Id(url参数) - * @apiSuccess {Long} id 日志Id - * @apiSuccess {String} opType 操作类型 - * @apiSuccess {String} organName 公司名称 - * @apiSuccess {String} opName 操作名称 - * @apiSuccess {Long} opUserId 操作人员id - * @apiSuccess {String} opUserName 操作人员名称 - * @apiSuccess {Long} organId 组织id - * @apiSuccess {String} method 方法名 - * @apiSuccess {String} requestPath 请求地址 - * @apiSuccess {String} requestParam 请求参数 - * @apiSuccess {String} responseParam 响应参数 - * @apiSuccess {String} ip 请求ip - * @apiSuccess {Long} startTime 开始时间 - * @apiSuccess {Long} endTime 结束时间 - * @apiParamExample {json} 请求示例: - * {} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":{"id":5342,"opType":"updateOrgan","organName":"rik","opName":" 修改组织信息","opUserId":1,"opUserName":"超级管理员","organId":1,"method":"update","requestPath":"http://localhost:8080/Riskmanage/v2/sysOrganization/update","requestParam":"}","responseParam":"ResponseEntityDto(super=com.risk.riskmanage.common.model.ResponseEntityDto@8bc7d62e, status=1, error=00000000, msg=null, data=1)","ip":"0:0:0:0:0:0:0:1","startTime":1616234345000,"endTime":1616234352000}} - */ - @RequestMapping(value = "getLogInfo/{id}", method = RequestMethod.POST) - public ResponseEntityDto getLogInfo(@PathVariable Long id){ - Logger logger = s.loggerService.findById(id); - return ResponseEntityBuilder.buildNormalResponse(logger); - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/logger/mapper/LoggerMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/logger/mapper/LoggerMapper.java deleted file mode 100644 index 34b6528..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/logger/mapper/LoggerMapper.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.risk.riskmanage.logger.mapper; - -import com.risk.riskmanage.common.mapper.BaseMapper; -import com.risk.riskmanage.logger.model.Logger; - -import java.util.Date; -import java.util.List; -import java.util.Map; -/** - * ClassName:LoggerMapper
- * Description:日志mapper - * */ -public interface LoggerMapper extends BaseMapper{ - - /** - * getLogList :(获取日志集合) - * - * @param param 参数集合 - * @return - * */ - public List getLogList(Map param); - - /** - * 查询最后登录时间 - * @param userId - * @return - */ - public List getLastLoginInfo(Long userId); - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/logger/model/Logger.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/logger/model/Logger.java deleted file mode 100644 index 0733762..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/logger/model/Logger.java +++ /dev/null @@ -1,167 +0,0 @@ -package com.risk.riskmanage.logger.model; - -import java.util.Date; - -/** - * ClassName:Logger
- * Description: 日志实体类.
- */ -public class Logger { - - /** - * 主键 - * */ - private Long id; - - /** - * 操作类型 - * */ - private String opType; - - - /** - * 公司名称 - * */ - private String organName; - - /** - * 操作名称 - * */ - private String opName; - - /** - * 操作人员id - * */ - private Long opUserId; - - /** - * 操作人员id - * */ - private String opUserName; - - /** - * 组织id - * */ - private Long organId; - - /** - * 方法名 - * */ - private String method; - - /** - * 请求地址 - * */ - private String requestPath; - - /** - * 请求参数 - * */ - private String requestParam; - - /** - * 响应参数 - * */ - private String responseParam; - - /** - * 请求ip - * */ - private String ip; - - /** - * 开始时间 - * */ - private Date startTime; - /** - * 结束时间 - * */ - private Date endTime; - - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - public String getOpType() { - return opType; - } - public void setOpType(String opType) { - this.opType = opType; - } - public Long getOpUserId() { - return opUserId; - } - public void setOpUserId(Long opUserId) { - this.opUserId = opUserId; - } - public String getMethod() { - return method; - } - public void setMethod(String method) { - this.method = method; - } - public String getRequestPath() { - return requestPath; - } - public void setRequestPath(String requestPath) { - this.requestPath = requestPath; - } - public String getRequestParam() { - return requestParam; - } - public void setRequestParam(String requestParam) { - this.requestParam = requestParam; - } - public String getResponseParam() { - return responseParam; - } - public void setResponseParam(String responseParam) { - this.responseParam = responseParam; - } - public Date getStartTime() { - return startTime; - } - public void setStartTime(Date startTime) { - this.startTime = startTime; - } - public Date getEndTime() { - return endTime; - } - public void setEndTime(Date endTime) { - this.endTime = endTime; - } - public Long getOrganId() { - return organId; - } - public void setOrganId(Long organId) { - this.organId = organId; - } - public String getIp() { - return ip; - } - public void setIp(String ip) { - this.ip = ip; - } - public String getOpName() { - return opName; - } - public void setOpName(String opName) { - this.opName = opName; - } - public String getOpUserName() { - return opUserName; - } - public void setOpUserName(String opUserName) { - this.opUserName = opUserName; - } - public String getOrganName() { - return organName; - } - public void setOrganName(String organName) { - this.organName = organName; - } - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/logger/model/request/LoggerParam.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/logger/model/request/LoggerParam.java deleted file mode 100644 index b8ad8c1..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/logger/model/request/LoggerParam.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.risk.riskmanage.logger.model.request; - -import com.risk.riskmanage.common.model.BaseParam; -import lombok.Data; - -@Data -public class LoggerParam extends BaseParam { - - private String searchKey; - private String startDate; - private String endDate; -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/logger/service/LogService.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/logger/service/LogService.java deleted file mode 100644 index d37e3d0..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/logger/service/LogService.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.risk.riskmanage.logger.service; - -import com.risk.riskmanage.logger.model.Logger; - -import java.util.Date; -import java.util.List; -import java.util.Map; -/** - * ClassName:LogService
- * Description:日志接口 - * */ -public interface LogService { - - /** - * getLogList :(获取日志集合) - * - * @param param 参数集合 - * @return - * */ - public List getLogList(Map param); - - - /** - * findById :(根据id获取日志) - * - * @param id 日志记录id - * @return - * */ - public Logger findById(Long id); - - /** - * 查询最后登录时间 - * @param userId - * @return - */ - public List getLastLoginInfo(Long userId); - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/logger/service/impl/LogServiceImpl.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/logger/service/impl/LogServiceImpl.java deleted file mode 100644 index df19ed1..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/logger/service/impl/LogServiceImpl.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.risk.riskmanage.logger.service.impl; - -import com.risk.riskmanage.common.basefactory.BaseService; -import com.risk.riskmanage.logger.model.Logger; -import com.risk.riskmanage.logger.service.LogService; -import org.springframework.stereotype.Service; - -import java.util.Date; -import java.util.List; -import java.util.Map; -/** - * ClassName:LogService
- * Description:日志接口实现 - * */ -@Service -public class LogServiceImpl extends BaseService implements LogService{ - - @Override - public List getLogList(Map param) { - // TODO Auto-generated method stub - return loggerMapper.getLogList(param); - } - - @Override - public Logger findById(Long id) { - // TODO Auto-generated method stub - return loggerMapper.selectByPrimaryKey(id); - } - - @Override - public List getLastLoginInfo(Long userId) { - return loggerMapper.getLastLoginInfo(userId); - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/redis/RedisManager.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/redis/RedisManager.java deleted file mode 100644 index 940fac9..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/redis/RedisManager.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.risk.riskmanage.redis; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import redis.clients.jedis.Jedis; -import redis.clients.jedis.JedisPool; - -@Component -public class RedisManager { - // 0-表示永远不过期 - private int expire = 0; - - @Autowired - private JedisPool jedisPool; - - public RedisManager() {} - - /** - * @Title: init - * @Description: 初始化方法,用来初始化 - * @param 设定文件 - * @return void 返回类型 - * @throws - */ - public void init() { - } - - /** - * @Title: get - * @Description: 根据key来获得一条特定的缓存数据 - * @param @param key string类型的key - * @param @return 设定文件 - * @return String 返回类型 - * @throws - */ - public String get(String key) { - String value = null; - Jedis jedis = jedisPool.getResource(); - try { - value = jedis.get(key); - } catch (Exception e) { - //释放redis对象 - jedisPool.returnBrokenResource(jedis); - e.printStackTrace(); - } finally { - //返还到连接池 - if (jedis != null) { - jedisPool.returnResource(jedis); - } - } - return value; - } - - /** - * @Title: set - * @Description: 向redis数据库中缓存数据,key,value都为字符串的类型 - * @param @param key - * @param @param value - * @param @param expire 0为永不过期,其他时间则会设置对应的过期时间 - * @param @return 设定文件 - * @return String 返回类型 - * @throws - */ - public String set(String key, String value, int expire) { - Jedis jedis = jedisPool.getResource(); - try { - jedis.set(key, value); - if (expire != 0) { - jedis.expire(key, expire); - } - } catch (Exception e) { - //释放redis对象 - jedisPool.returnBrokenResource(jedis); - e.printStackTrace(); - } finally { - //返还到连接池 - if (jedis != null) { - jedisPool.returnResource(jedis); - } - } - return value; - } - - /** - * @Title: del - * @Description: 根据特定的string类型的key来删除redis数据库中的缓存数据 - * @param @param key 设定文件 - * @return void 返回类型 - * @throws - */ - public void del(String key) { - Jedis jedis = jedisPool.getResource(); - try { - jedis.del(key); - } finally { - if (jedis != null) { - jedis.close(); - } - } - } - - /** - * 获取key的剩余过期时间,单位秒 - * @param key - * @return - */ - public Long ttl(String key) { - Long value = null; - Jedis jedis = jedisPool.getResource(); - try { - value = jedis.ttl(key); - } catch (Exception e) { - //释放redis对象 - jedisPool.returnBrokenResource(jedis); - e.printStackTrace(); - } finally { - //返还到连接池 - if (jedis != null) { - jedisPool.returnResource(jedis); - } - } - return value; - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/consts/RuleConditionConst.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/consts/RuleConditionConst.java deleted file mode 100644 index 7242f46..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/consts/RuleConditionConst.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.risk.riskmanage.rule.consts; - -public class RuleConditionConst { - - public static final long DEFAULT_CONDITION_PARENT_ID = 0;//根节点父ID - public static final int RELATION_CONDITION_TYPE = 1;//关系节点类型 - public static final int EXPRESSION_CONDITION_TYPE = 2;//表达式节点类型 - - public static final String LOOP_RULE_LOGICAL = "for";//循环规则的逻辑符号 - public static final int LOOP_RULE_ROOT = 3;//循环规则的根节点 - public static final int LOOP_RULE_RESULT_CONDITION = 4;//循环规则的结果条件 - - public static final String CONDITION_GROUP_LOGICAL = "condGroup";//循环规则的逻辑符号 - public static final int CONDITION_GROUP_ROOT = 5;//循环规则的根节点 - public static final int CONDITION_GROUP_RESULT_CONDITION = 6;//循环规则的结果条件 - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/consts/RuleConst.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/consts/RuleConst.java deleted file mode 100644 index 40aa495..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/consts/RuleConst.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.risk.riskmanage.rule.consts; - -public class RuleConst { - public static final int STATUS_ENABLED = 1;//启用状态,默认 - public static final int STATUS_DEAD = 0;//停用状态 - public static final int STATUS_DELETE = -1;//删除状态 - - - public static final int TYPE_SYSTEM = 0;//系统规则 - public static final int TYPE_ORGAN = 1;//组织规则,默认 - public static final int TYPE_ENGINE = 2;//引擎规则 - - public static final int RULE_TYPE_TERMINATION = 0;//终止 - public static final int RULE_TYPE_SCORING = 1;//计分 - - public static final int RULE_AUDIT_TERMINATION = 2;//终止 - public static final int RULE_AUDIT_SCORING = 5;//继续 - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/consts/RuleRunnerConst.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/consts/RuleRunnerConst.java deleted file mode 100644 index 4a29e58..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/consts/RuleRunnerConst.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.risk.riskmanage.rule.consts; - -import java.util.Map; - -public class RuleRunnerConst { - public static final String RULE_FILE_HEAD = " package com.baoying.enginex.executor.drools \\r\\n" + - " import java.util.Map;\\r\\n" + - " import java.util.List;\\r\\n" + - " import java.util.ArrayList;\\r\\n" + - " import java.util.HashMap;\\r\\n" + - " import com.baoying.enginex.executor.engineModel.model.InputParam;\\r\\n" + - " import com.baoying.enginex.executor.engineModel.model.Result;\\r\\n" + - " import com.baoying.enginex.executor.engineModel.model.EngineRule;\\r\\n"; - public static final String RULE_NAME_PREFIX = " rule \t"; - public static final String RULE_SALIENCE_PREFIX = "\\r\\n salience\\t "; - public static final String RULE_CONDITION_PREFIX = "\\r\\n when \\r\\n"; - public static final String CONDITION_DETAIL_PREFIX = "\\t $inputParam : InputParam();\\r\\n Map"; - public static final String CONDITION_DETAIL_SUFFIX = " \t from $inputParam.inputParam;\\r\\n"; - public static final String RULE_DISPOSE_PREFIX = "\\t then \\r\\n"; - public static final String DISPOSE_PREFIX = - "\\t List resultList =$inputParam.getResult();\\r\\n" + - "\\t Result result =new Result(); \\r\\n" + - "\\t result.setResultType(\""; - public static final String DISPOSE_INFIX = "\"); \\r\\n" + - "\\t result.setVersionCode(\""; - public static final String DISPOSE_SUFFIX = "\"); \\r\\n" + - "\\t Map map =new HashMap<>(); \\r\\n"; - - public static final String SCORE_PREFIX = "\\t map.put(\"score\","; - public static final String SCORE_SUFFIX = "); \\r\\n"; - - public static final String RULE_END = "\\t result.setMap(map); \\r\\n" + - " resultList.add(result); \\r\\n" + - "\\t $inputParam.setResult(resultList); \\r\\n" + - " end\\r\\n"; - - public static final int DEFAULT_TYPE = 1; - - //拼装规则执行的content - public static String fitRuleContent(String code, Integer salience, String rule, Integer type, Integer score, Map contentMap) { - String content = ""; - if (salience == null || salience < 0) { - salience = 0; - } - if (type == null) { - type = DEFAULT_TYPE; - } - content += RULE_FILE_HEAD + - RULE_NAME_PREFIX + code + - RULE_SALIENCE_PREFIX + salience + - RULE_CONDITION_PREFIX + - CONDITION_DETAIL_PREFIX + rule + - CONDITION_DETAIL_SUFFIX + - RULE_DISPOSE_PREFIX + - DISPOSE_PREFIX + type + - DISPOSE_INFIX + code+ - DISPOSE_SUFFIX; - if (score!=null){ - content += SCORE_PREFIX+score+SCORE_SUFFIX; - } - - if (contentMap!=null&&!contentMap.isEmpty()){ - for (String s : contentMap.keySet()) { - content+="\\t\\t map.put(\""+s+"\",\""+contentMap.get(s)+"\");\\n"; - } - - } - content += RULE_END; - - return content; - } - -// public static void main(String[] args) { -// String versionCode = "rule1"; -// Integer salience = null; -// String rule = "age>10"; -// Integer type = null; -// Integer score = 10; -// Map contentMap = new HashMap<>(); -// contentMap.put("a","a"); -// contentMap.put("b","b"); -// contentMap.put("c","c"); -// String s = fitContent(versionCode, salience, rule, type, score,contentMap); -// System.out.println(s); -// } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/controller/RuleInfoController.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/controller/RuleInfoController.java deleted file mode 100644 index b6e4aa2..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/controller/RuleInfoController.java +++ /dev/null @@ -1,265 +0,0 @@ -package com.risk.riskmanage.rule.controller; - -import com.github.pagehelper.PageInfo; -import com.risk.riskmanage.common.constants.OpTypeConst; -import com.risk.riskmanage.common.enums.ErrorCodeEnum; -import com.risk.riskmanage.common.exception.ApiException; -import com.risk.riskmanage.common.model.ResponseEntityDto; -import com.risk.riskmanage.common.model.requestParam.UpdateStatusParam; -import com.risk.riskmanage.common.utils.ResponseEntityBuilder; -import com.risk.riskmanage.knowledge.model.response.UploadResponse; -import com.risk.riskmanage.logger.ArchivesLog; -import com.risk.riskmanage.rule.model.request.RuleListParamV2; -import com.risk.riskmanage.common.model.requestParam.UpdateFolderParam; -import com.risk.riskmanage.rule.model.vo.RuleVo; -import com.risk.riskmanage.rule.service.RuleService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.commons.CommonsMultipartResolver; - -import javax.servlet.http.HttpServletRequest; -import java.util.HashMap; - - -@Controller("ruleControllerV3") -@RequestMapping("v3/rule") -public class RuleInfoController { - - @Autowired - private RuleService ruleService; - - - /** - * @api {POST} /v3/rule/getRuleInfo/{id} 3.19. V3获取rule信息 - * @apiGroup knowledge - * @apiVersion 2.0.0 - * @apiParam {Long} id : 规则id - * @apiSuccess {String} status 状态:1成功,0失败 - * @apiParamExample {json} 请求示例: - * {} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":{"id":666,"name":"2021_4_6测试接口","versionCode":"test2021_4_6第二次输入","description":"接口测试","priority":0,"parentId":0,"author":135,"userId":135,"organId":46,"engineId":null,"status":1,"type":1,"isNon":null,"content":"test","created":"2021-04-06T08:38:17.000+00:00","updated":"2021-04-07T05:12:52.000+00:00","ruleType":0,"ruleAudit":2,"score":0,"lastLogical":"","ruleConditionVo":{"id":14,"logical":"&&","fieldId":null,"operator":null,"fieldValue":null,"ruleId":666,"parentId":0,"conditionType":1,"createTime":"2021-04-06T08:38:26.000+00:00","updateTime":null,"insertTempId":null,"children":[{"id":15,"logical":null,"fieldId":null,"operator":">","fieldValue":"1000","ruleId":666,"parentId":14,"conditionType":1,"createTime":"2021-04-06T08:38:26.000+00:00","updateTime":null,"insertTempId":null,"children":[],"tempParentId":null},{"id":16,"logical":null,"fieldId":null,"operator":"<","fieldValue":"10000","ruleId":666,"parentId":14,"conditionType":1,"createTime":"2021-04-06T08:38:26.000+00:00","updateTime":null,"insertTempId":null,"children":[],"tempParentId":null}],"tempParentId":null},"ruleContentInfoList":[{"id":16,"fieldId":10000,"fieldValue":"test01","ruleId":666},{"id":17,"fieldId":10000,"fieldValue":"test02","ruleId":666}]}} - */ - @ResponseBody - @RequestMapping(value = "getRuleInfo/{id}", method = RequestMethod.POST) - public ResponseEntityDto getRuleInfo(@PathVariable Long id) { - if (id == null) { - throw new ApiException(ErrorCodeEnum.PARAMS_EXCEPTION.getCode(), ErrorCodeEnum.PARAMS_EXCEPTION.getMessage()); - } - RuleVo ruleVo = ruleService.queryById(id,2); - ResponseEntityDto ruleResponseEntityDto = ResponseEntityBuilder.buildNormalResponse(ruleVo); - return ruleResponseEntityDto; - } - - - /** - * @api {POST} /v3/rule/getRuleList 3.20. V3规则 列表 list - * @apiGroup knowledge - * @apiVersion 2.0.0 - * @apiParam {Integer} [pageNum] 第几页,有默认值1 - * @apiParam {Integer} [pageSize] 每页的数量,有默认值10 - * @apiParam {object} [ruleInfo] 查询条件rule对象(不加查询条件则返回全部,以下参数未此对象的字段) - * @apiParam (ruleInfo) {Long} [id] rule的id - * @apiParam (ruleInfo) {String} [name] rule的名字 - * @apiParam (ruleInfo) {String} [versionCode] rule的代码 - * @apiParam (ruleInfo) {String} [description] rule的描述信息 - * @apiParam (ruleInfo) {Integer} [priority] 优先级 - * @apiParam (ruleInfo) {String} [parentId] 父节点id(文件夹id) - * @apiParam (ruleInfo) {Integer} [priority] 优先级 - * @apiParam (ruleInfo) {Long} [author] 用户id - * @apiParam (ruleInfo) {Long} [userId] 用户id - * @apiParam (ruleInfo) {Long} [organId] 组织id - * @apiParam (ruleInfo) {Integer} [engineId] 引擎id(原表内容未用到) - * @apiParam (ruleInfo) {Integer} [status] 状态id(0 :停用 ,1 : 启用,-1:删除) - * @apiParam (ruleInfo) {Integer} [type] 规则类型(0 : 系统的规则 1:组织的规则 2: 引擎的规则) - * @apiParam (ruleInfo) {Integer} [isNon] 逻辑关系“非”,0:否 ,1:是 - * @apiParam (ruleInfo) {String} [content] 规则执行内容 - * @apiParam (ruleInfo) {Integer} [ruleType] 规则类型(0硬性拒绝规则,1加减分规则) - * @apiParam (ruleInfo) {Integer} [ruleAudit] 规则审核(2 终止,5 继续) - * @apiParam (ruleInfo) {Integer} [score] 规则得分 - * @apiParam (ruleInfo) {String} [lastLogical] 最后逻辑(原表内容未用到) - * @apiSuccess {String} status 状态: 1成功, 0失败 - * @apiParamExample {json} 请求示例: - * {"pageNum":1,"pageSize":10,"ruleInfo":{"id":666,"name":"2021_4_6测试接口","versionCode":"test2021_4_6第二次输入","description":"接口测试","priority":0,"parentId":0,"author":135,"userId":135,"organId":46,"engineId":null,"status":1,"type":1,"isNon":null,"content":"test","created":"2021-04-06T08:38:17.000+00:00","updated":"2021-04-06T09:07:27.000+00:00","ruleType":0,"ruleAudit":2,"score":0,"lastLogical":""}} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":{"id":666,"name":"2021_4_6测试接口","versionCode":"test2021_4_6第二次输入","description":"接口测试","priority":0,"parentId":0,"author":135,"userId":135,"organId":46,"engineId":null,"status":1,"type":1,"isNon":null,"content":"test","created":"2021-04-06T08:38:17.000+00:00","updated":"2021-04-07T05:12:52.000+00:00","ruleType":0,"ruleAudit":2,"score":0,"lastLogical":"","ruleConditionVo":{"id":14,"logical":"&&","fieldId":null,"operator":null,"fieldValue":null,"ruleId":666,"parentId":0,"conditionType":1,"createTime":"2021-04-06T08:38:26.000+00:00","updateTime":null,"insertTempId":null,"children":[{"id":15,"logical":null,"fieldId":null,"operator":">","fieldValue":"1000","ruleId":666,"parentId":14,"conditionType":0,"createTime":"2021-04-06T08:38:26.000+00:00","updateTime":null,"insertTempId":null,"children":[],"tempParentId":null},{"id":16,"logical":null,"fieldId":null,"operator":"<","fieldValue":"10000","ruleId":666,"parentId":14,"conditionType":0,"createTime":"2021-04-06T08:38:26.000+00:00","updateTime":null,"insertTempId":null,"children":[],"tempParentId":null},{"id":14,"logical":"&&","fieldId":null,"operator":null,"fieldValue":null,"ruleId":666,"parentId":0,"conditionType":1,"createTime":"2021-04-06T08:38:26.000+00:00","updateTime":null,"insertTempId":null,"children":[{"id":14,"logical":"&&","fieldId":null,"operator":null,"fieldValue":null,"ruleId":666,"parentId":0,"conditionType":1,"createTime":"2021-04-06T08:38:26.000+00:00","updateTime":null,"insertTempId":null,"children":[{"id":15,"logical":null,"fieldId":null,"operator":">","fieldValue":"1000","ruleId":666,"parentId":14,"conditionType":0,"createTime":"2021-04-06T08:38:26.000+00:00","updateTime":null,"insertTempId":null,"children":[],"tempParentId":null},{"id":16,"logical":null,"fieldId":null,"operator":"<","fieldValue":"10000","ruleId":666,"parentId":14,"conditionType":0,"createTime":"2021-04-06T08:38:26.000+00:00","updateTime":null,"insertTempId":null,"children":[],"tempParentId":null}],"tempParentId":null},{"id":15,"logical":null,"fieldId":null,"operator":">","fieldValue":"1000","ruleId":666,"parentId":14,"conditionType":0,"createTime":"2021-04-06T08:38:26.000+00:00","updateTime":null,"insertTempId":null,"children":[],"tempParentId":null},{"id":16,"logical":null,"fieldId":null,"operator":"<","fieldValue":"10000","ruleId":666,"parentId":14,"conditionType":0,"createTime":"2021-04-06T08:38:26.000+00:00","updateTime":null,"insertTempId":null,"children":[],"tempParentId":null}],"tempParentId":null},{"id":14,"logical":"&&","fieldId":null,"operator":null,"fieldValue":null,"ruleId":666,"parentId":0,"conditionType":1,"createTime":"2021-04-06T08:38:26.000+00:00","updateTime":null,"insertTempId":null,"children":[],"tempParentId":null}],"tempParentId":null},"ruleContentInfoList":[{"id":16,"fieldId":10000,"fieldValue":"test01","ruleId":666},{"id":17,"fieldId":10000,"fieldValue":"test02","ruleId":666}]}} - */ - @ResponseBody - @RequestMapping(value = "getRuleList", method = RequestMethod.POST) - public ResponseEntityDto getRuleList(@RequestBody RuleListParamV2 ruleListParam) { - PageInfo pageInfo = ruleService.queryByEntity(ruleListParam); - HashMap responseMap = new HashMap<>(); - responseMap.put("pageInfo", pageInfo); - responseMap.put("klist", pageInfo.getList()); - pageInfo.setList(null); - ResponseEntityDto ruleResponseEntityDto = ResponseEntityBuilder.buildNormalResponse(responseMap); - return ruleResponseEntityDto; - } - - /** - * @api {POST} /v3/rule/addRule 3.21. V3添加规则 - * @apiGroup knowledge - * @apiVersion 2.0.0 - * @apiParam {String} name rule的名字 - * @apiParam {String} versionCode rule的代码 - * @apiParam {String} description rule的描述信息 - * @apiParam {Integer} priority 优先级 - * @apiParam {String} parentId 父节点id(文件夹id) - * @apiParam {Integer} [status] 状态id(0 :停用 ,1 : 启用,-1:删除)默认启用 - * @apiParam {Integer} [type] 规则类型(0 : 系统的规则 1:组织的规则 2: 引擎的规则)默认组织规则 - * @apiParam {Integer} [isNon] 逻辑关系“非”,0:否 ,1:是 - * @apiParam {String} [content] 规则执行内容 - * @apiParam {Integer} ruleType 规则类型(0硬性拒绝规则,1加减分规则) - * @apiParam {Integer} [ruleAudit] 规则审核(2 终止,5 继续)根据ruleType推定拒绝规则为终止 - * @apiParam {Integer} [score] 规则得分 - * @apiParam {String} [lastLogical] 最后逻辑(原表内容未用到) - * @apiParam {object} [ruleConditionVo] 规则对应的一颗规则条件的树形对象 - * @apiParam (ruleConditionVo) {String} logical 逻辑符号&&、||(仅关系表达式) - * @apiParam (ruleConditionVo) {Long} fieldId 字段id(仅条件表达式) - * @apiParam (ruleConditionVo) {String} operator 操作符(仅条件表达式) - * @apiParam (ruleConditionVo) {String} fieldValue 字段值(仅条件表达式) - * @apiParam (ruleConditionVo) {Integer} conditionType 条件类型1.关系表达式,2.条件表达式 - * @apiParam (ruleConditionVo) {List} [children] 子对象列表,和所属对象相同 - * @apiParam {List} [ruleContentInfoList] 同一规则下的content对象list - * @apiParam (ruleContentInfoList) {Long} [fieldId] 字段id - * @apiParam (ruleContentInfoList) {String} [fieldValue] 字段值 - * @apiSuccess {String} status 状态: 1成功, 0失败 - * @apiParamExample {json} 请求示例: - * {"name":"2021_4_6测试接口02","versionCode":"test2021_4_7","description":"接口测试","priority":0,"parentId":0,"author":135,"userId":135,"organId":46,"status":1,"type":1,"isNon":null,"content":"test","ruleType":0,"ruleAudit":2,"score":0,"lastLogical":"","ruleConditionVo":{"logical":"&&","conditionType":"1","children":[{"fieldId":"0","operator":">","fieldValue":"10","conditionType":"1"},{"fieldId":"0","operator":"<","fieldValue":"100","conditionType":"1"}]},"ruleContentInfoList":[{"fieldId":"10000","fieldValue":"test1"},{"fieldId":"10000","fieldValue":"test2"}]} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":{"id":668,"name":"2021_4_6测试接口02","versionCode":"test2021_4_7","description":"接口测试","priority":0,"parentId":0,"author":135,"userId":135,"organId":46,"engineId":null,"status":1,"type":1,"isNon":null,"content":"test","created":null,"updated":null,"ruleType":0,"ruleAudit":2,"score":0,"lastLogical":"","ruleConditionVo":{"id":17,"logical":"&&","fieldId":null,"operator":null,"fieldValue":null,"ruleId":668,"parentId":0,"conditionType":1,"createTime":"2021-04-07T08:09:17.000+00:00","updateTime":null,"insertTempId":null,"children":[{"id":18,"logical":null,"fieldId":null,"operator":">","fieldValue":"10","ruleId":668,"parentId":17,"conditionType":1,"createTime":"2021-04-07T08:09:17.000+00:00","updateTime":null,"insertTempId":null,"children":[],"tempParentId":null},{"id":19,"logical":null,"fieldId":null,"operator":"<","fieldValue":"100","ruleId":668,"parentId":17,"conditionType":1,"createTime":"2021-04-07T08:09:17.000+00:00","updateTime":null,"insertTempId":null,"children":[],"tempParentId":null}],"tempParentId":null},"ruleContentInfoList":[{"id":18,"fieldId":10000,"fieldValue":"test1","ruleId":668},{"id":19,"fieldId":10000,"fieldValue":"test2","ruleId":668}]}} - */ - @ResponseBody - @RequestMapping(value = "addRule", method = RequestMethod.POST) - @ArchivesLog(operationType = OpTypeConst.SAVE_RULE) - public ResponseEntityDto addRule(@RequestBody RuleVo ruleVo) { - RuleVo insert = ruleService.insertRuleInfo(ruleVo); - ResponseEntityDto ruleResponseEntityDto = ResponseEntityBuilder.buildNormalResponse(insert); - return ruleResponseEntityDto; - } - - /** - * @api {POST} /v3/rule/updateRule 3.22. V3修改规则 - * @apiGroup knowledge - * @apiVersion 2.0.0 - * @apiParam {Long} id rule的id - * @apiParam {String} name rule的名字 - * @apiParam {String} versionCode rule的代码 - * @apiParam {String} description rule的描述信息 - * @apiParam {Integer} priority 优先级 - * @apiParam {String} parentId 父节点id(文件夹id) - * @apiParam {Long} author 用户id - * @apiParam {Long} userId 用户id - * @apiParam {Long} organId 组织id - * @apiParam {Integer} [engineId] 引擎id(原表内容未用到) - * @apiParam {Integer} status 状态id(0 :停用 ,1 : 启用,-1:删除) - * @apiParam {Integer} type 规则类型(0 : 系统的规则 1:组织的规则 2: 引擎的规则) - * @apiParam {Integer} [isNon] 逻辑关系“非”,0:否 ,1:是 - * @apiParam {String} [content] 规则执行内容 - * @apiParam {Integer} ruleType 规则类型(0硬性拒绝规则,1加减分规则) - * @apiParam {Integer} [ruleAudit] 规则审核(2 终止,5 继续)根据ruleType推定拒绝规则为终止 - * @apiParam {Integer} [score] 规则得分 - * @apiParam {String} [lastLogical] 最后逻辑(原表内容未用到) - * @apiParam {object} [ruleConditionVo] 规则对应的一颗规则条件的树形对象 - * @apiParam (ruleConditionVo) {Long} [id] 条件id - * @apiParam (ruleConditionVo) {String} logical 逻辑符号&&、||(仅关系表达式) - * @apiParam (ruleConditionVo) {Long} fieldId 字段id(仅条件表达式) - * @apiParam (ruleConditionVo) {String} operator 操作符(仅条件表达式) - * @apiParam (ruleConditionVo) {String} fieldValue 字段值(仅条件表达式) - * @apiParam (ruleConditionVo) {Long} [ruleId] 规则id - * @apiParam (ruleConditionVo) {Long} [parentId] 条件父节点id - * @apiParam (ruleConditionVo) {Integer} conditionType 条件类型1.关系表达式,2.条件表达式 - * @apiParam (ruleConditionVo) {List} [children] 子对象列表,和所属对象相同 - * @apiParam {List} [ruleContentInfoList] 同一规则下的content对象list - * @apiParam (ruleContentInfoList) {Long} [id] content主键id - * @apiParam (ruleContentInfoList) {Long} fieldId 字段id - * @apiParam (ruleContentInfoList) {String} fieldValue 字段值 - * @apiParam (ruleContentInfoList) {Long} [ruleId] 规则id - * @apiSuccess {String} status 状态: 1成功, 0失败 - * @apiParamExample {json} 请求示例: - * {"id":667,"name":"2021_4_7测试接口","versionCode":"test2021_4_7第二次输入","description":"接口测试","priority":0,"parentId":0,"author":135,"userId":135,"organId":46,"engineId":null,"status":1,"type":1,"isNon":null,"content":"test","created":"2021-04-06T08:38:17.000+00:00","updated":null,"ruleType":0,"ruleAudit":2,"score":0,"lastLogical":"","ruleConditionVo":{"id":5,"logical":"&&","fieldId":null,"operator":null,"fieldValue":null,"ruleId":666,"parentId":0,"conditionType":1,"createTime":"2021-04-06T08:38:26.000+00:00","updateTime":null,"insertTempId":null,"children":[{"id":6,"logical":null,"fieldId":0,"operator":">","fieldValue":"1000","ruleId":666,"parentId":5,"conditionType":1,"createTime":"2021-04-06T08:38:26.000+00:00","updateTime":null,"insertTempId":null,"children":[],"tempParentId":null},{"id":7,"logical":null,"fieldId":0,"operator":"<","fieldValue":"10000","ruleId":666,"parentId":5,"conditionType":1,"createTime":"2021-04-06T08:38:26.000+00:00","updateTime":null,"insertTempId":null,"children":[],"tempParentId":null}],"tempParentId":null},"ruleContentInfoList":[{"id":10,"fieldId":"10000","fieldValue":"test01","ruleId":666},{"id":11,"fieldId":"10000","fieldValue":"test02","ruleId":666}]} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":{"id":667,"name":"2021_4_7测试接口","versionCode":"test2021_4_7第二次输入","description":"接口测试","priority":0,"parentId":0,"author":135,"userId":135,"organId":46,"engineId":null,"status":1,"type":1,"isNon":null,"content":"test","created":"2021-04-06T08:38:17.000+00:00","updated":null,"ruleType":0,"ruleAudit":2,"score":0,"lastLogical":"","ruleConditionVo":{"id":20,"logical":"&&","fieldId":null,"operator":null,"fieldValue":null,"ruleId":667,"parentId":0,"conditionType":1,"createTime":"2021-04-06T08:38:26.000+00:00","updateTime":null,"insertTempId":null,"children":[{"id":21,"logical":null,"fieldId":null,"operator":">","fieldValue":"1000","ruleId":667,"parentId":20,"conditionType":1,"createTime":"2021-04-06T08:38:26.000+00:00","updateTime":null,"insertTempId":null,"children":[],"tempParentId":null},{"id":22,"logical":null,"fieldId":null,"operator":"<","fieldValue":"10000","ruleId":667,"parentId":20,"conditionType":1,"createTime":"2021-04-06T08:38:26.000+00:00","updateTime":null,"insertTempId":null,"children":[],"tempParentId":null}],"tempParentId":null},"ruleContentInfoList":[{"id":20,"fieldId":10000,"fieldValue":"test01","ruleId":667},{"id":21,"fieldId":10000,"fieldValue":"test02","ruleId":667}]}} - */ - @ResponseBody - @RequestMapping(value = "updateRule", method = RequestMethod.POST) - @ArchivesLog(operationType = OpTypeConst.UPDATE_RULE) - public ResponseEntityDto updateRule(@RequestBody RuleVo rule) { - RuleVo update = ruleService.updateRuleInfo(rule); - ResponseEntityDto ruleResponseEntityDto = ResponseEntityBuilder.buildNormalResponse(update); - return ruleResponseEntityDto; - } - - /** - * @api {POST} /v3/rule/updateRuleStatus 3.23. V3修改状态 - * @apiGroup knowledge - * @apiVersion 2.0.0 - * @apiParam {LongArray} ids 规则id数组 - * @apiParam {Integer} status 目标状态:0未启用,1启用,2删除 - * @apiSuccess {String} status 状态:1成功,0失败 - * @apiParamExample {json} 请求示例: - * {"ids":[666,667],"status":"1"} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":true} - */ - @ResponseBody - @RequestMapping(value = "updateRuleStatus", method = RequestMethod.POST) - @ArchivesLog(operationType = OpTypeConst.UPDATE_RULE_STATUS) - public ResponseEntityDto updateStatus(@RequestBody UpdateStatusParam param) { - UpdateStatusParam.checkParam(param); - boolean updateResult = ruleService.updateStatus(param.getList(), param.getStatus()); - if (updateResult) { - return ResponseEntityBuilder.buildNormalResponse(updateResult); - } else { - return ResponseEntityBuilder.buildErrorResponse(ErrorCodeEnum.SERVER_ERROR); - } - - } - - @ResponseBody - @RequestMapping(value = "updateRuleParent", method = RequestMethod.POST) - @ArchivesLog(operationType = OpTypeConst.UPDATE_RULE_STATUS) - public ResponseEntityDto updateParent(@RequestBody UpdateFolderParam param) { - UpdateFolderParam.checkNotNull(param); - boolean updateResult = ruleService.updateParent(param.getIds(), param.getFolderId()); - if (updateResult) { - return ResponseEntityBuilder.buildNormalResponse(updateResult); - } else { - return ResponseEntityBuilder.buildErrorResponse(ErrorCodeEnum.SERVER_ERROR); - } - } - - // 查询简单规则 - @ResponseBody - @RequestMapping(value = "getSimpleRule/{id}", method = RequestMethod.POST) -// @ArchivesLog(operationType = OpTypeConst.SELECT_SAMPLE_RULE) - public ResponseEntityDto getSimpleRule(@PathVariable Long id) { - if (id == null) { - throw new ApiException(ErrorCodeEnum.PARAMS_EXCEPTION.getCode(), ErrorCodeEnum.PARAMS_EXCEPTION.getMessage()); - } - RuleVo ruleVo = ruleService.queryById(id,1); - ResponseEntityDto ruleResponseEntityDto = ResponseEntityBuilder.buildNormalResponse(ruleVo); - return ruleResponseEntityDto; - } - @ResponseBody - @RequestMapping(value = "upload", method = RequestMethod.POST) - public ResponseEntityDto upload(HttpServletRequest request)throws Exception{ - CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver(request.getSession().getServletContext()); - if (!multipartResolver.isMultipart(request)) { - return ResponseEntityBuilder.buildErrorResponse(ErrorCodeEnum.RULE_UPLOAD_ERROR); - } - UploadResponse upload = ruleService.upload(request); - return ResponseEntityBuilder.buildNormalResponse(upload); - } - @ResponseBody - @RequestMapping(value = "getScriptRule/{id}", method = RequestMethod.POST) - public ResponseEntityDto getScriptRule(@PathVariable Long id) { - if (id == null) { - throw new ApiException(ErrorCodeEnum.PARAMS_EXCEPTION.getCode(), ErrorCodeEnum.PARAMS_EXCEPTION.getMessage()); - } - RuleVo ruleVo = ruleService.queryById(id,3); - ResponseEntityDto ruleResponseEntityDto = ResponseEntityBuilder.buildNormalResponse(ruleVo); - return ruleResponseEntityDto; - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/controller/RuleVersionController.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/controller/RuleVersionController.java deleted file mode 100644 index 0b3c691..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/controller/RuleVersionController.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.risk.riskmanage.rule.controller; - -import com.risk.riskmanage.common.constants.OpTypeConst; -import com.risk.riskmanage.common.enums.ErrorCodeEnum; -import com.risk.riskmanage.common.model.ResponseEntityDto; -import com.risk.riskmanage.common.model.requestParam.StatusParam; -import com.risk.riskmanage.common.utils.ResponseEntityBuilder; -import com.risk.riskmanage.logger.ArchivesLog; -import com.risk.riskmanage.rule.model.vo.RuleVersionVo; -import com.risk.riskmanage.rule.service.RuleVersionService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -@Controller -@ResponseBody -@RequestMapping("/v3/ruleVersion") -public class RuleVersionController { - - @Autowired - private RuleVersionService versionService; - /** - * 查询指定版本下的内容 - * @param versionId - * @return - */ - @PostMapping("/getRuleVersionInfo/{versionId}") - public ResponseEntityDto getRuleVersionInfo(@PathVariable Long versionId) { - RuleVersionVo version =versionService.queryById(versionId); - return ResponseEntityBuilder.buildNormalResponse(version); - } - - /** - * 新增一个版本 - * @param version - * @return - */ - @PostMapping("/addRuleVersion") -// @ArchivesLog(operationType = OpTypeConst.SAVE_RULE_VERSION) - public ResponseEntityDto addRuleVersion(@RequestBody RuleVersionVo version){ - boolean b = versionService.addVersion(version); - if (!b){ - return ResponseEntityBuilder.buildErrorResponse(ErrorCodeEnum.PARAMS_EXCEPTION); - } - List< RuleVersionVo> ruleVersionList = versionService.queryVersionListByRuleId(version.getRuleId()); - return ResponseEntityBuilder.buildNormalResponse(ruleVersionList); - } - - /** - * 复制版本 - * @param version - * @return - */ - @PostMapping("/copyRuleVersion") -// @ArchivesLog(operationType = OpTypeConst.COPY_RULE_VERSION) - public ResponseEntityDto copyRuleVersion(@RequestBody RuleVersionVo version){ - boolean b = versionService.copyVersion(version); - List< RuleVersionVo> ruleVersionList = versionService.queryVersionListByRuleId(version.getRuleId()); - return ResponseEntityBuilder.buildNormalResponse(ruleVersionList); - } - - /** - * 修改版本 - * @param version - * @return - */ - @PostMapping("/updateRuleVersion") -// @ArchivesLog(operationType = OpTypeConst.UPDATE_RULE_VERSION) - public ResponseEntityDto updateRuleVersion(@RequestBody RuleVersionVo version){ - boolean b = versionService.updateVersion(version); - List ruleVersionList = versionService.queryVersionListByRuleId(version.getRuleId()); - return ResponseEntityBuilder.buildNormalResponse(ruleVersionList); - } - - /** - * 修改状态 - * @param statusParam - * @return - */ - @RequestMapping(value = "/updateRuleVersionStatus", method = RequestMethod.POST) -// @ArchivesLog(operationType = OpTypeConst.UPDATE_RULE_VERSION_STATUS) - public ResponseEntityDto updateStatus(@RequestBody StatusParam statusParam) { - versionService.updateStatus(statusParam); - List ruleVersionList = versionService.queryVersionListByRuleId(statusParam.getTacticsId()); - return ResponseEntityBuilder.buildNormalResponse(ruleVersionList); - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/mapper/RuleConditionInfoMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/mapper/RuleConditionInfoMapper.java deleted file mode 100644 index 8627b4e..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/mapper/RuleConditionInfoMapper.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.risk.riskmanage.rule.mapper; - - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.risk.riskmanage.rule.model.RuleConditionInfo; -import org.apache.ibatis.annotations.Mapper; - -/** - * (RuleConditionInfo)表数据库访问层 - */ -@Mapper -public interface RuleConditionInfoMapper extends BaseMapper { - -} - diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/mapper/RuleFieldInfoMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/mapper/RuleFieldInfoMapper.java deleted file mode 100644 index 7328f05..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/mapper/RuleFieldInfoMapper.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.risk.riskmanage.rule.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.risk.riskmanage.rule.model.RuleFieldInfo; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface RuleFieldInfoMapper extends BaseMapper { -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/mapper/RuleInfoMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/mapper/RuleInfoMapper.java deleted file mode 100644 index a6a12ee..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/mapper/RuleInfoMapper.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.risk.riskmanage.rule.mapper; - - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.risk.riskmanage.rule.model.RuleInfo; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - - -/** - * Rule表数据库访问层 - */ -@Mapper -public interface RuleInfoMapper extends BaseMapper { - - RuleInfo queryById(Integer id); - - List queryRuleList(RuleInfo ruleInfo); - - int updateStatus(@Param(value = "ids") Long[] ids, @Param(value = "status") Integer status); - - int updateParent(@Param(value = "ids") Long[] ids,@Param(value = "parentId") Long parentId); -} - diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/mapper/RuleLoopGroupActionMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/mapper/RuleLoopGroupActionMapper.java deleted file mode 100644 index a075fa8..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/mapper/RuleLoopGroupActionMapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.risk.riskmanage.rule.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.risk.riskmanage.rule.model.RuleLoopGroupAction; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * (RuleLoopGroupAction)表数据库访问层 - */ -public interface RuleLoopGroupActionMapper extends BaseMapper { - - - -} - diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/mapper/RuleVersionMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/mapper/RuleVersionMapper.java deleted file mode 100644 index 81a459d..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/mapper/RuleVersionMapper.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.risk.riskmanage.rule.mapper; - - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.risk.riskmanage.rule.model.RuleVersion; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface RuleVersionMapper extends BaseMapper { -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/RuleConditionInfo.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/RuleConditionInfo.java deleted file mode 100644 index c245842..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/RuleConditionInfo.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.risk.riskmanage.rule.model; - -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.risk.riskmanage.rule.model.vo.RuleConditionVo; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -import java.util.ArrayList; -import java.util.Date; -import java.io.Serializable; -import java.util.List; - -/** - * 规则条件表(t_rule_condition)实体类 - */ - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors -@TableName("`t_rule_condition`") -public class RuleConditionInfo - implements Serializable { - private static final long serialVersionUID = -55937038829167862L; - - @TableId(type = IdType.AUTO) - private Long id;//主键ID - - private String logical;//关系节点的逻辑符号:&&(并关系),||(或关系) - - private Long fieldId;//表达式节点对应的字段id - - private String fieldEn;//字段的en或者json类型的key - private Integer fieldType;//字段的类型:1中间变量 2 入参 - - private String operator;//表达式节点的操作符 - - private Integer variableType;//变量类型 - - private String fieldValue;//表达式节点对应字段的限定值 - - private String executionLogic;//表达式执行逻辑 - - private Long ruleId;//规则表的id - - private Long versionId;//规则版本的id - - private Long parentId;//父节点的id - - private Integer conditionType;//规则节点的类型:1-关系节点,2-表达式节点 - - private Date createTime;//创建时间 - - private Date updateTime;//修改时间 - - @TableField(exist = false) - private String insertTempId;//插入时临时id - - @TableField(exist = false) - private String TempParentId;//插入时临时父id - - @TableField(exist = false) - private Integer valueType;//字段值类型 - - @TableField(exist = false) - private List loopGroupActions = new ArrayList<>();//循环组对应的条件 - - @TableField(exist = false) - private RuleConditionVo loopResultCondition;//for对应的结果条件的计算条件树 - @TableField(exist = false) - private RuleConditionVo condGroupResultCondition;//条件组对应的结果计算条件树 -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/RuleFieldInfo.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/RuleFieldInfo.java deleted file mode 100644 index c380f82..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/RuleFieldInfo.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.risk.riskmanage.rule.model; - -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 lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@TableName("t_rule_field") -public class RuleFieldInfo implements Serializable { - private static final long serialVersionUID = -132321133324148507L; - @TableId(type = IdType.AUTO) - private Long id; - - private String logical;//逻辑运算符 - - private String operator;//运算符 - - private String fieldValue;//字段值 - - private Long ruleId;//关联的规则的id - - private String fieldId;//关联的字段的id - @TableField(exist = false) - private String fieldEn;//关联的字段的英文名称 - @TableField(exist = false) - private String field;//字段内容 - @TableField(exist = false) - private Integer valueType;//关联的字段的值类型 - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/RuleInfo.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/RuleInfo.java deleted file mode 100644 index b347a52..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/RuleInfo.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.risk.riskmanage.rule.model; - -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.risk.riskmanage.rule.model.vo.RuleVersionVo; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; -import org.springframework.beans.BeanUtils; - -import java.util.ArrayList; -import java.util.Date; -import java.io.Serializable; -import java.util.List; - - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors -@TableName("t_rule") -public class RuleInfo implements Serializable { - private static final long serialVersionUID = -13354133324148507L; - @TableId(type = IdType.AUTO) - private Long id;//主键 - - private String name;//规则名称 - - private String code;//规则代码 - - private String description;//规则描述 - - private Integer priority;//规则优先级 - - private Long parentId;//父节点id - - private Long author;//创建人id - - private Long userId;//修改人id - - private Long organId;//组织id - - private Integer engineId; - - private Integer status;//状态 0 :停用 ,1 : 启用,-1:删除 - - private Integer type;//规则类型 0 : 系统的规则 1:组织的规则 2: 引擎的规则 - - private Integer isNon;//逻辑关系“非”,0:否 ,1:是 - - private String content;//规则具体内容 - - private Date created; - - private Date updated; - - private Integer ruleType;//0硬性拒绝规则1加减分规则 - - private Integer ruleAudit; - - private Integer score;//得分 - - private String lastLogical;//逻辑关系符 - - private Integer difficulty;//规则难度:1-简单规则,2复杂规则 - - private String scriptType;//脚本类型python,js,groovy - - private String resultFieldEn;//存放是否命中的字段 - - private String scoreFieldEn;//存放得分的字段en - @TableField(exist = false) - private String authorName;//创建人名称,需要去其他表查询 - @TableField(exist = false) - private List parentIds; - @TableField(exist = false) - private List ruleVersionList; -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/RuleLoopGroupAction.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/RuleLoopGroupAction.java deleted file mode 100644 index 9ff31b5..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/RuleLoopGroupAction.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.risk.riskmanage.rule.model; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.Date; -import java.io.Serializable; - -/** - * (RuleLoopGroupAction)实体类 - */ - -@Data -@NoArgsConstructor -@AllArgsConstructor -@TableName("t_rule_loop_group_action") -public class RuleLoopGroupAction implements Serializable { - private static final long serialVersionUID = -47370055295043749L; - /** - * 循环组动作表主键 - */ - @TableId(type = IdType.AUTO) - private Long id; - /** - * 对应条件表中for的id - */ - private Long conditionForId; - /** - * 对应条件表中条件id - */ - private Long conditionGroupId; - /** - * 动作类型 1-求和,2-赋值,3-输出输出变量,4-输出常量 - */ - private Integer actionType; - /** - * 动作的key - */ - private String actionKey; - /** - * 动作的value - */ - private String actionValue; - /** - * 创建时间 - */ - private Date createTime; - /** - * 修改时间 - */ - private Date updateTime; - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/RuleVersion.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/RuleVersion.java deleted file mode 100644 index 1003ae2..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/RuleVersion.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.risk.riskmanage.rule.model; - -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 lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.util.Date; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@TableName("`t_rule_version`") -public class RuleVersion implements Serializable { - private static final long serialVersionUID = -1850194333747447612L; - /** - * 规则版本主键id - */ - @TableId( type = IdType.AUTO) - private Long id; - /** - * 规则id - */ - private Long ruleId; - /** - * 规则版本号 - */ - private String versionCode; - /** - * 描述信息 - */ - private String description; - /** - * 状态:-1 删除 0停用 1启用 - */ - private Integer status; - /** - * 规则结果en(命中情况) - */ - private String resultFieldEn; - /** - * 规则得分 - */ - private Integer score; - /** - * 规则得分的en - */ - private String scoreFieldEn; - /** - * 组织id - */ - private Long organId; - /** - * 创建者id - */ - private Long createUserId; - /** - * 修改者id - */ - private Long updateUserId; - /** - * 创建时间 - */ - private Date createTime; - /** - * 修改时间 - */ - private Date updateTime; - - /** - * 快照信息 - */ - private String snapshot; -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/param/RuleSetNodeResultParam.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/param/RuleSetNodeResultParam.java deleted file mode 100644 index a2426a4..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/param/RuleSetNodeResultParam.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.risk.riskmanage.rule.model.param; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class RuleSetNodeResultParam { - private Long id;//规则的id - private Integer difficulty;//标识:1基础规则,2复杂规则,3脚本规则 - private Long versionId;//版本id - private String resultEn; - private String scoreEn; - private String code; - private String name; -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/request/RuleListParamV2.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/request/RuleListParamV2.java deleted file mode 100644 index e7f8898..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/request/RuleListParamV2.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.risk.riskmanage.rule.model.request; - -import com.risk.riskmanage.rule.model.RuleInfo; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - - - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class RuleListParamV2 { - protected Integer pageNum = 1; // 第几页 - protected Integer pageSize = 10; // 每页的数量 - - -// protected Boolean search = false; // 是否搜索 - - protected RuleInfo ruleInfo;//查询实体对象 - -// protected Integer parentId = 0; // 文件夹的id -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/request/RuleUpdateStatusParam.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/request/RuleUpdateStatusParam.java deleted file mode 100644 index 1e242a4..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/request/RuleUpdateStatusParam.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.risk.riskmanage.rule.model.request; - - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -@Data -@AllArgsConstructor -@NoArgsConstructor -@Accessors -public class RuleUpdateStatusParam { - private String ids;//id - private Integer status;//状态 -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/vo/RuleConditionVo.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/vo/RuleConditionVo.java deleted file mode 100644 index 548f5d6..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/vo/RuleConditionVo.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.risk.riskmanage.rule.model.vo; - -import com.risk.riskmanage.rule.model.RuleConditionInfo; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - - - -import java.util.List; -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors -public class RuleConditionVo extends RuleConditionInfo { - - private List children;//规则子节点 -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/vo/RuleVersionVo.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/vo/RuleVersionVo.java deleted file mode 100644 index b8a9687..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/vo/RuleVersionVo.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.risk.riskmanage.rule.model.vo; - - -import com.risk.riskmanage.rule.model.RuleVersion; -import com.risk.riskmanage.tactics.model.TacticsOutput; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.List; - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class RuleVersionVo extends RuleVersion { - private RuleConditionVo ruleConditionVo;//规则对应的结点树 - - private List tacticsOutputList;//输出字段 - - private List failOutputList;//失败输出字段 -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/vo/RuleVo.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/vo/RuleVo.java deleted file mode 100644 index 3271f29..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/model/vo/RuleVo.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.risk.riskmanage.rule.model.vo; - - - - -import com.risk.riskmanage.rule.model.RuleFieldInfo; -import com.risk.riskmanage.rule.model.RuleInfo; -import com.risk.riskmanage.tactics.model.TacticsOutput; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -import java.util.List; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors -public class RuleVo extends RuleInfo { - - private RuleConditionVo ruleConditionVo;//规则对应的结点树 - - private List ruleFieldList;//简单规则条件列表 - - private List tacticsOutputList;//输出字段 - - private List ruleVersionList;//规则版本列表 -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/RuleConditionService.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/RuleConditionService.java deleted file mode 100644 index f647865..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/RuleConditionService.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.risk.riskmanage.rule.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.risk.riskmanage.rule.model.RuleConditionInfo; -import com.risk.riskmanage.rule.model.vo.RuleConditionVo; - -import java.util.List; - -/** - * (RuleConditionInfo)表服务接口 - */ -public interface RuleConditionService extends IService { - - - /** - * 根据ruleId查询装配好返回 - * @param versionId 规则版本id - * @return 对象列表 - */ - RuleConditionVo queryByVersionId(Long versionId); - - /** - * 新增数据 - * @param ruleConditionVo 实例对象 - * @return 实例对象 - */ - RuleConditionVo insertRuleCondition(RuleConditionVo ruleConditionVo,Long ruleId); - - RuleConditionVo updateRuleCondition(Long ruleId,RuleConditionVo ruleConditionVo); - - boolean deleteRuleCondition(Long ruleId,Long versionId); - - - RuleConditionVo assemble(List list); - - List disassemble(RuleConditionVo vo,Long ruleId,boolean needTempId); - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/RuleFieldInfoService.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/RuleFieldInfoService.java deleted file mode 100644 index 83fc0ed..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/RuleFieldInfoService.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.risk.riskmanage.rule.service; - -import com.baomidou.mybatisplus.extension.service.IService; - -import com.risk.riskmanage.rule.model.RuleFieldInfo; - -import com.risk.riskmanage.rule.model.vo.RuleVo; - -import java.util.List; - -public interface RuleFieldInfoService extends IService { - List queryByRuleId(Long ruleId); - - boolean insertRuleField(List list,Long ruleId); - - boolean updateRuleField(List list,Long ruleId); - - boolean deleteRuleField(Long ruleId); - - public String assemblyRuleContent(RuleVo rule, List fieldInfoList); -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/RuleLoopGroupActionService.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/RuleLoopGroupActionService.java deleted file mode 100644 index e995ab7..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/RuleLoopGroupActionService.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.risk.riskmanage.rule.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.risk.riskmanage.rule.mapper.RuleLoopGroupActionMapper; -import com.risk.riskmanage.rule.model.RuleLoopGroupAction; - -import java.util.List; - -/** - * (RuleLoopGroupAction)表服务接口 - */ -public interface RuleLoopGroupActionService extends IService { - - List getRuleLoopList(Long forId,Long conditionId); - - boolean addLoopGroupList(Long forId,Long conditionId, List loopGroupActions); - boolean deleteLoopGroupByForId(Long forId); -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/RuleService.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/RuleService.java deleted file mode 100644 index 723d169..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/RuleService.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.risk.riskmanage.rule.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.github.pagehelper.PageInfo; - -import com.risk.riskmanage.knowledge.model.response.UploadResponse; -import com.risk.riskmanage.rule.model.RuleInfo; -import com.risk.riskmanage.rule.model.request.RuleListParamV2; -import com.risk.riskmanage.rule.model.vo.RuleVo; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; - - -public interface RuleService extends IService { - - /** - * 通过ID查询单条数据 - * @param id 主键 - * @return 实例对象 - */ - RuleVo queryById(Long id,Integer difficulty); - - /** - * 根据实体类条件查询 - * @param ruleListParam - * @return - */ - public PageInfo queryByEntity(RuleListParamV2 ruleListParam); - - - /** - * 新增数据 - * @param rule 实例对象 - * @return 实例对象 - */ - RuleVo insertRuleInfo(RuleVo rule); - - /** - * 修改数据 - * @param rule 实例对象 - * @return 实例对象 - */ - RuleVo updateRuleInfo(RuleVo rule); - - - boolean updateStatus(List ids,Integer status); - - boolean updateParent(List ids,Long parentId); - - UploadResponse upload(HttpServletRequest request) throws Exception; - - List queryFieldEnByRuleId(Long ruleId); -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/RuleVersionService.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/RuleVersionService.java deleted file mode 100644 index 9ac79f0..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/RuleVersionService.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.risk.riskmanage.rule.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.risk.riskmanage.common.model.requestParam.StatusParam; -import com.risk.riskmanage.rule.model.RuleVersion; -import com.risk.riskmanage.rule.model.vo.RuleVersionVo; - -import java.util.List; - -public interface RuleVersionService extends IService { - RuleVersionVo queryById(Long id); - - List queryVersionListByRuleId(Long RuleId); - - - - List queryFieldEnByVersionId(Long versionId); - - int addVersionList(List versionList); - boolean addVersion(RuleVersionVo version); - - boolean copyVersion(RuleVersionVo version); - - boolean updateVersion(RuleVersionVo version); - - boolean updateStatus(StatusParam statusParam); -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/impl/RuleConditionServiceImpl.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/impl/RuleConditionServiceImpl.java deleted file mode 100644 index b0c8bad..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/impl/RuleConditionServiceImpl.java +++ /dev/null @@ -1,342 +0,0 @@ -package com.risk.riskmanage.rule.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.risk.riskmanage.rule.consts.RuleConditionConst; -import com.risk.riskmanage.rule.mapper.RuleConditionInfoMapper; -import com.risk.riskmanage.rule.model.RuleConditionInfo; - - -import com.risk.riskmanage.rule.model.RuleLoopGroupAction; -import com.risk.riskmanage.rule.model.vo.RuleConditionVo; -import com.risk.riskmanage.rule.service.RuleConditionService; -import com.risk.riskmanage.rule.service.RuleLoopGroupActionService; -import org.springframework.beans.BeanUtils; - -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import java.util.stream.Collectors; - -/** - * (RuleConditionInfo)表服务实现类 - */ -@Service("ruleConditionService2") -public class RuleConditionServiceImpl extends ServiceImpl implements RuleConditionService { - @Resource - private RuleConditionInfoMapper ruleConditionInfoMapper; - - @Resource - private RuleLoopGroupActionService loopGroupActionService; - - /** - * 查询整个规则的节点并且装配成树 - * - * @param versionId 规则版本id - * @return - */ - @Override - public RuleConditionVo queryByVersionId(Long versionId) { - if (versionId == null) { - return null; - } - //构造查询条件,查询条件列表 - RuleConditionVo result = null; - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(RuleConditionInfo::getVersionId,versionId); - List ruleConditionInfoList = ruleConditionInfoMapper.selectList(queryWrapper); - //组装为需要的树形结构 - if (ruleConditionInfoList != null) { - result = this.assemble(ruleConditionInfoList); - } - return result; - } - - - /** - * 新增数据 - * - * @param ruleConditionVo 实例对象 - * @return 实例对象 - */ - @Override - @Transactional - public RuleConditionVo insertRuleCondition(RuleConditionVo ruleConditionVo, Long ruleId) { - if (ruleConditionVo == null || ruleId == null) { - return null; - } - Long versionId = ruleConditionVo.getVersionId(); - if (versionId==null){ - versionId=0L; - } - Long parentId = RuleConditionConst.DEFAULT_CONDITION_PARENT_ID; - //将插入的条件树拆解 - List list = this.disassemble(ruleConditionVo, ruleId, true); - for (RuleConditionInfo info : list) { - info.setVersionId(versionId); - } - //找出唯一根节点 - RuleConditionInfo root = null; - for (RuleConditionInfo info : list) { - if (info.getParentId() == parentId) { - root = info; - break; - } - } - //递归插入所有数据 - boolean saveResult = this.save(list, root); - if (!saveResult) { - return null; - } - return null; - } - - /** - * 修改规则条件 - * - * @param ruleConditionVo - * @return - */ - @Override - @Transactional - public RuleConditionVo updateRuleCondition(Long ruleId, RuleConditionVo ruleConditionVo) { - if (ruleId == null) { - return null; - } - //删除一个规则下的所有条件 - boolean delete = this.deleteRuleCondition(ruleId,ruleConditionVo.getVersionId()); - RuleConditionVo ruleCondition = null; - if (!delete) { - ruleCondition = this.queryByVersionId(ruleConditionVo.getVersionId()); - } - //插入条件树 - if ((delete || ruleCondition == null) && ruleConditionVo != null) { - RuleConditionVo insertResult = this.insertRuleCondition(ruleConditionVo, ruleId); - return insertResult; - } - return null; - } - - /** - * 删除根据规则id规则条件 - * - * @param ruleId - * @return - */ - @Override - @Transactional - public boolean deleteRuleCondition(Long ruleId,Long versionId) { - if (ruleId == null) { - return false; - } - //删除循环动作子表中的内容 - RuleConditionInfo info = new RuleConditionInfo(); - if (ruleId!=null){ - info.setRuleId(ruleId); - } - info.setVersionId(versionId); - info.setLogical(RuleConditionConst.LOOP_RULE_LOGICAL); - List ruleConditionInfoList = ruleConditionInfoMapper.selectList(new QueryWrapper<>(info)); - for (RuleConditionInfo ruleConditionInfo : ruleConditionInfoList) { - loopGroupActionService.deleteLoopGroupByForId(ruleConditionInfo.getId()); - } - //删除条件表内容 - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); - queryWrapper.eq(RuleConditionInfo::getVersionId,versionId); - if (ruleId!=null){ - queryWrapper.eq(RuleConditionInfo::getRuleId,ruleId); - } - int delete = ruleConditionInfoMapper.delete(queryWrapper); - return delete > 0 ? true : false; - } - - - //装配方法,将规则条件List装配成一个规则树并返回 - @Override - public RuleConditionVo assemble(List list) { - RuleConditionVo root = null; - //转换为Vo - List rcVoList = transferToVoList(list); - //获取根节点,根节点只有一个的时候进行操作,并且返回拼装好的规则树,否则返回null - List collect = rcVoList.stream().filter(rc -> { - return rc.getParentId() == RuleConditionConst.DEFAULT_CONDITION_PARENT_ID; - }).collect(Collectors.toList()); - if (collect.size() == 1) { - root = collect.get(0); - RuleConditionVo ruleTree = coupling(rcVoList, root); - return ruleTree; - } - return null; - } - - - // 拆解方法,将规则条件Vo转换未规则条件list - @Override - public List disassemble(RuleConditionVo vo, Long ruleId, boolean needTempId) { - if (vo == null) { - return null; - } - if (needTempId) { - vo.setParentId(RuleConditionConst.DEFAULT_CONDITION_PARENT_ID); - vo.setInsertTempId(UUID.randomUUID().toString().replace("-", "")); - } - List voList = decoupling(vo, ruleId, needTempId); - List ruleConditionInfoList = transferToInfoList(voList); - return ruleConditionInfoList; - } - - //存储 - @Transactional - public boolean save(List list, RuleConditionInfo root) { - String tempId = root.getInsertTempId(); - //保存根节点 - int insert = ruleConditionInfoMapper.insert(root); - if (insert <= 0) { - return false; - } - Long id = root.getId(); - for (int i = 0; i < list.size(); i++) { - RuleConditionInfo info = list.get(i); - //保存根节点的子节点 - if (tempId.equals(info.getTempParentId())) { - info.setParentId(id); - //递归保存每个节点和子节点 - save(list, info); - //对有动作的循环条件保存循环动作表内容 - if (root.getLogical()!=null&&RuleConditionConst.LOOP_RULE_LOGICAL.equals(root.getLogical())&&info.getLoopGroupActions()!=null){ - loopGroupActionService.addLoopGroupList(id,info.getId(),info.getLoopGroupActions()); - } - } - } - return true; - } - - //耦合方法:将规则节点列表耦合规则树(),循环规则的子节点需要去查循环表获取 - private RuleConditionVo coupling(List list, RuleConditionVo root) { - List children = new ArrayList<>(); - for (RuleConditionVo rc : list) { - //处理root的子节点 - if (root.getId().equals(rc.getParentId())) { - RuleConditionVo rcVo = coupling(list, rc); - String logical = root.getLogical(); - - if (logical!=null&&!"".equals(logical)){ - switch (logical){ - //当root为for节点,则此子节点需要拼上循环动作 - case RuleConditionConst.LOOP_RULE_LOGICAL: - List loopList = loopGroupActionService.getRuleLoopList(root.getId(),rc.getId()); - rcVo.setLoopGroupActions(loopList); - if (rc.getConditionType()==RuleConditionConst.LOOP_RULE_RESULT_CONDITION){ - root.setLoopResultCondition(rcVo); - continue; - } - break; - //当root为条件组节点,则此子节点需要拼上条件组结果 - case RuleConditionConst.CONDITION_GROUP_LOGICAL: - if (rc.getConditionType()==RuleConditionConst.CONDITION_GROUP_RESULT_CONDITION){ - root.setCondGroupResultCondition(rcVo); - continue; - } - break; - - - - } - - } -// if (root.getLogical() != null && RuleConditionConst.LOOP_RULE_LOGICAL.equals(root.getLogical())) { -// List loopList = loopGroupActionService.getRuleLoopList(root.getId(),rc.getId()); -// rcVo.setLoopGroupActions(loopList); -// if (rc.getConditionType()==RuleConditionConst.LOOP_RULE_RESULT_CONDITION){ -// root.setLoopResultCondition(rcVo); -// continue; -// } -// } - // - children.add(rcVo); - } - } - root.setChildren(children); - return root; - } - - //解耦方法:将规则树解耦为节点列表 - private List decoupling(RuleConditionVo vo, Long ruleId, boolean needTempId) { - List list = new ArrayList<>(); - List children = vo.getChildren(); - - //处理条件树根节点的子条件 - if (children != null && children.size() > 0) { - for (int i = 0; i < children.size(); i++) { - RuleConditionVo child = children.get(i); - if (needTempId) { - child.setInsertTempId(UUID.randomUUID().toString().replace("-", "")); - child.setTempParentId(vo.getInsertTempId()); - } - List childList = decoupling(child, ruleId, needTempId); - list.addAll(childList); - } - } - vo.setRuleId(ruleId); - list.add(vo); - //处理for条件的结果条件 - Integer conditionType = vo.getConditionType(); - if (conditionType!=null){ - switch (conditionType){ - case RuleConditionConst.LOOP_RULE_ROOT: - RuleConditionVo loopResult = vo.getLoopResultCondition(); - loopResult.setRuleId(ruleId); - loopResult.setTempParentId(vo.getInsertTempId()); - loopResult.setInsertTempId(UUID.randomUUID().toString().replace("-", "")); - List loopResultList = decoupling(loopResult, ruleId, needTempId); - list.addAll(loopResultList); - break; - case RuleConditionConst.CONDITION_GROUP_ROOT: - RuleConditionVo condGroupResult = vo.getCondGroupResultCondition(); - condGroupResult.setRuleId(ruleId); - condGroupResult.setTempParentId(vo.getInsertTempId()); - condGroupResult.setInsertTempId(UUID.randomUUID().toString().replace("-", "")); - List condGroupResultList = decoupling(condGroupResult, ruleId, needTempId); - list.addAll(condGroupResultList); - break; - } - } -// if (vo.getConditionType()==RuleConditionConst.LOOP_RULE_ROOT){ -// RuleConditionVo loopResult = vo.getLoopResultCondition(); -// loopResult.setRuleId(ruleId); -// loopResult.setTempParentId(vo.getInsertTempId()); -// loopResult.setInsertTempId(UUID.randomUUID().toString().replace("-", "")); -// List loopResultList = decoupling(loopResult, ruleId, needTempId); -// list.addAll(loopResultList); -// } - return list; - } - - //List转换为List - private List transferToVoList(List list) { - List rcVoList = new ArrayList<>(); - for (int i = 0; i < list.size(); i++) { - RuleConditionVo rcVo = new RuleConditionVo(); - BeanUtils.copyProperties(list.get(i), rcVo); - rcVoList.add(rcVo); - } - return rcVoList; - } - - //List转换为List - private List transferToInfoList(List list) { - List rcList = new ArrayList<>(); - for (int i = 0; i < list.size(); i++) { - RuleConditionInfo rc = new RuleConditionInfo(); - BeanUtils.copyProperties(list.get(i), rc); - rcList.add(rc); - } - return rcList; - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/impl/RuleFieldInfoServiceImpl.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/impl/RuleFieldInfoServiceImpl.java deleted file mode 100644 index b4f2ed1..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/impl/RuleFieldInfoServiceImpl.java +++ /dev/null @@ -1,368 +0,0 @@ -package com.risk.riskmanage.rule.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.risk.riskmanage.common.exception.ApiException; -import com.risk.riskmanage.datamanage.common.ValueType; -import com.risk.riskmanage.rule.mapper.RuleFieldInfoMapper; -import com.risk.riskmanage.rule.model.RuleFieldInfo; -import com.risk.riskmanage.rule.model.vo.RuleVo; -import com.risk.riskmanage.rule.service.RuleFieldInfoService; -import com.risk.riskmanage.tactics.model.TacticsOutput; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.annotation.Resource; -import java.util.*; -import java.util.stream.Collectors; - -@Service -public class RuleFieldInfoServiceImpl extends ServiceImpl implements RuleFieldInfoService { - @Resource - private RuleFieldInfoMapper ruleFieldInfoMapper; - @Override - public List queryByRuleId(Long ruleId) { - RuleFieldInfo ruleFieldInfo = new RuleFieldInfo(); - ruleFieldInfo.setRuleId(ruleId); - List ruleFieldInfoList = ruleFieldInfoMapper.selectList(new QueryWrapper<>(ruleFieldInfo)); - - return ruleFieldInfoList; - } - - @Override - @Transactional - public boolean insertRuleField(List list, Long ruleId) { - for (RuleFieldInfo ruleFieldInfo : list) { - ruleFieldInfo.setRuleId(ruleId); - } - this.saveBatch(list); - return false; - } - - @Override - @Transactional - public boolean updateRuleField(List list, Long ruleId) { - boolean b = this.deleteRuleField(ruleId); - if (!b){ - List ruleFieldInfoList = this.queryByRuleId(ruleId); - if (ruleFieldInfoList!=null&&ruleFieldInfoList.size()>0){ - throw new ApiException("修改简单规则条件异常","修改简单规则条件异常"); - } - } - for (RuleFieldInfo ruleFieldInfo : list) { - ruleFieldInfo.setRuleId(ruleId); - } - this.saveBatch(list); - return false; - } - - - @Override - @Transactional - public boolean deleteRuleField(Long ruleId) { - RuleFieldInfo ruleFieldInfo = new RuleFieldInfo(); - ruleFieldInfo.setRuleId(ruleId); - return this.remove(new QueryWrapper<>(ruleFieldInfo)); - } - - public String assemblyRuleContent(RuleVo rule, List fieldInfoList) { - if (rule.getRuleType()==null){ - rule.setRuleType(1); - } - List ruleFieldList = fieldInfoList.stream().map(item -> { - item.setFieldEn(item.getFieldId().split("\\|")[1]); - return item; - }).collect(Collectors.toList()); - - String ruleStr = ""; // ( this['age'] > 18 && this['age'] < 80 ) - String functionStr = ""; - - // ((-车损明细名称-==-底大边(右)||-车损明细名称-==-底大边外板(右))&&-车损明细类型-==-1)&&-车型名称-==-吉利全球鹰RX6453B01多用途乘用车 - Map>> map = cycleRuleHandle(ruleFieldList); - String firstLogical = ""; - if(!ruleFieldList.isEmpty()){ - firstLogical = ruleFieldList.get(0).getLogical(); - if(firstLogical.contains("&&")){ - firstLogical = firstLogical.substring(0, firstLogical.indexOf("&&")); - } else if(firstLogical.contains("||")){ - firstLogical = firstLogical.substring(0, firstLogical.indexOf("||")); - } - } - if (!map.isEmpty()) { -// List ruleContents = rule.getRuleContentInfoList(); - List tacticsOutputList = rule.getTacticsOutputList(); - for (String key : map.keySet()) { - List attributeNameSet = tacticsOutputList.stream().map(item -> { - String attributeName = ""; - String fieldValue = item.getFieldValue(); - if(item.getVariableType() == 2 && fieldValue.contains(key + "[")){ - attributeName = fieldValue.substring(fieldValue.indexOf("[") + 1, fieldValue.lastIndexOf("]")); - } - return attributeName; - }).filter(item -> StringUtils.isNotBlank(item)).collect(Collectors.toList()); - - String attributeName = attributeNameSet.size() > 0 ? attributeNameSet.get(0) : ""; - - ruleStr = " " + key + "(this['" + key + "'], $inputParam) "; - functionStr += createDroolsFunction(key, attributeName, map.get(key), firstLogical); - } - } - - for (int i = 0; i < ruleFieldList.size(); i++) { - RuleFieldInfo ruleField = ruleFieldList.get(i); - if (!"-1".equals(ruleField.getLogical())) { - String logical = ruleField.getLogical(); - if (i == 0 && !map.isEmpty()) { - logical = logical.replace(firstLogical, ""); - } - ruleStr = ruleStr + " " + logical; - } - - // 字符、数组型的值需要加引号 - if (ruleField.getValueType() == ValueType.Char.getValue() || ruleField.getValueType() == ValueType.Array.getValue()) { - ruleStr = ruleStr + " this['" + ruleField.getFieldId().split("\\|")[1] + "'] " + - ruleField.getOperator() + " \"" + ruleField.getFieldValue() + "\" "; - } else { - ruleStr = ruleStr + " this['" + ruleField.getFieldId().split("\\|")[1] + "'] " + - ruleField.getOperator() + " " + ruleField.getFieldValue() + " "; - } - } - - if (map.isEmpty()) { - if (StringUtils.isNotBlank(rule.getLastLogical()) && !"-1".equals(rule.getLastLogical())) { - ruleStr = ruleStr + rule.getLastLogical(); - } - } - - String enginerule = "package com.baoying.enginex.executor.drools\\r\\n"; - enginerule += "import java.util.Map;\\r\\n"; - enginerule += "import java.util.List;\\r\\n"; - enginerule += "import java.util.Set;\\r\\n"; - enginerule += "import java.util.HashSet;\\r\\n"; - enginerule += "import java.util.ArrayList;\\r\\n"; - enginerule += "import java.util.HashMap;\r\n"; - enginerule += "import com.baoying.enginex.executor.engineModel.model.InputParam;\\r\\n"; - enginerule += "import com.baoying.enginex.executor.engineModel.model.Result;\\r\\n"; - enginerule += "import com.baoying.enginex.executor.engineModel.model.EngineRule;\\r\\n"; - enginerule += "import com.alibaba.fastjson.JSONObject;\\r\\n"; - enginerule += "rule \"" + rule.getCode() + "\"\\r\\n"; - enginerule += "salience " + rule.getPriority() + "\\r\\n"; - enginerule += "when\\r\\n"; - enginerule += "\\t $inputParam : InputParam();\\r\\n"; - enginerule += "\\t Map(" + ruleStr + ") from $inputParam.inputParam;\\r\\n"; - enginerule += "then\\r\\n"; - enginerule += "\\t List resultList = $inputParam.getResult();\\r\\n"; - enginerule += "\\t Result result = new Result(); \\r\\n"; - enginerule += "\\t result.setResultType(\"" + rule.getRuleType() + "\"); \\r\\n"; - enginerule += "\\t result.setVersionCode(\"" + rule.getCode() + "\"); \\r\\n"; - enginerule += "\\t Map map = new HashMap<>(); \\r\\n"; - - if (rule.getScore() != null) { - enginerule += "\\t map.put(\"score\"," + rule.getScore() + "); \\r\\n"; - } - -// enginerule +=outputparam; - enginerule += "\\t result.setMap(map); \\r\\n"; - enginerule += "\\t resultList.add(result); \\r\\n"; - enginerule += "\\t $inputParam.setResult(resultList); \\r\\n"; - enginerule += "end\\r\\n"; - - enginerule += "\\r\\n" + functionStr; - - return enginerule; - } - - /** - * 循环规则处理 - * - * @param ruleFieldList - * @return - */ - private Map>> cycleRuleHandle(List ruleFieldList) { - List> groupRuleFields = new ArrayList<>(); - List ruleFields = new ArrayList<>(); - // ((-车损明细名称-==-底大边(右)||-车损明细名称-==-底大边外板(右))&&-车损明细类型-==-1)&&-车型名称-==-吉利全球鹰RX6453B01多用途乘用车 - Stack stack = new Stack<>(); - for (RuleFieldInfo ruleField : ruleFieldList) { - String logical = ruleField.getLogical(); - - // 纯括号 - if(!logical.contains("&&") && !logical.contains("||")){ - if(logical.contains("(")){ - for(int i=0; i(ruleFields)); - ruleFields = new ArrayList<>(); - ruleFields.add(ruleField); - } else { - ruleFields.add(ruleField); - } - - if(logical.contains("(")){ - String rightLogical = ""; - if(logical.contains("&&")){ - rightLogical = logical.substring(logical.indexOf("&&") + 1); - } else if(logical.contains("||")){ - rightLogical = logical.substring(logical.indexOf("||") + 1); - } - for(int i=0; i(ruleFields)); - - // map中key为数组名称,value为该数组循环需要满足的多个条件判断单元 - Map>> map = new HashMap<>(); - ruleFieldList.clear(); - for (List ruleFields1 : groupRuleFields) { - RuleFieldInfo ruleField = ruleFields1.get(0); - if (ruleField.getFieldEn().contains("[") && ruleField.getFieldEn().contains("]")) { - String key = ruleField.getFieldEn().substring(0, ruleField.getFieldEn().indexOf("[")); - if (!map.containsKey(key)) { - List> ruleFieldList1 = new ArrayList<>(); - ruleFieldList1.add(ruleFields1); - map.put(key, ruleFieldList1); - } else { - List> ruleFieldList1 = map.get(key); - ruleFieldList1.add(ruleFields1); - } - } else { - // ruleFieldListNew为剔除数组外,剩余的普通字段集合 - ruleFieldList.add(ruleField); - } - } - - return map; - } - - /** - * 拼接drools自定义函数 - * - * @param functionName - * @param groupRuleFields - * @return - */ - private String createDroolsFunction(String functionName, String attributeName, List> groupRuleFields, String groupBracket) { - String[] variableArr = new String[groupRuleFields.size()]; - String[] conditionStrArr = new String[groupRuleFields.size()]; - for (int i = 0; i < groupRuleFields.size(); i++) { - variableArr[i] = "unit" + i; - String condition = ""; - List groupRuleField = groupRuleFields.get(i); - for (int j = 0; j < groupRuleField.size(); j++) { - RuleFieldInfo ruleField = groupRuleField.get(j); - String logical = ruleField.getLogical(); - String fieldEn = ruleField.getFieldEn(); - if (fieldEn.contains("[") && fieldEn.contains("]")) { - fieldEn = fieldEn.substring(fieldEn.indexOf("[") + 1, fieldEn.lastIndexOf("]")); - } - String operator = ruleField.getOperator(); - String fieldValue = ruleField.getFieldValue(); - - if (ruleField.getValueType() == ValueType.Char.getValue()) { - if ("==".equals(operator) || "contains".equals(operator)) { - operator = operator.replace("==", "equals"); - condition += logical + " map.get(\"" + fieldEn + "\").toString()." + operator + "(\"" + fieldValue + "\") "; - } else if ("!=".equals(operator) || "not contains".equals(operator) || "notContains".equals(operator)) { - operator = operator.replace("!=", "equals") - .replace("not contains", "contains") - .replace("notContains", "contains"); - condition += logical + " !map.get(\"" + fieldEn + "\").toString()." + operator + "(\"" + fieldValue + "\") "; - } - } else { - condition += logical + " Integer.valueOf(map.get(\"" + fieldEn + "\").toString()) " + operator + " " + fieldValue + " "; - } - } - condition += groupBracket; - - String setStr = ""; - if(StringUtils.isNotBlank(attributeName)){ - setStr = "\\t\\t\\t set.add(" + "map.get(\"" + attributeName + "\").toString()" + ");\\r\\n"; - } - String conditionStr = "\\t\\t if(" + condition + "){\\r\\n" - + "\\t\\t\\t " + variableArr[i] + " ++;\\r\\n" - + setStr - + "\\t\\t }\\r\\n"; - - conditionStrArr[i] = conditionStr; - } - - // 变量定义 - String variableStr = ""; - for (String variable : variableArr) { - variableStr += "\\t int " + variable + " = 0;\\r\\n"; - } - - // for循环内容 - String forContent = ""; - forContent += "\\t Set set = new HashSet();\\r\\n"; - forContent += "\\t for(Object obj : objList){\\r\\n"; - forContent += "\\t\\t Map map = JSONObject.parseObject(JSONObject.toJSONString(obj), Map.class);\\r\\n"; - for (String conditionStr : conditionStrArr) { - forContent += conditionStr; - } - forContent += "\\t }\\r\\n"; - - // 返回结果判断 - String resultJudge = ""; - resultJudge += "\\t if("; - for (int i = 0; i < variableArr.length; i++) { - if (i == 0) { - resultJudge += variableArr[i] + " > 0 "; - } else { - resultJudge += "&& " + variableArr[i] + " > 0 "; - } - } - resultJudge += "){\\r\\n"; - resultJudge += "\\t\\t return true;\\r\\n"; - resultJudge += "\\t }\\r\\n"; - - // 函数内容 - String functionStr = ""; - functionStr += "function Boolean " + functionName + "(List objList, InputParam inputParam){\\r\\n"; - functionStr += "\\t Map> outmap = inputParam.getOutputParam();\\r\\n"; - functionStr += variableStr; - functionStr += forContent; - if(StringUtils.isNotBlank(attributeName)){ - functionStr += "\\t outmap.put(\"" + functionName + "["+ attributeName + "]\", set);\\r\\n"; - } - functionStr += "\\t inputParam.setOutputParam(outmap);\\r\\n"; - functionStr += resultJudge; - functionStr += "\\t return false;\\r\\n"; - functionStr += "}\\r\\n"; - - return functionStr; - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/impl/RuleLoopGroupActionServiceImpl.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/impl/RuleLoopGroupActionServiceImpl.java deleted file mode 100644 index b1a4054..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/impl/RuleLoopGroupActionServiceImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.risk.riskmanage.rule.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.risk.riskmanage.rule.model.RuleLoopGroupAction; -import com.risk.riskmanage.rule.mapper.RuleLoopGroupActionMapper; -import com.risk.riskmanage.rule.service.RuleLoopGroupActionService; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; - -/** - * (RuleLoopGroupAction)表服务实现类 - */ -@Service("ruleLoopGroupActionService") -public class RuleLoopGroupActionServiceImpl extends ServiceImpl implements RuleLoopGroupActionService { - @Resource - private RuleLoopGroupActionMapper ruleLoopGroupActionMapper; - - @Override - public List getRuleLoopList(Long forId, Long conditionId) { - RuleLoopGroupAction ruleLoopGroupAction = new RuleLoopGroupAction(); - ruleLoopGroupAction.setConditionForId(forId); - ruleLoopGroupAction.setConditionGroupId(conditionId); - List loopList = ruleLoopGroupActionMapper.selectList(new QueryWrapper<>(ruleLoopGroupAction)); - if (loopList==null){ - loopList = new ArrayList<>(); - } - return loopList; - } - - @Override - public boolean addLoopGroupList(Long forId,Long conditionId, List loopGroupActions) { - for (RuleLoopGroupAction loopGroupAction : loopGroupActions) { - loopGroupAction.setConditionForId(forId); - loopGroupAction.setConditionGroupId(conditionId); - } - boolean add = this.saveBatch(loopGroupActions); - return add; - } - - @Override - public boolean deleteLoopGroupByForId(Long forId) { - if (forId==null){ - return false; - } - RuleLoopGroupAction ruleLoopGroupAction = new RuleLoopGroupAction(); - ruleLoopGroupAction.setConditionForId(forId); - ruleLoopGroupActionMapper.delete(new QueryWrapper<>(ruleLoopGroupAction)); - return true; - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/impl/RuleServiceImpl.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/impl/RuleServiceImpl.java deleted file mode 100644 index a83939a..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/impl/RuleServiceImpl.java +++ /dev/null @@ -1,627 +0,0 @@ -package com.risk.riskmanage.rule.service.impl; - - -import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.risk.riskmanage.common.enums.ErrorCodeEnum; -import com.risk.riskmanage.common.exception.ApiException; -import com.risk.riskmanage.datamanage.mapper.FieldMapper; -import com.risk.riskmanage.datamanage.model.Field; -import com.risk.riskmanage.knowledge.common.consts.Status; -import com.risk.riskmanage.common.utils.ExcelUtil; -import com.risk.riskmanage.knowledge.mapper.RuleMapper; -import com.risk.riskmanage.knowledge.model.KnowledgeTree; -import com.risk.riskmanage.knowledge.model.Rule; -import com.risk.riskmanage.knowledge.model.response.UploadResponse; -import com.risk.riskmanage.knowledge.service.KnowledgeTreeService; -import com.risk.riskmanage.rule.consts.RuleConst; -import com.risk.riskmanage.rule.mapper.RuleInfoMapper; -import com.risk.riskmanage.rule.model.*; -import com.risk.riskmanage.rule.model.request.RuleListParamV2; -import com.risk.riskmanage.rule.model.vo.RuleVersionVo; -import com.risk.riskmanage.rule.model.vo.RuleVo; -import com.risk.riskmanage.rule.service.*; -import com.risk.riskmanage.system.mapper.UserMapper; -import com.risk.riskmanage.system.model.User; -import com.risk.riskmanage.tactics.consts.TacticsType; -import com.risk.riskmanage.tactics.model.TacticsOutput; -import com.risk.riskmanage.tactics.service.TacticsOutputService; -import com.risk.riskmanage.util.SessionManager; -import com.risk.riskmanage.util.StringUtil; -import org.apache.poi.hssf.usermodel.HSSFWorkbook; -import org.apache.poi.ss.usermodel.Row; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.xssf.usermodel.XSSFWorkbook; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.multipart.MultipartHttpServletRequest; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; -import java.io.InputStream; -import java.util.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * 组织规则维护表(RuleInfo)表服务实现类 - */ -@Service("ruleService2") -public class RuleServiceImpl extends ServiceImpl implements RuleService { - @Resource - private RuleInfoMapper ruleInfoMapper; - - @Autowired - private RuleVersionService versionService; - @Resource - private RuleConditionService ruleConditionService; - @Resource - private RuleFieldInfoService ruleFieldInfoService; - - @Resource - private TacticsOutputService outputService; - - @Resource - private UserMapper userMapper; - - @Resource - private FieldMapper fieldMapper; - @Resource - private RuleMapper ruleMapper; - @Resource - private KnowledgeTreeService knowledgeTreeService; - - @Override - public RuleVo queryById(Long id, Integer difficulty) { - //查询规则 - RuleInfo ruleInfo = ruleInfoMapper.selectById(id); - if (ruleInfo == null) { - return null; - } - RuleVo ruleVo = new RuleVo(); - BeanUtils.copyProperties(ruleInfo, ruleVo); - List tacticsOutputList = new ArrayList<>(); - if (difficulty == null || (difficulty != 1 && difficulty != 2 && difficulty != 3)) { - difficulty = ruleInfo.getDifficulty(); - } - switch (difficulty) { - case 1: - List list = ruleFieldInfoService.queryByRuleId(id); - tacticsOutputList = outputService.queryByTactics(new TacticsOutput(id, TacticsType.BASE_RULE)); - ruleVo.setTacticsOutputList(tacticsOutputList); - ruleVo.setRuleFieldList(list); - break; - case 2: - //查询版本 - List ruleVersionList = versionService.queryVersionListByRuleId(id); - ruleVo.setRuleVersionList(ruleVersionList); - break; - } - return ruleVo; - } - - - @Override - public PageInfo queryByEntity(RuleListParamV2 ruleListParam) { - - RuleInfo query = ruleListParam.getRuleInfo(); - Integer pageNum = ruleListParam.getPageNum(); - Integer pageSize = ruleListParam.getPageSize(); - if (query != null && query.getName() != null && !"".equals(query.getName())) { - query.setName("%" + query.getName() + "%"); - } - if (pageNum > 0 && pageSize > 0) { - PageHelper.startPage(pageNum, pageSize); - } - query.setOrganId(SessionManager.getLoginAccount().getOrganId()); - List ruleInfoList = ruleInfoMapper.queryRuleList(query); - PageInfo pageInfo = new PageInfo(ruleInfoList); - - //TODO 循环查用户表,待优化 - for (RuleInfo info : ruleInfoList) { - if (info != null && info.getAuthor() != null) { - info.setAuthorName(userMapper.findNickNameById(info.getAuthor())); - } - } - return pageInfo; - } - - - @Override - @Transactional - public RuleVo insertRuleInfo(RuleVo vo) { - Integer difficulty = vo.getDifficulty(); - if (difficulty == null) { - throw new ApiException(ErrorCodeEnum.PARAMS_EXCEPTION.getCode(), ErrorCodeEnum.PARAMS_EXCEPTION.getMessage()); - } - //初始化基本参数 - RuleVo ruleVo = initParam(vo); - //拷贝VO到Info对象 - RuleInfo ruleInfo = new RuleInfo(); - BeanUtils.copyProperties(ruleVo, ruleInfo); - if (difficulty == 1) { - ruleInfo.setContent(ruleFieldInfoService.assemblyRuleContent(vo, vo.getRuleFieldList())); - } - //插入并获取insert后实体对象返回id - boolean save = this.save(ruleInfo); - if (!save) { - throw new ApiException(ErrorCodeEnum.RULE_SAVE_ERROR.getCode(), ErrorCodeEnum.RULE_SAVE_ERROR.getMessage()); - } - Long ruleId = ruleInfo.getId(); - - switch (difficulty) { - case 1: - //插入子表(ruleField)数据 - ruleFieldInfoService.insertRuleField(vo.getRuleFieldList(), ruleId); - //插入子表自定义输出数据 - outputService.insertTacticsOutput(ruleId, ruleVo.getTacticsOutputList()); - break; - case 2: - //插入版本表数据 - List ruleVersionList = ruleVo.getRuleVersionList(); - if (ruleVersionList != null && ruleVersionList.size() > 0) { - for (RuleVersionVo ruleVersionVo : ruleVersionList) { - ruleVersionVo.setRuleId(ruleId); - } - versionService.addVersionList(ruleVersionList); - } - ruleVo.setRuleVersionList(versionService.queryVersionListByRuleId(vo.getId())); - break; - } - return ruleVo; - } - - /** - * 修改数据 - * - * @param vo 实例对象 - * @return 实例对象 - */ - @Override - @Transactional - public RuleVo updateRuleInfo(RuleVo vo) { - if (vo.getId() == null || vo.getDifficulty() == null) { - throw new ApiException(ErrorCodeEnum.PARAMS_EXCEPTION.getCode(), ErrorCodeEnum.PARAMS_EXCEPTION.getMessage()); - } - Integer difficulty = vo.getDifficulty(); - RuleInfo ruleInfo = new RuleInfo(); - BeanUtils.copyProperties(vo, ruleInfo); - //修改主表数据 - if (difficulty == 1) { - ruleInfo.setContent(ruleFieldInfoService.assemblyRuleContent(vo, vo.getRuleFieldList())); - } - boolean updateResult = this.updateById(ruleInfo); - if (!updateResult) { - throw new ApiException(ErrorCodeEnum.SERVER_ERROR.getCode(), ErrorCodeEnum.SERVER_ERROR.getMessage()); - } - Long ruleId = vo.getId(); - switch (difficulty) { - case 1: - outputService.updateTacticsOutput(ruleId, vo.getTacticsOutputList(), TacticsType.BASE_RULE); - //插入子表(ruleField)数据 - ruleFieldInfoService.updateRuleField(vo.getRuleFieldList(), ruleId); - break; - case 2: - List ruleVersionList = vo.getRuleVersionList(); - if (ruleVersionList != null && ruleVersionList.size() > 0) { - RuleVersionVo ruleVersionVo = ruleVersionList.get(0); - ruleVersionVo.setRuleId(vo.getId()); - versionService.updateVersion(ruleVersionVo); - } - vo.setRuleVersionList(versionService.queryVersionListByRuleId(ruleId)); - break; - } - return vo; - } - - /** - * 通过主键修改状态,支持批量 - * - * @param ids 主键id集合 - * @param status 状态代号 - * @return - */ - @Override - @Transactional - public boolean updateStatus(List ids, Integer status) { - LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); - wrapper.in(RuleInfo::getId, ids); - RuleInfo info = new RuleInfo(); - info.setStatus(status); - return this.update(info, wrapper); - } - - @Override - @Transactional - public boolean updateParent(List ids, Long parentId) { - LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); - wrapper.in(RuleInfo::getId, ids); - RuleInfo info = new RuleInfo(); - info.setParentId(parentId); - return this.update(info, wrapper); - } - - //唯一性检查 - private boolean checkUniqueness(RuleVo vo) { - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper(); - queryWrapper.eq(RuleInfo::getName, vo.getName()); - queryWrapper.ne(RuleInfo::getStatus, -1); - queryWrapper.eq(RuleInfo::getOrganId, SessionManager.getLoginAccount().getOrganId()); - queryWrapper.and(wrapper -> wrapper.eq(RuleInfo::getName, vo.getName()).or().eq(RuleInfo::getCode, vo.getCode())); - RuleInfo info = this.getOne(queryWrapper); - if (info != null) { - if (info.getCode().equals(vo.getCode())) { - throw new ApiException(ErrorCodeEnum.RULE_CODE_REPEAT.getCode(), ErrorCodeEnum.RULE_CODE_REPEAT.getMessage()); - } else if (info.getName().equals(vo.getName())) { - throw new ApiException(ErrorCodeEnum.RULE_NAME_REPEAT.getCode(), ErrorCodeEnum.RULE_NAME_REPEAT.getMessage()); - } - } - return true; - } - - //新插入数据的准备工作 - private RuleVo initParam(RuleVo vo) { - this.checkUniqueness(vo); - //加入用户信息 - User user = SessionManager.getLoginAccount(); - vo.setUserId(user.getUserId()); - vo.setOrganId(user.getOrganId()); - vo.setAuthor(user.getUserId()); - //加入状态信息 - vo.setType(RuleConst.TYPE_ORGAN); - vo.setStatus(RuleConst.STATUS_ENABLED); - //加入规则类型 - if (vo == null || vo.getRuleAudit() == null) { - throw new ApiException(ErrorCodeEnum.PARAMS_EXCEPTION.getCode(), ErrorCodeEnum.PARAMS_EXCEPTION.getMessage()); - } - switch (vo.getRuleAudit()) { - case RuleConst.RULE_AUDIT_TERMINATION: - vo.setRuleType(RuleConst.RULE_TYPE_TERMINATION); - break; - case RuleConst.RULE_AUDIT_SCORING: - vo.setRuleType(RuleConst.RULE_TYPE_SCORING); - break; - default: - vo.setRuleType(RuleConst.RULE_TYPE_TERMINATION); - } - - return vo; - } - - @Override - @Transactional - public UploadResponse upload(HttpServletRequest request) throws Exception { - MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request; - Iterator iter = multiRequest.getFileNames(); - //查出原有的规则内容 - List rules = ruleMapper.getAllCodeNameParentId(); - //将文件夹和code结合起来 - Set nameSet = new HashSet<>(); - //将文件夹和规则名结合起来 - Set codeSet = new HashSet<>(); - for (Rule rule : rules) { - codeSet.add(rule.getCode() + "/" + rule.getParentId()); - nameSet.add(rule.getName() + "/" + rule.getParentId()); - } - //重复的code集合 - Set rpCodeSet = new HashSet<>(); - //重复的名字集合 - Set rpNameSet = new HashSet<>(); - //重复行数 - int repeatRows = 0; - //失败行数 - int failRows = 0; - //成功行数 - int sucRows = 0; - //已存在行数 - int existRows = 0; - //总行数 - int total = 0; - //存放重复的list - List rpCodeList = new ArrayList(); - List rpNameList = new ArrayList(); - //已存在的list - List existCodeList = new ArrayList(); - List existNameList = new ArrayList(); - //文件夹不存在的List - List folderNotExistList = new ArrayList(); - - Map map = new HashMap(); - //处理excel - while (iter.hasNext()) { - MultipartFile file = multiRequest.getFile(iter.next().toString()); - boolean isXlsx = false; - String fileName = file.getOriginalFilename(); - - if (fileName.endsWith(".xlsx")) { - isXlsx = true; - } - InputStream input = file.getInputStream(); - Workbook wb = null; - //根据文件格式(2003或者2007)来初始化 - if (isXlsx) - wb = new XSSFWorkbook(input); - else - wb = new HSSFWorkbook(input); - Sheet sheet = wb.getSheetAt(0); -// POIFSFileSystem fs = new POIFSFileSystem(file.getInputStream()); -// HSSFWorkbook wb = new HSSFWorkbook(fs); -// Sheet Sheet = wb.getSheetAt(0); - User user = SessionManager.getLoginAccount(); - Long userId = user.getUserId(); - - if (sheet != null) { - try { - HashMap paramMap = new HashMap<>(); - paramMap.put("parentId", "0"); - paramMap.put("treeType", "0"); - paramMap.put("type", "1"); - List treeList = knowledgeTreeService.getTreeList(paramMap); - HashMap cache = new HashMap<>(); - Map folder = treeList.get(0); - List rlist = new ArrayList(); - //遍历excel,从第二行开始 即 rowNum=1,逐个获取单元格的内容,然后进行格式处理,最后插入数据库 - for (int rowNum = 1; rowNum <= sheet.getLastRowNum(); rowNum++) { - total++; - Row hssfRow = sheet.getRow(rowNum); - if (hssfRow == null || hssfRow.getCell(0) == null) { - continue; - } - RuleVo rule = new RuleVo(); - rule.setName(ExcelUtil.formatCell(hssfRow.getCell(1))); - rule.setCode(ExcelUtil.formatCell(hssfRow.getCell(2))); - rule.setDescription(ExcelUtil.formatCell(hssfRow.getCell(3))); - rule.setPriority(Integer.parseInt(ExcelUtil.formatCell(hssfRow.getCell(4)).replace(".0", ""))); - String folderName = ExcelUtil.formatCell(hssfRow.getCell(0)); - Long folderId = this.getFolderId(folder, cache, folderName); - - rule.setAuthor(userId); - rule.setUserId(userId); - rule.setOrganId(user.getOrganId()); - rule.setStatus(Status.ENABLED); - rule.setType(1); - rule.setRuleType(1); - rule.setRuleAudit(5); - rule.setScore(1); - rule.setDifficulty(1); - //如果未匹配成功则不插入, - if (folderId == 0L && (folderName != null || !"".equals(folderName))) { - failRows++; - folderNotExistList.add(folderName); - continue; - } - rule.setParentId(folderId); - //判断规则code和name是否重复 - if (rpCodeSet.contains(rule.getCode() + "/" + rule.getParentId())) { - repeatRows++; - rpCodeList.add(folderName + "/" + rule.getCode()); - continue; - } - if (rpNameSet.contains(rule.getName() + "/" + rule.getParentId())) { - repeatRows++; - rpNameList.add(folderName + "/" + rule.getName()); - continue; - } - //判断规则code和name是否在数据库中已存在 - if (codeSet.contains(rule.getCode() + "/" + rule.getParentId())) { - existRows++; - existCodeList.add(folderName + "/" + rule.getCode()); - continue; - } - if (nameSet.contains(rule.getName() + "/" + rule.getParentId())) { - existRows++; - existNameList.add(folderName + "/" + rule.getName()); - continue; - } - - String ruleFields = ExcelUtil.formatCell(hssfRow.getCell(5)); - rule.setLastLogical(this.checkLastLogical(ruleFields)); - ruleFields = this.removeLastLogical(ruleFields, rule.getLastLogical()); - rule.setRuleFieldList(this.handExcelDataForRuleField(ruleFields, userId)); - String ruleContents = ExcelUtil.formatCell(hssfRow.getCell(6)); -// rule.setRuleContentInfoList(this.handExcelDataForRuleContent(ruleContents, userId)); - rule.setTacticsOutputList(this.handExcelDataForRuleContent(ruleContents, userId)); - - rlist.add(rule); - rpCodeSet.add(rule.getCode() + "/" + rule.getParentId()); - rpNameSet.add(rule.getName() + "/" + rule.getParentId()); - } - map.put("existNameList", existNameList); - map.put("existCodeList", existCodeList); - map.put("rpCodeList", rpCodeList); - map.put("rpNameList", rpNameList); - map.put("folderNotExistList", folderNotExistList); - for (RuleVo rule : rlist) { - RuleVo vo = this.insertRuleInfo(rule); - if (vo != null) { - sucRows++; - } - } - } catch (Exception e) { - e.printStackTrace(); - return new UploadResponse(existRows, sucRows, repeatRows, failRows, total, map); - } - } - } - return new UploadResponse(existRows, sucRows, repeatRows, failRows, total, map); - } - - @Override - public List queryFieldEnByRuleId(Long ruleId) { - RuleInfo rule = this.getById(ruleId); - if (rule == null) { - return null; - } - Integer difficulty = rule.getDifficulty(); - //字段en - Set fieldEns = new HashSet<>(); - //字段id - Set fieldIds = new HashSet<>(); - if (difficulty != null) { - - List ruleFieldInfoList = ruleFieldInfoService.queryByRuleId(ruleId); - if (ruleFieldInfoList != null && ruleFieldInfoList.size() > 0) { - for (RuleFieldInfo ruleFieldInfo : ruleFieldInfoList) { - String fieldId = ruleFieldInfo.getFieldId(); - if (fieldId != null && fieldId.contains("|")) { - fieldEns.add(ruleFieldInfo.getFieldId().split("\\|")[1]); - } else { - fieldIds.add(Long.valueOf(ruleFieldInfo.getFieldId())); - } - } - } - for (Long fieldId : fieldIds) { - String fieldName = fieldMapper.findFieldNameById(fieldId); - fieldEns.add(fieldName); - } - } - return new ArrayList<>(fieldEns); - } - - - //获取文件夹id - private Long getFolderId(Map folder, Map cache, String folderName) { - //没有文件夹名称则为0 - if (folderName == null || "".equals(folderName)) { - return 0L; - } - //已经缓存则直接返回 - if (cache.containsKey(folderName)) { - return cache.get(folderName); - } - String[] split = folderName.split("/"); - //类型转换:处理老表格式问题 - if (folder.get("name") != null && folder.get("name").equals(split[0]) && split.length > 1) { - List children = JSON.parseArray(JSON.toJSONString(folder.get("children")), KnowledgeTree.class); - - //设置初始的父id为0; - Long parentId = 0L; - for (int i = 1; i < split.length; i++) { - KnowledgeTree knowledgeTree = checkFolderId(children, split[i]); - //未匹配成功,需要创建文件夹并且并且将children设置为null - if (knowledgeTree == null || knowledgeTree.getChildren() == null) { - //todo 报错未完成创建文件夹,先报异常 - children = null; -// throw new ApiException(ErrorCodeEnum.FOLDER_NOT_EXIST.getVersionCode(),folderName+"<-->文件夹不存在"); - break; - } else {//匹配成功直接替换 - children = Arrays.asList(knowledgeTree.getChildren()); - //记录父id,如果下次匹配失败则会根据这次返回的parentId来创建文件夹 - parentId = knowledgeTree.getId(); - } - //匹配到最后,返回id,并且将此文件夹名和对应id插入到cache中 - if (i == split.length - 1) { - cache.put(folderName, knowledgeTree.getId()); - return knowledgeTree.getId(); - } - } - } - return 0L; - } - - //验证是否匹配到文件夹 - private KnowledgeTree checkFolderId(List folderList, String folderName) { - if (folderList == null) { - return null; - } - for (KnowledgeTree knowledgeTree : folderList) { - if (folderName.equals(knowledgeTree.getName())) { - return knowledgeTree; - } - } - return null; - } - - //确定最后一个逻辑字符 - private String checkLastLogical(String ruleFields) { - String patternStr = "^(\\(+)"; - if (!ruleFields.matches(patternStr)) { - return "-1"; - } else { - String str = "(\\)+$)"; - Pattern pattern = Pattern.compile(str); - Matcher matcher = pattern.matcher(ruleFields); - if (matcher.find()) { - return matcher.group(0); - } - } - return "-1"; - } - - //删除条件中最后的括号部分 - private String removeLastLogical(String ruleFields, String lastLogical) { - if (lastLogical != null && !"".equals(lastLogical) && !lastLogical.equals("-1")) { - return ruleFields.substring(0, ruleFields.length() - lastLogical.length()); - } - return ruleFields; - } - - public List handExcelDataForRuleField(String ruleFields, Long userId) { - List ruleFieldList = new ArrayList(); - if (!StringUtil.isBlank(ruleFields)) { - String patten = "(\\)*)(&&|\\|\\|)"; - ruleFields = ruleFields.replaceAll("\\n", ""); - ruleFields = ruleFields.replaceAll(patten, "\n$1$2"); - String[] field = ruleFields.trim().split("\n"); - for (int i = 0; i < field.length; i++) { - String[] str = field[i].split("-"); - RuleFieldInfo ruleField = new RuleFieldInfo(); - ruleField.setLogical(str[0]); - ruleField.setField(str[1]); - ruleField.setOperator(str[2]); - ruleField.setFieldValue(str[3]); - Field fieldInfo = findByFieldCn(userId, ruleField.getField()); - ruleField.setFieldId(fieldInfo.getId() + "|" + fieldInfo.getFieldEn()); - ruleField.setValueType(fieldInfo.getValueType()); - - ruleFieldList.add(ruleField); - } - } - return ruleFieldList; - } - - public List handExcelDataForRuleContent(String ruleContents, Long userId) { - List tacticsOutputList = new ArrayList(); - if (!StringUtil.isBlank(ruleContents)) { - String[] content = ruleContents.trim().split("\n"); - for (int i = 0; i < content.length; i++) { - String[] str = content[i].split("="); - TacticsOutput tacticsOutput = new TacticsOutput(); - Field field = this.findByFieldCn(userId, str[0]); - tacticsOutput.setFieldId(field.getId()); - tacticsOutput.setFieldEn(field.getFieldEn()); - String fieldValue = str[1]; - Integer variableType = 1; - Pattern pattern = Pattern.compile("^(\\{)([\\s|\\S]+)(\\})$"); - Matcher matcher = pattern.matcher(fieldValue); - if (matcher.find()) { - Field field1 = this.findByFieldCn(userId, matcher.group(2).trim()); - fieldValue = field1.getId().toString() + "|" + field1.getFieldEn(); - variableType = 2; - } - tacticsOutput.setFieldValue(fieldValue); - tacticsOutput.setVariableType(variableType); - tacticsOutput.setTacticsType("base_rule"); - tacticsOutputList.add(tacticsOutput); - } - } - return tacticsOutputList; - } - - public Field findByFieldCn(Long userId, String fieldCn) { - Map fieldMap = new HashMap(); - fieldMap.put("userId", userId); - fieldMap.put("fieldCn", fieldCn); - Field field = fieldMapper.findByFieldCn(fieldMap); - return field; - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/impl/RuleVersionServiceImpl.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/impl/RuleVersionServiceImpl.java deleted file mode 100644 index f7b066a..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/rule/service/impl/RuleVersionServiceImpl.java +++ /dev/null @@ -1,228 +0,0 @@ -package com.risk.riskmanage.rule.service.impl; - -import com.alibaba.fastjson.JSON; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.risk.riskmanage.common.model.requestParam.StatusParam; -import com.risk.riskmanage.datamanage.mapper.FieldMapper; -import com.risk.riskmanage.rule.mapper.RuleVersionMapper; -import com.risk.riskmanage.rule.model.RuleConditionInfo; -import com.risk.riskmanage.rule.model.RuleVersion; -import com.risk.riskmanage.rule.model.vo.RuleConditionVo; -import com.risk.riskmanage.rule.model.vo.RuleVersionVo; -import com.risk.riskmanage.rule.service.RuleConditionService; -import com.risk.riskmanage.rule.service.RuleVersionService; -import com.risk.riskmanage.system.model.User; -import com.risk.riskmanage.tactics.consts.TacticsType; -import com.risk.riskmanage.tactics.model.TacticsOutput; -import com.risk.riskmanage.tactics.service.TacticsOutputService; -import com.risk.riskmanage.util.CustomValueUtils; -import com.risk.riskmanage.util.SessionManager; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -@Service -public class RuleVersionServiceImpl extends ServiceImpl implements RuleVersionService { - private Logger logger = LoggerFactory.getLogger(this.getClass()); - @Autowired - private RuleVersionMapper versionMapper; - @Autowired - private RuleConditionService conditionService; - @Autowired - private TacticsOutputService outputService; - @Autowired - private FieldMapper fieldMapper; - @Autowired - private ThreadPoolTaskExecutor threadPoolTaskExecutor; - - @Override - public RuleVersionVo queryById(Long id) { - RuleVersion ruleVersion = versionMapper.selectById(id); - RuleVersionVo result = new RuleVersionVo(); - if (ruleVersion==null){ - return result; - } - BeanUtils.copyProperties(ruleVersion,result); - //查询ruleCondition组装成树形结构 - RuleConditionVo ruleConditionVo = conditionService.queryByVersionId(id); - List tacticsOutputList = outputService.queryByTactics(new TacticsOutput(id, TacticsType.COMPLEX_RULE,TacticsType.OutType.SUCCESS_OUT)); - List failOutputList = outputService.queryByTactics(new TacticsOutput(id, TacticsType.COMPLEX_RULE,TacticsType.OutType.FAIL_OUT)); - result.setRuleConditionVo(ruleConditionVo); - result.setTacticsOutputList(tacticsOutputList); - result.setFailOutputList(failOutputList); - return result; - } - - @Override - public List queryVersionListByRuleId(Long RuleId) { - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(RuleVersion::getRuleId,RuleId); - queryWrapper.eq(RuleVersion::getStatus,1); - queryWrapper.orderByDesc(RuleVersion::getId); - List ruleVersionList = versionMapper.selectList(queryWrapper); - List ruleVersionVoList = new ArrayList<>(); - for (RuleVersion ruleVersion : ruleVersionList) { - RuleVersionVo versionVo = new RuleVersionVo(); - BeanUtils.copyProperties(ruleVersion,versionVo); - ruleVersionVoList.add(versionVo); - } - return ruleVersionVoList; - } - - @Override - public List queryFieldEnByVersionId(Long versionId) { - Set fieldEns= new HashSet<>(); - Set fieldIds= new HashSet<>(); - RuleConditionVo ruleConditionVo = conditionService.queryByVersionId(versionId); - List ruleConditionInfoList = conditionService.disassemble(ruleConditionVo, versionId, false); - for (RuleConditionInfo info : ruleConditionInfoList) { - if (info.getFieldEn()!=null&&info.getFieldType()!=1&&!info.getFieldEn().startsWith("%")){ - if (info.getFieldEn().contains(".")){ - fieldEns.add(info.getFieldEn().split("\\.")[0]); - } - else { - fieldEns.add(info.getFieldEn()); - } - }else if(info.getFieldId()!=null){ - fieldIds.add(info.getFieldId()); - } - if (info.getVariableType()!=null){ - if (info.getVariableType()==2&&info.getFieldValue()!=null&&!info.getFieldValue().contains("%")){ - fieldEns.add(info.getFieldValue()); - }else if (info.getVariableType()==3){ - fieldEns.addAll(CustomValueUtils.getFieldEnSet(info.getFieldValue())); - } - } - } - for (Long fieldId : fieldIds) { - String fieldName= fieldMapper.findFieldNameById(fieldId); - fieldEns.add(fieldName); - } - return new ArrayList<>(fieldEns); - } - - @Override - @Transactional - public int addVersionList(List versionList) { - int result = 0; - for (RuleVersionVo versionVo : versionList) { - boolean b = addVersion(versionVo); - if (b){ - result++; - } - } - return result; - } - - @Override - @Transactional - public boolean addVersion(RuleVersionVo version) { - User loginUser = SessionManager.getLoginAccount(); - version.setOrganId(loginUser.getOrganId()); - version.setCreateUserId(loginUser.getUserId()); - version.setUpdateUserId(loginUser.getUserId()); - version.setCreateTime(null); - version.setUpdateTime(null); - version.setStatus(1); - if (version.getVersionCode()==null){ - version.setVersionCode("V:0"); - } - if (version.getDescription()==null){ - version.setDescription("初始版本"); - } - int insert = versionMapper.insert(version); - if (insert>0){ - this.addVersionDetail(version); - this.saveSnapshot(version.getId()); - return true; - }else { - logger.error("新增规则版本失败{}",version); - } - return false; - } - @Transactional - public boolean addVersionDetail(RuleVersionVo version){ - RuleConditionVo ruleConditionVo = version.getRuleConditionVo(); - ruleConditionVo.setVersionId(version.getId()); - //添加条件信息 - conditionService.insertRuleCondition(ruleConditionVo,version.getRuleId()); - //添加输出字段 - List tacticsOutputList = version.getTacticsOutputList(); - if (tacticsOutputList!=null&&tacticsOutputList.size()>0){ - outputService.insertTacticsOutput(version.getId(),tacticsOutputList ); - } - List failOutputList = version.getFailOutputList(); - if (failOutputList!=null&&failOutputList.size()>0){ - outputService.insertTacticsOutput(version.getId(),failOutputList ); - } - return true; - } - - @Override - @Transactional - public boolean copyVersion(RuleVersionVo version) { - RuleVersionVo versionVo = this.queryById(version.getId()); - versionVo.setId(null); - versionVo.setVersionCode(version.getVersionCode()); - versionVo.setDescription(version.getDescription()); - return this.addVersion(versionVo); - } - - @Override - @Transactional - public boolean updateVersion(RuleVersionVo version) { - Long versionId = version.getId(); - if (versionId==null){ - return false; - } - User loginUser = SessionManager.getLoginAccount(); - version.setUpdateUserId(loginUser.getUserId()); - //修改版本主表 - versionMapper.updateById(version); - //修改条件表 - conditionService.updateRuleCondition(version.getRuleId(),version.getRuleConditionVo()); - //修改策略输出 - outputService.updateTacticsOutput(versionId,version.getTacticsOutputList(),version.getFailOutputList(),TacticsType.COMPLEX_RULE); - this.saveSnapshot(versionId); - return true; - } - - - @Override - @Transactional - public boolean updateStatus(StatusParam statusParam) { - LambdaQueryWrapper updateWrapper = new LambdaQueryWrapper<>(); - updateWrapper.in(RuleVersion::getId,statusParam.getIds()); - updateWrapper.eq(RuleVersion::getRuleId,statusParam.getTacticsId()); - RuleVersion ruleVersion = new RuleVersion(); - ruleVersion.setStatus(statusParam.getStatus()); - boolean update = this.update(ruleVersion, updateWrapper); - return update; - } - - - private boolean saveSnapshot(Long versionId){ - threadPoolTaskExecutor.execute(new Runnable() { - @Override - public void run() { - LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper<>(); - RuleVersionVo versionVo = queryById(versionId); - versionVo.setSnapshot(null); - wrapper.eq(RuleVersion::getId,versionId).set(RuleVersion::getSnapshot, JSON.toJSONString(versionVo)); - versionMapper.update(null,wrapper); - } - }); - return true; - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/spring/aop/ExceptionAop.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/spring/aop/ExceptionAop.java deleted file mode 100644 index 330f3e7..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/spring/aop/ExceptionAop.java +++ /dev/null @@ -1,113 +0,0 @@ -package com.risk.riskmanage.spring.aop; - -import com.alibaba.fastjson.JSONObject; -import com.risk.riskmanage.common.enums.ErrorCodeEnum; -import com.risk.riskmanage.common.exception.ApiException; -import com.risk.riskmanage.common.utils.ResponseEntityBuilder; -import com.risk.riskmanage.util.AccountSessionWrap; -import com.risk.riskmanage.util.RequestUtil; -import com.risk.riskmanage.util.SessionManager; -import org.aspectj.lang.ProceedingJoinPoint; -import org.aspectj.lang.annotation.Around; -import org.aspectj.lang.annotation.Aspect; -import org.aspectj.lang.reflect.MethodSignature; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.core.annotation.Order; -import org.springframework.stereotype.Component; -import org.springframework.web.context.request.RequestAttributes; -import org.springframework.web.context.request.RequestContextHolder; -import org.springframework.web.context.request.ServletRequestAttributes; -import org.springframework.web.multipart.MultipartRequest; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -/** - * 异常处理 - */ -@Order(1) -@Aspect -@Component -public class ExceptionAop { - private static final Logger logger = LoggerFactory.getLogger(ExceptionAop.class); - public static final String EDP = "execution(* com.risk.riskmanage.*.controller..*.*(..))"; - - /** - * 处理运行异常的切面 - */ - @Around(EDP) - public Object deal(ProceedingJoinPoint pjp) throws Throwable { - Object returnMessage = null; - Long beginTimeMills = System.currentTimeMillis(); - String className = pjp.getTarget().getClass().getName(); - String methodName = pjp.getSignature().getName(); - RequestAttributes ra = RequestContextHolder.getRequestAttributes(); - ServletRequestAttributes sra = (ServletRequestAttributes) ra; - HttpServletRequest request = sra.getRequest(); - String addIp = RequestUtil.getClientIP(request); - String requestMethod = request.getMethod(); - StringBuffer requestURL = request.getRequestURL(); - MethodSignature methodSignature = (MethodSignature) pjp.getSignature(); - - AccountSessionWrap session = SessionManager.getSession(); - Long userId = session.getUser() != null && session.getUser().getUserId() != null ? session.getUser().getUserId() : 0; - String reqUuid = null; - String argsWrap = null; - - try { - reqUuid = session.getTraceId(); - argsWrap = getParam(pjp.getArgs(), methodSignature.getParameterNames()); - logger.info("===>> 切面BEGIN: {} - {} {} enter {}.{} method, ### traceId:{} ###, request args: {}, userId:{} ===>>", - addIp, requestMethod, requestURL, className, methodName, reqUuid, argsWrap, userId); - returnMessage = pjp.proceed(); - } catch (ApiException e1) { - logger.info("方法[" + pjp.getSignature().getName() + "]发生业务异常Exception-{}", e1); - returnMessage = ResponseEntityBuilder.buildErrorResponse(e1.errCode, e1.message); - } catch (NullPointerException e2) { - logger.error("方法[" + pjp.getSignature().getName() + "]发生运行时异常NullPointerException-{}", e2); - returnMessage = ResponseEntityBuilder.buildErrorResponse(ErrorCodeEnum.NULL_POINT_EREXCEPTION.getCode(), ErrorCodeEnum.NULL_POINT_EREXCEPTION.getMessage()); - } catch (ClassCastException e2) { - logger.error("方法[" + pjp.getSignature().getName() + "]发生运行时异常ClassCastException-{}", e2); - returnMessage = ResponseEntityBuilder.buildErrorResponse(ErrorCodeEnum.CLASS_CAST_EXCEPTION.getCode(), ErrorCodeEnum.CLASS_CAST_EXCEPTION.getMessage()); - } catch (Exception e2) { - logger.error("方法[" + pjp.getSignature().getName() + "]发生运行时异常Exception-{}", e2); - returnMessage = ResponseEntityBuilder.buildErrorResponse(ErrorCodeEnum.SERVER_ERROR.getCode(), ErrorCodeEnum.SERVER_ERROR.getMessage()); - } catch (Throwable e) { - logger.error("方法[" + pjp.getSignature().getName() + "]发生运行时异常Throwable-{}", e); - returnMessage = ResponseEntityBuilder.buildErrorResponse(ErrorCodeEnum.SERVER_ERROR.getCode(), ErrorCodeEnum.SERVER_ERROR.getMessage()); - } - logger.info("<<==== 切面END: exit {}.{} method,### traceId:{}, userId:{}, cost time: {} ms ###, returnResult:{} <<====", - className, methodName, reqUuid, userId, (System.currentTimeMillis() - beginTimeMills), JSONObject.toJSONString(returnMessage)); - return returnMessage; - - } - - private String getParam(Object[] fieldValues, String[] filedNames) { - if (fieldValues == null - || fieldValues.length == 0 - || filedNames == null - || filedNames.length == 0 - || fieldValues.length != filedNames.length) { - return null; - } - StringBuffer stringBuffer = new StringBuffer(); - for (int i = 0; i < fieldValues.length; i++) { - if (fieldValues[i] instanceof HttpServletRequest - || fieldValues[i] instanceof MultipartRequest - || fieldValues[i] instanceof HttpServletResponse - || fieldValues[i] instanceof HttpSession) { - continue; - } - stringBuffer.append("{"); - if (i < filedNames.length) { - stringBuffer.append(filedNames[i]); - stringBuffer.append(":"); - } - stringBuffer.append(JSONObject.toJSONString(fieldValues[i])); - stringBuffer.append("},"); - } - return stringBuffer.toString(); - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/spring/interceptor/SessionInterceptor.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/spring/interceptor/SessionInterceptor.java deleted file mode 100644 index 710e870..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/spring/interceptor/SessionInterceptor.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.risk.riskmanage.spring.interceptor; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.risk.riskmanage.common.constants.Constants; -import com.risk.riskmanage.common.constants.ServiceFilterConstant; -import com.risk.riskmanage.common.enums.ErrorCodeEnum; -import com.risk.riskmanage.common.exception.ApiException; -import com.risk.riskmanage.common.model.ResponseEntityDto; -import com.risk.riskmanage.common.utils.ResponseEntityBuilder; -import com.risk.riskmanage.redis.RedisManager; -import com.risk.riskmanage.system.model.User; -import com.risk.riskmanage.util.AccountSessionWrap; -import com.risk.riskmanage.util.CommonUtil; -import com.risk.riskmanage.util.RequestUtil; -import com.risk.riskmanage.util.SessionManager; -import org.apache.commons.lang.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.OutputStream; - -/** - * 会话拦截器 - */ -@Component -public class SessionInterceptor extends HandlerInterceptorAdapter { - private Logger logger = LoggerFactory.getLogger(this.getClass()); - @Autowired - private RedisManager redisManager; - - @Override - public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { - String uri = request.getRequestURI(); - String ip = RequestUtil.getClientIP(request); - AccountSessionWrap acsw = new AccountSessionWrap(ip, uri); - String reqUuid = CommonUtil.getUUID(); - String requestMethod = request.getMethod(); - StringBuffer requestURL = request.getRequestURL(); - acsw.setTraceId(reqUuid); - String token = request.getHeader(Constants.SYSTEM_KEY_TOKEN); - logger.debug("===>> 【会话拦截】-BEGIN: {} - {} {}, ### traceId:{},{}, token:{} ### ===>>", ip, requestMethod, requestURL, reqUuid, uri, token); - SessionManager.setSession(acsw); - if (ServiceFilterConstant.isSessionFilter(uri)) { - return true; - } - if (StringUtils.isBlank(token)) { - output(response, ErrorCodeEnum.ERROR_TOKEN_EXPIRE.getCode(),ErrorCodeEnum.ERROR_TOKEN_EXPIRE.getMessage()); - return false; - } - - try { - String value = redisManager.get(token); - if(StringUtils.isBlank(value)){ - output(response, ErrorCodeEnum.ERROR_TOKEN_EXPIRE.getCode(),ErrorCodeEnum.ERROR_TOKEN_EXPIRE.getMessage()); - return false; - } - - // token更新频率,设置离过期时间还剩n秒以内才更新一次token - Long time = redisManager.ttl(token); - if(time.intValue() <= Constants.LOGIN_TOKEN_REFRESH_TIME.intValue()){ - redisManager.set(token, value, Constants.LOGIN_TOKEN_TIME.intValue()); - } - - User user = JSONObject.parseObject(value, User.class); - acsw.setUser(user); - } catch (ApiException e1) { - output(response, e1.errCode, e1.getMessage()); - return false; - } catch (Exception e) { - logger.error("【会话拦截】调用Token验证服务异常,uri:{},token:{},IP:{}",uri,token,ip,e); - output(response, ErrorCodeEnum.SERVER_ERROR.getCode(), ErrorCodeEnum.SERVER_ERROR.getMessage()); - return false; - } - - return true; - } - - private void output(HttpServletResponse response, String errCode, String errMsg) { - ResponseEntityDto ret = ResponseEntityBuilder.buildErrorResponse(errCode, errMsg); - try { - logger.info("【会话拦截】未通过,{\"errCode\":" + errCode + ",\"errMsg:\":" + errMsg + "}"); - response.setCharacterEncoding("UTF-8"); - response.setHeader("Content-Type", "application/json;charset=UTF-8"); - byte[] jsonBytes = JSON.toJSONBytes(ret); - OutputStream output = response.getOutputStream(); - output.write(jsonBytes); - output.flush(); - } catch (IOException e) { - logger.error("【会话拦截】输出响应报文异常!,{},{}",errCode,errMsg, e); - } - } -} \ No newline at end of file diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/controller/v2/LoginController.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/controller/v2/LoginController.java deleted file mode 100644 index 434a689..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/controller/v2/LoginController.java +++ /dev/null @@ -1,99 +0,0 @@ - -package com.risk.riskmanage.system.controller.v2; - -import com.alibaba.fastjson.JSONObject; -import com.risk.riskmanage.common.basefactory.BaseController; -import com.risk.riskmanage.common.constants.Constants; -import com.risk.riskmanage.common.constants.OpTypeConst; -import com.risk.riskmanage.common.enums.ErrorCodeEnum; -import com.risk.riskmanage.common.model.ResponseEntityDto; -import com.risk.riskmanage.common.utils.ResponseEntityBuilder; -import com.risk.riskmanage.logger.ArchivesLog; -import com.risk.riskmanage.redis.RedisManager; -import com.risk.riskmanage.system.model.User; -import com.risk.riskmanage.system.model.request.LoginInfoParam; -import com.risk.riskmanage.util.AccountSessionWrap; -import com.risk.riskmanage.util.MD5; -import com.risk.riskmanage.util.SessionManager; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -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.ResponseBody; - -import javax.servlet.http.HttpServletRequest; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -/** - * @apiDefine account 1. 账户 - */ -@Controller("loginControllerV2") -@RequestMapping("/v2/login/*") -public class LoginController extends BaseController{ - - @Autowired - private RedisManager redisManager; - - /** - * @api {POST} /v2/login/login 1.01. 用户登录 - * @apiGroup account - * @apiVersion 1.0.1 - * @apiParam {String} account 账号 - * @apiParam {String} password 密码 - * @apiSuccess {String} token 会话token - * @apiParamExample {json} Request: - * {"account":"admin","password":"123456"} - * @apiSuccessExample {json} Success-Response: - * {"status":"1","error":"00000000","msg":null,"data":{"token":"21fd6379df134ea590a462e4de1f6b33"}} - */ - @ResponseBody - @RequestMapping(value = "/login") - @ArchivesLog(operationType = OpTypeConst.LOGIN) - public ResponseEntityDto login(@RequestBody LoginInfoParam param) { - Map map = new HashMap<>(); - String account = param.getAccount(); - String password = param.getPassword(); - if(!("".equals(account)) && !("".equals(password))){ - User user = s.userService.selectLoginInfo(account.trim(), MD5.GetMD5Code(password)); - if(null != user && user.getStatus()==1){ - String token = UUID.randomUUID().toString().replaceAll("-", ""); - redisManager.set(token, JSONObject.toJSONString(user), Constants.LOGIN_TOKEN_TIME.intValue()); - map.put("token", token); - - AccountSessionWrap acsw = new AccountSessionWrap(null, null); - acsw.setUser(user); - SessionManager.setSession(acsw); - }else{ - return ResponseEntityBuilder.buildErrorResponse(ErrorCodeEnum.LOGIN_ERROR); - } - } - return ResponseEntityBuilder.buildNormalResponse(map); - } - - /** - * @api {POST} /v2/login/logout 1.02. 用户登出 - * @apiGroup account - * @apiVersion 1.0.1 - * @apiSuccess {String} status 状态: 1成功, 0失败 - * @apiParamExample {json} Request: - * {} - * @apiSuccessExample {json} Success-Response: - * {"status":"1","error":"00000000","msg":null,"data":null} - */ - @ResponseBody - @RequestMapping(value = "logout", method = RequestMethod.POST) - @ArchivesLog(operationType = OpTypeConst.LOGOUT) - public ResponseEntityDto logout(HttpServletRequest request) { - String token = request.getHeader(Constants.SYSTEM_KEY_TOKEN); - if(StringUtils.isNotBlank(token)){ - redisManager.del(token); - } - return ResponseEntityBuilder.buildNormalResponse(); - } - -} - diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/controller/v2/SysMenuController.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/controller/v2/SysMenuController.java deleted file mode 100644 index 5166dcc..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/controller/v2/SysMenuController.java +++ /dev/null @@ -1,423 +0,0 @@ -package com.risk.riskmanage.system.controller.v2; - -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.risk.riskmanage.common.basefactory.CcpBaseController; -import com.risk.riskmanage.common.constants.OpTypeConst; -import com.risk.riskmanage.common.enums.ErrorCodeEnum; -import com.risk.riskmanage.common.exception.ApiException; -import com.risk.riskmanage.common.model.BaseParam; -import com.risk.riskmanage.common.model.ResponseEntityDto; -import com.risk.riskmanage.common.utils.ResponseEntityBuilder; -import com.risk.riskmanage.engine.model.Engine; -import com.risk.riskmanage.logger.ArchivesLog; -import com.risk.riskmanage.system.model.SysMenu; -import com.risk.riskmanage.system.model.SysUser; -import com.risk.riskmanage.system.model.User; -import com.risk.riskmanage.system.model.response.SysMenuVo; -import com.risk.riskmanage.util.SessionManager; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.*; - -import java.util.*; - -@Controller("sysMenuControllerV2") -@RequestMapping("v2/sysMenu") -@ResponseBody -public class SysMenuController extends CcpBaseController { - - /** - * @api {POST} /v2/sysMenu/getMenuList 6.31. 获取资源列表 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiParam {Integer} pageNo 页数 - * @apiParam {Integer} pageSize 每页的条数 - * @apiSuccess {JSON} pager 分页信息 - * @apiSuccess {JSONArray} listMenu 资源列表 - * @apiSuccess (listMenu) {Long} id 资源编号 - * @apiSuccess (listMenu) {Long} userId 分配者 - * @apiSuccess (listMenu) {String} name 资源名称 - * @apiSuccess (listMenu) {String} versionCode 资源代号 - * @apiSuccess (listMenu) {String} url 资源路径 - * @apiSuccess (listMenu) {Long} parentId 父节点 - * @apiSuccess (listMenu) {String} des 资源描述 - * @apiSuccess (listMenu) {Long} birth 创建时间 - * @apiSuccess (listMenu) {String} icon 图标 - * @apiSuccess (listMenu) {Integer} sort 顺序(值越小优先级越高) - * @apiSuccess (listMenu) {Integer} status 状态:0停用,1启用, -1删除 - * @apiParamExample {json} 请求示例: - * {"pageNo":1,"pageSize":2} - * @apiSuccessExample {json} Success-Response: - * {"status":"1","error":"00000000","msg":null,"data":{"pager":{"pageNum":1,"pageSize":2,"size":2,"startRow":1,"endRow":2,"total":17,"pages":9,"list":null,"prePage":0,"nextPage":2,"isFirstPage":true,"isLastPage":false,"hasPreviousPage":false,"hasNextPage":true,"navigatePages":8,"navigatepageNums":[1,2,3,4,5,6,7,8],"navigateFirstPage":1,"navigateLastPage":8,"lastPage":8,"firstPage":1},"listMenu":[{"id":1,"userId":0,"name":"引擎管理","versionCode":"0001","url":"sysMenu/getChildMenu","parentId":0,"des":"引擎管理","birth":1498721562000,"icon":null,"sort":0,"status":1,"roleId":0,"checked":false,"chkDisabled":false,"hidden":false},{"id":2,"userId":0,"name":"规则管理","versionCode":"0002","url":"sysMenu/getChildMenu","parentId":0,"des":"规则管理","birth":1498807962000,"icon":"bb","sort":5,"status":1,"roleId":0,"checked":false,"chkDisabled":false,"hidden":false}]}} - */ - @RequestMapping(value = "getMenuList", method = RequestMethod.POST) - public ResponseEntityDto getMenuList(@RequestBody BaseParam baseParam) { - PageHelper.startPage(baseParam.getPageNo(),baseParam.getPageSize()); - // 获取所有菜单 - List listMenu = s.sysMenuService.getAllSysMenu(); - PageInfo pageInfo = new PageInfo(listMenu); - pageInfo.setList(null); - HashMap modelMap = new HashMap<>(); - modelMap.put("listMenu", listMenu); - modelMap.put("pager", pageInfo); - return ResponseEntityBuilder.buildNormalResponse(modelMap); - } - - /** - * @api {POST} /v2/sysMenu/save 6.32. 创建资源 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiParam {String} name 资源名称 - * @apiParam {String} versionCode 资源代号 - * @apiParam {String} url 资源路径 - * @apiParam {Long} parentId 父节点 - * @apiParam {String} des 资源描述 - * @apiParam {String} icon 图标 - * @apiParam {Integer} sort 顺序(值越小优先级越高) - * @apiSuccess {String} status 状态: 1成功, 0失败 - * @apiParamExample {json} 请求示例: - * {"name":"测试资源","versionCode":"0066","url":"testMenu","parentId":0,"des":"测试资源描述","icon":"el-icon-eleme","sort":2} - * @apiSuccessExample {json} Success-Response: - * {"status":"1","error":"00000000","msg":null,"data":1} - */ - @RequestMapping(value = "save", method = RequestMethod.POST) - @ArchivesLog(operationType = OpTypeConst.SAVE_SYS_MENU) - public ResponseEntityDto save(@RequestBody SysMenu sysMenu) { - List list = s.sysMenuService.validateMenuOnly(sysMenu); - if(list!=null&&list.size()>0){ - throw new ApiException(ErrorCodeEnum.CREATE_MENU_NAME_REPEAT.getCode(), ErrorCodeEnum.CREATE_MENU_NAME_REPEAT.getMessage()); - } - int num = s.sysMenuService.createSysMenu(sysMenu); - return ResponseEntityBuilder.buildNormalResponse(num); - } - - /** - * @api {POST} /v2/sysMenu/getMenuInfo/{id} 6.33. 获取资源详情 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiParam {Long} id 资源编号(url参数) - * @apiSuccess {Long} id 资源编号 - * @apiSuccess {Long} userId 分配者 - * @apiSuccess {String} name 资源名称 - * @apiSuccess {String} versionCode 资源代号 - * @apiSuccess {String} url 资源路径 - * @apiSuccess {Long} parentId 父节点 - * @apiSuccess {String} des 资源描述 - * @apiSuccess {Long} birth 创建时间 - * @apiSuccess {String} icon 图标 - * @apiSuccess {Integer} sort 顺序(值越小优先级越高) - * @apiSuccess {Integer} status 状态:0停用,1启用, -1删除 - * @apiParamExample {json} 请求示例: - * {} - * @apiSuccessExample {json} Success-Response: - * {"status":"1","error":"00000000","msg":null,"data":{"id":32,"userId":135,"name":"测试资源","versionCode":"0066","url":"testMenu","parentId":0,"des":"测试资源描述","birth":1616760174000,"icon":"el-icon-eleme","sort":2,"status":1,"roleId":0,"checked":false,"chkDisabled":false,"hidden":false}} - */ - @RequestMapping(value = "/getMenuInfo/{id}", method = RequestMethod.POST) - public ResponseEntityDto getMenuInfo(@PathVariable long id) { - SysMenu sysMenu = s.sysMenuService.findById(id); - return ResponseEntityBuilder.buildNormalResponse(sysMenu); - } - - /** - * @api {POST} /v2/sysMenu/update 6.34. 修改资源 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiParam {Long} id 资源编号 - * @apiParam {String} name 资源名称 - * @apiParam {String} versionCode 资源代号 - * @apiParam {String} url 资源路径 - * @apiParam {Long} parentId 父节点 - * @apiParam {String} des 资源描述 - * @apiParam {String} icon 图标 - * @apiParam {Integer} sort 顺序(值越小优先级越高) - * @apiSuccess {String} status 状态: 1成功, 0失败 - * @apiParamExample {json} 请求示例: - * {"id":32,"name":"测试资源1","versionCode":"0067","url":"testMenu","parentId":0,"des":"测试资源描述","icon":"el-icon-eleme","sort":5} - * @apiSuccessExample {json} Success-Response: - * {"status":"1","error":"00000000","msg":null,"data":1} - */ - @RequestMapping(value = "update", method = RequestMethod.POST) - @ArchivesLog(operationType = OpTypeConst.UPDATE_SYS_MENU) - public ResponseEntityDto update(@RequestBody SysMenu sysMenu) { - List list = s.sysMenuService.validateMenuOnly(sysMenu); - if(list!=null&&list.size()>0){ - throw new ApiException(ErrorCodeEnum.CREATE_MENU_NAME_REPEAT.getCode(), ErrorCodeEnum.CREATE_MENU_NAME_REPEAT.getMessage()); - } - int num = s.sysMenuService.updateSysMenu(sysMenu); - return ResponseEntityBuilder.buildNormalResponse(num); - } - - /** - * @api {POST} /v2/sysMenu/updateStatus 6.35. 资源删除 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiParam {Integer} status 状态:-1删除 - * @apiParam {String} ids 资源编号,逗号分隔 - * @apiSuccess {String} status 状态: 1成功, 0失败 - * @apiParamExample {json} 请求示例: - * {"status":-1,"ids":"26"} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":1} - */ - @RequestMapping(value = "updateStatus", method = RequestMethod.POST) -// @ArchivesLog(operationType = OpTypeConst.UPDATE_SYS_MENU_STATUS) - public ResponseEntityDto updateStatus(@RequestBody Map param) { - int status = (Integer) param.get("status"); - String ids = (String)param.get("ids"); - int num = 0; - List list = new ArrayList(); - - if (ids != "") { - String[] strs = ids.split(","); - for (int i = 0; i < strs.length; i++) { - list.add(Integer.parseInt(strs[i])); - } - } - - if (list != null && list.size() > 0) { - num = s.sysMenuService.updateStatus(status, list); - } - return ResponseEntityBuilder.buildNormalResponse(num); - } - - /** - * @api {POST} /v2/sysMenu/getTreeMenu 6.36. 新增/修改资源获取父节点树 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiParam {Integer} parentId 父节点Id - * @apiSuccess {String} status 状态: 1成功, 0失败 - * @apiParamExample {json} 请求示例: - * {"parentId":0} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":[{"id":22,"userId":0,"name":"模型管理","versionCode":"0007","url":"sysMenu/getChildMenu","parentId":0,"des":"模型管理","birth":1498980762000,"icon":null,"status":1,"roleId":0,"checked":false,"chkDisabled":false,"isHidden":false},{"id":23,"userId":0,"name":"数据源管理","versionCode":"0008","url":"sysMenu/getChildMenu","parentId":0,"des":"数据源管理","birth":1498984362000,"icon":null,"status":1,"roleId":0,"checked":false,"chkDisabled":false,"isHidden":false},{"id":24,"userId":0,"name":"黑白名单库管理","versionCode":"0009","url":"sysMenu/getChildMenu","parentId":0,"des":"黑白名单库管理","birth":1498987962000,"icon":null,"status":1,"roleId":0,"checked":false,"chkDisabled":false,"isHidden":false},{"id":25,"userId":0,"name":"评分卡管理","versionCode":"0010","url":"sysMenu/getChildMenu","parentId":0,"des":"评分卡管理","birth":1498897962000,"icon":null,"status":1,"roleId":0,"checked":false,"chkDisabled":false,"isHidden":false}]} - */ - @RequestMapping(value = "getTreeMenu", method = RequestMethod.POST) - public ResponseEntityDto getTreeMenu(@RequestBody Map param){ - long parentId = Long.valueOf(param.get("parentId").toString()); - List listMenu = s.sysMenuService.getAllValidMenu(); - if(listMenu!=null&&listMenu.size()>0){ - for(int i=0;i param){ - long roleId = Long.valueOf(param.get("roleId").toString()); - long organRoleId = 0; - List listAll = new ArrayList(); - //获取登录用户id - User user = SessionManager.getLoginAccount(); - long userId = user.getUserId(); - long orgId = user.getOrganId(); - //获取登录人角色id - SysUser sysUser = s.sysUserService.findRoleByUserId(userId); - if(sysUser!=null){ - organRoleId = sysUser.getSysRole().getId(); - } - //角色资源 - List listRoleMenu = s.sysMenuService.findTreeList(roleId); - if(orgId==1){ - //全部启用资源 - listAll = s.sysMenuService.getAllValidMenu(); - if(listAll!=null&&listAll.size()>0){ - for(int i=0;i 0) { - for (int j = 0; j < listRoleMenu.size(); j++) { - long id_j = listRoleMenu.get(j).getId(); - if (id_j == id_i) { - listAll.get(i).setChecked(true); - } - } - } - } - } - - }else{ - //公司资源 - listAll = s.sysMenuService.findTreeList(organRoleId); - if(listAll!=null&&listAll.size()>0){ - for(int i=0;i 0) { - for (int j = 0; j < listRoleMenu.size(); j++) { - long id_j = listRoleMenu.get(j).getId(); - if (id_j == id_i) { - listAll.get(i).setChecked(true); - } - } - } - } - } - } - return ResponseEntityBuilder.buildNormalResponse(listAll); - } - /** - * @api {POST} /v2/sysMenu/insertRoleMenu 6.38.1. 权限分配,保存、修改资源树 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiParam {Integer} roleId 角色编号 - * @apiParam {String} ids 资源编号,逗号分隔 - * @apiSuccess {String} status 状态: 1成功, 0失败 - * @apiParamExample {json} 请求示例: - * {"roleId":76,"ids":"1,18,2,15,3,16,17,4,11,12,19"} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":11} - */ - @RequestMapping(value = "insertRoleMenu", method = RequestMethod.POST) - @ArchivesLog(operationType = OpTypeConst.SAVE_OR_UPDATE_MENU_ROLE) - public ResponseEntityDto insertRoleMenu(@RequestBody Map param) { - long roleId = Long.valueOf(param.get("roleId").toString()); - String ids = (String)param.get("ids"); - int num = 0; - List list = new ArrayList(); - - if (ids != "") { - String[] strs = ids.split(","); - for (int i = 0; i < strs.length; i++) { - list.add(Integer.parseInt(strs[i])); - } - if (list != null && list.size() > 0) { - num = s.sysMenuService.insertRoleMenu(roleId, list); - } - }else{ - num = s.sysMenuService.deleteRoleMenu(roleId); - } - return ResponseEntityBuilder.buildNormalResponse(num); - } - - /** - * @api {POST} /v2/sysMenu/insertRoleEngine 6.38.2. 权限分配,保存、修改引擎树 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiParam {Integer} roleId 角色编号 - * @apiParam {String} ids 引擎Id,逗号分隔 - * @apiSuccess {String} status 状态: 1成功, 0失败 - * @apiParamExample {json} 请求示例: - * {"roleId":76,"ids":"1,1_217,11_217,111_217,112_217,1121_217,12_217,121_217,122_217,1221_217,123_217,1231_217,13_217,131_217,132_217,1321_217,133_217,1331_217,14_217,141_217,15_217,151_217"} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":22} - */ - @RequestMapping(value = "insertRoleEngine", method = RequestMethod.POST) - @ArchivesLog(operationType = OpTypeConst.SAVE_ROLE_ENGINE) - public ResponseEntityDto insertRoleEngine(@RequestBody Map param) { - long roleId = Long.valueOf(param.get("roleId").toString()); - String ids = (String)param.get("ids"); - int num = 0; - List list = new ArrayList(); - - if (ids != "") { - String[] strs = ids.split(","); - for (int i = 0; i < strs.length; i++) { - list.add(strs[i]); - } - if (list != null && list.size() > 0) { - num = s.sysMenuService.insertRoleEngine(roleId, list); - } - }else{ - num = s.sysMenuService.deleteRoleEngine(roleId); - //初始化公司管理员引擎权限: - Engine engineVo = new Engine(); - User user = SessionManager.getLoginAccount(); - long organId = user.getOrganId(); - //查询角色所在公司 - long organ_id = s.sysRoleService.getOrganByRoleId(roleId); - engineVo.setOrganId(organ_id); - if(organId==1){ - String idstr = "1,"; - List list_str = new ArrayList(); - - } - } - return ResponseEntityBuilder.buildNormalResponse(num); - } - - /** - * @api {POST} /v2/sysMenu/getMenus 6.39. 获取菜单信息 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiSuccess {String} status 状态: 1成功, 0失败 - * @apiParamExample {json} 请求示例: - * {} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":[{"title":"系统首页","index":"sysMenu/getChildMenu","icon":null,"subs":[]},{"title":"引擎列表","index":"sysMenu/getChildMenu","icon":"xx","subs":[]},{"title":"引擎管理","index":"sysMenu/getChildMenu","icon":null,"subs":[]},{"title":"指标管理","index":"sysMenu/getChildMenu","icon":null,"subs":[]},{"title":"规则管理","index":"sysMenu/getChildMenu","icon":"bb","subs":[]},{"title":"评分卡管理","index":"sysMenu/getChildMenu","icon":null,"subs":[]},{"title":"模型管理","index":"sysMenu/getChildMenu","icon":null,"subs":[]},{"title":"数据源管理","index":"sysMenu/getChildMenu","icon":null,"subs":[]},{"title":"黑白名单库管理","index":"sysMenu/getChildMenu","icon":null,"subs":[]},{"title":"系统管理","index":"sysMenu/getChildMenu","icon":null,"subs":[{"title":"用户管理","index":"sysUser/view","icon":null,"subs":[]},{"title":"角色管理","index":"sysRole/view","icon":"aa","subs":[]},{"title":"日志管理","index":"log/index","icon":null,"subs":[]}]}]} - */ - @RequestMapping(value = "getMenus", method = RequestMethod.POST) - public ResponseEntityDto getMenus(){ - List menuList = new ArrayList<>(); - User user = SessionManager.getLoginAccount(); - long orgId = user.getOrganId(); - long userId = user.getUserId(); - if(orgId==1){ - menuList = s.sysMenuService.getAllValidMenu(); - }else{ - long roleId = 0; - SysUser sysUser = s.sysUserService.findRoleByUserId(userId); - if(sysUser!=null){ - roleId = sysUser.getSysRole().getId(); - } - menuList = s.sysMenuService.findTreeList(roleId); - } - - long parentId = 0; - List result = recursionMenu(menuList, parentId); - - return ResponseEntityBuilder.buildNormalResponse(result); - } - - /** - * 递归获取子菜单 - * @param menuList - * @param parentId - * @return - */ - private List recursionMenu(List menuList, long parentId){ - List sysMenuVoList = new ArrayList<>(); - for(SysMenu sysMenu : menuList) { - if(sysMenu.getParentId() == parentId){ - SysMenuVo sysMenuVo = new SysMenuVo(); - sysMenuVo.setTitle(sysMenu.getName()); - sysMenuVo.setIndex(StringUtils.isBlank(sysMenu.getUrl()) ? UUID.randomUUID().toString() : sysMenu.getUrl()); - sysMenuVo.setIcon(sysMenu.getIcon()); - - List sysMenuVos = recursionMenu(menuList, sysMenu.getId()); - if(!sysMenuVos.isEmpty()){ - sysMenuVo.setSubs(sysMenuVos); - } - - sysMenuVoList.add(sysMenuVo); - } - } - return sysMenuVoList; - } - -} \ No newline at end of file diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/controller/v2/SysOrganizationController.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/controller/v2/SysOrganizationController.java deleted file mode 100644 index d698b44..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/controller/v2/SysOrganizationController.java +++ /dev/null @@ -1,194 +0,0 @@ -package com.risk.riskmanage.system.controller.v2; - -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.risk.riskmanage.common.basefactory.CcpBaseController; -import com.risk.riskmanage.common.constants.OpTypeConst; -import com.risk.riskmanage.common.enums.ErrorCodeEnum; -import com.risk.riskmanage.common.exception.ApiException; -import com.risk.riskmanage.common.model.BaseParam; -import com.risk.riskmanage.common.model.ResponseEntityDto; -import com.risk.riskmanage.common.utils.ResponseEntityBuilder; -import com.risk.riskmanage.logger.ArchivesLog; -import com.risk.riskmanage.system.model.SysOrganization; -import com.risk.riskmanage.system.model.User; -import com.risk.riskmanage.util.SessionManager; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.*; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Controller("sysOrganizationControllerV2") -@RequestMapping("v2/sysOrganization") -@ResponseBody -public class SysOrganizationController extends CcpBaseController{ - - /** - * @api {POST} /v2/sysOrganization/getOrganList 6.41. 获取组织列表 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiParam {Integer} pageNo 页数 - * @apiParam {Integer} pageSize 每页的条数 - * @apiSuccess {JSON} pager 分页信息 - * @apiSuccess {JSONArray} listOrgan 组织列表 - * @apiSuccess (listOrgan) {Long} id 组织编号 - * @apiSuccess (listOrgan) {String} name 组织名称 - * @apiSuccess (listOrgan) {String} versionCode 组织代号 - * @apiSuccess (listOrgan) {Integer} status 状态:0禁用,1启用 - * @apiSuccess (listOrgan) {String} author 创建者 - * @apiSuccess (listOrgan) {Long} birth 创建时间 - * @apiSuccess (listOrgan) {String} token 唯一标识 - * @apiParamExample {json} 请求示例: - * {"pageNo":1,"pageSize":2} - * @apiSuccessExample {json} Success-Response: - * {"status":"1","error":"00000000","msg":null,"data":{"listOrgan":[{"id":46,"name":"管理员","versionCode":"007","email":null,"telephone":null,"status":1,"author":"超级管理员","birth":1498722046000,"token":"4f15125c-93c0-43fb-9ed2-e0b92763fa3d"}],"pager":{"pageNum":1,"pageSize":2,"size":1,"startRow":1,"endRow":1,"total":1,"pages":1,"list":null,"prePage":0,"nextPage":0,"isFirstPage":true,"isLastPage":true,"hasPreviousPage":false,"hasNextPage":false,"navigatePages":8,"navigatepageNums":[1],"navigateFirstPage":1,"navigateLastPage":1,"lastPage":1,"firstPage":1}}} - */ - @RequestMapping(value = "getOrganList", method = RequestMethod.POST) - public ResponseEntityDto getOrganList(@RequestBody BaseParam baseParam){ - PageHelper.startPage(baseParam.getPageNo(), baseParam.getPageSize()); - List listOrgan = s.sysOrganizationService.getAllSysOrganization(); - PageInfo pageInfo = new PageInfo(listOrgan); - pageInfo.setList(null); - HashMap modelMap = new HashMap<>(); - modelMap.put("listOrgan", listOrgan); - modelMap.put("pager", pageInfo); - return ResponseEntityBuilder.buildNormalResponse(modelMap); - } - - /** - * @api {POST} /v2/sysOrganization/getAllValidOrgan 6.42. 获取所有已启用组织 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiSuccess {Long} id 组织编号 - * @apiSuccess {String} name 组织名称 - * @apiSuccess {String} versionCode 组织代号 - * @apiSuccess {Integer} status 状态:0禁用,1启用 - * @apiSuccess {String} author 创建者 - * @apiSuccess {Long} birth 创建时间 - * @apiSuccess {String} token 唯一标识 - * @apiParamExample {json} 请求示例: - * {} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":[{"id":46,"name":"管理员","versionCode":"007","email":null,"telephone":null,"status":1,"author":"超级管理员","birth":1498722046000,"token":"4f15125c-93c0-43fb-9ed2-e0b92763fa3d"},{"id":1,"name":"rik","versionCode":"0001","email":"123.com ","telephone":"1234567489","status":1,"author":"超级管理员","birth":1498721562000,"token":"6a6ea35e-aabe-4e64-bd98-dae304b10a21"}]} - */ - @RequestMapping(value = "getAllValidOrgan", method = RequestMethod.POST) - public ResponseEntityDto getAllValidOrgan(){ - List list = new ArrayList<>(); - User user = SessionManager.getLoginAccount(); - Long organId = user.getOrganId(); - if(organId.longValue() == 1){ - list = s.sysOrganizationService.getAllValidOrgan(); - } else { - SysOrganization sysOrganization = s.sysOrganizationService.findById(organId); - list.add(sysOrganization); - } - return ResponseEntityBuilder.buildNormalResponse(list); - } - - /** - * @api {POST} /v2/sysOrganization/save 6.43. 创建组织 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiParam {String} name 组织名称 - * @apiParam {String} versionCode 组织代号 - * @apiSuccess {String} status 状态: 1成功, 0失败 - * @apiParamExample {json} 请求示例: - * {"name":"测试公司","versionCode":"666"} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":1} - */ - @RequestMapping(value = "save", method = RequestMethod.POST) - @ArchivesLog(operationType = OpTypeConst.SAVE_ORGAN) - public ResponseEntityDto save(@RequestBody SysOrganization sysOrganization) { - //验证唯一性 - List list = s.sysOrganizationService.validateOrganOnly(sysOrganization); - if(list!=null&&list.size()>0){ - throw new ApiException(ErrorCodeEnum.CREATE_ORGAN_NAME_REPEAT.getCode(), ErrorCodeEnum.CREATE_ORGAN_NAME_REPEAT.getMessage()); - } - int num = s.sysOrganizationService.createSysOrganization(sysOrganization); - return ResponseEntityBuilder.buildNormalResponse(num); - } - - /** - * @api {POST} /v2/sysOrganization/getOrganInfo/{id} 6.44. 获取组织详情 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiParam {Long} id 组织编号(url参数) - * @apiSuccess {Long} id 组织编号 - * @apiSuccess {String} name 组织名称 - * @apiSuccess {String} versionCode 组织代号 - * @apiSuccess {Integer} status 状态:0禁用,1启用 - * @apiSuccess {String} author 创建者 - * @apiSuccess {Long} birth 创建时间 - * @apiSuccess {String} token 唯一标识 - * @apiParamExample {json} 请求示例: - * {} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":{"id":46,"name":"管理员","versionCode":"007","email":null,"telephone":null,"status":1,"author":"超级管理员","birth":1498722046000,"token":"4f15125c-93c0-43fb-9ed2-e0b92763fa3d"}} - */ - @RequestMapping(value = "/getOrganInfo/{id}", method = RequestMethod.POST) - public ResponseEntityDto getOrganInfo(@PathVariable long id){ - SysOrganization sysOrganization = s.sysOrganizationService.findById(id); - return ResponseEntityBuilder.buildNormalResponse(sysOrganization); - } - - /** - * @api {POST} /v2/sysOrganization/update 6.45. 修改组织 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiParam {Long} id 组织编号 - * @apiParam {String} name 组织名称 - * @apiParam {String} versionCode 组织代号 - * @apiSuccess {String} status 状态: 1成功, 0失败 - * @apiParamExample {json} 请求示例: - * {"id":47,"name":"测试公司2","versionCode":"666"} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":1} - */ - @RequestMapping(value = "update", method = RequestMethod.POST) - @ArchivesLog(operationType = OpTypeConst.UPDATE_ORGAN) - public ResponseEntityDto update(@RequestBody SysOrganization sysOrganization) { - //验证唯一性 - List list = s.sysOrganizationService.validateOrganOnly(sysOrganization); - if(list!=null&&list.size()>0){ - throw new ApiException(ErrorCodeEnum.CREATE_ORGAN_NAME_REPEAT.getCode(), ErrorCodeEnum.CREATE_ORGAN_NAME_REPEAT.getMessage()); - } - int num = s.sysOrganizationService.updateSysOrganization(sysOrganization); - return ResponseEntityBuilder.buildNormalResponse(num); - } - - /** - * @api {POST} /v2/sysOrganization/updateStatus 6.46. 组织停用、启用、删除 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiParam {Integer} status 状态:0停用,1启用, -1删除 - * @apiParam {String} ids 用户Id,逗号分隔 - * @apiSuccess {String} status 状态: 1成功, 0失败 - * @apiParamExample {json} 请求示例: - * {"status":0,"ids":"46"} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":1} - */ - @RequestMapping(value = "updateStatus", method = RequestMethod.POST) - @ArchivesLog(operationType = OpTypeConst.UPDATE_ORGAN_STATUS) - public ResponseEntityDto updateStates(@RequestBody Map param){ - int status = (Integer) param.get("status"); - String ids = (String)param.get("ids"); - int num = 0; - List list = new ArrayList(); - - if(ids!=""){ - String[] strs = ids.split(","); - for(int i=0;i0){ - num = s.sysOrganizationService.updateStatus(status,list); - } - return ResponseEntityBuilder.buildNormalResponse(num); - } -} \ No newline at end of file diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/controller/v2/SysRoleController.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/controller/v2/SysRoleController.java deleted file mode 100644 index 45a1736..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/controller/v2/SysRoleController.java +++ /dev/null @@ -1,225 +0,0 @@ -package com.risk.riskmanage.system.controller.v2; - -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.risk.riskmanage.common.basefactory.CcpBaseController; -import com.risk.riskmanage.common.constants.OpTypeConst; -import com.risk.riskmanage.common.enums.ErrorCodeEnum; -import com.risk.riskmanage.common.exception.ApiException; -import com.risk.riskmanage.common.model.BaseParam; -import com.risk.riskmanage.common.model.ResponseEntityDto; -import com.risk.riskmanage.common.utils.ResponseEntityBuilder; -import com.risk.riskmanage.logger.ArchivesLog; -import com.risk.riskmanage.system.model.SysRole; -import com.risk.riskmanage.system.model.User; -import com.risk.riskmanage.util.SessionManager; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.*; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Controller("sysRoleControllerV2") -@RequestMapping("v2/sysRole") -@ResponseBody -public class SysRoleController extends CcpBaseController{ - - /** - * @api {POST} /v2/sysRole/getRoleList 6.21. 获取角色列表 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiParam {Integer} pageNo 页数 - * @apiParam {Integer} pageSize 每页的条数 - * @apiSuccess {JSON} pager 分页信息 - * @apiSuccess {JSONArray} listRole 角色列表 - * @apiSuccess (listRole) {Integer} id 角色编号 - * @apiSuccess (listRole) {Integer} organId 组织编号 - * @apiSuccess (listRole) {String} roleName 角色名称 - * @apiSuccess (listRole) {String} author 创建者 - * @apiSuccess (listRole) {Long} birth 创建时间 - * @apiSuccess (listRole) {Integer} status 状态:0禁用,1启用 - * @apiParamExample {json} 请求示例: - * {"pageNo":1,"pageSize":2} - * @apiSuccessExample {json} Success-Response: - * {"status":"1","error":"00000000","msg":null,"data":{"listRole":[{"id":72,"organId":46,"roleName":"业务管理员","roleCode":null,"roleDesc":null,"author":"超级管理员","birth":1498725111000,"status":1},{"id":71,"organId":46,"roleName":"引擎管理员","roleCode":null,"roleDesc":null,"author":"超级管理员","birth":1498725103000,"status":1}],"pager":{"pageNum":1,"pageSize":2,"size":2,"startRow":1,"endRow":2,"total":3,"pages":2,"list":null,"prePage":0,"nextPage":2,"isFirstPage":true,"isLastPage":false,"hasPreviousPage":false,"hasNextPage":true,"navigatePages":8,"navigatepageNums":[1,2],"navigateFirstPage":1,"navigateLastPage":2,"firstPage":1,"lastPage":2}}} - */ - @RequestMapping(value = "/getRoleList", method = RequestMethod.POST) - public ResponseEntityDto getRoleList(@RequestBody BaseParam baseParam){ - List listRole = null; - //获取公司管理员所在公司 - User user = SessionManager.getLoginAccount(); - long organId = user.getOrganId(); - PageHelper.startPage(baseParam.getPageNo(),baseParam.getPageSize()); - if(organId==1){ - //获取所有未删除角色 - listRole = s.sysRoleService.getAllRoles(); - }else{ - //获取本公司未删除角色 - listRole = s.sysRoleService.getAllSysRole(organId); - } - PageInfo pageInfo = new PageInfo(listRole); - pageInfo.setList(null); - HashMap modelMap = new HashMap<>(); - modelMap.put("listRole", listRole); - modelMap.put("pager", pageInfo); - return ResponseEntityBuilder.buildNormalResponse(modelMap); - } - - /** - * @api {POST} /v2/sysRole/getAllValidRole 6.22. 根据公司获取所有启用角色 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiParam {Integer} organId 组织编号 - * @apiSuccess {Integer} id 角色编号 - * @apiSuccess {Integer} organId 组织编号 - * @apiSuccess {String} roleName 角色名称 - * @apiSuccess {String} author 创建者 - * @apiSuccess {Long} birth 创建时间 - * @apiSuccess {Integer} status 状态:0禁用,1启用 - * @apiParamExample {json} 请求示例: - * {"organId":46} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":[{"id":70,"organId":46,"roleName":"管理员","roleCode":null,"roleDesc":null,"author":"超级管理员","birth":1498724751000,"status":1},{"id":71,"organId":46,"roleName":"引擎管理员","roleCode":null,"roleDesc":null,"author":"超级管理员","birth":1498725103000,"status":1},{"id":72,"organId":46,"roleName":"业务管理员","roleCode":null,"roleDesc":null,"author":"超级管理员","birth":1498725111000,"status":1}]} - */ - @RequestMapping(value = "getAllValidRole", method = RequestMethod.POST) - public ResponseEntityDto getAllValidRole(@RequestBody Map param){ - String author = ""; - User user = SessionManager.getLoginAccount(); - Long orgId = user.getOrganId(); - if(orgId==1){ - author = "超级管理员"; - } - - long organId = orgId; - if(param.get("organId") != null){ - organId = Long.valueOf(param.get("organId").toString()); - } - List list = s.sysRoleService.getAllValidRole(organId,author); - return ResponseEntityBuilder.buildNormalResponse(list); - } - - /** - * @api {POST} /v2/sysRole/save 6.23. 创建角色 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiParam {Integer} organId 组织编号 - * @apiParam {String} roleName 角色名称 - * @apiSuccess {String} status 状态: 1成功, 0失败 - * @apiParamExample {json} 请求示例: - * {"organId":1,"roleName":"浏览者"} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":1} - */ - @RequestMapping(value = "save", method = RequestMethod.POST) - @ArchivesLog(operationType = OpTypeConst.SAVE_SYS_ROLE) - public ResponseEntityDto save(@RequestBody SysRole sysRole) { - //确保每个公司只能创建一个公司管理员 - User user = SessionManager.getLoginAccount(); - Long or_id = user.getOrganId(); - if(or_id==1){ - sysRole.setAuthor(user.getNickName()); - //查询公司管理员是否存在 - List list_role = s.sysRoleService.getOrganRoleByAuthor(sysRole); - if(list_role!=null&&list_role.size()>0){ - throw new ApiException(ErrorCodeEnum.CREATE_ROLE_ADMIN_REPEAT.getCode(), ErrorCodeEnum.CREATE_ROLE_ADMIN_REPEAT.getMessage()); - } - }else{ - sysRole.setAuthor(user.getNickName()); - } - //验证名称唯一性 - List list = s.sysRoleService.validateRoleOnly(sysRole); - if(list!=null&&list.size()>0){ - throw new ApiException(ErrorCodeEnum.CREATE_ROLE_NAME_REPEAT.getCode(), ErrorCodeEnum.CREATE_ROLE_NAME_REPEAT.getMessage()); - } - int num = s.sysRoleService.createSysRole(sysRole); - return ResponseEntityBuilder.buildNormalResponse(num); - } - - /** - * @api {POST} /v2/sysRole/getRoleInfo/{id} 6.24. 获取角色详情 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiParam {Long} id 角色编号(url参数) - * @apiSuccess {Integer} id 角色编号 - * @apiSuccess {Integer} organId 组织编号 - * @apiSuccess {String} roleName 角色名称 - * @apiSuccess {String} author 创建者 - * @apiSuccess {Long} birth 创建时间 - * @apiSuccess {Integer} status 状态:0禁用,1启用 - * @apiParamExample {json} 请求示例: - * {} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":{"id":76,"organId":46,"roleName":"浏览者","roleCode":null,"roleDesc":null,"author":"管理员","birth":1563634443000,"status":1}} - */ - @RequestMapping(value = "/getRoleInfo/{id}", method = RequestMethod.POST) - public ResponseEntityDto getRoleInfo(@PathVariable long id){ - SysRole sysrole = null; - //获取管理员所在公司 - User user = SessionManager.getLoginAccount(); - long organId = user.getOrganId(); - if(organId==1){ - sysrole = s.sysRoleService.findByAId(id); - }else{ - sysrole = s.sysRoleService.findById(id,organId); - } - return ResponseEntityBuilder.buildNormalResponse(sysrole); - } - - /** - * @api {POST} /v2/sysRole/update 6.25. 修改角色 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiParam {Integer} id 角色编号 - * @apiParam {Integer} organId 组织编号 - * @apiParam {String} roleName 角色名称 - * @apiSuccess {String} status 状态: 1成功, 0失败 - * @apiParamExample {json} 请求示例: - * {"id":77,"organId":1,"roleName":"浏览者2"} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":1} - */ - @RequestMapping(value = "update", method = RequestMethod.POST) - @ArchivesLog(operationType = OpTypeConst.UPDATE_SYS_ROLE) - public ResponseEntityDto update(@RequestBody SysRole sysRole) { - List list = s.sysRoleService.validateRoleOnly(sysRole); - if(list!=null&&list.size()>0){ - throw new ApiException(ErrorCodeEnum.CREATE_ROLE_NAME_REPEAT.getCode(), ErrorCodeEnum.CREATE_ROLE_NAME_REPEAT.getMessage()); - } - int num = s.sysRoleService.updateSysRole(sysRole); - return ResponseEntityBuilder.buildNormalResponse(num); - } - - /** - * @api {POST} /v2/sysRole/updateStatus 6.26. 角色停用、启用、删除 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiParam {Integer} status 状态:0停用,1启用, -1删除 - * @apiParam {String} ids 用户Id,逗号分隔 - * @apiSuccess {String} status 状态: 1成功, 0失败 - * @apiParamExample {json} 请求示例: - * {"status":0,"ids":"77"} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":1} - */ - @RequestMapping(value = "updateStatus", method = RequestMethod.POST) - @ArchivesLog(operationType = OpTypeConst.UPDATE_SYS_ROLE_STATUS) - public ResponseEntityDto updateStates(@RequestBody Map param){ - int status = (Integer) param.get("status"); - String ids = (String)param.get("ids"); - int num = 0; - List list = new ArrayList(); - - if(ids!=""){ - String[] strs = ids.split(","); - for(int i=0;i0){ - num = s.sysRoleService.updateStatus(status,list); - } - return ResponseEntityBuilder.buildNormalResponse(num); - } -} \ No newline at end of file diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/controller/v2/SysUserController.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/controller/v2/SysUserController.java deleted file mode 100644 index 13e5398..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/controller/v2/SysUserController.java +++ /dev/null @@ -1,236 +0,0 @@ -package com.risk.riskmanage.system.controller.v2; - -import com.github.pagehelper.PageHelper; -import com.github.pagehelper.PageInfo; -import com.risk.riskmanage.common.basefactory.BaseController; -import com.risk.riskmanage.common.constants.OpTypeConst; -import com.risk.riskmanage.common.enums.ErrorCodeEnum; -import com.risk.riskmanage.common.exception.ApiException; -import com.risk.riskmanage.common.model.BaseParam; -import com.risk.riskmanage.common.model.ResponseEntityDto; -import com.risk.riskmanage.common.utils.ResponseEntityBuilder; -import com.risk.riskmanage.logger.ArchivesLog; -import com.risk.riskmanage.system.model.SysUser; -import com.risk.riskmanage.system.model.User; -import com.risk.riskmanage.util.SessionManager; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.*; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * @apiDefine sysManager 6.系统管理 - */ -@Controller("sysUserControllerV2") -@RequestMapping("v2/sysUser") -@ResponseBody -public class SysUserController extends BaseController{ - - /** - * @api {POST} /v2/sysUser/getUserList 6.11. 获取用户列表 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiParam {Integer} pageNo 页数 - * @apiParam {Integer} pageSize 每页的条数 - * @apiSuccess {JSON} pager 分页信息 - * @apiSuccess {JSONArray} listUser 用户列表 - * @apiSuccess (listUser) {Long} id 用户Id - * @apiSuccess (listUser) {Long} organId 组织编号 - * @apiSuccess (listUser) {String} employeeId 员工编号 - * @apiSuccess (listUser) {String} account 账号 - * @apiSuccess (listUser) {String} nickName 姓名 - * @apiSuccess (listUser) {String} cellphone 手机号 - * @apiSuccess (listUser) {String} email 邮箱 - * @apiSuccess (listUser) {Integer} status 状态:0停用,1启用, -1删除 - * @apiSuccess (listUser) {String} author 创建人 - * @apiSuccess (listUser) {Long} birth 创建时间 - * @apiSuccess (listUser) {JSON} sysRole 角色信息 - * @apiSuccess (sysRole) {Long} id 角色编号 - * @apiSuccess (sysRole) {String} roleName 角色名称 - * @apiSuccess (listUser) {JSON} sysOrgan 公司信息 - * @apiSuccess (sysOrgan) {Long} id 组织编号 - * @apiSuccess (sysOrgan) {String} name 组织名称 - * @apiParamExample {json} 请求示例: - * {"pageNo":1,"pageSize":2} - * @apiSuccessExample {json} Success-Response: - * {"status":"1","error":"00000000","msg":null,"data":{"pager":{"pageNum":1,"pageSize":2,"size":2,"startRow":1,"endRow":2,"total":12,"pages":6,"list":null,"prePage":0,"nextPage":2,"isFirstPage":true,"isLastPage":false,"hasPreviousPage":false,"hasNextPage":true,"navigatePages":8,"navigatepageNums":[1,2,3,4,5,6],"navigateFirstPage":1,"navigateLastPage":6,"lastPage":6,"firstPage":1},"listUser":[{"id":149,"organId":46,"employeeId":"011","account":"rong360","password":"4m774i0~4m2&5n1c4i55296#2@1j010i","nickName":"rong","email":"11@qq.com","cellphone":"15222222222","qq":null,"latestTime":null,"latestIp":null,"status":1,"birth":1613801940000,"author":"超级管理员","sysRole":{"id":70,"organId":0,"roleName":"管理员","roleCode":null,"roleDesc":null,"author":null,"birth":null,"status":0},"sysOrgan":{"id":46,"name":"管理员","versionCode":null,"email":null,"telephone":null,"status":0,"author":null,"birth":null,"token":null}},{"id":148,"organId":46,"employeeId":"010","account":"yljr","password":"4m774i0~4m2&5n1c4i55296#2@1j010i","nickName":"yljr","email":"11@qq.com","cellphone":"15222222222","qq":null,"latestTime":null,"latestIp":null,"status":1,"birth":1613720093000,"author":"超级管理员","sysRole":{"id":70,"organId":0,"roleName":"管理员","roleCode":null,"roleDesc":null,"author":null,"birth":null,"status":0},"sysOrgan":{"id":46,"name":"管理员","versionCode":null,"email":null,"telephone":null,"status":0,"author":null,"birth":null,"token":null}}]}} - */ - @RequestMapping(value = "getUserList", method = RequestMethod.POST) - public ResponseEntityDto getUserList(@RequestBody BaseParam baseParam){ - SysUser sysUser = new SysUser(); - //获取登录人所在公司 - User user = SessionManager.getLoginAccount(); - long organId = user.getOrganId(); - sysUser.setOrganId(organId); - PageHelper.startPage(baseParam.getPageNo(), baseParam.getPageSize()); - List listUser = s.sysUserService.getAllUsers(sysUser); - PageInfo pageInfo = new PageInfo(listUser); - pageInfo.setList(null); - HashMap modelMap = new HashMap<>(); - modelMap.put("listUser", listUser); - modelMap.put("pager", pageInfo); - return ResponseEntityBuilder.buildNormalResponse(modelMap); - } - - /** - * @api {POST} /v2/sysUser/save 6.12. 创建用户 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiParam {Long} organId 组织编号 - * @apiParam {String} employeeId 员工编号 - * @apiParam {String} account 账号 - * @apiParam {String} nickName 姓名 - * @apiParam {String} cellphone 手机号 - * @apiParam {String} email 邮箱 - * @apiParam {JSON} sysRole 角色信息 - * @apiParam (sysRole) {Long} id 角色编号 - * @apiSuccess {String} status 状态: 1成功, 0失败 - * @apiParamExample {json} 请求示例: - * {"organId":46,"employeeId":"012","account":"testuser","nickName":"张三","email":"11@qq.com","cellphone":"15222222222","sysRole":{"id":71}} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":1} - */ - @RequestMapping(value = "save", method = RequestMethod.POST) - @ArchivesLog(operationType = OpTypeConst.SAVE_SYS_USER) - public ResponseEntityDto save(@RequestBody SysUser sysUser){ - String nickName = sysUser.getNickName(); - if(nickName.equals("超级管理员")){ - throw new ApiException(ErrorCodeEnum.CREATE_USER_NAME_ERROR.getCode(), ErrorCodeEnum.CREATE_USER_NAME_ERROR.getMessage()); - } - String account = sysUser.getAccount(); - sysUser.setAccount(account); - //验证唯一性 - List list = s.sysUserService.validateUserOnly(sysUser); - if(list!=null&&list.size()>0){ - throw new ApiException(ErrorCodeEnum.CREATE_USER_NAME_REPEAT.getCode(), ErrorCodeEnum.CREATE_USER_NAME_REPEAT.getMessage()); - } - long num = s.sysUserService.createSysUser(sysUser); - return ResponseEntityBuilder.buildNormalResponse(num); - } - - /** - * @api {POST} /v2/sysUser/getUserInfo/{id} 6.13. 获取用户详情 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiParam {Long} id 用户Id(url参数) - * @apiSuccess {Long} id 用户Id - * @apiSuccess {Long} organId 组织编号 - * @apiSuccess {String} employeeId 员工编号 - * @apiSuccess {String} account 账号 - * @apiSuccess {String} nickName 姓名 - * @apiSuccess {String} cellphone 手机号 - * @apiSuccess {String} email 邮箱 - * @apiSuccess {Integer} status 状态:0停用,1启用, -1删除 - * @apiSuccess {String} author 创建人 - * @apiSuccess {Long} birth 创建时间 - * @apiSuccess {JSON} sysRole 角色信息 - * @apiSuccess (sysRole) {Long} id 角色编号 - * @apiSuccess (sysRole) {String} roleName 角色名称 - * @apiSuccess {JSON} sysOrgan 公司信息 - * @apiSuccess (sysOrgan) {Long} id 组织编号 - * @apiSuccess (sysOrgan) {String} name 组织名称 - * @apiParamExample {json} 请求示例: - * {} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":{"id":149,"organId":46,"employeeId":"011","account":"rong360","password":"4m774i0~4m2&5n1c4i55296#2@1j010i","nickName":"rong","email":"11@qq.com","cellphone":"15222222222","qq":null,"latestTime":null,"latestIp":null,"status":1,"birth":1613801940000,"author":"超级管理员","sysRole":{"id":70,"organId":0,"roleName":"管理员","roleCode":null,"roleDesc":null,"author":null,"birth":null,"status":0},"sysOrgan":{"id":46,"name":null,"versionCode":null,"email":null,"telephone":null,"status":0,"author":null,"birth":null,"token":null}}} - */ - @RequestMapping(value = "/getUserInfo/{id}", method = RequestMethod.POST) - public ResponseEntityDto getUserInfo(@PathVariable long id) { - SysUser sysUser = new SysUser(); - sysUser.setId(id); - //获取用户所在公司 - User user = SessionManager.getLoginAccount(); - long organId = user.getOrganId(); - sysUser.setOrganId(organId); - SysUser result = s.sysUserService.findById(sysUser); - return ResponseEntityBuilder.buildNormalResponse(result); - } - - /** - * @api {POST} /v2/sysUser/update 6.14. 修改用户 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiParam {Long} id 用户Id - * @apiParam {Long} organId 组织编号 - * @apiParam {String} employeeId 员工编号 - * @apiParam {String} account 账号 - * @apiParam {String} nickName 姓名 - * @apiParam {String} cellphone 手机号 - * @apiParam {String} email 邮箱 - * @apiParam {JSON} sysRole 角色信息 - * @apiParam (sysRole) {Long} id 角色编号 - * @apiSuccess {String} status 状态: 1成功, 0失败 - * @apiParamExample {json} 请求示例: - * {"id":150,"organId":46,"employeeId":"012","account":"testuser2","nickName":"张三","email":"11@qq.com","cellphone":"15222222222","sysRole":{"id":72}} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":1} - */ - @RequestMapping(value = "update", method = RequestMethod.POST) - @ArchivesLog(operationType = OpTypeConst.UPDATE_SYS_USER) - public ResponseEntityDto update(@RequestBody SysUser sysUser) { - String account = sysUser.getAccount(); - sysUser.setAccount(account); - List list = s.sysUserService.validateUserOnly(sysUser); - if(list!=null&&list.size()>0){ - throw new ApiException(ErrorCodeEnum.CREATE_USER_NAME_REPEAT.getCode(), ErrorCodeEnum.CREATE_USER_NAME_REPEAT.getMessage()); - } - int num = s.sysUserService.updateSysUser(sysUser); - return ResponseEntityBuilder.buildNormalResponse(num); - } - - /** - * @api {POST} /v2/sysUser/updateStatus 6.15. 用户停用、启用、删除 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiParam {Integer} status 状态:0停用,1启用, -1删除 - * @apiParam {String} ids 用户Id,逗号分隔 - * @apiSuccess {String} status 状态: 1成功, 0失败 - * @apiParamExample {json} 请求示例: - * {"status":0,"ids":"150,151"} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":2} - */ - @RequestMapping(value = "updateStatus", method = RequestMethod.POST) - @ArchivesLog(operationType = OpTypeConst.UPDATE_SYS_USER_STATUS) - public ResponseEntityDto updateStatus(@RequestBody Map param){ - int status = (Integer) param.get("status"); - String ids = (String)param.get("ids"); - int num = 0; - List list = new ArrayList(); - - if(ids!=""){ - String[] strs = ids.split(","); - for(int i=0;i0){ - num = s.sysUserService.updateStates(status,list); - } - return ResponseEntityBuilder.buildNormalResponse(num); - } - - /** - * @api {POST} /v2/sysUser/updatePassword 6.16. 修改密码 - * @apiGroup sysManager - * @apiVersion 2.0.0 - * @apiParam {Long} id 用户Id - * @apiParam {String} password 新密码 - * @apiSuccess {String} status 状态: 1成功, 0失败 - * @apiParamExample {json} 请求示例: - * {"id":136,"password":"654321"} - * @apiSuccessExample {json} 成功返回数据示例: - * {"status":"1","error":"00000000","msg":null,"data":1} - */ - @RequestMapping(value = "updatePassword", method = RequestMethod.POST) - @ArchivesLog(operationType = OpTypeConst.UPDTE_PASSWORD) - public ResponseEntityDto updatePassword(@RequestBody SysUser sysUser){ - int num = s.sysUserService.updatePassword(sysUser); - return ResponseEntityBuilder.buildNormalResponse(num); - } - -} \ No newline at end of file diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/mapper/DepartmentMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/mapper/DepartmentMapper.java deleted file mode 100644 index c955fe3..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/mapper/DepartmentMapper.java +++ /dev/null @@ -1,25 +0,0 @@ - -package com.risk.riskmanage.system.mapper; - -import com.risk.riskmanage.common.mapper.BaseMapper; -import com.risk.riskmanage.system.model.Department; - -/** - * ClassName:DepartmentMapper
- * Description: 部门mapper.
- * @see - */ -public interface DepartmentMapper extends BaseMapper { - - /** - * isExist:(根据相应的条件判断是否存在重复值).
- * @return 返回行数 - */ - Integer isExist(Department department); - - /** - * deleteDept:(根据部门ids删除部门信息).
- */ - void deleteDept(Long []deletIds); -} - diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/mapper/MenuMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/mapper/MenuMapper.java deleted file mode 100644 index 65791f1..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/mapper/MenuMapper.java +++ /dev/null @@ -1,60 +0,0 @@ - -package com.risk.riskmanage.system.mapper; - -import java.util.List; - -import com.risk.riskmanage.common.mapper.BaseMapper; -import com.risk.riskmanage.system.model.Menu; - -/** - * ClassName:MenuMapper
- * Description: 菜单mapper.
- * @see - */ -public interface MenuMapper extends BaseMapper { - /** - * isExist:(根据相应的条件判断是否存在重复值).
- * @author wz - * @param menu 菜单实体类 - * @return 返回行数 - */ - Integer isExist(Menu menu); - - /** - * deleteRole:(根据菜单ids删除菜单信息).
- * @author wz - * @param deletIds 菜单ids - */ - void deleteMenu(Long []deletIds); - - /** - * selectByRole:(根据角色查询).
- * @author wz - * @param menu - * @return 查询的菜单类 - */ - List selectByRole(Menu menu); - - /** - * deleteMenuRole:(删除菜单角色关联表).
- * @author wz - * @param menu 菜单实体类 - */ - void deleteMenuRole(Menu menu); - - /** - * insertMenuRole:(添加菜单角色关联表).
- * @author wz - * @param menu 菜单实体类 - */ - void insertMenuRole(Menu menu); - - /** - * findUserMenuByUser:(根据登录用户名查询相应授权菜单列表).
- * @author wz - * @param loginName - * @return 根据登录用户名查询相应授权菜单列表 - */ - List findUserMenuByUser(String loginName); -} - diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/mapper/RoleMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/mapper/RoleMapper.java deleted file mode 100644 index 7f40884..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/mapper/RoleMapper.java +++ /dev/null @@ -1,30 +0,0 @@ - -package com.risk.riskmanage.system.mapper; - -import com.risk.riskmanage.system.model.Role; -import com.risk.riskmanage.common.mapper.BaseMapper; - - -/** - * ClassName:RoleMapper
- * Description: 角色管理mapper层.
- * @see - */ -public interface RoleMapper extends BaseMapper{ - - /** - * isExist:(根据相应的条件判断是否存在重复值).
- * @author wz - * @param role 角色实体类 - * @return 返回行数 - */ - Integer isExist(Role role); - - /** - * deleteRole:(根据角色ids删除角色信息).
- * @author wz - * @param deletIds 角色ids - */ - void deleteRole(Long []deletIds); -} - diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/mapper/SysMenuMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/mapper/SysMenuMapper.java deleted file mode 100644 index 96477ce..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/mapper/SysMenuMapper.java +++ /dev/null @@ -1,112 +0,0 @@ - -package com.risk.riskmanage.system.mapper; - -import java.util.List; -import java.util.Map; - -import org.apache.ibatis.annotations.Param; - -import com.risk.riskmanage.system.model.SysMenu; - - -public interface SysMenuMapper { - - /** - * 查询所有资源 - * @return - */ - public List getAllSysMenu(); - /** - * 查询单条资源 - * @param id - * @return - */ - public SysMenu findById(long id); - /** - * 新增资源 - * @param sysMenu - * @return - */ - public int createSysMenu(SysMenu sysMenu); - /** - * 修改资源 - * @param sysMenu - * @return - */ - public int updateSysMenu(SysMenu sysMenu); - /** - * 删除资源 - * @param id - * @return - */ - public int deleteSysMenu(long id); - - /** - * 修改资源状态 - * @param id - * @param idList - * @return - */ - public int updateStatus(@Param("status") int status, @Param("list") List list); - - /** - * 通过父节点查询子菜单 - * @param id - * @return - */ - public List findChildByParent(long parentId); - - /** - * 通过角色菜单关系表及父节点查询菜单 - */ - public List findRoleMenuByParent(@Param ("parentId")long parentId, @Param("roleId") long roleId); - - /** - * 保存角色菜单关系 - */ - public int insertRoleMenu(@Param("roleId") long roleId ,@Param("list") List list); - - /** - * 删除角色菜单关系(实现修改) - */ - public int deleteRoleMenu(long roleId); - /** - * 分配资源树 - * @param roleId - * @return - */ - public List findTreeList(long roleId); - /** - * 获取所有启用资源 - * @return - */ - public List getAllValidMenu(); - - /** - * 获取引擎资源树 - */ - public List> getEngineTree(long roleId); - - /** - * 保存引擎树 - */ - public int insertRoleEngine(@Param ("roleId") long roleId,@Param ("list") List list); - /** - * 删除引擎树(实现修改) - */ - public int deleteRoleEngine(long roleId); - - /** - * 验证唯一性 - */ - public List validateMenuOnly(SysMenu sysMenu); - /** - * 验证是否有查看菜单的权限 - */ - public List validatePermission(@Param("roleId")long roleId,@Param("url")String url); - /** - * 验证是否有该引擎的权限 - */ - public List> validateEnginePermission(@Param("roleId")long roleId,@Param("id_e") String id_e); - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/mapper/SysOrganizationMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/mapper/SysOrganizationMapper.java deleted file mode 100644 index c9b8369..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/mapper/SysOrganizationMapper.java +++ /dev/null @@ -1,59 +0,0 @@ - -package com.risk.riskmanage.system.mapper; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; - -import com.risk.riskmanage.system.model.SysOrganization; - - - -public interface SysOrganizationMapper { - /** - * 查询所有公司 - * @return - */ - public List getAllSysOrganization(); - /** - * 获取所有启用公司 - * @return - */ - public List getAllValidOrgan(); - /** - * 查询单个公司 - * @param id - * @return - */ - public SysOrganization findById(long id); - /** - * 创建公司 - * @param SysOrganization - * @return - */ - public int createSysOrganization(SysOrganization SysOrganization); - /** - * 修改组织 - * @param SysOrganization - * @return - */ - public int updateSysOrganization(SysOrganization SysOrganization); - /** - * 删除组织 - * @param id - * @return - */ - public int deleteSysOrganization(long id); - - /** - * 修改公司状态(停用/启用、删除) - * @param states - * @return - */ - public int updateStatus(@Param ("status") int status,@Param ("list") List list); - /** - * 验证唯一性 - */ - public List validateOrganOnly(SysOrganization SysOrganization); - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/mapper/SysRoleMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/mapper/SysRoleMapper.java deleted file mode 100644 index 915e860..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/mapper/SysRoleMapper.java +++ /dev/null @@ -1,91 +0,0 @@ - -package com.risk.riskmanage.system.mapper; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; - -import com.risk.riskmanage.system.model.SysRole; - - - -public interface SysRoleMapper { - /** - * 获取本组织所有角色 - * @return - */ - public List getAllSysRole(long organId); - /** - * 获取所有角色 - */ - public List getAllRoles(); - /** - * 获取本组织启用的角色 - * @param organId - * @return - */ - public List getAllValidRole(@Param("organId")long organId,@Param("author")String author); - /** - * 查询本组织的单个角色 - * @param id - * @return - */ - public SysRole findById(@Param("id") long id, @Param("organId") long organId); - /** - * 查询单个角色 - * @param id - * @return - */ - public SysRole findByAId(long id); - - /** - * 创建本组织角色 - * @param sysRole - * @return - */ - public int createSysRole(SysRole sysRole); - /** - * 修改本公司角色 - * @param sysRole - * @return - */ - public int updateSysRole(SysRole sysRole); - /** - * 删除本公司角色 - * @param id - * @return - */ - public int deleteSysRole(long id); - /** - * 创建公司管理员角色 - */ - public int createOrganRole(SysRole sysRole); - /** - * 修改角色状态(停用、启用、删除) - * @param id - * @param idList - * @return - */ - public int updateStatus(@Param("status") int status, @Param("list") List list); - /** - * 根据角色查询角色所在公司 - */ - public long getOrganByRoleId(long roleId); - - /** - * 验证角色唯一性 - */ - public List validateRoleOnly(SysRole sysRole); - /** - * 查询公司管理员角色id - */ - public List getOrganRoleByAuthor(SysRole sysRole); - /** - * 删除本公司所有角色 - */ - public int deleteAllRoles(long organId); - /** - * 删除多个公司的所有角色 - */ - public int deleteRolesByOrgans(@Param("status") Integer status,@Param("list")List list); -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/mapper/SysUserMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/mapper/SysUserMapper.java deleted file mode 100644 index 2efd2dd..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/mapper/SysUserMapper.java +++ /dev/null @@ -1,124 +0,0 @@ - -package com.risk.riskmanage.system.mapper; - -import java.util.List; - - -import org.apache.ibatis.annotations.Param; - -import com.risk.riskmanage.system.model.SysUser; - - - - - -public interface SysUserMapper { - /** - * 查询搜索用户 - */ - public List getAllUsers(SysUser sysUser); - /** - * 查询本组织单个用户 - * @param - * @return - */ - public SysUser findById(SysUser sysUser); - /** - * 创建本公司用户 - * @param sysUser - * @return - */ - public long createSysUser(SysUser sysUser); - /** - * 添加用户角色关系 - * @param userId - * @param roleId - * @return - */ - public int insertUserRole(@Param("userId") long userId, - @Param("roleId") long roleId, - @Param("organId") long organId); - /** - * 修改本公司用户 - * @param sysUser - * @return - */ - public int updateSysUser(SysUser sysUser); - /** - * 修改用户角色关系 - * @param sysUser - * @return - */ - public int updateUserRole(SysUser sysUser); - /** - * 删除本公司用户 - * @param id - * @return - */ - public int deleteSysUser(long id); - /** - * 修改用户状态(停用/启用/删除) - * @param states - * @return - */ - public int updateStates(@Param ("status") int status,@Param ("list") List list); - /** - * 通过用户id查询角色 - * @param userId - * @return - */ - public SysUser findRoleByUserId(long userId); - - /** - * 重置密码 - */ - public int resetPassword(SysUser sysUser); - - /** - * 修改密码 - */ - public int updatePassword(SysUser sysUser); - - /** - * 本公司账号员工编号唯一性 - */ - public List validateUserOnly(SysUser sysUser); - - /** - * 删除本公司的所有账号 - */ - public int deleteAllUser(long organId); - /** - * 删除本公司的用户角色关系 - */ - public int deleteAllUserRole(long organId); - /** - * 删除多个公司的所有账号 - */ - public int deleteUsersByOrgans(@Param("status")Integer status,@Param("list")List list); - /** - * 删除多个公司的用户角色关系 - */ - public int deleteUserRoleByOrgan(@Param("status")Integer status,@Param("list")List list); - /** - * 删除角色账号关联关系 - */ - public int deleteUserRoleById(long RoleId); - /** - * 查询本角色下的所有账号 - */ - public List getUserIdsByRoleId(long roleId); - /** - * 删除角色关联的所有账号 - */ - public int deleteUsersByIds(@Param("status") Integer status,@Param("list")List list); - - /** - * 批量删除角色账号关系 - */ - public int deleteBatchUserRole(@Param("status") Integer status,@Param("list")List list); - /** - * 批量查询角色关联的账号 - */ - public List getBatchUserIdsByRoleId(List list); -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/mapper/UserMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/mapper/UserMapper.java deleted file mode 100644 index a4675f9..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/mapper/UserMapper.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.risk.riskmanage.system.mapper; - -import com.risk.riskmanage.common.mapper.BaseMapper; -import com.risk.riskmanage.system.model.User; -import com.risk.riskmanage.system.model.UserRole; - -import java.util.List; -import java.util.Set; - -/** - * @ClassName: UserMapper
- * @Description: 后台用户管理mapper接口.
- */ -public interface UserMapper extends BaseMapper { - /** - * isExist:(根据相应的条件判断是否存在重复值).
- * - * @param user 用户实体类 - * @return 返回行数 - * @author wz - */ - Integer isExist(User user); - - /** - * selectLoginInfo:(用户登录判断).
- * - * @param user 用户实体类 - * @return User - * @author wz - */ - User selectLoginInfo(User user); - - /** - * deleteDept:(根据用户ids删除用户信息).
- * - * @param user 用户id - * @author wz - */ - void deleteUser(User user); - - /** - * insertUserRole:(增加记录到用户角色关系表).
- * - * @param userRolelist 用户角色关系list - * @author wz - */ - void insertUserRole(List userRolelist); - - /** - * deleteUserRole:(根据用户ids删除用户角色关联表信息).
- * - * @param deletIds 用户ids - * @author wz - */ - void deleteUserRole(Long[] deletIds); - - /** - * findUserMenuSet:(根据用户名获取所授权的菜单).
- * - * @param loginName - * @return 根据用户名获取所授权的菜单 - * @author wz - */ - Set findUserMenuSet(String loginName); - - User findUserById(Integer userId); - - String findNickNameById(Long id); - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/Department.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/Department.java deleted file mode 100644 index 8e9bb06..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/Department.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.risk.riskmanage.system.model; - -import java.io.Serializable; - -import com.risk.riskmanage.common.model.BasePage; - -/** - * ClassName:DepartmentVo
- * Description: 后台部门管理实体类.
- */ -public class Department extends BasePage implements Serializable { - - private static final long serialVersionUID = 1L; - /** - * 部门id - */ - private Long id; - /** - * 部门名称 - */ - private String deptName; - /** - * 部门编号 - */ - private String deptCode; - /** - * 部门排序 - */ - private Integer deptOrder; - /** - * 状态 - */ - private Integer status; - /** - * 创建人 - */ - private String creator; - /** - * 创建时间 - */ - private String createTime; - /** - * 最后修改人 - */ - private String updater; - /** - * 最后修改时间 - */ - private String updateTime; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getDeptName() { - return deptName; - } - - public void setDeptName(String deptName) { - this.deptName = deptName; - } - - public String getDeptCode() { - return deptCode; - } - - public void setDeptCode(String deptCode) { - this.deptCode = deptCode; - } - - public Integer getDeptOrder() { - return deptOrder; - } - - public void setDeptOrder(Integer deptOrder) { - this.deptOrder = deptOrder; - } - - public Integer getStatus() { - return status; - } - - public void setStatus(Integer status) { - this.status = status; - } - - public String getCreator() { - return creator; - } - - public void setCreator(String creator) { - this.creator = creator; - } - - public String getCreateTime() { - return createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } - - public String getUpdater() { - return updater; - } - - public void setUpdater(String updater) { - this.updater = updater; - } - - public String getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(String updateTime) { - this.updateTime = updateTime; - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/Menu.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/Menu.java deleted file mode 100644 index f97484c..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/Menu.java +++ /dev/null @@ -1,249 +0,0 @@ -package com.risk.riskmanage.system.model; - -import java.io.Serializable; -import java.util.Arrays; - -import com.risk.riskmanage.common.model.BasePage; - -/** - * ClassName:MenuVo
- * Description: 系统菜单管理界面.
- */ -public class Menu extends BasePage implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 菜单主键id - */ - private Long id; - /** - * 父id - */ - private Long pid; - /** - * 菜单名称 - */ - private String name; - /** - * 菜单类型 - */ - private Integer type; - /** - * 菜单顺序 - */ - private Integer muneOrder; - /** - * easyui展开 - */ - private String state; - /** - * 菜单链接 - */ - private String url; - /** - * 菜单编号 - */ - private String menuCode; - /** - * 菜单图标 - */ - private String icon; - /** - * 菜单描述 - */ - private String description; - /** - * 菜单状态 - */ - private Integer status; - /** - * 创建人 - */ - private String creator; - /** - * 创建时间 - */ - private String createTime; - /** - * 最后修改人 - */ - private String updater; - /** - * 最后修改时间 - */ - private String updateTime; - - /** - * 父类 - */ - private Long _parentId; - - /** - * 角色编码 - */ - private String roleCode; - - /** - * 删除ids数组 - */ - private Long []deletIds; - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public Long[] getDeletIds() { - return deletIds; - } - - public void setDeletIds(Long[] deletIds) { - this.deletIds = deletIds; - } - - public String getRoleCode() { - return roleCode; - } - - public void setRoleCode(String roleCode) { - this.roleCode = roleCode; - } - - public Long get_parentId() { - return _parentId; - } - - public void set_parentId(Long _parentId) { - this._parentId = _parentId; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public Long getPid() { - return pid; - } - - public void setPid(Long pid) { - this.pid = pid; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Integer getType() { - return type; - } - - public void setType(Integer type) { - this.type = type; - } - - public Integer getMuneOrder() { - return muneOrder; - } - - public void setMuneOrder(Integer muneOrder) { - this.muneOrder = muneOrder; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getMenuCode() { - return menuCode; - } - - public void setMenuCode(String menuCode) { - this.menuCode = menuCode; - } - - public String getIcon() { - return icon; - } - - public void setIcon(String icon) { - this.icon = icon; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Integer getStatus() { - return status; - } - - public void setStatus(Integer status) { - this.status = status; - } - - public String getCreator() { - return creator; - } - - public void setCreator(String creator) { - this.creator = creator; - } - - public String getCreateTime() { - return createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } - - public String getUpdater() { - return updater; - } - - public void setUpdater(String updater) { - this.updater = updater; - } - - public String getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(String updateTime) { - this.updateTime = updateTime; - } - - @Override - public String toString() { - return "Menu [id=" + id + ", pid=" + pid + ", name=" + name + ", type=" - + type + ", muneOrder=" + muneOrder + ", state=" + state - + ", url=" + url + ", menuCode=" + menuCode + ", icon=" + icon - + ", description=" + description + ", status=" + status - + ", creator=" + creator + ", createTime=" + createTime - + ", updater=" + updater + ", updateTime=" + updateTime - + ", _parentId=" + _parentId + ", roleCode=" + roleCode - + ", deletIds=" + Arrays.toString(deletIds) + "]"; - } - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/MenuJson.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/MenuJson.java deleted file mode 100644 index 9f2856d..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/MenuJson.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.risk.riskmanage.system.model; - -import java.util.List; - -/** - * ClassName:MenuJson
- * Description: 转化成前端需要菜单实体类.
- */ -public class MenuJson { - - private String menuid; - private String icon; - private String menuname; - private String url; - private List menus; - - public String getMenuid() { - return menuid; - } - - public void setMenuid(String menuid) { - this.menuid = menuid; - } - - public String getIcon() { - return icon; - } - - public void setIcon(String icon) { - this.icon = icon; - } - - public String getMenuname() { - return menuname; - } - - public void setMenuname(String menuname) { - this.menuname = menuname; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public List getMenus() { - return menus; - } - - public void setMenus(List menus) { - this.menus = menus; - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/Pager.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/Pager.java deleted file mode 100644 index c298da1..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/Pager.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.risk.riskmanage.system.model; - -public class Pager { - - private int rows = 10; - private int totalResult; - private int page; - - private String sortField; - private String order; - - public Pager() { - } - - public Pager(int totalResult) { - this.totalResult = totalResult; - } - - public int getRows() { - return rows; - } - - public void setRows(int rows) { - this.rows = rows; - } - - public int getPage() { - return page; - } - - public void setPage(int page) { - this.page = page; - } - - public int getTotalPage() { - return (totalResult + rows - 1) / rows; - } - - public int getTotalResult() { - return totalResult; - } - - public void setTotalResult(int totalResult) { - this.totalResult = totalResult; - } - - public int getCurrentResult() { - if (page == 0) return 0; - else return (page - 1) * rows; - } - - public String getSortField() { - return sortField; - } - - public void setSortField(String sortField) { - this.sortField = sortField; - } - - public String getOrder() { - return order; - } - - public void setOrder(String order) { - this.order = order; - } - - public int getPageCount() { - int pagecount = 0; - if (totalResult % rows == 0) { - pagecount = totalResult / rows; - } else { - pagecount = totalResult / rows + 1; - } - return pagecount; - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/Role.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/Role.java deleted file mode 100644 index 3e99a36..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/Role.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.risk.riskmanage.system.model; - -import java.io.Serializable; - -import com.risk.riskmanage.common.model.BasePage; - -/** - * ClassName:RoleVo
- * Description: 角色实体类.
- */ -public class Role extends BasePage implements Serializable { - private static final long serialVersionUID = 1L; - - /** - * 主键id - */ - private Long id; - /** - * 角色名称 - */ - private String name; - /** - * 角色编码 - */ - private String roleCode; - /** - * 角色描述 - */ - private String descripttion; - /** - * 状态 - */ - private Integer status; - /** - * 创建人 - */ - private String creator; - /** - * 创建时间 - */ - private String createTime; - /** - * 最后修改人 - */ - private String updater; - /** - * 最后修改时间 - */ - private String updateTime; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getRoleCode() { - return roleCode; - } - - public void setRoleCode(String roleCode) { - this.roleCode = roleCode; - } - - public String getDescripttion() { - return descripttion; - } - - public void setDescripttion(String descripttion) { - this.descripttion = descripttion; - } - - public Integer getStatus() { - return status; - } - - public void setStatus(Integer status) { - this.status = status; - } - - public String getCreator() { - return creator; - } - - public void setCreator(String creator) { - this.creator = creator; - } - - public String getCreateTime() { - return createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } - - public String getUpdater() { - return updater; - } - - public void setUpdater(String updater) { - this.updater = updater; - } - - public String getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(String updateTime) { - this.updateTime = updateTime; - } - - @Override - public String toString() { - return "Role [id=" + id + ", name=" + name + ", roleCode=" + roleCode - + ", descripttion=" + descripttion + ", status=" + status - + ", creator=" + creator + ", createTime=" + createTime - + ", updater=" + updater + ", updateTime=" + updateTime + "]"; - } - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/SysMenu.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/SysMenu.java deleted file mode 100644 index 57103e5..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/SysMenu.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.risk.riskmanage.system.model; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; - -import java.io.Serializable; -import java.util.Date; - -@Data -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = false) -public class SysMenu implements Serializable { - - private static final long serialVersionUID = -1L; - - private long id; - private long userId;//分配者 - private String name; //资源名称 - private String code;//资源代号 - private String url;//路径 - private long parentId;//父节点 - private String des; - private Date birth;//创建时间 - private String icon;//图标 - private Integer sort; // 菜单顺序 - private int status;//状态 - private long roleId;//角色id - private boolean checked;//菜单默认选中 - private boolean chkDisabled;//节点是否禁用 - private boolean isHidden;//节点是否隐藏 - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/SysOrganization.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/SysOrganization.java deleted file mode 100644 index ee1d046..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/SysOrganization.java +++ /dev/null @@ -1,89 +0,0 @@ - -package com.risk.riskmanage.system.model; - -import java.io.Serializable; -import java.util.Date; - - - -public class SysOrganization implements Serializable { - - private static final long serialVersionUID = -1L; - - private long id;//组织编号 - private String name;//组织名称 - private String code;//组织代号 - private String email; - private String telephone; - private int status;//0禁用1启用 - private String author;//创建者 - private Date birth;//创建时间 - private String token;//唯一标识 - - - - public String getToken() { - return token; - } - public void setToken(String token) { - this.token = token; - } - public String getAuthor() { - return author; - } - public void setAuthor(String author) { - this.author = author; - } - public long getId() { - return id; - } - public void setId(long id) { - this.id = id; - } - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public String getCode() { - return code; - } - public void setCode(String code) { - this.code = code; - } - public String getEmail() { - return email; - } - public void setEmail(String email) { - this.email = email; - } - public String getTelephone() { - return telephone; - } - public void setTelephone(String telephone) { - this.telephone = telephone; - } - public int getStatus() { - return status; - } - public void setStatus(int status) { - this.status = status; - } - public Date getBirth() { - return birth; - } - public void setBirth(Date birth) { - this.birth = birth; - } - @Override - public String toString() { - return "SysOrganization [id=" + id + ", name=" + name + ", versionCode=" + code - + ", email=" + email + ", telephone=" + telephone + ", status=" - + status + ", author=" + author + ", birth=" + birth - + ", token=" + token + "]"; - } - - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/SysRole.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/SysRole.java deleted file mode 100644 index 13a5124..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/SysRole.java +++ /dev/null @@ -1,83 +0,0 @@ - -package com.risk.riskmanage.system.model; - -import java.io.Serializable; -import java.util.Date; - - - -public class SysRole implements Serializable { - - private static final long serialVersionUID = -1L; - - private long id; - private long organId; - private String roleName; - private String roleCode;//角色代号 - private String roleDesc; - private String author;//创建者 - private Date birth;//创建时间 - private int status; //状态0禁用1启用 - - - - - public String getAuthor() { - return author; - } - public void setAuthor(String author) { - this.author = author; - } - public Date getBirth() { - return birth; - } - public void setBirth(Date birth) { - this.birth = birth; - } - public long getOrganId() { - return organId; - } - public void setOrganId(long organId) { - this.organId = organId; - } - public long getId() { - return id; - } - public void setId(long id) { - this.id = id; - } - public String getRoleName() { - return roleName; - } - public void setRoleName(String roleName) { - this.roleName = roleName; - } - public String getRoleCode() { - return roleCode; - } - public void setRoleCode(String roleCode) { - this.roleCode = roleCode; - } - public String getRoleDesc() { - return roleDesc; - } - public void setRoleDesc(String roleDesc) { - this.roleDesc = roleDesc; - } - public int getStatus() { - return status; - } - public void setStatus(int status) { - this.status = status; - } - @Override - public String toString() { - return "SysRole [id=" + id + ", organId=" + organId + ", roleName=" - + roleName + ", roleCode=" + roleCode + ", roleDesc=" + roleDesc - + ", author=" + author + ", birth=" + birth + ", status=" - + status + "]"; - } - - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/SysSuccess.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/SysSuccess.java deleted file mode 100644 index dc40640..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/SysSuccess.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.risk.riskmanage.system.model; - -public class SysSuccess { - - private boolean success; - private String msg; - - public SysSuccess() { - } - - public SysSuccess(boolean value, String msg) { - super(); - this.success = value; - this.msg = msg; - } - - public boolean getSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public String getMsg() { - return msg; - } - - public void setMsg(String msg) { - this.msg = msg; - } - - @Override - public String toString() { - return "SysSuccess [success=" + success + ", msg=" + msg + "]"; - } - - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/SysUser.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/SysUser.java deleted file mode 100644 index 3d09363..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/SysUser.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.risk.riskmanage.system.model; - -import java.io.Serializable; -import java.util.Date; - -public class SysUser implements Serializable { - - private static final long serialVersionUID = -1L; - - private long id;//用户(主键) - private long organId;//组织编号 - private String employeeId;//员工编号 - private String account;//账户 - private String password; - private String nickName;//昵称 - private String email; - private String cellphone; - private String qq; - private String latestTime; - private String latestIp; - private int status; - private Date birth;//创建时间 - private String author;//创建人 - private SysRole sysRole;//角色对象 - private SysOrganization sysOrgan;//公司对象 - - - - - - public SysOrganization getSysOrgan() { - return sysOrgan; - } - public void setSysOrgan(SysOrganization sysOrgan) { - this.sysOrgan = sysOrgan; - } - public String getAuthor() { - return author; - } - public void setAuthor(String author) { - this.author = author; - } - public String getEmployeeId() { - return employeeId; - } - public void setEmployeeId(String employeeId) { - this.employeeId = employeeId; - } - public long getId() { - return id; - } - public void setId(long id) { - this.id = id; - } - public long getOrganId() { - return organId; - } - public void setOrganId(long organId) { - this.organId = organId; - } - public String getAccount() { - return account; - } - public void setAccount(String account) { - this.account = account; - } - public String getPassword() { - return password; - } - public void setPassword(String password) { - this.password = password; - } - public String getNickName() { - return nickName; - } - public void setNickName(String nickName) { - this.nickName = nickName; - } - public String getEmail() { - return email; - } - public void setEmail(String email) { - this.email = email; - } - public String getCellphone() { - return cellphone; - } - public void setCellphone(String cellphone) { - this.cellphone = cellphone; - } - public String getQq() { - return qq; - } - public void setQq(String qq) { - this.qq = qq; - } - public String getLatestTime() { - return latestTime; - } - public void setLatestTime(String latestTime) { - this.latestTime = latestTime; - } - public String getLatestIp() { - return latestIp; - } - public void setLatestIp(String latestIp) { - this.latestIp = latestIp; - } - public int getStatus() { - return status; - } - public void setStatus(int status) { - this.status = status; - } - public SysRole getSysRole() { - return sysRole; - } - public void setSysRole(SysRole sysRole) { - this.sysRole = sysRole; - } - public Date getBirth() { - return birth; - } - public void setBirth(Date birth) { - this.birth = birth; - } - @Override - public String toString() { - return "SysUser [id=" + id + ", organId=" + organId + ", employeeId=" - + employeeId + ", account=" + account + ", password=" + password - + ", nickName=" + nickName + ", email=" + email + ", cellphone=" - + cellphone + ", qq=" + qq + ", latestTime=" + latestTime - + ", latestIp=" + latestIp + ", status=" + status + ", birth=" - + birth + ", author=" + author + ", sysOrgan="+sysOrgan+", sysRole=" + sysRole + "]"; - } - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/User.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/User.java deleted file mode 100644 index 36b6a22..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/User.java +++ /dev/null @@ -1,205 +0,0 @@ -package com.risk.riskmanage.system.model; - -import java.io.Serializable; -import java.util.Arrays; -import java.util.Date; - -import com.risk.riskmanage.common.model.BasePage; - -/** - * @ClassName: UserVo
- * @Description: 后台用户实体类.
- */ -public class User extends BasePage implements Serializable { - - /** - * serialVersionUID:TODO(序列化对象使用) - */ - private static final long serialVersionUID = 1L; - - /** - * 关系id - */ - private Long userId; - /** - * 企业id - */ - private Long organId; - /** - * 用户id - */ - private String account; - /** - * 用户密码 - */ - private String password; - - /** - * 昵称 - */ - private String nickName; - /** - * 邮箱 - */ - private String email; - /** - * 电话 - */ - private String cellphone; - /** - * qq - */ - private String qq; - /** - * - */ - private String latestTime; - /** - * 最后一次登录IP - */ - private String latestIp; - /** - * 状态 - */ - private Integer status; - /** - * 创建时间 - */ - private Date birth; - /** - * 创建时间 - */ - private Long parentId; - /** - * 删除ids数组 - */ - private Long []deletIds; - - public Long[] getDeletIds() { - return deletIds; - } - - public void setDeletIds(Long[] deletIds) { - this.deletIds = deletIds; - } - - public Long getUserId() { - return userId; - } - - public void setUserId(Long userId) { - this.userId = userId; - } - - public Long getOrganId() { - return organId; - } - - public void setOrganId(Long organId) { - this.organId = organId; - } - - public String getAccount() { - return account; - } - - public void setAccount(String account) { - this.account = account; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getNickName() { - return nickName; - } - - public void setNickName(String nickName) { - this.nickName = nickName; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getCellphone() { - return cellphone; - } - - public void setCellphone(String cellphone) { - this.cellphone = cellphone; - } - - public String getQq() { - return qq; - } - - public void setQq(String qq) { - this.qq = qq; - } - - - - public String getLatestTime() { - return latestTime; - } - - public void setLatestTime(String latestTime) { - this.latestTime = latestTime; - } - - public String getLatestIp() { - return latestIp; - } - - public void setLatestIp(String latestIp) { - this.latestIp = latestIp; - } - - public Integer getStatus() { - return status; - } - - public void setStatus(Integer status) { - this.status = status; - } - - public Date getBirth() { - return birth; - } - - public void setBirth(Date birth) { - this.birth = birth; - } - - public Long getParentId() { - return parentId; - } - - public void setParentId(Long parentId) { - this.parentId = parentId; - } - - @Override - public String toString() { - return "User [userId=" + userId + ", organId=" + organId + ", account=" - + account + ", password=" + password + ", nickName=" + nickName - + ", email=" + email + ", cellphone=" + cellphone + ", qq=" + qq - + ", latestTime=" + latestTime + ", latestIp=" + latestIp - + ", status=" + status + ", birth=" + birth + ", parentId=" - + parentId + ", deletIds=" + Arrays.toString(deletIds) + "]"; - } - - - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/UserRole.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/UserRole.java deleted file mode 100644 index e7d4983..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/UserRole.java +++ /dev/null @@ -1,54 +0,0 @@ - -package com.risk.riskmanage.system.model; - -import java.io.Serializable; - -import com.risk.riskmanage.common.model.BasePage; - -/** - * ClassName:UserRoleVo
- * Description: 用户角色实体类.
- */ -public class UserRole extends BasePage implements Serializable{ - - private static final long serialVersionUID = 1L; - - /** - * 主键id - */ - private Long id; - /** - * 用户id - */ - private Long userId; - /** - * 角色编码 - */ - private String roleCode; - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - public Long getUserId() { - return userId; - } - public void setUserId(Long userId) { - this.userId = userId; - } - public String getRoleCode() { - return roleCode; - } - public void setRoleCode(String roleCode) { - this.roleCode = roleCode; - } - @Override - public String toString() { - return "UserRole [id=" + id + ", userId=" + userId + ", roleCode=" - + roleCode + "]"; - } - - -} - diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/request/LoginInfoParam.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/request/LoginInfoParam.java deleted file mode 100644 index 619ce56..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/request/LoginInfoParam.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.risk.riskmanage.system.model.request; - -import lombok.Data; - -@Data -public class LoginInfoParam { - private String account;// 账号 - private String password;// 密码 -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/response/SysMenuVo.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/response/SysMenuVo.java deleted file mode 100644 index d667580..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/model/response/SysMenuVo.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.risk.riskmanage.system.model.response; - -import com.fasterxml.jackson.annotation.JsonInclude; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; - -import java.io.Serializable; -import java.util.List; - -/** - * 系统菜单返回对象 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@ToString(callSuper = true) -@JsonInclude(JsonInclude.Include.NON_NULL) -public class SysMenuVo implements Serializable { - private static final long serialVersionUID = 621966254529550199L; - - /** - * 菜单名称 - */ - private String title; - - /** - * 菜单地址 - */ - private String index; - - /** - * 菜单图标 - */ - private String icon; - - /** - * 子菜单 - */ - private List subs; - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/DepartmentService.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/DepartmentService.java deleted file mode 100644 index 4cc6582..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/DepartmentService.java +++ /dev/null @@ -1,70 +0,0 @@ - -package com.risk.riskmanage.system.service; - -import java.util.List; - -import com.risk.riskmanage.system.model.Department; - -/** - * ClassName:DepartmentService
- * Description: 部门service接口.
- */ -public interface DepartmentService { - - /** - * getDeptList:(根据相应条件查询部门信息列表).
- * @author wz - * @param departmentVo - * @return 部门信息列表 - */ - List getDeptList(Department department); - - /** - * getDeptCount:(根据相应条件返回记录行数).
- * @author wz - * @param departmentVo - * @return 返回部门记录行数 - */ - int getDeptCount(Department department); - - /** - * insertDept:(新增部门记录).
- * @author wz - * @param departmentVo - */ - void insertDept(Department department); - - /** - * updateDept:(新增部门记录).
- * @author wz - * @param departmentVo - */ - void updateDept(Department department); - - /** - * isExistByDeptName:(判断是否存在相同部门名称).
- * @author wz - * @param deptName 部门名称 - * @param deptId 部门主键id - * @return true为存在相同的部门名称 - */ - boolean isExistByDeptName(String deptName,Long deptId); - - /** - * isExistByDeptCode:(判断是否存在相同部门编号).
- * @author wz - * @param deptCode 部门编号 - * @param deptId 部门主键id - * @return true为存在相同的部门编号 - */ - boolean isExistByDeptCode(String deptCode,Long deptId); - - /** - * deleteDept:(根据部门ids删除部门信息).
- * @author wz - * @param deletIds 部门ids - */ - void deleteDept(Long []deletIds ); - -} - diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/MenuSevice.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/MenuSevice.java deleted file mode 100644 index 4fd3af3..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/MenuSevice.java +++ /dev/null @@ -1,95 +0,0 @@ - -package com.risk.riskmanage.system.service; - -import java.util.List; - -import com.risk.riskmanage.system.model.Menu; -import com.risk.riskmanage.system.model.MenuJson; - - -/** - * ClassName:MenuSevice
- * Description: 菜单service.
- */ -public interface MenuSevice { - /** - * getMenuList:(根据相应条件查询菜单信息列表).
- * @author wz - * @param menuVo - * @return 菜单信息列表 - */ - List getMenuList(Menu menu); - - /** - * getMenuCount:(根据相应条件返回记录行数).
- * @author wz - * @param menuVo - * @return 返回菜单记录行数 - */ - int getMenuCount(Menu menu); - - /** - * insertMenu:(新增菜单记录).
- * @author wz - * @param menuVo - */ - void insertMenu(Menu menu); - - /** - * updateMenu:(新增菜单记录).
- * @author wz - * @param menuVo - */ - void updateMenu(Menu menu); - - /** - * isExistByMenuName:(判断是否存在相同菜单名称).
- * @author wz - * @param menuName 菜单名称 - * @param menuId 菜单主键id - * @return true为存在相同的菜单名称 - */ - boolean isExistByMenuName(String menuName,Long menuId); - - /** - * isExistByMenuCode:(判断是否存在相同菜单编号).
- * @author wz - * @param menuCode 菜单编号 - * @param menuId 菜单主键id - * @return true为存在相同的菜单编号 - */ - boolean isExistByMenuCode(String menuCode,Long menuId); - - /** - * deleteMenu:(根据菜单ids删除菜单信息).
- * @author wz - * @param deletIds 菜单ids - */ - void deleteMenu(Long []deletIds ); - - /** - * selectByRole:(根据角色查询).
- * @author wz - * @param menuVo - * @return 查询的菜单类 - */ - List selectByRole(Menu menu); - - /** - * deleteMenu:(返回true为角色权限修改成功).
- * @author wz - * @param deletIds 菜单ids - * @param roleCode 角色编号 - * @return 返回true为角色权限修改成功 - */ - boolean addMenuRole(Long []deletIds,String roleCode); - - /** - * findUserMenuByUser:(根据登录用户名查询相应授权菜单列表).
- * @author wz - * @param loginName - * @return 根据登录用户名查询相应授权菜单列表 - */ - List findUserMenuByUser(String loginName); -} - diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/RoleService.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/RoleService.java deleted file mode 100644 index 9b2a780..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/RoleService.java +++ /dev/null @@ -1,69 +0,0 @@ - -package com.risk.riskmanage.system.service; - -import java.util.List; - -import com.risk.riskmanage.system.model.Role; - -/** - * ClassName:RoleService
- * Description: 角色管理service接口.
- */ -public interface RoleService { - - /** - * getRoleList:(根据相应条件查询角色信息列表).
- * @author wz - * @param role - * @return 角色信息列表 - */ - List getRoleList(Role role); - - /** - * getRoleCount:(根据相应条件返回记录行数).
- * @author wz - * @param role - * @return 返回角色记录行数 - */ - int getRoleCount(Role role); - - /** - * insertRole:(新增角色记录).
- * @author wz - * @param role - */ - void insertRole(Role role); - - /** - * updateRole:(新增角色记录).
- * @author wz - * @param role - */ - void updateRole(Role role); - - /** - * isExistByRoleName:(判断是否存在相同角色名称).
- * @author wz - * @param roleName 角色名称 - * @param roleId 角色主键id - * @return true为存在相同的角色名称 - */ - boolean isExistByRoleName(String roleName,Long roleId); - - /** - * isExistByRoleCode:(判断是否存在相同角色编号).
- * @author wz - * @param roleCode 角色编号 - * @param roleId 角色主键id - * @return true为存在相同的角色编号 - */ - boolean isExistByRoleCode(String roleCode,Long roleId); - - /** - * deleteRole:(根据角色ids删除角色信息).
- * @author wz - * @param deletIds 角色ids - */ - void deleteRole(Long []deletIds ); -} - diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/SysMenuService.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/SysMenuService.java deleted file mode 100644 index 58cde53..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/SysMenuService.java +++ /dev/null @@ -1,109 +0,0 @@ - -package com.risk.riskmanage.system.service; - -import com.risk.riskmanage.system.model.SysMenu; -import org.apache.ibatis.annotations.Param; - -import java.util.List; -import java.util.Map; - - -public interface SysMenuService { - /** - * 查询所有资源 - * @return - */ - public List getAllSysMenu(); - /** - * 查询单条资源 - * @param id - * @return - */ - public SysMenu findById(long id); - /** - * 新增资源 - * @param sysMenu - * @return - */ - public int createSysMenu(SysMenu sysMenu); - /** - * 修改资源 - * @param sysMenu - * @return - */ - public int updateSysMenu(SysMenu sysMenu); - /** - * 删除资源 - * @param id - * @return - */ - public int deleteSysMenu(long id); - - /** - * 修改资源状态 - * @param id - * @param idList - * @return - */ - public int updateStatus(@Param("status") int status, @Param("list") List list); - - /** - * 通过父节点查询子菜单 - * @param id - * @return - */ - public List findChildByParent(long parentId); - - /** - * 通过角色菜单关系表及父节点查询菜单 - */ - public List findRoleMenuByParent(@Param ("parentId")long parentId, @Param("roleId") long roleId); - - /** - * 保存角色菜单关系(实现修改) - */ - public int insertRoleMenu(@Param("roleId") long roleId ,@Param("list") List list); - /** - * 分配资源树 - * @param roleId - * @return - */ - public List findTreeList(long roleId); - /** - * 获取所有启用资源 - * @return - */ - public List getAllValidMenu(); - - /** - * 获取引擎资源树 - */ - public List> getEngineTree(long roleId); - - /** - * 保存引擎树 - */ - public int insertRoleEngine(@Param ("roleId") long roleId,@Param ("list") List list); - /** - * 删除引擎树(实现修改) - */ - public int deleteRoleEngine(long roleId); - - /** - * 删除角色菜单关系(实现修改) - */ - public int deleteRoleMenu(long roleId); - /** - * 验证唯一性 - */ - public List validateMenuOnly(SysMenu sysMenu); - - /** - * 验证是否有查看菜单的权限 - */ - public List validatePermission(@Param("roleId")long roleId,@Param("url")String url); - /** - * 验证是否有该引擎的权限 - */ - public List> validateEnginePermission(@Param("roleId")long roleId,@Param("id_e") String id_e); -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/SysOrganizationService.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/SysOrganizationService.java deleted file mode 100644 index 4cc7d8c..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/SysOrganizationService.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.risk.riskmanage.system.service; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; - -import com.risk.riskmanage.system.model.SysOrganization; - - - - -public interface SysOrganizationService { - /** - * 查询所有公司 - * @return - */ - public List getAllSysOrganization(); - /** - * 获取所有启用公司 - * @return - */ - public List getAllValidOrgan(); - /** - * 查询单个公司 - * @param id - * @return - */ - public SysOrganization findById(long id); - /** - * 创建公司 - * @param SysOrganization - * @return - */ - public int createSysOrganization(SysOrganization SysOrganization); - /** - * 修改公司 - * @param SysOrganization - * @return - */ - public int updateSysOrganization(SysOrganization SysOrganization); - /** - * 删除公司 - * @param id - * @return - */ - public int deleteSysOrganization(long id); - /** - * 修改公司状态(停用/启用、删除) - * @param states - * @return - */ - public int updateStatus(@Param ("status") int status,@Param ("list") List list); - /** - * 验证唯一性 - */ - public List validateOrganOnly(SysOrganization SysOrganization); -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/SysRoleService.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/SysRoleService.java deleted file mode 100644 index 4225dfb..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/SysRoleService.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.risk.riskmanage.system.service; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; - -import com.risk.riskmanage.system.model.SysRole; - - - - - -public interface SysRoleService { - /** - * 获取本组织所有角色 - * @param organId - * @return - */ - public List getAllSysRole(long organId); - /** - * 获取所有角色 - */ - public List getAllRoles(); - /** - * 获取本组织启用的角色 - * @param organId - * @return - */ - public List getAllValidRole(@Param("organId")long organId,@Param("author")String author); - /** - * 查询本组织的单个用户 - * @param id - * @return - */ - public SysRole findById(@Param("id") long id, @Param("organId") long organId); - /** - * 查询单个角色 - * @param id - * @return - */ - public SysRole findByAId(long id); - /** - * 创建本组织角色 - * @param sysRole - * @return - */ - public int createSysRole(SysRole sysRole); - /** - * 修改本公司角色 - * @param sysRole - * @return - */ - public int updateSysRole(SysRole sysRole); - /** - * 删除本公司角色 - * @param id - * @return - */ - public int deleteSysRole(long id); - /** - * 创建公司管理员角色 - */ - public int createOrganRole(SysRole sysRole); - /** - * 修改角色状态(启用、停用、删除) - * @param id - * @param idList - * @return - */ - public int updateStatus(@Param("status") int status,@Param("list") List list); - /** - * 根据角色查询角色所在公司 - */ - public long getOrganByRoleId(long roleId); - /** - * 验证角色唯一性 - */ - public List validateRoleOnly(SysRole sysRole); - /** - * 查询公司管理员角色id - */ - public List getOrganRoleByAuthor(SysRole sysRole); - /** - * 删除本公司所有角色 - */ - public int deleteAllRoles(long organId); - /** - * 删除多个公司的所有角色 - */ - public int deleteRolesByOrgans(@Param("status") Integer status,@Param("list")List list); -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/SysUserService.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/SysUserService.java deleted file mode 100644 index 51f8044..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/SysUserService.java +++ /dev/null @@ -1,111 +0,0 @@ - -package com.risk.riskmanage.system.service; - -import com.risk.riskmanage.system.model.SysUser; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - - - - - -public interface SysUserService { - /** - * 查询搜索用户 - */ - public List getAllUsers(SysUser sysUser); - /** - * 查询本组织单个用户 - * @param - * @return - */ - public SysUser findById(SysUser sysUser); - /** - * 创建本公司用户 - * @param sysUser - * @return - */ - public long createSysUser(SysUser sysUser); - /** - * 修改本公司用户 - * @param user - * @return - */ - public int updateSysUser(SysUser user); - /** - * 删除本公司用户 - * @param id - * @return - */ - public int deleteSysUser(long id); - /** - * 修改用户状态(停用/启用) - * @param - * @return - */ - public int updateStates(@Param ("status") int status,@Param ("list") List list); - /** - * 通过用户id查询角色 - * @param userId - * @return - */ - public SysUser findRoleByUserId(long userId); - - /** - * 重置密码 - */ - public int resetPassword(SysUser sysUser); - - /** - * 修改密码 - */ - public int updatePassword(SysUser sysUser); - - /** - * 本公司账号员工编号唯一性 - */ - public List validateUserOnly(SysUser sysUser); - /** - * 删除本公司的所有账号 - */ - public int deleteAllUser(long organId); - - /** - * 删除本公司的用户角色关系 - */ - public int deleteAllUserRole(long organId); - - /** - * 删除多个公司的所有账号 - */ - public int deleteUsersByOrgans(@Param("status")Integer status,@Param("list")List list); - - /** - * 删除多个公司的用户角色关系 - */ - public int deleteUserRoleByOrgan(@Param("status")Integer status,@Param("list")List list); - - /** - * 删除角色账号关联关系 - */ - public int deleteUserRoleById(long RoleId); - - /** - * 查询本角色下的所有账号 - */ - public List getUserIdsByRoleId(long roleId); - /** - * 删除角色关联的所有账号 - */ - public int deleteUsersByIds(@Param("status") Integer status,@Param("list")List list); - - /** - * 批量删除角色账号关系 - */ - public int deleteBatchUserRole(@Param("status") Integer status,@Param("list")List list); - /** - * 批量查询角色关联的账号 - */ - public List getBatchUserIdsByRoleId(List list); -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/UserService.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/UserService.java deleted file mode 100644 index ae23cd3..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/UserService.java +++ /dev/null @@ -1,80 +0,0 @@ - -package com.risk.riskmanage.system.service; - -import com.risk.riskmanage.system.model.User; - -import java.util.List; -import java.util.Set; - -/** - * ClassName:UserService
- * Description: 后台用户管理service接口.
- */ -public interface UserService { - - /** - * getUserList:(返回后台用户列表).
- * @author wz - * @param user - * @return 用户列表 - */ - List getUserList(User user); - - /** - * getUserCount:(返回后台用户行数).
- * @author wz - * @param user - * @return 返回后台用户行数 - */ - int getUserCount(User user); - - /** - * insertUser:(新增后台用户记录).
- * @author wz - * @param user - */ - void insertUser(User user); - - /** - * updateUser:(修改后台用户记录).
- * @author wz - * @param user - */ - void updateUser(User user); - - /** - * isExistByLoginName:(判断是否存在相同后台用户名称).
- * @author wz - * @param loginName 后台用户登录名称 - * @param userId 后台用户主键id - * @return true为存在相同的后台用户登录名称 - */ - boolean isExistByLoginName(String loginName,Long userId); - - /** - * isExistUser:(是否存在用户).
- * @author wz - * @param loginName 用户名 - * @param password 密码 - * @return User 返回存在用户或者null - */ - User selectLoginInfo(String loginName,String password); - - /** - * deleteUser:(根据后台用户ids删除后台用户信息).
- * @author wz - * @param deletIds 后台用户ids - * @param status 状态 - */ - void deleteUser(Long []deletIds,Integer status); - - /** - * findUserMenuSet:(根据用户名获取所授权的菜单).
- * @author wz - * @param loginName - * @return 根据用户名获取所授权的菜单 - */ - Set findUserMenuSet(String loginName); - -} - diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/impl/DepartmentServiceImpl.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/impl/DepartmentServiceImpl.java deleted file mode 100644 index 7c8b8ac..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/impl/DepartmentServiceImpl.java +++ /dev/null @@ -1,73 +0,0 @@ - -package com.risk.riskmanage.system.service.impl; - -import java.util.List; - -import com.risk.riskmanage.system.service.DepartmentService; -import org.springframework.stereotype.Service; - -import com.risk.riskmanage.common.basefactory.BaseService; -import com.risk.riskmanage.system.model.Department; - -/** - * ClassName:DepartmentServiceImpl
- * Description: TODO ADD FUNCTION.
- */ -@Service -public class DepartmentServiceImpl extends BaseService implements DepartmentService { - - @Override - public List getDeptList(Department department) { - return departmentMapper.selectByExample(department); - } - - @Override - public int getDeptCount(Department department) { - return departmentMapper.countByExample(department); - } - - @Override - public void insertDept(Department department) { - departmentMapper.insertSelective(department); - } - - @Override - public void updateDept(Department department) { - departmentMapper.updateByPrimaryKeySelective(department); - } - - @Override - public boolean isExistByDeptName(String deptName,Long deptId) { - if(deptName != null && !("".equals(deptName))){ - Department department = new Department(); - department.setId(deptId); - department.setDeptName(deptName); - int rowCount=departmentMapper.isExist(department); - if(rowCount>0){ - return true; - } - } - return false; - } - - @Override - public boolean isExistByDeptCode(String deptCode,Long deptId) { - if(deptCode != null && !("".equals(deptCode))){ - Department department = new Department(); - department.setDeptCode(deptCode); - department.setId(deptId); - int rowCount=departmentMapper.isExist(department); - if(rowCount>0){ - return true; - } - } - return false; - } - - @Override - public void deleteDept(Long []deletIds) { - departmentMapper.deleteDept(deletIds); - } - -} - diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/impl/MenuServiceImpl.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/impl/MenuServiceImpl.java deleted file mode 100644 index 5b7ce67..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/impl/MenuServiceImpl.java +++ /dev/null @@ -1,129 +0,0 @@ - -package com.risk.riskmanage.system.service.impl; - -import java.util.ArrayList; -import java.util.List; - -import com.risk.riskmanage.system.service.MenuSevice; -import com.risk.riskmanage.common.basefactory.BaseService; -import com.risk.riskmanage.system.model.Menu; -import com.risk.riskmanage.system.model.MenuJson; -import org.springframework.stereotype.Service; - -@Service -public class MenuServiceImpl extends BaseService implements MenuSevice { - - @Override - public List getMenuList(Menu menu) { - return menuMapper.selectByExample(menu); - } - - @Override - public int getMenuCount(Menu menu) { - return menuMapper.countByExample(menu); - } - - @Override - public void insertMenu(Menu menu) { - menuMapper.insertSelective(menu); - } - - @Override - public void updateMenu(Menu menu) { - menuMapper.updateByPrimaryKeySelective(menu); - } - - @Override - public boolean isExistByMenuName(String menuName, Long menuId) { - if(menuName != null && !("".equals(menuName))){ - Menu menu = new Menu(); - menu.setId(menuId); - menu.setName(menuName); - int rowCount=menuMapper.isExist(menu); - if(rowCount>0){ - return true; - } - } - return false; - } - - @Override - public boolean isExistByMenuCode(String menuCode, Long menuId) { - if(menuCode != null && !("".equals(menuCode))){ - Menu menu = new Menu(); - menu.setId(menuId); - menu.setMenuCode(menuCode); - int rowCount=menuMapper.isExist(menu); - if(rowCount>0){ - return true; - } - } - return false; - } - - @Override - public void deleteMenu(Long[] deletIds) { - menuMapper.deleteMenu(deletIds); - } - - @Override - public List selectByRole(Menu menu) { - return menuMapper.selectByRole(menu); - } - - @Override - public boolean addMenuRole(Long[] deletIds, String roleCode) { - if(deletIds.length>0 && roleCode !=null ){ - Menu menu = new Menu(); - menu.setRoleCode(roleCode); - menuMapper.deleteMenuRole(menu); - for (int i = 0; i < deletIds.length; i++) { - menu.setId(deletIds[i]); - menuMapper.insertMenuRole(menu); - } - return true; - } - return false; - } - - @Override - public List findUserMenuByUser(String loginName) { - if(loginName != null && !("".equals(loginName))){ - List menuList = menuMapper.findUserMenuByUser(loginName); - List menuOneList = new ArrayList(); - for (Menu menu : menuList) { - if(menu.getPid() == 1){ - menuOneList.add(menu); - } - } - - List menuJsonList = new ArrayList(); - - for(Menu menuOne : menuOneList){ - MenuJson menuJson = new MenuJson(); - menuJson.setMenuid(menuOne.getId().toString()); - menuJson.setIcon(menuOne.getIcon()); - menuJson.setMenuname(menuOne.getName()); - List menuTwoList = new ArrayList(); - for(Menu menu : menuList){ - if(menu.getPid() == menuOne.getId()){ - MenuJson menuJsonTemp = new MenuJson(); - menuJsonTemp.setMenuid(menu.getId().toString()); - menuJsonTemp.setIcon(menu.getIcon()); - menuJsonTemp.setMenuname(menu.getName()); - menuJsonTemp.setUrl(menu.getUrl()); - menuTwoList.add(menuJsonTemp); - } - } - menuJson.setMenus(menuTwoList); - menuJsonList.add(menuJson); - } - - return menuJsonList; - - } - return null; - } - -} - diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/impl/RoleServiceImpl.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/impl/RoleServiceImpl.java deleted file mode 100644 index 21a9f9f..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/impl/RoleServiceImpl.java +++ /dev/null @@ -1,73 +0,0 @@ - -package com.risk.riskmanage.system.service.impl; - -import java.util.List; - -import com.risk.riskmanage.system.service.RoleService; -import org.springframework.stereotype.Service; - -import com.risk.riskmanage.common.basefactory.BaseService; -import com.risk.riskmanage.system.model.Role; - -/** - * ClassName:RoleServiceImpl
- * Description: 角色管理service接口实现.
- */ -@Service -public class RoleServiceImpl extends BaseService implements RoleService { - - @Override - public List getRoleList(Role role) { - return roleMapper.selectByExample(role); - } - - @Override - public int getRoleCount(Role role) { - return roleMapper.countByExample(role); - } - - @Override - public void insertRole(Role role) { - roleMapper.insertSelective(role); - } - - @Override - public void updateRole(Role role) { - roleMapper.updateByPrimaryKeySelective(role); - } - - @Override - public boolean isExistByRoleName(String roleName, Long roleId) { - if(roleName != null && !("".equals(roleName))){ - Role role = new Role(); - role.setId(roleId); - role.setName(roleName); - int rowCount=roleMapper.isExist(role); - if(rowCount>0){ - return true; - } - } - return false; - } - - @Override - public boolean isExistByRoleCode(String roleCode, Long roleId) { - if(roleCode != null && !("".equals(roleCode))){ - Role role = new Role(); - role.setId(roleId); - role.setRoleCode(roleCode); - int rowCount=roleMapper.isExist(role); - if(rowCount>0){ - return true; - } - } - return false; - } - - @Override - public void deleteRole(Long[] deletIds) { - roleMapper.deleteRole(deletIds); - } - -} - diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/impl/SysMenuServiceImpl.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/impl/SysMenuServiceImpl.java deleted file mode 100644 index 76ef2a7..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/impl/SysMenuServiceImpl.java +++ /dev/null @@ -1,160 +0,0 @@ - -package com.risk.riskmanage.system.service.impl; - -import com.risk.riskmanage.common.basefactory.BaseService; -import com.risk.riskmanage.system.model.SysMenu; -import com.risk.riskmanage.system.model.User; -import com.risk.riskmanage.system.service.SysMenuService; -import com.risk.riskmanage.util.SessionManager; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.Map; - -@Service -public class SysMenuServiceImpl extends BaseService implements SysMenuService { - /** - * 查询所有资源 - */ - @Override - public List getAllSysMenu() { - return sysMenuMapper.getAllSysMenu(); - } - /** - * 查询单条资源 - */ - @Override - public SysMenu findById(long id) { - return sysMenuMapper.findById(id); - } - /** - * 新增资源 - */ - @Override - public int createSysMenu(SysMenu sysMenu) { - //获取登录人信息 - User user = SessionManager.getLoginAccount(); - //分配者 - long userId = user.getUserId(); - sysMenu.setUserId(userId); - return sysMenuMapper.createSysMenu(sysMenu); - } - /** - * 修改资源 - */ - @Override - public int updateSysMenu(SysMenu sysMenu) { - return sysMenuMapper.updateSysMenu(sysMenu); - } - /** - * 删除资源 - */ - @Override - public int deleteSysMenu(long id) { - return sysMenuMapper.deleteSysMenu(id); - } - /** - * 修改资源状态 - */ - @Override - public int updateStatus(int status, List list) { - return sysMenuMapper.updateStatus(status, list); - } - /** - * 通过父节点查询子菜单 - */ - @Override - public List findChildByParent(long parentId) { - return sysMenuMapper.findChildByParent(parentId); - } - /** - * 通过角色菜单关系表及父节点查询菜单 - */ - @Override - public List findRoleMenuByParent(long parentId, long roleId) { - return sysMenuMapper.findRoleMenuByParent(parentId, roleId); - } - - /** - * 获取所有启用资源 - */ - @Override - public List getAllValidMenu() { - return sysMenuMapper.getAllValidMenu(); - } - - /** - * 分配资源树 - */ - @Override - public List findTreeList(long roleId) { - return sysMenuMapper.findTreeList(roleId); - } - /** - * 保存、修改资源树(实现修改) - */ - @Override - public int insertRoleMenu(long roleId, List list) { - //先删除原关系 - sysMenuMapper.deleteRoleMenu(roleId); - //保存菜单角色关系 - int insertNum = sysMenuMapper.insertRoleMenu(roleId, list); - return insertNum; - } - - /** - * 获取引擎资源树 - */ - @Override - public List> getEngineTree(long roleId) { - return sysMenuMapper.getEngineTree(roleId) ; - } - /** - * 保存引擎树 - */ - @Override - public int insertRoleEngine(long roleId, List list) { - //先删除原关系 - sysMenuMapper.deleteRoleEngine(roleId); - //保存菜单角色关系 - int insertNum = sysMenuMapper.insertRoleEngine(roleId, list); - return insertNum; - } - /** - * 删除引擎树 - */ - @Override - public int deleteRoleEngine(long roleId) { - return sysMenuMapper.deleteRoleEngine(roleId); - } - /** - * 删除资源树 - */ - @Override - public int deleteRoleMenu(long roleId) { - return sysMenuMapper.deleteRoleMenu(roleId); - } - /** - * 验证唯一性 - */ - @Override - public List validateMenuOnly(SysMenu sysMenu) { - return sysMenuMapper.validateMenuOnly(sysMenu); - } - /** - * 验证是否有查看资源的权限 - */ - @Override - public List validatePermission(long roleId, String url) { - return sysMenuMapper.validatePermission(roleId, url); - } - /** - * 验证是否有访问该引擎的权限 - */ - @Override - public List> validateEnginePermission(long roleId, - String id_e) { - return sysMenuMapper.validateEnginePermission(roleId, id_e); - } - -} \ No newline at end of file diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/impl/SysOrganizationServiceImpl.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/impl/SysOrganizationServiceImpl.java deleted file mode 100644 index 5d86cd8..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/impl/SysOrganizationServiceImpl.java +++ /dev/null @@ -1,97 +0,0 @@ - -package com.risk.riskmanage.system.service.impl; - -import com.risk.riskmanage.common.basefactory.BaseService; -import com.risk.riskmanage.system.model.SysOrganization; -import com.risk.riskmanage.system.model.User; -import com.risk.riskmanage.system.service.SysOrganizationService; -import com.risk.riskmanage.util.SessionManager; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.UUID; - -@Service -public class SysOrganizationServiceImpl extends BaseService implements SysOrganizationService { - /** - * 查询公司 - */ - @Override - public List getAllSysOrganization() { - return sysOrganizationMapper.getAllSysOrganization(); - } - /** - * 查询单个公司 - */ - @Override - public SysOrganization findById(long id) { - return sysOrganizationMapper.findById(id); - } - /** - * 创建公司 - */ - @Override - public int createSysOrganization(SysOrganization SysOrganization) { - //获取登录人信息(超级管理员) - User user = SessionManager.getLoginAccount(); - String nickName = user.getNickName(); - SysOrganization.setAuthor(nickName); - //生成token唯一标识 - String uuid = UUID.randomUUID().toString(); - SysOrganization.setToken(uuid); - return sysOrganizationMapper.createSysOrganization(SysOrganization); - } - /** - * 修改公司 - */ - @Override - public int updateSysOrganization(SysOrganization SysOrganization) { - return sysOrganizationMapper.updateSysOrganization(SysOrganization); - } - /** - * 删除公司 - */ - @Override - public int deleteSysOrganization(long id) { - //删除对应的角色 - sysRoleMapper.deleteAllRoles(id); - //删除对应的用户 - sysUserMapper.deleteAllUser(id); - //删除用户角色关系 - sysUserMapper.deleteAllUserRole(id); - //删除公司 - int num = sysOrganizationMapper.deleteSysOrganization(id); - return num; - } - /** - * 批量修改公司状态 - */ - @Override - public int updateStatus(int status, List list) { - //删除、停用、启用每个公司下的所有角色 - sysRoleMapper.deleteRolesByOrgans(status,list); - //删除、停用、启用每个公司下的所有账号 - sysUserMapper.deleteUsersByOrgans(status,list); - //删除、停用、启用每个公司下的所有用户角色关系 - sysUserMapper.deleteUserRoleByOrgan(status,list); - //删除、停用、启用公司 - int num = sysOrganizationMapper.updateStatus(status, list); - return num; - } - /** - * 获取所有启用公司 - */ - @Override - public List getAllValidOrgan() { - return sysOrganizationMapper.getAllValidOrgan(); - } - /** - * 验证唯一性 - */ - @Override - public List validateOrganOnly( - SysOrganization SysOrganization) { - return sysOrganizationMapper.validateOrganOnly(SysOrganization); - } - -} \ No newline at end of file diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/impl/SysRoleServiceImpl.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/impl/SysRoleServiceImpl.java deleted file mode 100644 index 27129dc..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/impl/SysRoleServiceImpl.java +++ /dev/null @@ -1,151 +0,0 @@ - -package com.risk.riskmanage.system.service.impl; - - -import com.risk.riskmanage.common.basefactory.BaseService; -import com.risk.riskmanage.system.model.SysRole; -import com.risk.riskmanage.system.model.User; -import com.risk.riskmanage.system.service.SysRoleService; -import com.risk.riskmanage.util.SessionManager; -import org.springframework.stereotype.Service; - -import java.util.List; - - -@Service -public class SysRoleServiceImpl extends BaseService implements SysRoleService { - /** - * 获取本组织所有角色 - * @return - */ - @Override - public List getAllSysRole(long organId) { - return sysRoleMapper.getAllSysRole(organId); - } - /** - * 获取所有角色 - */ - @Override - public List getAllRoles() { - return sysRoleMapper.getAllRoles(); - } - /** - * 获取本组织的单个角色 - */ - @Override - public SysRole findById(long id,long organId) { - return sysRoleMapper.findById(id,organId); - } - /** - * 查询单个角色 - */ - @Override - public SysRole findByAId(long id) { - return sysRoleMapper.findByAId(id); - } - /** - * 创建本公司的角色 - */ - @Override - public int createSysRole(SysRole sysRole) { - return sysRoleMapper.createSysRole(sysRole); - } - /** - * 修改本公司角色 - */ - @Override - public int updateSysRole(SysRole sysRole) { - //获取管理员所在公司 - User user = SessionManager.getLoginAccount(); - long organId = user.getOrganId(); - if(organId!=1){ - //修改本公司角色 - sysRole.setOrganId(organId); - } - return sysRoleMapper.updateSysRole(sysRole); - } - /** - * 删除本公司角色 - */ - @Override - public int deleteSysRole(long id) { - //查询本角色对应的账号id - List list = sysUserMapper.getUserIdsByRoleId(id); - //删除本角色下账号 - if (list!=null&&list.size()>0){ - sysUserMapper.deleteUsersByIds(-1,list); - } - //删除账号角色关系 - sysUserMapper.deleteUserRoleById(id); - //删除角色 - int num = sysRoleMapper.deleteSysRole(id); - return num; - } - /** - * 创建公司管理员角色 - */ - @Override - public int createOrganRole(SysRole sysRole) { - return sysRoleMapper.createOrganRole(sysRole); - } - /** - * 修改角色状态(启用、停用、删除) - */ - @Override - public int updateStatus(int status, List list) { - //查询角色下的账号id - List listu = sysUserMapper.getBatchUserIdsByRoleId(list); - //批量删除角色关联账号 - if (listu!=null&&listu.size()>0){ - sysUserMapper.deleteUsersByIds(status,listu); - } - //批量删除角色账号关系 - sysUserMapper.deleteBatchUserRole(status,list); - //批量删除角色 - int num = sysRoleMapper.updateStatus(status, list); - return num; - } - /** - * 根据角色查询公司 - */ - @Override - public long getOrganByRoleId(long roleId) { - return sysRoleMapper.getOrganByRoleId(roleId); - } - /** - * 验证角色唯一性 - */ - @Override - public List validateRoleOnly(SysRole sysRole) { - return sysRoleMapper.validateRoleOnly(sysRole); - } - /** - * 查询公司管理员角色id - */ - @Override - public List getOrganRoleByAuthor(SysRole sysRole) { - return sysRoleMapper.getOrganRoleByAuthor(sysRole); - } - /** - * 获取公司启用角色 - */ - @Override - public List getAllValidRole(long organId, String author) { - return sysRoleMapper.getAllValidRole(organId, author); - } - /** - * 删除本公司所有角色 - * - */ - @Override - public int deleteAllRoles(long organId) { - return sysRoleMapper.deleteAllRoles(organId); - } - /** - * 删除多个公司的所有角色 - */ - @Override - public int deleteRolesByOrgans(Integer status, List list) { - return sysRoleMapper.deleteRolesByOrgans(status, list); - } -} \ No newline at end of file diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/impl/SysUserServiceImpl.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/impl/SysUserServiceImpl.java deleted file mode 100644 index 0fe8db1..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/impl/SysUserServiceImpl.java +++ /dev/null @@ -1,193 +0,0 @@ - -package com.risk.riskmanage.system.service.impl; - -import com.risk.riskmanage.common.basefactory.BaseService; -import com.risk.riskmanage.system.model.SysUser; -import com.risk.riskmanage.system.model.User; -import com.risk.riskmanage.system.service.SysUserService; -import com.risk.riskmanage.util.MD5; -import com.risk.riskmanage.util.SessionManager; -import org.springframework.stereotype.Service; - -import java.util.List; - - - -@Service -public class SysUserServiceImpl extends BaseService implements SysUserService { - /** - * 查询搜索用户 - */ - @Override - public List getAllUsers(SysUser sysUser) { - return sysUserMapper.getAllUsers(sysUser); - } - /** - * 查询本组织单个用户 - * @return - */ - @Override - public SysUser findById(SysUser sysUser) { - return sysUserMapper.findById(sysUser); - } - /** - * 创建用户 - */ - @Override - public long createSysUser(SysUser sysUser) { - long num = 0; - //密码加密 - String password = MD5.GetMD5Code("111111"); - sysUser.setPassword(password); - //创建人 - User user = SessionManager.getLoginAccount(); - String nickName = user.getNickName(); - sysUser.setAuthor(nickName); - //创建用户并返回id - sysUserMapper.createSysUser(sysUser); - long uId = sysUser.getId(); - long roleId = sysUser.getSysRole().getId(); - long orgaId = sysUser.getOrganId(); - if(uId!=0&&roleId!=0){ - //添加表关系 - num = sysUserMapper.insertUserRole(uId, roleId,orgaId); - } - return num; - } - /** - * 修改本公司用户 - */ - @Override - public int updateSysUser(SysUser sysUser) { - int num = 0; - //修改用户 - int updateNum = sysUserMapper.updateSysUser(sysUser); - //修改用户角色关系 - if(updateNum==1){ - num = sysUserMapper.updateUserRole(sysUser); - } - return num; - } - /** - * 删除本公司用户 - */ - @Override - public int deleteSysUser(long id) { - //删除单个用户 - int num = sysUserMapper.deleteSysUser(id); - return num; - } - /** - * 修改用户状态 - */ - @Override - public int updateStates(int status,List list) { - return sysUserMapper.updateStates(status,list); - } - /** - * 通过用户id查询角色 - */ - @Override - public SysUser findRoleByUserId(long userId) { - return sysUserMapper.findRoleByUserId(userId); - } - /** - * 重置密码 - */ - @Override - public int resetPassword(SysUser sysUser) { - //密码加密 - String password = MD5.GetMD5Code("111111"); - sysUser.setPassword(password); - return sysUserMapper.resetPassword(sysUser); - } - /** - * 修改密码 - */ - @Override - public int updatePassword(SysUser sysUser) { - //获取登录人id -// User user = SessionManager.getLoginAccount(); -// long id = user.getUserId(); - //密码加密 - String password = MD5.GetMD5Code(sysUser.getPassword()); - sysUser.setPassword(password); -// sysUser.setId(id); - return sysUserMapper.updatePassword(sysUser); - } - /** - * 本公司账号员工编号唯一性 - */ - @Override - public List validateUserOnly(SysUser sysUser) { - return sysUserMapper.validateUserOnly(sysUser); - } - /** - * 删除本公司所有账号 - */ - @Override - public int deleteAllUser(long organId) { - return sysUserMapper.deleteAllUser(organId); - } - /** - * 删除本公司所有账号角色关系 - */ - @Override - public int deleteAllUserRole(long organId) { - return sysUserMapper.deleteAllUserRole(organId); - } - - /** - * 删除多个公司的所有用户 - */ - @Override - public int deleteUsersByOrgans(Integer status, List list) { - return sysUserMapper.deleteUsersByOrgans(status, list); - } - /** - * 删除多个公司的用户角色关系 - */ - @Override - public int deleteUserRoleByOrgan(Integer status, List list) { - return sysUserMapper.deleteUserRoleByOrgan(status, list); - } - /** - * 删除角色账号关联关系 - */ - @Override - public int deleteUserRoleById(long RoleId) { - return sysUserMapper.deleteUserRoleById(RoleId); - } - /** - * 查询角色下的所有账号 - */ - @Override - public List getUserIdsByRoleId(long roleId) { - return sysUserMapper.getUserIdsByRoleId(roleId); - } - /** - * 删除角色关联的账号 - */ - @Override - public int deleteUsersByIds(Integer status, List list) { - int result = 0; - if (list!=null&&list.size()>0){ - result = sysUserMapper.deleteUsersByIds(status, list); - } - return result; - } - /** - * 批量删除角色账号关系 - */ - @Override - public int deleteBatchUserRole(Integer status, List list) { - return sysUserMapper.deleteBatchUserRole(status, list); - } - /** - * 批量查询角色关联的账号 - */ - @Override - public List getBatchUserIdsByRoleId(List list) { - return sysUserMapper.getBatchUserIdsByRoleId(list); - } -} \ No newline at end of file diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/impl/UserServiceImpl.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/impl/UserServiceImpl.java deleted file mode 100644 index 68d1a33..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/system/service/impl/UserServiceImpl.java +++ /dev/null @@ -1,118 +0,0 @@ - -package com.risk.riskmanage.system.service.impl; - -import com.risk.riskmanage.common.basefactory.BaseService; -import com.risk.riskmanage.system.model.User; -import com.risk.riskmanage.system.model.UserRole; -import com.risk.riskmanage.system.service.UserService; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Set; - -/** - * ClassName:UserServiceImpl
- * Description: 后台用户管理service接口实现类.
- */ -@Service -public class UserServiceImpl extends BaseService implements UserService { - - @Override - public List getUserList(User user) { - return userMapper.selectByExample(user); - } - - @Override - public int getUserCount(User user) { - return userMapper.countByExample(user); - } - - @Override - public void insertUser(User user) { - List userRolelist = new ArrayList(); - String roleCodes = user.getUserId().toString(); - if(roleCodes != null || !("".equals(roleCodes)) ){ - List roleCodeList = Arrays.asList(roleCodes.split(",")); - userMapper.insertSelective(user); - for (int i = 0; i < roleCodeList.size(); i++) { - UserRole userRole = new UserRole(); - userRole.setUserId(user.getUserId()); - userRole.setRoleCode(roleCodeList.get(i)); - userRolelist.add(userRole); - } - userMapper.insertUserRole(userRolelist); - } - } - - @Override - public void updateUser(User user) { - List userRolelist = new ArrayList(); - String roleCodes =user.getUserId().toString(); - if(roleCodes != null && !("".equals(roleCodes)) ){ - List roleCodeList = Arrays.asList(roleCodes.split(",")); - for (int i = 0; i < roleCodeList.size(); i++) { - UserRole userRole = new UserRole(); - userRole.setUserId(user.getUserId()); - userRole.setRoleCode(roleCodeList.get(i)); - userRolelist.add(userRole); - } - userMapper.deleteUserRole(new Long[]{user.getUserId()}); - - userMapper.insertUserRole(userRolelist); - userMapper.updateByPrimaryKeySelective(user); - }else{ - userMapper.updateByPrimaryKeySelective(user); - } - - } - - @Override - public boolean isExistByLoginName(String loginName, Long userId) { - if(loginName != null && !("".equals(loginName))){ - User user = new User(); - user.setAccount(loginName); - user.setUserId(userId); - int rowCount=userMapper.isExist(user); - if(rowCount>0){ - return true; - } - } - return false; - } - - @Override - public User selectLoginInfo(String loginName,String password) { - if(loginName != null && !("".equals(loginName))){ - User user = new User(); - user.setAccount(loginName); - user.setPassword(password); - User userInfo=userMapper.selectLoginInfo(user); - if(userInfo != null){ - return userInfo; - } - } - return null; - } - - @Override - public void deleteUser(Long[] deletIds,Integer status) { - User user = new User(); - user.setDeletIds(deletIds); - if(status == -1){ - user.setStatus(-1); - userMapper.deleteUserRole(deletIds); - }else if(status == 1){ - user.setStatus(1); - } - userMapper.deleteUser(user); - } - - @Override - public Set findUserMenuSet(String loginName) { - return userMapper.findUserMenuSet(loginName); - } - -} - diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/tactics/consts/TacticsType.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/tactics/consts/TacticsType.java deleted file mode 100644 index 0406026..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/tactics/consts/TacticsType.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.risk.riskmanage.tactics.consts; - -public class TacticsType { - public static final String DECISION_TABLES = "decision_tables";//决策表 - public static final String DECISION_TREE = "decision_tree";//决策树 - public static final String SCORECARD = "scorecard";//评分卡 - public static final String LIST_DB = "list_db";//名单库 - public static final String MODELS = "models";//模型 - public static final String COMPLEX_RULE = "complex_rule";//复杂规则 - public static final String BASE_RULE = "base_rule";//基础规则 - - - public static class OutType{ - public static final String SUCCESS_OUT = "success";//成功时输出 - public static final String FAIL_OUT = "fail";//失败时输出 - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/tactics/mapper/TacticsOutputMapper.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/tactics/mapper/TacticsOutputMapper.java deleted file mode 100644 index 51a611f..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/tactics/mapper/TacticsOutputMapper.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.risk.riskmanage.tactics.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.risk.riskmanage.tactics.model.TacticsOutput; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface TacticsOutputMapper extends BaseMapper { -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/tactics/model/TacticsOutput.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/tactics/model/TacticsOutput.java deleted file mode 100644 index 3d71da6..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/tactics/model/TacticsOutput.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.risk.riskmanage.tactics.model; - -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 lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.Date; -import java.io.Serializable; - - -@Data -@NoArgsConstructor -@AllArgsConstructor -@TableName("t_tactics_output") -public class TacticsOutput implements Serializable { - @TableField(exist = false) - private static final long serialVersionUID = 699491471584300246L; - /** - * 主键 - */ - @TableId(type = IdType.AUTO) - private Long id; - /** - * 字段id - */ - private Long fieldId; - /** - * 字段的en - */ - private String fieldEn; - /** - * 字段值 - */ - private String fieldValue; - /** - * 字段值的类型:1 常量、2 变量,3.自定义 - */ - private Integer variableType; - /** - * 关联的策略id - */ - private Long tacticsId; - /** - * 关联的策略类型 base_rule.基础规则 scorecard.评分卡 decision_tables.决策表 decision_tree.决策树 complex_rule.复杂规则 list_db.名单库 models.机器学习模型 - */ - private String tacticsType; - /** - * 输出条件 - */ - private String outCondition; - /** - * 输出类型:success为成功时候输出,fail为失败时候的输出 - */ - private String outType; - /** - * 创建时间 - */ - private Date createTime; - /** - * 修改时间 - */ - private Date updateTime; - - public TacticsOutput(Long tacticsId, String tacticsType) { - this.tacticsId = tacticsId; - this.tacticsType = tacticsType; - } - - public TacticsOutput(Long tacticsId, String tacticsType, String outType) { - this.tacticsId = tacticsId; - this.tacticsType = tacticsType; - this.outType = outType; - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/tactics/service/TacticsOutputService.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/tactics/service/TacticsOutputService.java deleted file mode 100644 index dd89758..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/tactics/service/TacticsOutputService.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.risk.riskmanage.tactics.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.risk.riskmanage.tactics.model.TacticsOutput; - - -import java.util.List; - - -public interface TacticsOutputService extends IService { - boolean insertTacticsOutput(Long tacticsId,List list); - - boolean insertTacticsOutput(Long tacticsId,List list,String outType); - - - List queryByTactics(TacticsOutput entity); - - boolean updateTacticsOutput(Long tacticsId, List list,String tacticsType); - - boolean updateTacticsOutput(Long tacticsId, List successList, List failList,String tacticsType); - - boolean deleteByTactics(TacticsOutput entity); -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/tactics/service/impl/TacticsOutputServiceImpl.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/tactics/service/impl/TacticsOutputServiceImpl.java deleted file mode 100644 index de41196..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/tactics/service/impl/TacticsOutputServiceImpl.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.risk.riskmanage.tactics.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; - -import com.risk.riskmanage.tactics.consts.TacticsType; -import com.risk.riskmanage.tactics.mapper.TacticsOutputMapper; -import com.risk.riskmanage.tactics.model.TacticsOutput; -import com.risk.riskmanage.tactics.service.TacticsOutputService; -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; - -@Service -public class TacticsOutputServiceImpl extends ServiceImpl implements TacticsOutputService { - @Transactional - @Override - public boolean insertTacticsOutput(Long tacticsId, List list) { - if (tacticsId == null) { - return false; - } - if (list == null || list.size() == 0) { - return true; - } - for (TacticsOutput tacticsOutput : list) { - tacticsOutput.setTacticsId(tacticsId); - } - boolean saveResult = this.saveBatch(list); - return saveResult; - } - - @Override - public boolean insertTacticsOutput(Long tacticsId, List list, String outType) { - if (tacticsId == null || StringUtils.isBlank(outType)) { - return false; - } - if (list == null || list.size() == 0) { - return true; - } - for (TacticsOutput tacticsOutput : list) { - tacticsOutput.setTacticsId(tacticsId); - tacticsOutput.setOutType(outType); - } - boolean saveResult = this.saveBatch(list); - return saveResult; - } - - @Override - public List queryByTactics(TacticsOutput entity) { - return this.list(new QueryWrapper<>(entity)); - } - - @Transactional - @Override - public boolean updateTacticsOutput(Long tacticsId, List list, String tacticsType) { - TacticsOutput tacticsOutput = new TacticsOutput(tacticsId, tacticsType); - boolean delete = this.deleteByTactics(tacticsOutput); - if (!delete && this.queryByTactics(tacticsOutput).size() != 0) { - return false; - } - return this.insertTacticsOutput(tacticsId, list); - } - - @Transactional - @Override - public boolean updateTacticsOutput(Long tacticsId, List successList, List failList, String tacticsType) { - TacticsOutput tacticsOutput = new TacticsOutput(tacticsId, tacticsType); - boolean delete = this.deleteByTactics(tacticsOutput); - if (!delete && this.queryByTactics(tacticsOutput).size() != 0) { - return false; - } - if (successList != null && !successList.isEmpty()) { - this.insertTacticsOutput(tacticsId, successList, TacticsType.OutType.SUCCESS_OUT); - } - if (failList != null && !failList.isEmpty()) { - this.insertTacticsOutput(tacticsId, failList, TacticsType.OutType.FAIL_OUT); - } - return true; - } - - @Transactional - @Override - public boolean deleteByTactics(TacticsOutput entity) { - return this.remove(new QueryWrapper<>(entity)); - } - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/AccountSessionWrap.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/AccountSessionWrap.java deleted file mode 100644 index a0121bc..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/AccountSessionWrap.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.risk.riskmanage.util; - -import com.risk.riskmanage.system.model.User; -import lombok.Data; - -/** - * session 包装类 - */ -@Data -public class AccountSessionWrap { - public AccountSessionWrap(String ip, String requestUri) { - init(null, ip, requestUri); - } - - public AccountSessionWrap(User user, String ip, String requestUri) { - init(user, ip, requestUri); - } - - private void init(User user, String ip, String requestUri) { - setUser(user); - setIp(ip); - setRequestUri(requestUri); - } - - /** session */ - private User user; - private String ip; - private String requestUri; - /** 请求唯一标识 */ - private String traceId; - -} \ No newline at end of file diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/BracketMatchUtil.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/BracketMatchUtil.java deleted file mode 100644 index aadda0f..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/BracketMatchUtil.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.risk.riskmanage.util; - -import org.apache.commons.lang3.StringUtils; -import java.util.Stack; - -/** - * 括号匹配工具类 - */ -public class BracketMatchUtil { - - public static boolean matching(String expression) { - - if (StringUtils.isBlank(expression)) { - return false; - } - - Stack stack = new Stack<>(); - - for (int index = 0; index < expression.length(); index++) { - switch (expression.charAt(index)) { - case '(': - stack.push(expression.charAt(index)); - break; - case '{': - stack.push(expression.charAt(index)); - break; - case ')': - if (!stack.empty() && stack.peek() == '(') { - stack.pop(); - } - break; - - case '}': - if (!stack.empty() && stack.peek() == '{') { - stack.pop(); - } - } - } - - if (stack.empty()) { - return true; - } - - return false; - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/CollectionUtil.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/CollectionUtil.java deleted file mode 100644 index e458ec6..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/CollectionUtil.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.risk.riskmanage.util; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -public class CollectionUtil { - - /** - * 集合判非空 - * - * @param collection - * @return - */ - public static boolean isNotNullOrEmpty(Collection collection) { - if (null == collection || collection.isEmpty()){ - return false; - } - return true; - } - - /** - * map判非空 - * - * @param map - * @return - */ - public static boolean isNotNullOrEmpty(Map map) { - if (null == map || map.isEmpty()){ - return false; - } - return true; - } - - /** - * 获取多个集合并集 - * @param list - * @return - */ - public static Set getUnion(List> list) { - Set set = new HashSet(); - if (list == null) { - list = new ArrayList>(); - } - int size = list.size(); - if (size > 1) { - for (int i = 0; i < size; i++) { - int j = i + 1; - if (j < size) { - list.get(0).removeAll(list.get(j)); - list.get(0).addAll(list.get(j)); - if (i == size - 2) { - List resultList = list.get(0); - for (Object result : resultList) { - set.add(result); - } - } - } - } - } else { - // 只有一个集合则直接插入结果 - for (List subList : list) { - for (Object result : subList) { - set.add(result); - } - } - } - return set; - - } - - /** - * 获取多个集合交集 - * @param list - * @return - */ - public static Set getIntersection(List> list) { - Set set = new HashSet(); - int size = list.size(); - if (size > 1) { - // 集合个数大于1,取交集 - for (int i = 0; i < size; i++) { - int j = i + 1; - if (j < size) { - list.get(0).retainAll(list.get(j)); - if (i == size - 2) { - List resultList = list.get(0); - for (Object result : resultList) { - set.add(result); - } - } - } - } - } else { - // 只有一个集合则不取交集 - for (List subList : list) { - for (Object result : subList) { - set.add(result); - } - } - } - - return set; - - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/CommonUtil.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/CommonUtil.java deleted file mode 100644 index 4dc9db6..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/CommonUtil.java +++ /dev/null @@ -1,186 +0,0 @@ -package com.risk.riskmanage.util; - -import org.apache.commons.lang3.StringUtils; - -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.Calendar; -import java.util.Date; -import java.util.Random; -import java.util.UUID; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class CommonUtil { - // MD5简单加密 - public static String MD5Purity(String plainText) { - try { - MessageDigest md = MessageDigest.getInstance("MD5"); - md.update(plainText.getBytes()); - byte b[] = md.digest(); - int i; - StringBuffer buf = new StringBuffer(""); - for (int offset = 0; offset < b.length; offset++) { - i = b[offset]; - if (i < 0) - i += 256; - if (i < 16) - buf.append("0"); - buf.append(Integer.toHexString(i)); - } - plainText = buf.toString(); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } - return plainText; - } - - public static String Md5Sixteen(String plainText) { - String result = null; - try { - MessageDigest md = MessageDigest.getInstance("MD5"); - md.update(plainText.getBytes()); - byte b[] = md.digest(); - int i; - StringBuffer buf = new StringBuffer(""); - for (int offset = 0; offset < b.length; offset++) { - i = b[offset]; - if (i < 0) - i += 256; - if (i < 16) - buf.append("0"); - buf.append(Integer.toHexString(i)); - } - result = buf.toString().substring(8, 24); - System.out.println("mdt 16bit: " + buf.toString().substring(8, 24)); - System.out.println("md5 32bit: " + buf.toString()); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } - return result; - } - - // 生成4位随机数验证码 - public static int getCode() { - return (int) (Math.random() * 9000 + 1000); - } - - /** - * Boolean 类型转换string - * - * @param param - * @return - */ - public static String booleanToString(Boolean param) { - if (null != param) { - return param ? "1" : "0"; - } else { - return "0"; - } - } - - /** - * 获取当前日期几年前的日期 - * @param date 日期 - * @param year 年 - * @return - */ - public static Date getBeforeDate(Date date,int year){ - Calendar cal = Calendar.getInstance(); - cal.setTime(date); - cal.add(Calendar.YEAR,year); - return cal.getTime(); - } - - public static boolean validateNewAdress(String address) { - if(StringUtils.isBlank(address)) { - return false; - } - String specChar = "[`~!@#$%^&*()+=|{}':;',//[//].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?-~ - ]"; - String addressChar = "^(.*[\u4e00-\u9fa5]+.*([0-9]|[零一二三四五六七八九十壹贰叁肆伍陆柒捌玖拾])+.*)|(.*([0-9]|[零一二三四五六七八九十壹贰叁肆伍陆柒捌玖拾])+.*[\u4e00-\u9fa5]+.*)$"; - Pattern pattern = Pattern.compile(specChar); - Pattern reg = Pattern.compile(addressChar); - Matcher matcher1 = pattern.matcher(address); - Matcher matcher2= reg.matcher(address); - if (matcher1.matches() || !matcher2.matches() || address.length() < 12 || address.length() > 50) { - return false; - } else { - return true; - } - } - - /** - * 获取一个唯一的序列号,助于排错 - * - * @return 唯一序列号 - */ - public static String getUUID() { - return UUID.randomUUID().toString().replaceAll("-", ""); - } - - /** - * 版本号转换成数字 - * - * @author: liuyafei - * @date 创建时间:2016年10月10日 - * @version 1.0 - * @parameter - * @return - */ - public static int transVersionToNum(String version) { - int num = 0; - String[] msg = version.split("\\."); - int len = msg.length; - if (len >= 3) { - num += Integer.parseInt(msg[2]); - } - if (len >= 2) { - num += Integer.parseInt(msg[1]) * 10; - } - if (len >= 1) { - num += Integer.parseInt(msg[0]) * 100; - } - return num; - } - - /** - * 生成指定范围内随机数 - * @param min 最小随机数 - * @param max 最大随机数 - * @return 随机数 - */ - public static int getRandom(int min, int max) { - Random random = new Random(); - int maxrand = random.nextInt(max); - int s = maxrand % (max - min + 1) + min; - return s; - } - - /** - * 概率 - * @param i 概率值 - * @return - */ - public static boolean rendomChance(int i) { - Random r = new Random(); - int next = r.nextInt(101); - return next > 0 && next <= i; - } - - /** - * 获取当前倒推X秒的时间 - * - * @param second - * @return - */ - public static Date getSubSecondDate(int second) { - Calendar cal = Calendar.getInstance(); - cal.set(Calendar.SECOND, cal.get(Calendar.SECOND) - second); - return cal.getTime(); - } - - public static void main(String[] args) { - boolean r = rendomChance(50); - System.out.println(r); - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/CustomValueUtils.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/CustomValueUtils.java deleted file mode 100644 index 4f56598..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/CustomValueUtils.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.risk.riskmanage.util; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; - -import java.util.HashSet; -import java.util.Set; - -public class CustomValueUtils { - - public static final Set getFieldEnSet(String custom) { - Set fieldEns = new HashSet<>(); - if (custom != null && !"".equals(custom)) { - JSONObject jsonObject = JSON.parseObject(custom); - Object farr = jsonObject.get("farr"); - if (farr != null) { - JSONArray jsonArray = JSONArray.parseArray(JSON.toJSONString(farr)); - if (jsonArray != null && jsonArray.size() > 0) { - for (Object o : jsonArray) { - JSONObject field = JSON.parseObject(JSON.toJSONString(o)); - Object fieldEn = field.get("fieldEn"); - if (fieldEn != null && !"".equals(fieldEn)) { - fieldEns.add(fieldEn.toString()); - } - } - } - } - } - return fieldEns; - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/DataHelp.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/DataHelp.java deleted file mode 100644 index e0b0837..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/DataHelp.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.risk.riskmanage.util; - -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; - -public class DataHelp { - public static int day=0; - public static String getNowDate(){ - Date date = new Date(); - SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - String s = simple.format(date); - return s; - } - public static String getEndDate(){ - SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - Calendar c = Calendar.getInstance(); - c.add(Calendar.DATE, + DataHelp.day); - Date monday = c.getTime(); - String s = simple.format(monday); - return s; - } - public static String getNowDateString(){ - Date date = new Date(); - SimpleDateFormat simple = new SimpleDateFormat("yyyyMMddHHmmss"); - String s = simple.format(date); - return s; - } - public static String getDay(){ - Date date = new Date(); - SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd"); - String s = simple.format(date); - return s; - } - public static void main(String[] args) { - System.out.println(getNowDate()); - System.out.println(getNowDateString()); - - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/ImageCut.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/ImageCut.java deleted file mode 100644 index 46569b2..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/ImageCut.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.risk.riskmanage.util; - -import java.awt.Graphics; -import java.awt.Image; -import java.awt.Toolkit; -import java.awt.image.BufferedImage; -import java.awt.image.CropImageFilter; -import java.awt.image.FilteredImageSource; -import java.awt.image.ImageFilter; -import java.io.File; - -import javax.imageio.ImageIO; - -public class ImageCut { - /** - * 截取图片 - * @param srcImageFile 原图片地址 - * @param x 截取时的x坐标 - * @param y 截取时的y坐标 - * @param desWidth 截取的宽度 - * @param desHeight 截取的高度 - */ - public static void imgCut(String srcImageFile, int x, int y, int desWidth, - int desHeight) { - try { - Image img; - ImageFilter cropFilter; - BufferedImage bi = ImageIO.read(new File(srcImageFile+"_src.jpg")); - int srcWidth = bi.getWidth(); - int srcHeight = bi.getHeight(); - if (srcWidth >= desWidth && srcHeight >= desHeight) { - Image image = bi.getScaledInstance(srcWidth, srcHeight,Image.SCALE_DEFAULT); - cropFilter = new CropImageFilter(x, y, desWidth, desHeight); - img = Toolkit.getDefaultToolkit().createImage( - new FilteredImageSource(image.getSource(), cropFilter)); - BufferedImage tag = new BufferedImage(desWidth, desHeight, - BufferedImage.TYPE_INT_RGB); - Graphics g = tag.getGraphics(); - g.drawImage(img, 0, 0, null); - g.dispose(); - //输出文件 - ImageIO.write(tag, "JPEG", new File(srcImageFile+"_cut.jpg")); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/ListPageUtil.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/ListPageUtil.java deleted file mode 100644 index 1dd7965..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/ListPageUtil.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.risk.riskmanage.util; - -import java.util.Collections; -import java.util.List; - -/** - * 类说明 - */ -public class ListPageUtil { - /**原集合*/ - private List data; - - /** 上一页 */ - private int lastPage; - - /** 当前页 */ - private int nowPage; - - /** 下一页 */ - private int nextPage; -// - /** 每页条数 */ - private int pageSize; - - /** 总页数 */ - private int totalPage; - - /** 总数据条数 */ - private int totalCount; - - public int getPageSize() { - return pageSize; - } - - public List getData() { - return data; - } - public int getLastPage() { - return lastPage; - } - - public int getNowPage() { - return nowPage; - } - - public int getNextPage() { - return nextPage; - } - - public int getTotalPage() { - return totalPage; - } - - public int getTotalCount() { - return totalCount; - } - - public ListPageUtil(List data,int nowPage,int pageSize) { - if (data == null || data.isEmpty()) { - throw new IllegalArgumentException("data must be not empty!"); - } - - this.data = data; - this.pageSize = pageSize; - - this.nowPage = nowPage; - this.totalCount = data.size(); - this.totalPage = (totalCount + pageSize - 1) / pageSize; - this.lastPage = nowPage-1>1? nowPage-1:1; - this.nextPage = nowPage>=totalPage? totalPage: nowPage + 1; - - } - - /** - * 得到分页后的数据 - * - * @param pageNum 页码 - * @return 分页后结果 - */ - public List getPagedList() { - int fromIndex = (nowPage - 1) * pageSize; - if (fromIndex >= data.size()) { - return Collections.emptyList();//空数组 - } - if(fromIndex<0){ - return Collections.emptyList();//空数组 - } - int toIndex = nowPage * pageSize; - if (toIndex >= data.size()) { - toIndex = data.size(); - } - return data.subList(fromIndex, toIndex); - } - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/MD5.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/MD5.java deleted file mode 100644 index 1ca244a..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/MD5.java +++ /dev/null @@ -1,91 +0,0 @@ - -package com.risk.riskmanage.util; - -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; - -/** - * ClassName:MD5
- * Description: md5加密工具类.
- */ -public class MD5 { - /** - * 全局数组 - */ - private static final String[] DIGITS = { "0", "1", "2", "3", "4", "5", - "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "H", "i", - "j", "k", "l", "m", "n", "~", "$", "@", "%", "*", "#", "&", "!" }; - - public MD5() { - } - - /** - * byteToArrayString:(返回形式为数字跟字符串).
- * @author wz - * @param bByte byte - * @return 返回形式为数字跟字符串 - */ - private static String byteToArrayString(byte bByte) { - int iRet = bByte; - if (iRet < 0) { - iRet += 256; - } - int iD1 = iRet / 32; - int iD2 = iRet % 32; - return DIGITS[iD1] + DIGITS[iD2]; - } - - /** - * byteToNum:(返回形式只为数字).
- * @param bByte byte - * @return 返回形式只为数字 - */ - private static String byteToNum(byte bByte) { - int iRet = bByte; - System.out.println("iRet1=" + iRet); - if (iRet < 0) { - iRet += 256; - } - return String.valueOf(iRet); - } - - /** - * byteToString:(转换字节数组为16进制字串).
- * @param bByte byte数组 - * @return 返回转换字节数组为16进制字串 - */ - private static String byteToString(byte[] bByte) { - StringBuffer sBuffer = new StringBuffer(); - for (int i = 0; i < bByte.length; i++) { - sBuffer.append(byteToArrayString(bByte[i])); - } - return sBuffer.toString(); - } - - /** - * GetMD5Code:(md5加密).
- * @author wz - * @param param 需要加密的字段 - * @return 加密后的字段 - */ - public static String GetMD5Code(String param) { - String resultString = null; - try { - resultString = new String(param); - MessageDigest md = MessageDigest.getInstance("MD5"); - // md.digest() 该函数返回值为存放哈希值结果的byte数组 - resultString = byteToString(md.digest(param.getBytes())); - } catch (NoSuchAlgorithmException ex) { - ex.printStackTrace(); - } - return resultString; - } - - -// public static void main(String[] args) { -// MD5 getMD5 = new MD5(); -// System.out.println(getMD5.GetMD5Code("123456")); -// } - -} - diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/PageBean.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/PageBean.java deleted file mode 100644 index 5ed5c33..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/PageBean.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.risk.riskmanage.util; - -import java.util.List; - -/** - * @param - */ -public class PageBean { - - private int totalCount;//总记录数 - private int totalPage;//总页数 - private int currentPage;//当前页码 - private int pageSize;//每页显示的条数 - private List list;//每页显示的数据集合 - - public int getTotalCount() { - return totalCount; - } - - public void setTotalCount(int totalCount) { - this.totalCount = totalCount; - } - - public int getTotalPage() { - return totalPage; - } - - public void setTotalPage(int totalPage) { - this.totalPage = totalPage; - } - - public int getCurrentPage() { - return currentPage; - } - - public void setCurrentPage(int currentPage) { - this.currentPage = currentPage; - } - - public int getPageSize() { - return pageSize; - } - - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } - - public List getList() { - return list; - } - - public void setList(List list) { - this.list = list; - } - - @Override - public String toString() { - return "PageBean{" + - "totalCount=" + totalCount + - ", totalPage=" + totalPage + - ", currentPage=" + currentPage + - ", pageSize=" + pageSize + - ", list=" + list + - '}'; - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/PagerJsonResponse.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/PagerJsonResponse.java deleted file mode 100644 index f10e3d0..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/PagerJsonResponse.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.risk.riskmanage.util; - -import java.io.Serializable; -import java.util.List; - -import com.risk.riskmanage.system.model.Pager; - -public class PagerJsonResponse { - /** - * Current page - */ - private int page; - - /** - * Total pages - */ - private int total; - - /** - * Total number of records - */ - private int records; - private int pagecount; - - /** - * Contains the actual data - */ - private List rows; - - public PagerJsonResponse() { - - } - - public PagerJsonResponse(List rows, Pager pager) { - this.rows = rows; - this.total = pager.getTotalResult(); - this.records = pager.getTotalResult(); - this.page = pager.getPage(); - this.pagecount = pager.getPageCount(); - } - - public int getPage() { - return page; - } - - public void setPage(int page) { - this.page = page; - } - - public int getTotal() { - return total; - } - - public void setTotal(int total) { - this.total = total; - } - - public int getRecords() { - return records; - } - - public void setRecords(int records) { - this.records = records; - } - - public List getRows() { - return rows; - } - - public void setRows(List rows) { - this.rows = rows; - } - - public int getPagecount() { - return pagecount; - } - - public void setPagecount(int pagecount) { - this.pagecount = pagecount; - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/Properties.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/Properties.java deleted file mode 100644 index f7658cf..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/Properties.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.risk.riskmanage.util; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target(ElementType.FIELD) -@Retention(RetentionPolicy.RUNTIME) -public @interface Properties { - String name(); -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/RequestUtil.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/RequestUtil.java deleted file mode 100644 index 2cc5c14..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/RequestUtil.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.risk.riskmanage.util; - -import javax.servlet.http.HttpServletRequest; - -public class RequestUtil { - /** - * 获取客户端IP, 考虑web server代理 - * - * @param request - * @return - */ - public static String getClientIP(HttpServletRequest request) { - - String ip = request.getHeader("x-forwarded-for"); - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - ip = request.getHeader("Proxy-Client-IP"); - } - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - ip = request.getHeader("WL-Proxy-Client-IP"); - } - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - ip = request.getHeader("HTTP_CLIENT_IP"); - } - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - ip = request.getHeader("HTTP_X_FORWARDED_FOR"); - } - if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { - ip = request.getRemoteAddr(); - } - - if (ip != null&&ip.indexOf(',') > 0) { - ip = ip.substring(0, ip.indexOf(',')).trim(); - } - - return ip; - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/ResponseUtil.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/ResponseUtil.java deleted file mode 100644 index effd3d7..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/ResponseUtil.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.risk.riskmanage.util; - -import com.github.pagehelper.PageInfo; - -import java.util.HashMap; -import java.util.Map; - -public class ResponseUtil { - public static Map getResponseMap(PageInfo pageInfo){ - HashMap responseMap = new HashMap<>(); - responseMap.put("pageInfo",pageInfo); - responseMap.put("klist",pageInfo.getList()); - pageInfo.setList(null); - return responseMap; - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/Section.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/Section.java deleted file mode 100644 index e78c904..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/Section.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.risk.riskmanage.util; - - -public class Section { - - public float x; - public float y; - - public Section(float low,float hight){ - - x=low; - y=hight; - } - - public String toString() { - return "[" + x + "," + y + "]"; - } - - boolean isSample(Section section) { - return x == section.x && y == section.y; - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/SectionUtils.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/SectionUtils.java deleted file mode 100644 index 6abfb77..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/SectionUtils.java +++ /dev/null @@ -1,233 +0,0 @@ -package com.risk.riskmanage.util; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class SectionUtils { - public final static float max_float = Integer.MAX_VALUE; - public final static float min_float = Integer.MIN_VALUE; - - private static void SecSort(Section[] secs, int low, int high) { - int i = low; - int j = high; - Section temp = secs[low]; - while (i < j) { - while (i < j && temp.x < secs[j].x) - j--; - if (i < j) { - secs[i] = secs[j]; - i++; - } - while (i < j && temp.x > secs[i].x) - i++; - if (i < j) { - secs[j] = secs[i]; - j--; - } - } - secs[i] = temp; - - if (low < i) - SecSort(secs, low, i - 1); - if (high > j) - SecSort(secs, j + 1, high); - } - - private static boolean inSection(Section[] secs, Section s, int offset) { - boolean ret = false; - for (int k = 0; k < secs.length; k++) { - if (secs[k].x == secs[k].y || s.x == s.y) - continue; - - if (secs[k].x == s.x || secs[k].y == s.y) - continue; - - if (secs[k].x <= s.x && secs[k].y >= s.y && offset != k) { - ret = true; - break; - } else if (secs[k].x <= s.x && s.x < secs[k].y && offset != k) { - ret = true; - break; - } - } - return ret; - - } - - public static boolean checkSectionCoincide(List section_list) { - boolean ret = false; - String temp = ""; - float min = 0; - float max = 0; - - Section[] sections = new Section[section_list.size()]; - for (int i = 0; i < section_list.size(); i++) { - temp = section_list.get(i); - String chars[] = temp.split(","); - if (chars.length == 2) { - if ("(".equals(chars[0]) || "[".equals(chars[0])) { - min = min_float; - } else { - if (chars[0].indexOf("(") == 0) { - temp = chars[0].replace("(", ""); - min = parseFloat(temp); - } else if (chars[0].indexOf("[") == 0) { - temp = chars[0].replace("[", ""); - min = parseFloat(temp); - } - } - if (")".equals(chars[1]) || "]".equals(chars[1])) { - max = max_float; - } else { - if (chars[1].indexOf(")") > 0) { - temp = chars[1].replace(")", ""); - max = parseFloat(temp); - } else if (chars[1].indexOf("]") > 0) { - temp = chars[1].replace("]", ""); - max = parseFloat(temp); - } - } - sections[i] = new Section(min, max); - } else { - sections[i] = new Section(parseFloat(temp), parseFloat(temp)); - } - } - - int n = sections.length; - SecSort(sections, 0, n - 1); - for (int i = 0; i < n; i++) { - ret = inSection(sections, sections[i], i); - if (ret) - break; - } - return ret; - } - - public static boolean checkSectionValid(List section_list) { - boolean ret_min = false; - boolean ret_max = false; - boolean ret_lr = false; - String temp = ""; - - HashMap left_hp = new HashMap(); - HashMap right_hp = new HashMap(); - HashMap collection = new HashMap(); - - for (int i = 0; i < section_list.size(); i++) { - temp = section_list.get(i); - String chars[] = temp.split(","); - - if (chars.length == 2) { - if ("(".equals(chars[0]) || "[".equals(chars[0])) { - if ("(".equals(chars[0])) - ret_min = true; - } else { - if (chars[0].indexOf("(") == 0) { - temp = chars[0].replace("(", ""); - collection.put(temp, temp); - if (left_hp.get(chars[0]) != null) { - left_hp.put(chars[0], left_hp.get(chars[0]) + 1); - } else { - left_hp.put(chars[0], 1); - } - } else if (chars[0].indexOf("[") == 0) { - temp = chars[0].replace("[", ""); - collection.put(temp, temp); - if (left_hp.get(chars[0]) != null) { - left_hp.put(chars[0], left_hp.get(chars[0]) + 1); - } else { - left_hp.put(chars[0], 1); - } - } - } - - if (")".equals(chars[1]) || "]".equals(chars[1])) { - if (")".equals(chars[1])) - ret_max = true; - } else { - if (chars[1].indexOf(")") > 0) { - temp = chars[1].replace(")", ""); - collection.put(temp, temp); - - if (right_hp.get(chars[1]) != null) { - right_hp.put(chars[1], right_hp.get(chars[1]) + 1); - } else { - right_hp.put(chars[1], 1); - } - } else if (chars[1].indexOf("]") > 0) { - temp = chars[1].replace("]", ""); - collection.put(temp, temp); - if (right_hp.get(chars[1]) != null) { - right_hp.put(chars[1], right_hp.get(chars[1]) + 1); - } else { - right_hp.put(chars[1], 1); - } - } - } - } else { - if (right_hp.get(String.format("%s]", temp)) != null) { - right_hp.put(String.format("%s]", temp), - right_hp.get(String.format("%s]", temp)) + 1); - } else { - right_hp.put(String.format("%s]", temp), 1); - } - - if (left_hp.get(String.format("[%s", temp)) != null) { - left_hp.put(String.format("[%s", temp), - left_hp.get(String.format("[%s", temp)) + 1); - } else { - left_hp.put(String.format("[%s", temp), 1); - } - } - } - - int ct1 = 0; - int ct2 = 0; - for (Map.Entry entry : left_hp.entrySet()) { - String key = entry.getKey(); - ct1++; - if (key.indexOf("(") == 0) { - key = key.replace("(", ""); - key = String.format("%s]", key); - if (right_hp.get(key) != null && right_hp.get(key) == 1) { - - ct2++; - } - - } else if (key.indexOf("[") == 0) { - key = key.replace("[", ""); - key = String.format("%s)", key); - if (right_hp.get(key) != null && right_hp.get(key) == 1) { - ct2++; - } - } - } - - if (ct1 == ct2) { - ret_lr = true; - } - return (ret_min && ret_max && ret_lr); - } - - public static float parseFloat(String s) { - float i = 0f; - try { - i = Float.parseFloat(s); - } catch (Exception e) { - e.printStackTrace(); - } - return i; - } - - public static void main(String[] args) { - ArrayList section_list = new ArrayList(); - section_list.add("[0,3)"); - section_list.add("(4,)"); - section_list.add("(,0.5)"); - section_list.add("[3,4]"); - System.out.println("区间是否完整:"+checkSectionValid(section_list)); //检测表达式区间完整度 - System.out.println("区间是否重叠:"+checkSectionCoincide(section_list)); //检测表达式区间完整度 - } -} \ No newline at end of file diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/SessionManager.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/SessionManager.java deleted file mode 100644 index bd3b2ae..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/SessionManager.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.risk.riskmanage.util; - -import com.alibaba.ttl.TransmittableThreadLocal; -import com.risk.riskmanage.system.model.User; - -/** - * session管理类 - */ -public class SessionManager { - - private static TransmittableThreadLocal session = new TransmittableThreadLocal() { - - }; - public static AccountSessionWrap getSession() { - return session.get(); - } - - public static void setSession(AccountSessionWrap conn) { - session.set(conn); - } - - public static User getLoginAccount(){ - if(getSession() != null){ - return getSession().getUser(); - } else { - return null; - } - } -} \ No newline at end of file diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/StringUtil.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/StringUtil.java deleted file mode 100644 index ad9a90b..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/StringUtil.java +++ /dev/null @@ -1,467 +0,0 @@ -package com.risk.riskmanage.util; - -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -/** - * @ClassName: StringUtil - * @Description: String 工具类 - */ -public class StringUtil { - - /** - *

判断是否是有效的字符串,空字符串为无效字符串

- * - * @param str - * @return boolean - */ - public static boolean isValidStr(String str) { - return str != null && str.trim().length() > 0; - } - - /** - *

判断是字符串否是为空,字符串为空,返回 "",反之返回其字符串本身.

- * - *

if str is null then convret str to "".

- * - * @param str - * @return String - */ - public static String convertStrIfNull(String str) { - return str == null ? SysConstant.EMPTY_STRING : str; - } - - /** - *

根据字符串转换为布尔值.

- * - * @param str - * @return boolean - */ - public static boolean getStrToBoolean(String str) { - return isValidStr(str) ? str.toLowerCase().trim().equals(SysConstant.TRUE) : false; - } - - /** - *

根据字符串转换为 整型(int)并返回;转换失败,则返回0.

- * - *

convert str value to int. if fail,then return 0.

- * - * @param str - * @return int - */ - public static int getStrToInt(String str) { - try { - return Integer.parseInt(str); - } catch (NumberFormatException e) { - return 0; - } - } - - /** - *

根据字符串转换为 整型(int)并返回;转换失败,则返回 指定的值.

- * - *

convert str value to int. if fail,then return defaultvalue.

- * - * @param str - * @param defaultValue - * @return int - */ - public static int getStrToInt(String str, int defaultValue) { - try { - return Integer.parseInt(str); - } catch (NumberFormatException e) { - return defaultValue; - } - } - - /** - *

根据字符串转换为long.

- * - * @param str - * @return long - */ - public static long getStrTolong(String str) { - long result = 0; - if (!isValidStr(str)) { - return result; - } - try { - result = Long.parseLong(str); - } catch (NumberFormatException e) { - e.printStackTrace(); - } - return result; - } - - /** - *

根据字符串转换为double.

- * - *

convert String to double

- * - * @param str - * @return double - */ - public static double getStrTodouble(String str) { - double result = 0; - if (!isValidStr(str)) { - return result; - } - try { - result = Double.parseDouble(str); - } catch (NumberFormatException e) { - e.printStackTrace(); - } - return result; - } - - /** - *

根据字符串转换为BigDecimal.

- * - *

convert String object to BigDecimal

- * - * @param str - * @return BigDecimal - */ - public static BigDecimal getStrToBigDecimal(String str) { - BigDecimal result = new BigDecimal(0); - if (!isValidStr(str)) { - return result; - } - try { - result = new BigDecimal(str); - } catch (NumberFormatException e) { - e.printStackTrace(); - } - return result; - } - - /** - *

根据字符串转换为Integer.

- * - *

convert String to Integer.

- * - * @param str - * @return Integer - */ - public static Integer getStrToInteger(String str) { - Integer result = new Integer(0); - if (!isValidStr(str)) { - return result; - } - try { - result = Integer.valueOf(str); - } catch (NumberFormatException e) { - e.printStackTrace(); - } - return result; - } - - /** - *

根据字符串转换为Long.

- * - *

convert String to Long.

- * - * @param str - * @return Long - */ - public static Long getStrToLong(String str) { - Long result = new Long(0); - if (!isValidStr(str)) { - return result; - } - try { - result = Long.valueOf(str.trim()); - } catch (NumberFormatException e) { - e.printStackTrace(); - } - return result; - } - - /** - *

根据字符串转换为Double.

- * - *

convert String to Double

- * - * @param str - * @return Double - */ - public static Double getStrToDouble(String str) { - Double result = new Double(0); - if (!isValidStr(str)) { - return result; - } - try { - result = Double.valueOf(str); - } catch (NumberFormatException e) { - e.printStackTrace(); - } - return result; - } - - /** - *

根据数组转换为字符串,用","拼接.

- *

例:

- *

    String[] strArray = new String[]{"How","do","you","do"};

- *

    拼接后字符串样例:How,do,you,do

- * - *

convert Object array to String use ",".

- * - * @param Object[] - * @return String - */ - public static String getArrToStr(Object[] obj) { - if (obj == null) { - return null; - } - - StringBuffer buffer = new StringBuffer(); - if (obj.length > 0) { - buffer.append(obj[0]); - } - - for (int m = 1; m < obj.length; m++) { - buffer.append(SysConstant.COMMA).append(obj[m]); - } - - return buffer.toString(); - } - - /** - *

去掉重复数据(1,2,3,2,4 => 1,2,3,4)

- * - * @param metadata - * @param tagStr - * @return String - */ - public static String removeEqualStr(String metadata, String tagStr) { - if (!StringUtil.isValidStr(metadata)) { - return SysConstant.EMPTY_STRING; - } - Set set = new HashSet(); - String[] arr = metadata.split(tagStr); - for (String temp : arr) { - if (StringUtil.isValidStr(temp)) { - set.add(temp); - } - } - Iterator it = set.iterator(); - StringBuffer returnMetadata = new StringBuffer(); - while (it.hasNext()) { - returnMetadata.append(it.next() + tagStr); - } - return returnMetadata.toString().substring(0,returnMetadata.length() - 1); - } - - /** - *

查询是否有重复数据

- * - * @param strArr - * @param str - * @param tagStr - * @return boolean - */ - public static boolean hasEqualStr(String strArr, String str, String tagStr) { - boolean bool = false; - if (StringUtil.isValidStr(strArr)) { - String[] arr = strArr.split(tagStr); - for (String temp : arr) { - if (temp.equals(str)) { - bool = true; - break; - } - } - } - return bool; - } - - /** - *

根据字符串将其转换编码为UTF-8的字符串.

- * - *

convert type to utf-8

- * - * @param str - * @return utf-8 string - */ - public static String toUtf8String(String str) { - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < str.length(); i++) { - char c = str.charAt(i); - if (c >= 0 && c <= 255) { - sb.append(c); - } else { - byte[] b; - try { - b = Character.toString(c).getBytes("utf-8"); - } catch (Exception ex) { - b = new byte[0]; - } - for (int j = 0; j < b.length; j++) { - int k = b[j]; - if (k < 0) - k += 256; - sb.append("%" + Integer.toHexString(k).toUpperCase()); - } - } - } - return sb.toString(); - } - - /** - *

根据字符串指定的位置更新字符串内容

- * - * @param formString 被更新字符串 - * @param updateIndex 选择更新位数 - * @param updateValue 更新为值 - * - * @return String - */ - public static String formatIntegrity(String formatString, int updateIndex, char updateValue) { - if (!isValidStr(formatString)) { - return formatString; - } - if (updateIndex < 1) { - return formatString; - } - if (updateIndex > formatString.length()) { - return formatString; - } - char[] formatStringChar = formatString.toCharArray(); - formatStringChar[updateIndex] = updateValue; - - return String.valueOf(formatStringChar); - } - - /** - *

转换特殊字符

- * - * @param str 含有特殊字符的字符串 - * - * @return String - */ - public static String converSpecialChar(String str) { - if (!isValidStr(str)) { - return str; - } - str = str.trim(); - if (str.indexOf("\\") >= 0) { - str = str.replaceAll("\\\\", "\\\\\\\\\\\\\\\\"); - } - if (str.indexOf("'") >= 0) { - str = str.replaceAll("'", "\\\\'"); - } - if (str.indexOf("\"") >= 0) { - str = str.replaceAll("\"", "\\\\\""); - } - if (str.indexOf("%") >= 0) { - str = str.replaceAll("%", "\\\\%"); - } - return str; - } - - /** - *

获取字符串字节长度(包含中文和中文符号)

- * - * @param str 含有中文和中文符号的字符串 - * - * @return int - */ - public static int getLength(String str){ - return str.replaceAll("[\u4E00-\u9FA5\u3000-\u303F\uFF00-\uFFEF]", "rr").length(); - } - - /** - *

此排序方法仅应用于数字类型的string数字排序

- * - * @param arrays 有long类型的数字组成的String 数组 - * @return 排序后的数组 - */ - public static String[] sortArrays(String[] arrays){ - for(int i = 0; i < arrays.length - 1; i++) { - String temp =""; - for(int j = 0; j < arrays.length - i - 1; j++) { - if(StringUtil.getStrTolong(arrays[j]) >StringUtil.getStrTolong(arrays[j +1])) { - temp = arrays[j + 1]; - arrays[j + 1] = arrays[j]; - arrays[j] = temp; - } - } - } - return arrays; - } - - /** - *

此排序方法仅应用于浮点类型的string数字排序

- * - * @param arrays 有浮点类型的数字组成的String 数组 - * @return 排序后的数组 - */ - public static String[] sortArraystoBigDecimal(String[] arrays) { - for (int i = 0; i < arrays.length - 1; i++) { - String temp = ""; - for (int j = 0; j < arrays.length - i - 1; j++) { - if (StringUtil.getStrToBigDecimal(arrays[j]).compareTo( - StringUtil.getStrToBigDecimal(arrays[j + 1])) == 1) { - temp = arrays[j + 1]; - arrays[j + 1] = arrays[j]; - arrays[j] = temp; - } - } - } - return arrays; - } - - /** - *

判断字符串是否为NUll,或者为空字符

- * @param str 字符串 - * @return boolean - * */ - public static boolean isBlank(String str){ - if(str == null || str.equals("")){ - return true; - } - return false; - } - - - /** - *

将字符拆分,并放入list集合

- * @param str 字符串 - * @return list - * */ - public static List toLongList(String str){ - List idList = new ArrayList(); - if(!isBlank(str)){ - String[] idsArray = str.split(","); - for (int i = 0; i < idsArray.length; i++) { - idList.add(Long.parseLong(idsArray[i])); - } - } - return idList; - } - - - public static String listToString(List list, char separator) { - return org.apache.commons.lang.StringUtils.join(list.toArray(),separator); - } - - public static void main(String[] args) { - //String result = "aaaa ,,aaa"; - //System.out.println(getLength(result)); - - String[] strArray = new String[]{"How","d$o","you","do"}; - strArray = new String[]{"5.36","5.003","1.36","9.87","3.33333379"}; - //strArray = StringUtil.sortArrays(strArray); - strArray = StringUtil.sortArraystoBigDecimal(strArray); - String str = StringUtil.getArrToStr(strArray); - System.out.println(str); - - //System.out.println(StringUtil.formatIntegrity("dkkemnkn", 2, '6')); - - } - - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/SysConstant.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/SysConstant.java deleted file mode 100644 index 7ecc106..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/SysConstant.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.risk.riskmanage.util; - -/** - * @ClassName: SysConstant - * @Description: 系统常量类 - */ -public final class SysConstant { - - public static final String EMPTY_STRING =""; - - public static final String SPACE =" "; - - public static final String COMMA =","; - - public static final String SEMICOLON =";"; - - public static final String MINUS ="-"; - - public static final String UNDERLINE ="_"; - - public static final String DATA_POINT ="."; - - public static final String POINT ="\\."; - - public static final String COLON =":"; - - public static final String WN ="// "; - - public static final String AT ="@"; - - public static final String SLASH ="/"; - - public static final String BACKSLASH ="\\\\"; - - public static final String YES ="Y"; - - public static final String NO ="N"; - - public static final String TRUE ="true"; - - public static final String FALSE ="false"; - - public static final String LEFT_BRACKET ="("; - - public static final String RIGHT_BRACKET =")"; - - public static final String ELLIPSIS ="..."; - - public static final String ESCAPE ="\\"; - - public static final String EXCLAMATION ="!"; - - public static final String INFINITY ="∞"; - - /** - * 系统统一操作成功码 - */ - public static final String SUCCESS_CODE = "200"; - - /** - * 系统统一操作成功提示信息 - */ - public static final String SUCCESS_MESSAGE = "操作成功"; - - /** - * 系统统一操作失败码 - */ - public static final String FAIL_CODE = "500"; - - /** - * 系统统一操作失败提示信息 - */ - public static final String FAIL_MESSAGE = "操作失败"; - - /** - * 系统统一操作失败码 - */ - public static final String UNUSE_CODE = "300"; - - /** - * 系统统一操作失败提示信息 - */ - public static final String UNUSE_MESSAGE = "已停用"; - - /** - * 系统统一操作失败码 - */ - public static final String DEL_CODE = "400"; - - /** - * 系统统一操作失败提示信息 - */ - public static final String DEL_MESSAGE = "已删除"; -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/UploadController.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/UploadController.java deleted file mode 100644 index 70d919e..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/UploadController.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.risk.riskmanage.util; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.OutputStream; -import javax.servlet.http.HttpServletRequest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.multipart.MultipartFile; -import org.springframework.web.servlet.ModelAndView; -import com.risk.riskmanage.common.basefactory.BaseController; - - -/** - * @ClassName: UploadController
- * @Description: TODO ADD FUNCTION.
- */ -@Controller - -public class UploadController extends BaseController { - static Logger log = LoggerFactory.getLogger(UploadController.class); - - @RequestMapping("/upload") - public ModelAndView uploadFile( - @RequestParam(value = "file", required = true) MultipartFile file, - HttpServletRequest request, ModelMap model) { - log.info(" upload file " + file); - InputStream is = null; - OutputStream os = null; - - try { - - is = file.getInputStream(); - - File destFile = new File("C:\\img", "123456.jpg"); - // 获取文件类型ID - os = new FileOutputStream(destFile); - - byte[] b = new byte[4096]; - int length = 0; - while (true) { - length = is.read(b); - if (length < 0) - break; - os.write(b, 0, length); - } - - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } finally { - try { - if (is != null) { - is.close(); - } - if (os != null) { - os.close(); - } - } catch (Exception e) { - e.printStackTrace(); - - } finally { - System.gc(); - } - } - return new ModelAndView("uploadResult"); - } - - } diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/https/HttpClient.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/https/HttpClient.java deleted file mode 100644 index 5e4a4bf..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/https/HttpClient.java +++ /dev/null @@ -1,317 +0,0 @@ -package com.risk.riskmanage.util.https; - -import java.io.IOException; -import java.io.OutputStream; -import java.net.InetAddress; -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler; -import org.apache.commons.httpclient.Header; -import org.apache.commons.httpclient.HttpMethod; -import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; -import org.apache.commons.httpclient.cookie.CookiePolicy; -import org.apache.commons.httpclient.methods.GetMethod; -import org.apache.commons.httpclient.methods.PostMethod; -import org.apache.commons.httpclient.methods.multipart.PartBase; -import org.apache.commons.httpclient.params.HttpClientParams; -import org.apache.commons.httpclient.params.HttpConnectionManagerParams; -import org.apache.commons.httpclient.params.HttpMethodParams; -import org.apache.commons.httpclient.protocol.Protocol; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - - -public class HttpClient implements java.io.Serializable { - - static Logger log=LoggerFactory.getLogger(HttpClient.class); - - private static final long serialVersionUID = -176092625883595547L; - private static final int OK = 200; // OK: Success! - private static final int NOT_MODIFIED = 304; // Not Modified: There was no new data to return. - private static final int BAD_REQUEST = 400; // Bad Request: The request was invalid. An accompanying error message will explain why. This is the status versionCode will be returned during rate limiting. - private static final int NOT_AUTHORIZED = 401; // Not Authorized: Authentication credentials were missing or incorrect. - private static final int FORBIDDEN = 403; // Forbidden: The request is understood, but it has been refused. An accompanying error message will explain why. - private static final int NOT_FOUND = 404; // Not Found: The URI requested is invalid or the resource requested, such as a user, does not exists. - private static final int NOT_ACCEPTABLE = 406; // Not Acceptable: Returned by the Search API when an invalid format is specified in the request. - private static final int INTERNAL_SERVER_ERROR = 500;// Internal Server Error: Something is broken. Please post to the group so the Weibo team can investigate. - private static final int BAD_GATEWAY = 502;// Bad Gateway: Weibo is down or being upgraded. - private static final int SERVICE_UNAVAILABLE = 503;// Service Unavailable: The Weibo servers are up, but overloaded with requests. Try again later. The search and trend methods use this to indicate when you are being rate limited. - - private final static boolean DEBUG = true; - org.apache.commons.httpclient.HttpClient client = null; - - private MultiThreadedHttpConnectionManager connectionManager; - private int maxSize; - - public HttpClient() { - this(150, 30000, 30000, 1024 * 1024); - } - - public HttpClient(int maxConPerHost, int conTimeOutMs, int soTimeOutMs, - int maxSize) { - connectionManager = new MultiThreadedHttpConnectionManager(); - HttpConnectionManagerParams params = connectionManager.getParams(); - params.setDefaultMaxConnectionsPerHost(maxConPerHost); - params.setConnectionTimeout(conTimeOutMs); - params.setSoTimeout(soTimeOutMs); - - HttpClientParams clientParams = new HttpClientParams(); - // 忽略cookie 避免 Cookie rejected 警告 - clientParams.setCookiePolicy(CookiePolicy.IGNORE_COOKIES); - client = new org.apache.commons.httpclient.HttpClient(clientParams, - connectionManager); - Protocol myhttps = new Protocol("https", new MySSLSocketFactory(), 443); - Protocol.registerProtocol("https", myhttps); - this.maxSize = maxSize; - } - - /** - * log调试 - * - */ - private static void log(String message) { - if (DEBUG) { - log.debug(message); - } - } - - /** - * 处理http getmethod 请求 - * - */ - public int getHttps(String url){ - log.debug(" in getHttps,url="+url); - GetMethod method = new GetMethod(url); - int responseCode = -1; - try { - method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, - new DefaultHttpMethodRetryHandler(3, false)); - client.executeMethod(method); - responseCode = method.getStatusCode(); - log.info("https StatusCode:" + responseCode); - } catch (IOException ioe) { - ioe.printStackTrace(); - } finally { - method.releaseConnection(); - return responseCode; - } - } - public String get(String url) throws Exception { - return get(url, new PostParameter[0]).asString(); - } - - public Response get(String url, PostParameter[] params) - throws Exception { - log("Request:"); - log("GET:" + url); - if (null != params && params.length > 0) { - String encodedParams = HttpClient.encodeParameters(params); - if (-1 == url.indexOf("?")) { - url += "?" + encodedParams; - } else { - url += "&" + encodedParams; - } - } - GetMethod getmethod = new GetMethod(url); - return httpRequest(getmethod); - - } - - /** - * 处理http post请求 - * - */ - - public Response post(String url, PostParameter[] params) - throws Exception { - return post(url, params, true); - - } - - public Response post(String url, PostParameter[] params, - Boolean WithTokenHeader) throws HttpsException { - log("Request:"); - log("POST" + url); - PostMethod postMethod = new PostMethod(url); - for (int i = 0; i < params.length; i++) { - postMethod.addParameter(params[i].getName(), params[i].getValue()); - } - HttpMethodParams param = postMethod.getParams(); - param.setContentCharset("UTF-8"); - if (WithTokenHeader) { - return httpRequest(postMethod); - } else { - return httpRequest(postMethod, WithTokenHeader); - } - } - - /** - * 处理http post请求 - * - */ - - public String post(String url, Map params) - throws Exception { - String strResult = null; - - Response response= post(url, params, true); - if (response !=null) { - // 取出回应字串 - strResult = response.getResponseAsString(); - } - return strResult; - } - - public Response post(String url, Map params, - Boolean WithTokenHeader) throws HttpsException { - log("Request:"); - log("POST" + url); - PostMethod postMethod = new PostMethod(url); - postMethod.addRequestHeader("Content-type","application/x-www-form-urlencoded; charset=UTF-8"); - - for (Map.Entry entry : params.entrySet()) { - postMethod.addParameter(entry.getKey(), entry - .getValue()); - } - - HttpMethodParams param = postMethod.getParams(); - param.setContentCharset("UTF-8"); - if (WithTokenHeader) { - return httpRequest(postMethod); - } else { - return httpRequest(postMethod, WithTokenHeader); - } - } - public Response httpRequest(HttpMethod method) throws HttpsException { - return httpRequest(method, true); - } - - public Response httpRequest(HttpMethod method, Boolean WithTokenHeader) - throws HttpsException { - InetAddress ipaddr; - int responseCode = -1; - try { - ipaddr = InetAddress.getLocalHost(); - List
headers = new ArrayList
(); - method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, - new DefaultHttpMethodRetryHandler(3, false)); - client.executeMethod(method); - Header[] resHeader = method.getResponseHeaders(); - responseCode = method.getStatusCode(); - log("Response:"); - log("https StatusCode:" + String.valueOf(responseCode)); - - for (Header header : resHeader) { - log(header.getName() + ":" + header.getValue()); - } - Response response = new Response(); - response.setResponseAsString(method.getResponseBodyAsString()); - log(response.toString() + "\n"); - - if (responseCode != OK) - - { - try { - throw new HttpsException(getCause(responseCode)); - } catch (Exception e) { - e.printStackTrace(); - } - } - return response; - - } catch (IOException ioe) { - throw new HttpsException(ioe.getMessage(), ioe, responseCode); - } finally { - method.releaseConnection(); - } - - } - - /* - * 对parameters进行encode处理 - */ - public static String encodeParameters(PostParameter[] postParams) { - StringBuffer buf = new StringBuffer(); - for (int j = 0; j < postParams.length; j++) { - if (j != 0) { - buf.append("&"); - } - try { - buf.append(URLEncoder.encode(postParams[j].getName(), "UTF-8")) - .append("=") - .append(URLEncoder.encode(postParams[j].getValue(), - "UTF-8")); - } catch (java.io.UnsupportedEncodingException neverHappen) { - } - } - return buf.toString(); - } - - private static class ByteArrayPart extends PartBase { - private byte[] mData; - private String mName; - - public ByteArrayPart(byte[] data, String name, String type) - throws IOException { - super(name, type, "UTF-8", "binary"); - mName = name; - mData = data; - } - - protected void sendData(OutputStream out) throws IOException { - out.write(mData); - } - - protected long lengthOfData() throws IOException { - return mData.length; - } - - protected void sendDispositionHeader(OutputStream out) - throws IOException { - super.sendDispositionHeader(out); - StringBuilder buf = new StringBuilder(); - buf.append("; filename=\"").append(mName).append("\""); - out.write(buf.toString().getBytes()); - } - } - - private static String getCause(int statusCode) { - String cause = null; - switch (statusCode) { - case NOT_MODIFIED: - break; - case BAD_REQUEST: - cause = "The request was invalid. An accompanying error message will explain why. This is the status versionCode will be returned during rate limiting."; - break; - case NOT_AUTHORIZED: - cause = "Authentication credentials were missing or incorrect."; - break; - case FORBIDDEN: - cause = "The request is understood, but it has been refused. An accompanying error message will explain why."; - break; - case NOT_FOUND: - cause = "The URI requested is invalid or the resource requested, such as a user, does not exists."; - break; - case NOT_ACCEPTABLE: - cause = "Returned by the Search API when an invalid format is specified in the request."; - break; - case INTERNAL_SERVER_ERROR: - cause = "Something is broken. Please post to the group so the Weibo team can investigate."; - break; - case BAD_GATEWAY: - cause = "Weibo is down or being upgraded."; - break; - case SERVICE_UNAVAILABLE: - cause = "Service Unavailable: The Weibo servers are up, but overloaded with requests. Try again later. The search and trend methods use this to indicate when you are being rate limited."; - break; - default: - cause = ""; - } - return statusCode + ":" + cause; - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/https/HttpsException.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/https/HttpsException.java deleted file mode 100644 index 3b5ef7d..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/https/HttpsException.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.risk.riskmanage.util.https; - - -public class HttpsException extends Exception { - private int statusCode = -1; - private int errorCode = -1; - private String request; - private String error; - private static final long serialVersionUID = -2623309261327598087L; - - public HttpsException(String msg) { - super(msg); - } - - public HttpsException(Exception cause) { - super(cause); - } - - public HttpsException(String msg, Exception cause) { - super(msg, cause); - } - - public HttpsException(String msg, Exception cause, int statusCode) { - super(msg, cause); - this.statusCode = statusCode; - - } - - public int getStatusCode() { - return this.statusCode; - } - - public int getErrorCode() { - return errorCode; - } - - public String getRequest() { - return request; - } - - public String getError() { - return error; - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/https/MySSLSocketFactory.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/https/MySSLSocketFactory.java deleted file mode 100644 index ca7914e..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/https/MySSLSocketFactory.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.risk.riskmanage.util.https; - -import java.io.IOException; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.Socket; -import java.net.SocketAddress; -import java.net.UnknownHostException; -import java.security.KeyManagementException; -import java.security.NoSuchAlgorithmException; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; - -import javax.net.SocketFactory; -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; - -import org.apache.commons.httpclient.ConnectTimeoutException; -import org.apache.commons.httpclient.params.HttpConnectionParams; -import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; - - -public class MySSLSocketFactory implements ProtocolSocketFactory { - private SSLContext sslcontext = null; - private SSLContext createSSLContext() { - SSLContext sslcontext = null; - try { - sslcontext = SSLContext.getInstance("SSL"); - sslcontext.init(null, - new TrustManager[] { new TrustAnyTrustManager() }, - new java.security.SecureRandom()); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } catch (KeyManagementException e) { - e.printStackTrace(); - } - return sslcontext; - } - - private SSLContext getSSLContext() { - if (this.sslcontext == null) { - this.sslcontext = createSSLContext(); - } - return this.sslcontext; - } - - public Socket createSocket(Socket socket, String host, int port, - boolean autoClose) throws IOException, UnknownHostException { - return getSSLContext().getSocketFactory().createSocket(socket, host, - port, autoClose); - } - - public Socket createSocket(String host, int port) throws IOException, - UnknownHostException { - return getSSLContext().getSocketFactory().createSocket(host, port); - } - - public Socket createSocket(String host, int port, InetAddress clientHost, - int clientPort) throws IOException, UnknownHostException { - return getSSLContext().getSocketFactory().createSocket(host, port, - clientHost, clientPort); - } - - public Socket createSocket(String host, int port, InetAddress localAddress, - int localPort, HttpConnectionParams params) throws IOException, - UnknownHostException, ConnectTimeoutException { - if (params == null) { - throw new IllegalArgumentException("Parameters may not be null"); - } - int timeout = params.getConnectionTimeout(); - SocketFactory socketfactory = getSSLContext().getSocketFactory(); - if (timeout == 0) { - return socketfactory.createSocket(host, port, localAddress, - localPort); - } else { - Socket socket = socketfactory.createSocket(); - SocketAddress localaddr = new InetSocketAddress(localAddress, - localPort); - SocketAddress remoteaddr = new InetSocketAddress(host, port); - socket.bind(localaddr); - socket.connect(remoteaddr, timeout); - return socket; - } - } - - private static class TrustAnyTrustManager implements X509TrustManager { - public void checkClientTrusted(X509Certificate[] chain, String authType) - throws CertificateException { - } - - public void checkServerTrusted(X509Certificate[] chain, String authType) - throws CertificateException { - } - - public X509Certificate[] getAcceptedIssuers() { - return new X509Certificate[] {}; - } - } -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/https/PostParameter.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/https/PostParameter.java deleted file mode 100644 index 1bb8664..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/https/PostParameter.java +++ /dev/null @@ -1,206 +0,0 @@ -package com.risk.riskmanage.util.https; - -import java.io.File; -import java.net.URLEncoder; -import java.util.List; - - - - -public class PostParameter implements java.io.Serializable{ - String name; - String value; - private File file = null; - - private static final long serialVersionUID = -8708108746980739212L; - - public PostParameter(String name, String value) { - this.name = name; - this.value = value; - } - - public PostParameter(String name, double value) { - this.name = name; - this.value = String.valueOf(value); - } - - public PostParameter(String name, int value) { - this.name = name; - this.value = String.valueOf(value); - } - - public PostParameter(String name, File file) { - this.name = name; - this.file = file; - } - - public String getName(){ - return name; - } - public String getValue(){ - return value; - } - - public File getFile() { - return file; - } - - public boolean isFile(){ - return null != file; - } - - private static final String JPEG = "image/jpeg"; - private static final String GIF = "image/gif"; - private static final String PNG = "image/png"; - private static final String OCTET = "application/octet-stream"; - - /** - * - * @return content-type - */ - public String getContentType() { - if (!isFile()) { - throw new IllegalStateException("not a file"); - } - String contentType; - String extensions = file.getName(); - int index = extensions.lastIndexOf("."); - if (-1 == index) { - // no extension - contentType = OCTET; - } else { - extensions = extensions.substring(extensions.lastIndexOf(".") + 1).toLowerCase(); - if (extensions.length() == 3) { - if ("gif".equals(extensions)) { - contentType = GIF; - } else if ("png".equals(extensions)) { - contentType = PNG; - } else if ("jpg".equals(extensions)) { - contentType = JPEG; - } else { - contentType = OCTET; - } - } else if (extensions.length() == 4) { - if ("jpeg".equals(extensions)) { - contentType = JPEG; - } else { - contentType = OCTET; - } - } else { - contentType = OCTET; - } - } - return contentType; - } - - - public static boolean containsFile(PostParameter[] params) { - boolean containsFile = false; - if(null == params){ - return false; - } - for (PostParameter param : params) { - if (param.isFile()) { - containsFile = true; - break; - } - } - return containsFile; - } - /*package*/ static boolean containsFile(List params) { - boolean containsFile = false; - for (PostParameter param : params) { - if (param.isFile()) { - containsFile = true; - break; - } - } - return containsFile; - } - - public static PostParameter[] getParameterArray(String name, String value) { - return new PostParameter[]{new PostParameter(name,value)}; - } - public static PostParameter[] getParameterArray(String name, int value) { - return getParameterArray(name,String.valueOf(value)); - } - - public static PostParameter[] getParameterArray(String name1, String value1 - , String name2, String value2) { - return new PostParameter[]{new PostParameter(name1, value1) - , new PostParameter(name2, value2)}; - } - public static PostParameter[] getParameterArray(String name1, int value1 - , String name2, int value2) { - return getParameterArray(name1,String.valueOf(value1),name2,String.valueOf(value2)); - } - - @Override - public int hashCode() { - int result = name.hashCode(); - result = 31 * result + value.hashCode(); - result = 31 * result + (file != null ? file.hashCode() : 0); - return result; - } - - @Override public boolean equals(Object obj) { - if (null == obj) { - return false; - } - if (this == obj) { - return true; - } - if (obj instanceof PostParameter) { - PostParameter that = (PostParameter) obj; - - if (file != null ? !file.equals(that.file) : that.file != null) - return false; - - return this.name.equals(that.name) && - this.value.equals(that.value); - } - return false; - } - - @Override - public String toString() { - return "PostParameter{" + - "name='" + name + '\'' + - ", value='" + value + '\'' + - ", file=" + file + - '}'; - } - - public int compareTo(Object o) { - int compared; - PostParameter that = (PostParameter) o; - compared = name.compareTo(that.name); - if (0 == compared) { - compared = value.compareTo(that.value); - } - return compared; - } - - public static String encodeParameters(PostParameter[] httpParams) { - if (null == httpParams) { - return ""; - } - StringBuffer buf = new StringBuffer(); - for (int j = 0; j < httpParams.length; j++) { - if (httpParams[j].isFile()) { - throw new IllegalArgumentException("parameter [" + httpParams[j].name + "]should be text"); - } - if (j != 0) { - buf.append("&"); - } - try { - buf.append(URLEncoder.encode(httpParams[j].name, "UTF-8")) - .append("=").append(URLEncoder.encode(httpParams[j].value, "UTF-8")); - } catch (java.io.UnsupportedEncodingException neverHappen) { - } - } - return buf.toString(); - - } - -} diff --git a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/https/Response.java b/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/https/Response.java deleted file mode 100644 index 83bdd09..0000000 --- a/jar-enginex-manager/src/main/java/com/risk/riskmanage/util/https/Response.java +++ /dev/null @@ -1,226 +0,0 @@ -package com.risk.riskmanage.util.https; - -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.HttpURLConnection; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.zip.GZIPInputStream; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Document; -import org.xml.sax.SAXException; - - -public class Response { - private final static boolean DEBUG = true; - static Logger log = LoggerFactory.getLogger(Response.class); - - - private static ThreadLocal builders = - new ThreadLocal() { - @Override - protected DocumentBuilder initialValue() { - try { - return - DocumentBuilderFactory.newInstance() - .newDocumentBuilder(); - } catch (ParserConfigurationException ex) { - throw new ExceptionInInitializerError(ex); - } - } - }; - - private int statusCode; - private Document responseAsDocument = null; - private String responseAsString = null; - private InputStream is; - private HttpURLConnection con; - private boolean streamConsumed = false; - - public Response() { - - } - public Response(HttpURLConnection con) throws IOException { - this.con = con; - this.statusCode = con.getResponseCode(); - if(null == (is = con.getErrorStream())){ - is = con.getInputStream(); - } - if (null != is && "gzip".equals(con.getContentEncoding())) { - // the response is gzipped - is = new GZIPInputStream(is); - } - } - - // for test purpose - /*package*/ Response(String content) { - this.responseAsString = content; - } - - public int getStatusCode() { - return statusCode; - } - - public String getResponseHeader(String name) { - if (con != null) - return con.getHeaderField(name); - else - return null; - } - - /** - * Returns the response stream.
- * This method cannot be called after calling asString() or asDcoument()
- * It is suggested to call disconnect() after consuming the stream. - * - * Disconnects the internal HttpURLConnection silently. - * @return response body stream - * @throws HttpsException - * @see #disconnect() - */ - public InputStream asStream() { - if(streamConsumed){ - throw new IllegalStateException("Stream has already been consumed."); - } - return is; - } - - /** - * Returns the response body as string.
- * Disconnects the internal HttpURLConnection silently. - * @return response body - * @throws HttpsException - */ - public String asString() throws HttpsException{ - if(null == responseAsString){ - BufferedReader br; - try { - InputStream stream = asStream(); - if (null == stream) { - return null; - } - br = new BufferedReader(new InputStreamReader(stream, "UTF-8")); - StringBuffer buf = new StringBuffer(); - String line; - while (null != (line = br.readLine())) { - buf.append(line).append("\n"); - } - this.responseAsString = buf.toString(); - /* if(Configuration.isDalvik()){ - this.responseAsString = unescape(responseAsString); - }*/ - log(responseAsString); - stream.close(); - con.disconnect(); - streamConsumed = true; - } catch (NullPointerException npe) { - // don't remember in which case npe can be thrown - throw new HttpsException(npe.getMessage(), npe); - } catch (IOException ioe) { - throw new HttpsException(ioe.getMessage(), ioe); - } - } - return responseAsString; - } - - /** - * Returns the response body as org.w3c.dom.Document.
- * Disconnects the internal HttpURLConnection silently. - * @return response body as org.w3c.dom.Document - * @throws HttpsException - */ - public Document asDocument() throws HttpsException { - if (null == responseAsDocument) { - try { - // it should be faster to read the inputstream directly. - // but makes it difficult to troubleshoot - this.responseAsDocument = builders.get().parse(new ByteArrayInputStream(asString().getBytes("UTF-8"))); - } catch (SAXException saxe) { - throw new HttpsException("The response body was not well-formed:\n" + responseAsString, saxe); - } catch (IOException ioe) { - throw new HttpsException("There's something with the connection.", ioe); - } - } - return responseAsDocument; - } - - public InputStreamReader asReader() { - try { - return new InputStreamReader(is, "UTF-8"); - } catch (java.io.UnsupportedEncodingException uee) { - return new InputStreamReader(is); - } - } - - public void disconnect(){ - con.disconnect(); - } - - private static Pattern escaped = Pattern.compile("&#([0-9]{3,5});"); - - /** - * Unescape UTF-8 escaped characters to string. - * @author pengjianq...@gmail.com - * - * @param original The string to be unescaped. - * @return The unescaped string - */ - public static String unescape(String original) { - Matcher mm = escaped.matcher(original); - StringBuffer unescaped = new StringBuffer(); - while (mm.find()) { - mm.appendReplacement(unescaped, Character.toString( - (char) Integer.parseInt(mm.group(1), 10))); - } - mm.appendTail(unescaped); - return unescaped.toString(); - } - - @Override - public String toString() { - if(null != responseAsString){ - return responseAsString; - } - return "Response{" + - "statusCode=" + statusCode + - ", response=" + responseAsDocument + - ", responseString='" + responseAsString + '\'' + - ", is=" + is + - ", con=" + con + - '}'; - } - - private void log(String message) { - if (DEBUG) { - log.debug("[" + new java.util.Date() + "]" + message); - } - } - - private void log(String message, String message2) { - if (DEBUG) { - log(message + message2); - } - } - - public String getResponseAsString() { - return responseAsString; - } - - public void setResponseAsString(String responseAsString) { - this.responseAsString = responseAsString; - } - - public void setStatusCode(int statusCode) { - this.statusCode = statusCode; - } - -} diff --git a/jar-enginex-manager/src/main/resources/application-dev.properties b/jar-enginex-manager/src/main/resources/application-dev.properties deleted file mode 100644 index 20810bd..0000000 --- a/jar-enginex-manager/src/main/resources/application-dev.properties +++ /dev/null @@ -1,26 +0,0 @@ -server.port=8085 -server.servlet.context-path=/Riskmanage - -logging.config=classpath:logging-config.xml - -# mysql -spring.datasource.default.url = jdbc:mysql://47.102.125.25:3306/zsxntest?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true -spring.datasource.default.username = root -spring.datasource.default.password = enginex513 -spring.datasource.default.driver-class-name = com.mysql.cj.jdbc.Driver - -# redis -redis.host=47.102.125.25 -redis.port=6379 -redis.db=0 -redis.password=enginex123 -redis.pool.maxTotal=3000 -redis.pool.maxIdle=100 -redis.pool.maxWait=1000 -redis.pool.timeout=100000 - - -runner.url: http://localhost:8081 - -# \u76D1\u63A7\u4E2D\u5FC3 \u6570\u636E\u5B58\u50A8\u65B9\u5F0F mysql \u6216\u8005 hbase -monitor.data.storage.type=mysql \ No newline at end of file diff --git a/jar-enginex-manager/src/main/resources/application-prod.properties b/jar-enginex-manager/src/main/resources/application-prod.properties deleted file mode 100644 index 4eb48d7..0000000 --- a/jar-enginex-manager/src/main/resources/application-prod.properties +++ /dev/null @@ -1,27 +0,0 @@ -server.port=8080 -server.servlet.context-path=/Riskmanage - -logging.config=classpath:logging-config.xml - -# mysql -spring.datasource.default.url = jdbc:mysql://localhost:3306/riskmanage?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true -spring.datasource.default.username = root -spring.datasource.default.password = enginex513! -spring.datasource.default.driver-class-name = com.mysql.cj.jdbc.Driver - -# redis -redis.host=localhost -redis.port=6379 -redis.db=0 -redis.password=localhost! -redis.pool.maxTotal=3000 -redis.pool.maxIdle=100 -redis.pool.maxWait=1000 -redis.pool.timeout=100000 - - -runner.url: http://localhost:8082 - - -# \u76D1\u63A7\u4E2D\u5FC3 \u6570\u636E\u5B58\u50A8\u65B9\u5F0F mysql \u6216\u8005 hbase -monitor.data.storage.type=mysql \ No newline at end of file diff --git a/jar-enginex-manager/src/main/resources/application-test.properties b/jar-enginex-manager/src/main/resources/application-test.properties deleted file mode 100644 index 00e8df6..0000000 --- a/jar-enginex-manager/src/main/resources/application-test.properties +++ /dev/null @@ -1,25 +0,0 @@ -server.port=8080 -server.servlet.context-path=/Riskmanage - -logging.config=classpath:logging-config.xml - -# mysql -spring.datasource.default.url = jdbc:mysql://localhost:3306/riskmanage?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true -spring.datasource.default.username = root -spring.datasource.default.password = enginex513 -spring.datasource.default.driver-class-name = com.mysql.cj.jdbc.Driver - -# redis -redis.host=localhost -redis.port=6379 -redis.db=0 -redis.password=localhost -redis.pool.maxTotal=3000 -redis.pool.maxIdle=100 -redis.pool.maxWait=1000 -redis.pool.timeout=100000 - -runner.url: http://localhost:8081 - -# \u76D1\u63A7\u4E2D\u5FC3 \u6570\u636E\u5B58\u50A8\u65B9\u5F0F mysql \u6216\u8005 hbase -monitor.data.storage.type=mysql \ No newline at end of file diff --git a/jar-enginex-manager/src/main/resources/application.properties b/jar-enginex-manager/src/main/resources/application.properties deleted file mode 100644 index 257b306..0000000 --- a/jar-enginex-manager/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ -spring.profiles.active=dev \ No newline at end of file diff --git a/jar-enginex-manager/src/main/resources/datamanage/FieldCondMapper.xml b/jar-enginex-manager/src/main/resources/datamanage/FieldCondMapper.xml deleted file mode 100644 index 4e6ebae..0000000 --- a/jar-enginex-manager/src/main/resources/datamanage/FieldCondMapper.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - insert into t_field_condition ( field_id, condition_value, content - , cond_field_id, cond_field_operator, cond_field_value, cond_field_logical - , created) - values - - ( #{fieldCond.fieldId}, #{fieldCond.conditionValue}, #{fieldCond.content} - , #{fieldCond.condFieldId}, #{fieldCond.condFieldOperator}, #{fieldCond.condFieldValue}, #{fieldCond.condFieldLogical} - , now() ) - - - - - - - - - delete from t_field_condition where field_id = #{id} - - - - \ No newline at end of file diff --git a/jar-enginex-manager/src/main/resources/datamanage/FieldMapper.xml b/jar-enginex-manager/src/main/resources/datamanage/FieldMapper.xml deleted file mode 100644 index 598ff48..0000000 --- a/jar-enginex-manager/src/main/resources/datamanage/FieldMapper.xml +++ /dev/null @@ -1,836 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - id, field_en, field_cn, field_typeid, value_type, value_scope, is_derivative, is_output, is_common, formula, formula_show, used_fieldid, orig_fieldid, author, created, is_use_sql, data_source_id, sql_statement, sql_variable, is_interface, interface_id, interface_parse_field, json_value,dict_variable - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - insert into t_field ( field_en, field_cn, field_typeid - , value_type, value_scope, is_derivative - , is_output, formula, formula_show, orig_fieldid, used_fieldid - , is_common, author, created, is_use_sql, data_source_id, sql_statement, sql_variable - , is_interface, interface_id, interface_parse_field, json_value, organ_id,dict_variable) - values ( #{fieldEn}, #{fieldCn}, #{fieldTypeId} - , #{valueType}, #{valueScope}, #{isDerivative} - , #{isOutput}, #{formula}, #{formulaShow}, #{origFieldId}, #{usedFieldId} - , #{isCommon}, #{author}, now(), #{isUseSql}, #{dataSourceId}, #{sqlStatement}, #{sqlVariable} - , #{isInterface}, #{interfaceId}, #{interfaceParseField}, #{jsonValue}, #{organId},#{dictVariable}) - - - - insert into t_field ( field_en, field_cn, field_typeid - , value_type, value_scope, is_derivative - , is_output, formula, formula_show, is_common, author, created, - , is_interface, interface_id, interface_parse_field, json_value,dict_variable) - values - - ( - #{field.fieldEn}, #{field.fieldCn}, #{field.fieldTypeId} - , #{field.valueType}, #{field.valueScope}, #{field.isDerivative} - , #{field.isOutput}, #{field.formula}, #{field.formulaShow}, #{field.isCommon}, #{field.author}, now() - , #{isInterface}, #{interfaceId}, #{interfaceParseField}, #{jsonValue},#{dictVariable} - ) - - - - - update t_field - set field_en = #{fieldEn}, field_cn = #{fieldCn}, field_typeid = #{fieldTypeId} - , value_type = #{valueType}, value_scope = #{valueScope}, is_derivative = #{isDerivative} - , is_output = #{isOutput}, formula = #{formula}, formula_show = #{formulaShow} - , orig_fieldid = #{origFieldId}, used_fieldid = #{usedFieldId}, is_common = #{isCommon} - , is_use_sql = #{isUseSql}, data_source_id = #{dataSourceId}, sql_statement = #{sqlStatement}, sql_variable = #{sqlVariable} - ,is_interface = #{isInterface}, interface_id = #{interfaceId}, interface_parse_field = #{interfaceParseField}, json_value = #{jsonValue},dict_variable = #{dictVariable} - where id = #{id} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - update t_field - set field_typeid = #{folderId} - where id in - - #{id} - - - - - - \ No newline at end of file diff --git a/jar-enginex-manager/src/main/resources/datamanage/FieldTypeMapper.xml b/jar-enginex-manager/src/main/resources/datamanage/FieldTypeMapper.xml deleted file mode 100644 index 5b7ca91..0000000 --- a/jar-enginex-manager/src/main/resources/datamanage/FieldTypeMapper.xml +++ /dev/null @@ -1,196 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - insert into t_field_type ( field_type, parent_id, is_common ,type) - values ( #{fieldType}, #{parentId}, #{isCommon} ,#{type}) - - - - update t_field_type - set field_type = #{fieldType} - where id = #{id} - - - - update t_field_type_user_rel - set status = -1 - where organ_id = ( select organ_id from t_user where user_id = #{userId} ) - and engine_id = #{engineId} - and field_typeid in - - #{item} - - and status = 1 - - - - delete from t_field_type_user_rel - where organ_id = ( select organ_id from t_user where user_id = #{userId} ) - and engine_id = #{engineId} - and field_typeid in - - #{item} - - and field_typeid not in - ( select field_typeid - from t_field f,t_field_user_rel r - where f.id = r.field_id - and f.field_typeid in - - #{item} - - ) - - - - update t_field_type_user_rel - set status = 1 - where organ_id = ( select organ_id from t_user where user_id = #{userId} ) - and engine_id = #{engineId} - and field_typeid in - - #{item} - - and status = -1 - - - - - - - \ No newline at end of file diff --git a/jar-enginex-manager/src/main/resources/datamanage/FieldTypeUserMapper.xml b/jar-enginex-manager/src/main/resources/datamanage/FieldTypeUserMapper.xml deleted file mode 100644 index 4b16380..0000000 --- a/jar-enginex-manager/src/main/resources/datamanage/FieldTypeUserMapper.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - insert into t_field_type_user_rel ( field_typeid, organ_id, engine_id, user_id, created ) - values ( #{fieldTypeId}, #{organId}, #{engineId}, #{userId}, now() ) - - - - insert into t_field_type_user_rel ( field_typeid, organ_id, engine_id, user_id, created ) - select field_typeid, organ_id, #{engineId}, #{userId}, now() - from t_field_type_user_rel r - where r.field_typeid in - - #{item} - - and field_typeid not in ( select field_typeid from t_field_type_user_rel where engine_id = #{engineId}) - and engine_id is null - - - - - - delete from t_field_type_user_rel - where - organ_id = ( select organ_id from t_user where user_id = #{userId} ) - - and engine_id = #{engineId} - - - and engine_id is null - - and field_typeid = #{fieldTypeId} - - - - update t_field_type_user_rel - set user_id = #{userId}, created = now() - - ,status = #{status} - - where organ_id =#{organId} - and field_typeid = #{id} - - - \ No newline at end of file diff --git a/jar-enginex-manager/src/main/resources/datamanage/FieldUserMapper.xml b/jar-enginex-manager/src/main/resources/datamanage/FieldUserMapper.xml deleted file mode 100644 index 62985cc..0000000 --- a/jar-enginex-manager/src/main/resources/datamanage/FieldUserMapper.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - insert into t_field_user_rel (field_id, organ_id, engine_id, user_id, status, created, updated) - values (#{fieldId}, #{organId}, #{engineId}, #{userId}, #{status}, now(), now()) - - - - insert into t_field_user_rel (field_id, organ_id, engine_id, user_id, status, created, updated) - select id, #{organId}, #{engineId}, #{userId}, #{status}, now(), now() - from t_field t - where t.author = #{author} - and not exists ( select r.field_id from t_field_user_rel r where t.id = r.field_id ) - - - - insert into t_field_user_rel (field_id, organ_id, engine_id, user_id, status, created, updated) - select id, #{organId}, #{engineId}, #{userId}, #{status}, now(), now() - from t_field f - where f.field_typeid in - - #{item} - - and not exists ( select 1 - from ( select f.id,f.field_en,f.field_cn - from t_field f,t_field_user_rel fu - where f.id = fu.field_id - and fu.organ_id = ( select organ_id from t_user where user_id = #{userId} ) - and fu.engine_id = ${engineId} )y - where f.field_en = y.field_en or f.field_cn = y.field_cn or f.id = y.id - ) - - - - insert into t_field_user_rel (field_id, organ_id, engine_id, user_id, status, created, updated) - select id, #{organId}, #{engineId}, #{userId}, 1, now(), now() - from t_field f - where f.id in - - #{item} - - and not exists ( select 1 - from ( select f.id,f.field_en,f.field_cn - from t_field f,t_field_user_rel fu - where f.id = fu.field_id - and fu.organ_id = ( select organ_id from t_user where user_id = #{userId} ) - and fu.engine_id = ${engineId} )y - where f.field_en = y.field_en or f.field_cn = y.field_cn or f.id = y.id - ) - - - - update t_field_user_rel - set user_id = #{userId} , updated = now() - where organ_id = ( select organ_id from t_user where user_id = #{userId} ) - - and engine_id = #{engineId} - - - and engine_id is null - - and field_id = #{Id} - - - - update t_field_user_rel - set status=#{status} - where organ_id = ( select organ_id from t_user where user_id = #{userId} ) - - and engine_id = #{engineId} - - - and engine_id is null - - and field_id in - - #{item} - - - - - update t_field_user_rel - set status = -1 - where organ_id = ( select organ_id from t_user where user_id = #{userId} ) - and engine_id = #{engineId} - and field_id in - - #{item} - - and status = 1 - - - - update t_field_user_rel - set status = 1 - where organ_id = ( select organ_id from t_user where user_id = #{userId} ) - and engine_id = #{engineId} - and field_id in - - #{item} - - and status = -1 - - - \ No newline at end of file diff --git a/jar-enginex-manager/src/main/resources/excleTemplate/field.xlsx b/jar-enginex-manager/src/main/resources/excleTemplate/field.xlsx deleted file mode 100644 index 13f39a6..0000000 Binary files a/jar-enginex-manager/src/main/resources/excleTemplate/field.xlsx and /dev/null differ diff --git a/jar-enginex-manager/src/main/resources/excleTemplate/listDb.xlsx b/jar-enginex-manager/src/main/resources/excleTemplate/listDb.xlsx deleted file mode 100644 index 5e0fe7e..0000000 Binary files a/jar-enginex-manager/src/main/resources/excleTemplate/listDb.xlsx and /dev/null differ diff --git a/jar-enginex-manager/src/main/resources/interfacemanage/InterfaceMapper.xml b/jar-enginex-manager/src/main/resources/interfacemanage/InterfaceMapper.xml deleted file mode 100644 index 6de1e8b..0000000 --- a/jar-enginex-manager/src/main/resources/interfacemanage/InterfaceMapper.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - update riskmanage.t_field_interface set status = #{status} - where id in - - #{interfaceId} - - - - - - - - - - diff --git a/jar-enginex-manager/src/main/resources/knowledge/EngineRuleRelMapper.xml b/jar-enginex-manager/src/main/resources/knowledge/EngineRuleRelMapper.xml deleted file mode 100644 index 7131811..0000000 --- a/jar-enginex-manager/src/main/resources/knowledge/EngineRuleRelMapper.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - id - engine_id as engineId, - rule_id as ruleId - - - - - - insert into t_engine_rule_rel (engine_id,rule_id) - values - - (#{engineId},#{item}) - - - - - delete from t_engine_rule_rel where engine_id =#{engineId} - - and rule_id in - - #{item} - - - - \ No newline at end of file diff --git a/jar-enginex-manager/src/main/resources/knowledge/KnowledgeTreeMapper.xml b/jar-enginex-manager/src/main/resources/knowledge/KnowledgeTreeMapper.xml deleted file mode 100644 index 7405c8e..0000000 --- a/jar-enginex-manager/src/main/resources/knowledge/KnowledgeTreeMapper.xml +++ /dev/null @@ -1,398 +0,0 @@ - - - - - - - - - - - - - - - - - - - - id, - name, - parent_id, - user_id, - organ_id, - engine_id, - status, - type, - tree_type, - created, - updated - - - - k.id, - k.name, - k.parent_id, - k.user_id, - k.organ_id, - k.engine_id, - k.status, - k.type, - k.tree_type, - k.created, - k.updated - - - - - - - - - - - - - - insert into t_knowledge_tree (name,parent_id,user_id, - - organ_id, - - - engine_id, - - status,type,tree_type,created,updated) - values(#{name},#{parentId},#{userId}, - - #{organId}, - - - #{engineId}, - - #{status},#{type},#{treeType},now(), now()) - - - - - insert into t_knowledge_tree (name,parent_id,user_id, - - organ_id, - - - engine_id, - - status,type,tree_type,created,updated) - values(#{item.name},#{item.parentId},#{item.userId}, - - #{item.organId}, - - - #{item.engineId}, - - #{item.status},#{item.type},#{item.treeType},now(), now()) - - - - - - update t_knowledge_tree set - - name = #{name}, - - - status = #{status}, - - - type = #{type}, - - - parent_id = #{parentId}, - - updated = now() where id = #{id} - - - - - - - - - \ No newline at end of file diff --git a/jar-enginex-manager/src/main/resources/knowledge/KnowledgeTreeRelMapper.xml b/jar-enginex-manager/src/main/resources/knowledge/KnowledgeTreeRelMapper.xml deleted file mode 100644 index 17e5a1f..0000000 --- a/jar-enginex-manager/src/main/resources/knowledge/KnowledgeTreeRelMapper.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - id - engine_id as engineId, - knowledge_tree_id as treeId - - - - insert into t_engine_knowledge_tree_rel (engine_id,knowledge_tree_id) - values - - (#{engineId},#{item}) - - - - - delete from t_engine_knowledge_tree_rel where engine_id =#{engineId} - - - - \ No newline at end of file diff --git a/jar-enginex-manager/src/main/resources/knowledge/RuleContentMapper.xml b/jar-enginex-manager/src/main/resources/knowledge/RuleContentMapper.xml deleted file mode 100644 index f6e588e..0000000 --- a/jar-enginex-manager/src/main/resources/knowledge/RuleContentMapper.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - r.id, - t.field_cn as field, - r.field_id as fieldId, - r.field_value as fieldValue, - r.rule_id as ruleId, - t.field_en as fieldEn, - t.value_type as valueType, - t.value_scope as valueScope, - r.variable_type as variableType - - - - - - insert into t_rule_content (field_id,field_value,rule_id,variable_type) - values - - (#{item.fieldId},#{item.fieldValue},#{item.ruleId},#{item.variableType}) - - - - - - - - update t_rule_content set - - field_id = #{item.fieldId} - - - ,field_value = #{item.fieldValue} - - - ,variable_type = #{item.variableType} - - where id = #{item.id} - - - - - - delete from t_rule_content where id = #{item.id} - - - - - \ No newline at end of file diff --git a/jar-enginex-manager/src/main/resources/knowledge/RuleFieldMapper.xml b/jar-enginex-manager/src/main/resources/knowledge/RuleFieldMapper.xml deleted file mode 100644 index f0515dc..0000000 --- a/jar-enginex-manager/src/main/resources/knowledge/RuleFieldMapper.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - - - - - - - - - - - - r.id , - r.logical, - r.operator, - t.field_cn as field, - r.field_value as fieldValue, - r.rule_id as ruleId, - r.field_id as fieldId, - t.field_en as fieldEn, - t.value_type as valueType, - t.value_scope as valueScope - - - - - - insert into t_rule_field - (logical,operator,field_value,rule_id,field_id) - values - - ( - #{item.logical}, - #{item.operator}, - #{item.fieldValue}, - #{item.ruleId}, - TRIM(#{item.fieldId}) - ) - - - - - - - - update t_rule_field set - - logical = #{item.logical} - - - ,operator = #{item.operator} - - - ,field_value = #{item.fieldValue} - - - ,field_id = TRIM(#{item.fieldId}) - - where id = #{item.id} - - - - - - delete from t_rule_field where id = #{item.id} - - - - - - - - - - \ No newline at end of file diff --git a/jar-enginex-manager/src/main/resources/knowledge/RuleMapper.xml b/jar-enginex-manager/src/main/resources/knowledge/RuleMapper.xml deleted file mode 100644 index 4dd79d4..0000000 --- a/jar-enginex-manager/src/main/resources/knowledge/RuleMapper.xml +++ /dev/null @@ -1,509 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - r.id, - r.name, - r.code, - r.description, - r.priority, - r.parent_id, - r.user_id, - r.author, - u.nick_name as nick_name, - r.organ_id, - r.engine_id, - r.status, - r.rule_audit, - r.type, - r.score, - r.last_logical, - r.is_non, - r.created, - r.updated, - r.rule_type, - r.difficulty - - - - r.id, - r.name, - r.code, - r.description, - r.priority, - r.parent_id, - r.user_id, - r.author, - u.nick_name, - r.organ_id, - r.engine_id, - (CASE r.STATUS - WHEN r.id IN ( - SELECT - rule_id - FROM - t_engine_rule_rel td - WHERE - engine_id =#{engineId} - ) THEN - 1 - ELSE - 0 - END) AS status, - r.rule_audit, - r.type, - r.score, - r.last_logical, - r.is_non, - r.created, - r.updated, - r.rule_type - - - - r.id, - r.name, - r.code, - r.description, - r.engine_id, - r.priority, - r.parent_id, - r.user_id, - r.author, - r.organ_id, - r.engine_id, - r.status, - r.type, - r.is_non, - r.rule_audit, - r.score, - r.last_logical, - r.created, - r.updated, - r.rule_type - - - - - - - - - insert into t_rule ( - name, - code, - description, - priority, - parent_id, - user_id, - author, - - content, - - - organ_id, - - - engine_id, - - - rule_audit, - - - score, - - - last_logical, - - status,type,is_non,created,updated,rule_type,difficulty) - values( - #{name}, - #{code}, - #{description}, - #{priority}, - #{parentId}, - #{userId}, - #{author}, - - #{content}, - - - #{organId}, - - - #{engineId}, - - - #{ruleAudit}, - - - #{score}, - - - #{lastLogical}, - - #{status},#{type},#{isNon},now(), now(),#{ruleType},#{difficulty} - ) - - - - update t_rule set - - name = #{name}, - - - code = #{code}, - - - content = #{content}, - - - description = #{description}, - - - priority = #{priority}, - - - status = #{status}, - - - type = #{type}, - - - is_non = #{isNon}, - - - rule_type = #{ruleType}, - - - rule_audit = #{ruleAudit}, - - - last_logical = #{lastLogical}, - - - difficulty = #{difficulty}, - - score = #{score}, - updated = now() where id = #{id} - - - - update t_rule set status = #{status} where id in - - #{item} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/jar-enginex-manager/src/main/resources/logger/loggerMapper.xml b/jar-enginex-manager/src/main/resources/logger/loggerMapper.xml deleted file mode 100644 index 0d054bc..0000000 --- a/jar-enginex-manager/src/main/resources/logger/loggerMapper.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - l.id, - l.op_type, - l.op_name, - l.op_user_id, - u.nick_name, - o.name as organ_name, - l.organ_id, - l.method, - l.request_path, - l.request_param, - l.response_param, - l.ip, - l.start_time, - l.end_time - - - - insert into t_logger (op_type,op_name,op_user_id,organ_id,method,request_path,request_param,response_param,ip,start_time,end_time) - values(#{opType},#{opName},#{opUserId},#{organId},#{method},#{requestPath},#{requestParam},#{responseParam},#{ip},#{startTime},#{endTime}) - - - - - - - - - \ No newline at end of file diff --git a/jar-enginex-manager/src/main/resources/logging-config.xml b/jar-enginex-manager/src/main/resources/logging-config.xml deleted file mode 100644 index a6ff773..0000000 --- a/jar-enginex-manager/src/main/resources/logging-config.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/jar-enginex-manager/src/main/resources/rule/RuleMapper.xml b/jar-enginex-manager/src/main/resources/rule/RuleMapper.xml deleted file mode 100644 index a33c018..0000000 --- a/jar-enginex-manager/src/main/resources/rule/RuleMapper.xml +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - id, name, code, description, priority, parent_id, author, user_id, organ_id, engine_id, status, type, is_non, content, created, updated, rule_type, rule_audit, score, last_logical,difficulty,script_type,result_field_en,score_field_en - - - - - - - - update t_rule set status = #{status} - where id in - - #{ruleId} - - - - update t_rule set parent_id = #{parentId} - where id in - - #{ruleId} - - - - - diff --git a/jar-enginex-manager/src/main/resources/system/DepartmentMapper.xml b/jar-enginex-manager/src/main/resources/system/DepartmentMapper.xml deleted file mode 100644 index 6ad8111..0000000 --- a/jar-enginex-manager/src/main/resources/system/DepartmentMapper.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - INSERT INTO - manager_organization - - - org_name, - - - org_code, - - status, - updateTime - - values - - - #{deptName}, - - - #{deptCode}, - - 1, - now() - - - - - - - UPDATE manager_organization SET - - org_name = #{deptName} - - - ,org_code = #{deptCode} - - ,updateTime = now() - WHERE - status=1 - - and id = #{id} - - - - - UPDATE manager_organization SET - status=-1 - WHERE - id - IN - - #{deletIds} - - - - \ No newline at end of file diff --git a/jar-enginex-manager/src/main/resources/system/MenuMapper.xml b/jar-enginex-manager/src/main/resources/system/MenuMapper.xml deleted file mode 100644 index 0e94fc4..0000000 --- a/jar-enginex-manager/src/main/resources/system/MenuMapper.xml +++ /dev/null @@ -1,236 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - INSERT INTO - manager_menu - - - pid, - - - name, - - - menu_code, - - - type, - - - url, - - - icon, - - status, - updateTime - - values - - - #{pid}, - - - #{name}, - - - #{menuCode}, - - - #{type}, - - - #{url}, - - - #{icon}, - - 1, - now() - - - - - - - UPDATE manager_menu SET - - pid = #{pid}, - - - name = #{name}, - - - type = #{type}, - - - url = #{url}, - - - icon = #{icon}, - - - name = #{name} - - - ,menu_code = #{menuCode} - - ,updateTime = now() - WHERE - status=1 - - and id = #{id} - - - - - UPDATE manager_menu SET - status=-1 - WHERE - id - IN - - #{deletIds} - - - - - DELETE FROM - manager_menu_role - WHERE - 1=1 - - and role_code = #{roleCode} - - - - - INSERT INTO - manager_menu_role - - - menu_id, - - - role_code - - - values - - - #{id}, - - - #{roleCode} - - - - - - - \ No newline at end of file diff --git a/jar-enginex-manager/src/main/resources/system/RoleMapper.xml b/jar-enginex-manager/src/main/resources/system/RoleMapper.xml deleted file mode 100644 index d9945f8..0000000 --- a/jar-enginex-manager/src/main/resources/system/RoleMapper.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - INSERT INTO - manager_role - - - name, - - - role_code, - - status, - updateTime - - values - - - #{name}, - - - #{roleCode}, - - 1, - now() - - - - - - - UPDATE manager_role SET - - name = #{name} - - - ,role_code = #{roleCode} - - ,updateTime = now() - WHERE - status=1 - - and id = #{id} - - - - - UPDATE manager_role SET - status=-1 - WHERE - id - IN - - #{deletIds} - - - - \ No newline at end of file diff --git a/jar-enginex-manager/src/main/resources/system/SysMenuMapper.xml b/jar-enginex-manager/src/main/resources/system/SysMenuMapper.xml deleted file mode 100644 index 942b1b9..0000000 --- a/jar-enginex-manager/src/main/resources/system/SysMenuMapper.xml +++ /dev/null @@ -1,168 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - resource_id, user_id, name, code, url, parent_id, des, birth, icon, sort, status - - - - - - - - - - - - - - - - - - - - - - - - - - insert into t_resource (user_id, name, code, url, parent_id, des, birth, icon, sort) - values (#{userId}, #{name}, #{code}, #{url}, #{parentId}, #{des}, now(), #{icon}, #{sort}) - - - - - insert into t_role_resource_rel (role_id, resource_id) - values - - (#{roleId}, #{ids}) - - - - - - insert into t_role_engine (role_id, id_str) - values - - (#{roleId}, #{ids}) - - - - - update t_resource set name=#{name}, - url=#{url}, - - des=#{des}, - - - icon=#{icon}, - - - user_id=#{userId}, - - - parent_id=#{parentId}, - - - sort=#{sort}, - - code=#{code} - where resource_id = #{id} - - - - update t_resource set status = -1 where resource_id = #{id} - - - - - delete from t_role_resource_rel where role_id = #{roleId} - - - - - delete from t_role_engine where role_id = #{roleId} - - - - update t_resource set status=#{status} - - - resource_id in - #{ids} - - - - - \ No newline at end of file diff --git a/jar-enginex-manager/src/main/resources/system/SysOrganizationMapper.xml b/jar-enginex-manager/src/main/resources/system/SysOrganizationMapper.xml deleted file mode 100644 index cfee23c..0000000 --- a/jar-enginex-manager/src/main/resources/system/SysOrganizationMapper.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - organ_id, name, code, email, telephone, status, birth, author,token - - - - - - - - - - - - - insert into t_organization (name, code, email, telephone, status, author, birth, token) - values (#{name}, #{code}, #{email}, #{telephone}, 1, #{author}, now(), #{token}) - - - - update t_organization set name=#{name}, - - email=#{email}, - - - telephone=#{telephone}, - - - author=#{author}, - - code=#{code} - where organ_id=#{id} - - - - update t_organization set status = -1 where organ_id=#{id} - - - - update t_organization set status=#{status} - - - organ_id in - #{ids} - - - - - \ No newline at end of file diff --git a/jar-enginex-manager/src/main/resources/system/SysRoleMapper.xml b/jar-enginex-manager/src/main/resources/system/SysRoleMapper.xml deleted file mode 100644 index c76cd23..0000000 --- a/jar-enginex-manager/src/main/resources/system/SysRoleMapper.xml +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - - - - - - - - - - - - role_id, organ_id, role_name, role_code, role_desc, author, birth, status - - - - - - - - - - - - - - - - - - - - - - insert into t_role (role_id, organ_id, role_name, role_code, role_desc, author, birth, status) - values (#{id}, #{organId}, #{roleName}, #{roleCode}, #{roleDesc}, #{author}, now(), 1) - - - - insert into t_role (role_id, organ_id, role_name, role_code, role_desc, author, birth, status) - values (#{id}, #{organId}, #{roleName}, #{roleCode}, #{roleDesc}, #{author}, now(), 1) - - - - update t_role set - - organ_id=#{organId}, - - - role_desc=#{roleDesc}, - - - role_code=#{roleCode}, - - role_name=#{roleName} - where role_id = #{id} - - - - update t_role set status = -1 where role_id = #{id} - - - - update t_role set status=#{status} - - - role_id in - #{ids} - - - - - - - update t_role set status = -1 where organ_id = #{organId} - - - - update t_role set status = #{status} - - - organ_id in - #{ids} - - - - - \ No newline at end of file diff --git a/jar-enginex-manager/src/main/resources/system/SysUserMapper.xml b/jar-enginex-manager/src/main/resources/system/SysUserMapper.xml deleted file mode 100644 index f9b385a..0000000 --- a/jar-enginex-manager/src/main/resources/system/SysUserMapper.xml +++ /dev/null @@ -1,262 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - user_id, organ_id, employee_id, account, password, nick_name, email, cellphone, qq, latest_time, latest_ip, status, birth, author - - - - - - - - - - - - - - - - - - - - - - - insert into t_user (organ_id, employee_id, account, password, nick_name, email, cellphone, qq, latest_time, latest_ip, status, birth, author) - values (#{organId}, #{employeeId}, #{account}, #{password}, #{nickName}, #{email}, #{cellphone}, #{qq}, #{latestTime}, #{latestIp}, 1, now(), #{author}) - - - - - insert into t_user_role_rel (user_id, role_id,organ_id) - values (#{userId}, #{roleId},#{organId}) - - - - - update t_user set account=#{account}, - - organ_id=#{organId}, - - - password = #{password}, - - - employee_id=#{employeeId}, - - - email=#{email}, - - - cellphone=#{cellphone}, - - - qq=#{qq}, - - - latest_time=#{latestTime}, - - - latest_ip=#{latestIp}, - - - birth=#{birth}, - - - author=#{author}, - - nick_name=#{nickName} - where user_id=#{id} - - - - - update t_user_role_rel set - - organ_id=#{organId}, - - user_id=#{id}, role_id=#{sysRole.id} - where user_id=#{id} - - - - - update t_user set status=-1 - where user_id=#{id} - - - - - update t_user set status=#{status} - - - user_id in - #{ids} - - - - - - - - update t_user set password = #{password} where user_id=#{id} - - - - - update t_user set password = #{password} where user_id=#{id} - - - - - update t_user set status = -1 where organ_id=#{organId} - - - - - update t_user_role_rel set status = -1 where organ_id = #{organId} - - - - update t_user set status = #{status} - - - organ_id in - #{ids} - - - - - - - update t_user_role_rel set status = #{status} - - - organ_id in - #{ids} - - - - - - - - update t_user_role_rel set status = -1 where role_id = #{roleId} - - - - - update t_user set status = #{status} - - - user_id in - #{ids} - - - - - - - - update t_user_role_rel set status = #{status} - - - role_id in - #{ids} - - - - - - \ No newline at end of file diff --git a/jar-enginex-manager/src/main/resources/system/UserMapper.xml b/jar-enginex-manager/src/main/resources/system/UserMapper.xml deleted file mode 100644 index 6b8637e..0000000 --- a/jar-enginex-manager/src/main/resources/system/UserMapper.xml +++ /dev/null @@ -1,259 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - INSERT INTO - manager_user - - - login_name, - - - name, - - - password, - - - email, - - - phone, - - - dept_code, - - status, - updateTime - - values - - - #{loginName}, - - - #{name}, - - - #{password}, - - - #{email}, - - - #{phone}, - - - #{deptCode}, - - 0, - now() - - - - - UPDATE manager_user SET - - login_name = #{loginName}, - - - name = #{name}, - - - password = #{password}, - - - email = #{email}, - - - phone = #{phone}, - - - dept_code = #{deptCode}, - - updateTime = now() - WHERE - status !=-1 - - and id = #{id} - - - - - INSERT INTO manager_user_role - (user_id,role_code) - values - - (#{item.userId},#{item.roleCode}) - - - - - - - - - DELETE FROM - manager_user_role - WHERE - user_id - IN - - #{deletIds} - - - - - UPDATE manager_user SET - status=#{status} - WHERE - id - IN - - #{item} - - - - - - - - - - \ No newline at end of file diff --git a/jar-enginex-runner/.gitignore b/jar-enginex-runner/.gitignore deleted file mode 100644 index cf60db2..0000000 --- a/jar-enginex-runner/.gitignore +++ /dev/null @@ -1,34 +0,0 @@ -HELP.md -target/ -logs/ -!.mvn/wrapper/maven-wrapper.jar -!**/src/main/**/target/ -!**/src/test/**/target/ - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ -build/ -!**/src/main/**/build/ -!**/src/test/**/build/ - -### VS Code ### -.vscode/ diff --git a/jar-enginex-runner/README.md b/jar-enginex-runner/README.md deleted file mode 100644 index 68556ce..0000000 --- a/jar-enginex-runner/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# jar-enginex-runner - -enginex后端执行器 \ No newline at end of file diff --git a/jar-enginex-runner/lib/javax.ejb.jar b/jar-enginex-runner/lib/javax.ejb.jar deleted file mode 100644 index 4ebf5ec..0000000 Binary files a/jar-enginex-runner/lib/javax.ejb.jar and /dev/null differ diff --git a/jar-enginex-runner/lib/javax.jms.jar b/jar-enginex-runner/lib/javax.jms.jar deleted file mode 100644 index d31451a..0000000 Binary files a/jar-enginex-runner/lib/javax.jms.jar and /dev/null differ diff --git a/jar-enginex-runner/lib/javax.persistence.jar b/jar-enginex-runner/lib/javax.persistence.jar deleted file mode 100644 index 21d80e0..0000000 Binary files a/jar-enginex-runner/lib/javax.persistence.jar and /dev/null differ diff --git a/jar-enginex-runner/lib/javax.resource.jar b/jar-enginex-runner/lib/javax.resource.jar deleted file mode 100644 index 696a234..0000000 Binary files a/jar-enginex-runner/lib/javax.resource.jar and /dev/null differ diff --git a/jar-enginex-runner/lib/javax.servlet.jsp.jar b/jar-enginex-runner/lib/javax.servlet.jsp.jar deleted file mode 100644 index 9c0631c..0000000 Binary files a/jar-enginex-runner/lib/javax.servlet.jsp.jar and /dev/null differ diff --git a/jar-enginex-runner/lib/javax.servlet.jsp.jstl.jar b/jar-enginex-runner/lib/javax.servlet.jsp.jstl.jar deleted file mode 100644 index 7be17cc..0000000 Binary files a/jar-enginex-runner/lib/javax.servlet.jsp.jstl.jar and /dev/null differ diff --git a/jar-enginex-runner/lib/javax.transaction.jar b/jar-enginex-runner/lib/javax.transaction.jar deleted file mode 100644 index 729c695..0000000 Binary files a/jar-enginex-runner/lib/javax.transaction.jar and /dev/null differ diff --git a/jar-enginex-runner/mvnw b/jar-enginex-runner/mvnw deleted file mode 100644 index a16b543..0000000 --- a/jar-enginex-runner/mvnw +++ /dev/null @@ -1,310 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Mingw, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -########################################################################################## -# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -# This allows using the maven wrapper in projects that prohibit checking in binary data. -########################################################################################## -if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found .mvn/wrapper/maven-wrapper.jar" - fi -else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." - fi - if [ -n "$MVNW_REPOURL" ]; then - jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" - else - jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" - fi - while IFS="=" read key value; do - case "$key" in (wrapperUrl) jarUrl="$value"; break ;; - esac - done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" - if [ "$MVNW_VERBOSE" = true ]; then - echo "Downloading from: $jarUrl" - fi - wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" - if $cygwin; then - wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` - fi - - if command -v wget > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found wget ... using wget" - fi - if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - wget "$jarUrl" -O "$wrapperJarPath" - else - wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" - fi - elif command -v curl > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found curl ... using curl" - fi - if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - curl -o "$wrapperJarPath" "$jarUrl" -f - else - curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f - fi - - else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Falling back to using Java to download" - fi - javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" - # For Cygwin, switch paths to Windows format before running javac - if $cygwin; then - javaClass=`cygpath --path --windows "$javaClass"` - fi - if [ -e "$javaClass" ]; then - if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Compiling MavenWrapperDownloader.java ..." - fi - # Compiling the Java class - ("$JAVA_HOME/bin/javac" "$javaClass") - fi - if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - # Running the downloader - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Running MavenWrapperDownloader.java ..." - fi - ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") - fi - fi - fi -fi -########################################################################################## -# End of extension -########################################################################################## - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -if [ "$MVNW_VERBOSE" = true ]; then - echo $MAVEN_PROJECTBASEDIR -fi -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -# Provide a "standardized" way to retrieve the CLI args that will -# work with both Windows and non-Windows executions. -MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" -export MAVEN_CMD_LINE_ARGS - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/jar-enginex-runner/mvnw.cmd b/jar-enginex-runner/mvnw.cmd deleted file mode 100644 index c8d4337..0000000 --- a/jar-enginex-runner/mvnw.cmd +++ /dev/null @@ -1,182 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM https://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM set title of command window -title %0 -@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" - -FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( - IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B -) - -@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -@REM This allows using the maven wrapper in projects that prohibit checking in binary data. -if exist %WRAPPER_JAR% ( - if "%MVNW_VERBOSE%" == "true" ( - echo Found %WRAPPER_JAR% - ) -) else ( - if not "%MVNW_REPOURL%" == "" ( - SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" - ) - if "%MVNW_VERBOSE%" == "true" ( - echo Couldn't find %WRAPPER_JAR%, downloading it ... - echo Downloading from: %DOWNLOAD_URL% - ) - - powershell -Command "&{"^ - "$webclient = new-object System.Net.WebClient;"^ - "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ - "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ - "}"^ - "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ - "}" - if "%MVNW_VERBOSE%" == "true" ( - echo Finished downloading %WRAPPER_JAR% - ) -) -@REM End of extension - -@REM Provide a "standardized" way to retrieve the CLI args that will -@REM work with both Windows and non-Windows executions. -set MAVEN_CMD_LINE_ARGS=%* - -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% diff --git a/jar-enginex-runner/pom.xml b/jar-enginex-runner/pom.xml deleted file mode 100644 index 292ed90..0000000 --- a/jar-enginex-runner/pom.xml +++ /dev/null @@ -1,283 +0,0 @@ - - - 4.0.0 - - org.springframework.boot - spring-boot-starter-parent - 2.4.2 - - - com.baoying - enginex-runner - 0.0.1-SNAPSHOT - jar-enginex-runner - Demo project for Spring Boot - - 1.8 - 1.2.12 - 6.4.0.Final - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-logging - - - - - - org.springframework.boot - spring-boot-starter-log4j2 - - - - org.springframework.boot - spring-boot-starter-test - test - - - - junit - junit - test - - - - - - com.baomidou - mybatis-plus-boot-starter - 3.3.2 - - - - mysql - mysql-connector-java - - - - com.alibaba - druid-spring-boot-starter - 1.1.21 - - - - org.codehaus.jackson - jackson-mapper-lgpl - 1.7.4 - - - - org.apache.commons - commons-lang3 - 3.1 - - - - com.alibaba - fastjson - 1.2.58 - - - - org.projectlombok - lombok - 1.18.0 - - - - - org.drools - drools-core - ${drools.version} - - - org.kie - kie-spring - ${drools.version} - - - org.drools - drools-compiler - ${drools.version} - - - org.kie - kie-api - ${drools.version} - - - org.kie - kie-ci - ${drools.version} - - - org.drools - knowledge-api - 6.4.0.Final - - - com.itextpdf - itextpdf - 5.4.3 - - - com.itextpdf - itext-asian - 5.2.0 - - - - - - com.github.ben-manes.caffeine - caffeine - 2.8.4 - - - - - org.apache.commons - commons-pool2 - 2.0 - - - - - redis.clients - jedis - 2.4.2 - - - - - - commons-httpclient - commons-httpclient - 3.1 - - - - - org.codehaus.groovy - groovy-all - 2.4.15 - - - - org.python - jython-standalone - 2.7.0 - - - - org.jpmml - pmml-evaluator - 1.4.1 - - - org.jpmml - pmml-evaluator-extension - 1.4.1 - - - - - org.springframework.boot - spring-boot-starter-mail - - - - com.alibaba - transmittable-thread-local - 2.2.0 - - - - jakarta.xml.bind - jakarta.xml.bind-api - 2.3.3 - compile - - - com.github.pagehelper - pagehelper-spring-boot-starter - - 1.2.3 - - - org.mybatis - mybatis - - - org.mybatis - mybatis-spring - - - - - - - com.alibaba.otter - canal.client - 1.1.4 - - - ch.qos.logback - logback-core - - - ch.qos.logback - logback-classic - - - - - com.google.protobuf - protobuf-java - 3.5.1 - - - - cn.hutool - hutool-all - 5.5.2 - - - - - - - src/main/java - - - **/*.xml - - - - - src/main/resources - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/JarEnginexRunnerApplication.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/JarEnginexRunnerApplication.java deleted file mode 100644 index 75a7d47..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/JarEnginexRunnerApplication.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.baoying.enginex.executor; - -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -@SpringBootApplication -@EnableTransactionManagement -@MapperScan("com.baoying.enginex.executor.*.mapper") -@ComponentScan(basePackages = "com.baoying.enginex.executor.**") -public class JarEnginexRunnerApplication { - - public static void main(String[] args) { - SpringApplication.run(JarEnginexRunnerApplication.class, args); - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/canal/CacheController.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/canal/CacheController.java deleted file mode 100644 index 4da7c78..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/canal/CacheController.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.baoying.enginex.executor.canal; - -import com.baoying.enginex.executor.datamanage.mapper.SimpleMapper; -import com.baoying.enginex.executor.redis.RedisManager; -import com.baoying.enginex.executor.redis.RedisUtils; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - -import javax.annotation.Resource; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -@RestController -@RequestMapping("/cache") -public class CacheController { - - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Resource - private SimpleMapper simpleMapper; - @Autowired - private RedisManager redisManager; - - @RequestMapping(value = "initCache", method = RequestMethod.GET) - public void initCache() { - logger.info("===================== 缓存初始化开始 ====================="); - long start = System.currentTimeMillis(); - // 遍历表 - for (TableEnum tableEnum : TableEnum.values()) { - String tableName = tableEnum.getTableName(); - logger.info("===================== 开始初始化缓存表[{}] =====================", tableName); - - String sqlStr = "select * from " + tableName; - Map parameterMap = new HashMap<>(); - parameterMap.put("sqlStr", sqlStr); - List> result = simpleMapper.customSelect(parameterMap); - // 遍历行 - for (LinkedHashMap map : result) { - row(tableEnum, map); - } - logger.info("===================== 结束初始化缓存表[{}],共[{}]条数据 =====================", tableName, result.size()); - } - long end = System.currentTimeMillis(); - logger.info("===================== 缓存初始化成功!!耗时:{}ms =====================", (end - start)); - } - - private void row(TableEnum tableEnum, LinkedHashMap map) { - String tableName = tableEnum.getTableName(); - String primaryKey = null; - String foreignKey = null; - - if (StringUtils.isNotBlank(tableEnum.getPrimaryId())) { - String primaryId = map.get(tableEnum.getPrimaryId()).toString(); - primaryKey = RedisUtils.getPrimaryKey(tableName, primaryId); - } - - if (StringUtils.isNotBlank(tableEnum.getForeignId())) { - Object obj = map.get(tableEnum.getForeignId()); - if (obj != null && !"".equals(obj.toString())) { - String foreignId = obj.toString(); - foreignKey = RedisUtils.getForeignKey(tableName, foreignId); - } - } - - if (StringUtils.isNotBlank(primaryKey)) { - // 遍历列 - for (String field : map.keySet()) { - String value = map.get(field) == null ? null : map.get(field).toString(); - setColumnCache(primaryKey, field, value); - } - } - - if (StringUtils.isNotBlank(foreignKey)) { - setForeignKeyCache(primaryKey, foreignKey); - } - - // 指标表特殊处理 - dealSpecialTable(tableName, map); - } - - private void setColumnCache(String primaryKey, String field, String value) { - logger.info("开始主键缓存设置, primaryKey:{}, field:{}, value:{}", primaryKey, field, value); - - redisManager.hset(primaryKey, field, value); - - logger.info("结束主键缓存设置, primaryKey:{}, field:{}, value:{}", primaryKey, field, value); - } - - private void setForeignKeyCache(String primaryKey, String foreignKey) { - logger.info("开始外键缓存设置, primaryKey:{}, foreignKey:{}", primaryKey, foreignKey); - - redisManager.sadd(foreignKey, primaryKey); - - logger.info("结束外键缓存设置, primaryKey:{}, foreignKey:{}", primaryKey, foreignKey); - } - - private void dealSpecialTable(String tableName, LinkedHashMap map) { - if(tableName.equals(TableEnum.T_FIELD.getTableName())){ - String fieldEn = "field_en:" + map.get("organ_id") + ":" + map.get("field_en"); - String fieldEnKey = RedisUtils.getPrimaryKey(tableName, fieldEn); - - String fieldCn = "field_cn:" + map.get("organ_id") + ":" + map.get("field_cn"); - String fieldCnKey = RedisUtils.getPrimaryKey(tableName, fieldCn); - - for (String field : map.keySet()) { - String value = map.get(field) == null ? null : map.get(field).toString(); - setColumnCache(fieldEnKey, field, value); - setColumnCache(fieldCnKey, field, value); - } - } - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/canal/CanalClient.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/canal/CanalClient.java deleted file mode 100644 index cdbb23d..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/canal/CanalClient.java +++ /dev/null @@ -1,246 +0,0 @@ -package com.baoying.enginex.executor.canal; - -import com.alibaba.otter.canal.client.CanalConnector; -import com.alibaba.otter.canal.client.CanalConnectors; -import com.alibaba.otter.canal.protocol.CanalEntry; -import com.alibaba.otter.canal.protocol.Message; -import com.baoying.enginex.executor.common.constants.Constants; -import com.baoying.enginex.executor.config.ConfigHolder; -import com.baoying.enginex.executor.redis.RedisManager; -import com.baoying.enginex.executor.redis.RedisUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.ApplicationArguments; -import org.springframework.boot.ApplicationRunner; -import org.springframework.stereotype.Component; - -import java.net.InetSocketAddress; -import java.util.List; -import java.util.Optional; - -/** - * Canal数据同步 - * 实现ApplicationRunner接口,springboot启动成功后会执行run方法 - */ -@Component -public class CanalClient implements ApplicationRunner { - - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - private final static int BATCH_SIZE = 1000; - @Autowired - private ConfigHolder configHolder; - @Autowired - private RedisManager redisManager; - - @Override - public void run(ApplicationArguments args) throws Exception { - if(Constants.switchFlag.OFF.equals(configHolder.getCanalCacheSwitch())){ - return; - } - - // 创建链接 - CanalConnector connector = CanalConnectors.newSingleConnector( - new InetSocketAddress(configHolder.getCanalHostName(), configHolder.getCanalPort()), - "example", "", ""); - try { - //打开连接 - connector.connect(); - //订阅数据库表,全部表 - connector.subscribe(".*\\..*"); - //回滚到未进行ack的地方,下次fetch的时候,可以从最后一个没有ack的地方开始拿 - connector.rollback(); - while (true) { - logger.info("canal数据同步监听中..."); - // 获取指定数量的数据 - Message message = connector.getWithoutAck(BATCH_SIZE); - //获取批量ID - long batchId = message.getId(); - //获取批量的数量 - int size = message.getEntries().size(); - //如果没有数据 - if (batchId == -1 || size == 0) { - try { - //线程休眠2秒 - Thread.sleep(2000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } else { - //如果有数据,处理数据 - printEntry(message.getEntries()); - } - //进行 batch id 的确认。确认之后,小于等于此 batchId 的 Message 都会被确认。 - connector.ack(batchId); - } - } catch (Exception e) { - e.printStackTrace(); - } finally { - connector.disconnect(); - } - } - - /** - * 解析binlog获得的实体类信息 - */ - private void printEntry(List entrys) { - for (CanalEntry.Entry entry : entrys) { - if (entry.getEntryType() == CanalEntry.EntryType.TRANSACTIONBEGIN || entry.getEntryType() == CanalEntry.EntryType.TRANSACTIONEND) { - //开启/关闭事务的实体类型,跳过 - continue; - } - - String tableName = entry.getHeader().getTableName(); - TableEnum tableEnum = TableEnum.getByTableName(tableName); - if(tableEnum == null){ - // 没有在枚举中定义的表,跳过 - continue; - } - - //RowChange对象,包含了一行数据变化的所有特征 - //比如isDdl 是否是ddl变更操作 sql 具体的ddl sql beforeColumns afterColumns 变更前后的数据字段等等 - CanalEntry.RowChange rowChage; - try { - rowChage = CanalEntry.RowChange.parseFrom(entry.getStoreValue()); - } catch (Exception e) { - throw new RuntimeException("ERROR ## parser of eromanga-event has an error , data:" + entry.toString(), e); - } - - //获取操作类型:insert/update/delete类型 - CanalEntry.EventType eventType = rowChage.getEventType(); - //打印Header信息 - logger.info(String.format("============= binlog[%s:%s] , name[%s,%s] , eventType : %s =============", - entry.getHeader().getLogfileName(), entry.getHeader().getLogfileOffset(), - entry.getHeader().getSchemaName(), entry.getHeader().getTableName(), - eventType)); - - //判断是否是DDL语句 - if (rowChage.getIsDdl()) { - logger.info("============= isDdl: true,sql:" + rowChage.getSql()); - } - - //获取RowChange对象里的每一行数据 - for (CanalEntry.RowData rowData : rowChage.getRowDatasList()) { - //如果是删除语句 - if (eventType == CanalEntry.EventType.DELETE) { - row(rowData.getBeforeColumnsList(), tableName); - //如果是新增语句 - } else if (eventType == CanalEntry.EventType.INSERT) { - row(rowData.getAfterColumnsList(), tableName); - //如果是更新的语句 - } else { - //变更前的数据 -// printColumn(rowData.getBeforeColumnsList(), tableName); - //变更后的数据 - row(rowData.getAfterColumnsList(), tableName); - } - } - } - } - - private void row(List columns, String tableName) { - Optional keyColumn = columns.stream().filter(item -> item.getIsKey()).findFirst(); - if(keyColumn.isPresent()){ - // 获取主键id - String id = keyColumn.get().getValue(); - // 拼接主键key - String key = RedisUtils.getPrimaryKey(tableName, id); - // 拼接外键key - String foreignKey = null; - // 子表的redis key需要拼接上主表的id - TableEnum tableEnum = TableEnum.getByTableName(tableName); - if(tableEnum != null){ - Optional foreignKeyColumn = columns.stream().filter(item -> item.getName().equals(tableEnum.getForeignId())).findFirst(); - if(foreignKeyColumn.isPresent()){ - String foreignKeyValue = foreignKeyColumn.get().getValue(); - foreignKey = RedisUtils.getForeignKey(tableName, foreignKeyValue); - } - } - - for (CanalEntry.Column column : columns) { - // 更新发生改变的字段缓存 - setUpdatedColumnCache(column, key, foreignKey); - } - - // 指标表特殊处理 - dealSpecialTable(columns, tableName); - } - } - - private void setUpdatedColumnCache(CanalEntry.Column column, String key, String foreignKey){ - if(column.getUpdated()) { - logger.info("开始主键缓存更新, {}, {}, {}", key, column.getName(), column.getValue()); - - redisManager.hset(key, column.getName(), column.getValue()); - - logger.info("结束主键缓存更新, {}, {}, {}", key, column.getName(), column.getValue()); - - if(foreignKey != null){ - logger.info("开始外键缓存更新, {}, {}", key, foreignKey); - - redisManager.sadd(foreignKey, key); - - logger.info("结束外键缓存更新, {}, {}", key, foreignKey); - } - } - } - - private void setAllColumnCache(CanalEntry.Column column, String key){ - logger.info("开始主键缓存更新, {}, {}, {}", key, column.getName(), column.getValue()); - - redisManager.hset(key, column.getName(), column.getValue()); - - logger.info("结束主键缓存更新, {}, {}, {}", key, column.getName(), column.getValue()); - } - - private void dealSpecialTable(List columns, String tableName){ - if(tableName.equals(TableEnum.T_FIELD.getTableName())){ - String organ_id = null; - String field_en = null; - String field_cn = null; - for (CanalEntry.Column column : columns) { - String name = column.getName(); - switch (name) { - case "organ_id": - organ_id = column.getValue(); - break; - case "field_en": - field_en = column.getValue(); - break; - case "field_cn": - field_cn = column.getValue(); - break; - default: - break; - } - } - - String fieldEn = "field_en:" + organ_id + ":" + field_en; - String fieldEnKey = RedisUtils.getPrimaryKey(tableName, fieldEn); - - String fieldCn = "field_cn:" + organ_id + ":" + field_cn; - String fieldCnKey = RedisUtils.getPrimaryKey(tableName, fieldCn); - - // 如果field_en或field_cn发生变化,则对应的key为新生成的,需要保存所有字段缓存 - Optional fieldEnOptional = columns.stream().filter(item -> item.getName().equals("field_en") && item.getUpdated()).findFirst(); - Optional fieldCnOptional = columns.stream().filter(item -> item.getName().equals("field_cn") && item.getUpdated()).findFirst(); - for (CanalEntry.Column column : columns) { - if(fieldEnOptional.isPresent()){ - // 更新所有字段缓存 - setAllColumnCache(column, fieldEnKey); - } else { - // 更新发生改变的字段缓存 - setUpdatedColumnCache(column, fieldEnKey, null); - } - - if(fieldCnOptional.isPresent()){ - setAllColumnCache(column, fieldCnKey); - } else { - setUpdatedColumnCache(column, fieldCnKey, null); - } - } - } - } - -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/canal/TableEnum.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/canal/TableEnum.java deleted file mode 100644 index ba4b0be..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/canal/TableEnum.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.baoying.enginex.executor.canal; - -/** - * 缓存数据同步表 - */ -public enum TableEnum { - - /** - * 引擎 - */ - T_ENGINE("t_engine", "id", ""), - T_ENGINE_VERSION("t_engine_version", "version_id", "engine_id"), - T_ENGINE_NODE("t_engine_node", "node_id", "version_id"), - - /** - * 指标 - */ - T_FIELD("t_field", "id", ""), - T_FIELD_INTERFACE("t_field_interface", "id", ""), - T_FIELD_DATA_SOURCE("t_field_data_source", "id", ""), - - /** - * 规则 - */ - T_RULE("t_rule", "id", ""), - T_RULE_VERSION("t_rule_version", "id", "rule_id"), - T_RULE_CONDITION("t_rule_condition", "id", "version_id"), - T_RULE_LOOP_GROUP_ACTION("t_rule_loop_group_action", "id", "condition_for_id"), - T_RULE_FIELD("t_rule_field", "id", "rule_id"), - /** - * 策略输出 - */ - T_TACTICS_OUTPUT("t_tactics_output", "id", "tactics_id"); - - private String tableName; - private String primaryId; - private String foreignId; - - TableEnum(String tableName, String primaryId, String foreignId) { - this.tableName = tableName; - this.primaryId = primaryId; - this.foreignId = foreignId; - } - - public static TableEnum getByTableName(String tableName) { - for (TableEnum tableEnum : TableEnum.values()) { - if (tableName.equals(tableEnum.getTableName())) { - return tableEnum; - } - } - return null; - } - - public String getTableName() { - return tableName; - } - - public void setTableName(String tableName) { - this.tableName = tableName; - } - - public String getPrimaryId() { - return primaryId; - } - - public void setPrimaryId(String primaryId) { - this.primaryId = primaryId; - } - - public String getForeignId() { - return foreignId; - } - - public void setForeignId(String foreignId) { - this.foreignId = foreignId; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/basefactory/CustomBeanFactory.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/basefactory/CustomBeanFactory.java deleted file mode 100644 index b2caba1..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/basefactory/CustomBeanFactory.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baoying.enginex.executor.common.basefactory; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public final class CustomBeanFactory { - public static ApplicationContext getContext() { - final String[] applicationXML = { "applicationContext.xml"}; - ApplicationContext context = getSpringContext(applicationXML); - return context; - } - - public static ApplicationContext getSpringContext(String[] paths) { - return new ClassPathXmlApplicationContext(paths); - - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/constants/CommonConst.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/constants/CommonConst.java deleted file mode 100644 index f34a03d..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/constants/CommonConst.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.baoying.enginex.executor.common.constants; - -public class CommonConst { - - /** - * 逗号 - */ - public static final String SYMBOL_COMMA = ","; - - /** - * 单引号 - */ - public static final String SYMBOL_SINGLE_QUOTA = "\'"; - - /** - * 空格 - */ - public static final String SYMBOL_BLANK = " "; - - /** - * 空字符串 - */ - public static final String STRING_EMPTY = ""; - - /** - * 30分钟(s) - * */ - public static final long MINUTE_30 = 1800000; - - public static String DROOLS_KSESSION_KEY_PREFIX = "DROOLS_KSESSION#"; -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/constants/Constants.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/constants/Constants.java deleted file mode 100644 index 9fdc18c..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/constants/Constants.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.baoying.enginex.executor.common.constants; - -/** - * 公共变量约定 - */ -public class Constants { - - // 规则集节点相关常量 - public interface ruleNode { - // 互斥组(串行) - int MUTEXGROUP = 1; - // 执行组(并行) - int EXECUTEGROUP = 2; - } - - public interface switchFlag { - // 开关打开 - String ON = "on"; - // 开关关闭 - String OFF = "off"; - } - - public interface fieldName { - // 字段英文名 - String fieldEn = "field_en"; - //字段中文名 - String fieldCn = "field_cn"; - } - -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/constants/ParamTypeConst.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/constants/ParamTypeConst.java deleted file mode 100644 index 9ce45b6..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/constants/ParamTypeConst.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.baoying.enginex.executor.common.constants; - -public class ParamTypeConst { - public static final int CONSTANT = 1; - public static final int VARIABLE = 2; - public static final int CUSTOM = 3; - public static final int REGEX = 4; - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/ksession/KSessionFactory.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/ksession/KSessionFactory.java deleted file mode 100644 index 6b4e3f5..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/ksession/KSessionFactory.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.baoying.enginex.executor.common.ksession; - -import com.baoying.enginex.executor.redis.RedisManager; -import org.apache.commons.pool2.BaseKeyedPooledObjectFactory; -import org.apache.commons.pool2.PooledObject; -import org.apache.commons.pool2.impl.DefaultPooledObject; -import org.drools.KnowledgeBase; -import org.drools.KnowledgeBaseFactory; -import org.drools.builder.*; -import org.drools.io.ResourceFactory; -import org.drools.runtime.StatefulKnowledgeSession; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -/** - * kSession工厂类 - */ -@Component -public class KSessionFactory extends BaseKeyedPooledObjectFactory { - - @Autowired - private RedisManager redisManager; - - @Override - public StatefulKnowledgeSession create(String key) throws Exception { - StatefulKnowledgeSession kSession = null; - try { - String ruleString = redisManager.get(key); - if(ruleString == null){ - throw new Exception("create kSession fail, key is "+ key + ", ruleString is null!"); - } - - long start = System.currentTimeMillis(); - KnowledgeBuilder kb = KnowledgeBuilderFactory.newKnowledgeBuilder(); - kb.add(ResourceFactory.newByteArrayResource(ruleString.getBytes("utf-8")), ResourceType.DRL); - KnowledgeBuilderErrors errors = kb.getErrors(); - for (KnowledgeBuilderError error : errors) { - System.out.println(error); - } - KnowledgeBase kBase = KnowledgeBaseFactory.newKnowledgeBase(); - kBase.addKnowledgePackages(kb.getKnowledgePackages()); - kSession = kBase.newStatefulKnowledgeSession(); - long end = System.currentTimeMillis(); - System.out.println("------------------drools kSession创建耗时:" + (end - start) + " ----------------------"); - } catch (Exception e) { - throw e; - } - - return kSession; - } - - @Override - public PooledObject wrap(StatefulKnowledgeSession kSession) { - return new DefaultPooledObject(kSession); - } - - public void setRedisManager(RedisManager redisManager) { - this.redisManager = redisManager; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/ksession/KSessionPool.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/ksession/KSessionPool.java deleted file mode 100644 index 6951d13..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/ksession/KSessionPool.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.baoying.enginex.executor.common.ksession; - -import org.apache.commons.pool2.impl.GenericKeyedObjectPool; -import org.apache.commons.pool2.impl.GenericKeyedObjectPoolConfig; -import org.drools.runtime.StatefulKnowledgeSession; -import org.springframework.beans.factory.InitializingBean; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -/** - * kSession连接池 - */ -@Component -public class KSessionPool implements InitializingBean { - - private GenericKeyedObjectPool pool; - - @Autowired - private KSessionFactory kSessionFactory; - - /** - * 初始化方法 - * @throws Exception - */ - @Override - public void afterPropertiesSet() throws Exception { - initPool(); - } - - /** - * 初始化连接池 - * @return - * @throws Exception - */ - public void initPool() throws Exception { - GenericKeyedObjectPoolConfig poolConfig = new GenericKeyedObjectPoolConfig(); - poolConfig.setMaxTotalPerKey(200); - poolConfig.setMaxIdlePerKey(50); - poolConfig.setMinIdlePerKey(5); - poolConfig.setMaxTotal(2000); - this.pool = new GenericKeyedObjectPool(kSessionFactory, poolConfig); - } - - /** - * 获取一个连接对象 - * @return - * @throws Exception - */ - public StatefulKnowledgeSession borrowObject(String key) throws Exception { - return pool.borrowObject(key); - } - - /** - * 归还一个连接对象 - * @param ftpClient - */ - public void returnObject(String key, StatefulKnowledgeSession kSession) { - if(kSession != null){ - pool.returnObject(key, kSession); - } - } - - public void setkSessionFactory(KSessionFactory kSessionFactory) { - this.kSessionFactory = kSessionFactory; - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/mapper/BaseMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/mapper/BaseMapper.java deleted file mode 100644 index f70a40b..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/mapper/BaseMapper.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.baoying.enginex.executor.common.mapper; - -import java.util.List; - -public abstract interface BaseMapper { - - /** - * @Description: 根据对象删除数据 - * @param entity 对象 - * @return 是否删除成功 - */ - int deleteByExample(IdEntity entity); - - /** - * @Description: 根据对象主键ID删除数据 - * @param id 对象id编号 - * @return 是否删除成功 - */ - int deleteByPrimaryKey(Long id); - - /** - * @Description: 插入一条新的数据 - * @param entity 对象 - * @return 是否插入成功 - */ - int insertSelective(IdEntity entity); - - /** - * @Description: 根据对象主键更新对象信息 - * @param entity 对象 - * @return 是否修改成功标志 - */ - int updateByPrimaryKeySelective(IdEntity entity); - - /** - * @Description: 根据对象获取数据条数 - * @param entity 对象 - * @return 返回行数 - */ - int countByExample(IdEntity entity); - - /** - * @Description: 根据对象主键ID获取指定数据(多个) - * @param entity 对象 - * @return 对象列表 - */ - List selectByExample(IdEntity entity); - - /** - * @Description: 根据对象主键ID获取指定数据(单个) - * @param id id编号 - * @return 返回单个对象 - */ - IdEntity selectByPrimaryKey(Long id); -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/mapper/EmailTemplateMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/mapper/EmailTemplateMapper.java deleted file mode 100644 index e990cb6..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/mapper/EmailTemplateMapper.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.baoying.enginex.executor.common.mapper; - -import com.baoying.enginex.executor.common.model.EmailTemplate; -import com.baoying.enginex.executor.common.model.EmailTemplateExample; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -public interface EmailTemplateMapper { - long countByExample(EmailTemplateExample example); - - int deleteByExample(EmailTemplateExample example); - - int deleteByPrimaryKey(Integer templateId); - - int insert(EmailTemplate record); - - int insertSelective(EmailTemplate record); - - List selectByExampleWithBLOBs(EmailTemplateExample example); - - List selectByExample(EmailTemplateExample example); - - EmailTemplate selectByPrimaryKey(Integer templateId); - - int updateByExampleSelective(@Param("record") EmailTemplate record, @Param("example") EmailTemplateExample example); - - int updateByExampleWithBLOBs(@Param("record") EmailTemplate record, @Param("example") EmailTemplateExample example); - - int updateByExample(@Param("record") EmailTemplate record, @Param("example") EmailTemplateExample example); - - int updateByPrimaryKeySelective(EmailTemplate record); - - int updateByPrimaryKeyWithBLOBs(EmailTemplate record); - - int updateByPrimaryKey(EmailTemplate record); - - EmailTemplate selectTemplateByNid(String nid); -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/mapper/EmailTemplateMapper.xml b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/mapper/EmailTemplateMapper.xml deleted file mode 100644 index 5f092f0..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/mapper/EmailTemplateMapper.xml +++ /dev/null @@ -1,345 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - template_id, subject, nid, status, address, use_type, create_time, update_time - - - content - - - - - - delete from t_email_template - where template_id = #{templateId,jdbcType=INTEGER} - - - delete from t_email_template - - - - - - insert into t_email_template (template_id, subject, nid, - status, address, use_type, - create_time, update_time, content - ) - values (#{templateId,jdbcType=INTEGER}, #{subject,jdbcType=VARCHAR}, #{nid,jdbcType=VARCHAR}, - #{status,jdbcType=TINYINT}, #{address,jdbcType=VARCHAR}, #{useType,jdbcType=TINYINT}, - #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{content,jdbcType=LONGVARCHAR} - ) - - - insert into t_email_template - - - template_id, - - - subject, - - - nid, - - - status, - - - address, - - - use_type, - - - create_time, - - - update_time, - - - content, - - - - - #{templateId,jdbcType=INTEGER}, - - - #{subject,jdbcType=VARCHAR}, - - - #{nid,jdbcType=VARCHAR}, - - - #{status,jdbcType=TINYINT}, - - - #{address,jdbcType=VARCHAR}, - - - #{useType,jdbcType=TINYINT}, - - - #{createTime,jdbcType=TIMESTAMP}, - - - #{updateTime,jdbcType=TIMESTAMP}, - - - #{content,jdbcType=LONGVARCHAR}, - - - - - - update t_email_template - - - template_id = #{record.templateId,jdbcType=INTEGER}, - - - subject = #{record.subject,jdbcType=VARCHAR}, - - - nid = #{record.nid,jdbcType=VARCHAR}, - - - status = #{record.status,jdbcType=TINYINT}, - - - address = #{record.address,jdbcType=VARCHAR}, - - - use_type = #{record.useType,jdbcType=TINYINT}, - - - create_time = #{record.createTime,jdbcType=TIMESTAMP}, - - - update_time = #{record.updateTime,jdbcType=TIMESTAMP}, - - - content = #{record.content,jdbcType=LONGVARCHAR}, - - - - - - - - update t_email_template - set template_id = #{record.templateId,jdbcType=INTEGER}, - subject = #{record.subject,jdbcType=VARCHAR}, - nid = #{record.nid,jdbcType=VARCHAR}, - status = #{record.status,jdbcType=TINYINT}, - address = #{record.address,jdbcType=VARCHAR}, - use_type = #{record.useType,jdbcType=TINYINT}, - create_time = #{record.createTime,jdbcType=TIMESTAMP}, - update_time = #{record.updateTime,jdbcType=TIMESTAMP}, - content = #{record.content,jdbcType=LONGVARCHAR} - - - - - - update t_email_template - set template_id = #{record.templateId,jdbcType=INTEGER}, - subject = #{record.subject,jdbcType=VARCHAR}, - nid = #{record.nid,jdbcType=VARCHAR}, - status = #{record.status,jdbcType=TINYINT}, - address = #{record.address,jdbcType=VARCHAR}, - use_type = #{record.useType,jdbcType=TINYINT}, - create_time = #{record.createTime,jdbcType=TIMESTAMP}, - update_time = #{record.updateTime,jdbcType=TIMESTAMP} - - - - - - update t_email_template - - - subject = #{subject,jdbcType=VARCHAR}, - - - nid = #{nid,jdbcType=VARCHAR}, - - - status = #{status,jdbcType=TINYINT}, - - - address = #{address,jdbcType=VARCHAR}, - - - use_type = #{useType,jdbcType=TINYINT}, - - - create_time = #{createTime,jdbcType=TIMESTAMP}, - - - update_time = #{updateTime,jdbcType=TIMESTAMP}, - - - content = #{content,jdbcType=LONGVARCHAR}, - - - where template_id = #{templateId,jdbcType=INTEGER} - - - update t_email_template - set subject = #{subject,jdbcType=VARCHAR}, - nid = #{nid,jdbcType=VARCHAR}, - status = #{status,jdbcType=TINYINT}, - address = #{address,jdbcType=VARCHAR}, - use_type = #{useType,jdbcType=TINYINT}, - create_time = #{createTime,jdbcType=TIMESTAMP}, - update_time = #{updateTime,jdbcType=TIMESTAMP}, - content = #{content,jdbcType=LONGVARCHAR} - where template_id = #{templateId,jdbcType=INTEGER} - - - update t_email_template - set subject = #{subject,jdbcType=VARCHAR}, - nid = #{nid,jdbcType=VARCHAR}, - status = #{status,jdbcType=TINYINT}, - address = #{address,jdbcType=VARCHAR}, - use_type = #{useType,jdbcType=TINYINT}, - create_time = #{createTime,jdbcType=TIMESTAMP}, - update_time = #{updateTime,jdbcType=TIMESTAMP} - where template_id = #{templateId,jdbcType=INTEGER} - - - - - \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/model/BasePage.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/model/BasePage.java deleted file mode 100644 index d2a2e1c..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/model/BasePage.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.baoying.enginex.executor.common.model; - - -public class BasePage { - - /** - * 当前页数 - */ - private int page; - - /** - * 每页显示的行数 - */ - private int rows; - - /** - * 开始行数 - */ - private Integer curRow; - - /** - * 结束行数 - */ - private Integer endRow; - - /** - * 总行数 - */ - private Integer total; - - public BasePage() { - - } - - public Integer getTotal() { - return total; - } - - public void setTotal(Integer total) { - this.total = total; - } - - /** - * setPagination:(设置当前页面和每页显示行数).
- * @author wz - * @param page 当前页数 - * @param rows 每页显示的行数 - */ - public void setPagination(int page,int rows){ - this.page = page; - this.rows = rows; - this.curRow = (page-1)*rows; - this.endRow = (page)*rows; - } - - - public int getPage() { - return page; - } - - public void setPage(int page) { - this.page = page; - } - - public int getRows() { - return rows; - } - - public void setRows(int rows) { - this.rows = rows; - } - - public void setCurRow(Integer curRow) { - this.curRow = curRow; - } - - public void setEndRow(Integer endRow) { - this.endRow = endRow; - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/model/EmailTemplate.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/model/EmailTemplate.java deleted file mode 100644 index c7cefad..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/model/EmailTemplate.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.baoying.enginex.executor.common.model; - -import java.util.Date; - -public class EmailTemplate { - private Integer templateId; - - private String subject; - - private String nid; - - private Byte status; - - private String address; - - private Byte useType; - - private Date createTime; - - private Date updateTime; - - private String content; - - public EmailTemplate(Integer templateId, String subject, String nid, Byte status, String address, Byte useType, Date createTime, Date updateTime) { - this.templateId = templateId; - this.subject = subject; - this.nid = nid; - this.status = status; - this.address = address; - this.useType = useType; - this.createTime = createTime; - this.updateTime = updateTime; - } - - public EmailTemplate(Integer templateId, String subject, String nid, Byte status, String address, Byte useType, Date createTime, Date updateTime, String content) { - this.templateId = templateId; - this.subject = subject; - this.nid = nid; - this.status = status; - this.address = address; - this.useType = useType; - this.createTime = createTime; - this.updateTime = updateTime; - this.content = content; - } - - public EmailTemplate() { - super(); - } - - public Integer getTemplateId() { - return templateId; - } - - public void setTemplateId(Integer templateId) { - this.templateId = templateId; - } - - public String getSubject() { - return subject; - } - - public void setSubject(String subject) { - this.subject = subject == null ? null : subject.trim(); - } - - public String getNid() { - return nid; - } - - public void setNid(String nid) { - this.nid = nid == null ? null : nid.trim(); - } - - public Byte getStatus() { - return status; - } - - public void setStatus(Byte status) { - this.status = status; - } - - public String getAddress() { - return address; - } - - public void setAddress(String address) { - this.address = address == null ? null : address.trim(); - } - - public Byte getUseType() { - return useType; - } - - public void setUseType(Byte useType) { - this.useType = useType; - } - - public Date getCreateTime() { - return createTime; - } - - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - - public Date getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Date updateTime) { - this.updateTime = updateTime; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content == null ? null : content.trim(); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/model/EmailTemplateExample.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/model/EmailTemplateExample.java deleted file mode 100644 index 6ae7b1d..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/model/EmailTemplateExample.java +++ /dev/null @@ -1,711 +0,0 @@ -package com.baoying.enginex.executor.common.model; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -public class EmailTemplateExample { - protected String orderByClause; - - protected boolean distinct; - - protected List oredCriteria; - - public EmailTemplateExample() { - oredCriteria = new ArrayList(); - } - - public void setOrderByClause(String orderByClause) { - this.orderByClause = orderByClause; - } - - public String getOrderByClause() { - return orderByClause; - } - - public void setDistinct(boolean distinct) { - this.distinct = distinct; - } - - public boolean isDistinct() { - return distinct; - } - - public List getOredCriteria() { - return oredCriteria; - } - - public void or(Criteria criteria) { - oredCriteria.add(criteria); - } - - public Criteria or() { - Criteria criteria = createCriteriaInternal(); - oredCriteria.add(criteria); - return criteria; - } - - public Criteria createCriteria() { - Criteria criteria = createCriteriaInternal(); - if (oredCriteria.size() == 0) { - oredCriteria.add(criteria); - } - return criteria; - } - - protected Criteria createCriteriaInternal() { - Criteria criteria = new Criteria(); - return criteria; - } - - public void clear() { - oredCriteria.clear(); - orderByClause = null; - distinct = false; - } - - protected abstract static class GeneratedCriteria { - protected List criteria; - - protected GeneratedCriteria() { - super(); - criteria = new ArrayList(); - } - - public boolean isValid() { - return criteria.size() > 0; - } - - public List getAllCriteria() { - return criteria; - } - - public List getCriteria() { - return criteria; - } - - protected void addCriterion(String condition) { - if (condition == null) { - throw new RuntimeException("Value for condition cannot be null"); - } - criteria.add(new Criterion(condition)); - } - - protected void addCriterion(String condition, Object value, String property) { - if (value == null) { - throw new RuntimeException("Value for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value)); - } - - protected void addCriterion(String condition, Object value1, Object value2, String property) { - if (value1 == null || value2 == null) { - throw new RuntimeException("Between values for " + property + " cannot be null"); - } - criteria.add(new Criterion(condition, value1, value2)); - } - - public Criteria andTemplateIdIsNull() { - addCriterion("template_id is null"); - return (Criteria) this; - } - - public Criteria andTemplateIdIsNotNull() { - addCriterion("template_id is not null"); - return (Criteria) this; - } - - public Criteria andTemplateIdEqualTo(Integer value) { - addCriterion("template_id =", value, "templateId"); - return (Criteria) this; - } - - public Criteria andTemplateIdNotEqualTo(Integer value) { - addCriterion("template_id <>", value, "templateId"); - return (Criteria) this; - } - - public Criteria andTemplateIdGreaterThan(Integer value) { - addCriterion("template_id >", value, "templateId"); - return (Criteria) this; - } - - public Criteria andTemplateIdGreaterThanOrEqualTo(Integer value) { - addCriterion("template_id >=", value, "templateId"); - return (Criteria) this; - } - - public Criteria andTemplateIdLessThan(Integer value) { - addCriterion("template_id <", value, "templateId"); - return (Criteria) this; - } - - public Criteria andTemplateIdLessThanOrEqualTo(Integer value) { - addCriterion("template_id <=", value, "templateId"); - return (Criteria) this; - } - - public Criteria andTemplateIdIn(List values) { - addCriterion("template_id in", values, "templateId"); - return (Criteria) this; - } - - public Criteria andTemplateIdNotIn(List values) { - addCriterion("template_id not in", values, "templateId"); - return (Criteria) this; - } - - public Criteria andTemplateIdBetween(Integer value1, Integer value2) { - addCriterion("template_id between", value1, value2, "templateId"); - return (Criteria) this; - } - - public Criteria andTemplateIdNotBetween(Integer value1, Integer value2) { - addCriterion("template_id not between", value1, value2, "templateId"); - return (Criteria) this; - } - - public Criteria andSubjectIsNull() { - addCriterion("subject is null"); - return (Criteria) this; - } - - public Criteria andSubjectIsNotNull() { - addCriterion("subject is not null"); - return (Criteria) this; - } - - public Criteria andSubjectEqualTo(String value) { - addCriterion("subject =", value, "subject"); - return (Criteria) this; - } - - public Criteria andSubjectNotEqualTo(String value) { - addCriterion("subject <>", value, "subject"); - return (Criteria) this; - } - - public Criteria andSubjectGreaterThan(String value) { - addCriterion("subject >", value, "subject"); - return (Criteria) this; - } - - public Criteria andSubjectGreaterThanOrEqualTo(String value) { - addCriterion("subject >=", value, "subject"); - return (Criteria) this; - } - - public Criteria andSubjectLessThan(String value) { - addCriterion("subject <", value, "subject"); - return (Criteria) this; - } - - public Criteria andSubjectLessThanOrEqualTo(String value) { - addCriterion("subject <=", value, "subject"); - return (Criteria) this; - } - - public Criteria andSubjectLike(String value) { - addCriterion("subject like", value, "subject"); - return (Criteria) this; - } - - public Criteria andSubjectNotLike(String value) { - addCriterion("subject not like", value, "subject"); - return (Criteria) this; - } - - public Criteria andSubjectIn(List values) { - addCriterion("subject in", values, "subject"); - return (Criteria) this; - } - - public Criteria andSubjectNotIn(List values) { - addCriterion("subject not in", values, "subject"); - return (Criteria) this; - } - - public Criteria andSubjectBetween(String value1, String value2) { - addCriterion("subject between", value1, value2, "subject"); - return (Criteria) this; - } - - public Criteria andSubjectNotBetween(String value1, String value2) { - addCriterion("subject not between", value1, value2, "subject"); - return (Criteria) this; - } - - public Criteria andNidIsNull() { - addCriterion("nid is null"); - return (Criteria) this; - } - - public Criteria andNidIsNotNull() { - addCriterion("nid is not null"); - return (Criteria) this; - } - - public Criteria andNidEqualTo(String value) { - addCriterion("nid =", value, "nid"); - return (Criteria) this; - } - - public Criteria andNidNotEqualTo(String value) { - addCriterion("nid <>", value, "nid"); - return (Criteria) this; - } - - public Criteria andNidGreaterThan(String value) { - addCriterion("nid >", value, "nid"); - return (Criteria) this; - } - - public Criteria andNidGreaterThanOrEqualTo(String value) { - addCriterion("nid >=", value, "nid"); - return (Criteria) this; - } - - public Criteria andNidLessThan(String value) { - addCriterion("nid <", value, "nid"); - return (Criteria) this; - } - - public Criteria andNidLessThanOrEqualTo(String value) { - addCriterion("nid <=", value, "nid"); - return (Criteria) this; - } - - public Criteria andNidLike(String value) { - addCriterion("nid like", value, "nid"); - return (Criteria) this; - } - - public Criteria andNidNotLike(String value) { - addCriterion("nid not like", value, "nid"); - return (Criteria) this; - } - - public Criteria andNidIn(List values) { - addCriterion("nid in", values, "nid"); - return (Criteria) this; - } - - public Criteria andNidNotIn(List values) { - addCriterion("nid not in", values, "nid"); - return (Criteria) this; - } - - public Criteria andNidBetween(String value1, String value2) { - addCriterion("nid between", value1, value2, "nid"); - return (Criteria) this; - } - - public Criteria andNidNotBetween(String value1, String value2) { - addCriterion("nid not between", value1, value2, "nid"); - return (Criteria) this; - } - - public Criteria andStatusIsNull() { - addCriterion("status is null"); - return (Criteria) this; - } - - public Criteria andStatusIsNotNull() { - addCriterion("status is not null"); - return (Criteria) this; - } - - public Criteria andStatusEqualTo(Byte value) { - addCriterion("status =", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusNotEqualTo(Byte value) { - addCriterion("status <>", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusGreaterThan(Byte value) { - addCriterion("status >", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusGreaterThanOrEqualTo(Byte value) { - addCriterion("status >=", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusLessThan(Byte value) { - addCriterion("status <", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusLessThanOrEqualTo(Byte value) { - addCriterion("status <=", value, "status"); - return (Criteria) this; - } - - public Criteria andStatusIn(List values) { - addCriterion("status in", values, "status"); - return (Criteria) this; - } - - public Criteria andStatusNotIn(List values) { - addCriterion("status not in", values, "status"); - return (Criteria) this; - } - - public Criteria andStatusBetween(Byte value1, Byte value2) { - addCriterion("status between", value1, value2, "status"); - return (Criteria) this; - } - - public Criteria andStatusNotBetween(Byte value1, Byte value2) { - addCriterion("status not between", value1, value2, "status"); - return (Criteria) this; - } - - public Criteria andAddressIsNull() { - addCriterion("address is null"); - return (Criteria) this; - } - - public Criteria andAddressIsNotNull() { - addCriterion("address is not null"); - return (Criteria) this; - } - - public Criteria andAddressEqualTo(String value) { - addCriterion("address =", value, "address"); - return (Criteria) this; - } - - public Criteria andAddressNotEqualTo(String value) { - addCriterion("address <>", value, "address"); - return (Criteria) this; - } - - public Criteria andAddressGreaterThan(String value) { - addCriterion("address >", value, "address"); - return (Criteria) this; - } - - public Criteria andAddressGreaterThanOrEqualTo(String value) { - addCriterion("address >=", value, "address"); - return (Criteria) this; - } - - public Criteria andAddressLessThan(String value) { - addCriterion("address <", value, "address"); - return (Criteria) this; - } - - public Criteria andAddressLessThanOrEqualTo(String value) { - addCriterion("address <=", value, "address"); - return (Criteria) this; - } - - public Criteria andAddressLike(String value) { - addCriterion("address like", value, "address"); - return (Criteria) this; - } - - public Criteria andAddressNotLike(String value) { - addCriterion("address not like", value, "address"); - return (Criteria) this; - } - - public Criteria andAddressIn(List values) { - addCriterion("address in", values, "address"); - return (Criteria) this; - } - - public Criteria andAddressNotIn(List values) { - addCriterion("address not in", values, "address"); - return (Criteria) this; - } - - public Criteria andAddressBetween(String value1, String value2) { - addCriterion("address between", value1, value2, "address"); - return (Criteria) this; - } - - public Criteria andAddressNotBetween(String value1, String value2) { - addCriterion("address not between", value1, value2, "address"); - return (Criteria) this; - } - - public Criteria andUseTypeIsNull() { - addCriterion("use_type is null"); - return (Criteria) this; - } - - public Criteria andUseTypeIsNotNull() { - addCriterion("use_type is not null"); - return (Criteria) this; - } - - public Criteria andUseTypeEqualTo(Byte value) { - addCriterion("use_type =", value, "useType"); - return (Criteria) this; - } - - public Criteria andUseTypeNotEqualTo(Byte value) { - addCriterion("use_type <>", value, "useType"); - return (Criteria) this; - } - - public Criteria andUseTypeGreaterThan(Byte value) { - addCriterion("use_type >", value, "useType"); - return (Criteria) this; - } - - public Criteria andUseTypeGreaterThanOrEqualTo(Byte value) { - addCriterion("use_type >=", value, "useType"); - return (Criteria) this; - } - - public Criteria andUseTypeLessThan(Byte value) { - addCriterion("use_type <", value, "useType"); - return (Criteria) this; - } - - public Criteria andUseTypeLessThanOrEqualTo(Byte value) { - addCriterion("use_type <=", value, "useType"); - return (Criteria) this; - } - - public Criteria andUseTypeIn(List values) { - addCriterion("use_type in", values, "useType"); - return (Criteria) this; - } - - public Criteria andUseTypeNotIn(List values) { - addCriterion("use_type not in", values, "useType"); - return (Criteria) this; - } - - public Criteria andUseTypeBetween(Byte value1, Byte value2) { - addCriterion("use_type between", value1, value2, "useType"); - return (Criteria) this; - } - - public Criteria andUseTypeNotBetween(Byte value1, Byte value2) { - addCriterion("use_type not between", value1, value2, "useType"); - return (Criteria) this; - } - - public Criteria andCreateTimeIsNull() { - addCriterion("create_time is null"); - return (Criteria) this; - } - - public Criteria andCreateTimeIsNotNull() { - addCriterion("create_time is not null"); - return (Criteria) this; - } - - public Criteria andCreateTimeEqualTo(Date value) { - addCriterion("create_time =", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeNotEqualTo(Date value) { - addCriterion("create_time <>", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeGreaterThan(Date value) { - addCriterion("create_time >", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { - addCriterion("create_time >=", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeLessThan(Date value) { - addCriterion("create_time <", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeLessThanOrEqualTo(Date value) { - addCriterion("create_time <=", value, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeIn(List values) { - addCriterion("create_time in", values, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeNotIn(List values) { - addCriterion("create_time not in", values, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeBetween(Date value1, Date value2) { - addCriterion("create_time between", value1, value2, "createTime"); - return (Criteria) this; - } - - public Criteria andCreateTimeNotBetween(Date value1, Date value2) { - addCriterion("create_time not between", value1, value2, "createTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeIsNull() { - addCriterion("update_time is null"); - return (Criteria) this; - } - - public Criteria andUpdateTimeIsNotNull() { - addCriterion("update_time is not null"); - return (Criteria) this; - } - - public Criteria andUpdateTimeEqualTo(Date value) { - addCriterion("update_time =", value, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeNotEqualTo(Date value) { - addCriterion("update_time <>", value, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeGreaterThan(Date value) { - addCriterion("update_time >", value, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { - addCriterion("update_time >=", value, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeLessThan(Date value) { - addCriterion("update_time <", value, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { - addCriterion("update_time <=", value, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeIn(List values) { - addCriterion("update_time in", values, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeNotIn(List values) { - addCriterion("update_time not in", values, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeBetween(Date value1, Date value2) { - addCriterion("update_time between", value1, value2, "updateTime"); - return (Criteria) this; - } - - public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { - addCriterion("update_time not between", value1, value2, "updateTime"); - return (Criteria) this; - } - } - - public static class Criteria extends GeneratedCriteria { - - protected Criteria() { - super(); - } - } - - public static class Criterion { - private String condition; - - private Object value; - - private Object secondValue; - - private boolean noValue; - - private boolean singleValue; - - private boolean betweenValue; - - private boolean listValue; - - private String typeHandler; - - public String getCondition() { - return condition; - } - - public Object getValue() { - return value; - } - - public Object getSecondValue() { - return secondValue; - } - - public boolean isNoValue() { - return noValue; - } - - public boolean isSingleValue() { - return singleValue; - } - - public boolean isBetweenValue() { - return betweenValue; - } - - public boolean isListValue() { - return listValue; - } - - public String getTypeHandler() { - return typeHandler; - } - - protected Criterion(String condition) { - super(); - this.condition = condition; - this.typeHandler = null; - this.noValue = true; - } - - protected Criterion(String condition, Object value, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.typeHandler = typeHandler; - if (value instanceof List) { - this.listValue = true; - } else { - this.singleValue = true; - } - } - - protected Criterion(String condition, Object value) { - this(condition, value, null); - } - - protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { - super(); - this.condition = condition; - this.value = value; - this.secondValue = secondValue; - this.typeHandler = typeHandler; - this.betweenValue = true; - } - - protected Criterion(String condition, Object value, Object secondValue) { - this(condition, value, secondValue, null); - } - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/model/ExpressionParam.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/model/ExpressionParam.java deleted file mode 100644 index 3c20f2a..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/model/ExpressionParam.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baoying.enginex.executor.common.model; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -//表达式的参数实体类 -@Data -@AllArgsConstructor -@NoArgsConstructor -public class ExpressionParam { - private String fieldEn;//表达式中key字段en - private String operator;//表达式的操作符 - private Integer variableType;//表达式中value类型,1常量 2变量,3自定义 - private String fieldValue;//表达式中对应常量value值或者变量key - private String executionLogic;//执行逻辑 - private Integer conditionType;//规则节点的类型:1-关系节点,2-表达式节点 -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/session/SessionData.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/session/SessionData.java deleted file mode 100644 index 89163d5..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/session/SessionData.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baoying.enginex.executor.common.session; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; - -@Data -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = false) -public class SessionData { - - private Long organId; // 组织id - private Long engineId; // 引擎id - private Integer reqType;//请求类型 -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/session/SessionManager.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/session/SessionManager.java deleted file mode 100644 index 5040ea1..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/common/session/SessionManager.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.baoying.enginex.executor.common.session; - -import com.alibaba.ttl.TransmittableThreadLocal; - -/** - * session管理类 - */ -public class SessionManager { - private static TransmittableThreadLocal session = new TransmittableThreadLocal() { - - }; - - public static SessionData getSession() { - return session.get(); - } - - public static void setSession(SessionData conn) { - session.set(conn); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/config/ConfigHolder.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/config/ConfigHolder.java deleted file mode 100644 index 1e482d2..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/config/ConfigHolder.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.baoying.enginex.executor.config; - -import lombok.Data; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Configuration; - -@Configuration -@Data -public class ConfigHolder { - - //redisConfig - @Value("${redis.host}") - private String redisHost; - @Value("${redis.port}") - private int redisPort; - @Value("${redis.db}") - private int redisDb; - @Value("${redis.password}") - private String redisPwd; - @Value("${redis.pool.maxTotal}") - private int redisMaxTotal; - @Value("${redis.pool.maxIdle}") - private int redisMaxIdle; - @Value("${redis.pool.maxWait}") - private int redisMaxWait; - @Value("${redis.pool.timeout}") - private int redisTimeout; - - // 业务逻辑是否使用缓存 - @Value("${switch.use.cache}") - private String cacheSwitch; - // canal缓存同步是否开启 - @Value("${switch.canal.cache}") - private String canalCacheSwitch; - // canal主机地址 - @Value("${canal.hostname}") - private String canalHostName; - // canal端口 - @Value("${canal.port}") - private int canalPort; - - //jdbcConfig - /*@Value("${jdbc.url}") - private String jdbcUrl; - @Value("${jdbc.driver}") - private String DriverName; - @Value("${pool.maxPoolSize}") - private int maxPoolSize; - @Value("${jdbc.username}") - private String jdbcUserName; - @Value("${jdbc.password}") - private String jdbcPwd; - @Value("${pool.maxWait}") - private int jdbcMaxWait; - @Value("${pool.timeBetweenEvictionRunsMillis}") - private int timeBetweenEvictionRunsMillis; - @Value("${pool.minEvictableIdleTimeMillis}") - private int minEvictableIdleTimeMillis; - @Value("${pool.validationQuery}") - private String validationQuery; - - //rabbitconfig - @Value("${rabbitMQ.host}") - private String rabbitHost; - @Value("${rabbitMQ.port}") - private int rabbitPort; - @Value("${rabbitMQ.username}") - private String rabbitUsername; - @Value("${rabbitMQ.password}") - private String rabbitPassword;*/ - -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/config/ConfigurationContainor.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/config/ConfigurationContainor.java deleted file mode 100644 index 54c1e29..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/config/ConfigurationContainor.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.baoying.enginex.executor.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; -import redis.clients.jedis.JedisPool; -import redis.clients.jedis.JedisPoolConfig; - -import javax.annotation.Resource; -import java.util.concurrent.ThreadPoolExecutor; - -@Configuration -public class ConfigurationContainor { - - @Resource - private ConfigHolder configHolder; - - @Bean(name = "threadPoolTaskExecutor") - ThreadPoolTaskExecutor threadPoolTaskExecutor(){ - ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); - executor.setCorePoolSize(2000); - executor.setMaxPoolSize(10000); - executor.setQueueCapacity(100000); - executor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy()); - return executor; - } - - @Bean(name = "jedisPool") - public JedisPool jedisPool(){ - JedisPoolConfig config = new JedisPoolConfig(); - config.setMaxTotal(configHolder.getRedisMaxTotal()); - config.setMaxIdle(configHolder.getRedisMaxIdle()); - config.setMaxWaitMillis(configHolder.getRedisMaxWait()); - config.setTestOnBorrow(true); -// config.setTestOnReturn(true); - - JedisPool pool = new JedisPool(config, - configHolder.getRedisHost(), - configHolder.getRedisPort(), - configHolder.getRedisTimeout(), - configHolder.getRedisPwd(), - configHolder.getRedisDb()); - return pool; - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/config/DataSourceConfig.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/config/DataSourceConfig.java deleted file mode 100644 index af53c49..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/config/DataSourceConfig.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.baoying.enginex.executor.config; - -import com.alibaba.druid.pool.DruidDataSource; -import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean; -import org.apache.ibatis.session.SqlSessionFactory; -import org.mybatis.spring.SqlSessionTemplate; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.io.Resource; -import org.springframework.core.io.support.PathMatchingResourcePatternResolver; -import org.springframework.core.io.support.ResourcePatternResolver; - -import javax.sql.DataSource; - - -@Configuration -public class DataSourceConfig { - @Value("${spring.datasource.default.url}") - private String defaultDBUrl; - @Value("${spring.datasource.default.username}") - private String defaultDBUser; - @Value("${spring.datasource.default.password}") - private String defaultDBPassword; - @Value("${spring.datasource.default.driver-class-name}") - private String defaultDBDreiverName; - - @Bean - public DruidDataSource druidDataSource(){ - DruidDataSource defaultDataSource = new DruidDataSource(); - defaultDataSource.setUrl(defaultDBUrl); - defaultDataSource.setUsername(defaultDBUser); - defaultDataSource.setPassword(defaultDBPassword); - defaultDataSource.setDriverClassName(defaultDBDreiverName); - - return defaultDataSource; - } - - @Bean - public SqlSessionFactory sqlSessionFactory( - @Qualifier("druidDataSource") DataSource druidDataSource) - throws Exception { - MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean(); - ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); - Resource[] mapperXmlResource = resolver.getResources("classpath*:com/baoying/enginex/executor/*/mapper/*Mapper.xml"); - bean.setDataSource(druidDataSource); - bean.setMapperLocations(mapperXmlResource); - bean.setTypeAliasesPackage("com.baoying.enginex.executor.**.model"); - bean.getObject().getConfiguration().setMapUnderscoreToCamelCase(true); - bean.getObject().getConfiguration().setCacheEnabled(false); - return bean.getObject(); - } - - @Bean(name = "sqlSessionTemplate") - public SqlSessionTemplate sqlSessionTemplate( - @Qualifier("sqlSessionFactory") SqlSessionFactory sqlSessionFactory) - throws Exception { - return new SqlSessionTemplate(sqlSessionFactory); - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/config/RestTemplateConfig.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/config/RestTemplateConfig.java deleted file mode 100644 index 00dfa2a..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/config/RestTemplateConfig.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.baoying.enginex.executor.config; - -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.task.SimpleAsyncTaskExecutor; -import org.springframework.http.client.AsyncClientHttpRequestFactory; -import org.springframework.http.client.ClientHttpRequestFactory; -import org.springframework.http.client.SimpleClientHttpRequestFactory; -import org.springframework.web.client.AsyncRestTemplate; -import org.springframework.web.client.RestTemplate; - -/** - * RestTemplate配置 - */ -@Configuration -public class RestTemplateConfig { - - @Bean - public RestTemplate restTemplate(@Qualifier("clientHttpRequestFactory") ClientHttpRequestFactory factory){ - return new RestTemplate(factory); - } - - @Bean - public AsyncRestTemplate asyncRestTemplate(@Qualifier("asyncClientHttpRequestFactory") AsyncClientHttpRequestFactory factory){ - return new AsyncRestTemplate(factory); - } - - @Bean - public ClientHttpRequestFactory clientHttpRequestFactory(){ - // 创建一个 httpCilent 简单工厂 - SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); - // 设置连接超时 - factory.setConnectTimeout(15000); - // 设置读取超时 - factory.setReadTimeout(5000); - return factory; - } - - @Bean - public AsyncClientHttpRequestFactory asyncClientHttpRequestFactory(){ - // 创建一个 httpCilent 简单工厂 - SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); - // 设置连接超时 -// factory.setConnectTimeout(15000); - // 设置读取超时 -// factory.setReadTimeout(5000); - //设置异步任务(线程不会重用,每次调用时都会重新启动一个新的线程) - factory.setTaskExecutor(new SimpleAsyncTaskExecutor()); - return factory; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/FieldMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/FieldMapper.java deleted file mode 100644 index 26afa10..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/FieldMapper.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.baoying.enginex.executor.datamanage.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baoying.enginex.executor.datamanage.model.Field; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.List; -import java.util.Map; - -@Mapper -public interface FieldMapper extends BaseMapper { - - /** - * findFieldByIds:(找出一批字段id对应的字段列表).
- * @author caowenyu - * @param paramMap 参数集合 - * @return 字段列表 - */ - public List findFieldByIdsbyorganId(Map paramMap); - - /** - * findByFieldEn:(根据引擎和字段英文名找出引擎所用字段对象).
- * @author yuanlinfeng - * @param paramMap 参数集合 - * @return 字段对象 - */ - public Field findByFieldEnbyorganId(Map paramMap); - - /** - * findByFieldCn:(根据字段中文名找出字段对象).
- * @author yuanlinfeng - * @param paramMap 参数集合 - * @return 字段对象 - */ - public Field findByFieldCnbyorganId(Map paramMap); - - /** - * findByFieldCn:(按中文名查找通用字段).
- * @author yuanlinfeng - * @param paramMap 参数集合 - * @return 字段对象 - */ - public Field findByFieldCnNoEngineIdbyorganId(Map paramMap); - - /** - * findByFieldId:(根据字段Id查找字段对象).
- * @author caowenyu - * @param paramMap 参数集合 - * @return 字段对象 - */ - public Field findByFieldIdbyorganId(Map paramMap); - - List selectFieldListByIds(@Param("ids") List ids); - - List selectFieldListByEns(@Param("ens")List ens); -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/FieldMapper.xml b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/FieldMapper.xml deleted file mode 100644 index c3007df..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/FieldMapper.xml +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/FieldTypeMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/FieldTypeMapper.java deleted file mode 100644 index c944126..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/FieldTypeMapper.java +++ /dev/null @@ -1,128 +0,0 @@ - - -package com.baoying.enginex.executor.datamanage.mapper; - - -import com.baoying.enginex.executor.common.mapper.BaseMapper; -import com.baoying.enginex.executor.datamanage.model.FieldType; - -import java.util.List; -import java.util.Map; - -public interface FieldTypeMapper extends BaseMapper { - - /** - * getFieldTypeList:(查找用户的字段类型列表).
- * @author yuanlinfeng - * @param paramMap 参数集合 - * @return 字段类型列表 - */ - public List getFieldTypeList(Map paramMap); - - /** - * getSubFieldTypeList:(根据传入的字段父类型查找子类型列表).
- * @author yuanlinfeng - * @param paramMap 参数集合 - * @return 字段类型列表 - */ - public List getSubFieldTypeList(Map paramMap); - - /** - * findFieldTypeById:(根据传入的字段类型ID查找字段类型名).
- * @author yuanlinfeng - * @param paramMap 参数集合 - * @return 字段类型列表 - */ - public FieldType findFieldTypeById(Map paramMap); - - /** - * findTypeIdByParentId:(根据传入的字段类型父ID查找子类型ID).
- * @author yuanlinfeng - * @param paramMap 参数集合 - * @return 子字段类型ID - */ - public String findTypeIdByParentId(Map paramMap); - - /** - * findTypeIdByParentId:(根据传入的字段类型类型ID查找父ID).
- * @author yuanlinfeng - * @param paramMap 参数集合 - * @return 子字段类型ID - */ - public String findParentIdByTypeId(Map paramMap); - - /** - * findFieldType:(查找用户可用的字段类型列表,通用组织所有,引擎只有自定义).
- * @author yuanlinfeng - * @param paramMap 参数集合 - * @return 字段类型列表 - */ - public List findFieldType(Map paramMap); - - /** - * createFieldType:(新增字段类型).
- * @author yuanlinfeng - * @param fieldTypeVo 字段类型实体类 - * @return 插入成功 - */ - public boolean createFieldType(FieldType fieldTypeVo); - - /** - * findIdByFieldType:(新增字段类型).
- * @author yuanlinfeng - * @param paramMap paramMap - * @return 字段类型编号 - */ - public long findIdByFieldType(Map paramMap); - - /** - * updateFieldType:(更新字段类型名).
- * @author yuanlinfeng - * @param paramMap 参数集合 - * @return 更新成功 - */ - public boolean updateFieldType(Map paramMap); - - /** - * updateFieldTypeByTypeIds:(更新字段类型为删除状态(-1)).
- * @author yuanlinfeng - * @param paramMap 参数集合 - * @return 更新成功 - */ - public boolean updateFieldTypeByTypeIds(Map paramMap); - - /** - * deleteFieldTypeByTypeIds:(删除字段类型下没有字段的空节点)).
- * @author yuanlinfeng - * @param paramMap 参数集合 - * @return 更新成功 - */ - public boolean deleteFieldTypeByTypeIds(Map paramMap); - - /** - * backFieldTypeByTypeIds:(更新字段类型状态为启用状态(1)).
- * @author yuanlinfeng - * @param paramMap 参数集合 - * @return 更新成功 - */ - public boolean backFieldTypeByTypeIds(Map paramMap); - - /** - * isExists:(查找字段名是否存在).
- * @author yuanlinfeng - * @param paramMap 参数集合 - * @return 存在的记录条数 - */ - public int isExists(Map paramMap); - - - /** - * isExistsDefaultTreeName:(查找默认节点名是否存在).
- * @author yuanlinfeng - * @param paramMap 参数集合 - * @return 存在的记录条数 - */ - public int isExistsDefaultTreeName(Map paramMap); - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/FieldTypeMapper.xml b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/FieldTypeMapper.xml deleted file mode 100644 index ca38dc0..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/FieldTypeMapper.xml +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - insert into t_field_type ( field_type, parent_id, is_common ) - values ( #{fieldType}, #{parentId}, #{isCommon} ) - - - - update t_field_type - set field_type = #{fieldType} - where id = (select field_typeid - from t_field_type_user_rel - where organ_id = ( select organ_id from t_user where user_id = #{userId} ) - - and engine_id = #{engineId} - - - and engine_id is null - - and field_typeid = #{id} - ) - - - - update t_field_type_user_rel - set status = -1 - where organ_id = ( select organ_id from t_user where user_id = #{userId} ) - and engine_id = #{engineId} - and field_typeid in - - #{item} - - and status = 1 - - - - delete from t_field_type_user_rel - where organ_id = ( select organ_id from t_user where user_id = #{userId} ) - and engine_id = #{engineId} - and field_typeid in - - #{item} - - and field_typeid not in - ( select field_typeid - from t_field f,t_field_user_rel r - where f.id = r.field_id - and f.field_typeid in - - #{item} - - ) - - - - update t_field_type_user_rel - set status = 1 - where organ_id = ( select organ_id from t_user where user_id = #{userId} ) - and engine_id = #{engineId} - and field_typeid in - - #{item} - - and status = -1 - - - - - - - \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/FieldTypeUserMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/FieldTypeUserMapper.java deleted file mode 100644 index 3487ced..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/FieldTypeUserMapper.java +++ /dev/null @@ -1,54 +0,0 @@ - - -package com.baoying.enginex.executor.datamanage.mapper; - - -import com.baoying.enginex.executor.common.mapper.BaseMapper; -import com.baoying.enginex.executor.datamanage.model.FieldTypeUser; - -import java.util.Map; - -public interface FieldTypeUserMapper extends BaseMapper { - - /** - * createFieldTypeUserRel:(新增字段类型).
- * @author yuanlinfeng - * @param paramMap 参数集合 - * @return 插入成功 - */ - public boolean createFieldTypeUserRel(Map paramMap); - - /** - * batchBindEngineFieldTypeUserRel:(把一批通用字段类型id中不存在的类型id批量绑定到引擎).
- * @author yuanlinfeng - * @param paramMap 参数集合 - * @return 插入成功 - */ - public boolean batchBindEngineFieldTypeUserRel(Map paramMap); - - /** - * deleteFieldTypeUserRel:(取消字段类型).
- * @author yuanlinfeng - * @param paramMap 参数集合 - * @return 删除成功 - */ - public boolean deleteFieldTypeUserRel(Map paramMap); - - /** - * updateFieldTypeUserRel:(更新字段类型名).
- * @author yuanlinfeng - * @param paramMap 参数集合 - * @return 更新成功 - */ - public boolean updateFieldTypeUserRel(Map paramMap); - - /** - * findNodeIds:(查找引擎在用的节点集合).
- * @author yuanlinfeng - * @param paramMap 参数集合 - * @return - */ - public String findNodeIds(Map paramMap); - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/FieldTypeUserMapper.xml b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/FieldTypeUserMapper.xml deleted file mode 100644 index d37e5d7..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/FieldTypeUserMapper.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - insert into t_field_type_user_rel ( field_typeid, organ_id, engine_id, user_id, created ) - values ( #{fieldTypeId}, #{organId}, #{engineId}, #{userId}, now() ) - - - - insert into t_field_type_user_rel ( field_typeid, organ_id, engine_id, user_id, created ) - select field_typeid, organ_id, #{engineId}, #{userId}, now() - from t_field_type_user_rel r - where r.field_typeid in - - #{item} - - and field_typeid not in ( select field_typeid from t_field_type_user_rel where engine_id = #{engineId}) - and engine_id is null - - - - - - delete from t_field_type_user_rel - where - organ_id = ( select organ_id from t_user where user_id = #{userId} ) - - and engine_id = #{engineId} - - - and engine_id is null - - and field_typeid = #{fieldTypeId} - - - - update t_field_type_user_rel - set user_id = #{userId}, created = now() - where organ_id = ( select organ_id from t_user where user_id = #{userId} ) - - and engine_id = #{engineId} - - - and engine_id is null - - and field_typeid = #{id} - - - \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/FieldUserMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/FieldUserMapper.java deleted file mode 100644 index b95260b..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/FieldUserMapper.java +++ /dev/null @@ -1,77 +0,0 @@ - - -package com.baoying.enginex.executor.datamanage.mapper; - - -import com.baoying.enginex.executor.common.mapper.BaseMapper; -import com.baoying.enginex.executor.datamanage.model.FieldUser; - -import java.util.Map; - -public interface FieldUserMapper extends BaseMapper { - - /** - * createFieldUserRel:(绑定字段和用户关系).
- * @author yuanlinfeng - * @param fieldUser 用户字段实体类 - * @return 插入成功 - * */ - public boolean createFieldUserRel(FieldUser fieldUserVo); - - /** - * batchCreateFieldUserRel:(批量导入字段信息后批量绑定字段和用户关系).
- * @author yuanlinfeng - * @param paramMap 参数集合 - * @return 插入成功 - * */ - public boolean batchCreateFieldUserRel(Map paramMap); - - /** - * batchBindEngineFieldUserRel:(把一批通用字段id中未绑定的字段id批量绑定到引擎).
- * @author yuanlinfeng - * @param paramMap 参数集合 - * @return 插入成功 - * */ - public boolean batchBindEngineFieldUserRel(Map paramMap); - - /** - * batchCreateEngineFieldUserRel:(把id、英文名、中文名不重复的组织字段批量绑定到引擎).
- * @author yuanlinfeng - * @param paramMap 参数集合 - * @return 插入成功 - * */ - public boolean batchCreateEngineFieldUserRel(Map paramMap); - - /** - * updateFieldUserRel:(更新字段).
- * @author yuanlinfeng - * @param paramMap 参数集合 - * @return 更新成功 - * */ - public boolean updateFieldUserRel(Map paramMap); - - /** - * updateStatus:(单个或批量更新用户字段关系).
- * @author yuanlinfeng - * @param paramMap 参数集合 - * @return 更新成功 - * */ - public boolean updateStatus(Map paramMap); - - /** - * deleteFieldByIds:(批量修改字段启用状态为删除状态(-1)).
- * @author yuanlinfeng - * @param paramMap 参数集合 - * @return 更新是否成功 - */ - public boolean deleteFieldByIds(Map paramMap); - - /** - * deleteFieldByIds:(批量修改字段删除状态为启用状态(1)).
- * @author yuanlinfeng - * @param paramMap 参数集合 - * @return 更新是否成功 - */ - public boolean backFieldByIds(Map paramMap); - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/FieldUserMapper.xml b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/FieldUserMapper.xml deleted file mode 100644 index 0a982d9..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/FieldUserMapper.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - insert into t_field_user_rel (field_id, organ_id, engine_id, user_id, status, created, updated) - values (#{fieldId}, #{organId}, #{engineId}, #{userId}, #{status}, now(), now()) - - - - insert into t_field_user_rel (field_id, organ_id, engine_id, user_id, status, created, updated) - select id, #{organId}, #{engineId}, #{userId}, #{status}, now(), now() - from t_field t - where t.author = #{author} - and not exists ( select r.field_id from t_field_user_rel r where t.id = r.field_id ) - - - - insert into t_field_user_rel (field_id, organ_id, engine_id, user_id, status, created, updated) - select id, #{organId}, #{engineId}, #{userId}, #{status}, now(), now() - from t_field f - where f.field_typeid in - - #{item} - - and not exists ( select 1 - from ( select f.id,f.field_en,f.field_cn - from t_field f,t_field_user_rel fu - where f.id = fu.field_id - and fu.organ_id = ( select organ_id from t_user where user_id = #{userId} ) - and fu.engine_id = ${engineId} )y - where f.field_en = y.field_en or f.field_cn = y.field_cn or f.id = y.id - ) - - - - insert into t_field_user_rel (field_id, organ_id, engine_id, user_id, status, created, updated) - select id, #{organId}, #{engineId}, #{userId}, 1, now(), now() - from t_field f - where f.id in - - #{item} - - and not exists ( select 1 - from ( select f.id,f.field_en,f.field_cn - from t_field f,t_field_user_rel fu - where f.id = fu.field_id - and fu.organ_id = ( select organ_id from t_user where user_id = #{userId} ) - and fu.engine_id = ${engineId} )y - where f.field_en = y.field_en or f.field_cn = y.field_cn or f.id = y.id - ) - - - - update t_field_user_rel - set user_id = #{userId} , updated = now() - where organ_id = ( select organ_id from t_user where user_id = #{userId} ) - - and engine_id = #{engineId} - - - and engine_id is null - - and field_id = #{Id} - - - - update t_field_user_rel - set status=#{status} - where organ_id = ( select organ_id from t_user where user_id = #{userId} ) - - and engine_id = #{engineId} - - - and engine_id is null - - and field_id in - - #{item} - - - - - update t_field_user_rel - set status = -1 - where organ_id = ( select organ_id from t_user where user_id = #{userId} ) - and engine_id = #{engineId} - and field_id in - - #{item} - - and status = 1 - - - - update t_field_user_rel - set status = 1 - where organ_id = ( select organ_id from t_user where user_id = #{userId} ) - and engine_id = #{engineId} - and field_id in - - #{item} - - and status = -1 - - - \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/SimpleMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/SimpleMapper.java deleted file mode 100644 index a168cfe..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/SimpleMapper.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.baoying.enginex.executor.datamanage.mapper; - -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -public interface SimpleMapper { - - List> customSelect(Map paramsMap); - List> test(Map paramsMap); -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/SimpleMapper.xml b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/SimpleMapper.xml deleted file mode 100644 index 9882a70..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/mapper/SimpleMapper.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/model/CustList.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/model/CustList.java deleted file mode 100644 index d70b691..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/model/CustList.java +++ /dev/null @@ -1,236 +0,0 @@ -package com.baoying.enginex.executor.datamanage.model; - -import com.baoying.enginex.executor.common.model.BasePage; - -import java.io.Serializable; -import java.util.Date; - -public class CustList extends BasePage implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 主键 - * */ - private Long id; - - /** - * 以下20个t开头为匿名字段 - * */ - private String t0; - private String t1; - private String t2; - private String t3; - private String t4; - private String t5; - private String t6; - private String t7; - private String t8; - private String t9; - private String t10; - private String t11; - private String t12; - private String t13; - private String t14; - private String t15; - private String t16; - private String t17; - private String t18; - private String t19; - - /** - * 创建人编号 - * */ - private Long userId; - - /** - * 创建人昵称 - * */ - private String nickName; - - /** - * 创建时间 - * */ - private Date created; - - /** - * 检索客户信息是否存在的定制条件 - */ - private String checkCol; - - /** - * 检索名单库的表名称 - */ - private String tableName; - - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - public String getT0() { - return t0; - } - public void setT0(String t0) { - this.t0 = t0; - } - public String getT1() { - return t1; - } - public void setT1(String t1) { - this.t1 = t1; - } - public String getT2() { - return t2; - } - public void setT2(String t2) { - this.t2 = t2; - } - public String getT3() { - return t3; - } - public void setT3(String t3) { - this.t3 = t3; - } - public String getT4() { - return t4; - } - public void setT4(String t4) { - this.t4 = t4; - } - public String getT5() { - return t5; - } - public void setT5(String t5) { - this.t5 = t5; - } - public String getT6() { - return t6; - } - public void setT6(String t6) { - this.t6 = t6; - } - public String getT7() { - return t7; - } - public void setT7(String t7) { - this.t7 = t7; - } - public String getT8() { - return t8; - } - public void setT8(String t8) { - this.t8 = t8; - } - public String getT9() { - return t9; - } - public void setT9(String t9) { - this.t9 = t9; - } - public String getT10() { - return t10; - } - public void setT10(String t10) { - this.t10 = t10; - } - public String getT11() { - return t11; - } - public void setT11(String t11) { - this.t11 = t11; - } - public String getT12() { - return t12; - } - public void setT12(String t12) { - this.t12 = t12; - } - public String getT13() { - return t13; - } - public void setT13(String t13) { - this.t13 = t13; - } - public String getT14() { - return t14; - } - public void setT14(String t14) { - this.t14 = t14; - } - public String getT15() { - return t15; - } - public void setT15(String t15) { - this.t15 = t15; - } - public String getT16() { - return t16; - } - public void setT16(String t16) { - this.t16 = t16; - } - public String getT17() { - return t17; - } - public void setT17(String t17) { - this.t17 = t17; - } - public String getT18() { - return t18; - } - public void setT18(String t18) { - this.t18 = t18; - } - public String getT19() { - return t19; - } - public void setT19(String t19) { - this.t19 = t19; - } - public Long getUserId() { - return userId; - } - public void setUserId(Long userId) { - this.userId = userId; - } - public Date getCreated() { - return created; - } - public void setCreated(Date created) { - this.created = created; - } - public String getNickName() { - return nickName; - } - public void setNickName(String nickName) { - this.nickName = nickName; - } - public String getCheckCol() { - return checkCol; - } - public void setCheckCol(String checkCol) { - this.checkCol = checkCol; - } - public String getTableName() { - return tableName; - } - public void setTableName(String tableName) { - this.tableName = tableName; - } - @Override - public String toString() { - return "CustList [id=" + id + ", t0=" + t0 + ", t1=" + t1 + ", t2=" + t2 - + ", t3=" + t3 + ", t4=" + t4 + ", t5=" + t5 + ", t6=" + t6 - + ", t7=" + t7 + ", t8=" + t8 + ", t9=" + t9 + ", t10=" + t10 - + ", t11=" + t11 + ", t12=" + t12 + ", t13=" + t13 + ", t14=" - + t14 + ", t15=" + t15 + ", t16=" + t16 + ", t17=" + t17 - + ", t18=" + t18 + ", t19=" + t19 + ", userId=" + userId - + ", nickName=" + nickName + ", created=" + created - + ", checkCol=" + checkCol + ", tableName=" + tableName + "]"; - } - - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/model/Field.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/model/Field.java deleted file mode 100644 index bf68b24..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/model/Field.java +++ /dev/null @@ -1,203 +0,0 @@ -package com.baoying.enginex.executor.datamanage.model; - -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; - -import java.io.Serializable; -import java.util.Date; -import java.util.List; - -@Data -@TableName("t_field") -public class Field implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 主键 - * */ - private Long id; - - /** - * 字段英文名 - * */ - private String fieldEn; - - /** - * 字段中文名 - * */ - private String fieldCn; - - /** - * 字段类型编号 - * */ - @TableField("field_typeid") - private Long fieldTypeId; - - /** - * 字段类型名 - * */ - @TableField(exist = false) - private String fieldType; - - /** - * 字段存值类型 - * */ - private Integer valueType; - - /** - * 字段存值类型中文 - * */ - @TableField(exist = false) - private String valueTypeName; - - /** - * 字段约束范围 - * */ - private String valueScope; - - /** - * 是否衍生字段 - * */ - private Integer isDerivative; - - /** - * 是否衍生字段 - * */ - @TableField(exist = false) - private String isDerivativeName; - - /** - * 是否输出字段 - * */ - private Integer isOutput; - - /** - * 是否输出字段 - * */ - @TableField(exist = false) - private String isOutputName; - - /** - * 是否组织定义的通用字段 - * */ - private Integer isCommon; - - /** - * 衍生字段公式 - * */ - private String formula; - - /** - * 衍生字段公式回显信息 - * */ - private String formulaShow; - - /** - * 衍生字段引用的字段id - * */ - @TableField("used_fieldid") - private String usedFieldId; - - /** - * 衍生字段引用的原生字段id - * */ - @TableField("orig_fieldid") - private String origFieldId; - - /** - * 创建人 - * */ - private Long author; - - /** - * 创建人昵称 - * */ - @TableField(exist = false) - private String nickName; - - /** - * 创建时间 - * */ - private Date created; - - /** - * 归属的引擎ID - * */ - @TableField(exist = false) - private Long engineId; - - /** - * 归属的引擎名称 - * */ - @TableField(exist = false) - private String engineName; - - /** - * 字段状态(启用、停用、删除、未知) - * */ - @TableField(exist = false) - private String status; - - /** - * 字段条件设置集合 - * */ - @TableField(exist = false) - private List fieldCondList; - - /** - * 字段用户关系编号 - * */ - @TableField(exist = false) - private Long fieldRelId; - - /** - * 是否使用sql获取指标 - */ - private Boolean isUseSql; - - /** - * 使用sql获取指标时对应的数据源 - */ - private Integer dataSourceId; - - /** - * 使用sql获取指标时对应的sql语句 - */ - private String sqlStatement; - - /** - * sql变量配置 - */ - private String sqlVariable; - - /** - * 是否使用接口 - */ - private Boolean isInterface; - - /** - * 接口id - */ - private Integer interfaceId; - - /** - * 接口解析指标 - */ - private String interfaceParseField; - - /** - * json类型对应的json值 - */ - private String jsonValue; - /** - * 字典变量例如 日期:date - */ - private String dictVariable; - - /** - * 该字段归属的组织编号 - * */ - private Long organId; -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/model/FieldCond.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/model/FieldCond.java deleted file mode 100644 index ba07b14..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/model/FieldCond.java +++ /dev/null @@ -1,142 +0,0 @@ -package com.baoying.enginex.executor.datamanage.model; - - -import com.baoying.enginex.executor.common.model.BasePage; -import com.baoying.enginex.executor.datamanage.vo.FieldSubCondVo; - -import java.io.Serializable; -import java.util.Date; -import java.util.List; - -public class FieldCond extends BasePage implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 条件编号 - * */ - private Long id; - - /** - * 字段编号 - * */ - private Long fieldId; - - /** - * 字段条件值 - * */ - private String conditionValue; - - /** - * 字段条件区域设置json格式 - * */ - private String content; - - /** - * 条件字段编号 - * */ - private Long condFieldId; - - /** - * 条件字段的运算符 - * */ - private String condFieldOperator; - - /** - * 条件字段的条件设置值 - * */ - private String condFieldValue; - - /** - * 条件字段间的逻辑符 - * */ - private String condFieldLogical; - - /** - * 创建时间 - * */ - private Date created; - - private List fieldSubCond; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public Long getFieldId() { - return fieldId; - } - - public void setFieldId(Long fieldId) { - this.fieldId = fieldId; - } - - public String getConditionValue() { - return conditionValue; - } - - public void setConditionValue(String conditionValue) { - this.conditionValue = conditionValue; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public Date getCreated() { - return created; - } - - public void setCreated(Date created) { - this.created = created; - } - - public Long getCondFieldId() { - return condFieldId; - } - - public void setCondFieldId(Long condFieldId) { - this.condFieldId = condFieldId; - } - - public String getCondFieldOperator() { - return condFieldOperator; - } - - public void setCondFieldOperator(String condFieldOperator) { - this.condFieldOperator = condFieldOperator; - } - - public String getCondFieldValue() { - return condFieldValue; - } - - public void setCondFieldValue(String condFieldValue) { - this.condFieldValue = condFieldValue; - } - - public String getCondFieldLogical() { - return condFieldLogical; - } - - public void setCondFieldLogical(String condFieldLogical) { - this.condFieldLogical = condFieldLogical; - } - - public List getFieldSubCond() { - return fieldSubCond; - } - - public void setFieldSubCond(List fieldSubCond) { - this.fieldSubCond = fieldSubCond; - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/model/FieldInter.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/model/FieldInter.java deleted file mode 100644 index 2ce413c..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/model/FieldInter.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.baoying.enginex.executor.datamanage.model; - - -import com.baoying.enginex.executor.common.model.BasePage; - -import java.io.Serializable; - -public class FieldInter extends BasePage implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 主键 - * */ - private Integer id; - - /** - * 衍生字段编号 - * */ - private Integer fieldRelId; - - /** - * 公式引用的字段编号 - * */ - private Integer interFieldId; - - /** - * 公式引用的字段用户关系编号 - * */ - private Integer interFieldRelId; - - /** - * 同名字段的顺序 - * */ - private Integer seq; - - /** - * 字段值区间划分 - * */ - private String interval; - - /** - * 对应区间的值定义 - * */ - private String value; - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public Integer getFieldRelId() { - return fieldRelId; - } - - public void setFieldRelId(Integer fieldRelId) { - this.fieldRelId = fieldRelId; - } - - public Integer getInterFieldId() { - return interFieldId; - } - - public void setInterFieldId(Integer interFieldId) { - this.interFieldId = interFieldId; - } - - public Integer getInterFieldRelId() { - return interFieldRelId; - } - - public void setInterFieldRelId(Integer interFieldRelId) { - this.interFieldRelId = interFieldRelId; - } - - public Integer getSeq() { - return seq; - } - - public void setSeq(Integer seq) { - this.seq = seq; - } - - public String getInterval() { - return interval; - } - - public void setInterval(String interval) { - this.interval = interval; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - -} - diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/model/FieldType.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/model/FieldType.java deleted file mode 100644 index 1b62fd5..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/model/FieldType.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.baoying.enginex.executor.datamanage.model; - - -import com.baoying.enginex.executor.common.model.BasePage; - -import java.io.Serializable; - -public class FieldType extends BasePage implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 主键 - * */ - private Integer id; - - /** - * 字段类型名 - * */ - private String fieldType; - - /** - * 父节点编号 - * */ - private Integer parentId; - - /** - * 是否组织定义的通用字段类型 - * */ - private Integer isCommon; - - /** - * 字段类型的子类集合 - * */ - private FieldType[] children; - - /** - * 是否为父类 - * */ - private String isParent = "true"; - - /** - * 引擎编号 - * */ - private Integer engineId; - - /** - *文件夹图片路径 - * */ - private String icon; - - public Integer getId() { - return id; - } - public void setId(Integer id) { - this.id = id; - } - public String getFieldType() { - return fieldType; - } - public void setFieldType(String fieldType) { - this.fieldType = fieldType; - } - public Integer getParentId() { - return parentId; - } - public void setParentId(Integer parentId) { - this.parentId = parentId; - } - public Integer getIsCommon() { - return isCommon; - } - public void setIsCommon(Integer isCommon) { - this.isCommon = isCommon; - } - public FieldType[] getChildren() { - return children; - } - public void setChildren(FieldType[] children) { - this.children = children; - } - public String getIsParent() { - return isParent; - } - public void setIsParent(String isParent) { - this.isParent = isParent; - } - public Integer getEngineId() { - return engineId; - } - public void setEngineId(Integer engineId) { - this.engineId = engineId; - } - public String getIcon() { -// if(engineId!=null) -// icon = "../../resource/images/authority/folder.png"; -// else - icon = "../resource/images/authority/folder.png"; - return icon; - } - public void setIcon(String icon) { - this.icon = icon; - } - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/model/FieldTypeUser.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/model/FieldTypeUser.java deleted file mode 100644 index db8b115..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/model/FieldTypeUser.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.baoying.enginex.executor.datamanage.model; - - -import com.baoying.enginex.executor.common.model.BasePage; - -import java.io.Serializable; -import java.util.Date; - -public class FieldTypeUser extends BasePage implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 主键 - * */ - private Integer id; - - /** - * 字段类型编号(表主键) - * */ - private Integer fieldTypeId; - - /** - * 该字段类型归属的组织编号 - * */ - private Long organId; - - /** - * 该字段类型归属的引擎id(表主键) - * */ - private Integer engineId; - - /** - * 创建或修改该字段的用户编号 - * */ - private Long userId; - - /** - * 创建时间 - * */ - private Date created; - - public Integer getId() { - return id; - } - public void setId(Integer id) { - this.id = id; - } - public Integer getFieldTypeId() { - return fieldTypeId; - } - public void setFieldTypeId(Integer fieldTypeId) { - this.fieldTypeId = fieldTypeId; - } - public Long getOrganId() { - return organId; - } - public void setOrganId(Long organId) { - this.organId = organId; - } - public Integer getEngineId() { - return engineId; - } - public void setEngineId(Integer engineId) { - this.engineId = engineId; - } - public Long getUserId() { - return userId; - } - public void setUserId(Long userId) { - this.userId = userId; - } - public Date getCreated() { - return created; - } - public void setCreated(Date created) { - this.created = created; - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/model/FieldUser.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/model/FieldUser.java deleted file mode 100644 index c887839..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/model/FieldUser.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.baoying.enginex.executor.datamanage.model; - - -import com.baoying.enginex.executor.common.model.BasePage; - -import java.io.Serializable; -import java.util.Date; - -public class FieldUser extends BasePage implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 主键 - * */ - private Long id; - - /** - * 字段编号(表主键) - * */ - private Long fieldId; - - /** - * 该字段归属的组织编号 - * */ - private Long organId; - - /** - * 该字段归属的引擎id(表主键) - * */ - private Long engineId; - - /** - * 创建或修改该字段的用户编号 - * */ - private Long userId; - - /** - * 启用停用删除标志 - * */ - private int status; - - /** - * 创建时间 - * */ - private Date created; - - /** - * 更新时间 - * */ - private Date updated; - - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - public Long getFieldId() { - return fieldId; - } - public void setFieldId(Long fieldId) { - this.fieldId = fieldId; - } - public Long getOrganId() { - return organId; - } - public void setOrganId(Long organId) { - this.organId = organId; - } - public Long getEngineId() { - return engineId; - } - public void setEngineId(Long engineId) { - this.engineId = engineId; - } - public Long getUserId() { - return userId; - } - public void setUserId(Long userId) { - this.userId = userId; - } - public int getStatus() { - return status; - } - public void setStatus(int status) { - this.status = status; - } - public Date getCreated() { - return created; - } - public void setCreated(Date created) { - this.created = created; - } - public Date getUpdated() { - return updated; - } - public void setUpdated(Date updated) { - this.updated = updated; - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/model/FormulaField.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/model/FormulaField.java deleted file mode 100644 index b655d49..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/model/FormulaField.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.baoying.enginex.executor.datamanage.model; - - -import com.baoying.enginex.executor.common.model.BasePage; - -import java.io.Serializable; - -public class FormulaField extends BasePage implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 主键 - * */ - private Long id; - - /** - * 字段编号(表主键) - * */ - private Long fieldId; - /** - * 公式用到的字段编号(表主键) - * */ - private Long formulaFieldId; - - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - public Long getFieldId() { - return fieldId; - } - public void setFieldId(Long fieldId) { - this.fieldId = fieldId; - } - public Long getFormulaFieldId() { - return formulaFieldId; - } - public void setFormulaFieldId(Long formulaFieldId) { - this.formulaFieldId = formulaFieldId; - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/service/FieldService.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/service/FieldService.java deleted file mode 100644 index f7e08e6..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/service/FieldService.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.baoying.enginex.executor.datamanage.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.baoying.enginex.executor.datamanage.model.Field; - -import java.util.List; - -public interface FieldService extends IService { - - Field queryById(Long id); - - List findFieldByIdsbyorganId(Long organId, List ids); - - List selectFieldListByEns(List fieldEnList); - - Field findByFieldEnbyorganId(Long organId, String fieldEn); - - Field findByFieldCnbyorganId(Long organId, String fieldCn); -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/service/impl/FieldServiceImpl.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/service/impl/FieldServiceImpl.java deleted file mode 100644 index cfeb580..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/service/impl/FieldServiceImpl.java +++ /dev/null @@ -1,112 +0,0 @@ -package com.baoying.enginex.executor.datamanage.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.baoying.enginex.executor.canal.TableEnum; -import com.baoying.enginex.executor.common.constants.Constants; -import com.baoying.enginex.executor.common.session.SessionManager; -import com.baoying.enginex.executor.config.ConfigHolder; -import com.baoying.enginex.executor.datamanage.mapper.FieldMapper; -import com.baoying.enginex.executor.datamanage.model.Field; -import com.baoying.enginex.executor.datamanage.service.FieldService; -import com.baoying.enginex.executor.redis.RedisManager; -import com.baoying.enginex.executor.redis.RedisUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -@Service -public class FieldServiceImpl extends ServiceImpl implements FieldService { - - @Autowired - public FieldMapper fieldMapper; - @Autowired - private ConfigHolder configHolder; - @Autowired - private RedisManager redisManager; - - @Override - public Field queryById(Long id) { - Field field = null; - if(Constants.switchFlag.ON.equals(configHolder.getCacheSwitch())){ - String key = RedisUtils.getPrimaryKey(TableEnum.T_FIELD, id); - field = redisManager.getByPrimaryKey(key, Field.class); - } else { - field = fieldMapper.selectById(id); - } - - return field; - } - - @Override - public List findFieldByIdsbyorganId(Long organId, List ids) { - List fieldList = null; - if(Constants.switchFlag.ON.equals(configHolder.getCacheSwitch())){ - List keys = RedisUtils.getPrimaryKey(TableEnum.T_FIELD, ids); - fieldList = redisManager.hgetAllBatchByPrimaryKeys(keys, Field.class); - } else { - Map paramMap = new HashMap<>(); - paramMap.put("organId", organId); - paramMap.put("Ids", ids); - fieldList = fieldMapper.findFieldByIdsbyorganId(paramMap); - } - return fieldList; - } - - @Override - public List selectFieldListByEns(List fieldEnList) { - List fieldList = null; - if(Constants.switchFlag.ON.equals(configHolder.getCacheSwitch())){ - Long organId = SessionManager.getSession().getOrganId(); - List keys = fieldEnList.stream().map(item -> { - String fieldEnStr = Constants.fieldName.fieldEn + ":" + organId + ":" + item; - String fieldEnKey = RedisUtils.getPrimaryKey(TableEnum.T_FIELD, fieldEnStr); - return fieldEnKey; - }).collect(Collectors.toList()); - - fieldList = redisManager.hgetAllBatchByPrimaryKeys(keys, Field.class); - - } else { - fieldList = fieldMapper.selectFieldListByEns(fieldEnList); - } - return fieldList; - } - - @Override - public Field findByFieldEnbyorganId(Long organId, String fieldEn) { - Field field = null; - if(Constants.switchFlag.ON.equals(configHolder.getCacheSwitch())){ - String fieldEnStr = Constants.fieldName.fieldEn + ":" + organId + ":" + fieldEn; - String fieldEnKey = RedisUtils.getPrimaryKey(TableEnum.T_FIELD, fieldEnStr); - field = redisManager.getByPrimaryKey(fieldEnKey, Field.class); - // todo 是否需要status = 1判断 - } else { - Map paramMap = new HashMap(); - paramMap.put("organId", organId); - paramMap.put("fieldEn", fieldEn); - field = fieldMapper.findByFieldEnbyorganId(paramMap); - } - return field; - } - - @Override - public Field findByFieldCnbyorganId(Long organId, String fieldCn) { - Field field = null; - if(Constants.switchFlag.ON.equals(configHolder.getCacheSwitch())){ - String fieldCnStr = Constants.fieldName.fieldCn + ":" + organId + ":" + fieldCn; - String fieldCnKey = RedisUtils.getPrimaryKey(TableEnum.T_FIELD, fieldCnStr); - field = redisManager.getByPrimaryKey(fieldCnKey, Field.class); - // todo 是否需要status = 1判断 - } else { - Map paramMap = new HashMap(); - paramMap.put("organId", organId); - paramMap.put("fieldCn", fieldCn); - field = fieldMapper.findByFieldCnbyorganId(paramMap); - } - return field; - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/vo/FieldEnumVo.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/vo/FieldEnumVo.java deleted file mode 100644 index dcab312..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/vo/FieldEnumVo.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.baoying.enginex.executor.datamanage.vo; - -import com.baoying.enginex.executor.datamanage.model.Field; - -import java.util.List; - - -public class FieldEnumVo { - - private Field field; - - private List enums; - - public Field getField() { - return field; - } - - public void setField(Field field) { - this.field = field; - } - - public List getEnums() { - return enums; - } - - public void setEnums(List enums) { - this.enums = enums; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/vo/FieldExcelVo.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/vo/FieldExcelVo.java deleted file mode 100644 index be106f7..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/vo/FieldExcelVo.java +++ /dev/null @@ -1,150 +0,0 @@ -package com.baoying.enginex.executor.datamanage.vo; - -import java.util.Date; - -public class FieldExcelVo { - - /** - * 主键 - * */ - private Integer id; - - /** - * 字段英文名 - * */ - private String fieldEn; - - /** - * 字段中文名 - * */ - private String fieldCn; - - /** - * 字段类型名称 - * */ - private String fieldType; - - /** - * 字段存值类型 - * */ - private String valueType; - - /** - * 字段约束范围 - * */ - private String valueScope; - - /** - * 是否衍生字段 - * */ - private String isDerivative; - - /** - * 是否输出字段 - * */ - private String isOutput; - - /** - * 衍生字段公式 - * */ - private String formula; - - /** - * 创建人 - * */ - private String author; - - /** - * 创建时间 - * */ - private Date created; - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getFieldEn() { - return fieldEn; - } - - public void setFieldEn(String fieldEn) { - this.fieldEn = fieldEn; - } - - public String getFieldCn() { - return fieldCn; - } - - public void setFieldCn(String fieldCn) { - this.fieldCn = fieldCn; - } - - public String getFieldType() { - return fieldType; - } - - public void setFieldType(String fieldType) { - this.fieldType = fieldType; - } - - public String getValueType() { - return valueType; - } - - public void setValueType(String valueType) { - this.valueType = valueType; - } - - public String getValueScope() { - return valueScope; - } - - public void setValueScope(String valueScope) { - this.valueScope = valueScope; - } - - public String getIsDerivative() { - return isDerivative; - } - - public void setIsDerivative(String isDerivative) { - this.isDerivative = isDerivative; - } - - public String getIsOutput() { - return isOutput; - } - - public void setIsOutput(String isOutput) { - this.isOutput = isOutput; - } - - public String getFormula() { - return formula; - } - - public void setFormula(String formula) { - this.formula = formula; - } - - public String getAuthor() { - return author; - } - - public void setAuthor(String author) { - this.author = author; - } - - public Date getCreated() { - return created; - } - - public void setCreated(Date created) { - this.created = created; - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/vo/FieldFormulaVo.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/vo/FieldFormulaVo.java deleted file mode 100644 index 1a58aff..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/vo/FieldFormulaVo.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.baoying.enginex.executor.datamanage.vo; - -import java.io.Serializable; - -public class FieldFormulaVo implements Serializable { - - private static final long serialVersionUID = 1L; - - // [{fvalue: "0",formula: "a",farr: [{fieldCN:"引擎字段1-1",fieldCond:[{"inputOne":"c","inputThree":"5"},{"inputOne":"b","inputThree":"12"}]},{fieldCN:"通用字段2贷前",fieldCond:[{"inputOne":"(30,40]","inputThree":"5"},{"inputOne":"[45,51)","inputThree":"12"}]}]}]; - - /** - * 衍生字段公式设置对应的值 - * */ - private String fvalue; - - /** - * 衍生字段公式 - * */ - private String formula; - - /** - * 衍生字段公式里字段的条件区域设置 - * */ - private Integer idx; - - /** - * 衍生字段公式里字段的条件区域设置 - * */ - private String farr; - - /** - * 衍生字段公式里条件区域设置的某个字段中文名 - * */ - private String fieldCN; - - /** - * 衍生字段公式里条件区域设置的某个字段的具体设置 - * */ - private String fieldCond; - - public String getFvalue() { - return fvalue; - } - - public void setFvalue(String fvalue) { - this.fvalue = fvalue; - } - - public String getFormula() { - return formula; - } - - public void setFormula(String formula) { - this.formula = formula; - } - - public Integer getIdx() { - return idx; - } - - public void setIdx(Integer idx) { - this.idx = idx; - } - - public String getFarr() { - return farr; - } - - public void setFarr(String farr) { - this.farr = farr; - } - - public String getFieldCN() { - return fieldCN; - } - - public void setFieldCN(String fieldCN) { - this.fieldCN = fieldCN; - } - - public String getFieldCond() { - return fieldCond; - } - - public void setFieldCond(String fieldCond) { - this.fieldCond = fieldCond; - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/vo/FieldSubCondVo.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/vo/FieldSubCondVo.java deleted file mode 100644 index 12955c3..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/datamanage/vo/FieldSubCondVo.java +++ /dev/null @@ -1,108 +0,0 @@ -package com.baoying.enginex.executor.datamanage.vo; - -import java.io.Serializable; - -public class FieldSubCondVo implements Serializable{ - - private static final long serialVersionUID = 1L; - - //[{"fieldId":"43","operator":"in","fieldValue":"b","logical":"and"}] - - /** - * 条件字段编号 - * */ - private Integer fieldId; - - /** - * 条件字段的运算符 - * */ - private String operator; - - /** - * 条件字段的条件设置值 - * */ - private String fieldValue; - - /** - * 条件字段间的逻辑符 - * */ - private String logical; - - /** - * 条件字段的值类型 - * */ - private Integer valueType; - - /** - * 条件字段的取值范围 - * */ - private String valueScope; - - /** - * 条件字段的取值范围拆解后的数组 - * */ - private String[] values; - - /** - * 条件字段的字段名 - */ - private String fieldCn; - - - public Integer getFieldId() { - return fieldId; - } - public void setFieldId(Integer fieldId) { - this.fieldId = fieldId; - } - public String getOperator() { - return operator; - } - public void setOperator(String operator) { - this.operator = operator; - } - public String getFieldValue() { - return fieldValue; - } - public void setFieldValue(String fieldValue) { - this.fieldValue = fieldValue; - } - public String getLogical() { - return logical; - } - public void setLogical(String logical) { - this.logical = logical; - } - public Integer getValueType() { - return valueType; - } - public void setValueType(Integer valueType) { - this.valueType = valueType; - } - public String getValueScope() { - return valueScope; - } - public void setValueScope(String valueScope) { - this.valueScope = valueScope; - } - public String[] getValues() { - if(valueType == 3){ - values = valueScope.split(","); - }else{ - values = new String[]{valueScope}; - } - return values; - } - public void setValues(String[] values) { - this.values = values; - } - public String getFieldCn() { - return fieldCn; - } - public void setFieldCn(String fieldCn) { - this.fieldCn = fieldCn; - } - - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/consts/EngineConst.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/consts/EngineConst.java deleted file mode 100644 index d94a29f..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/consts/EngineConst.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.baoying.enginex.executor.engine.consts; - - -public class EngineConst { - - /** - * 版本部署状态 - */ - public static final int BOOT_STATE_DEPLOY = 1; - - /** - * 版本未部署状态 - */ - public static final int BOOT_STATE_UNDEPLOY = 0; - - /** - * 决策选项结果集key - */ - public static final String DECISION_COLLECTION_KEY = "formulaList"; -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/consts/EngineMsg.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/consts/EngineMsg.java deleted file mode 100644 index 564e1cb..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/consts/EngineMsg.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.baoying.enginex.executor.engine.consts; - -public class EngineMsg { - - /** - * 部署成功 - */ - public static final int STATUS_SUCCESS = 1; - - public static final String DEPLOY_SUCCESS = "部署成功!"; - - public static final String UNDEPLOY_SUCCESS = "当前版本已停用!"; - - /** - * 部署失败 - */ - public static final int STATUS_FAILED = 0; - - public static final String DEPLOY_FAILED = "部署失败!"; - - public static final String UNDEPLOY_FAILED = "停用当前版本失败!"; - - public static final String DELETE_RUNNING_FAILED = "当前版本正在运行,不能删除!"; - - public static final String DELETE_VERSION_SUCCESS = "当前版本删除成功!"; - - public static final String DELETE_VERSION_FAILED = "未知异常,当前版本删除失败!"; - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/consts/EngineOperator.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/consts/EngineOperator.java deleted file mode 100644 index 7f9bbc3..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/consts/EngineOperator.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.baoying.enginex.executor.engine.consts; - - -public class EngineOperator { - - /*---------------------------- 关系运算符 ----------------------------*/ - - public static final String OPERATOR_AND_RELATION = "&&"; - - public static final String OPERATOR_OR_RELATION = "||"; - - public static final String OPERATOR_NOT_RELATION = "!"; - - public static final String OPERATOR_EQUALS_RELATION = "=="; - - public static final String OPERATOR_GREATER_RELATION = ">"; - - public static final String OPERATOR_GREATER_EQUALS_RELATION = ">="; - - public static final String OPERATOR_LESS_RELATION = "<"; - - public static final String OPERATOR_LESS_EQUALS_RELATION = "<="; - - public static final String OPERATOR_NOT_EQUALS_RELATION = "!="; - - public static final String OPERATOR_AND_STRING_RELATION = "AND"; - - public static final String OPERATOR_OR_STRING_RELATION = "OR"; - - /*---------------------------- 数学运算符 ----------------------------*/ - - public static final String OPERATOR_ADD_MATH = "+"; - - public static final String OPERATOR_MINUS_MATH = "-"; - - public static final String OPERATOR_MULITI_MATH = "*"; - - public static final String OPERATOR_DIVIDE_MATH = "/"; - - public static final String OPERATOR_MODULU_MATH = "%"; - - public static final String OPERATOR_ABS_MATH = "abs"; - - public static final String OPERATOR_ACOS_MATH = "acos"; - - public static final String OPERATOR_ASIN_MATH = "asin"; - - public static final String OPERATOR_ATAN_MATH = "atan"; - - public static final String OPERATOR_ATAN2_MATH = "atan2"; - - public static final String OPERATOR_AVERAGE_MATH = "avg"; - - public static final String OPERATOR_CEIL_MATH = "ceil"; - - public static final String OPERATOR_COS_MATH = "cos"; - - public static final String OPERATOR_EXP_MATH = "exp"; - - public static final String OPERATOR_FLOOR_MATH = "floor"; - - public static final String OPERATOR_IEEE_MATH = "IEEEremainder"; - - public static final String OPERATOR_LN_MATH = "ln"; - - public static final String OPERATOR_LOG_MATH = "log"; - - public static final String OPERATOR_MAX_MATH = "max"; - - public static final String OPERATOR_MIN_MATH = "min"; - - public static final String OPERATOR_POW_MATH = "pow"; - - public static final String OPERATOR_RANDOM_MATH = "random"; - - public static final String OPERATOR_RINT_MATH = "rint"; - - public static final String OPERATOR_ROUND_MATH = "round"; - - public static final String OPERATOR_SIN_MATH = "sin"; - - public static final String OPERATOR_SQRT_MATH = "sqrt"; - - public static final String OPERATOR_SUM_MATH = "sum"; - - public static final String OPERATOR_TAN_MATH = "tan"; - - public static final String OPERATOR_TODEGREES_MATH = "toDegrees"; - - public static final String OPERATOR_TORADIANS_MATH = "toRadians"; - - /*---------------------------- 字符串运算符 ----------------------------*/ - - public static final String OPERATOR_CHARAT_STRING = "charAt"; - - public static final String OPERATOR_COMPARE_STRING = "compareTo"; - - public static final String OPERATOR_CTIC_STRING = "compareToIgnoreCase"; - - public static final String OPERATOR_CONCAT_STRING = "concat"; - - public static final String OPERATOR_ENDSWITH_STRING = "endsWith"; - - public static final String OPERATOR_EIC_STRING = "equalsIgnoreCase"; - - public static final String OPERATOR_EVAL_STRING = "eval"; - - public static final String OPERATOR_INDEXOF_STRING = "indexOf"; - - public static final String OPERATOR_LASTINDEXOF_STRING = "lastIndexOf"; - - public static final String OPERATOR_LENGTH_STRING = "length"; - - public static final String OPERATOR_REPLACE_STRING = "replace"; - - public static final String OPERATOR_STARTSWITH_STRING = "startsWith"; - - public static final String OPERATOR_SUB_STRING = "substring"; - - public static final String OPERATOR_TLC_STRING = "toLowerCase"; - - public static final String OPERATOR_TUC_STRING = "toUpperCase"; - - public static final String OPERATOR_TRIM_STRING = "trim"; - - public static final String OPERATOR_CONTAINS_STRING = "contains"; - - public static final String OPERATOR_UNCONTAINS_STRING = "notContains"; - - public static final String OPERATOR_EQUALS_STRING = "equals"; - - public static final String OPERATOR_UNEQUALS_STRING = "notEquals"; - - /*---------------------------- 符号 ----------------------------*/ - - public static final String OPERATOR_LEFT_BRACE = "{"; - - public static final String OPERATOR_RIGHT_BRACE = "}"; - - public static final String OPERATOR_VARIABLE_LEFT = "#"+OPERATOR_LEFT_BRACE; - - public static final String OPERATOR_VARIABLE_RIGHT = "}"; - - public static final String OPERATOR_LEFT_PARENTHESES = "("; - - public static final String OPERATOR_RIGHT_PARENTHESES = ")"; - - public static final String OPERATOR_LEFT_BRACKET = "["; - - public static final String OPERATOR_RIGHT_BRACKET = "]"; -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/consts/EnumConst.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/consts/EnumConst.java deleted file mode 100644 index d57c954..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/consts/EnumConst.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.baoying.enginex.executor.engine.consts; - - -public class EnumConst { - - public static final String NODE_START = "开始"; - - public static final String NODE_POLICY = "政策规则"; - - public static final String NODE_CLASSIFY = "客户分群"; - - public static final String NODE_SCORECARD = "评分卡"; - - public static final String NODE_BLACK = "黑名单"; - - public static final String NODE_WHITE = "白名单"; - - public static final String NODE_SANDBOX = "沙盒比例"; - - public static final String NODE_CREDIT_LEVEL = "信用评级"; - - public static final String NODE_DECISION = "决策选项"; - - public static final String NODE_QUOTA_CALC = "额度计算"; - - public static final String NODE_REPORT = "报表分析"; - - public static final String NODE_CUSTOMIZE = "自定义按钮"; - - public static final String NODE_COMPLEXRULE = "复杂规则"; - - public static final String NODE_CHILD_ENGINE = "子引擎"; - - public static final String NODE_MODEL = "模型"; - - public static final String DECISION_TABLES = "决策表"; - - public static final String DECISION_TREE = "决策树"; - - public static final String NODE_RPC = "远程调用"; - - public static final String NODE_PARALLEL = "并行"; - - public static final String NODE_AGGREGATION = "聚合"; - - public static final String NODE_CHAMPION_CHALLENGE= "冠军挑战"; -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/controller/ApiController.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/controller/ApiController.java deleted file mode 100644 index fb2a01b..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/controller/ApiController.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.baoying.enginex.executor.engine.controller; - -import com.alibaba.fastjson.JSONObject; -import com.baoying.enginex.executor.engine.model.DecisionReqModel; -import com.baoying.enginex.executor.engine.service.EngineApiService; -import com.baoying.enginex.executor.engine.thread.EngineCallable; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; - -import javax.servlet.http.HttpServletResponse; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; - -@Controller -@RequestMapping("/QueryString") -public class ApiController { - - private static final Logger logger = LoggerFactory.getLogger(ApiController.class); - - @Autowired - public EngineApiService engineApiService; - - @RequestMapping(value = "/decision", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json;charset=UTF-8") - @ResponseBody - public String decision(String ts, String nonce, String act, String pid, String uid, String sign, String token, String paramJson, String fields) { - logger.info("请求参数--" + "ts:" + ts + ",nonce:" + nonce + ",act:" + act + ",pid:" + pid + ",uid:" + uid + ", sign:" + sign + ",token:" + token + ",paramJson" + paramJson); - Map map = new HashMap<>(); - map.put("ts", ts); - map.put("nonce", nonce); - map.put("act", act); - map.put("pid", pid); - map.put("uid", uid); - map.put("token", token); - JSONObject jsonObject = JSONObject.parseObject(paramJson); - if (jsonObject.getInteger("reqType") == 2) { - map.put("version", jsonObject.getInteger("version")); - map.put("subversion", jsonObject.getInteger("subversion")); - } - map.put("reqType", jsonObject.getInteger("reqType")); - map.put("engineId", jsonObject.getLong("engineId")); - map.put("organId", jsonObject.getLong("organId")); - map.put("sign", jsonObject.getString("sign")); - - Map requestFields = new HashMap<>(); - if(StringUtils.isNotBlank(fields)){ - requestFields = JSONObject.parseObject(fields, Map.class); - } - map.put("fields", requestFields); - String result = engineApiService.engineApi(map); - logger.info("uid:" + uid + " 响应参数--" + "result:" + result); - return result; - } - - @RequestMapping(value = "/batchDecision", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json;charset=UTF-8") - @ResponseBody - public String batchDecision(HttpServletResponse response, String ts, String nonce, String act, String sign, String token, int reqType, Long engineId, Long organId, String paramJson) { - List resultList = new ArrayList<>(); - Map resultMap = new HashMap<>(); - - List> list = new ArrayList<>(); - List reqModelList = JSONObject.parseArray(paramJson, DecisionReqModel.class); - for (DecisionReqModel reqModel : reqModelList) { - Map map = new HashMap<>(); - map.put("ts", ts); - map.put("nonce", nonce); - map.put("act", act); - map.put("token", token); - map.put("reqType", reqType); - map.put("engineId", engineId); - map.put("organId", organId); - map.put("sign", sign); - map.put("pid", reqModel.getPid()); - map.put("uid", reqModel.getUid()); - - Map requestFields = new HashMap<>(); - if(reqModel.getFields() != null){ - requestFields = JSONObject.parseObject(JSONObject.toJSONString(reqModel.getFields()), Map.class); - } - map.put("fields", requestFields); - list.add(map); - } - - List> futureList = new ArrayList<>(); - ExecutorService executorService = Executors.newFixedThreadPool(10); - for(Map paramMap : list){ - futureList.add(executorService.submit(new EngineCallable(paramMap))); - } - - // 获取线程执行结果 - for (final Future future : futureList) { - try { - final String str = future.get(5, TimeUnit.MINUTES); - resultList.add(JSONObject.parseObject(str)); - } catch (Exception e) { - boolean cancelResult = future.cancel(true); - logger.error("取消结果(" + cancelResult + ")" + e.getMessage(), e); - } - } - - String result = JSONObject.toJSONString(resultList); - resultMap.put("result", resultList); - logger.info(" 响应参数--" + "result:" + result); - - return result; - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/controller/DecisionController.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/controller/DecisionController.java deleted file mode 100644 index 7a6d70a..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/controller/DecisionController.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.baoying.enginex.executor.engine.controller; - -import com.baoying.enginex.executor.common.session.SessionData; -import com.baoying.enginex.executor.common.session.SessionManager; -import com.baoying.enginex.executor.engine.model.request.DecisionApiBizData; -import com.baoying.enginex.executor.engine.model.request.DecisionApiRequest; -import com.baoying.enginex.executor.engine.service.EngineApiService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -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.ResponseBody; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Controller -@RequestMapping("/runner") -public class DecisionController { - - private static final Logger logger = LoggerFactory.getLogger(DecisionController.class); - - @Autowired - public EngineApiService engineApiService; - - @RequestMapping(value = "/decision", method = RequestMethod.POST, produces = "application/json;charset=UTF-8") - @ResponseBody - public String decision(@RequestBody DecisionApiRequest apiRequest) { - long start = System.currentTimeMillis(); - DecisionApiBizData bizData = apiRequest.getBiz_data(); - Map map = new HashMap<>(); - map.put("pid", bizData.getBusinessId()); - map.put("uid", ""); - map.put("reqType", 1); - map.put("engineId", bizData.getEngineId()); - map.put("organId", bizData.getOrganId()); - - SessionData sessionData = new SessionData(); - sessionData.setOrganId(bizData.getOrganId()); - sessionData.setEngineId(bizData.getEngineId()); - sessionData.setReqType(1); - SessionManager.setSession(sessionData); - - if(bizData.getFields() != null){ - map.put("fields", bizData.getFields()); - } else { - map.put("fields", new HashMap<>()); - } - String result = engineApiService.engineApi(map); - long end = System.currentTimeMillis(); - logger.info("============ 接口调用耗时:{}ms ============", (end -start)); - return result; - } - - @RequestMapping(value = "/batchExecute", method = RequestMethod.POST, produces = "application/json;charset=UTF-8") - @ResponseBody - public List batchExecute(@RequestBody List requestList){ - List list = new ArrayList<>(); - for (DecisionApiRequest apiRequest : requestList) { - String decision = this.decision(apiRequest); - list.add(decision); - } - return list; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/enums/CallBackTypeEnum.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/enums/CallBackTypeEnum.java deleted file mode 100644 index 8478cc4..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/enums/CallBackTypeEnum.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.baoying.enginex.executor.engine.enums; - -public enum CallBackTypeEnum { - - SYNC(1,"同步"), - ASYNC(2,"异步"); - - private int code; - private String message; - - CallBackTypeEnum(int code, String message) { - this.code = code; - this.message = message; - } - - public int getCode() { - return code; - } - - public String getMessage() { - return message; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/enums/NodeTypeEnum.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/enums/NodeTypeEnum.java deleted file mode 100644 index 545e33b..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/enums/NodeTypeEnum.java +++ /dev/null @@ -1,125 +0,0 @@ -package com.baoying.enginex.executor.engine.enums; - -import com.baoying.enginex.executor.engine.consts.EnumConst; - -public enum NodeTypeEnum { - /** - * 开始节点 - */ - START(1, EnumConst.NODE_START), - /** - * 规则节点 - */ - POLICY(2,EnumConst.NODE_POLICY), - /** - * 分组节点 - */ - CLASSIFY(3, EnumConst.NODE_CLASSIFY), - /** - * 评分卡节点 - */ - SCORECARD(4,EnumConst.NODE_SCORECARD), - /** - * 黑名单节点 - */ - BLACKLIST(5,EnumConst.NODE_BLACK), - /** - * 白名单节点 - */ - WHITELIST(6,EnumConst.NODE_WHITE), - /** - * 沙盒节点 - */ - SANDBOX(7,EnumConst.NODE_SANDBOX), - /** - * 信用评级节点 - */ - CREDITLEVEL(8,EnumConst.NODE_CREDIT_LEVEL), - /** - * 决策选项节点 - */ - DECISION(9,EnumConst.NODE_DECISION), - /** - * 额度计算节点 - */ - QUOTACALC(10,EnumConst.NODE_QUOTA_CALC), - /** - * 报表分析节点 - */ - REPORT(11,EnumConst.NODE_REPORT), - /** - * 自定义节点 - */ - CUSTOMIZE(12,EnumConst.NODE_CUSTOMIZE), - /** - * 复杂规则 - */ - NODE_COMPLEXRULE(13,EnumConst.NODE_COMPLEXRULE), - /** - * 子引擎 - */ - CHILD_ENGINE(14,EnumConst.NODE_CHILD_ENGINE), - /** - * 模型 - */ - MODEL(15,EnumConst.NODE_MODEL), - /** - * 决策表 - */ - DECISION_TABLES(16,EnumConst.DECISION_TABLES), - /** - * 决策树 - */ - DECISION_TREE(17,EnumConst.DECISION_TREE), - /** - * 远程调用 - */ - RPC(18, EnumConst.NODE_RPC), - /** - * 并行节点 - */ - PARALLEL(19, EnumConst.NODE_PARALLEL), - /** - * 聚合节点 - */ - AGGREGATION(20, EnumConst.NODE_AGGREGATION), - /** - * 冠军挑战节点 - */ - CHAMPION_CHALLENGE(21, EnumConst.NODE_CHAMPION_CHALLENGE); - - private int value; - - private String type; - - private NodeTypeEnum(int value, String type) - { - this.value = value; - this.type = type; - } - - public int getValue() { - return value; - } - - public void setValue(int value) { - this.value = value; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public static NodeTypeEnum adapad(int value) { - for (NodeTypeEnum nodeTypeEnum : NodeTypeEnum.values()) { - if (nodeTypeEnum.getValue() == value) { - return nodeTypeEnum; - } - } - return null; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/mapper/EngineMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/mapper/EngineMapper.java deleted file mode 100644 index 08717b6..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/mapper/EngineMapper.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.baoying.enginex.executor.engine.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baoying.enginex.executor.engine.model.Engine; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface EngineMapper extends BaseMapper { -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/mapper/EngineNodeMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/mapper/EngineNodeMapper.java deleted file mode 100644 index 2a3012e..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/mapper/EngineNodeMapper.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baoying.enginex.executor.engine.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baoying.enginex.executor.engine.model.EngineNode; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -public interface EngineNodeMapper extends BaseMapper { - - /** - * 根据版本id获取版本下的所有节点 - * @param engineVersionId - * @return - */ - List getEngineNodeListByVersionId(@Param("engineVersionId") Long engineVersionId); - -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/mapper/EngineNodeMapper.xml b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/mapper/EngineNodeMapper.xml deleted file mode 100644 index ce6e7f1..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/mapper/EngineNodeMapper.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - node_id, parent_id, version_id, node_name, node_code, node_order, node_type, node_x, node_y,node_json,node_script,next_nodes,params,snapshot - - - - - \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/mapper/EngineResultSetMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/mapper/EngineResultSetMapper.java deleted file mode 100644 index d75f9c6..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/mapper/EngineResultSetMapper.java +++ /dev/null @@ -1,72 +0,0 @@ - - -package com.baoying.enginex.executor.engine.mapper; - - -import com.baoying.enginex.executor.engine.model.EngineResultSet; -import org.apache.ibatis.annotations.Param; - -import java.util.List; -import java.util.Map; - - -public interface EngineResultSetMapper { - /** - * - * 增加结果集 - * @param resultSet 结果集对象 - * @return 返回结果 - * @see - */ - int insertResultSet(EngineResultSet resultSet); - /** - * - * 查询结果集列表 - * @param resultSet 查询对象 - * @return 返回结果集 - * @see - */ - List getResultSetByList(EngineResultSet resultSet); - - /** - * 根据引擎编号和时间段获取结果集数据 - * @param map - * @return - */ - List getEngineResultSetBySegment(Map map); - - /** - * - * 通过主键编号得到 - * @param resultSet 对象 - * @return 返回对象 - * @see - */ - EngineResultSet getResultSetById(EngineResultSet resultSet); - - List getResultSetDetailsById(long resultSetId); - - /** - * 查找引擎id的批量测试结果 - * yuanlinfeng - * @param resultSetId - * @return - */ - List getBatchTestResultSetByEngineId(Map paramMap); - - /** - * 查找引擎批量测试批次号的所有测试结果 - * yuanlinfeng - * @param resultSetId - * @return - */ - List getBatchTestResultSetByBatchNo(Map paramMap); - - /** - * 更新结果出参 - * @param resultSet - */ - void updateResultOutput(EngineResultSet resultSet); - void updateResultById(@Param("resultId") Integer resultId, @Param("rowKeyStr") String rowKeyStr); - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/mapper/EngineResultSetMapper.xml b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/mapper/EngineResultSetMapper.xml deleted file mode 100644 index 758e1a4..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/mapper/EngineResultSetMapper.xml +++ /dev/null @@ -1,223 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - INSERT INTO - t_resultset - - - uid, - - - pid, - - - input, - - - output, - - - result, - - - engine_id, - - - uuid, - - - engine_version, - - - engine_name, - - - engine_code, - - - type, - - - sub_version, - - - scorecardscore, - - - batch_no, - - - datilResult, - - - values - - - #{uid}, - - - #{pid}, - - - #{input}, - - - #{output}, - - - #{result}, - - - #{engine_id}, - - - #{uuid}, - - - #{engine_version}, - - - #{engine_name}, - - - #{engine_code}, - - - #{type}, - - - #{subVersion}, - - - #{scorecardscore}, - - - #{batchNo}, - - - #{datilResult}, - - - - - - - - - - - - - - - update t_resultset t set t.`output` = #{output} where t.`id` = #{id} - - - - UPDATE t_resultset - set hbase_row_key = #{rowKeyStr} - where id = #{resultId} - - - \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/mapper/EngineVersionMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/mapper/EngineVersionMapper.java deleted file mode 100644 index b8acde4..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/mapper/EngineVersionMapper.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baoying.enginex.executor.engine.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baoying.enginex.executor.engine.model.EngineVersion; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.Map; - -@Mapper -public interface EngineVersionMapper extends BaseMapper { - - /** - * 获取引擎正在运行中的版本 - * @param engineId - * @return - */ - EngineVersion getRunningVersion(@Param("engineId") Long engineId); - - /** - * 获取指定版本信息 - * @param paramMap - * @return - */ - EngineVersion getTargetEngineVersion(Map paramMap); - -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/mapper/EngineVersionMapper.xml b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/mapper/EngineVersionMapper.xml deleted file mode 100644 index b207c87..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/mapper/EngineVersionMapper.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - version_id, engine_id, version, boot_state, status, layout, user_id, create_time, - latest_user, latest_time, sub_version - - - - - - - \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/ComplexRule.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/ComplexRule.java deleted file mode 100644 index 89791a2..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/ComplexRule.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.baoying.enginex.executor.engine.model; - -import java.util.Map; - -public class ComplexRule { - - private Map result; - - private String out; - - private Map returnResult; - - - - public Map getReturnResult() { - return returnResult; - } - - public void setReturnResult(Map returnResult) { - this.returnResult = returnResult; - } - - public Map getResult() { - return result; - } - - public void setResult(Map result) { - this.result = result; - } - - public String getOut() { - return out; - } - - public void setOut(String out) { - this.out = out; - } - - - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/DecisionOptions.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/DecisionOptions.java deleted file mode 100644 index 9a36d3b..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/DecisionOptions.java +++ /dev/null @@ -1,62 +0,0 @@ - -package com.baoying.enginex.executor.engine.model; - -import java.util.Map; - -public class DecisionOptions { - private String code;//决策选项code - private String name;//决策选项名称 - private Map inFields;//输入字段 - private Map outFields;//输出字段 - private Integer fType;//输出字段类型 - private Long nodId;//节点id - private String fieldScope; - - - - public String getFieldScope() { - return fieldScope; - } - public void setFieldScope(String fieldScope) { - this.fieldScope = fieldScope; - } - public Long getNodId() { - return nodId; - } - public void setNodId(Long nodId) { - this.nodId = nodId; - } - public Integer getfType() { - return fType; - } - public void setfType(Integer fType) { - this.fType = fType; - } - public String getCode() { - return code; - } - public void setCode(String code) { - this.code = code; - } - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public Map getInFields() { - return inFields; - } - public void setInFields(Map inFields) { - this.inFields = inFields; - } - public Map getOutFields() { - return outFields; - } - public void setOutFields(Map outFields) { - this.outFields = outFields; - } - - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/DecisionReqModel.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/DecisionReqModel.java deleted file mode 100644 index 6666277..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/DecisionReqModel.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baoying.enginex.executor.engine.model; - -import com.alibaba.fastjson.JSONObject; -import lombok.Data; - -import java.io.Serializable; - -@Data -public class DecisionReqModel implements Serializable { - private static final long serialVersionUID = 1743177499998353115L; - - private String pid; - private String uid; - private JSONObject fields; - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/Engine.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/Engine.java deleted file mode 100644 index a3d0cd8..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/Engine.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.baoying.enginex.executor.engine.model; - -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 lombok.Data; - -import java.io.Serializable; -import java.util.Date; -import java.util.List; - -@Data -@TableName("t_engine") -public class Engine implements Serializable { - private static final long serialVersionUID = -6611916471057697499L; - - /** - * 主键id - */ - @TableId(type = IdType.AUTO) - private Long id; - - /** - * 引擎编号 - */ - private String code; - - /** - * 引擎名称 - */ - private String name; - - /** - * 引擎描述 - */ - private String description; - - /** - * 引擎状态 - */ - private Integer status; - - /** - * 创建时间 - */ - private Date createDatetime; - - /** - * 修改时间 - */ - private Date updateDatetime; - - /** - * 创建人 - */ - private Long creator; - - /** - * 修改人 - */ - private Long userId; - - /** - * 公司编号 - */ - private Long organId; - - /** - * 调用方式 1:同步,2:异步 - */ - private Integer callbackType; - - /** - * 回调地址 - */ - private String callbackUrl; - - /** - * 异常回调地址 - */ - private String exceptionCallbackUrl; - - /** - * 引擎版本集合 - */ - @TableField(exist = false) - private List engineVersionList; - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/EngineNode.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/EngineNode.java deleted file mode 100644 index ae8026a..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/EngineNode.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.baoying.enginex.executor.engine.model; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; - -import java.io.Serializable; - -@Data -@TableName("t_engine_node") -public class EngineNode implements Serializable{ - private static final long serialVersionUID = -1867357850853531748L; - - /** - * 节点编号 - */ - @TableId(type = IdType.AUTO) - private Long nodeId; - - /** - * 版本编号 - */ - private Long versionId; - - /** - * 节点名称 - */ - private String nodeName; - - /** - * 节点code - */ - private String nodeCode; - - /** - * 节点顺序 - */ - private Integer nodeOrder; - - /** - * 节点类型 - */ - private Integer nodeType; - - /** - * 节点json - */ - private String nodeJson; - - /** - * 节点X轴 - */ - private double nodeX; - - /** - * 节点Y轴 - */ - private double nodeY; - - /** - * 节点脚本 - */ - private String nodeScript; - - /** - * 下一节点 - */ - private String nextNodes; - - /** - * 节点类型,图标等信息 - */ - private String params; - - /** - * 父节点编号 - */ - private String parentId; - - /** - * 节点配置快照 - */ - private String snapshot; -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/EngineResultSet.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/EngineResultSet.java deleted file mode 100644 index cd21487..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/EngineResultSet.java +++ /dev/null @@ -1,252 +0,0 @@ - - -package com.baoying.enginex.executor.engine.model; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -import java.util.Date; -import java.util.List; - -@Data -@AllArgsConstructor -@NoArgsConstructor -@Accessors -public class EngineResultSet { - private Integer id; - private String uid; - private String pid; - private String input; - private String output; - private Date create_datetime; - - private String result; - - private Long engine_id; - - private Integer engine_version; - - private String uuid; - - private String engine_name; - - private String engine_code; - - private Date startDate; - - private Date endDate; - - private Integer type; - - private Integer subVersion; - - private String scorecardscore; - - private String datilResult; - /** - *决策表结果 - */ - private String decisionTablesResult; - - /** - *决策树结果 - */ - private String decisionTreeResult; - - /** - * 批量测试批次号 - */ - private String batchNo; - - /** - * 批量测试每批测试开始时间 - */ - private Date startTime; - - /** - * 批量测试每批次花费时间 - */ - private String costTime; - - - public String getUid() { - return uid; - } - - public void setUid(String uid) { - this.uid = uid; - } - - public String getPid() { - return pid; - } - - public void setPid(String pid) { - this.pid = pid; - } - - public String getScorecardscore() { - return scorecardscore; - } - - public void setScorecardscore(String scorecardscore) { - this.scorecardscore = scorecardscore; - } - - public Integer getType() { - return type; - } - - public void setType(Integer type) { - this.type = type; - } - - public Integer getSubVersion() { - return subVersion; - } - - public void setSubVersion(Integer subVersion) { - this.subVersion = subVersion; - } - - private List resultSetList; - - - public Date getStartDate() { - return startDate; - } - - public void setStartDate(Date startDate) { - this.startDate = startDate; - } - - public Date getEndDate() { - return endDate; - } - - public void setEndDate(Date endDate) { - this.endDate = endDate; - } - - public String getEngine_name() { - return engine_name; - } - - public void setEngine_name(String engine_name) { - this.engine_name = engine_name; - } - - public String getEngine_code() { - return engine_code; - } - - public void setEngine_code(String engine_code) { - this.engine_code = engine_code; - } - - public String getUuid() { - return uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getInput() { - return input; - } - - public void setInput(String input) { - this.input = input; - } - - public Date getCreate_datetime() { - return create_datetime; - } - - public void setCreate_datetime(Date create_datetime) { - this.create_datetime = create_datetime; - } - - public String getResult() { - return result; - } - - public void setResult(String result) { - this.result = result; - } - - public Long getEngine_id() { - return engine_id; - } - - public void setEngine_id(Long engine_id) { - this.engine_id = engine_id; - } - - public Integer getEngine_version() { - return engine_version; - } - - public void setEngine_version(Integer engine_version) { - this.engine_version = engine_version; - } - - public List getResultSetList() { - return resultSetList; - } - - public void setResultSetList(List resultSetList) { - this.resultSetList = resultSetList; - } - - public String getBatchNo() { - return batchNo; - } - - public void setBatchNo(String batchNo) { - this.batchNo = batchNo; - } - - public Date getStartTime() { - return startTime; - } - - public void setStartTime(Date startTime) { - this.startTime = startTime; - } - - public String getCostTime() { - return costTime; - } - - public void setCostTime(String costTime) { - this.costTime = costTime; - } - - public String getDatilResult() { - return datilResult; - } - - public void setDatilResult(String datilResult) { - this.datilResult = datilResult; - } - - public String getOutput() { - return output; - } - - public void setOutput(String output) { - this.output = output; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/EngineRule.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/EngineRule.java deleted file mode 100644 index 9c840fe..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/EngineRule.java +++ /dev/null @@ -1,74 +0,0 @@ - -package com.baoying.enginex.executor.engine.model; - -import java.util.Map; - -public class EngineRule { - - private String refused; - - private String code ; - - private String policyName; - - private String desc; - - private String Strtus; - - - private Mapfields; - - - public String getStrtus() { - return Strtus; - } - - public void setStrtus(String strtus) { - Strtus = strtus; - } - - public String getRefused() { - return refused; - } - - public void setRefused(String refused) { - this.refused = refused; - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getPolicyName() { - return policyName; - } - - public void setPolicyName(String policyName) { - this.policyName = policyName; - } - - public String getDesc() { - return desc; - } - - public void setDesc(String desc) { - this.desc = desc; - } - - public Map getFields() { - return fields; - } - - public void setFields(Map fields) { - this.fields = fields; - } - - - - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/EngineVersion.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/EngineVersion.java deleted file mode 100644 index 8820695..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/EngineVersion.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.baoying.enginex.executor.engine.model; - -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 lombok.Data; - -import java.io.Serializable; -import java.util.List; - -@Data -@TableName("t_engine_version") -public class EngineVersion implements Serializable { - private static final long serialVersionUID = 2923432053414979455L; - - /** - * 版本编号 - */ - @TableId(type = IdType.AUTO) - private Long versionId; - - /** - * 引擎编号 - */ - private Long engineId; - - /** - * 版本号 - */ - private Integer version; - - /** - * 子版本 - */ - private Integer subVersion; - - /** - * 部署状态 - */ - private Integer bootState; - - /** - * 版本状态 - */ - private Integer status; - - /** - * 布局方式 - */ - private Integer layout; - - /** - * 创建者 - */ - private Long userId; - - /** - * 创建时间 - */ - private String createTime; - - /** - * 修改人 - */ - private Long latestUser; - - /** - * 最后修改时间 - */ - private String latestTime; - - /** - * 节点集合 - * */ - @TableField(exist = false) - private List engineNodeList; - -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/IndexEngineReportVo.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/IndexEngineReportVo.java deleted file mode 100644 index db1cad3..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/IndexEngineReportVo.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.baoying.enginex.executor.engine.model; - -import java.io.Serializable; - -public class IndexEngineReportVo implements Serializable { - - private static final long serialVersionUID = -1274492726714567316L; - private String dayTime; - private String monthTime; - private Integer engineId; - private String engineName; - private Integer useNum; - - public String getDayTime() { - return dayTime; - } - - public void setDayTime(String dayTime) { - this.dayTime = dayTime; - } - - public String getMonthTime() { - return monthTime; - } - - public void setMonthTime(String monthTime) { - this.monthTime = monthTime; - } - - public Integer getEngineId() { - return engineId; - } - - public void setEngineId(Integer engineId) { - this.engineId = engineId; - } - - public String getEngineName() { - return engineName; - } - - public void setEngineName(String engineName) { - this.engineName = engineName; - } - - public Integer getUseNum() { - return useNum; - } - - public void setUseNum(Integer useNum) { - this.useNum = useNum; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/InputParam.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/InputParam.java deleted file mode 100644 index eabdde6..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/InputParam.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.baoying.enginex.executor.engine.model; - -import java.util.List; -import java.util.Map; -import java.util.Set; - -public class InputParam { - private Map inputParam; - private List result; - // 数组中 符合条件的对象属性 - private Map> outputParam; - - public Map getInputParam() { - return inputParam; - } - - public void setInputParam(Map inputParam) { - this.inputParam = inputParam; - } - - public List getResult() { - return result; - } - - public void setResult(List result) { - this.result = result; - } - - public Map> getOutputParam() { - return outputParam; - } - - public void setOutputParam(Map> outputParam) { - this.outputParam = outputParam; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/NodeKnowledge.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/NodeKnowledge.java deleted file mode 100644 index 3ea8595..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/NodeKnowledge.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.baoying.enginex.executor.engine.model; - -import java.io.Serializable; - -/** - * 节点与知识库映射关系模型 - * @author sunyk - * - */ -public class NodeKnowledge implements Serializable { - private static final long serialVersionUID = -55965399064577379L; - /** - * 主键编号 - */ - private Long relId; - - /** - * 节点编号 - */ - private Long nodeId; - - /** - * 知识库信息编号 - */ - private Long knowledgeId; - - /** - * 知识库类型1规则2评分卡 - */ - private Integer knowledgeType; - - public Long getRelId() { - return relId; - } - - public void setRelId(Long relId) { - this.relId = relId; - } - - public Long getNodeId() { - return nodeId; - } - - public void setNodeId(Long nodeId) { - this.nodeId = nodeId; - } - - public Long getKnowledgeId() { - return knowledgeId; - } - - public void setKnowledgeId(Long knowledgeId) { - this.knowledgeId = knowledgeId; - } - - public Integer getKnowledgeType() { - return knowledgeType; - } - - public void setKnowledgeType(Integer knowledgeType) { - this.knowledgeType = knowledgeType; - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/Result.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/Result.java deleted file mode 100644 index 21f19a5..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/Result.java +++ /dev/null @@ -1,63 +0,0 @@ - - -package com.baoying.enginex.executor.engine.model; - -import java.util.List; -import java.util.Map; - -public class Result { - private String resultType;//规则1代表加减法,2拒绝规则 - private Integer id;//规则编号 - private String code;//规则code - private String name; - private String value; - private Map map;//评分 - private List list; - - - public Map getMap() { - return map; - } - public void setMap(Map map) { - this.map = map; - } - public String getValue() { - return value; - } - public void setValue(String value) { - this.value = value; - } - public String getResultType() { - return resultType; - } - public void setResultType(String resultType) { - this.resultType = resultType; - } - public Integer getId() { - return id; - } - public void setId(Integer id) { - this.id = id; - } - - public String getCode() { - return code; - } - public void setCode(String code) { - this.code = code; - } - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public List getList() { - return list; - } - public void setList(List list) { - this.list = list; - } - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/ResultSetList.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/ResultSetList.java deleted file mode 100644 index af50abb..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/ResultSetList.java +++ /dev/null @@ -1,76 +0,0 @@ - - -package com.baoying.enginex.executor.engine.model; - -import java.util.Date; - -public class ResultSetList { - private Long id; - private Integer type;//1.黑名单。2.白名单。3.拒绝规则。4.加减分规则 - private String code; - private String name; - private String description; - private String resultsetId; - private String expression; - private Date startDate; - private Date endDate; - - -public Date getStartDate() { - return startDate; -} -public void setStartDate(Date startDate) { - this.startDate = startDate; -} -public Date getEndDate() { - return endDate; -} -public void setEndDate(Date endDate) { - this.endDate = endDate; -} -public Long getId() { - return id; -} -public void setId(Long id) { - this.id = id; -} -public Integer getType() { - return type; -} -public void setType(Integer type) { - this.type = type; -} -public String getCode() { - return code; -} -public void setCode(String code) { - this.code = code; -} -public String getName() { - return name; -} -public void setName(String name) { - this.name = name; -} -public String getDescription() { - return description; -} -public void setDescription(String description) { - this.description = description; -} -public String getResultsetId() { - return resultsetId; -} -public void setResultsetId(String resultsetId) { - this.resultsetId = resultsetId; -} -public String getExpression() { - return expression; -} -public void setExpression(String expression) { - this.expression = expression; -} - - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/Sandbox.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/Sandbox.java deleted file mode 100644 index cc06839..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/Sandbox.java +++ /dev/null @@ -1,53 +0,0 @@ - - -package com.baoying.enginex.executor.engine.model; - -public class Sandbox { - private Integer sandbox;//沙盒组编号 - private Integer proportion;//沙盒占用比例 - private String nextNode;//下个节点序号 - private Integer sum;//分母 - private Integer startNumber;//起始值 - private Integer endNumberl;//终止值 - - - - public Integer getSum() { - return sum; - } - public void setSum(Integer sum) { - this.sum = sum; - } - public Integer getStartNumber() { - return startNumber; - } - public void setStartNumber(Integer startNumber) { - this.startNumber = startNumber; - } - public Integer getEndNumberl() { - return endNumberl; - } - public void setEndNumberl(Integer endNumberl) { - this.endNumberl = endNumberl; - } - public Integer getSandbox() { - return sandbox; - } - public void setSandbox(Integer sandbox) { - this.sandbox = sandbox; - } - public Integer getProportion() { - return proportion; - } - public void setProportion(Integer proportion) { - this.proportion = proportion; - } - public String getNextNode() { - return nextNode; - } - public void setNextNode(String nextNode) { - this.nextNode = nextNode; - } - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/ScoreCardEngine.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/ScoreCardEngine.java deleted file mode 100644 index 1890952..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/ScoreCardEngine.java +++ /dev/null @@ -1,49 +0,0 @@ - - -package com.baoying.enginex.executor.engine.model; - -import java.util.Map; - -public class ScoreCardEngine { - private String code;//评分卡编号 - private String name;//评分卡名称 - private String scoreCardName;//评分卡名称 - private Map inFields;//评分可用到的字段 - private Map outFields;//评分卡 - - - public String getScoreCardName() { - return scoreCardName; - } - public void setScoreCardName(String scoreCardName) { - this.scoreCardName = scoreCardName; - } - public String getCode() { - return code; - } - public void setCode(String code) { - this.code = code; - } - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public Map getInFields() { - return inFields; - } - public void setInFields(Map inFields) { - this.inFields = inFields; - } - public Map getOutFields() { - return outFields; - } - public void setOutFields(Map outFields) { - this.outFields = outFields; - } - - - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/TestRule.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/TestRule.java deleted file mode 100644 index c1478ba..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/TestRule.java +++ /dev/null @@ -1,37 +0,0 @@ - - -package com.baoying.enginex.executor.engine.model; - -public class TestRule { - private String id; - - private String ruleid; - - private String param; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getRuleid() { - return ruleid; - } - - public void setRuleid(String ruleid) { - this.ruleid = ruleid; - } - - public String getParam() { - return param; - } - - public void setParam(String param) { - this.param = param; - } - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/request/DecisionApiBizData.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/request/DecisionApiBizData.java deleted file mode 100644 index 28a0abb..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/request/DecisionApiBizData.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baoying.enginex.executor.engine.model.request; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; - -import java.util.Map; - -@Data -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = false) -public class DecisionApiBizData { - - private String businessId; // 业务id - private Long organId; // 组织id - private Long engineId; // 引擎id - private Map fields; // 指标字段键值对 -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/request/DecisionApiRequest.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/request/DecisionApiRequest.java deleted file mode 100644 index df0e1f8..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/model/request/DecisionApiRequest.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baoying.enginex.executor.engine.model.request; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.ToString; - -@Data -@ToString(callSuper = true) -@EqualsAndHashCode(callSuper = false) -public class DecisionApiRequest { - - private String tp_code; // 调用方编码 - private String timestamp; // 精确到毫秒 - private String sign; // 签名 - private String biz_enc; // biz_data加密方式(0不加密,1加密) - private DecisionApiBizData biz_data; // 请求的业务数据,json格式的字符串 -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/service/EngineApiService.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/service/EngineApiService.java deleted file mode 100644 index 80b2034..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/service/EngineApiService.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baoying.enginex.executor.engine.service; - -import java.util.Map; - -public interface EngineApiService { - - String engineApi(Map paramJson); -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/service/EngineNodeService.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/service/EngineNodeService.java deleted file mode 100644 index 0dfd038..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/service/EngineNodeService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baoying.enginex.executor.engine.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.baoying.enginex.executor.engine.model.EngineNode; - -import java.util.List; - -public interface EngineNodeService extends IService { - - /** - * 根据版本id获取版本下的所有节点 - * @param versionId - * @return - */ - List getEngineNodeListByVersionId(Long versionId); -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/service/EngineService.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/service/EngineService.java deleted file mode 100644 index 163aecf..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/service/EngineService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baoying.enginex.executor.engine.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.baoying.enginex.executor.engine.model.Engine; - -public interface EngineService extends IService { - - /** - * 根据id查询引擎 - * @param id - * @return - */ - Engine getEngineById(Long id); -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/service/EngineVersionService.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/service/EngineVersionService.java deleted file mode 100644 index 3a16c19..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/service/EngineVersionService.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baoying.enginex.executor.engine.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.baoying.enginex.executor.engine.model.EngineVersion; - -public interface EngineVersionService extends IService { - - EngineVersion getEngineVersionById(Long versionId); - - /** - * 获取引擎正在运行中的版本 - * @param engineId - * @return - */ - EngineVersion getRunningVersion(Long engineId); - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/service/impl/EngineApiServiceImpl.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/service/impl/EngineApiServiceImpl.java deleted file mode 100644 index 215cd62..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/service/impl/EngineApiServiceImpl.java +++ /dev/null @@ -1,400 +0,0 @@ -package com.baoying.enginex.executor.engine.service.impl; - -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.baoying.enginex.executor.engine.enums.NodeTypeEnum; -import com.baoying.enginex.executor.engine.mapper.EngineResultSetMapper; -import com.baoying.enginex.executor.engine.model.Engine; -import com.baoying.enginex.executor.engine.model.EngineNode; -import com.baoying.enginex.executor.engine.model.EngineResultSet; -import com.baoying.enginex.executor.engine.model.EngineVersion; -import com.baoying.enginex.executor.engine.service.EngineApiService; -import com.baoying.enginex.executor.engine.service.EngineNodeService; -import com.baoying.enginex.executor.engine.service.EngineService; -import com.baoying.enginex.executor.engine.service.EngineVersionService; -import com.baoying.enginex.executor.node.service.impl.*; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; -import org.springframework.stereotype.Service; -import org.springframework.util.concurrent.ListenableFuture; -import org.springframework.util.concurrent.ListenableFutureCallback; -import org.springframework.web.client.AsyncRestTemplate; - -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ConcurrentHashMap; - -@Service -public class EngineApiServiceImpl implements EngineApiService { - - private static final Logger logger = LoggerFactory.getLogger(EngineApiServiceImpl.class); - - @Autowired - public EngineService engineService; - - @Resource - public EngineVersionService engineVersionService; - - @Resource - public EngineNodeService engineNodeService; - - @Resource - public EngineResultSetMapper resultSetMapper; - - @Autowired - private DecisionOptionsNode decisionOptionsNode; - - @Autowired - private RuleSetNode ruleSetNode; - - @Autowired - private GroupNode groupNode; - - @Autowired - private SandboxProportionNode sandboxProportionNode; - - @Autowired - private AsyncRestTemplate asyncRestTemplate; - - @Override - public String engineApi(Map paramJson) { - logger.info("请求参数,paramJson: {}", JSONObject.toJSONString(paramJson)); - JSONObject jsonObject = new JSONObject(); - JSONArray resultJson = new JSONArray(); - Map> featureMaps = new ConcurrentHashMap<>(); - //时间差小于等于30分钟并且鉴权成功 - if (true){ - Long organId = Long.valueOf(paramJson.get("organId").toString()); - Long engineId = Long.valueOf(paramJson.get("engineId").toString()); - //获取引擎信息 - Engine engine = engineService.getEngineById(engineId); - if(engine != null && !engine.getOrganId().equals(organId)){ - // todo 校验引擎是否为该组织所属 - } - //获取引擎正在运行中的版本 - EngineVersion engineVersion = engineVersionService.getRunningVersion(engineId); - if (engineVersion != null) { - //返回引擎下的所有节点集合 - List engineNodeList = engineNodeService.getEngineNodeListByVersionId(engineVersion.getVersionId()); - Map engineNodeMap = getEngineNodeListByMap(engineNodeList); - try { - //变量池 - Map inputParam = new ConcurrentHashMap<>(); - inputParam.putAll(JSONObject.parseObject(JSONObject.toJSONString(paramJson.get("fields")), Map.class)); - EngineNode engineNode = engineNodeMap.get("ND_START"); - if (null != engineNode && null != engineNode.getNextNodes()) { - //返回输出结果 - Map outMap = new ConcurrentHashMap<>(); - // 记录执行前全量指标 - featureMaps.put("before",inputParam); - //节点执行方法 - recursionEngineNode(inputParam, engineNodeMap.get(engineNode.getNextNodes()), engineNodeMap, outMap); - jsonObject.put("status", "0x0000"); - jsonObject.put("msg", "执行成功"); - if (outMap.containsKey("centens") && outMap.get("centens").equals("true")) { - jsonObject.put("status", "0x0006"); - jsonObject.put("msg", "获取数据失败"); - jsonObject.put("data", ""); - return jsonObject.toString(); - } - //记录执行后的全量指标 - featureMaps.put("after",inputParam); - paramJson.put("versionId",engineNode.getVersionId()); - String json = JSONObject.toJSONString(inputParam); - jsonObject.put("input", JSONObject.parseObject(json)); - - EngineResultSet resultSet = new EngineResultSet(); - resultSet.setEngine_code(engine.getCode()); - resultSet.setInput(json); - resultSet.setEngine_id(engine.getId()); - resultSet.setEngine_name(engine.getName()); - resultSet.setType(2); - resultSet.setSubVersion(engineVersion.getSubVersion()); - resultSet.setUid(String.valueOf(paramJson.get("uid"))); - resultSet.setPid(String.valueOf(paramJson.get("pid"))); - - //决策表最终结果 - if (outMap.containsKey("decisionTables")){ - jsonObject.put("decisionTablesResult", outMap.get("decisionTables").toString()); - resultSet.setDecisionTablesResult(outMap.get("decisionTables").toString()); - } - //决策树最终结果 - if (outMap.containsKey("decisionTree")){ - jsonObject.put("decisionTreeResult", outMap.get("decisionTree").toString()); - resultSet.setDecisionTreeResult(outMap.get("decisionTree").toString()); - } - // 节点终止输出 - if (outMap.containsKey("result")) { - resultSet.setResult(outMap.get("result").toString()); - //决策选项最终结果 - jsonObject.put("result", outMap.get("result").toString()); - } - - if (outMap.containsKey("blackJson")) { - resultJson.add(new JSONObject().parse(outMap.get("blackJson").toString())); - } - - if (outMap.containsKey("whiteJson")) { - resultJson.add(new JSONObject().parse(outMap.get("whiteJson").toString())); - } - - if (outMap.containsKey("ruleJson")) { - //规则集节点输出 - JSONObject ruleJson = new JSONObject(); - ruleJson.put("resultType", 2); - ruleJson.put("resultJson", outMap.get("ruleJson")); - resultJson.add(ruleJson); - } - - if (outMap.containsKey("scoreJson")) { - //评分卡输出 - JSONObject ruleJson = new JSONObject(); - ruleJson.put("resultType", 4); - ruleJson.put("resultJson", outMap.get("scoreJson")); - resultJson.add(ruleJson); - } - - if (outMap.containsKey("decisionJson")) { - //决策选项输出 - JSONObject ruleJson = new JSONObject(); - ruleJson.put("resultType", 9); - ruleJson.put("resultJson", outMap.get("decisionJson")); - resultJson.add(ruleJson); - } - - if (outMap.containsKey("childEngineJson")) { - //子引擎节点输出 - JSONObject ruleJson = new JSONObject(); - ruleJson.put("resultType", 14); - ruleJson.put("resultJson", outMap.get("childEngineJson")); - resultJson.add(ruleJson); - } - - if (outMap.containsKey("modelJson")) { - //模型节点输出 - JSONObject ruleJson = new JSONObject(); - ruleJson.put("resultType", 15); - ruleJson.put("resultJson", outMap.get("modelJson")); - resultJson.add(ruleJson); - } - - if (outMap.containsKey("decisionTablesJson")) { - //决策表输出 - JSONObject ruleJson = new JSONObject(); - ruleJson.put("resultType", 16); - ruleJson.put("resultJson", outMap.get("decisionTablesJson")); - resultJson.add(ruleJson); - } - - if (outMap.containsKey("decisionTreeJson")) { - //决策树输出 - JSONObject ruleJson = new JSONObject(); - ruleJson.put("resultType", 17); - ruleJson.put("resultJson", outMap.get("decisionTreeJson")); - resultJson.add(ruleJson); - } - - jsonObject.put("data", resultJson); - String result = JSONObject.toJSONString(jsonObject); - - JSONObject tmpJsonObject = JSONObject.parseObject(result); - tmpJsonObject.remove("input"); - resultSet.setOutput(JSONObject.toJSONString(tmpJsonObject)); - resultSetMapper.insertResultSet(resultSet); - Integer resultId = resultSet.getId(); - // 正常返回结果回调 - decisionCallback(engine.getCallbackUrl(), paramJson, result); - } - } catch (Exception e) { - logger.error("接口请求异常", e); - jsonObject.put("status", "0x0005"); - jsonObject.put("msg", "执行失败"); - jsonObject.put("data", ""); - // 异常回调 - decisionCallback(engine.getCallbackUrl(), paramJson, "执行失败"); - } - } else { - jsonObject.put("status", "0x0004"); - jsonObject.put("msg", "请求引擎不存在或尚未部署运行"); - jsonObject.put("data", ""); - } - } else { - jsonObject.put("status", "0x0001"); - jsonObject.put("msg", "鉴权失败,非法调用"); - jsonObject.put("data", ""); - } - - return jsonObject.toString(); - } - - - /** - * 递归执行节点 - * @param inputParam - * @param engineNode - * @param engineNodeMap - * @param outMap - */ - private EngineNode recursionEngineNode(Map inputParam, EngineNode engineNode, Map engineNodeMap, Map outMap) { - logger.info("请求参数--" + "inputParam:" + JSONObject.toJSONString(inputParam)); - - EngineNode resultNode = null; // 结束时返回节点: 串行流程返回null、并行流程返回聚合节点 - - if(engineNode == null){ - return null; - } - - // 获取节点所需的指标 - getNodeField(engineNode, inputParam); - // 执行节点逻辑 - runNode(engineNode, inputParam, outMap); - - //用于存储执行过的节点 - List executedNodeList = new ArrayList<>(); - if(outMap.containsKey("executedNodes")){ - executedNodeList =(List) outMap.get("executedNodes"); - } - executedNodeList.add(engineNode.getNodeId()+""); - // 更新执行过节点数组 - outMap.put("executedNodes",executedNodeList); - // 递归执行下一个节点 - if (StringUtils.isNotBlank(engineNode.getNextNodes())) { - // 串行节点执行 - EngineNode nextEngineNode = engineNodeMap.get(engineNode.getNextNodes()); - //如果输出的map里面有nextNode,则说明有分组,需要走分组下面的节点 - if (outMap.containsKey("nextNode")) { - nextEngineNode = engineNodeMap.get(outMap.get("nextNode")); - outMap.remove("nextNode"); - } - - if(nextEngineNode!=null&&nextEngineNode.getNodeType() == NodeTypeEnum.AGGREGATION.getValue()){ - // 并行节点后面的分支为多线程执行,执行到聚合节点则结束 - resultNode = nextEngineNode; - } else { - resultNode = recursionEngineNode(inputParam, nextEngineNode, engineNodeMap, outMap); - } - } - - return resultNode; - } - - - - /** - * 获取节点所需的指标 - * @param engineNode - * @param inputParam - */ - private void getNodeField(EngineNode engineNode, Map inputParam) { - switch (engineNode.getNodeType()) { - case 2: - //规则 - ruleSetNode.getNodeField(engineNode, inputParam); - break; - case 3: - //分组 - groupNode.getNodeField(engineNode, inputParam); - break; - case 9: - //决策选项 - decisionOptionsNode.getNodeField(engineNode, inputParam); - break; - default: - break; - } - } - - /** - * 执行节点逻辑 - * @param engineNode - * @param inputParam - * @param outMap - */ - private void runNode(EngineNode engineNode, Map inputParam, Map outMap) { - switch (engineNode.getNodeType()) { - case 2: - //规则 - ruleSetNode.runNode(engineNode, inputParam, outMap); - break; - case 3: - //分组 - groupNode.runNode(engineNode, inputParam, outMap); - break; - case 7: - //沙盒比例 - sandboxProportionNode.runNode(engineNode, inputParam, outMap); - break; - case 9: - //决策选项 - decisionOptionsNode.runNode(engineNode, inputParam, outMap); - break; - default: - break; - } - } - - /** - * 把引擎节点,以序号为key放入map - * - * @param nodelist 引擎节点 - * @return map - * @see - */ - private Map getEngineNodeListByMap(List nodelist) { - Map map = new HashMap<>(); - for (int i = 0; i < nodelist.size(); i++) { - map.put(nodelist.get(i).getNodeCode(), nodelist.get(i)); - } - return map; - } - - /** - * 决策流执行完回调(包括决策流正常返回结果回调、以及异常回调) - * @param url - * @param paramJson - * @param result - */ - private void decisionCallback(String url, Map paramJson, String result){ - if(StringUtils.isBlank(url)){ - return; - } - Map paramMap = new HashMap<>(); - paramMap.put("paramJson", JSONObject.toJSONString(paramJson)); - paramMap.put("result", result); - // 设置请求头 - HttpHeaders httpHeaders = new HttpHeaders(); - httpHeaders.setContentType(MediaType.APPLICATION_JSON); - // 封装请求体 - JSONObject body = JSONObject.parseObject(JSONObject.toJSONString(paramMap)); - // 封装参数和头信息 - HttpEntity httpEntity = new HttpEntity(body, httpHeaders); - ListenableFuture> future = asyncRestTemplate.postForEntity(url, httpEntity, String.class); - if(future != null){ - future.addCallback(new ListenableFutureCallback>() { - @Override - public void onFailure(Throwable throwable) { - logger.info("引擎回调异步调用失败", throwable); - } - - @Override - public void onSuccess(ResponseEntity stringResponseEntity) { - String result = stringResponseEntity.getBody(); - logger.info("引擎回调异步调用成功,result:{}", result); - } - }); - } - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/service/impl/EngineNodeServiceImpl.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/service/impl/EngineNodeServiceImpl.java deleted file mode 100644 index 9c83b83..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/service/impl/EngineNodeServiceImpl.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.baoying.enginex.executor.engine.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.baoying.enginex.executor.canal.TableEnum; -import com.baoying.enginex.executor.common.constants.Constants; -import com.baoying.enginex.executor.config.ConfigHolder; -import com.baoying.enginex.executor.engine.mapper.EngineNodeMapper; -import com.baoying.enginex.executor.engine.model.EngineNode; -import com.baoying.enginex.executor.engine.service.EngineNodeService; -import com.baoying.enginex.executor.redis.RedisManager; -import com.baoying.enginex.executor.redis.RedisUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.Comparator; -import java.util.List; -import java.util.stream.Collectors; - -@Service -public class EngineNodeServiceImpl extends ServiceImpl implements EngineNodeService { - - @Autowired - private ConfigHolder configHolder; - @Autowired - private RedisManager redisManager; - @Autowired - private EngineNodeMapper engineNodeMapper; - - @Override - public List getEngineNodeListByVersionId(Long versionId) { - List engineNodeList = null; - if(Constants.switchFlag.ON.equals(configHolder.getCacheSwitch())){ - String key = RedisUtils.getForeignKey(TableEnum.T_ENGINE_NODE, versionId); - engineNodeList = redisManager.getByForeignKey(key, EngineNode.class); - if(engineNodeList != null){ - // 按node_order升序排序 - engineNodeList = engineNodeList.stream().sorted(Comparator.comparing(EngineNode::getNodeOrder)).collect(Collectors.toList()); - } - } else { - engineNodeList = engineNodeMapper.getEngineNodeListByVersionId(versionId); - } - - return engineNodeList; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/service/impl/EngineServiceImpl.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/service/impl/EngineServiceImpl.java deleted file mode 100644 index c895603..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/service/impl/EngineServiceImpl.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.baoying.enginex.executor.engine.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.baoying.enginex.executor.canal.TableEnum; -import com.baoying.enginex.executor.common.constants.Constants; -import com.baoying.enginex.executor.config.ConfigHolder; -import com.baoying.enginex.executor.engine.mapper.EngineMapper; -import com.baoying.enginex.executor.engine.model.Engine; -import com.baoying.enginex.executor.engine.service.EngineService; -import com.baoying.enginex.executor.redis.RedisManager; -import com.baoying.enginex.executor.redis.RedisUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class EngineServiceImpl extends ServiceImpl implements EngineService { - - @Autowired - private ConfigHolder configHolder; - @Autowired - private RedisManager redisManager; - @Autowired - private EngineMapper engineMapper; - - @Override - public Engine getEngineById(Long id) { - Engine engine = null; - if(Constants.switchFlag.ON.equals(configHolder.getCacheSwitch())){ - String key = RedisUtils.getPrimaryKey(TableEnum.T_ENGINE, id); - engine = redisManager.getByPrimaryKey(key, Engine.class); - } else { - engine = engineMapper.selectById(id); - } - - return engine; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/service/impl/EngineVersionServiceImpl.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/service/impl/EngineVersionServiceImpl.java deleted file mode 100644 index f5397c8..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/service/impl/EngineVersionServiceImpl.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.baoying.enginex.executor.engine.service.impl; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.baoying.enginex.executor.canal.TableEnum; -import com.baoying.enginex.executor.common.constants.Constants; -import com.baoying.enginex.executor.config.ConfigHolder; -import com.baoying.enginex.executor.engine.mapper.EngineVersionMapper; -import com.baoying.enginex.executor.engine.model.EngineVersion; -import com.baoying.enginex.executor.engine.service.EngineVersionService; -import com.baoying.enginex.executor.redis.RedisManager; -import com.baoying.enginex.executor.redis.RedisUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.Optional; - -@Service -public class EngineVersionServiceImpl extends ServiceImpl implements EngineVersionService { - - @Autowired - private ConfigHolder configHolder; - @Autowired - private RedisManager redisManager; - @Autowired - private EngineVersionMapper engineVersionMapper; - - @Override - public EngineVersion getEngineVersionById(Long versionId) { - EngineVersion engineVersion = null; - if(Constants.switchFlag.ON.equals(configHolder.getCacheSwitch())){ - String key = RedisUtils.getPrimaryKey(TableEnum.T_ENGINE_VERSION, versionId); - engineVersion = redisManager.getByPrimaryKey(key, EngineVersion.class); - } else { - engineVersion = engineVersionMapper.selectById(versionId); - } - return engineVersion; - } - - @Override - public EngineVersion getRunningVersion(Long engineId) { - EngineVersion engineVersion = null; - if(Constants.switchFlag.ON.equals(configHolder.getCacheSwitch())){ - String key = RedisUtils.getForeignKey(TableEnum.T_ENGINE_VERSION, engineId); - List list = redisManager.getByForeignKey(key, EngineVersion.class); - Optional optional = list.stream().filter(item -> item.getBootState() == 1).findFirst(); - if(optional.isPresent()){ - engineVersion = optional.get(); - } - } else { - engineVersion = engineVersionMapper.getRunningVersion(engineId); - } - - return engineVersion; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/thread/EngineCallable.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/thread/EngineCallable.java deleted file mode 100644 index 57b75ba..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/engine/thread/EngineCallable.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.baoying.enginex.executor.engine.thread; - -import com.baoying.enginex.executor.common.basefactory.CustomBeanFactory; -import com.baoying.enginex.executor.engine.service.EngineApiService; -import org.springframework.context.ApplicationContext; - -import java.util.Map; -import java.util.concurrent.Callable; - -public class EngineCallable implements Callable { - - private Map paramJson; - - public EngineCallable(Map paramJson){ - this.paramJson = paramJson; - } - - @Override - public String call() { - ApplicationContext context = CustomBeanFactory.getContext(); - EngineApiService engineApiService = (EngineApiService) context.getBean("engineApiServiceImpl"); - String result = engineApiService.engineApi(paramJson); - return result; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/mapper/KnowledgeTreeMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/mapper/KnowledgeTreeMapper.java deleted file mode 100644 index 96ba08b..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/mapper/KnowledgeTreeMapper.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.baoying.enginex.executor.knowledge.mapper; - - -import com.baoying.enginex.executor.common.mapper.BaseMapper; -import com.baoying.enginex.executor.knowledge.model.KnowledgeTree; - -import java.util.List; -import java.util.Map; - - -public interface KnowledgeTreeMapper extends BaseMapper { - - /** - * getTreeList:(根据父节点id和组织id,查询其下的所有子节点) - * @author keke - * @param paramMap 参数集合 - * @return 父节点下的所有子节点 - * */ - public List getTreeList(Map paramMap); - - /** - * batchInsert:(批量新增节点) - * @author keke - * @param k 节点信息集合 - * @return - * */ - public int batchInsert(List k); - - /** - * getTreeList:(根据父节点id和组织id,查询其下的所有子节点,若节点下规则,则过滤掉) - * @author keke - * @param paramMap 参数集合 - * @return 父节点下的所有子节点 - * */ - public List getTreeDataForEngine(Map paramMap); -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/mapper/KnowledgeTreeMapper.xml b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/mapper/KnowledgeTreeMapper.xml deleted file mode 100644 index 6ce10bb..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/mapper/KnowledgeTreeMapper.xml +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - - - - - - - - - - - - - - - id, - name, - parent_id, - user_id, - organ_id, - engine_id, - status, - type, - tree_type, - created, - updated - - - - k.id, - k.name, - k.parent_id, - k.user_id, - k.organ_id, - k.engine_id, - k.status, - k.type, - k.tree_type, - k.created, - k.updated - - - - - - - - - insert into t_knowledge_tree (name,parent_id,user_id, - - organ_id, - - - engine_id, - - status,type,tree_type,created,updated) - values(#{name},#{parentId},#{userId}, - - #{organId}, - - - #{engineId}, - - #{status},#{type},#{treeType},now(), now()) - - - - - insert into t_knowledge_tree (name,parent_id,user_id, - - organ_id, - - - engine_id, - - status,type,tree_type,created,updated) - values(#{item.name},#{item.parentId},#{item.userId}, - - #{item.organId}, - - - #{item.engineId}, - - #{item.status},#{item.type},#{item.treeType},now(), now()) - - - - - - update t_knowledge_tree set - - name = #{name}, - - - status = #{status}, - - - type = #{type}, - - - parent_id = #{parentId}, - - updated = now() where id = #{id} - - - - \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/mapper/RuleFieldMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/mapper/RuleFieldMapper.java deleted file mode 100644 index 8e2921a..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/mapper/RuleFieldMapper.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.baoying.enginex.executor.knowledge.mapper; - - -import com.baoying.enginex.executor.common.mapper.BaseMapper; -import com.baoying.enginex.executor.engine.model.NodeKnowledge; -import com.baoying.enginex.executor.knowledge.model.Rule; -import com.baoying.enginex.executor.knowledge.model.RuleField; - -import java.util.List; -import java.util.Map; - - -public interface RuleFieldMapper extends BaseMapper { - - /** - * getFieldList : (根据规则id,,获取规则下的所有字段) - * @author keke - * @param ruleId 规则id - * @return 规则下的所有字段 - * */ - public List getFieldList(Long ruleId); - - /** - * insertField : (批量新增字段记录) - * @author keke - * @param rlist 字段信息集合 - * @return - * */ - public int insertField(List ruleFieldlist); - - /** - * updateField : (批量修改字段记录) - * @author keke - * @param rlist 字段信息集合 - * @return - * */ - public boolean updateField(List rlist); - - /** - * deleteField : (批量删除字段记录) - * @author keke - * @param rlist 字段信息集合 - * @return - * */ - public boolean deleteField(List rlist); - - - /** - * getNodeByList : (根据引擎节点得到所用字段) - * @author wenyu.cao - * @param nodeid 节点编号 - * @return 返回字段list - * */ - public List getNodeByList(NodeKnowledge knowledge); - public List getNodeByListNew(NodeKnowledge knowledge); - /** - * - * 根据规则得到规则引用字段 - * @param nodeKnowledge - * @return - * @see - */ - public List selectNodeByRuleList(NodeKnowledge nodeKnowledge); - public List selectNodeByRuleListNew(NodeKnowledge nodeKnowledge); - /** - * - * 根据规则id得到规则引用字段 - * @param paramMap 规则id集合 - * @return - * @see - */ - public List selectByRuleList(Map paramMap); - public List selectByRuleListNew(Map paramMap); -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/mapper/RuleFieldMapper.xml b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/mapper/RuleFieldMapper.xml deleted file mode 100644 index c54c5bb..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/mapper/RuleFieldMapper.xml +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - r.id , - r.logical, - r.operator, - t.field_cn as field, - r.field_value as fieldValue, - r.rule_id as ruleId, - r.field_id as fieldId, - t.field_en as fieldEn, - t.value_type as valueType, - t.value_scope as valueScope - - - - - - insert into t_rule_field - (logical,operator,field_value,rule_id,field_id) - values - - ( - #{item.logical}, - #{item.operator}, - #{item.fieldValue}, - #{item.ruleId}, - TRIM(#{item.fieldId}) - ) - - - - - - - - update t_rule_field set - - logical = #{item.logical} - - - ,operator = #{item.operator} - - - ,field_value = #{item.fieldValue} - - - ,field_id = TRIM(#{item.fieldId}) - - where id = #{item.id} - - - - - - delete from t_rule_field where id = #{item.id} - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/mapper/RuleMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/mapper/RuleMapper.java deleted file mode 100644 index 4dafceb..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/mapper/RuleMapper.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.baoying.enginex.executor.knowledge.mapper; - -import com.baoying.enginex.executor.common.mapper.BaseMapper; -import com.baoying.enginex.executor.engine.model.NodeKnowledge; -import com.baoying.enginex.executor.knowledge.model.Rule; - -import java.util.List; -import java.util.Map; - - -public interface RuleMapper extends BaseMapper { - - /** - * getRuleList:(获取规则集合) - * @author keke - * @param paramMap 参数集合 - * @return 规则集合 - * */ - public List getRuleList(Map paramMap); - - /** - * updateRuleStatus:(批量修改规则状态记录) - * @author keke - * @param paramMap 参数集合 - * @return - * */ - public int updateRuleStatus(Map paramMap); - /** - * getNodeByRuleList : (根据引擎节点得到所用规则) - * @author wenyu.cao - * @param nodeid 节点编号 - * @return 返回字段list - * */ - public List getNodeByRuleList(NodeKnowledge knowledge); - - /** - * 根据规则类型查询规则 - * @param list 规则编号 - * @return - * @see - */ - public List selectnodeByInRoleid(List list); - - /** - * 根据父节点id查找,节点下所有规则id的集合 - * @param list 规则编号 - * @return - * @see - */ - public List getRuleIdsByParentId(Map param); - - /** - * getRuleList:(查找引用了某些字段的规则集合) - * @author yuanlinfeng - * @param paramMap 参数集合 - * @return 规则集合 - * */ - public List checkByField(Map paramMap); - - /** - * 效验规则名称唯一性 - * @param param 参数集合 - * @return - * @see - */ - public int countOnlyRuleName(Map param); - - /** - * 效验规则代码唯一性 - * @param param 参数集合 - * @return - * @see - */ - public int countOnlyRuleCode(Map param); - - /** - * getFieldIdsByRuleId:(根据规则id,获取规则所用字段id和Key) - * @author keke - * @param idList 规则id集合 - * @return - * */ - public List getFieldIdsByRuleId(List idList); - - public List getRuleListByType(Map paramMap); - - public List getNodeAddOrSubRulesByNodeId(Long nodeId); - - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/mapper/RuleMapper.xml b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/mapper/RuleMapper.xml deleted file mode 100644 index 240dda7..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/mapper/RuleMapper.xml +++ /dev/null @@ -1,468 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - r.id, - r.name, - r.code, - r.description, - r.priority, - r.parent_id as parentId, - r.user_id as userId, - r.author, - u.nick_name as authorName, - r.organ_id as organId, - r.engine_id as engineId, - r.status, - r.rule_audit as ruleAudit, - r.type, - r.score, - r.last_logical as lastLogical, - r.is_non as isNon, - r.created, - r.updated, - r.rule_type, - r.result_field_en, - r.hit_field_en - - - - r.id, - r.name, - r.code, - r.description, - r.priority, - r.parent_id as parentId, - r.user_id as userId, - r.author, - u.nick_name as authorName, - r.organ_id as organId, - r.engine_id as engineId, - (CASE r. STATUS - WHEN r.id IN ( - SELECT - rule_id - FROM - t_engine_rule_rel td - WHERE - engine_id =#{engineId} - ) THEN - 1 - ELSE - 0 - END) AS status, - r.rule_audit as ruleAudit, - r.type, - r.score, - r.last_logical as lastLogical, - r.is_non as isNon, - r.created, - r.updated, - r.rule_type - - - - r.id, - r.name, - r.code, - r.description, - r.engine_id, - r.priority, - r.parent_id, - r.user_id, - r.author, - r.organ_id, - r.engine_id, - r.status, - r.type, - r.is_non, - r.rule_audit, - r.score, - r.last_logical, - r.created, - r.updated, - r.rule_type - - - - - - - - - insert into t_rule ( - name, - code, - description, - priority, - parent_id, - user_id, - author, - - content, - - - organ_id, - - - engine_id, - - - rule_audit, - - - score, - - - last_logical, - - status,type,is_non,created,updated,rule_type) - values( - #{name}, - #{code}, - #{description}, - #{priority}, - #{parentId}, - #{userId}, - #{author}, - - #{content}, - - - #{organId}, - - - #{engineId}, - - - #{ruleAudit}, - - - #{score}, - - - #{lastLogical}, - - #{status},#{type},#{isNon},now(), now(),#{ruleType} - ) - - - - update t_rule set - - name = #{name}, - - - code = #{code}, - - - content = #{content}, - - - description = #{description}, - - - priority = #{priority}, - - - status = #{status}, - - - type = #{type}, - - - is_non = #{isNon}, - - - rule_type = #{ruleType}, - - - rule_audit = #{ruleAudit}, - - - last_logical = #{lastLogical}, - - score = #{score}, - updated = now() where id = #{id} - - - - update t_rule set status = #{status} where id in - - #{item} - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/EngineRuleRel.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/EngineRuleRel.java deleted file mode 100644 index d269eeb..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/EngineRuleRel.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.baoying.enginex.executor.knowledge.model; - -import java.io.Serializable; - - -public class EngineRuleRel implements Serializable{ - - private static final long serialVersionUID = 1L; - - /** - * 主键 - * */ - private Long id; - - /** - * 引擎id - * */ - private Long engineId; - - /** - * 树形目录id - * */ - private Long ruleId; - - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public Long getEngineId() { - return engineId; - } - - public void setEngineId(Long engineId) { - this.engineId = engineId; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/KnowledgeTree.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/KnowledgeTree.java deleted file mode 100644 index 1c33108..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/KnowledgeTree.java +++ /dev/null @@ -1,227 +0,0 @@ -package com.baoying.enginex.executor.knowledge.model; - -import org.codehaus.jackson.annotate.JsonIgnore; - -import java.io.Serializable; -import java.util.Arrays; -import java.util.Date; - - -public class KnowledgeTree implements Serializable{ - - private static final long serialVersionUID = 1L; - - /** - * 主键 - * */ - private Long id; - - /** - * 目录名称 - * */ - private String name; - - /** - * 父节点id - * */ - private Long parentId; - - /** - * 创建人id - * */ - private Long userId; - - /** - * 组织id - * */ - private Long organId; - - - /** - * 引擎id - * */ - private Long engineId; - - /** - * 创建日期 - * */ - private Date created; - - /** - * 目录类型 0 : 系统的目录 1:组织的目录 2: 引擎的目录 - * */ - private Integer type; - - /** - * 树形分类:0:规则树 1:评分卡的树 2:回收站的树 - * */ - private Integer treeType; - - /** - * 状态 0 :停用 ,1 : 启用,-1:删除 - * */ - private Integer status; - - /** - * 修改日期 - * */ - private Date updated; - - /** - * 子类集合 - * */ - private KnowledgeTree[] children; - - /** - * 是否为父类 - * */ - private String isParent = "true"; - - /** - *文件夹图片路径 - * */ - private String icon=""; - - private String isLastNode=""; - - private Integer directoryType; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Long getParentId() { - return parentId; - } - - public void setParentId(Long parentId) { - this.parentId = parentId; - } - - public Long getUserId() { - return userId; - } - - public void setUserId(Long userId) { - this.userId = userId; - } - - public Long getOrganId() { - return organId; - } - - public void setOrganId(Long organId) { - this.organId = organId; - } - - public Long getEngineId() { - return engineId; - } - - public void setEngineId(Long engineId) { - this.engineId = engineId; - } - - @JsonIgnore - public Date getCreated() { - return created; - } - - public void setCreated(Date created) { - this.created = created; - } - - public Integer getType() { - return type; - } - - public void setType(Integer type) { - this.type = type; - } - - public Integer getStatus() { - return status; - } - - public void setStatus(Integer status) { - this.status = status; - } - - @JsonIgnore - public Date getUpdated() { - return updated; - } - - public void setUpdated(Date updated) { - this.updated = updated; - } - - public KnowledgeTree[] getChildren() { - return children; - } - - public void setChildren(KnowledgeTree[] children) { - this.children = children; - } - - public String getIsParent() { - return isParent; - } - - public void setIsParent(String isParent) { - this.isParent = isParent; - } - - public Integer getTreeType() { - return treeType; - } - - public void setTreeType(Integer treeType) { - this.treeType = treeType; - } - - public String getIcon() { - if((int)treeType == 2 || (int)treeType == 3){ - icon = "../resource/images/datamanage/cabage.png"; - isLastNode ="true"; - }else{ - icon = "../resource/images/authority/folder.png"; - } - return icon; - } - - public Integer getDirectoryType() { - return directoryType = type ; - } - - public String getIsLastNode() { - if((int)treeType == 2 || (int)treeType == 3){ - isLastNode ="true"; - } - return isLastNode; - } - - @Override - public String toString() { - return "KnowledgeTree [id=" + id + ", name=" + name + ", parentId=" - + parentId + ", userId=" + userId + ", organId=" + organId - + ", engineId=" + engineId + ", created=" + created + ", type=" - + type + ", treeType=" + treeType + ", status=" + status - + ", updated=" + updated + ", children=" - + Arrays.toString(children) + ", isParent=" + isParent - + ", icon=" + icon + ", isLastNode=" + isLastNode - + ", directoryType=" + directoryType + "]"; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/KnowledgeTreeRel.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/KnowledgeTreeRel.java deleted file mode 100644 index 272dd88..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/KnowledgeTreeRel.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.baoying.enginex.executor.knowledge.model; - -import java.io.Serializable; - - -public class KnowledgeTreeRel implements Serializable{ - - private static final long serialVersionUID = 1L; - - /** - * 主键 - * */ - private Long id; - - /** - * 引擎id - * */ - private Long engineId; - - /** - * 树形目录id - * */ - private Long treeId; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public Long getEngineId() { - return engineId; - } - - public void setEngineId(Long engineId) { - this.engineId = engineId; - } - - public Long getTreeId() { - return treeId; - } - - public void setTreeId(Long treeId) { - this.treeId = treeId; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/Rule.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/Rule.java deleted file mode 100644 index 594772c..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/Rule.java +++ /dev/null @@ -1,411 +0,0 @@ -package com.baoying.enginex.executor.knowledge.model; - -import java.io.Serializable; -import java.util.Date; -import java.util.List; - - -public class Rule implements Serializable,Cloneable { - - private static final long serialVersionUID = 1L; - - /** - * 主键 - * */ - private Long id; - - /** - * 名称 - * */ - private String name; - - /** - * 代码 - * */ - private String code; - - /** - * 描述 - * */ - private String description; - - /** - * 优先级 - * */ - private Integer priority; - - /** - * 父节点id - * */ - private Long parentId; - - /** - *修改人id - * */ - private Long userId; - - /** - *创建人id - * */ - private Long author; - - /** - *创建人名称 - * */ - private String authorName; - - /** - * 组织id - * */ - private Long organId; - - /** - * 引擎id - * */ - private Long engineId; - - /** - * 规则类型 0 : 系统的规则 1:组织的规则 2: 引擎的规则 - * */ - private Integer type; - - /** - * 逻辑关系"非" 0:不是非 1:是非 - * */ - private Integer isNon; - - /** - * 状态 0 :停用 ,1 : 启用,-1:删除 - * */ - private Integer status; - /** - * 审批规则 5 :通过 ,2 : 拒绝,3:人工审批 4:简化流程 - */ - public int ruleAudit; - /** - * 规则字段集合 - * */ - private List ruleFieldList; - - /** - * 规则内容集合 - * */ - private List ruleContentList; - - /** - * 创建日期 - * */ - private Date created; - - /** - * 修改日期 - * */ - private Date updated; - - /** - * 规则具体内容 - * */ - public String content; - - /** - * 0硬性拒绝规则1加减分规则 - */ - private Integer ruleType; - - /** - *得分 - */ - private Integer score; - - /** - *逻辑关系符,存储条件区域最后一个逻辑符号,值有')'、'))'、'-1' - */ - private String lastLogical; - - /** - * 引擎名 - * */ - private String engineName; - - /** - * 规则节点名称 - * */ - private String engineNodeName; - - /** - * 规则节点名称 - * */ - private Long engineNodeId; - - /** - * 区分规则集和规则 - * */ - private int showType = 0; - - public String getScoreFieldEn() { - return scoreFieldEn; - } - - public void setScoreFieldEn(String scoreFieldEn) { - this.scoreFieldEn = scoreFieldEn; - } - - private String resultFieldEn;//存放结果的字段en - - private String scoreFieldEn;//存放是否命中的字段 - - public String getResultFieldEn() { - return resultFieldEn; - } - - public void setResultFieldEn(String resultFieldEn) { - this.resultFieldEn = resultFieldEn; - } - - - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public int getRuleAudit() { - return ruleAudit; - } - - public void setRuleAudit(int ruleAudit) { - this.ruleAudit = ruleAudit; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Integer getPriority() { - return priority; - } - - public void setPriority(Integer priority) { - this.priority = priority; - } - - public Long getParentId() { - return parentId; - } - - public void setParentId(Long parentId) { - this.parentId = parentId; - } - - public Long getUserId() { - return userId; - } - - public void setUserId(Long userId) { - this.userId = userId; - } - - public Long getAuthor() { - return author; - } - - public void setAuthor(Long author) { - this.author = author; - } - - public String getAuthorName() { - return authorName; - } - - public void setAuthorName(String authorName) { - this.authorName = authorName; - } - - public Long getOrganId() { - return organId; - } - - public void setOrganId(Long organId) { - this.organId = organId; - } - - public Long getEngineId() { - return engineId; - } - - public void setEngineId(Long engineId) { - this.engineId = engineId; - } - - public Integer getType() { - return type; - } - - public void setType(Integer type) { - this.type = type; - } - - public Integer getStatus() { - return status; - } - - public void setStatus(Integer status) { - this.status = status; - } - - public List getRuleFieldList() { - return ruleFieldList; - } - - public void setRuleFieldList(List ruleFieldList) { - this.ruleFieldList = ruleFieldList; - } - - public List getRuleContentList() { - return ruleContentList; - } - - public void setRuleContentList(List ruleContentList) { - this.ruleContentList = ruleContentList; - } - - public Date getCreated() { - return created; - } - - public void setCreated(Date created) { - this.created = created; - } - - public Date getUpdated() { - return updated; - } - - public void setUpdated(Date updated) { - this.updated = updated; - } - - public Integer getIsNon() { - return isNon; - } - - public void setIsNon(Integer isNon) { - this.isNon = isNon; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public Integer getRuleType() { - if(ruleAudit == 2) { - ruleType = 0; - }else{ - ruleType = 1; - } - return ruleType; - } - - public void setRuleType(Integer ruleType) { - this.ruleType = ruleType; - } - - public Integer getScore() { - return score; - } - - public void setScore(Integer score) { - this.score = score; - } - - public String getLastLogical() { - return lastLogical; - } - - public void setLastLogical(String lastLogical) { - this.lastLogical = lastLogical; - } - - public String getEngineName() { - return engineName; - } - - public void setEngineName(String engineName) { - this.engineName = engineName; - } - - - - public String getEngineNodeName() { - return engineNodeName; - } - - public void setEngineNodeName(String engineNodeName) { - this.engineNodeName = engineNodeName; - } - - public Long getEngineNodeId() { - return engineNodeId; - } - - public void setEngineNodeId(Long engineNodeId) { - this.engineNodeId = engineNodeId; - } - - public int getShowType() { - return showType; - } - - public void setShowType(int showType) { - this.showType = showType; - } - - @Override - public Object clone() throws CloneNotSupportedException { - // TODO Auto-generated method stub - return super.clone(); - } - - @Override - public String toString() { - return "Rule [id=" + id + ", name=" + name + ", versionCode=" + code + ", description=" + description + ", priority=" - + priority + ", parentId=" + parentId + ", userId=" + userId + ", author=" + author + ", authorName=" - + authorName + ", organId=" + organId + ", engineId=" + engineId + ", type=" + type + ", isNon=" + isNon - + ", status=" + status + ", ruleAudit=" + ruleAudit + ", ruleFieldList=" + ruleFieldList - + ", ruleContentList=" + ruleContentList + ", created=" + created + ", updated=" + updated - + ", content=" + content + ", ruleType=" + ruleType + ", score=" + score + ", lastLogical=" - + lastLogical + ", engineName=" + engineName + ", engineNodeName=" + engineNodeName + ", engineNodeId=" - + engineNodeId + ", showType=" + showType + "]"; - } - - - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/RuleContent.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/RuleContent.java deleted file mode 100644 index 5b9ebd2..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/RuleContent.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.baoying.enginex.executor.knowledge.model; - - -import org.apache.commons.lang3.StringUtils; - -import java.io.Serializable; - - -public class RuleContent implements Serializable{ - - - private static final long serialVersionUID = 1L; - - /** - * 主键 - * */ - private Long id; - - /** - * 字段名 - * */ - private String field; - - /** - * 字段值 - * */ - private String fieldValue; - - /** - * 字段id - * */ - private String fieldId; - - /** - * 规则Id - * */ - private Long ruleId; - - - /** - * 关联的字段的英文名称 - * */ - private String fieldEn; - - /** - * 关联的字段的值类型 - * */ - private Integer valueType; - - /** - * 关联的字段的取值范围 - * */ - private String valueScope; - - /** - * 关联的字段的值拆解后的数组 - * */ - private String[] values; - - /** - * 类型:1 常量、2 变量 - */ - private Integer variableType; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getField() { - return field; - } - - public void setField(String field) { - this.field = field; - } - - public String getFieldValue() { - return fieldValue; - } - - public void setFieldValue(String fieldValue) { - this.fieldValue = fieldValue; - } - - public String getFieldId() { - return fieldId; - } - - public void setFieldId(String fieldId) { - this.fieldId = fieldId; - } - - public Long getRuleId() { - return ruleId; - } - - public void setRuleId(Long ruleId) { - this.ruleId = ruleId; - } - - public Integer getValueType() { - return valueType; - } - - public void setValueType(Integer valueType) { - this.valueType = valueType; - } - - public String getValueScope() { - return valueScope; - } - - public void setValueScope(String valueScope) { - this.valueScope = valueScope; - } - - public String[] getValues() { - if(!StringUtils.isBlank(valueScope)){ - if(valueType == 3){ - values = valueScope.split(","); - }else{ - values = new String[]{valueScope}; - } - }else{ - values = null; - } - return values; - } - - public String getFieldEn() { - return fieldEn; - } - - public void setFieldEn(String fieldEn) { - this.fieldEn = fieldEn; - } - - public Integer getVariableType() { - return variableType; - } - - public void setVariableType(Integer variableType) { - this.variableType = variableType; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/RuleExcel.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/RuleExcel.java deleted file mode 100644 index db444b2..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/RuleExcel.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.baoying.enginex.executor.knowledge.model; - -public class RuleExcel { - - /** - * 规则名称 - * */ - private String name; - - /** - * 规则代码 - * */ - private String code; - - /** - * 规则描述 - * */ - private String description; - - /** - * 优先级 - * */ - private Integer priority; - - /** - * 规则字段内容 - * */ - private String fieldContent; - - /** - * 规则内容 - * */ - private String content; - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public String getCode() { - return code; - } - public void setCode(String code) { - this.code = code; - } - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - public Integer getPriority() { - return priority; - } - public void setPriority(Integer priority) { - this.priority = priority; - } - public String getFieldContent() { - return fieldContent; - } - public void setFieldContent(String fieldContent) { - this.fieldContent = fieldContent; - } - public String getContent() { - return content; - } - public void setContent(String content) { - this.content = content; - } - - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/RuleField.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/RuleField.java deleted file mode 100644 index 600a143..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/RuleField.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.baoying.enginex.executor.knowledge.model; - - -import org.apache.commons.lang3.StringUtils; - -import java.io.Serializable; - - -public class RuleField implements Serializable{ - - - private static final long serialVersionUID = 1L; - - /** - * 主键 - * */ - private Long id; - - /** - * 逻辑运算符 - * */ - private String logical; - - /** - * 字段内容 - * */ - private String field; - - /** - * 运算符 - * */ - private String operator; - - /** - * 字段值 - * */ - private String fieldValue; - - /** - * 关联的规则的id - * */ - private Long ruleId; - - /** - * 关联的字段的id - * */ - private String fieldId; - - /** - * 关联的字段的英文名称 - * */ - private String fieldEn; - - /** - * 关联的字段的值类型 - * */ - private Integer valueType; - - /** - * 关联的字段的取值范围 - * */ - private String valueScope; - - /** - * 关联的字段的值拆解后的数组 - * */ - private String[] values; - - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getLogical() { - return logical; - } - - public void setLogical(String logical) { - this.logical = logical; - } - - public String getField() { - return field; - } - - public void setField(String field) { - this.field = field; - } - - public String getOperator() { - return operator; - } - - public void setOperator(String operator) { - this.operator = operator; - } - - public String getFieldValue() { - return fieldValue; - } - - public void setFieldValue(String fieldValue) { - this.fieldValue = fieldValue; - } - - public Long getRuleId() { - return ruleId; - } - - public void setRuleId(Long ruleId) { - this.ruleId = ruleId; - } - - public String getFieldId() { - return fieldId; - } - - public void setFieldId(String fieldId) { - this.fieldId = fieldId; - } - - public Integer getValueType() { - return valueType; - } - - public void setValueType(Integer valueType) { - this.valueType = valueType; - } - - public String getValueScope() { - return valueScope; - } - - public void setValueScope(String valueScope) { - this.valueScope = valueScope; - } - - public String[] getValues() { - if(!StringUtils.isBlank(valueScope)){ - if(valueType == 3){ - values = valueScope.split(","); - }else{ - values = new String[]{valueScope}; - } - }else{ - values = null; - } - return values; - } - - public String getFieldEn() { - return fieldEn; - } - - public void setFieldEn(String fieldEn) { - this.fieldEn = fieldEn; - } - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/ScoreCardJson.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/ScoreCardJson.java deleted file mode 100644 index 072e1a1..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/ScoreCardJson.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.baoying.enginex.executor.knowledge.model; - -public class ScoreCardJson { - - private String ouput; - private Integer index; - private String formula; - private String formula_show; - private String fields; - - public String getOuput() { - return ouput; - } - public void setOuput(String ouput) { - this.ouput = ouput; - } - public Integer getIndex() { - return index; - } - public void setIndex(Integer index) { - this.index = index; - } - public String getFormula() { - return formula; - } - public void setFormula(String formula) { - this.formula = formula; - } - public String getFormula_show() { - return formula_show; - } - public void setFormula_show(String formula_show) { - this.formula_show = formula_show; - } - public String getFields() { - if(fields!=null){ - fields = fields.substring(1,fields.length()-1).trim(); - } - return fields; - } - public void setFields(String fields) { - this.fields = fields; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/ScorecardExcel.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/ScorecardExcel.java deleted file mode 100644 index 27cca47..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/ScorecardExcel.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.baoying.enginex.executor.knowledge.model; - -public class ScorecardExcel { - - /** - * 评分卡名称 - * */ - private String name; - - /** - * 评分卡代码 - * */ - private String code; - - /** - * 评分卡描述 - * */ - private String description; - - /** - * 版本号 - * */ - private String version; - - /** - * 评分卡字段内容 - * */ - private String fieldContent; - - /** - * 评分卡内容 - * */ - private String content; - - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public String getCode() { - return code; - } - public void setCode(String code) { - this.code = code; - } - public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } - public String getVersion() { - return version; - } - public void setVersion(String version) { - this.version = version; - } - public String getFieldContent() { - return fieldContent; - } - public void setFieldContent(String fieldContent) { - this.fieldContent = fieldContent; - } - public String getContent() { - return content; - } - public void setContent(String content) { - this.content = content; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/ScorecardField.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/ScorecardField.java deleted file mode 100644 index 9c331e2..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/ScorecardField.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.baoying.enginex.executor.knowledge.model; - -import java.io.Serializable; - - -public class ScorecardField implements Serializable{ - - - private static final long serialVersionUID = 1L; - - /** - * 主键 - * */ - private Long id; - - /** - * 关联的评分卡的id - * */ - private Long scorecardId; - - /** - * 关联的字段id - * */ - private Long fieldId; - - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public Long getScorecardId() { - return scorecardId; - } - - public void setScorecardId(Long scorecardId) { - this.scorecardId = scorecardId; - } - - public Long getFieldId() { - return fieldId; - } - - public void setFieldId(Long fieldId) { - this.fieldId = fieldId; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/ScorecardRuleContent.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/ScorecardRuleContent.java deleted file mode 100644 index 257f76e..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/knowledge/model/ScorecardRuleContent.java +++ /dev/null @@ -1,140 +0,0 @@ -package com.baoying.enginex.executor.knowledge.model; - - -import com.alibaba.fastjson.JSONObject; - -import java.io.Serializable; - - -public class ScorecardRuleContent implements Serializable{ - - - private static final long serialVersionUID = 1L; - - /** - * 主键 - * */ - private Long id; - - /** - * 评分卡Id - * */ - private Long scorecardId; - - /** - * 字段 - * */ - private String field; - - /** - * 字段英文名称 - * */ - private String fieldEn; - - /** - * 字段值 - * */ - private String fieldValue; - - /** - * 字段id - * */ - private Long fieldId; - - /** - * 关联的字段的值类型 - * */ - private Integer valueType; - - /** - * 关联的字段的取值范围 - * */ - private String valueScope; - - /** - * 关联的字段的值拆解后的数组 - * */ - private String[] values; - - private ScoreCardJson sCardJson; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public Long getScorecardId() { - return scorecardId; - } - - public void setScorecardId(Long scorecardId) { - this.scorecardId = scorecardId; - } - - public String getField() { - return field; - } - - public void setField(String field) { - this.field = field; - } - - public String getFieldValue() { - return fieldValue; - } - - public void setFieldValue(String fieldValue) { - this.fieldValue = fieldValue; - } - - public Long getFieldId() { - return fieldId; - } - - public void setFieldId(Long fieldId) { - this.fieldId = fieldId; - } - - public Integer getValueType() { - return valueType; - } - - public void setValueType(Integer valueType) { - this.valueType = valueType; - } - - public String getValueScope() { - return valueScope; - } - - public void setValueScope(String valueScope) { - this.valueScope = valueScope; - } - - public String[] getValues() { - if(valueType == 3){ - values = valueScope.split(","); - }else{ - values = new String[]{valueScope}; - } - return values; - } - - public ScoreCardJson getsCardJson() { - sCardJson = JSONObject.parseObject(fieldValue, ScoreCardJson.class); - return sCardJson; - } - - public String getFieldEn() { - return fieldEn; - } - - public void setFieldEn(String fieldEn) { - this.fieldEn = fieldEn; - } - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/message/email/service/EmailService.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/message/email/service/EmailService.java deleted file mode 100644 index a26e901..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/message/email/service/EmailService.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baoying.enginex.executor.message.email.service; - -public interface EmailService { - /** - * 发送邮件方法 - * @param to 收件人邮件地址 - * @param subject 主题 - * @param content 邮件内容 - */ - public void sendHtmlMail(String to, String subject, String content); - - /** - * 发送模板邮件方法 - * @param to 收件人邮件地址 - * @param subject 主题 - * @param templateName 模板名称 - * @param context 追加参数集合 - */ -// public void sendTemplateMail(String to, String subject, String templateName, Context context); - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/message/email/service/impl/EmailServiceImpl.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/message/email/service/impl/EmailServiceImpl.java deleted file mode 100644 index 06f3ba1..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/message/email/service/impl/EmailServiceImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.baoying.enginex.executor.message.email.service.impl; - -import com.baoying.enginex.executor.message.email.service.EmailService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.mail.javamail.JavaMailSender; -import org.springframework.mail.javamail.MimeMessageHelper; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import javax.mail.internet.MimeMessage; - -@Service("emailService") -@Slf4j -public class EmailServiceImpl implements EmailService { - - @Resource - private JavaMailSender mailSender; - - @Value("${spring.mail.username}") - private String fromAddr; - - @Override - public void sendHtmlMail(String to, String subject, String content) { - log.info("开始发送邮件,to:{}, subject:{}, content:{}", to, subject, content); - MimeMessage message = mailSender.createMimeMessage(); - try { - //true表示需要创建一个multipart message - MimeMessageHelper helper = new MimeMessageHelper(message,true, "utf-8"); - helper.setFrom(fromAddr); - String[] split = to.split(","); - helper.setTo(split); - helper.setSubject(subject); - helper.setText(content,true); - mailSender.send(message); - log.info("邮件发送成功"); - }catch (Exception e){ - log.error("邮件发送失败",e); - } - } - - public String getFromAddr() { - return fromAddr; - } - - public void setFromAddr(String fromAddr) { - this.fromAddr = fromAddr; - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/node/service/CommonService.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/node/service/CommonService.java deleted file mode 100644 index 086d78c..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/node/service/CommonService.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.baoying.enginex.executor.node.service; - -import com.baoying.enginex.executor.datamanage.model.Field; - -import java.util.List; -import java.util.Map; - -public interface CommonService { - - boolean getFieldByIds(List ids, Map inputParam); - - /** - * 获取引擎节点所需的指标 - * @param fields - * @param engineNode - * @param inputParam - * @return - */ - boolean getEngineField(List fields, Map inputParam); - - /** - * 获取衍生指标 - * @param inputParam - */ - void getFieldResult (Map inputParam); -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/node/service/EngineNodeService.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/node/service/EngineNodeService.java deleted file mode 100644 index 4dba3b1..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/node/service/EngineNodeService.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.baoying.enginex.executor.node.service; - -import com.baoying.enginex.executor.engine.model.EngineNode; - -import java.util.Map; - -/** - * 引擎节点执行 - */ -public interface EngineNodeService { - - /** - * 获取节点所需的指标 - * @param engineNode - * @param inputParam - */ - void getNodeField(EngineNode engineNode, Map inputParam); - - /** - * 执行节点逻辑 - * @param engineNode - * @param inputParam - * @param outMap - */ - void runNode(EngineNode engineNode, Map inputParam, Map outMap); -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/node/service/impl/CommonServiceImpl.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/node/service/impl/CommonServiceImpl.java deleted file mode 100644 index 083a9e7..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/node/service/impl/CommonServiceImpl.java +++ /dev/null @@ -1,789 +0,0 @@ -package com.baoying.enginex.executor.node.service.impl; - -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.baoying.enginex.executor.common.session.SessionData; -import com.baoying.enginex.executor.common.session.SessionManager; -import com.baoying.enginex.executor.datamanage.mapper.SimpleMapper; -import com.baoying.enginex.executor.datamanage.model.Field; -import com.baoying.enginex.executor.datamanage.model.FieldCond; -import com.baoying.enginex.executor.datamanage.service.FieldService; -import com.baoying.enginex.executor.engine.model.ComplexRule; -import com.baoying.enginex.executor.node.service.CommonService; -import com.baoying.enginex.executor.util.DictVariableUtils; -import com.baoying.enginex.executor.util.ExecuteUtils; -import com.baoying.enginex.executor.util.StringUtil; -import com.baoying.enginex.executor.util.https.HttpClient; -import com.baoying.enginex.executor.util.jeval.EvaluationException; -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.math.Groovy; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.io.InputStream; -import java.math.BigDecimal; -import java.util.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -@Service -public class CommonServiceImpl implements CommonService { - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Resource - private SimpleMapper simpleMapper; - - @Autowired - public FieldService fieldService; - - @Autowired - private Groovy groovy; - - @Override - public boolean getFieldByIds(List ids, Map inputParam) { - if (ids == null || ids.size() == 0) { - return true; - } - SessionData sessionData = SessionManager.getSession(); -// Long organId = sessionData.getOrganId(); - Long organId = 46L; - List fieldList = fieldService.findFieldByIdsbyorganId(organId, ids); - List list = new ArrayList<>(); - ids = new ArrayList<>(); - for (int i = 0; i < fieldList.size(); i++) { - if (fieldList.get(i).getIsDerivative() == 1) { - ids.addAll(StringUtil.toLongList(fieldList.get(i).getOrigFieldId())); - } else - list.add(fieldList.get(i)); - } - if (ids.size() > 0) { - List lists = fieldService.findFieldByIdsbyorganId(organId, ids); - list.addAll(lists); - } - - List fields = new ArrayList<>(); - fields.addAll(list); - - this.getEngineField(fields, inputParam); - - for (Field field : fieldList) { - if (field.getIsDerivative() == 1) { - inputParam.put(field.getFieldEn(), ""); - this.getFieldResult(inputParam); - } - } - return false; - } - - /** - * 调用http请求得到引擎节点所需要的字段 - * - * @return 引擎所需字段 - * @see - */ - @Override - public boolean getEngineField(List fields, Map inputParam) { - logger.info("start getEngineField, fields:{},inputParam:{}", JSONObject.toJSONString(fields), JSONObject.toJSONString(inputParam)); - - int type = 1; - - if (null != fields && fields.size() < 1) { - return true; - } - - // 循环规则特殊处理 - List tempFields = new ArrayList<>(fields); - for (Field field : fields) { - if (field.getFieldEn().contains("[") && field.getFieldEn().contains("]")) { - String fieldEn = field.getFieldEn().substring(0, field.getFieldEn().indexOf("[")); - Field nField = new Field(); - nField.setFieldEn(fieldEn); - tempFields.add(nField); - tempFields.remove(field); - } - } - fields = new ArrayList<>(tempFields); - - // 需要调用指标系统的字段集合 - List remainFields = new ArrayList<>(fields); - - for (Field field : fields) { - if (inputParam.containsKey(field.getFieldEn())) { - // 优先从入参中获取指标 - remainFields.remove(field); - } - } - - if (null != remainFields && remainFields.size() < 1) { - return true; - } - - Properties p = new Properties(); - try { - InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("datacenter.properties"); - p.load(inputStream); - } catch (Exception e1) { - e1.printStackTrace(); - logger.error("remainFields:{},请求异常", JSONObject.toJSONString(remainFields), e1); - } - String act = p.getProperty("act"); - //随机数 - String nonce = UUID.randomUUID().toString(); - String token = p.getProperty("token"); - Date date = new Date(); - long ts = date.getTime(); -// String sign = MD5.GetMD5Code(act.trim() + "," + date.getTime() + "," + nonce.trim() + "," + pid.trim() + "," + uid.trim() + "," + token.trim()); - HttpClient httpClient = new HttpClient(); - String url = p.getProperty("url") + "?token=" + token.trim() + "&ts=" + ts + "&act=" + act.trim() + "&nonce=" + nonce.trim(); - Map pam = new HashMap<>(); - pam.put("fields", getListFieldByString(remainFields)); -// pam.put("sign", sign); - pam.put("type", String.valueOf(type)); - try { - String result = httpClient.post(url, pam); - JSONObject jsonObject = JSONObject.parseObject(result); - //返回成功状态下解析返回的字段 - if (jsonObject.getString("status").equals("0x0000")) { - JSONArray array = jsonObject.getJSONArray("data"); - - if (type == 1) { //普通规则 - for (int i = 0; i < array.size(); i++) { - JSONObject object = array.getJSONObject(i); - for (Map.Entry entry : object.entrySet()) { - inputParam.put(entry.getKey(), entry.getValue()); - } - } - return true; - } else { //复杂规则 - List list = new ArrayList(); - return true; - } - } else { - //返回状态不成功,直接返回null - return false; - } - } catch (Exception e) { - e.printStackTrace(); - logger.error("remainFields:{},请求异常", JSONObject.toJSONString(remainFields), e); - } - return false; - } - - /** - * 把list对象转换为以,号隔开的string字符串 - * - * @param list - * @return - * @see - */ - private String getListFieldByString(List list) { - String fields = ""; - for (int i = 0; i < list.size(); i++) { - fields = fields + list.get(i).getFieldEn() + ","; - } - return fields; - - } - - /** - * 根据输入字段参数返回衍生字段的结果 - * 输入:引擎id及参数列表(原生字段英文字段名和值、待计算的衍生字段只有英文字段名) - * 输出:待计算衍生字段的计算结果值 - */ - @Override - public void getFieldResult(Map paramMap) { - //参数传递中间临时Map - Map paramMap2 = new HashMap(); - for (Map.Entry entry : paramMap.entrySet()) { - if (null != entry.getValue()) - paramMap2.put(entry.getKey(), entry.getValue()); - else - paramMap2.put(entry.getKey(), ""); - } - - SessionData sessionData = SessionManager.getSession(); - Long organId = sessionData.getOrganId(); - paramMap2.put("organId", organId); - - for (Map.Entry entry : paramMap.entrySet()) { - String fieldEn = entry.getKey(); - String fieldValue = ""; - if (null != entry.getValue()) - fieldValue = String.valueOf(entry.getValue()); - - if (null == fieldValue || fieldValue.equals("")) { - - paramMap2.put("fieldEn", fieldEn); - Field field = fieldService.findByFieldEnbyorganId(organId, fieldEn); - - if (field != null) { - if (field.getIsDerivative() == 1) { - String result = ""; - paramMap2.put("fieldCn", field.getFieldCn()); - result = getExpAll(field.getFieldCn(), "", paramMap); - //单独返回数值结果会带上(),做处理去掉 - result = result.replace("(", ""); - result = result.replace(")", ""); - paramMap.put(fieldEn, result); - } - } - } - } - } - - /** - * 递归生成衍生字段嵌套的逻辑表达式或公式计算的结果 - */ - private String getExpAll(String fieldCn, String exp, Map param) { - - String result = ""; - Map param2 = new HashMap(); - for (Map.Entry entry : param.entrySet()) { - if (null != entry.getValue()) - param2.put(entry.getKey(), entry.getValue()); - else - param2.put(entry.getKey(), ""); - } - - SessionData sessionData = SessionManager.getSession(); - Long organId = sessionData.getOrganId(); - - Map paramMap = new HashMap(); - - paramMap.put("organId", organId); - paramMap.put("engineId", param.get("engineId")); - paramMap.put("fieldCn", fieldCn); - - //放大从组织通用字段拷贝生成的引擎字段里字段的获取范围,优先取引擎,没有再取组织里的(因为中文名在组织通用字段和引擎字段里有重复) - String arrFormula = ""; - Field engField = fieldService.findByFieldCnbyorganId(organId, fieldCn); - String engFormula = engField.getFormula(); - if (!engFormula.equals("") && engFormula != null) { - arrFormula = engFormula; - } - - if (arrFormula.equals("") || arrFormula == null) { //衍生字段只有条件区域 - - List fieldCondList = new ArrayList(); - List engfieldCondList = fieldService.findByFieldCnbyorganId(organId, fieldCn).getFieldCondList(); - if (engfieldCondList.size() > 0) { - fieldCondList = engfieldCondList; - } - - if (fieldCondList.size() > 0) {//需要进行条件区域逻辑运算 - for (FieldCond fieldCond : fieldCondList) {//这里的fieldCond是字段设置的逻辑运算符 - String condValue = fieldCond.getConditionValue(); - List condList = new ArrayList<>(); - condList = JSONObject.parseArray(fieldCond.getContent()); - exp = ""; - for (int j = 0; j < condList.size(); j++) { - JSONObject cond = ((JSONArray) condList).getJSONObject(j); - //[{\"fieldId\":\"31\",\"operator\":\">\",\"fieldValue\":\"1000\",\"logical\":\"&&\"},{\"fieldId\":\"31\",\"operator\":\">=\",\"fieldValue\":\"7000\"}] - paramMap.put("id", cond.getString("fieldId")); - - Field condfield = fieldService.queryById(Long.valueOf(cond.getString("fieldId"))); - if (condfield == null) { - condfield = fieldService.findByFieldCnbyorganId(organId, fieldCn); - } - - String condFieldEn = condfield.getFieldEn();//yqshouru 月收入 - String condFieldCn = condfield.getFieldCn(); - Integer condValueType = condfield.getValueType(); //1数值型 - String condFieldValue = cond.getString("fieldValue"); //1000 - String operator = cond.getString("operator"); //>大于号 - String fieldValue = param2.get(condFieldEn).toString(); //取输入变量的值 - - String logical = ""; - - if (condfield.getIsDerivative() == 0) { - if (cond.containsKey("logical")) - logical = " " + cond.getString("logical") + " "; - if (operator.equals("in")) { - //exp += "(indexOf(#{"+fieldValue+"},'"+condFieldValue+"')>0"+logical; - exp += "(indexOf('" + condFieldValue + "','" + fieldValue + "',0) >= 0)" + logical; - } else if (operator.equals("not in")) { - //exp += "(indexOf(#{"+fieldValue+"},'"+condFieldValue+"')=0"+logical; - exp += "(indexOf('" + condFieldValue + "','" + fieldValue + "',0) = -1)" + logical; - } else if (operator.equals("like")) { //交换位置 (indexOf('abc','c',0) >= 0) - exp += "(indexOf('" + fieldValue + "','" + condFieldValue + "',0) >= 0)" + logical; - } else if (operator.equals("not like")) { //(indexOf('abc','x',0) = -1) - exp += "(indexOf('" + fieldValue + "','" + condFieldValue + "',0) = -1)" + logical; - } else { - if (condValueType == 1 || condValueType == 4) { - exp += " (" + fieldValue + "" + operator + "" + condFieldValue + ") " + logical; - } else - exp += " ('" + fieldValue + "'" + operator + "'" + condFieldValue + "') " + logical; - } - } else {//衍生字段 - if (cond.containsKey("logical")) - logical = " " + cond.getString("logical") + " "; - if (operator.equals("in")) { - //exp += "(indexOf(#{"+getExpAll(condFieldCn,"",param2)+"},'"+condFieldValue+"')>0"+logical; - //(indexOf('abc','c',0) >= 0) && (indexOf('abc','x',0) = -1) - exp += "(indexOf('" + condFieldValue + "','" + getExpAll(condFieldCn, "", param2) + "',0) >= 0)" + logical; - } else if (operator.equals("not in")) { - exp += "(indexOf('" + condFieldValue + "','" + getExpAll(condFieldCn, "", param2) + "',0) = -1)" + logical; - } else if (operator.equals("like")) { //交换位置 (indexOf('abc','c',0) >= 0) - exp += "(indexOf('" + getExpAll(condFieldCn, "", param2) + "','" + condFieldValue + "',0) >= 0)" + logical; - } else if (operator.equals("not like")) { //(indexOf('abc','x',0) = -1) - exp += "(indexOf('" + getExpAll(condFieldCn, "", param2) + "','" + condFieldValue + "',0) = -1)" + logical; - } else { - if (condValueType == 1 || condValueType == 4) { - exp += " (" + getExpAll(condFieldCn, "", param2) + "" + operator + "" + condFieldValue + ") " + logical; - } else - exp += " ('" + getExpAll(condFieldCn, "", param2) + "'" + operator + "'" + condFieldValue + "') " + logical; - } - } - } - Evaluator evaluator = new Evaluator(); - String b = ""; - try { - System.out.println("========字段区域设置的的表达式输出:" + exp); - b = evaluator.evaluate(exp); - } catch (EvaluationException e) { - e.printStackTrace(); - logger.error("请求异常", e); - } - if (b.equals("1.0")) { - result = condValue; - break; //遇到一个满足条件的则跳出循环 - } - } - } - } else { //衍生字段只有公式 - List formulaList = new ArrayList<>(); - formulaList = JSONObject.parseArray(arrFormula); - for (int i = 0; i < formulaList.size(); i++) { - JSONObject formulaJson = ((JSONArray) formulaList).getJSONObject(i); - - String formula = (String) formulaJson.get("formula"); - formula = formula.replace(">", ">"); //3>=6 && 3< 12 - formula = formula.replace("<", "<"); - Pattern pattern = Pattern.compile("@[a-zA-Z0-9_\u4e00-\u9fa5()()-]+@"); - Matcher matcher = pattern.matcher(formula); - String subexp = formula; - int j = 0; - exp = ""; - // 存放groovy脚本入参 - Map data = new HashMap<>(); - //System.out.println("待替换的字段串:"+formula); - while (matcher.find()) { - String fieldCN = matcher.group(0).replace("@", ""); - Map fieldMap = new HashMap(); - paramMap.put("organId", organId); - fieldMap.put("engineId", paramMap.get("engineId")); - fieldMap.put("fieldCn", fieldCN); - fieldMap.put("organId", organId); - Field subField = fieldService.findByFieldCnbyorganId(organId, fieldCN); - - //构造字段条件区间计算输入参数 - Map paramCond = new HashMap(); - paramCond.put("fieldValue", param2.get(subField.getFieldEn())); - paramCond.put("fieldEn", subField.getFieldEn()); - paramCond.put("fieldValueType", subField.getValueType()); - - //字段条件转换 - JSONArray fieldCond = new JSONArray(); - if (formulaJson.get("farr") != null && !"".equals(formulaJson.get("farr"))) { - JSONArray jsonArr = (JSONArray) formulaJson.get("farr"); - for (Iterator iterator = jsonArr.iterator(); iterator.hasNext(); ) { - JSONObject job = (JSONObject) iterator.next(); - if (job.get("fieldCN").equals(fieldCN) && !job.get("fieldCond").equals("")) { - fieldCond = (JSONArray) job.get("fieldCond"); - break; - } - } - } - - paramCond.put("fieldCond", fieldCond); - String v = ""; - if (fieldCond.size() > 0) { - v = calcFieldCond(paramCond); - } else { - v = "" + param2.get(subField.getFieldEn()); - } - data.put(subField.getFieldEn(), param2.get(subField.getFieldEn())); - - if (subField.getIsDerivative() == 0) { -// if(subexp.indexOf("substring")>=0||subexp.indexOf("equals")>=0){ //substring(@字段A@,3,6) -// exp += subexp.substring(j, matcher.end()).replace("@"+fieldCN+"@", "'"+v+"'"); -// }else{ -// exp += subexp.substring(j, matcher.end()).replace("@"+fieldCN+"@", v); -// } - - if (subexp.contains("def main")) { - // groovy脚本替换为动态参数 - v = "_['" + subField.getFieldEn() + "']"; - exp += subexp.substring(j, matcher.end()).replace("@" + fieldCN + "@", v); - } else { - if (subField.getValueType() == 1 || subField.getValueType() == 4) { - exp += subexp.substring(j, matcher.end()).replace("@" + fieldCN + "@", v); - } else { - exp += subexp.substring(j, matcher.end()).replace("@" + fieldCN + "@", "'" + v + "'"); - } - } - - } else { - - v = getExpAll(fieldCN, exp, param2); - // 存衍生字段 - if (subField.getValueType() == 1 || subField.getValueType() == 4) { - data.put(subField.getFieldEn(), Integer.valueOf(v)); - } else { - data.put(subField.getFieldEn(), v); - } - - if (subexp.contains("def main")) { - // groovy脚本替换为动态参数 - v = "_['" + subField.getFieldEn() + "']"; - } - exp += subexp.substring(j, matcher.end()).replace("@" + fieldCN + "@", v); - } - j = matcher.end(); - } - exp += formula.substring(j, formula.length()); - Evaluator evaluator = new Evaluator(); - String b = ""; - try { -// System.out.println("========字段公式编辑设置的表达式输出:" + exp); - - if (exp.contains("def main")) { - // 执行groovy脚本 - b = groovy.execute(exp, data); -// b = String.valueOf(groovy.execute(exp, data)); - } else { - b = evaluator.evaluate(exp); - } - - } catch (EvaluationException e) { - e.printStackTrace(); - logger.error("请求异常", e); - } - - // - if (engField.getValueType().intValue() == 1 || engField.getValueType().intValue() == 2) { //数值型或者字符型字段的衍生表达式b的结果返回值0.0代表计算结果 - if (!b.equals("")) { - result = b; - if (StringUtil.isValidStr(result) && result.startsWith("'") && result.endsWith("'")) { - result = result.substring(1, result.length() - 1); - } - } - } else if (engField.getValueType().intValue() == 3) { //枚举型字段的衍生表达式b的结果返回值0.0代表false即逻辑表达式无效 - if (!b.equals("1.0") && !b.equals("0.0") && !b.equals("")) { - result = b; - if (StringUtil.isValidStr(result) && result.startsWith("'") && result.endsWith("'")) { - result = result.substring(1, result.length() - 1); - } - } - if (b.equals("1.0")) { - result = (String) formulaJson.get("fvalue"); - //result = result.substring(result.indexOf(":")+1,result.length());// a:2 取2返回 - if (isNumeric(result)) { - result = "(" + result + ")"; - } else { - result = "'" + result + "'"; - } - break; //遇到一个满足条件的则跳出循环 - } - } - - } - } - - return result; - - } - - /** - * 公式编辑里设置字段条件区域转换的通用方法 - * 输入:待转换字段的输入参数、值类型 - * 输出:输入参数所在区间对应的结果值 - */ - private String calcFieldCond(Map paramMap) { - - String fieldValue = (String) paramMap.get("fieldValue"); - Integer fieldValueType = (Integer) paramMap.get("fieldValueType"); - - String result = ""; - //[{"fieldCN":"引擎字段1-1","fieldCond":[{"inputOne":"a","inputThree":"33"},{"inputOne":"b","inputThree":"490"},{"inputOne":"c","inputThree":"50"}]}] - //[{"fieldCN":"引擎字段1-1","fieldCond":[{"inputOne":"(3,19]","inputThree":"1"},{"inputOne":"(19,200]","inputThree":"2"}]},{"fieldCN":"通用字段2贷前","fieldCond":""}] - JSONArray jsonArr = (JSONArray) paramMap.get("fieldCond"); - for (Iterator iterator = jsonArr.iterator(); iterator.hasNext(); ) { - JSONObject job = (JSONObject) iterator.next(); - String inputOne = (String) job.get("inputOne"); - String inputThree = (String) job.get("inputThree"); - - if (fieldValueType == 3) { - if (fieldValue.equals(inputOne)) { - result = inputThree; - break; - } - } else if (fieldValueType == 1 || fieldValueType == 4) { - //(40,50] - Double lv = Double.parseDouble(inputOne.substring(1, inputOne.indexOf(","))); - Double rv = Double.parseDouble(inputOne.substring(inputOne.indexOf(",") + 1, inputOne.length() - 1)); - - String exp = ""; - if (inputOne.startsWith("(") && !lv.equals("")) { - exp = fieldValue + ">" + lv; - } - if (inputOne.startsWith("[") && !lv.equals("")) { - exp = fieldValue + ">=" + lv; - } - if (inputOne.endsWith(")") && !rv.equals("")) { - if (exp.equals("")) - exp += fieldValue + "<" + rv; - else - exp += "&&" + fieldValue + "<" + rv; - } - if (inputOne.endsWith("]") && !rv.equals("")) { - if (exp.equals("")) - exp += fieldValue + "<=" + rv; - else - exp += "&&" + fieldValue + "<=" + rv; - } - - Evaluator evaluator = new Evaluator(); - String b = ""; - try { - b = evaluator.evaluate(exp); - } catch (EvaluationException e) { - e.printStackTrace(); - logger.error("请求异常", e); - } - if (b.equals("1.0")) { - result = inputThree; - break; //遇到一个满足条件的则跳出循环 - } - } - } - return result; - } - - /** - * 判断表达式的运算结果是否数值型的公共方法 - */ - public boolean isNumeric(String str) { - Pattern pattern = Pattern.compile("^(-|\\+)?\\d+(\\.\\d+)?$"); - Matcher isNum = pattern.matcher(str); - if (!isNum.matches()) { - return false; - } - return true; - } - - private Map getSqlFieldParam(Field field, Map inputParam, Map parameterMap) { - String sqlStr = field.getSqlStatement(); - // 添加动态参数 - //处理in方法中的遍历 - Pattern sqlInPattern = Pattern.compile("[\\s]*in[\\s]*\\([\\s]*#\\{([a-zA-Z0-9_\u4e00-\u9fa5()()-]+)\\}[\\s]*\\)"); - Matcher sqlInMatcher = sqlInPattern.matcher(sqlStr); - while (sqlInMatcher.find()) { - String replaceOld = sqlInMatcher.group(0); - String sqlField = sqlInMatcher.group(1); - String sqlVariable = field.getSqlVariable(); - String fieldEn = sqlField.split("\\.")[0]; - String convertStr = ""; - Object value = null; - if (StringUtils.isNotBlank(sqlVariable)) { - JSONArray sqlVariableArr = JSONArray.parseArray(sqlVariable); - for (int i = 0; i < sqlVariableArr.size(); i++) { - JSONObject sqlVariableObj = sqlVariableArr.getJSONObject(i); - if (sqlField.equals(sqlVariableObj.getString("key"))) { - value = sqlVariableObj.getJSONArray("value"); - } - } - } - if (value == null) { - if (!inputParam.containsKey(fieldEn)) { - //不存再需要重新获取 - List fieldEns = new ArrayList<>(); - fieldEns.add(fieldEn); - //查询未入参的en是否是指标库中的指标,如果是则u需要继续查找 - List fieldList = fieldService.selectFieldListByEns(fieldEns); - if (fieldList != null && !fieldList.isEmpty()) { - //查询引用到的指标 - getEngineField(fieldList, inputParam); - } - - } -// value = inputParam.get(sqlField); - value = ExecuteUtils.getObjFromMap(inputParam, sqlField); - } - if (StringUtils.isBlank(convertStr) && value != null) { - if (value instanceof String) { - convertStr = value.toString(); - } else if (value instanceof List) { - List collection = (List) value; - int size = collection.size(); - - for (int i = 0; i < size; i++) { - convertStr += ("'" + String.valueOf(collection.get(i)) + "'"); - if (i < size - 1) { - convertStr += ","; - } - } - } - } - sqlStr = sqlStr.replace(replaceOld, " in (" + convertStr + ") "); - } - Pattern pattern = Pattern.compile("#\\{[a-zA-Z0-9_\u4e00-\u9fa5()()-]+\\}"); - Matcher matcher = pattern.matcher(sqlStr); - while (matcher.find()) { - String sqlField = matcher.group(0).replace("#{", "").replace("}", ""); - String fieldEn = sqlField.split("\\.")[0]; - // sql动态参数从页面配置获取 - String sqlVariable = field.getSqlVariable(); - if (StringUtils.isNotBlank(sqlVariable)) { - JSONArray sqlVariableArr = JSONArray.parseArray(sqlVariable); - for (int i = 0; i < sqlVariableArr.size(); i++) { - JSONObject sqlVariableObj = sqlVariableArr.getJSONObject(i); - if (sqlField.equals(sqlVariableObj.getString("key"))) { - parameterMap.put(sqlField, sqlVariableObj.get("value")); - } - } - } - - // sql动态参数从变量池获取 - if (!parameterMap.containsKey(fieldEn)) { - if (!inputParam.containsKey(fieldEn)) { - //不存再需要重新获取 - List fieldEns = new ArrayList<>(); - fieldEns.add(fieldEn); - //查询未入参的en是否是指标库中的指标,如果是则u需要继续查找 - List fieldList = fieldService.selectFieldListByEns(fieldEns); - if (fieldList != null && !fieldList.isEmpty()) { - //查询引用到的指标 - getEngineField(fieldList, inputParam); - } - - } - parameterMap.put(sqlField, ExecuteUtils.getObjFromMap(inputParam, sqlField)); - } - } - Pattern pattern$ = Pattern.compile("\\$\\{[a-zA-Z0-9_\u4e00-\u9fa5()()-]+\\}"); - Matcher matcher$ = pattern$.matcher(sqlStr); - while (matcher$.find()) { - String sqlField = matcher$.group(0).replace("${", "").replace("}", ""); - String fieldEn = sqlField.split("\\.")[0]; - // sql绑定参数从页面配置获取 - String sqlVariable = field.getSqlVariable(); - String dictVariable = field.getDictVariable(); - String replaceStr = ""; - if (StringUtils.isNotBlank(sqlVariable)) { - JSONArray sqlVariableArr = JSONArray.parseArray(sqlVariable); - for (int i = 0; i < sqlVariableArr.size(); i++) { - JSONObject sqlVariableObj = sqlVariableArr.getJSONObject(i); - - if (!sqlField.equals(sqlVariableObj.getString("key"))) { - continue; - } - if (inputParam.containsKey(fieldEn)) { - replaceStr = ExecuteUtils.getObjFromMap(inputParam, sqlField).toString(); - } else if (sqlVariableObj.get("value") != null) { - replaceStr = String.valueOf(sqlVariableObj.get("value")); - } - if (StringUtils.isNotBlank(replaceStr)) { - break; - } - - } - } - if (StringUtils.isNotBlank(dictVariable)){ - JSONArray jsonArray = JSONArray.parseArray(dictVariable); - for (int i = 0; i < jsonArray.size(); i++) { - JSONObject jsonObject = jsonArray.getJSONObject(i); - if (!sqlField.equals(jsonObject.getString("key"))) { - continue; - } -// if (inputParam.containsKey(fieldEn)) { -// replaceStr = ExecuteUtils.getObjFromMap(inputParam, sqlField).toString(); -// } else -// if (jsonObject.get("value") != null) { -// switch (jsonObject.getString("type")){ -// case "date": -// try { -// replaceStr = DateUtil.format(new Date(),jsonObject.getString("value")); -// }catch (Exception e){ -// e.printStackTrace(); -// replaceStr = DateUtil.format(new Date(),"yyyyMMdd"); -// } -// break; -// default: -// replaceStr = String.valueOf(jsonObject.get("value")); -// } -// } - replaceStr = DictVariableUtils.getValueFromJsonObject(jsonObject).toString(); - if (StringUtils.isNotBlank(replaceStr)) { - break; - } - } - } - if (StringUtils.isNotBlank(replaceStr)) { - //已经取出则直接跳过 - sqlStr = sqlStr.replace("${" + sqlField + "}", replaceStr); - continue; - } - // sql动态参数从变量池获取 - if (!parameterMap.containsKey(fieldEn)) { - if (!inputParam.containsKey(fieldEn)) { - //不存再需要重新获取 - //查询未入参的en是否是指标库中的指标,如果是则u需要继续查找 - List fieldList = fieldService.selectFieldListByEns(Arrays.asList(fieldEn)); - if (fieldList != null && !fieldList.isEmpty()) { - //查询引用到的指标 - getEngineField(fieldList, inputParam); - } - } - replaceStr = ExecuteUtils.getObjFromMap(inputParam, sqlField).toString(); - } - if (StringUtils.isNotBlank(replaceStr)) { - sqlStr = sqlStr.replace("${" + sqlField + "}", replaceStr); - break; - } - } - parameterMap.put("sqlStr", sqlStr); - return parameterMap; - } - - private Object handlerSqlFieldResult(Field field, Map parameterMap) { - List> result = simpleMapper.customSelect(parameterMap); - Object resultValue = null; - if (result == null || result.size() == 0) { - resultValue = null; - } else { - //json类型的数据 - if (field.getValueType() == 6) { - String json = field.getJsonValue(); - //示例数据为数组 - if (StringUtils.isNotBlank(json) && json.startsWith("[") && json.endsWith("]")) { - resultValue = result; - } else { - resultValue = result.get(0); - } - } else if (result.size() == 1) {// 基本指标只能是一个值。所以只能取sql查出来的第一个值。否则抛出异常 - LinkedHashMap resultMap = result.get(0); - if (resultMap.size() == 1) { - for (Map.Entry entry : resultMap.entrySet()) { - Object value = entry.getValue(); - - // 防止double表示为科学计数法 - if (value instanceof Double) { - value = BigDecimal.valueOf((Double) value); - } - resultValue = value.toString(); - } - } else { - throw new RuntimeException("sql库指标计算异常,sql字段个数超出预期。查询结果resultMap:" + resultMap.toString()); - } - } else { - throw new RuntimeException("sql库指标计算异常,sql结果个数超出预期。查询结果result:" + result.toString()); - } - } - return resultValue; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/node/service/impl/DecisionOptionsNode.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/node/service/impl/DecisionOptionsNode.java deleted file mode 100644 index 6958bd6..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/node/service/impl/DecisionOptionsNode.java +++ /dev/null @@ -1,144 +0,0 @@ -package com.baoying.enginex.executor.node.service.impl; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.baoying.enginex.executor.engine.model.EngineNode; -import com.baoying.enginex.executor.node.service.CommonService; -import com.baoying.enginex.executor.node.service.EngineNodeService; -import com.baoying.enginex.executor.util.JevalUtil; -import com.baoying.enginex.executor.util.jeval.EvaluationException; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * 决策选项节点 - */ -@Service -public class DecisionOptionsNode implements EngineNodeService { - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - private CommonService commonService; - - @Override - public void getNodeField(EngineNode engineNode, Map inputParam) { - logger.info("start【获取决策选项节点指标】DecisionOptionsNode.getNodeField engineNode:{},inputParam:{}", JSONObject.toJSONString(engineNode), JSONObject.toJSONString(inputParam)); - JSONObject jsonObject = JSONObject.parseObject(engineNode.getNodeScript()); - JSONArray array = jsonObject.getJSONArray("input"); - List ids = new ArrayList<>(); - for (int i = 0; i < array.size(); i++) { - JSONObject input = array.getJSONObject(i); - Object fieldId = input.get("field_id"); - if(fieldId != null && !"".equals(fieldId.toString())){ - ids.add(Long.valueOf(fieldId.toString())); - } - } - commonService.getFieldByIds(ids, inputParam); - } - - @Override - public void runNode(EngineNode engineNode, Map inputParam, Map outMap) { - //监控信息--节点信息记录(不需要策略层面的监控) - outMap.put("nodeSnapshot",JSON.parseObject(engineNode.getNodeJson())); - JSONObject nodeInfo = new JSONObject(); - nodeInfo.put("engineNode",engineNode); - nodeInfo.put("nodeId",engineNode.getNodeId()); - nodeInfo.put("nodeName",engineNode.getNodeName()); - nodeInfo.put("nodeType",engineNode.getNodeType()); - outMap.put("nodeInfo",nodeInfo); - JSONObject jsonObject = JSONObject.parseObject(engineNode.getNodeScript()); - JSONArray inputArray = jsonObject.getJSONArray("input"); - List inputList = JSONObject.parseArray(JSONObject.toJSONString(jsonObject.getJSONArray("input")), JSONObject.class); - JSONArray conditionArray = jsonObject.getJSONArray("conditions"); - JSONObject outputJson = jsonObject.getJSONObject("output"); - - // 变量值转义 - Map variablesMap = new HashMap<>(); - for (int i = 0; i < inputArray.size(); i++) { - String input = inputArray.get(i).toString(); - JSONObject inputField = JSONObject.parseObject(input); - String field_code = inputField.getString("field_code"); - Map fieldsMap = new HashMap<>(); - fieldsMap.put(field_code, inputField.getInteger("valueType")); - variablesMap.put(field_code, inputParam.get(field_code)); - variablesMap = JevalUtil.convertVariables(fieldsMap, variablesMap); - } - - // 默认值处理 - String dicisionResult =""; - String defaultValue = outputJson.getString("defaultValue"); - if (StringUtils.isNotBlank(defaultValue)){ - dicisionResult = defaultValue; - } - // 决策条件判断 - if(conditionArray != null && conditionArray.size() > 0){ - for (int i = 0; i < conditionArray.size(); i++) { - JSONObject formulaJson = JSONObject.parseObject(conditionArray.getString(i)); - try { - boolean outfieldvalue = JevalUtil.evaluateBoolean(formulaJson.getString("formula"), variablesMap); - if (outfieldvalue) { - dicisionResult = formulaJson.getString("result"); - // 输出结果计算 - String result = formulaJson.getString("result"); - if(result.contains("{") && result.contains("}")){ - String expression = result; - Pattern pattern = Pattern.compile("\\{[a-zA-Z0-9_\u4e00-\u9fa5()()-]+\\}"); - Matcher matcher = pattern.matcher(expression); - while (matcher.find()) { - String asName = matcher.group(0).replace("{", "").replace("}", ""); - Optional inputObj = inputList.stream().filter(item -> asName.equals(item.getString("asName"))).findFirst(); - if(inputObj.isPresent()){ - String field_code = inputObj.get().getString("field_code"); - expression = expression.replaceAll(asName, field_code); - } - } - expression = expression.replaceAll("\\{", "#{"); - Double calResult = JevalUtil.evaluateNumric(expression, variablesMap); - dicisionResult = calResult.toString(); - } - - break; - } - } catch (EvaluationException e) { - e.printStackTrace(); - logger.error("请求异常", e); - } - } - } - - Map outFields = new HashMap<>(); - String outputFieldCode = outputJson.getString("field_code"); - outFields.put("fieldId", outputJson.getIntValue("field_id")); - outFields.put("fieldName", outputJson.getString("field_name")); - outFields.put("fieldCode", outputFieldCode); - outFields.put("outValue", dicisionResult); - outMap.put("result", dicisionResult); - String key = engineNode.getNodeType() + "_" + engineNode.getNodeId() + "_result"; - inputParam.put(key, dicisionResult); - inputParam.put(outputFieldCode, dicisionResult); - - JSONObject json = new JSONObject(); - json.put("nodeId", engineNode.getNodeId()); - json.put("nodeName", engineNode.getNodeName()); - json.put("outFields", JSONObject.parseObject(JSON.toJSONString(outFields))); - //监控中心===》hbase中写入结果信息 - outMap.put("nodeResult",json); - if (outMap.containsKey("decisionJson")) { - JSONArray resultJson = (JSONArray) outMap.get("decisionJson"); - resultJson.add(json); - } else { - JSONArray resultJson = new JSONArray(); - resultJson.add(json); - outMap.put("decisionJson", resultJson); - } - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/node/service/impl/GroupNode.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/node/service/impl/GroupNode.java deleted file mode 100644 index ff0abd6..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/node/service/impl/GroupNode.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.baoying.enginex.executor.node.service.impl; - -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.baoying.enginex.executor.common.constants.CommonConst; -import com.baoying.enginex.executor.engine.model.EngineNode; -import com.baoying.enginex.executor.node.service.CommonService; -import com.baoying.enginex.executor.node.service.EngineNodeService; -import com.baoying.enginex.executor.util.JevalUtil; -import com.baoying.enginex.executor.util.jeval.EvaluationException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Service -public class GroupNode implements EngineNodeService { - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - private CommonService commonService; - - @Override - public void getNodeField(EngineNode engineNode, Map inputParam) { - logger.info("start【获取分组节点指标】GroupNode.getNodeField engineNode:{},inputParam:{}", JSONObject.toJSONString(engineNode), JSONObject.toJSONString(inputParam)); - JSONObject jsonObject = JSONObject.parseObject(engineNode.getNodeScript()); - JSONArray array = jsonObject.getJSONArray("fields"); - List ids = new ArrayList<>(); - for (int i = 0; i < array.size(); i++) { - JSONObject input = array.getJSONObject(i); - Object fieldId = input.get("fieldId"); - if(fieldId != null && !"".equals(fieldId.toString())){ - ids.add(Long.valueOf(fieldId.toString())); - } - } - commonService.getFieldByIds(ids, inputParam); - } - - @Override - public void runNode(EngineNode engineNode, Map inputParam, Map outMap) { - JSONObject jsonScript = JSONObject.parseObject(engineNode.getNodeScript()); - //监控中心--节点信息记录(不需要策略层面的监控) - outMap.put("nodeSnapshot",JSONObject.parse(engineNode.getNodeJson())); - JSONObject nodeInfo = new JSONObject(); - nodeInfo.put("engineNode",engineNode); - nodeInfo.put("nodeId",engineNode.getNodeId()); - nodeInfo.put("nodeName",engineNode.getNodeName()); - nodeInfo.put("nodeType",engineNode.getNodeType()); - outMap.put("nodeInfo",nodeInfo); - try { - String nextNode = handleClassify(jsonScript, inputParam); - outMap.put("nextNode", nextNode); - JSONObject result = new JSONObject(); - result.put("nodeResult",nextNode); - outMap.put("nodeResult",result); - } catch (EvaluationException e) { - e.printStackTrace(); - logger.error("请求异常", e); - } - } - - private static String handleClassify(JSONObject jsonScript, Map inputParam) throws EvaluationException { - JSONArray conditions = jsonScript.getJSONArray("conditions"); - JSONArray fields = jsonScript.getJSONArray("fields"); - Map variablesMap = new HashMap<>(); - variablesMap.putAll(inputParam); - Map fieldsMap = new HashMap<>(); - for(int i = 0; i < fields.size(); i++){ - JSONObject jsonObject = fields.getJSONObject(i); - fieldsMap.put(jsonObject.getString("fieldCode"), jsonObject.getIntValue("valueType")); - } - JevalUtil.convertVariables(fieldsMap, variablesMap); - - String nextNode = ""; - if (conditions == null || conditions.isEmpty()) { - //TODO 如果为空,如何处理 - return nextNode; - } else { - int size = conditions.size(); - boolean flag = false; - JSONObject formula = null; - for (int i = 0; i < size; i++) { - formula = conditions.getJSONObject(i); - //公式为空,则为else条件分支 - if (CommonConst.STRING_EMPTY.equals(formula.getString("formula"))) { - //else条件 - if (nextNode.equals(CommonConst.STRING_EMPTY)) { - nextNode = formula.getString("nextNode"); - } - } else { - //正常条件分支 - flag = JevalUtil.evaluateBoolean(formula.getString("formula"), variablesMap); - if (flag) { - nextNode = formula.getString("nextNode"); - break; - } - } - } - return nextNode; - } - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/node/service/impl/RuleSetNode.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/node/service/impl/RuleSetNode.java deleted file mode 100644 index 971aacf..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/node/service/impl/RuleSetNode.java +++ /dev/null @@ -1,866 +0,0 @@ -package com.baoying.enginex.executor.node.service.impl; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.baoying.enginex.executor.common.constants.CommonConst; -import com.baoying.enginex.executor.common.constants.Constants; -import com.baoying.enginex.executor.common.ksession.KSessionPool; -import com.baoying.enginex.executor.common.model.ExpressionParam; -import com.baoying.enginex.executor.datamanage.model.Field; -import com.baoying.enginex.executor.datamanage.service.FieldService; -import com.baoying.enginex.executor.engine.model.EngineNode; -import com.baoying.enginex.executor.engine.model.InputParam; -import com.baoying.enginex.executor.engine.model.Result; -import com.baoying.enginex.executor.node.service.CommonService; -import com.baoying.enginex.executor.node.service.EngineNodeService; -import com.baoying.enginex.executor.redis.RedisManager; -import com.baoying.enginex.executor.rule.consts.RuleConst; -import com.baoying.enginex.executor.rule.model.RuleInfo; -import com.baoying.enginex.executor.rule.model.RuleLoopGroupAction; -import com.baoying.enginex.executor.rule.model.RuleScriptVersion; -import com.baoying.enginex.executor.rule.model.vo.RuleConditionVo; -import com.baoying.enginex.executor.rule.model.vo.RuleVersionVo; -import com.baoying.enginex.executor.rule.service.*; -import com.baoying.enginex.executor.tactics.consts.TacticsType; -import com.baoying.enginex.executor.util.ExecuteUtils; -import com.baoying.enginex.executor.util.JevalUtil; -import com.baoying.enginex.executor.util.MD5; -import com.baoying.enginex.executor.util.jeval.EvaluationException; -import org.apache.commons.lang3.StringUtils; -import org.drools.runtime.StatefulKnowledgeSession; -import org.drools.runtime.rule.FactHandle; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.*; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.ExecutionException; -import java.util.stream.Collectors; - -@Service -public class RuleSetNode implements EngineNodeService { - - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Autowired - private CommonService commonService; - @Autowired - private RuleFieldInfoService ruleFieldInfoService; - @Resource - private RuleService ruleService; - @Autowired - private RuleConditionService conditionService; - @Resource - private RuleScriptVersionService ruleScriptVersionService; - @Resource - private FieldService fieldService; - @Autowired - private RuleVersionService versionService; - @Autowired - private ThreadPoolTaskExecutor threadPoolTaskExecutor; - @Autowired - private KSessionPool kSessionPool; - @Autowired - private RedisManager redisManager; - - @Override - public void getNodeField(EngineNode engineNode, Map inputParam) { - logger.info("start【获取规则集节点指标】RuleSetNode.getNodeField engineNode:{},inputParam:{}", JSONObject.toJSONString(engineNode), JSONObject.toJSONString(inputParam)); - JSONObject nodeJson = JSONObject.parseObject(engineNode.getNodeJson()); - List ids = new ArrayList<>(); - List ruleIds = new ArrayList<>(); // 基础规则集 - List versionIds = new ArrayList<>(); // 复杂规则集 - List scriptVersionIds = new ArrayList<>(); // 脚本规则集 - - JSONArray jsonArray = null; - int groupType = nodeJson.getInteger("groupType"); - if (groupType == Constants.ruleNode.MUTEXGROUP) { - jsonArray = nodeJson.getJSONObject("mutexGroup").getJSONArray("rules"); - } else { - jsonArray = nodeJson.getJSONObject("executeGroup").getJSONArray("rules"); - } - - for (int i = 0; i < jsonArray.size(); i++) { - JSONObject ruleObj = jsonArray.getJSONObject(i); - Long versionId = ruleObj.getLong("ruleVersionId"); - Long ruleId = ruleObj.getLong("id"); - Long difficulty = ruleObj.getLong("difficulty"); - if (difficulty != null && difficulty == 3) { - scriptVersionIds.add(versionId); // 脚本式规则 - } else if (versionId != null) { - versionIds.add(versionId); // 复杂规则 - } else if (ruleId != null) { - ruleIds.add(ruleId); // 简单规则 - } - } - - //获取字段en - List fieldEnList = new ArrayList<>(); - if (!ruleIds.isEmpty()) { - fieldEnList.addAll(ruleFieldInfoService.getFieldEnList(ruleIds)); - } - if (!versionIds.isEmpty()) { - fieldEnList.addAll(conditionService.queryFieldEnByVersionIds(versionIds)); - } - if (!scriptVersionIds.isEmpty()) { - fieldEnList.addAll(ruleScriptVersionService.queryFieldEnByVersionIds(scriptVersionIds)); - } - - //筛选调那些循环或者嵌套中的字段 - fieldEnList = fieldEnList.stream().distinct().filter(f -> f != null && !f.contains(".") && !f.contains("%")).collect(Collectors.toList()); - if (fieldEnList != null && !fieldEnList.isEmpty()) { - List fieldList = fieldService.selectFieldListByEns(fieldEnList); - for (Field field : fieldList) { - ids.add(field.getId()); - } - } - - if (!ids.isEmpty()) { - commonService.getFieldByIds(ids, inputParam); - } - } - - @Override - public void runNode(EngineNode engineNode, Map inputParam, Map outMap) { - JSONObject nodeJson = JSONObject.parseObject(engineNode.getNodeJson()); - //监控中心--记录节点快照信息 - if (engineNode != null && engineNode.getSnapshot() != null) { - outMap.put("nodeSnapshot", engineNode.getSnapshot()); - } - JSONObject nodeInfo = new JSONObject(); - nodeInfo.put("engineNode", engineNode); - nodeInfo.put("nodeId", engineNode.getNodeId()); - nodeInfo.put("nodeName", engineNode.getNodeName()); - nodeInfo.put("nodeType", engineNode.getNodeType()); - outMap.put("nodeInfo", nodeInfo); - int groupType = nodeJson.getInteger("groupType") == null ? Constants.ruleNode.EXECUTEGROUP : nodeJson.getInteger("groupType"); - CopyOnWriteArrayList ruleResultList = new CopyOnWriteArrayList<>();// 规则执行结果集合 - List ruleHitList = new ArrayList<>(); // 命中的规则集合 - - // 互斥组(串行) - if (groupType == Constants.ruleNode.MUTEXGROUP) { - JSONArray jsonArray = nodeJson.getJSONObject("mutexGroup").getJSONArray("rules"); - List ruleInfoList = getRuleFromJsonArray(jsonArray); - //监控中心--循环获取策略层面的快照信息 - recordStrategySnopshot(ruleInfoList, outMap); - ruleHitList = serialRule(inputParam, outMap, ruleInfoList, ruleResultList); - } - // 执行组(并行) - else if (groupType == Constants.ruleNode.EXECUTEGROUP) { - JSONArray jsonArray = nodeJson.getJSONObject("executeGroup").getJSONArray("rules"); - List ruleInfoList = getRuleFromJsonArray(jsonArray); - //监控中心--循环获取策略层面的快照信息 - recordStrategySnopshot(ruleInfoList, outMap); - ruleHitList = parallelRule(inputParam, outMap, ruleInfoList, ruleResultList); - } - - // 终止条件处理 - terminalCondition(engineNode, nodeJson, outMap, ruleHitList); - - JSONObject jsonObject = new JSONObject(); - jsonObject.put("nodeId", engineNode.getNodeId()); - jsonObject.put("nodeName", engineNode.getNodeName()); - jsonObject.put("ruleResultList", ruleResultList); - - if (outMap.containsKey("ruleJson")) { - JSONArray resultJson = (JSONArray) outMap.get("ruleJson"); - resultJson.add(jsonObject); - } else { - JSONArray resultJson = new JSONArray(); - resultJson.add(jsonObject); - outMap.put("ruleJson", resultJson); - } - int hitSize = 0; - double scoreSum = 0d; - for (Map map : ruleResultList) { - Object ruleScore = map.get("ruleScore"); - Object ruleResult = map.get("ruleResult"); - if (null != ruleResult && "命中".equals(ruleResult)) { - hitSize++; - if (null != ruleScore) { - try { - scoreSum += Double.valueOf(ruleScore.toString()); - } catch (Exception e) { - continue; - } - } - } - } - String hitKey = "" + engineNode.getNodeType() + "_" + engineNode.getNodeId() + "_size"; - String scoreKey = "" + engineNode.getNodeType() + "_" + engineNode.getNodeId() + "_score"; - inputParam.put(hitKey, hitSize); - inputParam.put(scoreKey, scoreSum); - //监控中心==》记录节点输出结果 - //记录整个规则集中的所有规则的命中情况,以及总的统计次数 放到输出变量池 - JSONObject nodeResult = new JSONObject(); - nodeResult.put("ruleResultList", ruleResultList); - nodeResult.put("hitNum", hitSize); - nodeResult.put("scoreTotal", scoreSum); - outMap.put("nodeResult", nodeResult); - } - - /** - * 监控中心--获取策略层面快照信息 - * - * @param ruleInfoList - * @param outMap - */ - private void recordStrategySnopshot(List ruleInfoList, Map outMap) { - JSONArray jsonObject = new JSONArray(); - ruleInfoList.stream().forEach(ruleInfo -> { - if (ruleInfo.getVersion().getSnapshot() != null) { - jsonObject.add(ruleInfo.getVersion().getSnapshot()); - - } - }); - JSONObject jsonObject1 = new JSONObject(); - jsonObject1.put("snopshot", jsonObject); - outMap.put("strategySnopshot", jsonObject1); - } - - /** - * 串行执行规则 - * - * @param inputParam - * @param outMap - * @param ruleInfoList - * @param ruleResultList - * @return - */ - private List serialRule(Map inputParam, Map outMap, List ruleInfoList, CopyOnWriteArrayList ruleResultList) { - logger.info("请求参数--串行执行规则" + "map:" + JSONObject.toJSONString(inputParam)); - List resultList = new ArrayList<>(); - for (int i = 0; i < ruleInfoList.size(); i++) { - RuleInfo rule = ruleInfoList.get(i); - boolean hitFlag = executeByDifficulty(inputParam, outMap, rule, ruleResultList); - if (hitFlag) { - resultList.add(rule); - break; - } - } - return resultList; - } - - - /** - * 并行执行规则 - * - * @param inputParam - * @param outMap - * @param ruleInfoList - * @param ruleResultList - * @return - */ - private List parallelRule(Map inputParam, Map outMap, List ruleInfoList, CopyOnWriteArrayList ruleResultList) { - logger.info("请求参数--并行执行规则" + "map:" + JSONObject.toJSONString(inputParam)); - List resultList = new ArrayList<>(); - List> futureList = new ArrayList<>(); - for (int i = 0; i < ruleInfoList.size(); i++) { - final int index = i; - CompletableFuture future = CompletableFuture.supplyAsync(() -> { - RuleInfo rule = ruleInfoList.get(index); - boolean hitFlag = executeByDifficulty(inputParam, outMap, rule, ruleResultList); - if (hitFlag) { - return rule; - } else { - return null; - } - }, threadPoolTaskExecutor); - - futureList.add(future); - } - - for (CompletableFuture future : futureList) { - try { - RuleInfo rule = future.get(); - if (rule != null) { - resultList.add(rule); - } - } catch (InterruptedException e) { - e.printStackTrace(); - } catch (ExecutionException e) { - e.printStackTrace(); - } - } - - return resultList; - } - - /** - * 根究规则类型选择执行 - * - * @param inputParam - * @param outMap - * @param rule - * @param ruleResultList - * @return - */ - private boolean executeByDifficulty(Map inputParam, Map outMap, RuleInfo rule, CopyOnWriteArrayList ruleResultList) { - boolean hitFlag = false; - if (rule.getDifficulty() == 1) { - hitFlag = executeBasicRule(inputParam, outMap, rule, ruleResultList); - } else if (rule.getDifficulty() == 2) { - hitFlag = executeComplexRule(inputParam, outMap, rule, ruleResultList); - } else if (rule.getDifficulty() == 3) { - hitFlag = executeScriptRule(inputParam, outMap, rule, ruleResultList); - } - return hitFlag; - } - - /** - * 执行复杂规则 - * - * @param input - * @param output - * @param rule - * @param ruleResultList - * @return - */ - public boolean executeComplexRule(Map input, Map output, RuleInfo rule, CopyOnWriteArrayList ruleResultList) { - boolean hitFlag = false; - //获取需要执行的整个规则。 -// RuleVo rule = ruleService.queryByVersionId(ruleId); -// Long versionId = rule.getVersionId(); -// if (versionId==null){ -// return false; -// } -// RuleVersionVo ruleVersion = versionService.queryByVersionId(versionId); - RuleVersionVo ruleVersion = rule.getVersion(); - if (ruleVersion == null) { - return false; - } - - //取出本规则的条件列表 - Map ruleMap = new HashMap<>(); - ruleMap.put("ruleId", rule.getId()); - ruleMap.put("ruleVersionId",ruleVersion.getId()); - ruleMap.put("ruleCode", rule.getCode()); - ruleMap.put("ruleName", rule.getName()); - ruleMap.put("versionCode", ruleVersion.getVersionCode()); - ruleMap.put("versionDesc", ruleVersion.getDescription()); - ruleMap.put("desc", rule.getDescription()); - ruleMap.put("ruleResult", "未命中"); - - //获取规则需要执行的condition逻辑。 - RuleConditionVo ruleCondition = ruleVersion.getRuleConditionVo(); - //传入输入参数、中间变量、输出参数和需要执行的condition逻辑获取执行结果 - Map temp = JSON.parseObject(JSON.toJSONString(input), Map.class); - boolean result = this.executeRuleCondition(temp, output, ruleCondition); - String resultFieldEn = ruleVersion.getResultFieldEn(); - if (resultFieldEn == null || "".equals(resultFieldEn)) { - resultFieldEn = "rule_2_"+rule.getId()+"_"+ruleVersion.getId()+"_hitResult"; - } - String scoreFieldEn = ruleVersion.getScoreFieldEn(); - if (StringUtils.isNotBlank(scoreFieldEn)){ - scoreFieldEn = "rule_2_"+rule.getId()+"_"+ruleVersion.getId()+"_score"; - } - input.put(resultFieldEn, "未命中"); - //根据执行的最终结果处理此规则输出内容 - List fieldList = new ArrayList<>(); - JSONObject resultJson = new JSONObject(); - if (result) { - ruleMap.put("ruleResult", "命中"); - ruleMap.put("ruleScore", rule.getScore()); - JSONObject scoreJson = new JSONObject(); - resultJson.put(resultFieldEn, "命中"); - fieldList.add(resultJson); -// if (StringUtils.isNotBlank(ruleVersion.getScoreFieldEn())) { - scoreJson.put(scoreFieldEn, ruleVersion.getScore()); - fieldList.add(scoreJson); - input.put(scoreFieldEn, ruleVersion.getScore()); -// } - input.put(resultFieldEn, "命中"); - //处理此规则需要输出的内容 - fieldList.addAll(ruleService.setComplexRuleOutput(ruleVersion.getId(), temp, input, TacticsType.OutType.SUCCESS_OUT)); - ruleMap.put("fieldList", fieldList); - hitFlag = true; - } else { - resultJson.put(resultFieldEn, "未命中"); - ruleMap.put("ruleScore", 0); - input.put(scoreFieldEn,0); - fieldList.add(resultJson); - fieldList.addAll(ruleService.setComplexRuleOutput(ruleVersion.getId(), temp, input, TacticsType.OutType.FAIL_OUT)); - ruleMap.put("fieldList", fieldList); - } - ruleResultList.add(ruleMap); - return hitFlag; - } - - //执行规则的条件 - private boolean executeRuleCondition(Map input, Map output, RuleConditionVo ruleCondition) { - Integer conditionType = ruleCondition.getConditionType(); - boolean result = false; - switch (conditionType) { - //关系条件节点 &&和|| - case RuleConst.RELATION_CONDITION: - //循环结果的条件 - case RuleConst.LOOP_RESULT_CONDITION: - case RuleConst.CONDITION_RESULT_CONDITION: - result = executeRelation(input, output, ruleCondition); - break; - //表达式条件节点 - case RuleConst.EXPRESSION_CONDITION: - result = executeExpression(input, output, ruleCondition); - break; - //循环条件根节点 - case RuleConst.LOOP_CONDITION: - result = executeLoop(input, output, ruleCondition); - break; - //条件组根节点 - case RuleConst.CONDITION_GROUP_CONDITION: - result = executeCondGroup(input, output, ruleCondition); - break; - } - return result; - } - - //执行条件组 - private boolean executeCondGroup(Map input, Map output, RuleConditionVo ruleCondition) { - //取出子条件 - List children = ruleCondition.getChildren(); - //存储命中条数 - int hitNum = 0; - if (children == null) { - return false; - } - //执行条件组中条件列表,命中则添加命中条数 - for (RuleConditionVo child : children) { - boolean childResult = executeRuleCondition(input, output, child); - if (childResult) { - hitNum++; - } - } - //获取条件组命中条件,为null直接不命中 - RuleConditionVo condGroup = ruleCondition.getCondGroupResultCondition(); - if (condGroup == null) { - return false; - } - //传入命中条件和组内命中条数执行并返回 - Map map = new HashMap<>(); - //将命中条数存入map然后判断执行结果 - map.put("hitNum", hitNum); - return executeRuleCondition(map, output, condGroup); - } - - //关系条件节点 &&和|| - private boolean executeRelation(Map input, Map output, RuleConditionVo ruleCondition) { - //获取关系逻辑 - String logical = ruleCondition.getLogical(); - //处理子逻辑 - List children = ruleCondition.getChildren(); - - boolean result = false; - switch (logical) { - case "||": - result = false; - for (RuleConditionVo child : children) { - boolean childResult = executeRuleCondition(input, output, child); - if (childResult) { - return true; - } - } - break; - case "&&": - result = true; - for (RuleConditionVo child : children) { - boolean childResult = executeRuleCondition(input, output, child); - if (!childResult) { - return false; - } - } - break; - } - return result; - } - - //表达式条件节点 - private boolean executeExpression(Map input, Map output, RuleConditionVo ruleCondition) { - String executionLogic = ruleCondition.getExecutionLogic(); - boolean result = false; - ExpressionParam expressionParam = new ExpressionParam(); - //复制执行的关键参数到统一入参 - BeanUtils.copyProperties(ruleCondition, expressionParam); - result = ExecuteUtils.getExpressionResult(expressionParam, input); - return result; - } - - //循环条件根节点 - private boolean executeLoop(Map input, Map output, RuleConditionVo ruleCondition) { - List children = ruleCondition.getChildren(); - String fieldEn = ruleCondition.getFieldEn(); - - //对循环中每个条件进行处理 - String[] split = fieldEn.split("\\."); - //从map中取元素返回最终取到的对象 - Object obj = ExecuteUtils.getObjFromMap(input, fieldEn); - List arrayList = new ArrayList(); - if (obj != null) { - arrayList.addAll(JSON.parseObject(JSON.toJSONString(obj), ArrayList.class)); - } - //取不到这个数组 - if (arrayList.isEmpty()) { - return false; - } - //拼接当前对象的key - String currentKey = "%" + split[split.length - 1] + "%"; - for (RuleConditionVo child : children) { - List loopGroupActions = child.getLoopGroupActions(); - // 调用for循环条件下的操作,并且将其存入input中 - for (RuleLoopGroupAction loopGroupAction : loopGroupActions) { - this.initLoopGroupAction(loopGroupAction, input); - } - } - for (Object currentObj : arrayList) { - //将循环时的当前对象存入input - input.put(currentKey, currentObj); - //循环执行当前for中的每个判断单元 - for (RuleConditionVo child : children) { - if (executeRuleCondition(input, output, child)) { - List loopGroupActions = child.getLoopGroupActions(); - // 调用for循环条件下的操作,并且将其存入input中 - for (RuleLoopGroupAction loopGroupAction : loopGroupActions) { - this.saveLoopGroupAction(loopGroupAction, input); - } - } - } - } - //计算for的返回结果 - RuleConditionVo loopResultCondition = ruleCondition.getLoopResultCondition(); - boolean result = executeRuleCondition(input, output, loopResultCondition); - return result; - } - - //保存循环规则的动作 - private void saveLoopGroupAction(RuleLoopGroupAction loopGroupAction, Map input) { - Integer actionType = loopGroupAction.getActionType(); - String actionKey = loopGroupAction.getActionKey(); - String actionValue = loopGroupAction.getActionValue(); - if (actionType == null) { - return; - } - switch (actionType) { - case RuleConst.LOOP_GROUP_ACTION_TYPE_SUM: - Integer count = 1; - if (input.containsKey(actionKey) && StringUtils.isNumeric(ExecuteUtils.getObjFromMap(input, actionKey).toString())) { - count = count + Integer.parseInt(ExecuteUtils.getObjFromMap(input, actionKey).toString()); - } - input.put(actionKey, count); - break; - case RuleConst.LOOP_GROUP_ACTION_TYPE_ASSIGNMENT: - //赋值待添加 - break; - case RuleConst.LOOP_GROUP_ACTION_TYPE_OUT_CONST: - input.put(actionKey, actionValue); - break; - case RuleConst.LOOP_GROUP_ACTION_TYPE_OUT_VARIABLE: - input.put(actionKey, ExecuteUtils.getObjFromMap(input, actionValue)); - break; - } - } - - - private void initLoopGroupAction(RuleLoopGroupAction loopGroupAction, Map input){ - Integer actionType = loopGroupAction.getActionType(); - String actionKey = loopGroupAction.getActionKey(); - String actionValue = loopGroupAction.getActionValue(); - if (actionType == null) { - return; - } - switch (actionType) { - case RuleConst.LOOP_GROUP_ACTION_TYPE_SUM: - input.put(actionKey, 0); - break; - case RuleConst.LOOP_GROUP_ACTION_TYPE_ASSIGNMENT: - //赋值待添加 - break; - case RuleConst.LOOP_GROUP_ACTION_TYPE_OUT_CONST: - input.put(actionKey, ""); - break; - case RuleConst.LOOP_GROUP_ACTION_TYPE_OUT_VARIABLE: - input.put(actionKey,new HashSet<>()); - break; - } - } - /** - * 执行基础规则(drools) - * - * @param map - * @param outMap - * @param rule - * @param ruleResultList - * @return - */ - private boolean executeBasicRule(Map map, Map outMap, RuleInfo rule, CopyOnWriteArrayList ruleResultList) { - boolean hitFlag = false; - StatefulKnowledgeSession kSession = null; - String keyMd5 = null; - try { - String ruleString = rule.getContent().replace("\\r\\n", "\r\n"); - ruleString = ruleString.replace("\\t", "\t"); - keyMd5 = CommonConst.DROOLS_KSESSION_KEY_PREFIX + MD5.GetMD5Code(ruleString); - redisManager.set(keyMd5, ruleString, 120); - kSession = kSessionPool.borrowObject(keyMd5); - - List resultList = new ArrayList<>(); - InputParam inputParam = new InputParam(); - inputParam.setInputParam(map); - inputParam.setResult(resultList); - FactHandle fact = kSession.insert(inputParam); - kSession.fireAllRules(); - kSession.retract(fact); - - JSONObject jsonObject = new JSONObject(); - jsonObject.put("ruleId", rule.getId()); - jsonObject.put("ruleCode", rule.getCode()); - jsonObject.put("ruleName", rule.getName()); - jsonObject.put("desc", rule.getDescription()); - String resultEn = rule.getResultFieldEn(); - if (StringUtils.isBlank(resultEn)){ - resultEn = "rule_1_"+rule.getId()+"_hitResult"; - } - String scoreEn = rule.getScoreFieldEn(); - if (StringUtils.isBlank(resultEn)){ - scoreEn = "rule_1_"+rule.getId()+"_score"; - } - if (resultList.size() > 0) { - jsonObject.put("ruleResult", "命中"); - jsonObject.put("ruleScore", rule.getScore()); - map.put(scoreEn, rule.getScore()); - map.put(resultEn, "命中"); - - List fieldList = new ArrayList<>(); - JSONObject resultJson = new JSONObject(); - JSONObject scoreJson = new JSONObject(); - resultJson.put(rule.getResultFieldEn(), "命中"); - scoreJson.put(rule.getScoreFieldEn(), rule.getScore()); - fieldList.add(resultJson); - fieldList.add(scoreJson); - if (null != rule && null != rule.getId()) { - fieldList.addAll(ruleService.setBaseRuleOutput(rule.getId(), map)); - jsonObject.put("fieldList", fieldList); - } - ruleResultList.add(jsonObject); - hitFlag = true; - - } else { - // 未命中返回信息 - jsonObject.put("ruleResult", "未命中"); - map.put(resultEn, "未命中"); - map.put(scoreEn, 0); - ruleResultList.add(jsonObject); - } - } catch (Exception e) { - e.printStackTrace(); - logger.error("请求异常", e); - } finally { - if (keyMd5 != null && kSession != null) { - kSessionPool.returnObject(keyMd5, kSession); - } - } - return hitFlag; - } - - /** - * 终止条件判断 - * - * @param engineNode - * @param inputParam - * @param outMap - * @param ruleHitList - */ - private void terminalCondition(EngineNode engineNode, Map inputParam, Map outMap, List ruleHitList) { - if (StringUtils.isBlank(engineNode.getNodeScript())) { - return; - } - JSONObject nodeScript = JSONObject.parseObject(engineNode.getNodeScript()); - JSONObject terminationInfo = nodeScript.getJSONObject("terminationInfo"); - JSONArray selectedRule = terminationInfo.getJSONArray("selectedRule"); - String conditions = terminationInfo.getString("conditions"); - if (!selectedRule.isEmpty()) { - if (!selectedRule.isEmpty()) { - List selectedRuleList = JSONObject.parseArray(JSONObject.toJSONString(selectedRule), JSONObject.class); - // 查找已选规则中命名的规则集合 - List selectedHitRules = new ArrayList<>(); - for (JSONObject jsonObject : selectedRuleList) { - Optional rule = ruleHitList.stream().filter(item -> item.getId().equals(jsonObject.getLong("id"))).findFirst(); - if (rule.isPresent()) { - selectedHitRules.add(rule.get()); - } - } - - int totalSize = selectedHitRules.size(); // 规则命名个数 - double totalScore = selectedHitRules.stream().mapToDouble(RuleInfo::getScore).sum(); // 规则总得分 - String sizeKey = engineNode.getNodeType() + "_" + engineNode.getNodeId() + "_terminal_size"; - String scoreKey = engineNode.getNodeType() + "_" + engineNode.getNodeId() + "_terminal_score"; - Map variablesMap = new HashMap<>(); - variablesMap.put(sizeKey, totalSize); - variablesMap.put(scoreKey, totalScore); - - ExecuteUtils.terminalCondition(engineNode,inputParam,outMap,variablesMap); - } - } - } - - private List getRuleFromJsonArray(JSONArray jsonArray) { - List ruleIds = new ArrayList<>(); - Map map = new HashMap<>(); - for (int i = 0; i < jsonArray.size(); i++) { - JSONObject ruleObj = jsonArray.getJSONObject(i); - Long versionId = ruleObj.getLong("ruleVersionId"); - Long ruleId = ruleObj.getLong("id"); - if (ruleId != null) { - ruleIds.add(ruleId); - if (versionId != null) { - map.put(ruleId, versionId); - } - } - } - - List ruleInfoList = ruleService.getRuleList(ruleIds); - for (RuleInfo ruleInfo : ruleInfoList) { - if (ruleInfo.getDifficulty() == 2 || ruleInfo.getDifficulty() == 3) { - Long versionId = map.get(ruleInfo.getId()); - ruleInfo.setVersionId(versionId); - if (versionId != null) { - switch (ruleInfo.getDifficulty()) { - case 2: - RuleVersionVo ruleVersionVo = versionService.queryById(versionId); - ruleInfo.setVersion(ruleVersionVo); - ruleInfo.setScore(ruleVersionVo.getScore()); - break; - case 3: - RuleScriptVersion ruleScriptVersion = ruleScriptVersionService.queryById(versionId); - ruleInfo.setScriptVersion(ruleScriptVersion); - ruleInfo.setVersion(JSON.parseObject(JSON.toJSONString(ruleScriptVersion), RuleVersionVo.class)); - ruleInfo.setScore(0); - break; - } - } else { - ruleInfo.setScore(0); - } - } - } - - return ruleInfoList; - } - - /** - * 执行脚本规则 - * - * @param inputParam - * @param outMap - * @param rule - * @param ruleResultList - * @return - */ - private boolean executeScriptRule(Map inputParam, Map outMap, RuleInfo rule, CopyOnWriteArrayList ruleResultList) { - boolean hitFlag = false; - RuleScriptVersion scriptVersion = rule.getScriptVersion(); - if (RuleConst.ScriptType.GROOVY.equals(rule.getScriptType())&&RuleConst.ScriptType.GROOVY.equals( scriptVersion.getScriptType())) { - //groovy脚本执行 - //取出需要执行的版本 - if (scriptVersion == null || StringUtils.isBlank(scriptVersion.getScriptContent())) { - return false; - } - //取出脚本内容 - String scriptContent = scriptVersion.getScriptContent(); - //取出本规则集的规则列表 - Map ruleMap = new HashMap<>(); - ruleMap.put("ruleId", rule.getId()); - ruleMap.put("ruleCode", rule.getCode()); - ruleMap.put("ruleName", rule.getName()); - ruleMap.put("versionCode", scriptVersion.getVersionCode()); - ruleMap.put("versionDesc", scriptVersion.getDescription()); - ruleMap.put("desc", rule.getDescription()); - ruleMap.put("ruleResult", "未命中"); - - - String resultFieldEn = "hitResult"; - String resultEn = "rule_"+rule.getDifficulty()+"_"+rule.getId()+"_"+scriptVersion.getId()+"_hitResult"; - String scoreEn = "rule_"+rule.getDifficulty()+"_"+rule.getId()+"_"+scriptVersion.getId()+"_score"; - inputParam.put(resultEn, "未命中"); - inputParam.put(scoreEn,0); - //根据执行的最终结果处理此规则输出内容 - List fieldList = new ArrayList<>(); - JSONObject resultJson = new JSONObject(); - try { - Object resp = ExecuteUtils.getObjFromScript(inputParam, scriptContent); - String result = "未命中"; - JSONObject executeResult = null; - int ruleScore = 0; - if (resp instanceof HashMap) { - Map resultMap = (HashMap) resp; - executeResult = JSON.parseObject(JSON.toJSONString(resultMap)); - ruleScore = executeResult.getIntValue("ruleScore"); - result = executeResult.getString(resultFieldEn); - JSONArray fieldListJson = executeResult.getJSONArray("fieldList"); - JSONObject updateInputMap = executeResult.getJSONObject("updateInputMap"); - if (fieldListJson != null) { - fieldList = fieldListJson.toJavaList(Object.class); - List list = new ArrayList(); - for (Object o : fieldList) { - if (o!=null&& o instanceof Map){ - Map map = ExecuteUtils.handleGroovyResult((Map) o); - list.add(map); - } - } - fieldList = list; - } - - if (executeResult != null) { - ruleMap.put("ruleResult", result); - ruleMap.put("ruleScore", ruleScore); - resultJson.put(resultFieldEn, result); - fieldList.add(resultJson); - inputParam.put(resultFieldEn, result); - //处理此规则需要输出的内容 - ruleMap.put("fieldList", fieldList); - } - if ("命中".equals(result)) { - hitFlag = true; - inputParam.put(resultEn,"命中"); - inputParam.put(scoreEn,ruleScore); - } - //更新入参 - if (updateInputMap!=null&&!updateInputMap.isEmpty()){ - Set> entries = ExecuteUtils.handleGroovyResult(updateInputMap).entrySet(); - for (Map.Entry entry : entries) { - inputParam.put(entry.getKey(),entry.getValue()); - } - } - } - } catch (Exception e) { - e.printStackTrace(); - logger.error("脚本规则集执行错误:{}" + e); - } - ruleResultList.add(ruleMap); - } - return hitFlag; - } - -// public static void main(String[] args) { -//// HashMap result = new HashMap<>(); //规则执行的返回值 -//// int ruleScore = 0; //规则命中时得分 -//// String hitResult = "未命中"; //命中结果,可选类型为:命中、未命中 -//// HashMap updateInputMap = new HashMap<>(); //用于更新入参的map,此map中的所有内容将被更新到入参中,key重复的将被覆盖。 -//// ArrayList> fieldList = new ArrayList<>(); //用于存放输出字段的值 -//// //自定义代码区域,根据需要书写逻辑代码 -//// -//// -//// -//// //返回固定格式的结果用于后续执行 -//// result.put("hitResult",hitResult); -//// result.put("ruleScore",ruleScore); -//// result.put("fieldList",fieldList); -//// result.put("updateInputMap",updateInputMap); -//// return result; -// } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/node/service/impl/SandboxProportionNode.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/node/service/impl/SandboxProportionNode.java deleted file mode 100644 index 3a10a88..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/node/service/impl/SandboxProportionNode.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.baoying.enginex.executor.node.service.impl; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.baoying.enginex.executor.engine.model.EngineNode; -import com.baoying.enginex.executor.engine.model.Sandbox; -import com.baoying.enginex.executor.node.service.EngineNodeService; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Random; - -@Service -public class SandboxProportionNode implements EngineNodeService { - private final Logger logger = LoggerFactory.getLogger(this.getClass()); - - @Override - public void getNodeField(EngineNode engineNode, Map inputParam) { - - } - - @Override - public void runNode(EngineNode engineNode, Map inputParam, Map outMap) { - if (null != engineNode.getNodeScript()) { - List list = JSON.parseArray(engineNode.getNodeScript(), Sandbox.class); - //监控中心-- 节点配置信息记录(不需要策略层面的监控) - JSONObject nodeSnapshot = new JSONObject(); - nodeSnapshot.put("nodeSnapshot",JSON.parseArray(engineNode.getNodeJson())); - outMap.put("nodeSnapshot",nodeSnapshot); - JSONObject nodeInfo = new JSONObject(); - nodeInfo.put("engineNode",engineNode); - nodeInfo.put("nodeId",engineNode.getNodeId()); - nodeInfo.put("nodeName",engineNode.getNodeName()); - nodeInfo.put("nodeType",engineNode.getNodeType()); - outMap.put("nodeInfo",nodeInfo); - int num = 0;//随机生成的数 - int startNum = 0; - int endNum = 0; - for (int i = 0; i < list.size(); i++) { - Sandbox sandbox = list.get(i); - endNum = startNum + sandbox.getProportion(); - if (num == 0) - num = getRandoms(0, sandbox.getSum(), 1)[0]; - int[] range = getRandoms(startNum, endNum, sandbox.getProportion()); - for (int j = 0; j < range.length; j++) { - if (range[j] == num) { - if (StringUtils.isBlank(sandbox.getNextNode())) { - List sblist = JSON.parseArray(engineNode.getNodeJson(), Sandbox.class); - for (Sandbox sb : sblist) { - if (sb.getSandbox() == sandbox.getSandbox()) { - sandbox.setNextNode(sb.getNextNode()); - break; - } - } - } - - outMap.put("nextNode", sandbox.getNextNode()); - JSONObject nodeResult = new JSONObject(); - nodeResult.put("nodeResult",sandbox.getNextNode()); - outMap.put("nodeResult",nodeResult); - break; - } - } - startNum = endNum; - } - } - } - - /** - * 根据min和max随机生成count个不重复的随机数组 - * - * @param min - * @param max - * @param count - * @return int[] - */ - public int[] getRandoms(int min, int max, int count) { - int[] randoms = new int[count]; - List listRandom = new ArrayList(); - - if (count > (max - min + 1)) { - return null; - } - // 将所有的可能出现的数字放进候选list - for (int i = min; i < max; i++) { - listRandom.add(i); - } - // 从候选list中取出放入数组,已经被选中的就从这个list中移除 - for (int i = 0; i < count; i++) { - int index = getRandom(0, listRandom.size() - 1); - randoms[i] = listRandom.get(index); - listRandom.remove(index); - } - - return randoms; - } - - /** - * 根据min和max随机生成一个范围在[min,max]的随机数,包括min和max - * - * @param min - * @param max - * @return int - */ - public int getRandom(int min, int max) { - Random random = new Random(); - return random.nextInt(max - min + 1) + min; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/redis/RedisManager.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/redis/RedisManager.java deleted file mode 100644 index f7dc255..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/redis/RedisManager.java +++ /dev/null @@ -1,683 +0,0 @@ -package com.baoying.enginex.executor.redis; - -import com.alibaba.fastjson.JSONObject; -import com.alibaba.fastjson.PropertyNamingStrategy; -import com.alibaba.fastjson.parser.ParserConfig; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import redis.clients.jedis.*; - -import java.util.*; - -@Component -public class RedisManager { - // 0-表示永远不过期 - private int expire = 0; - - @Autowired - private JedisPool jedisPool; - - public RedisManager() {} - - /** - * @Title: init - * @Description: 初始化方法,用来初始化 - * @param 设定文件 - * @return void 返回类型 - * @throws - */ - public void init() { - } - - /** - * @Title: get - * @Description: 根据key来获得一条特定的缓存数据 - * @param @param key 序列化后的key - * @param @return 设定文件 - * @return byte[] 返回类型 - * @throws - */ - public byte[] get(byte[] key) { - byte[] value = null; - Jedis jedis =null; - try { - jedis = jedisPool.getResource(); - value = jedis.get(key); - } catch (Exception e) { - //释放redis对象 - jedisPool.returnBrokenResource(jedis); - e.printStackTrace(); - } finally { - jedis.close(); - //返还到连接池 - if (jedis != null) { - jedisPool.returnResource(jedis); - } - } - return value; - } - - - /** - * @Title: get - * @Description: 根据key来获得一条特定的缓存数据 - * @param @param key string类型的key - * @param @return 设定文件 - * @return String 返回类型 - * @throws - */ - public String get(String key) { - String value = null; - Jedis jedis = jedisPool.getResource(); - try { - value = jedis.get(key); - } catch (Exception e) { - //释放redis对象 - jedisPool.returnBrokenResource(jedis); - e.printStackTrace(); - } finally { - //返还到连接池 - if (jedis != null) { - jedisPool.returnResource(jedis); - } - } - return value; - } - - /** - * @Title: set - * @Description: 向redis数据库中缓存数据,key,value都为byte[](已经序列化) - * @param @param key - * @param @param value - * @param @return 设定文件 - * @return byte[] 返回类型 - * @throws - */ - public byte[] set(byte[] key, byte[] value) { - Jedis jedis = jedisPool.getResource(); - try { - jedis.set(key, value); - if (this.expire != 0) { - jedis.expire(key, this.expire); - } - } catch (Exception e) { - //释放redis对象 - jedisPool.returnBrokenResource(jedis); - e.printStackTrace(); - } finally { - //返还到连接池 - if (jedis != null) { - jedisPool.returnResource(jedis); - } - } - return value; - } - - /** - * @Title: set - * @Description: 向redis数据库中缓存数据,key,value为字符串类型,缓存时间为永不过期 - * @param @param key - * @param @param value - * @param @return 设定文件 - * @return String 返回类型 - * @throws - */ - public String set(String key, String value) { - Jedis jedis = jedisPool.getResource(); - try { - jedis.set(key, value); - if (this.expire != 0) { - jedis.expire(key, this.expire); - } - } catch (Exception e) { - //释放redis对象 - jedisPool.returnBrokenResource(jedis); - e.printStackTrace(); - } finally { - //返还到连接池 - if (jedis != null) { - jedisPool.returnResource(jedis); - } - } - return value; - } - - /** - * @Title: set - * @Description: 向redis数据库中缓存数据,key,value都为byte[](已经序列化) - * @param @param key - * @param @param value - * @param @param expire 0为永不过期,其他时间则会设置对应的过期时间 - * @param @return 设定文件 - * @return byte[] 返回类型 - * @throws - */ - public byte[] set(byte[] key, byte[] value, int expire) { - Jedis jedis = null; - try { - jedis = jedisPool.getResource(); - jedis.set(key, value); - if (expire != 0) { - jedis.expire(key, expire); - } - } catch (Exception e) { - //释放redis对象 - jedisPool.returnBrokenResource(jedis); - e.printStackTrace(); - } finally { - //返还到连接池 - if (jedis != null) { - jedisPool.returnResource(jedis); - } - } - return value; - } - - /** - * @Title: set - * @Description: 向redis数据库中缓存数据,key,value都为字符串的类型 - * @param @param key - * @param @param value - * @param @param expire 0为永不过期,其他时间则会设置对应的过期时间 - * @param @return 设定文件 - * @return String 返回类型 - * @throws - */ - public String set(String key, String value, int expire) { - Jedis jedis = jedisPool.getResource(); - try { - jedis.set(key, value); - if (expire != 0) { - jedis.expire(key, expire); - } - } catch (Exception e) { - //释放redis对象 - jedisPool.returnBrokenResource(jedis); - e.printStackTrace(); - } finally { - //返还到连接池 - if (jedis != null) { - jedisPool.returnResource(jedis); - } - } - return value; - } - - /** - * @Title: del - * @Description: 根据byte数组(已经序列化的key)来删除redis数据库中缓存的数据 - * @param @param key 设定文件 - * @return void 返回类型 - * @throws - */ - public void del(byte[] key) { - Jedis jedis = jedisPool.getResource(); - try { - jedis.del(key); - } catch (Exception e) { - //释放redis对象 - jedisPool.returnBrokenResource(jedis); - e.printStackTrace(); - } finally { - //返还到连接池 - if (jedis != null) { - jedisPool.returnResource(jedis); - } - } - } - - /** - * @Title: del - * @Description: 根据特定的string类型的key来删除redis数据库中的缓存数据 - * @param @param key 设定文件 - * @return void 返回类型 - * @throws - */ - public void del(String key) { - Jedis jedis = jedisPool.getResource(); - try { - jedis.del(key); - } finally { - if (jedis != null) { - jedis.close(); - } - } - } - - /** - * @Title: flushDB - * @Description: 清除指定redis数据库中的数据 - * @param 设定文件 - * @return void 返回类型 - * @throws - */ - public void flushDB() { - Jedis jedis = jedisPool.getResource(); - try { - jedis.flushDB(); - } catch (Exception e) { - //释放redis对象 - jedisPool.returnBrokenResource(jedis); - e.printStackTrace(); - } finally { - //返还到连接池 - if (jedis != null) { - jedisPool.returnResource(jedis); - } - } - } - - /** - * @Title: dbSize - * @Description: 获得redis缓存数据的大小 - * @param @return 设定文件 - * @return Long 返回类型 - * @throws - */ - public Long dbSize() { - Long dbSize = 0L; - Jedis jedis = jedisPool.getResource(); - try { - dbSize = jedis.dbSize(); - } catch (Exception e) { - //释放redis对象 - jedisPool.returnBrokenResource(jedis); - e.printStackTrace(); - } finally { - //返还到连接池 - if (jedis != null) { - jedisPool.returnResource(jedis); - } - } - return dbSize; - } - - /** - * @Title: keys - * @Description: 根据泛型来查询所有符合泛型的缓存数据 - * @param @param pattern - * @param @return 设定文件 - * @return Set 返回类型 - * @throws - */ - public Set keys(String pattern) { - Set keys = null; - Jedis jedis = jedisPool.getResource(); - try { - keys = jedis.keys(pattern.getBytes()); - } catch (Exception e) { - //释放redis对象 - jedisPool.returnBrokenResource(jedis); - e.printStackTrace(); - } finally { - //返还到连接池 - if (jedis != null) { - jedisPool.returnResource(jedis); - } - } - return keys; - } - - /** - * @Title: dels - * @Description: 根据提供的泛型来删除reids中缓存的数据 - * @param @param pattern 设定文件 - * @return void 返回类型 - * @throws - */ - public void dels(String pattern) { - Set keys = null; - Jedis jedis = jedisPool.getResource(); - try { - keys = jedis.keys(pattern.getBytes()); - Iterator ito = keys.iterator(); - while (ito.hasNext()) { - jedis.del(ito.next()); - } - } catch (Exception e) { - //释放redis对象 - jedisPool.returnBrokenResource(jedis); - e.printStackTrace(); - } finally { - //返还到连接池 - if (jedis != null) { - jedisPool.returnResource(jedis); - } - } - } - - - - // ------------------------------------ 缓存改造 ----------------------------------- - - /** - * hash类型 添加键值对 - * - * @param key - * @param field - * @param value - * @return - */ - public Long hset(String key, String field, String value) { - Jedis jedis = jedisPool.getResource(); - Long result = null; - try { - result = jedis.hset(key, field, value); - if (this.expire != 0) { - jedis.expire(key, this.expire); - } - } catch (Exception e) { - //释放redis对象 - jedisPool.returnBrokenResource(jedis); - e.printStackTrace(); - } finally { - //返还到连接池 - if (jedis != null) { - jedisPool.returnResource(jedis); - } - } - return result; - } - - /** - * hash类型 获取所有键值对 - * - * @param key - * @return - */ - public Map hgetAll(String key) { - Map value = null; - Jedis jedis = jedisPool.getResource(); - try { - value = jedis.hgetAll(key); - } catch (Exception e) { - //释放redis对象 - jedisPool.returnBrokenResource(jedis); - e.printStackTrace(); - } finally { - //返还到连接池 - if (jedis != null) { - jedisPool.returnResource(jedis); - } - } - return value; - } - - public ScanResult scan(String cursor, ScanParams params) { - ScanResult value = null; - Jedis jedis = jedisPool.getResource(); - try { - value = jedis.scan(cursor, params); - } catch (Exception e) { - //释放redis对象 - jedisPool.returnBrokenResource(jedis); - e.printStackTrace(); - } finally { - //返还到连接池 - if (jedis != null) { - jedisPool.returnResource(jedis); - } - } - return value; - } - - public List scan(String key) { - List result = null; - // 游标初始值为0 - String cursor = ScanParams.SCAN_POINTER_START; - ScanParams scanParams = new ScanParams(); - scanParams.match(key);// pattern - scanParams.count(1000); - while (true) { - //使用scan命令获取数据,使用cursor游标记录位置,下次循环使用 - ScanResult scanResult = scan(cursor, scanParams); - cursor = scanResult.getStringCursor();// 返回0 说明遍历完成 - List list = scanResult.getResult(); - if (result == null) { - result = new ArrayList<>(); - } - result.addAll(list); - if ("0".equals(cursor)) { - break; - } - } - return result; - } - - /** - * hash类型 模糊查询 - * - * @param keyPattern - * @param clazz - * @param - * @return - */ - public List scanHash(String keyPattern, Class clazz) { - List result = null; - List keys = scan(keyPattern); - for (String key : keys) { - Map map = hgetAll(key); - if (result == null) { - result = new ArrayList<>(); - } - result.add(JSONObject.parseObject(JSONObject.toJSONString(map), clazz)); - } - return result; - } - - /** - * list类型 从尾部添加元素 - * - * @param key - * @param strings - * @return - */ - public Long rpush(String key, String... strings) { - Jedis jedis = jedisPool.getResource(); - Long result = null; - try { - result = jedis.rpush(key, strings); - if (this.expire != 0) { - jedis.expire(key, this.expire); - } - } catch (Exception e) { - //释放redis对象 - jedisPool.returnBrokenResource(jedis); - e.printStackTrace(); - } finally { - //返还到连接池 - if (jedis != null) { - jedisPool.returnResource(jedis); - } - } - return result; - } - - /** - * list类型 获取链表中从start到end的元素的值 - * (start、end可为负数,若为-1则表示链表尾部的元素) - * - * @param key - * @param start - * @param end - * @return - */ - public List lrange(String key, long start, long end) { - Jedis jedis = jedisPool.getResource(); - List result = null; - try { - result = jedis.lrange(key, 0, -1); - } catch (Exception e) { - //释放redis对象 - jedisPool.returnBrokenResource(jedis); - e.printStackTrace(); - } finally { - //返还到连接池 - if (jedis != null) { - jedisPool.returnResource(jedis); - } - } - return result; - } - - /** - * set类型 添加成员 - * - * @param key - * @param members - * @return - */ - public Long sadd(String key, String... members) { - Jedis jedis = jedisPool.getResource(); - Long result = null; - try { - result = jedis.sadd(key, members); - if (this.expire != 0) { - jedis.expire(key, this.expire); - } - } catch (Exception e) { - //释放redis对象 - jedisPool.returnBrokenResource(jedis); - e.printStackTrace(); - } finally { - //返还到连接池 - if (jedis != null) { - jedisPool.returnResource(jedis); - } - } - return result; - } - - /** - * set类型 获取所有的成员 - * - * @param key - * @return - */ - public Set smembers(String key) { - Jedis jedis = jedisPool.getResource(); - Set result = null; - try { - result = jedis.smembers(key); - } catch (Exception e) { - //释放redis对象 - jedisPool.returnBrokenResource(jedis); - e.printStackTrace(); - } finally { - //返还到连接池 - if (jedis != null) { - jedisPool.returnResource(jedis); - } - } - return result; - } - - /** - * 根据主键查询对象 - * - * @param key - * @param clazz - * @param - * @return - */ - public T getByPrimaryKey(String key, Class clazz) { - long start = System.currentTimeMillis(); - ParserConfig.getGlobalInstance().propertyNamingStrategy = PropertyNamingStrategy.SnakeCase; - T result = null; - Map map = hgetAll(key); - if (map != null) { - result = JSONObject.parseObject(JSONObject.toJSONString(map), clazz); - } - long end = System.currentTimeMillis(); - System.out.println("============= getByPrimaryKey ======== 耗时:" + (end -start)); - return result; - } - - /** - * 根据外键查询对应的集合 - * - * @param key - * @param clazz - * @param - * @return - */ - public List getByForeignKey(String key, Class clazz) { - long start = System.currentTimeMillis(); - ParserConfig.getGlobalInstance().propertyNamingStrategy = PropertyNamingStrategy.SnakeCase; - List result = null; - Set members = smembers(key); - if (members != null) { - result = hgetAllBatchByPrimaryKeys(new ArrayList<>(members), clazz); - } - long end = System.currentTimeMillis(); - System.out.println("============= getByForeignKey ======== 耗时:" + (end -start)); - return result; - } - - /** - * pipeline批量获取hash数据 - * - * @param keys 主键列表 - * @param clazz - * @param - * @return - */ - public List hgetAllBatchByPrimaryKeys(List keys, Class clazz) { - long start = System.currentTimeMillis(); - Jedis jedis = jedisPool.getResource(); - List result = null; - try { - Pipeline pipelined = jedis.pipelined(); - for (String key : keys) { - pipelined.hgetAll(key); - } - // 阻塞拿到所有返回信息 - List objectList = pipelined.syncAndReturnAll(); - - for (Object object : objectList) { - if (result == null) { - result = new ArrayList<>(); - } - result.add(JSONObject.parseObject(JSONObject.toJSONString(object), clazz)); - } - } catch (Exception e) { - //释放redis对象 - jedisPool.returnBrokenResource(jedis); - e.printStackTrace(); - } finally { - //返还到连接池 - if (jedis != null) { - jedisPool.returnResource(jedis); - } - } - long end = System.currentTimeMillis(); - System.out.println("============= hgetAllBatchByPrimaryKeys ======== 耗时:" + (end -start)); - return result; - } - - /** - * pipeline批量获取hash数据 - * @param keys 外键列表 - * @param clazz - * @param - * @return - */ - public List hgetAllBatchByForeignKeys(List keys, Class clazz) { - long start = System.currentTimeMillis(); - List result = null; - for (String key : keys) { - List keyResult = getByForeignKey(key, clazz); - if(keyResult == null){ - continue; - } - if (result == null) { - result = new ArrayList<>(); - } - result.addAll(keyResult); - } - long end = System.currentTimeMillis(); - System.out.println("============= hgetAllBatchByForeignKeys ======== 耗时:" + (end -start)); - return result; - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/redis/RedisPipeline.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/redis/RedisPipeline.java deleted file mode 100644 index 3bf52b3..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/redis/RedisPipeline.java +++ /dev/null @@ -1,46 +0,0 @@ -//package com.baoying.enginex.executor.redis; -// -//import org.springframework.beans.factory.annotation.Autowired; -//import org.springframework.dao.DataAccessException; -//import org.springframework.data.redis.connection.RedisConnection; -//import org.springframework.data.redis.core.RedisCallback; -//import org.springframework.data.redis.core.RedisOperations; -//import org.springframework.data.redis.core.RedisTemplate; -//import org.springframework.data.redis.core.SessionCallback; -//import org.springframework.stereotype.Component; -// -//import java.util.List; -// -//@Component -//public class RedisPipeline { -// -// @Autowired -// private RedisTemplate redisTemplate; -// -// public List hGetAllBatch(List keys) { -// List list = redisTemplate.executePipelined(new RedisCallback() { -// @Override -// public Object doInRedis(RedisConnection redisConnection) throws DataAccessException { -// for(String key : keys){ -// redisConnection.hGetAll(key.getBytes()); -// } -// return null; -// } -// }); -// return list; -// } -// -// public List usePipeline(List keys) { -// List list = redisTemplate.executePipelined(new SessionCallback() { -// @Override -// public Object execute(RedisOperations redisOperations) throws DataAccessException { -// for(String key : keys){ -// redisOperations.opsForHash().entries(null); -// } -// return null; -// } -// }); -// return list; -// } -// -//} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/redis/RedisUtils.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/redis/RedisUtils.java deleted file mode 100644 index 0354020..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/redis/RedisUtils.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.baoying.enginex.executor.redis; - -import com.baoying.enginex.executor.canal.TableEnum; - -import java.util.List; -import java.util.stream.Collectors; - -public class RedisUtils { - - /** - * 获取主键redis key - * @param tableName - * @param primaryId - * @return - */ - public static String getPrimaryKey(String tableName, Object primaryId){ - String key = "primary_key" + ":" + tableName + ":" + primaryId; - return key; - } - - public static String getPrimaryKey(TableEnum tableEnum, Object primaryId){ - return getPrimaryKey(tableEnum.getTableName(), primaryId); - } - - public static List getPrimaryKey(TableEnum tableEnum, List primaryIds){ - List keys = primaryIds.stream().map(item -> getPrimaryKey(tableEnum, item)).collect(Collectors.toList()); - return keys; - } - - /** - * 获取外键redis key - * @param tableName - * @param foreignId - * @return - */ - public static String getForeignKey(String tableName, Object foreignId){ - String key = "foreign_key" + ":" + tableName + ":" + foreignId; - return key; - } - - public static String getForeignKey(TableEnum tableEnum, Object foreignId){ - return getForeignKey(tableEnum.getTableName(), foreignId); - } - - public static List getForeignKey(TableEnum tableEnum, List foreignIds){ - List keys = foreignIds.stream().map(item -> getForeignKey(tableEnum, item)).collect(Collectors.toList()); - return keys; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/consts/RuleConditionConst.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/consts/RuleConditionConst.java deleted file mode 100644 index 7960f1e..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/consts/RuleConditionConst.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.baoying.enginex.executor.rule.consts; - -public class RuleConditionConst { - - public static final long DEFAULT_CONDITION_PARENT_ID = 0;//根节点父ID - - public static final String LOOP_RULE_LOGICAL = "for";//循环规则的逻辑符号 - public static final int LOOP_RULE_RESULT_CONDITION = 4;//循环规则的结果条件 - - public static final String CONDITION_GROUP_LOGICAL = "condGroup";//条件组的逻辑符号 - public static final int CONDITION_GROUP_RESULT_CONDITION = 6;//条件组的结果条件 -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/consts/RuleConst.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/consts/RuleConst.java deleted file mode 100644 index 177144a..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/consts/RuleConst.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.baoying.enginex.executor.rule.consts; - -public class RuleConst { - - public static final int CONST_TYPE = 1;//常量 - public static final int VARIABLE_TYPE = 2;//变量 - - public static final int RELATION_CONDITION = 1;//关系节点表示&&或者|| - public static final int EXPRESSION_CONDITION = 2;//表达式条件 - public static final int LOOP_CONDITION = 3;//循环条件 - public static final int LOOP_RESULT_CONDITION = 4;//循环规则条件 - public static final int CONDITION_GROUP_CONDITION = 5;//条件组节点 - public static final int CONDITION_RESULT_CONDITION = 6;//条件组节点 - - - public static final int LOOP_GROUP_ACTION_TYPE_SUM = 1;//循环中求和 - public static final int LOOP_GROUP_ACTION_TYPE_ASSIGNMENT = 2;//赋值 - - public static final int LOOP_GROUP_ACTION_TYPE_OUT_VARIABLE = 3;//输出变量 - public static final int LOOP_GROUP_ACTION_TYPE_OUT_CONST = 4;//输出常量 - - public static class ScriptType { - public static final String GROOVY = "groovy"; - public static final String PYTHON = "python"; - public static final String JAVASCRIPT = "js"; - - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/consts/RuleRunnerConst.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/consts/RuleRunnerConst.java deleted file mode 100644 index 89f54f5..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/consts/RuleRunnerConst.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.baoying.enginex.executor.rule.consts; - -import java.util.Map; - -public class RuleRunnerConst { - public static final String RULE_FILE_HEAD = " package com.baoying.enginex.executor.drools \\r\\n" + - " import java.util.Map;\\r\\n" + - " import java.util.List;\\r\\n" + - " import java.util.ArrayList;\\r\\n" + - " import java.util.HashMap;\\r\\n" + - " import com.baoying.enginex.executor.engine.model.InputParam;\\r\\n" + - " import com.baoying.enginex.executor.engine.model.Result;\\r\\n" + - " import com.baoying.enginex.executor.engine.model.EngineRule;\\r\\n"; - public static final String RULE_NAME_PREFIX = " rule \t"; - public static final String RULE_SALIENCE_PREFIX = "\\r\\n salience\\t "; - public static final String RULE_CONDITION_PREFIX = "\\r\\n when \\r\\n"; - public static final String CONDITION_DETAIL_PREFIX = "\\t $inputParam : InputParam();\\r\\n Map"; - public static final String CONDITION_DETAIL_SUFFIX = " \t from $inputParam.inputParam;\\r\\n"; - public static final String RULE_DISPOSE_PREFIX = "\\t then \\r\\n"; - public static final String DISPOSE_PREFIX = - "\\t List resultList =$inputParam.getResult();\\r\\n" + - "\\t Result result =new Result(); \\r\\n" + - "\\t result.setResultType(\""; - public static final String DISPOSE_INFIX = "\"); \\r\\n" + - "\\t result.setVersionCode(\""; - public static final String DISPOSE_SUFFIX = "\"); \\r\\n" + - "\\t Map map =new HashMap<>(); \\r\\n"; - - public static final String SCORE_PREFIX = "\\t map.put(\"score\","; - public static final String SCORE_SUFFIX = "); \\r\\n"; - - public static final String RULE_END = "\\t result.setMap(map); \\r\\n" + - " resultList.add(result); \\r\\n" + - "\\t $inputParam.setResult(resultList); \\r\\n" + - " end\\r\\n"; - - public static final int DEFAULT_TYPE = 1; - - //拼装规则执行的content - public static String fitRuleContent(String code, Integer salience, String rule, Integer type, Integer score, Map contentMap) { - String content = ""; - if (salience == null || salience < 0) { - salience = 0; - } - if (type == null) { - type = DEFAULT_TYPE; - } - content += RULE_FILE_HEAD + - RULE_NAME_PREFIX + code + - RULE_SALIENCE_PREFIX + salience + - RULE_CONDITION_PREFIX + - CONDITION_DETAIL_PREFIX + rule + - CONDITION_DETAIL_SUFFIX + - RULE_DISPOSE_PREFIX + - DISPOSE_PREFIX + type + - DISPOSE_INFIX + code+ - DISPOSE_SUFFIX; - if (score!=null){ - content += SCORE_PREFIX+score+SCORE_SUFFIX; - } - - if (contentMap!=null&&!contentMap.isEmpty()){ - for (String s : contentMap.keySet()) { - content+="\\t\\t map.put(\""+s+"\",\""+contentMap.get(s)+"\");\\n"; - } - - } - content += RULE_END; - - return content; - } - -// public static void main(String[] args) { -// String versionCode = "rule1"; -// Integer salience = null; -// String rule = "age>10"; -// Integer type = null; -// Integer score = 10; -// Map contentMap = new HashMap<>(); -// contentMap.put("a","a"); -// contentMap.put("b","b"); -// contentMap.put("c","c"); -// String s = fitContent(versionCode, salience, rule, type, score,contentMap); -// System.out.println(s); -// } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/mapper/RuleConditionInfoMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/mapper/RuleConditionInfoMapper.java deleted file mode 100644 index 3504c81..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/mapper/RuleConditionInfoMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baoying.enginex.executor.rule.mapper; - - - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baoying.enginex.executor.rule.model.RuleConditionInfo; -import org.apache.ibatis.annotations.Mapper; - - -@Mapper -public interface RuleConditionInfoMapper extends BaseMapper { - -} - diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/mapper/RuleFieldInfoMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/mapper/RuleFieldInfoMapper.java deleted file mode 100644 index fe19561..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/mapper/RuleFieldInfoMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baoying.enginex.executor.rule.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baoying.enginex.executor.rule.model.RuleFieldInfo; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -@Mapper -public interface RuleFieldInfoMapper extends BaseMapper { - - List getFieldEnList(@Param("ruleIds") List ruleIds); -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/mapper/RuleFieldInfoMapper.xml b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/mapper/RuleFieldInfoMapper.xml deleted file mode 100644 index 2f96e06..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/mapper/RuleFieldInfoMapper.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/mapper/RuleInfoMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/mapper/RuleInfoMapper.java deleted file mode 100644 index ad4ffbe..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/mapper/RuleInfoMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baoying.enginex.executor.rule.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baoying.enginex.executor.rule.model.RuleInfo; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - - -@Mapper -public interface RuleInfoMapper extends BaseMapper { - - List getRuleList(@Param("ruleIds")List ruleIds); -} - diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/mapper/RuleInfoMapper.xml b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/mapper/RuleInfoMapper.xml deleted file mode 100644 index 2ad03d9..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/mapper/RuleInfoMapper.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - id, name, code, description, priority, parent_id, author, user_id, organ_id, engine_id, status, type, is_non, content, created, updated, rule_type, rule_audit, score, score_field_en, last_logical,difficulty,script_type,result_field_en - - - - - - diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/mapper/RuleLoopGroupActionMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/mapper/RuleLoopGroupActionMapper.java deleted file mode 100644 index 411fcda..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/mapper/RuleLoopGroupActionMapper.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.baoying.enginex.executor.rule.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baoying.enginex.executor.rule.model.RuleLoopGroupAction; - -public interface RuleLoopGroupActionMapper extends BaseMapper { - -} - diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/mapper/RuleScriptVersionMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/mapper/RuleScriptVersionMapper.java deleted file mode 100644 index e6fdaa9..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/mapper/RuleScriptVersionMapper.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baoying.enginex.executor.rule.mapper; - - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baoying.enginex.executor.rule.model.RuleScriptVersion; -import org.apache.ibatis.annotations.Mapper; - - -@Mapper -public interface RuleScriptVersionMapper extends BaseMapper { - - - -} - diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/mapper/RuleVersionMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/mapper/RuleVersionMapper.java deleted file mode 100644 index a77463b..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/mapper/RuleVersionMapper.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.baoying.enginex.executor.rule.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baoying.enginex.executor.rule.model.RuleVersion; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface RuleVersionMapper extends BaseMapper { -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/model/RuleConditionInfo.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/model/RuleConditionInfo.java deleted file mode 100644 index 5796e03..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/model/RuleConditionInfo.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.baoying.enginex.executor.rule.model; - -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.baoying.enginex.executor.rule.model.vo.RuleConditionVo; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors -@TableName("`t_rule_condition`") -public class RuleConditionInfo - implements Serializable { - private static final long serialVersionUID = -55937038829167862L; - - @TableId(type = IdType.AUTO) - private Long id;//主键ID - - private String logical;//关系节点的逻辑符号:&&(并关系),||(或关系) - - private Long fieldId;//表达式节点对应的字段id - private String fieldEn;//字段en - private String fieldType;//字段的类型:1中间变量 2 入参 - private String operator;//表达式节点的操作符 - private Integer variableType;//变量类型,1常量 2变量 - private String fieldValue;//表达式节点对应字段的限定值 - private String executionLogic;//执行逻辑 - private Long ruleId;//规则表的id - private Long versionId;//规则版本id - private Long parentId;//父节点的id - - private Integer conditionType;//规则节点的类型:1-关系节点,2-表达式节点 - - private Date createTime;//创建时间 - - private Date updateTime;//修改时间 - - @TableField(exist = false) - private String insertTempId;//插入时临时id - - @TableField(exist = false) - private String TempParentId;//插入时临时父id - - @TableField(exist = false) - private Integer valueType;//字段值类型 - - @TableField(exist = false) - private List loopGroupActions = new ArrayList<>();//循环组对应的条件 - - @TableField(exist = false) - private RuleConditionVo loopResultCondition;//for对应的结果条件的计算条件树 - @TableField(exist = false) - private RuleConditionVo condGroupResultCondition;//条件组对应的结果计算条件树 -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/model/RuleFieldInfo.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/model/RuleFieldInfo.java deleted file mode 100644 index f98a773..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/model/RuleFieldInfo.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.baoying.enginex.executor.rule.model; - -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 lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@TableName("t_rule_field") -public class RuleFieldInfo implements Serializable { - private static final long serialVersionUID = -132321133324148507L; - @TableId(type = IdType.AUTO) - private Long id; - - private String logical;//逻辑运算符 - - private String operator;//运算符 - - private String fieldValue;//字段值 - - private Long ruleId;//关联的规则的id - - private String fieldId;//关联的字段的id - @TableField(exist = false) - private String fieldEn;//关联的字段的英文名称 - @TableField(exist = false) - private String field;//字段内容 - @TableField(exist = false) - private Integer valueType;//关联的字段的值类型 - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/model/RuleInfo.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/model/RuleInfo.java deleted file mode 100644 index a6a9923..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/model/RuleInfo.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.baoying.enginex.executor.rule.model; - -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.baoying.enginex.executor.rule.model.vo.RuleVersionVo; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.Date; -import java.util.List; - - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors -@TableName("t_rule") -public class RuleInfo implements Serializable { - private static final long serialVersionUID = -13354133324148507L; - @TableId(type = IdType.AUTO) - private Long id;//主键 - - private String name;//规则名称 - - private String code;//规则代码 - - private String description;//规则描述 - - private Integer priority;//规则优先级 - - private Long parentId;//父节点id - - private Long author;//创建人id - - private Long userId;//修改人id - - private Long organId;//组织id - - private Integer engineId; - - private Integer status;//状态 0 :停用 ,1 : 启用,-1:删除 - - private Integer type;//规则类型 0 : 系统的规则 1:组织的规则 2: 引擎的规则 - - private Integer isNon;//逻辑关系“非”,0:否 ,1:是 - - private String content;//规则具体内容 - - private Date created; - - private Date updated; - - private Integer ruleType;//0硬性拒绝规则1加减分规则 - - private Integer ruleAudit; - - private Integer score;//得分 - - private String lastLogical;//逻辑关系符 - - private Integer difficulty;//规则难度:1-简单规则,2复杂规则 - - private String scriptType; - - private String resultFieldEn;//存放结果的字段en - - private String scoreFieldEn;//存放是否命中的字段 - - @TableField(exist = false) - private String authorName;//创建人名称,需要去其他表查询 - @TableField(exist = false) - private List parentIds; - @TableField(exist = false) - private Long versionId;//执行版本的id - @TableField(exist = false) - private RuleVersionVo version; - @TableField(exist = false) - private List ruleScriptVersionList; - @TableField(exist = false) - private RuleScriptVersion scriptVersion; -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/model/RuleLoopGroupAction.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/model/RuleLoopGroupAction.java deleted file mode 100644 index 0136dc6..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/model/RuleLoopGroupAction.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.baoying.enginex.executor.rule.model; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.util.Date; - - -@Data -@NoArgsConstructor -@AllArgsConstructor -@TableName("t_rule_loop_group_action") -public class RuleLoopGroupAction implements Serializable { - private static final long serialVersionUID = -47370055295043749L; - /** - * 循环组动作表主键 - */ - @TableId(type = IdType.AUTO) - private Long id; - /** - * 对应条件表中for的id - */ - private Long conditionForId; - /** - * 对应条件表中条件id - */ - private Long conditionGroupId; - /** - * 动作类型 1-求和,2-赋值,3-输出输出变量,4-输出常量 - */ - private Integer actionType; - /** - * 动作的key - */ - private String actionKey; - /** - * 动作的value - */ - private String actionValue; - /** - * 创建时间 - */ - private Date createTime; - /** - * 修改时间 - */ - private Date updateTime; - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/model/RuleScriptVersion.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/model/RuleScriptVersion.java deleted file mode 100644 index f0e9393..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/model/RuleScriptVersion.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.baoying.enginex.executor.rule.model; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.util.Date; - - -@Data -@NoArgsConstructor -@AllArgsConstructor -@TableName("`t_rule_script_version`") -public class RuleScriptVersion implements Serializable { - private static final long serialVersionUID = -78864192587533951L; - /** - * 主键:规则版本id - */ - @TableId(type = IdType.AUTO) - private Long id; - /** - * 规则id - */ - private Long ruleId; - /** - * 版本号 - */ - private String versionCode; - /** - * 版本描述 - */ - private String description; - /** - * 状态:-1删除 ,1启用,0停用 - */ - private Integer status; - /** - * 脚本类型:groovy,python,js - */ - private String scriptType; - /** - * 脚本规则集内容json,包含脚本内容和脚本所用字段两个值 - */ - private String scriptContent; - /** - * 组织id - */ - private Long organId; - /** - * 创建者id - */ - private Long createUserId; - /** - * 修改者id - */ - private Long updateUserId; - /** - * 创建时间 - */ - private Date createTime; - /** - * 修改时间 - */ - private Date updateTime; - /** - * 规则版本配置快照 - */ - private String snapshot; - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/model/RuleVersion.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/model/RuleVersion.java deleted file mode 100644 index 50651a0..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/model/RuleVersion.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.baoying.enginex.executor.rule.model; - -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.util.Date; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@TableName("`t_rule_version`") -public class RuleVersion implements Serializable { - private static final long serialVersionUID = -1850194333747447612L; - /** - * 规则版本主键id - */ - @TableId( type = IdType.AUTO) - private Long id; - /** - * 规则id - */ - private Long ruleId; - /** - * 规则版本号 - */ - private String versionCode; - /** - * 描述信息 - */ - private String description; - /** - * 状态:-1 删除 0停用 1启用 - */ - private Integer status; - /** - * 规则结果en(命中情况) - */ - private String resultFieldEn; - /** - * 规则得分 - */ - private Integer score; - /** - * 规则得分的en - */ - private String scoreFieldEn; - /** - * 组织id - */ - private Long organId; - /** - * 创建者id - */ - private Long createUserId; - /** - * 修改者id - */ - private Long updateUserId; - /** - * 创建时间 - */ - private Date createTime; - /** - * 修改时间 - */ - private Date updateTime; - /** - * 规则版本快照 - */ - private String snapshot; -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/model/vo/RuleConditionVo.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/model/vo/RuleConditionVo.java deleted file mode 100644 index ebcde12..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/model/vo/RuleConditionVo.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.baoying.enginex.executor.rule.model.vo; - - -import com.baoying.enginex.executor.rule.model.RuleConditionInfo; -import com.baoying.enginex.executor.rule.model.RuleLoopGroupAction; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors -public class RuleConditionVo extends RuleConditionInfo { - -// private Long id;//主键ID -// -// private String logical;//关系节点的逻辑符号:&&(并关系),||(或关系) -// -// private Long fieldId;//表达式节点对应的字段id -// -// private String fieldEn;//字段en -// private String fieldType;//字段的类型:1中间变量 2 入参 -// private String operator;//表达式节点的操作符 -// private Integer variableType;//变量类型,1常量 2变量 -// private String fieldValue;//表达式节点对应字段的限定值 -// private String executionLogic;//执行逻辑 -// private Long ruleId;//规则表的id -// -// private Long parentId;//父节点的id -// -// private Integer conditionType;//规则节点的类型:1-关系节点,2-表达式节点 -// -// private Date createTime;//创建时间 -// -// private Date updateTime;//修改时间 -// -// private String insertTempId;//插入时临时id -// -// private String TempParentId;//插入时临时父id - - private List children;//规则子节点 - -// private Integer valueType;//字段类型 -// -// private List loopGroupActions = new ArrayList<>();//循环组对应的条件,循环内的组条件下的操作列表 -// -// private RuleConditionVo loopResultCondition;//for对应的结果条件的计算条件树 -// -// private RuleConditionVo condGroupResultCondition;//条件组对应的结果计算条件树 -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/model/vo/RuleVersionVo.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/model/vo/RuleVersionVo.java deleted file mode 100644 index 8661bec..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/model/vo/RuleVersionVo.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.baoying.enginex.executor.rule.model.vo; - - -import com.baoying.enginex.executor.rule.model.RuleVersion; -import com.baoying.enginex.executor.tactics.model.TacticsOutput; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import java.util.List; - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class RuleVersionVo extends RuleVersion { - private RuleConditionVo ruleConditionVo;//规则对应的结点树 - - private List tacticsOutputList;//成功输出字段 - private List failOutputList;//失败输出字段 -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/model/vo/RuleVo.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/model/vo/RuleVo.java deleted file mode 100644 index 85805a4..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/model/vo/RuleVo.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.baoying.enginex.executor.rule.model.vo; - - -import com.baoying.enginex.executor.rule.model.RuleFieldInfo; -import com.baoying.enginex.executor.rule.model.RuleInfo; -import com.baoying.enginex.executor.rule.model.RuleScriptVersion; -import com.baoying.enginex.executor.tactics.model.TacticsOutput; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; -import java.util.List; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors -public class RuleVo extends RuleInfo { - - private RuleConditionVo ruleConditionVo;//规则对应的结点树 - - - private List ruleFieldList;//简单规则条件列表 - - private List tacticsOutputList;//输出字段 - - private List ruleVersionList;//版本列表 - private List ruleScriptVersionList; -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/RuleConditionService.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/RuleConditionService.java deleted file mode 100644 index 0bc281d..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/RuleConditionService.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baoying.enginex.executor.rule.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.baoying.enginex.executor.rule.model.RuleConditionInfo; -import com.baoying.enginex.executor.rule.model.vo.RuleConditionVo; - -import java.util.List; - - -public interface RuleConditionService extends IService { - - RuleConditionVo queryByVersionId(Long versionId); - - List queryFieldEnByVersionIds(List versionIds); -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/RuleFieldInfoService.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/RuleFieldInfoService.java deleted file mode 100644 index 014a3b8..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/RuleFieldInfoService.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.baoying.enginex.executor.rule.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.baoying.enginex.executor.rule.model.RuleFieldInfo; - -import java.util.List; - -public interface RuleFieldInfoService extends IService { - - List queryByRuleId(Long ruleId); - - List getFieldEnList(List ruleIds); -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/RuleLoopGroupActionService.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/RuleLoopGroupActionService.java deleted file mode 100644 index cd94ef0..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/RuleLoopGroupActionService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baoying.enginex.executor.rule.service; - - -import com.baomidou.mybatisplus.extension.service.IService; -import com.baoying.enginex.executor.rule.model.RuleLoopGroupAction; - -import java.util.List; - - -public interface RuleLoopGroupActionService extends IService { - - List getRuleLoopList(Long forId, Long conditionId); - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/RuleScriptVersionService.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/RuleScriptVersionService.java deleted file mode 100644 index 3012fc8..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/RuleScriptVersionService.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.baoying.enginex.executor.rule.service; - - - -import com.baomidou.mybatisplus.extension.service.IService; -import com.baoying.enginex.executor.rule.model.RuleScriptVersion; - -import java.util.List; - - -public interface RuleScriptVersionService extends IService { - RuleScriptVersion queryById(Long id); - - List queryVersionListByRuleId(Long ruleId); - - List queryFieldEnByVersionId(Long versionId); - List queryFieldEnByVersionIds(List versionId); - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/RuleService.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/RuleService.java deleted file mode 100644 index 6a75acd..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/RuleService.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.baoying.enginex.executor.rule.service; - - -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baoying.enginex.executor.rule.model.RuleInfo; -import com.baoying.enginex.executor.rule.model.vo.RuleVo; - - -import java.util.List; -import java.util.Map; - -public interface RuleService extends IService { - - /** - * 通过ID查询单条数据 - * @param id 主键 - * @return 实例对象 - */ - RuleVo queryById(Long id); - - List setComplexRuleOutput(Long versionId, Map temp, Map input, String outType); - - List setBaseRuleOutput(Long ruleId, Map input); - - List getRuleList(List ruleIds); - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/RuleVersionService.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/RuleVersionService.java deleted file mode 100644 index be7aacc..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/RuleVersionService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baoying.enginex.executor.rule.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import com.baoying.enginex.executor.rule.model.RuleVersion; -import com.baoying.enginex.executor.rule.model.vo.RuleVersionVo; - -import java.util.List; - -public interface RuleVersionService extends IService { - - RuleVersionVo queryById(Long id); - - List queryVersionListByRuleId(Long ruleId); -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/impl/RuleConditionServiceImpl.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/impl/RuleConditionServiceImpl.java deleted file mode 100644 index 7104395..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/impl/RuleConditionServiceImpl.java +++ /dev/null @@ -1,158 +0,0 @@ -package com.baoying.enginex.executor.rule.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.baoying.enginex.executor.canal.TableEnum; -import com.baoying.enginex.executor.common.constants.Constants; -import com.baoying.enginex.executor.config.ConfigHolder; -import com.baoying.enginex.executor.redis.RedisManager; -import com.baoying.enginex.executor.redis.RedisUtils; -import com.baoying.enginex.executor.rule.consts.RuleConditionConst; -import com.baoying.enginex.executor.rule.mapper.RuleConditionInfoMapper; -import com.baoying.enginex.executor.rule.model.RuleConditionInfo; -import com.baoying.enginex.executor.rule.model.RuleLoopGroupAction; -import com.baoying.enginex.executor.rule.model.vo.RuleConditionVo; -import com.baoying.enginex.executor.rule.service.RuleConditionService; -import com.baoying.enginex.executor.rule.service.RuleLoopGroupActionService; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - - -@Service("ruleConditionService2") -public class RuleConditionServiceImpl extends ServiceImpl implements RuleConditionService { - - @Resource - private RuleConditionInfoMapper ruleConditionInfoMapper; - @Resource - private RuleLoopGroupActionService loopGroupActionService; - @Autowired - private ConfigHolder configHolder; - @Autowired - private RedisManager redisManager; - - @Override - public RuleConditionVo queryByVersionId(Long versionId) { - if (versionId == null) { - return null; - } - //构造查询条件,查询条件列表 - RuleConditionVo result = null; - - List ruleConditionInfoList = null; - if(Constants.switchFlag.ON.equals(configHolder.getCacheSwitch())){ - String key = RedisUtils.getForeignKey(TableEnum.T_RULE_CONDITION, versionId); - ruleConditionInfoList = redisManager.getByForeignKey(key, RuleConditionInfo.class); - } else { - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(RuleConditionInfo::getVersionId, versionId); - ruleConditionInfoList = ruleConditionInfoMapper.selectList(queryWrapper); - } - - //组装为需要的树形结构 - if (ruleConditionInfoList != null) { - result = this.assemble(ruleConditionInfoList); - } - return result; - } - - @Override - public List queryFieldEnByVersionIds(List versionIds) { - List ruleConditions = null; - if(Constants.switchFlag.ON.equals(configHolder.getCacheSwitch())){ - List keys = RedisUtils.getForeignKey(TableEnum.T_RULE_CONDITION, versionIds); - ruleConditions = redisManager.hgetAllBatchByForeignKeys(keys, RuleConditionInfo.class); - - ruleConditions = ruleConditions.stream() - .filter(item -> StringUtils.isNotBlank(item.getFieldEn()) && !"1".equals(item.getFieldType())) - .collect(Collectors.toList()); - - } else { - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.in(RuleConditionInfo::getVersionId,versionIds); - queryWrapper.isNotNull(RuleConditionInfo::getFieldEn); - queryWrapper.ne(RuleConditionInfo::getFieldType,1); - queryWrapper.select(RuleConditionInfo::getFieldEn); - ruleConditions = ruleConditionInfoMapper.selectList(queryWrapper); - } - - List result = new ArrayList<>(); - if (ruleConditions != null){ - for (RuleConditionInfo condition : ruleConditions) { - result.add(condition.getFieldEn()); - } - } - return result; - } - - //装配方法,将规则条件List装配成一个规则树并返回 - public RuleConditionVo assemble(List list) { - RuleConditionVo root = null; - //转换为Vo - List rcVoList = transferToVoList(list); - //获取根节点,根节点只有一个的时候进行操作,并且返回拼装好的规则树,否则返回null - List collect = rcVoList.stream().filter(rc -> { - return rc.getParentId() == RuleConditionConst.DEFAULT_CONDITION_PARENT_ID; - }).collect(Collectors.toList()); - if (collect.size() == 1) { - root = collect.get(0); - RuleConditionVo ruleTree = coupling(rcVoList, root); - return ruleTree; - } - return null; - } - - //耦合方法:将规则节点列表耦合规则树(),循环规则的子节点需要去查循环表获取 - private RuleConditionVo coupling(List list, RuleConditionVo root) { - List children = new ArrayList<>(); - for (RuleConditionVo rc : list) { - //处理root的子节点 - if (root.getId().equals(rc.getParentId())) { - RuleConditionVo rcVo = coupling(list, rc); - String logical = root.getLogical(); - - if (logical!=null&&!"".equals(logical)){ - switch (logical){ - //当root为for节点,则此子节点需要拼上循环动作 - case RuleConditionConst.LOOP_RULE_LOGICAL: - List loopList = loopGroupActionService.getRuleLoopList(root.getId(),rc.getId()); - rcVo.setLoopGroupActions(loopList); - if (rc.getConditionType()==RuleConditionConst.LOOP_RULE_RESULT_CONDITION){ - root.setLoopResultCondition(rcVo); - continue; - } - break; - //当root为条件组节点,则此子节点需要拼上条件组结果 - case RuleConditionConst.CONDITION_GROUP_LOGICAL: - if (rc.getConditionType()==RuleConditionConst.CONDITION_GROUP_RESULT_CONDITION){ - root.setCondGroupResultCondition(rcVo); - continue; - } - break; - } - - } - children.add(rcVo); - } - } - root.setChildren(children); - return root; - } - - //List转换为List - private List transferToVoList(List list) { - List rcVoList = new ArrayList<>(); - for (int i = 0; i < list.size(); i++) { - RuleConditionVo rcVo = new RuleConditionVo(); - BeanUtils.copyProperties(list.get(i), rcVo); - rcVoList.add(rcVo); - } - return rcVoList; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/impl/RuleFieldInfoServiceImpl.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/impl/RuleFieldInfoServiceImpl.java deleted file mode 100644 index 2ee9479..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/impl/RuleFieldInfoServiceImpl.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.baoying.enginex.executor.rule.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.baoying.enginex.executor.canal.TableEnum; -import com.baoying.enginex.executor.common.constants.Constants; -import com.baoying.enginex.executor.config.ConfigHolder; -import com.baoying.enginex.executor.redis.RedisManager; -import com.baoying.enginex.executor.redis.RedisUtils; -import com.baoying.enginex.executor.rule.mapper.RuleFieldInfoMapper; -import com.baoying.enginex.executor.rule.model.RuleFieldInfo; -import com.baoying.enginex.executor.rule.service.RuleFieldInfoService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - -@Service -public class RuleFieldInfoServiceImpl extends ServiceImpl implements RuleFieldInfoService { - - @Resource - private RuleFieldInfoMapper ruleFieldInfoMapper; - @Autowired - private ConfigHolder configHolder; - @Autowired - private RedisManager redisManager; - - @Override - public List queryByRuleId(Long ruleId) { - RuleFieldInfo ruleFieldInfo = new RuleFieldInfo(); - ruleFieldInfo.setRuleId(ruleId); - List ruleFieldInfoList = ruleFieldInfoMapper.selectList(new QueryWrapper<>(ruleFieldInfo)); - return ruleFieldInfoList; - } - - @Override - public List getFieldEnList(List ruleIds) { - List list = null; - if(Constants.switchFlag.ON.equals(configHolder.getCacheSwitch())){ - List keys = RedisUtils.getForeignKey(TableEnum.T_RULE_FIELD, ruleIds); - List ruleFieldInfos = redisManager.hgetAllBatchByForeignKeys(keys, RuleFieldInfo.class); - Set set = ruleFieldInfos.stream().map(item -> { - String[] fieldIdArr = item.getFieldId().split("\\|"); // 587|f_hr_age - return fieldIdArr[1]; - }).collect(Collectors.toSet()); - - list = new ArrayList<>(set); - } else { - list = ruleFieldInfoMapper.getFieldEnList(ruleIds); - } - return list; - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/impl/RuleLoopGroupActionServiceImpl.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/impl/RuleLoopGroupActionServiceImpl.java deleted file mode 100644 index da28c09..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/impl/RuleLoopGroupActionServiceImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.baoying.enginex.executor.rule.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.baoying.enginex.executor.canal.TableEnum; -import com.baoying.enginex.executor.common.constants.Constants; -import com.baoying.enginex.executor.config.ConfigHolder; -import com.baoying.enginex.executor.redis.RedisManager; -import com.baoying.enginex.executor.redis.RedisUtils; -import com.baoying.enginex.executor.rule.mapper.RuleLoopGroupActionMapper; -import com.baoying.enginex.executor.rule.model.RuleLoopGroupAction; -import com.baoying.enginex.executor.rule.service.RuleLoopGroupActionService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - - -@Service("ruleLoopGroupActionService") -public class RuleLoopGroupActionServiceImpl extends ServiceImpl implements RuleLoopGroupActionService { - @Resource - private RuleLoopGroupActionMapper ruleLoopGroupActionMapper; - @Autowired - private ConfigHolder configHolder; - @Autowired - private RedisManager redisManager; - - @Override - public List getRuleLoopList(Long forId, Long conditionId) { - List loopList = null; - if(Constants.switchFlag.ON.equals(configHolder.getCacheSwitch())){ - String key = RedisUtils.getForeignKey(TableEnum.T_RULE_LOOP_GROUP_ACTION, forId); - loopList = redisManager.getByForeignKey(key, RuleLoopGroupAction.class); - loopList = loopList.stream().filter(item -> item.getConditionGroupId().equals(conditionId)).collect(Collectors.toList()); - } else { - RuleLoopGroupAction ruleLoopGroupAction = new RuleLoopGroupAction(); - ruleLoopGroupAction.setConditionForId(forId); - ruleLoopGroupAction.setConditionGroupId(conditionId); - loopList = ruleLoopGroupActionMapper.selectList(new QueryWrapper<>(ruleLoopGroupAction)); - } - - if (loopList==null){ - loopList = new ArrayList<>(); - } - return loopList; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/impl/RuleScriptVersionServiceImpl.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/impl/RuleScriptVersionServiceImpl.java deleted file mode 100644 index bca56a4..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/impl/RuleScriptVersionServiceImpl.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.baoying.enginex.executor.rule.service.impl; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; - -import com.baoying.enginex.executor.datamanage.model.Field; -import com.baoying.enginex.executor.rule.mapper.RuleScriptVersionMapper; -import com.baoying.enginex.executor.rule.model.RuleScriptVersion; -import com.baoying.enginex.executor.rule.service.RuleScriptVersionService; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - - -@Service("ruleScriptVersionService") -public class RuleScriptVersionServiceImpl extends ServiceImpl implements RuleScriptVersionService { - @Resource - private RuleScriptVersionMapper ruleScriptVersionMapper; - @Autowired - private ThreadPoolTaskExecutor threadPoolTaskExecutor; - - @Override - public RuleScriptVersion queryById(Long id) { - if (id!=null){ - return this.getById(id); - } - return null; - } - - @Override - public List queryVersionListByRuleId(Long ruleId) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(RuleScriptVersion::getRuleId,ruleId); - wrapper.eq(RuleScriptVersion::getStatus,1); - wrapper.orderByDesc(RuleScriptVersion::getId); - List list = this.list(wrapper); - return list; - } - - @Override - public List queryFieldEnByVersionId(Long versionId) { - - RuleScriptVersion ruleScriptVersion = this.queryById(versionId); - Set fieldEnSet = new HashSet<>(); - if (ruleScriptVersion==null){ - return new ArrayList<>(); - } - collectFieldEn(ruleScriptVersion,fieldEnSet); - return new ArrayList<>(fieldEnSet); - } - - @Override - public List queryFieldEnByVersionIds(List versionIds) { - LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.in(RuleScriptVersion::getId,versionIds); - List list = this.list(wrapper); - Set fieldEnSet = new HashSet<>(); - if (list!=null&&!list.isEmpty()){ - for (RuleScriptVersion ruleScriptVersion : list) { - collectFieldEn(ruleScriptVersion,fieldEnSet); - } - } - return new ArrayList<>(fieldEnSet); - } - private void collectFieldEn(RuleScriptVersion ruleScriptVersion,Set fieldEnSet){ - String scriptContent = ruleScriptVersion.getScriptContent(); - if (StringUtils.isNotBlank(scriptContent)){ - JSONObject jsonObject = JSON.parseObject(scriptContent); - Object farr = jsonObject.get("farr"); - if (farr!=null&&!"".equals(farr)){ - List fieldList = JSONArray.parseArray(JSON.toJSONString(farr), Field.class); - fieldEnSet.addAll(fieldList.stream().map(item->{return item.getFieldEn();}).collect(Collectors.toSet())); - } - } - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/impl/RuleServiceImpl.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/impl/RuleServiceImpl.java deleted file mode 100644 index 911e78d..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/impl/RuleServiceImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -package com.baoying.enginex.executor.rule.service.impl; - -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; - -import com.baoying.enginex.executor.canal.TableEnum; -import com.baoying.enginex.executor.common.constants.Constants; -import com.baoying.enginex.executor.config.ConfigHolder; -import com.baoying.enginex.executor.redis.RedisManager; -import com.baoying.enginex.executor.redis.RedisUtils; -import com.baoying.enginex.executor.rule.mapper.RuleInfoMapper; - -import com.baoying.enginex.executor.rule.model.RuleFieldInfo; -import com.baoying.enginex.executor.rule.model.RuleInfo; -import com.baoying.enginex.executor.rule.model.RuleScriptVersion; -import com.baoying.enginex.executor.rule.model.vo.RuleVersionVo; -import com.baoying.enginex.executor.rule.model.vo.RuleVo; -import com.baoying.enginex.executor.rule.service.RuleFieldInfoService; -import com.baoying.enginex.executor.rule.service.RuleScriptVersionService; -import com.baoying.enginex.executor.rule.service.RuleService; -import com.baoying.enginex.executor.rule.service.RuleVersionService; -import com.baoying.enginex.executor.tactics.consts.TacticsType; -import com.baoying.enginex.executor.tactics.model.TacticsOutput; -import com.baoying.enginex.executor.tactics.service.TacticsOutputService; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.*; - - -@Service("ruleService2") -public class RuleServiceImpl extends ServiceImpl implements RuleService { - @Resource - private RuleInfoMapper ruleInfoMapper; - @Autowired - private RuleVersionService versionService; - @Resource - private RuleFieldInfoService ruleFieldInfoService; - @Resource - private TacticsOutputService outputService; - @Autowired - private ConfigHolder configHolder; - @Autowired - private RedisManager redisManager; - @Resource - private RuleScriptVersionService ruleScriptVersionService; - - @Override - public RuleVo queryById(Long id) { - //查询规则 - RuleInfo ruleInfo = ruleInfoMapper.selectById(id); - if (ruleInfo==null){ - return null; - } - RuleVo ruleVo = new RuleVo(); - BeanUtils.copyProperties(ruleInfo, ruleVo); - Integer difficulty = ruleInfo.getDifficulty(); - switch (difficulty) { - case 1: - List list = ruleFieldInfoService.queryByRuleId(id); - List tacticsOutputList = outputService.queryByTactics(new TacticsOutput(id, TacticsType.BASE_RULE)); - ruleVo.setTacticsOutputList(tacticsOutputList); - ruleVo.setRuleFieldList(list); - break; - case 2: - //查询版本 - List ruleVersionList = versionService.queryVersionListByRuleId(id); - ruleVo.setRuleVersionList(ruleVersionList); - break; - case 3: - //脚本规则集 - List ruleScriptVersionList = ruleScriptVersionService.queryVersionListByRuleId(id); - ruleVo.setRuleScriptVersionList(ruleScriptVersionList); - break; - } - return ruleVo; - } - - @Override - public List setComplexRuleOutput(Long versionId, Map temp, Map input, String outType) { - List jsonObjectList = outputService.setOutput(new TacticsOutput(versionId, TacticsType.COMPLEX_RULE,outType), temp); - for (JSONObject jsonObject : jsonObjectList) { - input.putAll(jsonObject); - } - return jsonObjectList; - } - - @Override - public List setBaseRuleOutput(Long ruleId, Map input) { - List jsonObjectList = outputService.setOutput(new TacticsOutput(ruleId, TacticsType.BASE_RULE), input); - return jsonObjectList; - } - - @Override - public List getRuleList(List ruleIds) { - List ruleInfoList = null; - if(Constants.switchFlag.ON.equals(configHolder.getCacheSwitch())){ - List keys = RedisUtils.getPrimaryKey(TableEnum.T_RULE, ruleIds); - ruleInfoList = redisManager.hgetAllBatchByPrimaryKeys(keys, RuleInfo.class); - } else { - ruleInfoList = ruleInfoMapper.getRuleList(ruleIds); - } - return ruleInfoList; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/impl/RuleVersionServiceImpl.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/impl/RuleVersionServiceImpl.java deleted file mode 100644 index a6f65f5..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/rule/service/impl/RuleVersionServiceImpl.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.baoying.enginex.executor.rule.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.baoying.enginex.executor.canal.TableEnum; -import com.baoying.enginex.executor.common.constants.Constants; -import com.baoying.enginex.executor.config.ConfigHolder; -import com.baoying.enginex.executor.redis.RedisManager; -import com.baoying.enginex.executor.redis.RedisUtils; -import com.baoying.enginex.executor.rule.mapper.RuleVersionMapper; -import com.baoying.enginex.executor.rule.model.RuleVersion; -import com.baoying.enginex.executor.rule.model.vo.RuleConditionVo; -import com.baoying.enginex.executor.rule.model.vo.RuleVersionVo; -import com.baoying.enginex.executor.rule.service.RuleConditionService; -import com.baoying.enginex.executor.rule.service.RuleVersionService; -import com.baoying.enginex.executor.tactics.consts.TacticsType; -import com.baoying.enginex.executor.tactics.model.TacticsOutput; -import com.baoying.enginex.executor.tactics.service.TacticsOutputService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.List; - -@Service -public class RuleVersionServiceImpl extends ServiceImpl implements RuleVersionService { - - private Logger logger = LoggerFactory.getLogger(this.getClass()); - @Autowired - private RuleVersionMapper versionMapper; - @Autowired - private RuleConditionService conditionService; - @Autowired - private TacticsOutputService outputService; - @Autowired - private ConfigHolder configHolder; - @Autowired - private RedisManager redisManager; - - @Override - public RuleVersionVo queryById(Long id) { - RuleVersion ruleVersion = null; - if (Constants.switchFlag.ON.equals(configHolder.getCacheSwitch())) { - String key = RedisUtils.getPrimaryKey(TableEnum.T_RULE_VERSION, id); - ruleVersion = redisManager.getByPrimaryKey(key, RuleVersion.class); - } else { - ruleVersion = versionMapper.selectById(id); - } - - RuleVersionVo result = new RuleVersionVo(); - if (ruleVersion == null) { - return result; - } - BeanUtils.copyProperties(ruleVersion, result); - //查询ruleCondition组装成树形结构 - RuleConditionVo ruleConditionVo = conditionService.queryByVersionId(id); - List tacticsOutputList = outputService.queryByTactics(new TacticsOutput(id, TacticsType.COMPLEX_RULE,TacticsType.OutType.SUCCESS_OUT)); - List failOutputList = outputService.queryByTactics(new TacticsOutput(id, TacticsType.COMPLEX_RULE,TacticsType.OutType.FAIL_OUT)); - result.setRuleConditionVo(ruleConditionVo); - result.setTacticsOutputList(tacticsOutputList); - result.setFailOutputList(failOutputList); - return result; - } - - @Override - public List queryVersionListByRuleId(Long ruleId) { - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(RuleVersion::getRuleId,ruleId); - queryWrapper.eq(RuleVersion::getStatus,1); - queryWrapper.orderByDesc(RuleVersion::getUpdateTime); - List ruleVersionList = versionMapper.selectList(queryWrapper); - List ruleVersionVoList = new ArrayList<>(); - for (RuleVersion ruleVersion : ruleVersionList) { - RuleVersionVo versionVo = new RuleVersionVo(); - BeanUtils.copyProperties(ruleVersion,versionVo); - ruleVersionVoList.add(versionVo); - } - return ruleVersionVoList; - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/DepartmentMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/DepartmentMapper.java deleted file mode 100644 index cadfb7c..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/DepartmentMapper.java +++ /dev/null @@ -1,26 +0,0 @@ - -package com.baoying.enginex.executor.system.mapper; - - -import com.baoying.enginex.executor.common.mapper.BaseMapper; -import com.baoying.enginex.executor.system.model.Department; - - -public interface DepartmentMapper extends BaseMapper { - - /** - * isExist:(根据相应的条件判断是否存在重复值).
- * @author wz - * @param departmentVo 部门实体类 - * @return 返回行数 - */ - Integer isExist(Department department); - - /** - * deleteDept:(根据部门ids删除部门信息).
- * @author wz - * @param deletIds 部门ids - */ - void deleteDept(Long[] deletIds); -} - diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/DepartmentMapper.xml b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/DepartmentMapper.xml deleted file mode 100644 index 2199b8d..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/DepartmentMapper.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - INSERT INTO - manager_organization - - - org_name, - - - org_code, - - status, - updateTime - - values - - - #{deptName}, - - - #{deptCode}, - - 1, - now() - - - - - - - UPDATE manager_organization SET - - org_name = #{deptName} - - - ,org_code = #{deptCode} - - ,updateTime = now() - WHERE - status=1 - - and id = #{id} - - - - - UPDATE manager_organization SET - status=-1 - WHERE - id - IN - - #{deletIds} - - - - \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/MenuMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/MenuMapper.java deleted file mode 100644 index a2fa119..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/MenuMapper.java +++ /dev/null @@ -1,57 +0,0 @@ - -package com.baoying.enginex.executor.system.mapper; - - -import com.baoying.enginex.executor.common.mapper.BaseMapper; -import com.baoying.enginex.executor.system.model.Menu; - -import java.util.List; - - -public interface MenuMapper extends BaseMapper { - /** - * isExist:(根据相应的条件判断是否存在重复值).
- * @author wz - * @param menu 菜单实体类 - * @return 返回行数 - */ - Integer isExist(Menu menu); - - /** - * deleteRole:(根据菜单ids删除菜单信息).
- * @author wz - * @param deletIds 菜单ids - */ - void deleteMenu(Long[] deletIds); - - /** - * selectByRole:(根据角色查询).
- * @author wz - * @param menu - * @return 查询的菜单类 - */ - List selectByRole(Menu menu); - - /** - * deleteMenuRole:(删除菜单角色关联表).
- * @author wz - * @param menu 菜单实体类 - */ - void deleteMenuRole(Menu menu); - - /** - * insertMenuRole:(添加菜单角色关联表).
- * @author wz - * @param menu 菜单实体类 - */ - void insertMenuRole(Menu menu); - - /** - * findUserMenuByUser:(根据登录用户名查询相应授权菜单列表).
- * @author wz - * @param loginName - * @return 根据登录用户名查询相应授权菜单列表 - */ - List findUserMenuByUser(String loginName); -} - diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/MenuMapper.xml b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/MenuMapper.xml deleted file mode 100644 index bf94775..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/MenuMapper.xml +++ /dev/null @@ -1,236 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - INSERT INTO - manager_menu - - - pid, - - - name, - - - menu_code, - - - type, - - - url, - - - icon, - - status, - updateTime - - values - - - #{pid}, - - - #{name}, - - - #{menuCode}, - - - #{type}, - - - #{url}, - - - #{icon}, - - 1, - now() - - - - - - - UPDATE manager_menu SET - - pid = #{pid}, - - - name = #{name}, - - - type = #{type}, - - - url = #{url}, - - - icon = #{icon}, - - - name = #{name} - - - ,menu_code = #{menuCode} - - ,updateTime = now() - WHERE - status=1 - - and id = #{id} - - - - - UPDATE manager_menu SET - status=-1 - WHERE - id - IN - - #{deletIds} - - - - - DELETE FROM - manager_menu_role - WHERE - 1=1 - - and role_code = #{roleCode} - - - - - INSERT INTO - manager_menu_role - - - menu_id, - - - role_code - - - values - - - #{id}, - - - #{roleCode} - - - - - - - \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/RoleMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/RoleMapper.java deleted file mode 100644 index 9e07db8..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/RoleMapper.java +++ /dev/null @@ -1,26 +0,0 @@ - -package com.baoying.enginex.executor.system.mapper; - - -import com.baoying.enginex.executor.common.mapper.BaseMapper; -import com.baoying.enginex.executor.system.model.Role; - - -public interface RoleMapper extends BaseMapper { - - /** - * isExist:(根据相应的条件判断是否存在重复值).
- * @author wz - * @param role 角色实体类 - * @return 返回行数 - */ - Integer isExist(Role role); - - /** - * deleteRole:(根据角色ids删除角色信息).
- * @author wz - * @param deletIds 角色ids - */ - void deleteRole(Long[] deletIds); -} - diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/RoleMapper.xml b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/RoleMapper.xml deleted file mode 100644 index 6452fb1..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/RoleMapper.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - INSERT INTO - manager_role - - - name, - - - role_code, - - status, - updateTime - - values - - - #{name}, - - - #{roleCode}, - - 1, - now() - - - - - - - UPDATE manager_role SET - - name = #{name} - - - ,role_code = #{roleCode} - - ,updateTime = now() - WHERE - status=1 - - and id = #{id} - - - - - UPDATE manager_role SET - status=-1 - WHERE - id - IN - - #{deletIds} - - - - \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/SysMenuMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/SysMenuMapper.java deleted file mode 100644 index 5b78b9d..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/SysMenuMapper.java +++ /dev/null @@ -1,111 +0,0 @@ - -package com.baoying.enginex.executor.system.mapper; - -import com.baoying.enginex.executor.system.model.SysMenu; -import org.apache.ibatis.annotations.Param; - -import java.util.List; -import java.util.Map; - - -public interface SysMenuMapper { - - /** - * 查询所有资源 - * @return - */ - public List getAllSysMenu(); - /** - * 查询单条资源 - * @param id - * @return - */ - public SysMenu findById(long id); - /** - * 新增资源 - * @param sysMenu - * @return - */ - public int createSysMenu(SysMenu sysMenu); - /** - * 修改资源 - * @param sysMenu - * @return - */ - public int updateSysMenu(SysMenu sysMenu); - /** - * 删除资源 - * @param id - * @return - */ - public int deleteSysMenu(long id); - - /** - * 修改资源状态 - * @param id - * @param idList - * @return - */ - public int updateStatus(@Param("status") int status, @Param("list") List list); - - /** - * 通过父节点查询子菜单 - * @param id - * @return - */ - public List findChildByParent(long parentId); - - /** - * 通过角色菜单关系表及父节点查询菜单 - */ - public List findRoleMenuByParent(@Param("parentId") long parentId, @Param("roleId") long roleId); - - /** - * 保存角色菜单关系 - */ - public int insertRoleMenu(@Param("roleId") long roleId, @Param("list") List list); - - /** - * 删除角色菜单关系(实现修改) - */ - public int deleteRoleMenu(long roleId); - /** - * 分配资源树 - * @param roleId - * @return - */ - public List findTreeList(long roleId); - /** - * 获取所有启用资源 - * @return - */ - public List getAllValidMenu(); - - /** - * 获取引擎资源树 - */ - public List> getEngineTree(long roleId); - - /** - * 保存引擎树 - */ - public int insertRoleEngine(@Param("roleId") long roleId, @Param("list") List list); - /** - * 删除引擎树(实现修改) - */ - public int deleteRoleEngine(long roleId); - - /** - * 验证唯一性 - */ - public List validateMenuOnly(SysMenu sysMenu); - /** - * 验证是否有查看菜单的权限 - */ - public List validatePermission(@Param("roleId") long roleId, @Param("url") String url); - /** - * 验证是否有该引擎的权限 - */ - public List> validateEnginePermission(@Param("roleId") long roleId, @Param("id_e") String id_e); - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/SysMenuMapper.xml b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/SysMenuMapper.xml deleted file mode 100644 index 71ae388..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/SysMenuMapper.xml +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - - - - - - - - - - - - - resource_id, user_id, name, code, url, parent_id, des, birth, icon, status - - - - - - - - - - - - - - - - - - - - - - - - - - insert into t_resource (user_id, name, code, url, parent_id, des, birth, icon) - values (#{userId}, #{name}, #{code}, #{url}, #{parentId}, #{des}, now(), #{icon}) - - - - - insert into t_role_resource_rel (role_id, resource_id) - values - - (#{roleId}, #{ids}) - - - - - - insert into t_role_engine (role_id, id_str) - values - - (#{roleId}, #{ids}) - - - - - update t_resource set name=#{name}, - url=#{url}, - - des=#{des}, - - - icon=#{icon}, - - - user_id=#{userId}, - - - parent_id=#{parentId}, - - code=#{code} - where resource_id = #{id} - - - - update t_resource set status = -1 where resource_id = #{id} - - - - - delete from t_role_resource_rel where role_id = #{roleId} - - - - - delete from t_role_engine where role_id = #{roleId} - - - - update t_resource set status=#{status} - - - resource_id in - #{ids} - - - - - \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/SysOrganizationMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/SysOrganizationMapper.java deleted file mode 100644 index c6bd78b..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/SysOrganizationMapper.java +++ /dev/null @@ -1,57 +0,0 @@ - -package com.baoying.enginex.executor.system.mapper; - -import com.baoying.enginex.executor.system.model.SysOrganization; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - - -public interface SysOrganizationMapper { - /** - * 查询所有公司 - * @return - */ - public List getAllSysOrganization(); - /** - * 获取所有启用公司 - * @return - */ - public List getAllValidOrgan(); - /** - * 查询单个公司 - * @param id - * @return - */ - public SysOrganization findById(long id); - /** - * 创建公司 - * @param SysOrganization - * @return - */ - public int createSysOrganization(SysOrganization SysOrganization); - /** - * 修改组织 - * @param SysOrganization - * @return - */ - public int updateSysOrganization(SysOrganization SysOrganization); - /** - * 删除组织 - * @param id - * @return - */ - public int deleteSysOrganization(long id); - - /** - * 修改公司状态(停用/启用、删除) - * @param states - * @return - */ - public int updateStatus(@Param("status") int status, @Param("list") List list); - /** - * 验证唯一性 - */ - public List validateOrganOnly(SysOrganization SysOrganization); - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/SysOrganizationMapper.xml b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/SysOrganizationMapper.xml deleted file mode 100644 index 4c9805d..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/SysOrganizationMapper.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - - - - - - - - organ_id, name, code, email, telephone, status, birth, author,token - - - - - - - - - - - - - insert into t_organization (name, code, email, telephone, status, author, birth, token) - values (#{name}, #{code}, #{email}, #{telephone}, 1, #{author}, now(), #{token}) - - - - update t_organization set name=#{name}, - - email=#{email}, - - - telephone=#{telephone}, - - - author=#{author}, - - code=#{code} - where organ_id=#{id} - - - - update t_organization set status = -1 where organ_id=#{id} - - - - update t_organization set status=#{status} - - - organ_id in - #{ids} - - - - - \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/SysRoleMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/SysRoleMapper.java deleted file mode 100644 index 1dd6763..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/SysRoleMapper.java +++ /dev/null @@ -1,90 +0,0 @@ - -package com.baoying.enginex.executor.system.mapper; - -import com.baoying.enginex.executor.system.model.SysRole; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - - - -public interface SysRoleMapper { - /** - * 获取本组织所有角色 - * @return - */ - public List getAllSysRole(long organId); - /** - * 获取所有角色 - */ - public List getAllRoles(); - /** - * 获取本组织启用的角色 - * @param organId - * @return - */ - public List getAllValidRole(@Param("organId") long organId, @Param("author") String author); - /** - * 查询本组织的单个角色 - * @param id - * @return - */ - public SysRole findById(@Param("id") long id, @Param("organId") long organId); - /** - * 查询单个角色 - * @param id - * @return - */ - public SysRole findByAId(long id); - - /** - * 创建本组织角色 - * @param sysRole - * @return - */ - public int createSysRole(SysRole sysRole); - /** - * 修改本公司角色 - * @param sysRole - * @return - */ - public int updateSysRole(SysRole sysRole); - /** - * 删除本公司角色 - * @param id - * @return - */ - public int deleteSysRole(long id); - /** - * 创建公司管理员角色 - */ - public int createOrganRole(SysRole sysRole); - /** - * 修改角色状态(停用、启用、删除) - * @param id - * @param idList - * @return - */ - public int updateStatus(@Param("status") int status, @Param("list") List list); - /** - * 根据角色查询角色所在公司 - */ - public long getOrganByRoleId(long roleId); - - /** - * 验证角色唯一性 - */ - public List validateRoleOnly(SysRole sysRole); - /** - * 查询公司管理员角色id - */ - public List getOrganRoleByAuthor(SysRole sysRole); - /** - * 删除本公司所有角色 - */ - public int deleteAllRoles(long organId); - /** - * 删除多个公司的所有角色 - */ - public int deleteRolesByOrgans(@Param("status") Integer status, @Param("list") List list); -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/SysRoleMapper.xml b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/SysRoleMapper.xml deleted file mode 100644 index abddcb6..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/SysRoleMapper.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - - - - - - - - - - role_id, organ_id, role_name, role_code, role_desc, author, birth, status - - - - - - - - - - - - - - - - - - - - - - insert into t_role (role_id, organ_id, role_name, role_code, role_desc, author, birth, status) - values (#{id}, #{organId}, #{roleName}, #{roleCode}, #{roleDesc}, #{author}, now(), 1) - - - - insert into t_role (role_id, organ_id, role_name, role_code, role_desc, author, birth, status) - values (#{id}, #{organId}, #{roleName}, #{roleCode}, #{roleDesc}, #{author}, now(), 1) - - - - update t_role set - - role_desc=#{roleDesc}, - - - role_code=#{roleCode}, - - role_name=#{roleName} - where role_id = #{id} and organ_id = #{organId} - - - - update t_role set status = -1 where role_id = #{id} - - - - update t_role set status=#{status} - - - role_id in - #{ids} - - - - - - - update t_role set status = -1 where organ_id = #{organId} - - - - update t_role set status = #{status} - - - organ_id in - #{ids} - - - - - \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/SysUserMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/SysUserMapper.java deleted file mode 100644 index bf99eda..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/SysUserMapper.java +++ /dev/null @@ -1,120 +0,0 @@ - -package com.baoying.enginex.executor.system.mapper; - -import com.baoying.enginex.executor.system.model.SysUser; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - - - -public interface SysUserMapper { - /** - * 查询搜索用户 - */ - public List getAllUsers(SysUser sysUser); - /** - * 查询本组织单个用户 - * @param id - * @return - */ - public SysUser findById(SysUser sysUser); - /** - * 创建本公司用户 - * @param sysUser - * @return - */ - public long createSysUser(SysUser sysUser); - /** - * 添加用户角色关系 - * @param userId - * @param roleId - * @return - */ - public int insertUserRole(@Param("userId") long userId, - @Param("roleId") long roleId, - @Param("organId") long organId); - /** - * 修改本公司用户 - * @param sysUser - * @return - */ - public int updateSysUser(SysUser sysUser); - /** - * 修改用户角色关系 - * @param sysUser - * @return - */ - public int updateUserRole(SysUser sysUser); - /** - * 删除本公司用户 - * @param id - * @return - */ - public int deleteSysUser(long id); - /** - * 修改用户状态(停用/启用/删除) - * @param states - * @return - */ - public int updateStates(@Param("status") int status, @Param("list") List list); - /** - * 通过用户id查询角色 - * @param userId - * @return - */ - public SysUser findRoleByUserId(long userId); - - /** - * 重置密码 - */ - public int resetPassword(SysUser sysUser); - - /** - * 修改密码 - */ - public int updatePassword(SysUser sysUser); - - /** - * 本公司账号员工编号唯一性 - */ - public List validateUserOnly(SysUser sysUser); - - /** - * 删除本公司的所有账号 - */ - public int deleteAllUser(long organId); - /** - * 删除本公司的用户角色关系 - */ - public int deleteAllUserRole(long organId); - /** - * 删除多个公司的所有账号 - */ - public int deleteUsersByOrgans(@Param("status") Integer status, @Param("list") List list); - /** - * 删除多个公司的用户角色关系 - */ - public int deleteUserRoleByOrgan(@Param("status") Integer status, @Param("list") List list); - /** - * 删除角色账号关联关系 - */ - public int deleteUserRoleById(long RoleId); - /** - * 查询本角色下的所有账号 - */ - public List getUserIdsByRoleId(long roleId); - /** - * 删除角色关联的所有账号 - */ - public int deleteUsersByIds(@Param("status") Integer status, @Param("list") List list); - - /** - * 批量删除角色账号关系 - */ - public int deleteBatchUserRole(@Param("status") Integer status, @Param("list") List list); - /** - * 批量查询角色关联的账号 - */ - public List getBatchUserIdsByRoleId(List list); -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/SysUserMapper.xml b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/SysUserMapper.xml deleted file mode 100644 index 99059a2..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/SysUserMapper.xml +++ /dev/null @@ -1,255 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - user_id, organ_id, employee_id, account, password, nick_name, email, cellphone, qq, latest_time, latest_ip, status, birth, author - - - - - - - - - - - - - - - - - - - - - - - insert into t_user (organ_id, employee_id, account, password, nick_name, email, cellphone, qq, latest_time, latest_ip, status, birth, author) - values (#{organId}, #{employeeId}, #{account}, #{password}, #{nickName}, #{email}, #{cellphone}, #{qq}, #{latestTime}, #{latestIp}, 1, now(), #{author}) - - - - - insert into t_user_role_rel (user_id, role_id,organ_id) - values (#{userId}, #{roleId},#{organId}) - - - - - update t_user set account=#{account}, - - password = #{password} - - - employee_id=#{employeeId}, - - - email=#{email}, - - - cellphone=#{cellphone}, - - - qq=#{qq}, - - - latest_time=#{latestTime}, - - - latest_ip=#{latestIp}, - - - birth=#{birth}, - - - author=#{author}, - - nick_name=#{nickName} - where user_id=#{id} - - - - - update t_user_role_rel set user_id=#{id}, role_id=#{sysRole.id} - where user_id=#{id} - - - - - update t_user set status=-1 - where user_id=#{id} - - - - - update t_user set status=#{status} - - - user_id in - #{ids} - - - - - - - - update t_user set password = #{password} where user_id=#{id} - - - - - update t_user set password = #{password} where user_id=#{id} - - - - - update t_user set status = -1 where organ_id=#{organId} - - - - - update t_user_role_rel set status = -1 where organ_id = #{organId} - - - - update t_user set status = #{status} - - - organ_id in - #{ids} - - - - - - - update t_user_role_rel set status = #{status} - - - organ_id in - #{ids} - - - - - - - - update t_user_role_rel set status = -1 where role_id = #{roleId} - - - - - update t_user set status = #{status} - - - user_id in - #{ids} - - - - - - - - update t_user_role_rel set status = #{status} - - - role_id in - #{ids} - - - - - - \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/UserMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/UserMapper.java deleted file mode 100644 index 90e262f..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/UserMapper.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.baoying.enginex.executor.system.mapper; - - -import com.baoying.enginex.executor.common.mapper.BaseMapper; -import com.baoying.enginex.executor.system.model.User; -import com.baoying.enginex.executor.system.model.UserRole; - -import java.util.List; -import java.util.Set; - - -public interface UserMapper extends BaseMapper { - /** - * isExist:(根据相应的条件判断是否存在重复值).
- * @author wz - * @param user 用户实体类 - * @return 返回行数 - */ - Integer isExist(User user); - - /** - * selectLoginInfo:(用户登录判断).
- * @author wz - * @param user 用户实体类 - * @return User - */ - User selectLoginInfo(User user); - - /** - * deleteDept:(根据用户ids删除用户信息).
- * @author wz - * @param user 用户id - */ - void deleteUser(User user); - - /** - * insertUserRole:(增加记录到用户角色关系表).
- * @author wz - * @param userRolelist 用户角色关系list - */ - void insertUserRole(List userRolelist); - - /** - * deleteUserRole:(根据用户ids删除用户角色关联表信息).
- * @author wz - * @param deletIds 用户ids - */ - void deleteUserRole(Long[] deletIds); - - /** - * findUserMenuSet:(根据用户名获取所授权的菜单).
- * @author wz - * @param loginName - * @return 根据用户名获取所授权的菜单 - */ - Set findUserMenuSet(String loginName); -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/UserMapper.xml b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/UserMapper.xml deleted file mode 100644 index 027cfe8..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/mapper/UserMapper.xml +++ /dev/null @@ -1,243 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - INSERT INTO - manager_user - - - login_name, - - - name, - - - password, - - - email, - - - phone, - - - dept_code, - - status, - updateTime - - values - - - #{loginName}, - - - #{name}, - - - #{password}, - - - #{email}, - - - #{phone}, - - - #{deptCode}, - - 0, - now() - - - - - UPDATE manager_user SET - - login_name = #{loginName}, - - - name = #{name}, - - - password = #{password}, - - - email = #{email}, - - - phone = #{phone}, - - - dept_code = #{deptCode}, - - updateTime = now() - WHERE - status !=-1 - - and id = #{id} - - - - - INSERT INTO manager_user_role - (user_id,role_code) - values - - (#{item.userId},#{item.roleCode}) - - - - - - - - - DELETE FROM - manager_user_role - WHERE - user_id - IN - - #{deletIds} - - - - - UPDATE manager_user SET - status=#{status} - WHERE - id - IN - - #{item} - - - - - - \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/Department.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/Department.java deleted file mode 100644 index 52a60c4..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/Department.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.baoying.enginex.executor.system.model; - - -import com.baoying.enginex.executor.common.model.BasePage; - -import java.io.Serializable; - -public class Department extends BasePage implements Serializable { - - private static final long serialVersionUID = 1L; - /** - * 部门id - */ - private Long id; - /** - * 部门名称 - */ - private String deptName; - /** - * 部门编号 - */ - private String deptCode; - /** - * 部门排序 - */ - private Integer deptOrder; - /** - * 状态 - */ - private Integer status; - /** - * 创建人 - */ - private String creator; - /** - * 创建时间 - */ - private String createTime; - /** - * 最后修改人 - */ - private String updater; - /** - * 最后修改时间 - */ - private String updateTime; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getDeptName() { - return deptName; - } - - public void setDeptName(String deptName) { - this.deptName = deptName; - } - - public String getDeptCode() { - return deptCode; - } - - public void setDeptCode(String deptCode) { - this.deptCode = deptCode; - } - - public Integer getDeptOrder() { - return deptOrder; - } - - public void setDeptOrder(Integer deptOrder) { - this.deptOrder = deptOrder; - } - - public Integer getStatus() { - return status; - } - - public void setStatus(Integer status) { - this.status = status; - } - - public String getCreator() { - return creator; - } - - public void setCreator(String creator) { - this.creator = creator; - } - - public String getCreateTime() { - return createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } - - public String getUpdater() { - return updater; - } - - public void setUpdater(String updater) { - this.updater = updater; - } - - public String getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(String updateTime) { - this.updateTime = updateTime; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/Menu.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/Menu.java deleted file mode 100644 index 37bb55b..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/Menu.java +++ /dev/null @@ -1,247 +0,0 @@ -package com.baoying.enginex.executor.system.model; - - -import com.baoying.enginex.executor.common.model.BasePage; - -import java.io.Serializable; -import java.util.Arrays; - - -public class Menu extends BasePage implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 菜单主键id - */ - private Long id; - /** - * 父id - */ - private Long pid; - /** - * 菜单名称 - */ - private String name; - /** - * 菜单类型 - */ - private Integer type; - /** - * 菜单顺序 - */ - private Integer muneOrder; - /** - * easyui展开 - */ - private String state; - /** - * 菜单链接 - */ - private String url; - /** - * 菜单编号 - */ - private String menuCode; - /** - * 菜单图标 - */ - private String icon; - /** - * 菜单描述 - */ - private String description; - /** - * 菜单状态 - */ - private Integer status; - /** - * 创建人 - */ - private String creator; - /** - * 创建时间 - */ - private String createTime; - /** - * 最后修改人 - */ - private String updater; - /** - * 最后修改时间 - */ - private String updateTime; - - /** - * 父类 - */ - private Long _parentId; - - /** - * 角色编码 - */ - private String roleCode; - - /** - * 删除ids数组 - */ - private Long []deletIds; - - public String getState() { - return state; - } - - public void setState(String state) { - this.state = state; - } - - public Long[] getDeletIds() { - return deletIds; - } - - public void setDeletIds(Long[] deletIds) { - this.deletIds = deletIds; - } - - public String getRoleCode() { - return roleCode; - } - - public void setRoleCode(String roleCode) { - this.roleCode = roleCode; - } - - public Long get_parentId() { - return _parentId; - } - - public void set_parentId(Long _parentId) { - this._parentId = _parentId; - } - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public Long getPid() { - return pid; - } - - public void setPid(Long pid) { - this.pid = pid; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Integer getType() { - return type; - } - - public void setType(Integer type) { - this.type = type; - } - - public Integer getMuneOrder() { - return muneOrder; - } - - public void setMuneOrder(Integer muneOrder) { - this.muneOrder = muneOrder; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getMenuCode() { - return menuCode; - } - - public void setMenuCode(String menuCode) { - this.menuCode = menuCode; - } - - public String getIcon() { - return icon; - } - - public void setIcon(String icon) { - this.icon = icon; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Integer getStatus() { - return status; - } - - public void setStatus(Integer status) { - this.status = status; - } - - public String getCreator() { - return creator; - } - - public void setCreator(String creator) { - this.creator = creator; - } - - public String getCreateTime() { - return createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } - - public String getUpdater() { - return updater; - } - - public void setUpdater(String updater) { - this.updater = updater; - } - - public String getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(String updateTime) { - this.updateTime = updateTime; - } - - @Override - public String toString() { - return "Menu [id=" + id + ", pid=" + pid + ", name=" + name + ", type=" - + type + ", muneOrder=" + muneOrder + ", state=" + state - + ", url=" + url + ", menuCode=" + menuCode + ", icon=" + icon - + ", description=" + description + ", status=" + status - + ", creator=" + creator + ", createTime=" + createTime - + ", updater=" + updater + ", updateTime=" + updateTime - + ", _parentId=" + _parentId + ", roleCode=" + roleCode - + ", deletIds=" + Arrays.toString(deletIds) + "]"; - } - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/MenuJson.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/MenuJson.java deleted file mode 100644 index a197ed6..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/MenuJson.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.baoying.enginex.executor.system.model; - -import java.util.List; - - -public class MenuJson { - - private String menuid; - private String icon; - private String menuname; - private String url; - private List menus; - - public String getMenuid() { - return menuid; - } - - public void setMenuid(String menuid) { - this.menuid = menuid; - } - - public String getIcon() { - return icon; - } - - public void setIcon(String icon) { - this.icon = icon; - } - - public String getMenuname() { - return menuname; - } - - public void setMenuname(String menuname) { - this.menuname = menuname; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public List getMenus() { - return menus; - } - - public void setMenus(List menus) { - this.menus = menus; - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/Pager.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/Pager.java deleted file mode 100644 index 387d61e..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/Pager.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.baoying.enginex.executor.system.model; - -public class Pager { - - private int rows = 10; - private int totalResult; - private int page; - - private String sortField; - private String order; - - public Pager() { - } - - public Pager(int totalResult) { - this.totalResult = totalResult; - } - - public int getRows() { - return rows; - } - - public void setRows(int rows) { - this.rows = rows; - } - - public int getPage() { - return page; - } - - public void setPage(int page) { - this.page = page; - } - - public int getTotalPage() { - return (totalResult + rows - 1) / rows; - } - - public int getTotalResult() { - return totalResult; - } - - public void setTotalResult(int totalResult) { - this.totalResult = totalResult; - } - - public int getCurrentResult() { - if (page == 0) return 0; - else return (page - 1) * rows; - } - - public String getSortField() { - return sortField; - } - - public void setSortField(String sortField) { - this.sortField = sortField; - } - - public String getOrder() { - return order; - } - - public void setOrder(String order) { - this.order = order; - } - - public int getPageCount() { - int pagecount = 0; - if (totalResult % rows == 0) { - pagecount = totalResult / rows; - } else { - pagecount = totalResult / rows + 1; - } - return pagecount; - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/Role.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/Role.java deleted file mode 100644 index 8d4b8c2..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/Role.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.baoying.enginex.executor.system.model; - - -import com.baoying.enginex.executor.common.model.BasePage; - -import java.io.Serializable; - - -public class Role extends BasePage implements Serializable { - private static final long serialVersionUID = 1L; - - /** - * 主键id - */ - private Long id; - /** - * 角色名称 - */ - private String name; - /** - * 角色编码 - */ - private String roleCode; - /** - * 角色描述 - */ - private String descripttion; - /** - * 状态 - */ - private Integer status; - /** - * 创建人 - */ - private String creator; - /** - * 创建时间 - */ - private String createTime; - /** - * 最后修改人 - */ - private String updater; - /** - * 最后修改时间 - */ - private String updateTime; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getRoleCode() { - return roleCode; - } - - public void setRoleCode(String roleCode) { - this.roleCode = roleCode; - } - - public String getDescripttion() { - return descripttion; - } - - public void setDescripttion(String descripttion) { - this.descripttion = descripttion; - } - - public Integer getStatus() { - return status; - } - - public void setStatus(Integer status) { - this.status = status; - } - - public String getCreator() { - return creator; - } - - public void setCreator(String creator) { - this.creator = creator; - } - - public String getCreateTime() { - return createTime; - } - - public void setCreateTime(String createTime) { - this.createTime = createTime; - } - - public String getUpdater() { - return updater; - } - - public void setUpdater(String updater) { - this.updater = updater; - } - - public String getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(String updateTime) { - this.updateTime = updateTime; - } - - @Override - public String toString() { - return "Role [id=" + id + ", name=" + name + ", roleCode=" + roleCode - + ", descripttion=" + descripttion + ", status=" + status - + ", creator=" + creator + ", createTime=" + createTime - + ", updater=" + updater + ", updateTime=" + updateTime + "]"; - } - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/SysMenu.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/SysMenu.java deleted file mode 100644 index 7bcb694..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/SysMenu.java +++ /dev/null @@ -1,127 +0,0 @@ - -package com.baoying.enginex.executor.system.model; - -import java.io.Serializable; -import java.util.Date; - - - -public class SysMenu implements Serializable { - - private static final long serialVersionUID = -1L; - - private long id; - private long userId;//分配者 - private String name; //资源名称 - private String code;//资源代号 - private String url;//路径 - private long parentId;//父节点 - private String des; - private Date birth;//创建时间 - private String icon;//图标 - private int status;//状态 - private long roleId;//角色id - private boolean checked;//菜单默认选中 - private boolean chkDisabled;//节点是否禁用 - private boolean isHidden;//节点是否隐藏 - - - - - public boolean isisHidden() { - return isHidden; - } - public void setisHidden(boolean isHidden) { - this.isHidden = isHidden; - } - public boolean isChkDisabled() { - return chkDisabled; - } - public void setChkDisabled(boolean chkDisabled) { - this.chkDisabled = chkDisabled; - } - public boolean isChecked() { - return checked; - } - public void setChecked(boolean checked) { - this.checked = checked; - } - public long getRoleId() { - return roleId; - } - public void setRoleId(long roleId) { - this.roleId = roleId; - } - public int getStatus() { - return status; - } - public void setStatus(int status) { - this.status = status; - } - public String getDes() { - return des; - } - public void setDes(String des) { - this.des = des; - } - public long getId() { - return id; - } - public void setId(long id) { - this.id = id; - } - public long getUserId() { - return userId; - } - public void setUserId(long userId) { - this.userId = userId; - } - public long getParentId() { - return parentId; - } - public void setParentId(long parentId) { - this.parentId = parentId; - } - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public String getCode() { - return code; - } - public void setCode(String code) { - this.code = code; - } - public String getUrl() { - return url; - } - public void setUrl(String url) { - this.url = url; - } - public String getIcon() { - return icon; - } - public void setIcon(String icon) { - this.icon = icon; - } - public Date getBirth() { - return birth; - } - public void setBirth(Date birth) { - this.birth = birth; - } - @Override - public String toString() { - return "SysMenu [id=" + id + ", userId=" + userId + ", name=" + name - + ", versionCode=" + code + ", url=" + url + ", parentId=" + parentId - + ", des=" + des + ", birth=" + birth + ", icon=" + icon - + ", status=" + status + ", roleId=" + roleId + ", checked=" - + checked + ", chkDisabled=" + chkDisabled + ", isHidden=" - + isHidden + "]"; - } - - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/SysOrganization.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/SysOrganization.java deleted file mode 100644 index 8bfb985..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/SysOrganization.java +++ /dev/null @@ -1,89 +0,0 @@ - -package com.baoying.enginex.executor.system.model; - -import java.io.Serializable; -import java.util.Date; - - - -public class SysOrganization implements Serializable { - - private static final long serialVersionUID = -1L; - - private long id;//组织编号 - private String name;//组织名称 - private String code;//组织代号 - private String email; - private String telephone; - private int status;//0禁用1启用 - private String author;//创建者 - private Date birth;//创建时间 - private String token;//唯一标识 - - - - public String getToken() { - return token; - } - public void setToken(String token) { - this.token = token; - } - public String getAuthor() { - return author; - } - public void setAuthor(String author) { - this.author = author; - } - public long getId() { - return id; - } - public void setId(long id) { - this.id = id; - } - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - public String getCode() { - return code; - } - public void setCode(String code) { - this.code = code; - } - public String getEmail() { - return email; - } - public void setEmail(String email) { - this.email = email; - } - public String getTelephone() { - return telephone; - } - public void setTelephone(String telephone) { - this.telephone = telephone; - } - public int getStatus() { - return status; - } - public void setStatus(int status) { - this.status = status; - } - public Date getBirth() { - return birth; - } - public void setBirth(Date birth) { - this.birth = birth; - } - @Override - public String toString() { - return "SysOrganization [id=" + id + ", name=" + name + ", versionCode=" + code - + ", email=" + email + ", telephone=" + telephone + ", status=" - + status + ", author=" + author + ", birth=" + birth - + ", token=" + token + "]"; - } - - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/SysRole.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/SysRole.java deleted file mode 100644 index cfb9aa7..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/SysRole.java +++ /dev/null @@ -1,83 +0,0 @@ - -package com.baoying.enginex.executor.system.model; - -import java.io.Serializable; -import java.util.Date; - - - -public class SysRole implements Serializable { - - private static final long serialVersionUID = -1L; - - private long id; - private long organId; - private String roleName; - private String roleCode;//角色代号 - private String roleDesc; - private String author;//创建者 - private Date birth;//创建时间 - private int status; //状态0禁用1启用 - - - - - public String getAuthor() { - return author; - } - public void setAuthor(String author) { - this.author = author; - } - public Date getBirth() { - return birth; - } - public void setBirth(Date birth) { - this.birth = birth; - } - public long getOrganId() { - return organId; - } - public void setOrganId(long organId) { - this.organId = organId; - } - public long getId() { - return id; - } - public void setId(long id) { - this.id = id; - } - public String getRoleName() { - return roleName; - } - public void setRoleName(String roleName) { - this.roleName = roleName; - } - public String getRoleCode() { - return roleCode; - } - public void setRoleCode(String roleCode) { - this.roleCode = roleCode; - } - public String getRoleDesc() { - return roleDesc; - } - public void setRoleDesc(String roleDesc) { - this.roleDesc = roleDesc; - } - public int getStatus() { - return status; - } - public void setStatus(int status) { - this.status = status; - } - @Override - public String toString() { - return "SysRole [id=" + id + ", organId=" + organId + ", roleName=" - + roleName + ", roleCode=" + roleCode + ", roleDesc=" + roleDesc - + ", author=" + author + ", birth=" + birth + ", status=" - + status + "]"; - } - - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/SysSuccess.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/SysSuccess.java deleted file mode 100644 index ed50b75..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/SysSuccess.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.baoying.enginex.executor.system.model; - -public class SysSuccess { - - private boolean success; - private String msg; - - public SysSuccess() { - } - - public SysSuccess(boolean value, String msg) { - super(); - this.success = value; - this.msg = msg; - } - - public boolean getSuccess() { - return success; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public String getMsg() { - return msg; - } - - public void setMsg(String msg) { - this.msg = msg; - } - - @Override - public String toString() { - return "SysSuccess [success=" + success + ", msg=" + msg + "]"; - } - - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/SysUser.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/SysUser.java deleted file mode 100644 index 143255a..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/SysUser.java +++ /dev/null @@ -1,141 +0,0 @@ - -package com.baoying.enginex.executor.system.model; - -import java.io.Serializable; -import java.util.Date; - - - -public class SysUser implements Serializable { - - private static final long serialVersionUID = -1L; - - private long id;//用户(主键) - private long organId;//组织编号 - private String employeeId;//员工编号 - private String account;//账户 - private String password; - private String nickName;//昵称 - private String email; - private String cellphone; - private String qq; - private String latestTime; - private String latestIp; - private int status; - private Date birth;//创建时间 - private String author;//创建人 - private SysRole sysRole;//角色对象 - private SysOrganization sysOrgan;//公司对象 - - - - - - public SysOrganization getSysOrgan() { - return sysOrgan; - } - public void setSysOrgan(SysOrganization sysOrgan) { - this.sysOrgan = sysOrgan; - } - public String getAuthor() { - return author; - } - public void setAuthor(String author) { - this.author = author; - } - public String getEmployeeId() { - return employeeId; - } - public void setEmployeeId(String employeeId) { - this.employeeId = employeeId; - } - public long getId() { - return id; - } - public void setId(long id) { - this.id = id; - } - public long getOrganId() { - return organId; - } - public void setOrganId(long organId) { - this.organId = organId; - } - public String getAccount() { - return account; - } - public void setAccount(String account) { - this.account = account; - } - public String getPassword() { - return password; - } - public void setPassword(String password) { - this.password = password; - } - public String getNickName() { - return nickName; - } - public void setNickName(String nickName) { - this.nickName = nickName; - } - public String getEmail() { - return email; - } - public void setEmail(String email) { - this.email = email; - } - public String getCellphone() { - return cellphone; - } - public void setCellphone(String cellphone) { - this.cellphone = cellphone; - } - public String getQq() { - return qq; - } - public void setQq(String qq) { - this.qq = qq; - } - public String getLatestTime() { - return latestTime; - } - public void setLatestTime(String latestTime) { - this.latestTime = latestTime; - } - public String getLatestIp() { - return latestIp; - } - public void setLatestIp(String latestIp) { - this.latestIp = latestIp; - } - public int getStatus() { - return status; - } - public void setStatus(int status) { - this.status = status; - } - public SysRole getSysRole() { - return sysRole; - } - public void setSysRole(SysRole sysRole) { - this.sysRole = sysRole; - } - public Date getBirth() { - return birth; - } - public void setBirth(Date birth) { - this.birth = birth; - } - @Override - public String toString() { - return "SysUser [id=" + id + ", organId=" + organId + ", employeeId=" - + employeeId + ", account=" + account + ", password=" + password - + ", nickName=" + nickName + ", email=" + email + ", cellphone=" - + cellphone + ", qq=" + qq + ", latestTime=" + latestTime - + ", latestIp=" + latestIp + ", status=" + status + ", birth=" - + birth + ", author=" + author + ", sysOrgan="+sysOrgan+", sysRole=" + sysRole + "]"; - } - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/User.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/User.java deleted file mode 100644 index 28d66d1..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/User.java +++ /dev/null @@ -1,203 +0,0 @@ -package com.baoying.enginex.executor.system.model; - - -import com.baoying.enginex.executor.common.model.BasePage; - -import java.io.Serializable; -import java.util.Arrays; -import java.util.Date; - - -public class User extends BasePage implements Serializable { - - /** - * serialVersionUID:TODO(序列化对象使用) - */ - private static final long serialVersionUID = 1L; - - /** - * 关系id - */ - private Long userId; - /** - * 企业id - */ - private Long organId; - /** - * 用户id - */ - private String account; - /** - * 用户密码 - */ - private String password; - - /** - * 昵称 - */ - private String nickName; - /** - * 邮箱 - */ - private String email; - /** - * 电话 - */ - private String cellphone; - /** - * qq - */ - private String qq; - /** - * - */ - private String latestTime; - /** - * 最后一次登录IP - */ - private String latestIp; - /** - * 状态 - */ - private Integer status; - /** - * 创建时间 - */ - private Date birth; - /** - * 创建时间 - */ - private Long parentId; - /** - * 删除ids数组 - */ - private Long []deletIds; - - public Long[] getDeletIds() { - return deletIds; - } - - public void setDeletIds(Long[] deletIds) { - this.deletIds = deletIds; - } - - public Long getUserId() { - return userId; - } - - public void setUserId(Long userId) { - this.userId = userId; - } - - public Long getOrganId() { - return organId; - } - - public void setOrganId(Long organId) { - this.organId = organId; - } - - public String getAccount() { - return account; - } - - public void setAccount(String account) { - this.account = account; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getNickName() { - return nickName; - } - - public void setNickName(String nickName) { - this.nickName = nickName; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getCellphone() { - return cellphone; - } - - public void setCellphone(String cellphone) { - this.cellphone = cellphone; - } - - public String getQq() { - return qq; - } - - public void setQq(String qq) { - this.qq = qq; - } - - - - public String getLatestTime() { - return latestTime; - } - - public void setLatestTime(String latestTime) { - this.latestTime = latestTime; - } - - public String getLatestIp() { - return latestIp; - } - - public void setLatestIp(String latestIp) { - this.latestIp = latestIp; - } - - public Integer getStatus() { - return status; - } - - public void setStatus(Integer status) { - this.status = status; - } - - public Date getBirth() { - return birth; - } - - public void setBirth(Date birth) { - this.birth = birth; - } - - public Long getParentId() { - return parentId; - } - - public void setParentId(Long parentId) { - this.parentId = parentId; - } - - @Override - public String toString() { - return "User [userId=" + userId + ", organId=" + organId + ", account=" - + account + ", password=" + password + ", nickName=" + nickName - + ", email=" + email + ", cellphone=" + cellphone + ", qq=" + qq - + ", latestTime=" + latestTime + ", latestIp=" + latestIp - + ", status=" + status + ", birth=" + birth + ", parentId=" - + parentId + ", deletIds=" + Arrays.toString(deletIds) + "]"; - } - - - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/UserRole.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/UserRole.java deleted file mode 100644 index 802fa8f..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/system/model/UserRole.java +++ /dev/null @@ -1,52 +0,0 @@ - -package com.baoying.enginex.executor.system.model; - - -import com.baoying.enginex.executor.common.model.BasePage; - -import java.io.Serializable; - - -public class UserRole extends BasePage implements Serializable{ - - private static final long serialVersionUID = 1L; - - /** - * 主键id - */ - private Long id; - /** - * 用户id - */ - private Long userId; - /** - * 角色编码 - */ - private String roleCode; - public Long getId() { - return id; - } - public void setId(Long id) { - this.id = id; - } - public Long getUserId() { - return userId; - } - public void setUserId(Long userId) { - this.userId = userId; - } - public String getRoleCode() { - return roleCode; - } - public void setRoleCode(String roleCode) { - this.roleCode = roleCode; - } - @Override - public String toString() { - return "UserRole [id=" + id + ", userId=" + userId + ", roleCode=" - + roleCode + "]"; - } - - -} - diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/tactics/consts/TacticsType.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/tactics/consts/TacticsType.java deleted file mode 100644 index 8d31c97..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/tactics/consts/TacticsType.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baoying.enginex.executor.tactics.consts; - -public class TacticsType { - public static final String DECISION_TABLES = "decision_tables";//决策表 - public static final String SCORECARD = "scorecard";//评分卡 - public static final String LIST_DB = "list_db";//名单库 - public static final String MODELS = "models"; - public static final String COMPLEX_RULE = "complex_rule"; - public static final String BASE_RULE = "base_rule"; - public static final String DECISION_TREE = "decision_tree";//决策树 - - public static class OutType{ - public static final String SUCCESS_OUT = "success";//成功时输出 - public static final String FAIL_OUT = "fail";//失败时输出 - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/tactics/mapper/TacticsOutputMapper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/tactics/mapper/TacticsOutputMapper.java deleted file mode 100644 index 5d4d08b..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/tactics/mapper/TacticsOutputMapper.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.baoying.enginex.executor.tactics.mapper; - - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baoying.enginex.executor.tactics.model.TacticsOutput; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface TacticsOutputMapper extends BaseMapper { -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/tactics/model/OutCondition.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/tactics/model/OutCondition.java deleted file mode 100644 index 7d60b50..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/tactics/model/OutCondition.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baoying.enginex.executor.tactics.model; - - -import com.baoying.enginex.executor.common.model.ExpressionParam; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.List; - - -@Data -@NoArgsConstructor -@AllArgsConstructor -public class OutCondition { - private String logical; - private List conditionList; -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/tactics/model/TacticsOutput.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/tactics/model/TacticsOutput.java deleted file mode 100644 index 0ba6040..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/tactics/model/TacticsOutput.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.baoying.enginex.executor.tactics.model; - -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 lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.util.Date; - - -@Data -@NoArgsConstructor -@AllArgsConstructor -@TableName("t_tactics_output") -public class TacticsOutput implements Serializable { - @TableField(exist = false) - private static final long serialVersionUID = 699491471584300246L; - /** - * 主键 - */ - @TableId(type = IdType.AUTO) - private Long id; - /** - * 字段id - */ - private Long fieldId; - /** - * 字段的en - */ - private String fieldEn; - /** - * 字段值 - */ - private String fieldValue; - /** - *字段值的类型:1 常量、2 变量,3.自定义 - */ - private Integer variableType; - /** - * 关联的策略id - */ - private Long tacticsId; - /** - * 关联的策略类型 base_rule.基础规则 scorecard.评分卡 decision_tables.决策表 decision_tree.决策树 complex_rule.复杂规则 list_db.名单库 models.机器学习模型 - */ - private String tacticsType; - /** - * 输出条件 - */ - private String outCondition; - /** - * 输出类型 success成功输出, fail失败输出 - */ - private String outType; - /** - * 创建时间 - */ - private Date createTime; - /** - * 修改时间 - */ - private Date updateTime; - - public TacticsOutput(Long tacticsId, String tacticsType) { - this.tacticsId = tacticsId; - this.tacticsType = tacticsType; - } - - public TacticsOutput(Long tacticsId, String tacticsType, String outType) { - this.tacticsId = tacticsId; - this.tacticsType = tacticsType; - this.outType = outType; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/tactics/service/TacticsOutputService.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/tactics/service/TacticsOutputService.java deleted file mode 100644 index 8cd1636..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/tactics/service/TacticsOutputService.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baoying.enginex.executor.tactics.service; - -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.extension.service.IService; -import com.baoying.enginex.executor.tactics.model.TacticsOutput; - -import java.util.List; -import java.util.Map; - - -public interface TacticsOutputService extends IService { - - List queryByTactics(TacticsOutput entity); - - List setOutput(TacticsOutput entity,Map input); - - boolean judgeOutCondition(String condition,Map input); -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/tactics/service/impl/TacticsOutputServiceImpl.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/tactics/service/impl/TacticsOutputServiceImpl.java deleted file mode 100644 index 9c111c5..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/tactics/service/impl/TacticsOutputServiceImpl.java +++ /dev/null @@ -1,141 +0,0 @@ -package com.baoying.enginex.executor.tactics.service.impl; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.baoying.enginex.executor.canal.TableEnum; -import com.baoying.enginex.executor.common.constants.Constants; -import com.baoying.enginex.executor.common.model.ExpressionParam; -import com.baoying.enginex.executor.config.ConfigHolder; -import com.baoying.enginex.executor.redis.RedisManager; -import com.baoying.enginex.executor.redis.RedisUtils; -import com.baoying.enginex.executor.tactics.consts.TacticsType; -import com.baoying.enginex.executor.tactics.mapper.TacticsOutputMapper; -import com.baoying.enginex.executor.tactics.model.OutCondition; -import com.baoying.enginex.executor.tactics.model.TacticsOutput; -import com.baoying.enginex.executor.tactics.service.TacticsOutputService; - -import com.baoying.enginex.executor.util.ExecuteUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -@Service -public class TacticsOutputServiceImpl extends ServiceImpl implements TacticsOutputService { - - @Autowired - private ConfigHolder configHolder; - @Autowired - private RedisManager redisManager; - - @Override - public List queryByTactics(TacticsOutput entity) { - List tacticsOutputList = null; - if(Constants.switchFlag.ON.equals(configHolder.getCacheSwitch())){ - String key = RedisUtils.getForeignKey(TableEnum.T_TACTICS_OUTPUT, entity.getTacticsId()); - tacticsOutputList = redisManager.getByForeignKey(key, TacticsOutput.class); - if(tacticsOutputList != null){ - tacticsOutputList = tacticsOutputList.stream().filter(item -> item.getTacticsType().equals(entity.getTacticsType())) - .collect(Collectors.toList()); - } - if (tacticsOutputList!=null&&!tacticsOutputList.isEmpty()&& TacticsType.COMPLEX_RULE.equals(entity.getVariableType())&&entity.getOutType()!=null){ - //复杂规则需要过滤出类型 - tacticsOutputList = tacticsOutputList.stream().filter(item ->entity.getOutType().equals( item.getOutType())).collect(Collectors.toList()); - } - } else { - tacticsOutputList = this.list(new QueryWrapper<>(entity)); - } - - return tacticsOutputList; - } - - @Transactional - - //设置输出,传入map向map中放入输出并且返回输出列表 - @Override - public List setOutput(TacticsOutput entity, Map input) { - List tacticsOutputList = this.queryByTactics(entity); - List jsonList = new ArrayList<>(); - if (tacticsOutputList != null && tacticsOutputList.size() > 0) { - for (TacticsOutput tacticsOutput : tacticsOutputList) { - if (!this.judgeOutCondition(tacticsOutput.getOutCondition(),input)){ - continue; - } - JSONObject json = new JSONObject(); - String fieldEn = tacticsOutput.getFieldEn(); - String fieldValue = tacticsOutput.getFieldValue(); - Object value = fieldValue; - Integer variableType = tacticsOutput.getVariableType(); - if (variableType != null) { - switch (variableType) { - case 2: - value = ExecuteUtils.getObjFromMap(input, fieldValue); - break; - case 3: - value = ExecuteUtils.getObjFromScript(input,fieldValue); - break; - } - } - if (value != null ) { - if (!"".equals(value)&&!"'".equals(value)&&value.toString().startsWith("'")&&value.toString().endsWith("'")){ - value = value.toString().substring(1,value.toString().length()-1); - } - json.put(fieldEn, value); - input.put(fieldEn, value); - jsonList.add(json); - } - } - } - return jsonList; - } - - //判断是否符合输出条件 - @Override - public boolean judgeOutCondition(String condition, Map input) { - //条件为空则符合输出 - if (null == condition || "".equals(condition)) { - return true; - } - OutCondition outCondition; - try { - outCondition = JSON.parseObject(condition, OutCondition.class); - }catch (Exception e){ - //字符串转json失败 - return true; - } - String logical = outCondition.getLogical(); - List conditionList = outCondition.getConditionList(); - if (null == logical || null == conditionList||conditionList.size()<1){ - return true; - } - boolean result=false; - switch (logical) { - case "||": - result = false; - for (ExpressionParam expression : conditionList) { - if (ExecuteUtils.getExpressionResult(expression, input)){ - return true; - } - } - break; - case "&&": - result = true; - for (ExpressionParam expression : conditionList) { - if (!ExecuteUtils.getExpressionResult(expression, input)){ - return false; - } - } - break; - } - return result; - } - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/CollectionUtil.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/CollectionUtil.java deleted file mode 100644 index 724f049..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/CollectionUtil.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.baoying.enginex.executor.util; - -import java.util.*; - -public class CollectionUtil { - - /** - * 集合判非空 - * - * @param collection - * @return - */ - public static boolean isNotNullOrEmpty(Collection collection) { - if (null == collection || collection.isEmpty()){ - return false; - } - return true; - } - - /** - * map判非空 - * - * @param map - * @return - */ - public static boolean isNotNullOrEmpty(Map map) { - if (null == map || map.isEmpty()){ - return false; - } - return true; - } - - /** - * 获取多个集合并集 - * @param list - * @return - */ - public static Set getUnion(List> list) { - Set set = new HashSet(); - if (list == null) { - list = new ArrayList>(); - } - int size = list.size(); - if (size > 1) { - for (int i = 0; i < size; i++) { - int j = i + 1; - if (j < size) { - list.get(0).removeAll(list.get(j)); - list.get(0).addAll(list.get(j)); - if (i == size - 2) { - List resultList = list.get(0); - for (Object result : resultList) { - set.add(result); - } - } - } - } - } else { - // 只有一个集合则直接插入结果 - for (List subList : list) { - for (Object result : subList) { - set.add(result); - } - } - } - return set; - - } - - /** - * 获取多个集合交集 - * @param list - * @return - */ - public static Set getIntersection(List> list) { - Set set = new HashSet(); - int size = list.size(); - if (size > 1) { - // 集合个数大于1,取交集 - for (int i = 0; i < size; i++) { - int j = i + 1; - if (j < size) { - list.get(0).retainAll(list.get(j)); - if (i == size - 2) { - List resultList = list.get(0); - for (Object result : resultList) { - set.add(result); - } - } - } - } - } else { - // 只有一个集合则不取交集 - for (List subList : list) { - for (Object result : subList) { - set.add(result); - } - } - } - - return set; - - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/CustomValueUtils.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/CustomValueUtils.java deleted file mode 100644 index 4590857..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/CustomValueUtils.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.baoying.enginex.executor.util; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; - -import java.util.HashSet; -import java.util.Set; - -public class CustomValueUtils { - - public static final Set getFieldEnSet(String custom) { - Set fieldEns = new HashSet<>(); - if (custom != null && !"".equals(custom)) { - JSONObject jsonObject = JSON.parseObject(custom); - Object farr = jsonObject.get("farr"); - if (farr != null) { - JSONArray jsonArray = JSONArray.parseArray(JSON.toJSONString(farr)); - if (jsonArray != null && jsonArray.size() > 0) { - for (Object o : jsonArray) { - JSONObject field = JSON.parseObject(JSON.toJSONString(o)); - Object fieldEn = field.get("fieldEn"); - if (fieldEn != null && !"".equals(fieldEn)) { - fieldEns.add(fieldEn.toString()); - } - } - } - } - } - return fieldEns; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/DataHelp.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/DataHelp.java deleted file mode 100644 index 4f5c854..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/DataHelp.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.baoying.enginex.executor.util; - -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; - -public class DataHelp { - public static int day=0; - public static String getNowDate(){ - Date date = new Date(); - SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - String s = simple.format(date); - return s; - } - public static String getEndDate(){ - SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - Calendar c = Calendar.getInstance(); - c.add(Calendar.DATE, + DataHelp.day); - Date monday = c.getTime(); - String s = simple.format(monday); - return s; - } - public static String getNowDateString(){ - Date date = new Date(); - SimpleDateFormat simple = new SimpleDateFormat("yyyyMMddHHmmss"); - String s = simple.format(date); - return s; - } - public static String getDay(){ - Date date = new Date(); - SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd"); - String s = simple.format(date); - return s; - } - public static void main(String[] args) { - System.out.println(getNowDate()); - System.out.println(getNowDateString()); - - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/DictVariableUtils.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/DictVariableUtils.java deleted file mode 100644 index bafc7c1..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/DictVariableUtils.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.baoying.enginex.executor.util; - -import cn.hutool.core.date.DateUtil; -import com.alibaba.fastjson.JSONObject; - -import java.util.Date; - -public class DictVariableUtils { - - public static Object getValueFromJsonObject(JSONObject jsonObject){ - Object result = ""; - if (jsonObject.get("value") != null) { - switch (jsonObject.getString("type")){ - case "date": - try { - result = DateUtil.format(new Date(),jsonObject.getString("value")); - }catch (Exception e){ - e.printStackTrace(); - result = DateUtil.format(new Date(),"yyyyMMdd"); - } - break; - default: - result = jsonObject.get("value"); - } - } - return result; - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/ExecuteUtils.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/ExecuteUtils.java deleted file mode 100644 index 66fa29b..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/ExecuteUtils.java +++ /dev/null @@ -1,674 +0,0 @@ -package com.baoying.enginex.executor.util; - - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.baoying.enginex.executor.common.constants.ParamTypeConst; -import com.baoying.enginex.executor.common.model.ExpressionParam; -import com.baoying.enginex.executor.datamanage.model.Field; -import com.baoying.enginex.executor.datamanage.service.FieldService; -import com.baoying.enginex.executor.engine.model.EngineNode; -import com.baoying.enginex.executor.node.service.CommonService; -import com.baoying.enginex.executor.util.jeval.EvaluationException; -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.math.Groovy; -import org.apache.commons.lang.StringUtils; -import com.baoying.enginex.executor.util.jeval.function.math.Python; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -//底层执行的工具类 -@Component -public class ExecuteUtils { - private static final Logger logger = LoggerFactory.getLogger(ExecuteUtils.class); - private static Groovy groovy; - private static CommonService commonService; - private static Python python; - private static FieldService fieldService; - - @Autowired - public ExecuteUtils(Groovy groovy, CommonService commonService, Python python, FieldService fieldService) { - ExecuteUtils.groovy = groovy; - ExecuteUtils.commonService = commonService; - ExecuteUtils.python = python; - ExecuteUtils.fieldService = fieldService; - } - - //获取基本单元的执行结果 - public final static boolean getExpressionResult(ExpressionParam expressionParam, Map params) { - //如果是规则的条件的话,判断是否为叶子节点,如果不是则直接返回false - if (expressionParam.getConditionType() != null && expressionParam.getConditionType() != 2) { - return false; - } - String operator = expressionParam.getOperator(); -// //获取第一个参数的key -// String paramOneKey = expressionParam.getFieldEn(); -// //获取第二个参数的key或者常量值 -// String paramTwoKey = expressionParam.getFieldValue(); - //获取第二个参数的类型 - Integer variableType = expressionParam.getVariableType(); - //给每个参数取值 - Object paramOne = getValueByKey(2, params, expressionParam.getFieldEn(),null); - //默认为常量 - Object paramTwo = getValueByKey(variableType, params, expressionParam.getFieldValue(),null); - //如果第二个参数类型为变量则取出参数,为自定义则计算出值返回 -// if (variableType != null) { -// switch (variableType) { -// case 1: -// //常量类型 -// break; -// case 2: -// //变量类型 -// paramTwo = getObjFromMap(params, paramTwoKey); -// break; -// case 3: -// //自定义脚本类型 -// paramTwo = getObjFromScript(params, expressionParam.getFieldValue()); -// break; -// case 4: -// //正则表达式类型 -// paramTwo = getObjFromRegex(params, expressionParam.getFieldValue()); -// } -// } - //如果两个参数有没取到的则直接返回false - if (paramOne == null || "".equals(paramOne) || paramTwo == null || "".equals(paramTwo)) { - return false; - } - return getCondResult(operator, paramOne, paramTwo); -// //协商获取操作类型 -// boolean result = false; -// //预处理:如果是数字类型的话提前取出数值 -// Double numOne = StrUtils.strToDouble(paramOne.toString()); -// Double numTwo = StrUtils.strToDouble(paramTwo.toString()); -// switch (operator) { -// //数值之间的比较 -// case "==": -// if (numOne != null && numTwo != null) { -// result = numOne.equals(numTwo); -// } else if (paramOne != null && paramTwo != null) { -// result = paramOne.toString().equals(paramTwo.toString()); -// } -// break; -// case "!=": -// if (numOne != null && numTwo != null) { -// result = !numOne.equals(numTwo); -// } else if (paramOne != null && paramTwo != null) { -// result = !paramOne.toString().equals(paramTwo.toString()); -// } -// break; -// case ">": -// if (numOne != null && numTwo != null) { -// result = numOne > numTwo; -// } -// break; -// case "<": -// if (numOne != null && numTwo != null) { -// result = numOne < numTwo; -// } -// break; -// case ">=": -// if (numOne != null && numTwo != null) { -// result = numOne >= numTwo; -// } -// break; -// case "<=": -// if (numOne != null && numTwo != null) { -// result = numOne <= numTwo; -// } -// break; -// //字符串之间的比较 -// case "equals": -// result = paramOne.toString().equals(paramTwo.toString()); -// break; -// case "not equals": -// result = !paramOne.toString().equals(paramTwo.toString()); -// break; -// case "contains": -// result = paramOne.toString().contains(paramTwo.toString()); -// break; -// case "not contains": -// result = !paramOne.toString().contains(paramTwo.toString()); -// break; -// case "regex": -// Pattern pattern = Pattern.compile(paramTwo.toString()); -// Matcher matcher = pattern.matcher(paramOne.toString()); -// result = matcher.find(); -// break; -// } -// return result; - } - - - //传入两个参数和一个操作符进行比对获取结果 - public final static boolean getCondResult(String operator, Object paramOne, Object paramTwo) { - boolean result = false; - Double numOne = StrUtils.strToDouble(paramOne.toString()); - Double numTwo = StrUtils.strToDouble(paramTwo.toString()); - switch (operator) { - //数值之间的比较 - case "==": - if (numOne != null && numTwo != null) { - result = numOne.equals(numTwo); - } else if (paramOne != null && paramTwo != null) { - result = paramOne.toString().equals(paramTwo.toString()); - } - break; - case "!=": - if (numOne != null && numTwo != null) { - result = !numOne.equals(numTwo); - } else if (paramOne != null && paramTwo != null) { - result = !paramOne.toString().equals(paramTwo.toString()); - } - break; - case ">": - if (numOne != null && numTwo != null) { - result = numOne > numTwo; - } - break; - case "<": - if (numOne != null && numTwo != null) { - result = numOne < numTwo; - } - break; - case ">=": - if (numOne != null && numTwo != null) { - result = numOne >= numTwo; - } - break; - case "<=": - if (numOne != null && numTwo != null) { - result = numOne <= numTwo; - } - break; - //字符串之间的比较 - case "equals": - result = paramOne.toString().equals(paramTwo.toString()); - break; - case "not equals": - result = !paramOne.toString().equals(paramTwo.toString()); - break; - case "contains": - result = paramOne.toString().contains(paramTwo.toString()); - break; - case "not contains": - result = !paramOne.toString().contains(paramTwo.toString()); - break; - case "regex": - Pattern pattern = Pattern.compile(paramTwo.toString()); - Matcher matcher = pattern.matcher(paramOne.toString()); - result = matcher.find(); - break; - case "in": - if (paramTwo instanceof List){ - List list = (List) paramTwo; - result = list.contains(paramOne); - }else if (paramTwo instanceof Map){ - Map map= (Map)paramTwo; - result = map.containsKey(paramOne); - } - break; - case "not in": - if (paramTwo instanceof List){ - List list = (List) paramTwo; - result = !list.contains(paramOne); - }else if (paramTwo instanceof Map){ - Map map= (Map)paramTwo; - result = !map.containsKey(paramOne); - } - break; - } - return result; - } - - //根据key,分不同类型取出值 - public final static Object getValueByKey(Integer variableType, Map params, String paramKey,List list) { - Object result = paramKey; - if (variableType != null) { - switch (variableType) { - case ParamTypeConst - .CONSTANT: - //常量类型 - result = paramKey; - break; - case ParamTypeConst - .VARIABLE: - //变量类型 - result = getObjFromMap(params, paramKey); - break; - case ParamTypeConst - .CUSTOM: - //自定义脚本类型 - if (list==null || list.isEmpty()){ - result = getObjFromScript(params, paramKey); - }else { - result = getObjFromScript(params,paramKey,list); - } - break; - case ParamTypeConst - .REGEX: - //正则表达式类型 - result = getObjFromRegex(params, paramKey); - } - } - return result; - } - - - //从map中取值 - public final static Object getObjFromMap(Map input, String key) { - if (StringUtils.isBlank(key)) { - return ""; - } - if (input == null) { - input = new ConcurrentHashMap<>(); - } - String[] array = key.split("\\."); - //如果当前变量池中未找到此变量则需要获取 - if (input.get(array[0]) == null && !array[0].startsWith("%")) { - List strings = new ArrayList(); - strings.add(array[0]); - boolean result = getFieldToInputByEns(strings,input); - if (!result) { - return ""; - } - } - return getObjFromMap(input, array); - } - - //从map中找到需要的对象并返回 - public final static Object getObjFromMap(Map input, String[] array) { - if (array.length == 1) { - Object o = input.get(array[0]); - if (o == null) { - return ""; - } - return o; - } - Map map = input; - for (int i = 0; i < array.length; i++) { - String childKey = array[i]; - //判断是否能找到key - if (map.containsKey(childKey)) { - Object o = map.get(childKey); - if (i == array.length - 1) { - return map.get(childKey); - } - //如果是数组取length - if (i == array.length - 2) { - if ("length()".equals(array[array.length - 1])) { - return JSON.toJavaObject(JSON.parseObject(JSON.toJSONString(o)), ArrayList.class).size(); - } - } - //未找到最后一个数组元素则将其识别为map - map = JSON.toJavaObject(JSON.parseObject(JSON.toJSONString(o)), Map.class); - } - } - return ""; - } - - //根据入参map,通过公式和groovy计算出返回结果 - public final static Object getObjFromScript(Map input, String fieldValue) { - JSONObject formulaJson = JSON.parseObject(fieldValue); - //找到脚本中引用的字段,放入data中 - Map data = new HashMap<>(); - Object farr = formulaJson.get("farr"); - List fieldIds = new ArrayList<>(); - //字段cn为key,字段en为value - Map fieldMap = new HashMap<>(); - if (farr != null && !"".equals(farr)) { - List fieldList = JSONArray.parseArray(JSON.toJSONString(farr), Field.class); - for (Field field : fieldList) { - String fieldCn = field.getFieldCn(); - String fieldEn = field.getFieldEn(); - if (fieldCn != null && fieldEn != null && !"".equals(fieldCn) && !"".equals(fieldEn)) { - fieldMap.put(fieldCn, field); - } - fieldIds.add(field.getId()); - } - } - if (fieldIds.size() > 0) { - getFieldToInputByIds(fieldIds,input); - } - Object result = executeScript(formulaJson, fieldMap, input); - //取出groovy脚本 -// String formula = (String) formulaJson.get("formula"); -// //替换掉特殊的字符 -// formula = formula.replace(">", ">"); //3>=6 && 3< 12 -// formula = formula.replace("<", "<"); -// //正则匹配自定义中用到的变量对其进行替换 -// Pattern pattern = Pattern.compile("@[a-zA-Z0-9_\u4e00-\u9fa5()()-]+@"); -// Matcher matcher = pattern.matcher(formula); -// String subexp = formula; -// String exp = ""; -// int j = 0; -// while (matcher.find()) { -// String fieldCN = matcher.group(0).replace("@", ""); -// Field subField = fieldMap.get(fieldCN); -// if (subField == null) { -// return ""; -// } -// String fieldEn = subField.getFieldEn(); -// String v = ""; -// v = "" + input.get(fieldEn); -// data.put(fieldEn, input.get(fieldEn)); -// if (subexp.contains("def main")) { -// // groovy脚本替换为动态参数 -// v = "_['" + fieldEn + "']"; -// exp += subexp.substring(j, matcher.end()).replace("@" + fieldCN + "@", v); -// } else { -// if (subField.getValueType() == 1 || subField.getValueType() == 4) { -// exp += subexp.substring(j, matcher.end()).replace("@" + fieldCN + "@", v); -// } else { -// exp += subexp.substring(j, matcher.end()).replace("@" + fieldCN + "@", "'" + v + "'"); -// } -// } -// j = matcher.end(); -// } -// exp += formula.substring(j, formula.length()); -// Evaluator evaluator = new Evaluator(); -// Object result = ""; -// try { -// if (exp.contains("def main")) { -// // 执行groovy脚本 -// -// logger.warn("groovy:{},{}", exp, data); -// result = groovy.executeForObject(exp, data); -// } else if (exp.contains("def python_main(_):")) { -// //执行python脚本 -// result = python.executeForObject(exp, data); -// } else { -// //执行公式 -// result = evaluator.evaluate(exp); -// } -// } catch (EvaluationException e) { -// e.printStackTrace(); -// logger.error("请求异常", e); -// } - return result; - } - - //处理集合中的特殊自定义 - public final static Object getObjFromScript(Map input, String fieldValue, List current) { - JSONObject formulaJson = JSON.parseObject(fieldValue); - //找到脚本中引用的字段,放入data中 - Object farr = formulaJson.get("farr"); - List fieldIds = new ArrayList<>(); - //字段cn为key,字段en为value - Map fieldMap = new HashMap<>(); - if (farr != null && !"".equals(farr)) { - List fieldList = JSONArray.parseArray(JSON.toJSONString(farr), JSONObject.class); - String inputParamStr = JSON.toJSONString(input); - for (JSONObject jsonObject : fieldList) { - String fieldCn = jsonObject.getString("fieldCn"); - String fieldEn = jsonObject.getString("fieldEn"); - Field field = new Field(); - field.setFieldEn(fieldEn); - field.setFieldCn(fieldCn); - field.setValueType(jsonObject.getInteger("valueType")); - Long id = jsonObject.getLong("id"); - if (fieldCn != null && fieldEn != null && !"".equals(fieldCn) && !"".equals(fieldEn)) { - fieldMap.put(fieldCn, field); - } - if (!jsonObject.containsKey("paramList")) { - fieldIds.add(id); - continue; - } - Map temp = JSON.parseObject(inputParamStr, Map.class); - //存在paramList需要单个字段取出 - JSONArray paramList = jsonObject.getJSONArray("paramList"); - for (int i = 0; i < paramList.size(); i++) { - JSONObject param = paramList.getJSONObject(i); - String en = param.getString("en"); - String value = param.getString("value"); - switch (param.getIntValue("type")) { - case ParamTypeConst.CONSTANT: - temp.put(en,value ); - break; - case ParamTypeConst.VARIABLE: - temp.put(en, ListOpUtils.getObjByKeyAndJson(current.get(0), value)); - break; - } - } - getFieldToInputByIds(Arrays.asList(id), temp); - input.put(fieldEn,temp.get(fieldEn)); - } - } - - if (fieldIds.size() > 0) { - getFieldToInputByIds(fieldIds, input); - } - //取出groovy脚本 - Object result = executeScript(formulaJson, fieldMap, input); - return result; - } - - //对正则取值 - public final static Object getObjFromRegex(Map input, String fieldValue) { - String result = fieldValue; - //校验是否使用了字段如果使用了则需要替换为值 - Pattern pattern = Pattern.compile("@[a-zA-Z0-9_\u4e00-\u9fa5()()-]+@"); - Matcher matcher = pattern.matcher(fieldValue); - while (matcher.find()) { - String fieldEn = matcher.group().replace("@", ""); - Object value = ExecuteUtils.getObjFromMap(input, fieldEn); - String valueStr = ""; - if (value != null) { - valueStr = value.toString(); - } - result = result.replace("@" + fieldEn + "@", valueStr); - } - return result; - } - - //执行自定义脚本 - public final static Object executeScript(JSONObject formulaJson, Map fieldMap, Map input) { - String formula = formulaJson.getString("formula"); - //替换掉特殊的字符 - formula = formula.replace(">", ">"); //3>=6 && 3< 12 - formula = formula.replace("<", "<"); - //正则匹配自定义中用到的变量对其进行替换 - Pattern pattern = Pattern.compile("@[a-zA-Z0-9_\u4e00-\u9fa5()()-]+@"); - Matcher matcher = pattern.matcher(formula); - String subexp = formula; - String exp = ""; - int j = 0; - Map data = new HashMap<>(); - while (matcher.find()) { - String fieldCN = matcher.group(0).replace("@", ""); - Field subField = fieldMap.get(fieldCN); - if (subField == null) { - return ""; - } - String fieldEn = subField.getFieldEn(); - String v = ""; - v = "" + input.get(fieldEn); - data.put(fieldEn, input.get(fieldEn)); - if (subexp.contains("def main")) { - // groovy脚本替换为动态参数 - v = "_['" + fieldEn + "']"; - exp += subexp.substring(j, matcher.end()).replace("@" + fieldCN + "@", v); - } else { - if (subField.getValueType() == 1 || subField.getValueType() == 4) { - exp += subexp.substring(j, matcher.end()).replace("@" + fieldCN + "@", v); - } else { - exp += subexp.substring(j, matcher.end()).replace("@" + fieldCN + "@", "'" + v + "'"); - } - } - j = matcher.end(); - } - - - exp += formula.substring(j, formula.length()); - Evaluator evaluator = new Evaluator(); - Object result = ""; - try { - if (exp.contains("def main")) { - // 执行groovy脚本 - - logger.warn("groovy:{},{}", exp, data); - result = groovy.executeForObject(exp, data); - } else if (exp.contains("def python_main(_):")) { - //执行python脚本 - result = python.executeForObject(exp, data); - } else { - //执行公式 - result = evaluator.evaluate(exp); - } - if (result.toString().startsWith("'")){ - //字符串 - result = result.toString().replace("'",""); - }else { - //数值 - if (StrUtils.isNum(result.toString())){ - String[] split = result.toString().split("\\."); - if (split.length>1&&StrUtils.strToLong(split[1])>0){ - result = StrUtils.strToDouble(result.toString()); - }else { - result = StrUtils.strToLong(split[0]); - } - } - } - } catch (EvaluationException e) { - e.printStackTrace(); - logger.error("请求异常", e); - } - - return result; - } - - //对groovy脚本执行结果进一步处理 - public static Map handleGroovyResult(Map map) { - - Iterator> iterator = map.entrySet().iterator(); - while (iterator.hasNext()) { - Map.Entry entry = iterator.next(); - if (entry.getKey().startsWith("_['") && entry.getKey().endsWith("']")) { - map.remove(entry.getKey()); - String key = entry.getKey().replace("_['", "").replace("']", ""); - map.put(key, entry.getValue()); - } - } - return map; - } - - //调用commonService根据ens取参数 - public static boolean getFieldToInputByEns(List fieldEns, Map input ){ - boolean result = commonService.getEngineField(fieldService.selectFieldListByEns(fieldEns), input); - return result; - } - //调用commonService根据ids取参数 - public static boolean getFieldToInputByIds(List ids, Map input ){ - boolean result = commonService.getFieldByIds(ids, input); - return result; - } - - // 解析nodeJson - public final static List getExecuteListFromNodeJson(EngineNode engineNode) { - JSONObject nodeJson = JSON.parseObject(engineNode.getNodeJson()); - String strategyStr = null; - switch (engineNode.getNodeType()) { - case 2://规则集 - strategyStr = JSON.toJSONString(nodeJson.getJSONObject("executeGroup").get("strategyList")); - break; - case 4://评分卡 - strategyStr = JSON.toJSONString(nodeJson.getJSONArray("scorecardList")); - break; - case 5://名单库 - strategyStr = JSON.toJSONString(nodeJson.getJSONArray("listDbList")); - break; - case 15://模型 - strategyStr = JSON.toJSONString(nodeJson.getJSONArray("modelList")); - break; - case 16://决策表 - strategyStr = JSON.toJSONString(nodeJson.getJSONArray("decisionTableList")); - break; - case 17://决策树 - strategyStr = JSON.toJSONString(nodeJson.getJSONArray("decisionTreeList")); - break; - - } - List maps = JSON.parseArray(strategyStr, Map.class); - return maps; - } - - //获取执行用的id列表 - public final static List getExecuteIdList(EngineNode engineNode, String idKey) { - List maps = ExecuteUtils.getExecuteListFromNodeJson(engineNode); - List executeIdList = new ArrayList<>(); - if (maps != null && maps.size() > 0) { - for (Map map : maps) { - if (map.containsKey(idKey)) { - Object o = map.get(idKey); - if (o != null) { - Long id = StrUtils.strToLong(String.valueOf(o)); - if (id != null) { - executeIdList.add(id); - } - } - - } - } - } - return executeIdList; - } - - //判断终止条件是否满足,满足则结束 - public final static void terminalCondition(EngineNode engineNode, Map inputParam, Map outMap, Map variablesMap) { - if (StringUtils.isBlank(engineNode.getNodeScript())) { - return; - } - JSONObject nodeScript = JSONObject.parseObject(engineNode.getNodeScript()); - JSONObject terminationInfo = nodeScript.getJSONObject("terminationInfo"); - String conditions = terminationInfo.getString("conditions"); - Map fieldTypeMap = terminationInfo.getObject("fieldTypeMap", Map.class); - JevalUtil.convertVariables(fieldTypeMap, variablesMap); - // 判断终止条件 - boolean result = false; - try { - result = JevalUtil.evaluateBoolean(conditions, variablesMap); - } catch (EvaluationException e) { - logger.error("终止条件执行异常,执行内容:{},参数:{}", conditions, variablesMap); - e.printStackTrace(); - } - - if (result) { - Object outValue = ""; - JSONObject output = terminationInfo.getJSONObject("output"); - String fieldValue = output.getString("fieldValue"); - String fieldCode = output.getString("fieldCode"); - int variableType = output.getInteger("variableType"); - switch (variableType) { - case 1: - outValue = fieldValue; - break; - case 2: - outValue = ExecuteUtils.getObjFromMap(inputParam, fieldValue); - break; - case 3: - outValue = ExecuteUtils.getObjFromScript(inputParam, fieldValue); - break; - } - // 输出终止结果 - if (outValue == null) { - outValue = ""; - } - if (outValue instanceof String) { - outMap.put("result", outValue); - } else { - outMap.put("result", JSONObject.toJSON(outValue)); - } - if (StringUtils.isNotBlank(fieldCode)) { - inputParam.put(fieldCode, outValue); - } - engineNode.setNextNodes(null); - } - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/JevalUtil.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/JevalUtil.java deleted file mode 100644 index 4662733..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/JevalUtil.java +++ /dev/null @@ -1,168 +0,0 @@ -package com.baoying.enginex.executor.util; - -import com.baoying.enginex.executor.common.constants.CommonConst; -import com.baoying.enginex.executor.engine.consts.EngineOperator; -import com.baoying.enginex.executor.util.jeval.EvaluationException; -import com.baoying.enginex.executor.util.jeval.Evaluator; - -import java.util.Map; - -/** - * 表达式解析器入口 - * @author sunyk - * - */ -public class JevalUtil { - - /** - * 获取执行布尔值结果 - * @param expression - * @param params - * @return - * @throws EvaluationException - */ - public static Boolean evaluateBoolean(String expression,Map params) throws EvaluationException { - Evaluator evaluator = getEvaluator(params); - return evaluator.getBooleanResult(expression); - } - - /** - * 获取执行数字结果 - * @param expression - * @param params - * @return - * @throws EvaluationException - */ - public static Double evaluateNumric(String expression,Map params) throws EvaluationException{ - Evaluator evaluator = getEvaluator(params); - return evaluator.getNumberResult(expression); - } - - /** - * 获取执行String结果 - * @param expression - * @param params - * @return - * @throws EvaluationException - */ - public static String evaluateString(String expression,Map params) throws EvaluationException{ - Evaluator evaluator = getEvaluator(params); - return evaluator.evaluate(expression,false,true); - } - - /** - * 获取绑定参数的Evaluator - * @param params - * @return - * @throws EvaluationException - */ - private static Evaluator getEvaluator(Map params){ - Evaluator evaluator = new Evaluator(); - if(params != null && !params.isEmpty()){ - for (Map.Entry entry : params.entrySet()) { - if(null!=entry.getValue()){ - evaluator.putVariable(entry.getKey(), entry.getValue().toString()); - } - } - } - return evaluator; - } - - /** - * 根据区间表达式解析区间 - * @param expression,eg:[3,5],param:字段code - * @return - */ - public static String getNumericInterval(String expression,String param){ - StringBuffer result = new StringBuffer(); - //先把变量进行加工#{param} - param = EngineOperator.OPERATOR_VARIABLE_LEFT+param+EngineOperator.OPERATOR_VARIABLE_RIGHT; - //如果是纯数字,代表==,直接拼接 - if(!expression.startsWith(EngineOperator.OPERATOR_LEFT_PARENTHESES) && !expression.startsWith(EngineOperator.OPERATOR_LEFT_BRACKET) - && !expression.endsWith(EngineOperator.OPERATOR_RIGHT_PARENTHESES) && !expression.endsWith(EngineOperator.OPERATOR_RIGHT_BRACKET)){ - result.append(param).append(CommonConst.SYMBOL_BLANK).append(EngineOperator.OPERATOR_EQUALS_RELATION).append(CommonConst.SYMBOL_BLANK).append(expression); - return result.toString(); - } - //获取到取值区间 - String exp = expression.substring(1, expression.length()-1); - String[] segments = null; - if(exp.startsWith(CommonConst.SYMBOL_COMMA)){ - segments = new String[1]; - segments[0] = exp.substring(1); - }else{ - segments = exp.split(CommonConst.SYMBOL_COMMA); - } - //判断取值范围(,3)(4,) - if(segments.length == 1){ - //说明是(,3),(4,) - if(expression.substring(1, expression.length()-1).startsWith(CommonConst.SYMBOL_COMMA)){ - //以逗号开始(,3) - if(expression.endsWith(EngineOperator.OPERATOR_RIGHT_PARENTHESES)){ - //小括号 - result.append(param).append(CommonConst.SYMBOL_BLANK).append(EngineOperator.OPERATOR_LESS_RELATION).append(CommonConst.SYMBOL_BLANK).append(segments[0]); - }else if(expression.endsWith(EngineOperator.OPERATOR_RIGHT_BRACKET)){ - //大括号 - result.append(param).append(CommonConst.SYMBOL_BLANK).append(EngineOperator.OPERATOR_LESS_EQUALS_RELATION).append(CommonConst.SYMBOL_BLANK).append(segments[0]); - } - }else{ - //以逗号结尾(4,) - if(expression.startsWith(EngineOperator.OPERATOR_LEFT_PARENTHESES)){ - //小括号 - result.append(param).append(CommonConst.SYMBOL_BLANK).append(EngineOperator.OPERATOR_GREATER_RELATION).append(CommonConst.SYMBOL_BLANK).append(segments[0]); - }else if(expression.startsWith(EngineOperator.OPERATOR_LEFT_BRACKET)){ - //大括号 - result.append(param).append(CommonConst.SYMBOL_BLANK).append(EngineOperator.OPERATOR_GREATER_EQUALS_RELATION).append(CommonConst.SYMBOL_BLANK).append(segments[0]); - } - } - }else if(segments.length == 2){ - //开始符号 - if(expression.startsWith(EngineOperator.OPERATOR_LEFT_PARENTHESES)){ - //小括号 - result.append(param).append(CommonConst.SYMBOL_BLANK).append(EngineOperator.OPERATOR_GREATER_RELATION).append(CommonConst.SYMBOL_BLANK).append(segments[0]); - }else if(expression.startsWith(EngineOperator.OPERATOR_LEFT_BRACKET)){ - //大括号 - result.append(param).append(CommonConst.SYMBOL_BLANK).append(EngineOperator.OPERATOR_GREATER_EQUALS_RELATION).append(CommonConst.SYMBOL_BLANK).append(segments[0]); - } - //都是&&关系 - result.append(CommonConst.SYMBOL_BLANK).append(EngineOperator.OPERATOR_AND_RELATION).append(CommonConst.SYMBOL_BLANK); - //结束符号 - if(expression.endsWith(EngineOperator.OPERATOR_RIGHT_PARENTHESES)){ - //小括号 - result.append(param).append(CommonConst.SYMBOL_BLANK).append(EngineOperator.OPERATOR_LESS_RELATION).append(CommonConst.SYMBOL_BLANK).append(segments[1]); - }else if(expression.endsWith(EngineOperator.OPERATOR_RIGHT_BRACKET)){ - //大括号 - result.append(param).append(CommonConst.SYMBOL_BLANK).append(EngineOperator.OPERATOR_LESS_EQUALS_RELATION).append(CommonConst.SYMBOL_BLANK).append(segments[1]); - } - } - return result.toString(); - } - - /** - * 变量值转义 - * @param fieldsMap - * @param variablesMap - * @return - */ - public static Map convertVariables(Map fieldsMap,Map variablesMap){ - if(CollectionUtil.isNotNullOrEmpty(variablesMap)){ - if(!CollectionUtil.isNotNullOrEmpty(fieldsMap)){ - return variablesMap; - } - String key = ""; - Integer value = null; - for (Map.Entry entry : variablesMap.entrySet()) { - key = entry.getKey(); - value = fieldsMap.get(key); - if(value == null){ - continue; - } - //2代表字符串 - if(value == 2){ - String variableValue = CommonConst.SYMBOL_SINGLE_QUOTA+String.valueOf(variablesMap.get(key))+CommonConst.SYMBOL_SINGLE_QUOTA; - variablesMap.put(key, variableValue); - } - } - } - return variablesMap; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/ListOpUtils.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/ListOpUtils.java deleted file mode 100644 index 4857a7f..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/ListOpUtils.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.baoying.enginex.executor.util; - -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import org.apache.commons.lang3.StringUtils; - -import java.util.List; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; - -public class ListOpUtils { - public static Map> recursionGroup(List param, List keys){ - return param.stream().collect(Collectors.groupingBy(item->{ - String cond = ""; - for (String key : keys) { - if (StringUtils.isNotBlank(cond)){ - cond+="_"; - } - cond += getObjByKeyAndJson(item,key); -// String[] split = key.split("\\."); -// if (split.length>1){ -// JSONObject jsonObject = item; -// for (int i = 0; i < split.length; i++) { -// if (i - * Description: md5加密工具类.
- * Date: 2015年6月30日 上午10:30:23
- * @since JDK 1.7 - * @see - */ -public class MD5 { - /** - * 全局数组 - */ - private static final String[] DIGITS = { "0", "1", "2", "3", "4", "5", - "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "H", "i", - "j", "k", "l", "m", "n", "~", "$", "@", "%", "*", "#", "&", "!" }; - - public MD5() { - } - - /** - * byteToArrayString:(返回形式为数字跟字符串).
- * @author wz - * @param bByte byte - * @return 返回形式为数字跟字符串 - */ - private static String byteToArrayString(byte bByte) { - int iRet = bByte; - if (iRet < 0) { - iRet += 256; - } - int iD1 = iRet / 32; - int iD2 = iRet % 32; - return DIGITS[iD1] + DIGITS[iD2]; - } - - /** - * byteToNum:(返回形式只为数字).
- * @param bByte byte - * @return 返回形式只为数字 - */ - private static String byteToNum(byte bByte) { - int iRet = bByte; - System.out.println("iRet1=" + iRet); - if (iRet < 0) { - iRet += 256; - } - return String.valueOf(iRet); - } - - /** - * byteToString:(转换字节数组为16进制字串).
- * @param bByte byte数组 - * @return 返回转换字节数组为16进制字串 - */ - private static String byteToString(byte[] bByte) { - StringBuffer sBuffer = new StringBuffer(); - for (int i = 0; i < bByte.length; i++) { - sBuffer.append(byteToArrayString(bByte[i])); - } - return sBuffer.toString(); - } - - /** - * GetMD5Code:(md5加密).
- * @author wz - * @param param 需要加密的字段 - * @return 加密后的字段 - */ - public static String GetMD5Code(String param) { - String resultString = null; - try { - resultString = new String(param); - MessageDigest md = MessageDigest.getInstance("MD5"); - // md.digest() 该函数返回值为存放哈希值结果的byte数组 - resultString = byteToString(md.digest(param.getBytes())); - } catch (NoSuchAlgorithmException ex) { - ex.printStackTrace(); - } - return resultString; - } - - -// public static void main(String[] args) { -// MD5 getMD5 = new MD5(); -// System.out.println(getMD5.GetMD5Code("123456")); -// } - -} - diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/NumUtils.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/NumUtils.java deleted file mode 100644 index 39b9f4f..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/NumUtils.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.baoying.enginex.executor.util; - - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -public class NumUtils { - - public static double toDouble(Object o){ - double d = 0D; - if (o==null){ - return d; - } - try { - d = Double.valueOf(o.toString()).doubleValue(); - - }catch (Exception e){ - log.error("转换为double失败,原值:{}",o); - e.printStackTrace(); - } - return d; - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/StrUtils.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/StrUtils.java deleted file mode 100644 index a402980..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/StrUtils.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.baoying.enginex.executor.util; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class StrUtils { - //判断是否为一个数字 - public static boolean isNum(String str){ - if (str==null||"".equals(str)){ - return false; - } - Pattern pattern = Pattern.compile("^(-|\\+)?\\d+(\\.\\d+)?$"); - Matcher isNum = pattern.matcher(str); - if (!isNum.matches()) { - return false; - } - return true; - } - //将字符串转为Long类型 - public static Long strToLong(String str){ - if (isNum(str)){ - return Long.valueOf(str); - } - return null; - } - public static Double strToDouble(String str){ - if (isNum(str)){ - return Double.valueOf(str); - } - return null; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/StringUtil.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/StringUtil.java deleted file mode 100644 index 95dc1d2..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/StringUtil.java +++ /dev/null @@ -1,465 +0,0 @@ -package com.baoying.enginex.executor.util; - -import java.math.BigDecimal; -import java.util.*; - -/** - * @ClassName: StringUtil - * @Description: String 工具类 - * @author Bai_Keyang - * @date 2015-06-24 16:00:16 - */ -public class StringUtil { - - /** - *

判断是否是有效的字符串,空字符串为无效字符串

- * - * @param str - * @return boolean - */ - public static boolean isValidStr(String str) { - return str != null && str.trim().length() > 0; - } - - /** - *

判断是字符串否是为空,字符串为空,返回 "",反之返回其字符串本身.

- * - *

if str is null then convret str to "".

- * - * @param str - * @return String - */ - public static String convertStrIfNull(String str) { - return str == null ? SysConstant.EMPTY_STRING : str; - } - - /** - *

根据字符串转换为布尔值.

- * - * @param str - * @return boolean - */ - public static boolean getStrToBoolean(String str) { - return isValidStr(str) ? str.toLowerCase().trim().equals(SysConstant.TRUE) : false; - } - - /** - *

根据字符串转换为 整型(int)并返回;转换失败,则返回0.

- * - *

convert str value to int. if fail,then return 0.

- * - * @param str - * @return int - */ - public static int getStrToInt(String str) { - try { - return Integer.parseInt(str); - } catch (NumberFormatException e) { - return 0; - } - } - - /** - *

根据字符串转换为 整型(int)并返回;转换失败,则返回 指定的值.

- * - *

convert str value to int. if fail,then return defaultvalue.

- * - * @param str - * @param defaultValue - * @return int - */ - public static int getStrToInt(String str, int defaultValue) { - try { - return Integer.parseInt(str); - } catch (NumberFormatException e) { - return defaultValue; - } - } - - /** - *

根据字符串转换为long.

- * - * @param str - * @return long - */ - public static long getStrTolong(String str) { - long result = 0; - if (!isValidStr(str)) { - return result; - } - try { - result = Long.parseLong(str); - } catch (NumberFormatException e) { - e.printStackTrace(); - } - return result; - } - - /** - *

根据字符串转换为double.

- * - *

convert String to double

- * - * @param str - * @return double - */ - public static double getStrTodouble(String str) { - double result = 0; - if (!isValidStr(str)) { - return result; - } - try { - result = Double.parseDouble(str); - } catch (NumberFormatException e) { - e.printStackTrace(); - } - return result; - } - - /** - *

根据字符串转换为BigDecimal.

- * - *

convert String object to BigDecimal

- * - * @param str - * @return BigDecimal - */ - public static BigDecimal getStrToBigDecimal(String str) { - BigDecimal result = new BigDecimal(0); - if (!isValidStr(str)) { - return result; - } - try { - result = new BigDecimal(str); - } catch (NumberFormatException e) { - e.printStackTrace(); - } - return result; - } - - /** - *

根据字符串转换为Integer.

- * - *

convert String to Integer.

- * - * @param str - * @return Integer - */ - public static Integer getStrToInteger(String str) { - Integer result = new Integer(0); - if (!isValidStr(str)) { - return result; - } - try { - result = Integer.valueOf(str); - } catch (NumberFormatException e) { - e.printStackTrace(); - } - return result; - } - - /** - *

根据字符串转换为Long.

- * - *

convert String to Long.

- * - * @param str - * @return Long - */ - public static Long getStrToLong(String str) { - Long result = new Long(0); - if (!isValidStr(str)) { - return result; - } - try { - result = Long.valueOf(str.trim()); - } catch (NumberFormatException e) { - e.printStackTrace(); - } - return result; - } - - /** - *

根据字符串转换为Double.

- * - *

convert String to Double

- * - * @param str - * @return Double - */ - public static Double getStrToDouble(String str) { - Double result = new Double(0); - if (!isValidStr(str)) { - return result; - } - try { - result = Double.valueOf(str); - } catch (NumberFormatException e) { - e.printStackTrace(); - } - return result; - } - - /** - *

根据数组转换为字符串,用","拼接.

- *

例:

- *

    String[] strArray = new String[]{"How","do","you","do"};

- *

    拼接后字符串样例:How,do,you,do

- * - *

convert Object array to String use ",".

- * - * @param Object[] - * @return String - */ - public static String getArrToStr(Object[] obj) { - if (obj == null) { - return null; - } - - StringBuffer buffer = new StringBuffer(); - if (obj.length > 0) { - buffer.append(obj[0]); - } - - for (int m = 1; m < obj.length; m++) { - buffer.append(SysConstant.COMMA).append(obj[m]); - } - - return buffer.toString(); - } - - /** - *

去掉重复数据(1,2,3,2,4 => 1,2,3,4)

- * - * @param metadata - * @param tagStr - * @return String - */ - public static String removeEqualStr(String metadata, String tagStr) { - if (!StringUtil.isValidStr(metadata)) { - return SysConstant.EMPTY_STRING; - } - Set set = new HashSet(); - String[] arr = metadata.split(tagStr); - for (String temp : arr) { - if (StringUtil.isValidStr(temp)) { - set.add(temp); - } - } - Iterator it = set.iterator(); - StringBuffer returnMetadata = new StringBuffer(); - while (it.hasNext()) { - returnMetadata.append(it.next() + tagStr); - } - return returnMetadata.toString().substring(0,returnMetadata.length() - 1); - } - - /** - *

查询是否有重复数据

- * - * @param strArr - * @param str - * @param tagStr - * @return boolean - */ - public static boolean hasEqualStr(String strArr, String str, String tagStr) { - boolean bool = false; - if (StringUtil.isValidStr(strArr)) { - String[] arr = strArr.split(tagStr); - for (String temp : arr) { - if (temp.equals(str)) { - bool = true; - break; - } - } - } - return bool; - } - - /** - *

根据字符串将其转换编码为UTF-8的字符串.

- * - *

convert type to utf-8

- * - * @param str - * @return utf-8 string - */ - public static String toUtf8String(String str) { - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < str.length(); i++) { - char c = str.charAt(i); - if (c >= 0 && c <= 255) { - sb.append(c); - } else { - byte[] b; - try { - b = Character.toString(c).getBytes("utf-8"); - } catch (Exception ex) { - b = new byte[0]; - } - for (int j = 0; j < b.length; j++) { - int k = b[j]; - if (k < 0) - k += 256; - sb.append("%" + Integer.toHexString(k).toUpperCase()); - } - } - } - return sb.toString(); - } - - /** - *

根据字符串指定的位置更新字符串内容

- * - * @param formString 被更新字符串 - * @param updateIndex 选择更新位数 - * @param updateValue 更新为值 - * - * @return String - */ - public static String formatIntegrity(String formatString, int updateIndex, char updateValue) { - if (!isValidStr(formatString)) { - return formatString; - } - if (updateIndex < 1) { - return formatString; - } - if (updateIndex > formatString.length()) { - return formatString; - } - char[] formatStringChar = formatString.toCharArray(); - formatStringChar[updateIndex] = updateValue; - - return String.valueOf(formatStringChar); - } - - /** - *

转换特殊字符

- * - * @param str 含有特殊字符的字符串 - * - * @return String - */ - public static String converSpecialChar(String str) { - if (!isValidStr(str)) { - return str; - } - str = str.trim(); - if (str.indexOf("\\") >= 0) { - str = str.replaceAll("\\\\", "\\\\\\\\\\\\\\\\"); - } - if (str.indexOf("'") >= 0) { - str = str.replaceAll("'", "\\\\'"); - } - if (str.indexOf("\"") >= 0) { - str = str.replaceAll("\"", "\\\\\""); - } - if (str.indexOf("%") >= 0) { - str = str.replaceAll("%", "\\\\%"); - } - return str; - } - - /** - *

获取字符串字节长度(包含中文和中文符号)

- * - * @param str 含有中文和中文符号的字符串 - * - * @return int - */ - public static int getLength(String str){ - return str.replaceAll("[\u4E00-\u9FA5\u3000-\u303F\uFF00-\uFFEF]", "rr").length(); - } - - /** - *

此排序方法仅应用于数字类型的string数字排序

- * - * @param arrays 有long类型的数字组成的String 数组 - * @return 排序后的数组 - */ - public static String[] sortArrays(String[] arrays){ - for(int i = 0; i < arrays.length - 1; i++) { - String temp =""; - for(int j = 0; j < arrays.length - i - 1; j++) { - if(StringUtil.getStrTolong(arrays[j]) >StringUtil.getStrTolong(arrays[j +1])) { - temp = arrays[j + 1]; - arrays[j + 1] = arrays[j]; - arrays[j] = temp; - } - } - } - return arrays; - } - - /** - *

此排序方法仅应用于浮点类型的string数字排序

- * - * @param arrays 有浮点类型的数字组成的String 数组 - * @return 排序后的数组 - */ - public static String[] sortArraystoBigDecimal(String[] arrays) { - for (int i = 0; i < arrays.length - 1; i++) { - String temp = ""; - for (int j = 0; j < arrays.length - i - 1; j++) { - if (StringUtil.getStrToBigDecimal(arrays[j]).compareTo( - StringUtil.getStrToBigDecimal(arrays[j + 1])) == 1) { - temp = arrays[j + 1]; - arrays[j + 1] = arrays[j]; - arrays[j] = temp; - } - } - } - return arrays; - } - - /** - *

判断字符串是否为NUll,或者为空字符

- * @param str 字符串 - * @return boolean - * */ - public static boolean isBlank(String str){ - if(str == null || str.equals("")){ - return true; - } - return false; - } - - - /** - *

将字符拆分,并放入list集合

- * @param str 字符串 - * @return list - * */ - public static List toLongList(String str){ - List idList = new ArrayList(); - if(!isBlank(str)){ - String[] idsArray = str.split(","); - for (int i = 0; i < idsArray.length; i++) { - idList.add(Long.parseLong(idsArray[i])); - } - } - return idList; - } - - - public static String listToString(List list, char separator) { - return org.apache.commons.lang.StringUtils.join(list.toArray(),separator); - } - - public static void main(String[] args) { - //String result = "aaaa ,,aaa"; - //System.out.println(getLength(result)); - - String[] strArray = new String[]{"How","d$o","you","do"}; - strArray = new String[]{"5.36","5.003","1.36","9.87","3.33333379"}; - //strArray = StringUtil.sortArrays(strArray); - strArray = StringUtil.sortArraystoBigDecimal(strArray); - String str = StringUtil.getArrToStr(strArray); - System.out.println(str); - - //System.out.println(StringUtil.formatIntegrity("dkkemnkn", 2, '6')); - - } - - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/SysConstant.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/SysConstant.java deleted file mode 100644 index 3b63848..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/SysConstant.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.baoying.enginex.executor.util; - -/** - * @ClassName: SysConstant - * @Description: 系统常量类 - * @author Bai_Keyang - * @date 2015-06-24 16:00:16 - */ -public final class SysConstant { - - public static final String EMPTY_STRING =""; - - public static final String SPACE =" "; - - public static final String COMMA =","; - - public static final String SEMICOLON =";"; - - public static final String MINUS ="-"; - - public static final String UNDERLINE ="_"; - - public static final String DATA_POINT ="."; - - public static final String POINT ="\\."; - - public static final String COLON =":"; - - public static final String WN ="// "; - - public static final String AT ="@"; - - public static final String SLASH ="/"; - - public static final String BACKSLASH ="\\\\"; - - public static final String YES ="Y"; - - public static final String NO ="N"; - - public static final String TRUE ="true"; - - public static final String FALSE ="false"; - - public static final String LEFT_BRACKET ="("; - - public static final String RIGHT_BRACKET =")"; - - public static final String ELLIPSIS ="..."; - - public static final String ESCAPE ="\\"; - - public static final String EXCLAMATION ="!"; - - public static final String INFINITY ="∞"; - - /** - * 系统统一操作成功码 - */ - public static final String SUCCESS_CODE = "200"; - - /** - * 系统统一操作成功提示信息 - */ - public static final String SUCCESS_MESSAGE = "操作成功"; - - /** - * 系统统一操作失败码 - */ - public static final String FAIL_CODE = "500"; - - /** - * 系统统一操作失败提示信息 - */ - public static final String FAIL_MESSAGE = "操作失败"; - - /** - * 系统统一操作失败码 - */ - public static final String UNUSE_CODE = "300"; - - /** - * 系统统一操作失败提示信息 - */ - public static final String UNUSE_MESSAGE = "已停用"; - - /** - * 系统统一操作失败码 - */ - public static final String DEL_CODE = "400"; - - /** - * 系统统一操作失败提示信息 - */ - public static final String DEL_MESSAGE = "已删除"; -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/https/HttpClient.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/https/HttpClient.java deleted file mode 100644 index f9d8b54..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/https/HttpClient.java +++ /dev/null @@ -1,320 +0,0 @@ -package com.baoying.enginex.executor.util.https; - -import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler; -import org.apache.commons.httpclient.Header; -import org.apache.commons.httpclient.HttpMethod; -import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; -import org.apache.commons.httpclient.cookie.CookiePolicy; -import org.apache.commons.httpclient.methods.GetMethod; -import org.apache.commons.httpclient.methods.PostMethod; -import org.apache.commons.httpclient.methods.multipart.PartBase; -import org.apache.commons.httpclient.params.HttpClientParams; -import org.apache.commons.httpclient.params.HttpConnectionManagerParams; -import org.apache.commons.httpclient.params.HttpMethodParams; -import org.apache.commons.httpclient.protocol.Protocol; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.io.OutputStream; -import java.net.InetAddress; -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - - -/** - * @author sinaWeibo - * - */ -public class HttpClient implements java.io.Serializable { - - static Logger log=LoggerFactory.getLogger(HttpClient.class); - - private static final long serialVersionUID = -176092625883595547L; - private static final int OK = 200; // OK: Success! - private static final int NOT_MODIFIED = 304; // Not Modified: There was no new data to return. - private static final int BAD_REQUEST = 400; // Bad Request: The request was invalid. An accompanying error message will explain why. This is the status versionCode will be returned during rate limiting. - private static final int NOT_AUTHORIZED = 401; // Not Authorized: Authentication credentials were missing or incorrect. - private static final int FORBIDDEN = 403; // Forbidden: The request is understood, but it has been refused. An accompanying error message will explain why. - private static final int NOT_FOUND = 404; // Not Found: The URI requested is invalid or the resource requested, such as a user, does not exists. - private static final int NOT_ACCEPTABLE = 406; // Not Acceptable: Returned by the Search API when an invalid format is specified in the request. - private static final int INTERNAL_SERVER_ERROR = 500;// Internal Server Error: Something is broken. Please post to the group so the Weibo team can investigate. - private static final int BAD_GATEWAY = 502;// Bad Gateway: Weibo is down or being upgraded. - private static final int SERVICE_UNAVAILABLE = 503;// Service Unavailable: The Weibo servers are up, but overloaded with requests. Try again later. The search and trend methods use this to indicate when you are being rate limited. - - private final static boolean DEBUG = true; - org.apache.commons.httpclient.HttpClient client = null; - - private MultiThreadedHttpConnectionManager connectionManager; - private int maxSize; - - public HttpClient() { - this(150, 30000, 30000, 1024 * 1024); - } - - public HttpClient(int maxConPerHost, int conTimeOutMs, int soTimeOutMs, - int maxSize) { - connectionManager = new MultiThreadedHttpConnectionManager(); - HttpConnectionManagerParams params = connectionManager.getParams(); - params.setDefaultMaxConnectionsPerHost(maxConPerHost); - params.setConnectionTimeout(conTimeOutMs); - params.setSoTimeout(soTimeOutMs); - - HttpClientParams clientParams = new HttpClientParams(); - // 忽略cookie 避免 Cookie rejected 警告 - clientParams.setCookiePolicy(CookiePolicy.IGNORE_COOKIES); - client = new org.apache.commons.httpclient.HttpClient(clientParams, - connectionManager); - Protocol myhttps = new Protocol("https", new MySSLSocketFactory(), 443); - Protocol.registerProtocol("https", myhttps); - this.maxSize = maxSize; - } - - /** - * log调试 - * - */ - private static void log(String message) { - if (DEBUG) { - log.debug(message); - } - } - - /** - * 处理http getmethod 请求 - * - */ - public int getHttps(String url){ - log.debug(" in getHttps,url="+url); - GetMethod method = new GetMethod(url); - int responseCode = -1; - try { - method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, - new DefaultHttpMethodRetryHandler(3, false)); - client.executeMethod(method); - responseCode = method.getStatusCode(); - log.info("https StatusCode:" + responseCode); - } catch (IOException ioe) { - ioe.printStackTrace(); - } finally { - method.releaseConnection(); - return responseCode; - } - } - public String get(String url) throws Exception { - return get(url, new PostParameter[0]).asString(); - } - - public Response get(String url, PostParameter[] params) - throws Exception { - log("Request:"); - log("GET:" + url); - if (null != params && params.length > 0) { - String encodedParams = HttpClient.encodeParameters(params); - if (-1 == url.indexOf("?")) { - url += "?" + encodedParams; - } else { - url += "&" + encodedParams; - } - } - GetMethod getmethod = new GetMethod(url); - return httpRequest(getmethod); - - } - - /** - * 处理http post请求 - * - */ - - public Response post(String url, PostParameter[] params) - throws Exception { - return post(url, params, true); - - } - - public Response post(String url, PostParameter[] params, - Boolean WithTokenHeader) throws HttpsException { - log("Request:"); - log("POST" + url); - PostMethod postMethod = new PostMethod(url); - for (int i = 0; i < params.length; i++) { - postMethod.addParameter(params[i].getName(), params[i].getValue()); - } - HttpMethodParams param = postMethod.getParams(); - param.setContentCharset("UTF-8"); - if (WithTokenHeader) { - return httpRequest(postMethod); - } else { - return httpRequest(postMethod, WithTokenHeader); - } - } - - /** - * 处理http post请求 - * - */ - - public String post(String url, Map params) - throws Exception { - String strResult = null; - - Response response= post(url, params, true); - if (response !=null) { - // 取出回应字串 - strResult = response.getResponseAsString(); - } - return strResult; - } - - public Response post(String url, Map params, - Boolean WithTokenHeader) throws HttpsException { - log("Request:"); - log("POST" + url); - PostMethod postMethod = new PostMethod(url); - postMethod.addRequestHeader("Content-type","application/x-www-form-urlencoded; charset=UTF-8"); - - for (Map.Entry entry : params.entrySet()) { - postMethod.addParameter(entry.getKey(), entry - .getValue()); - } - - HttpMethodParams param = postMethod.getParams(); - param.setContentCharset("UTF-8"); - if (WithTokenHeader) { - return httpRequest(postMethod); - } else { - return httpRequest(postMethod, WithTokenHeader); - } - } - public Response httpRequest(HttpMethod method) throws HttpsException { - return httpRequest(method, true); - } - - public Response httpRequest(HttpMethod method, Boolean WithTokenHeader) - throws HttpsException { - InetAddress ipaddr; - int responseCode = -1; - try { - ipaddr = InetAddress.getLocalHost(); - List
headers = new ArrayList
(); - method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, - new DefaultHttpMethodRetryHandler(3, false)); - client.executeMethod(method); - Header[] resHeader = method.getResponseHeaders(); - responseCode = method.getStatusCode(); - log("Response:"); - log("https StatusCode:" + String.valueOf(responseCode)); - - for (Header header : resHeader) { - log(header.getName() + ":" + header.getValue()); - } - Response response = new Response(); - response.setResponseAsString(method.getResponseBodyAsString()); - log(response.toString() + "\n"); - - if (responseCode != OK) - - { - try { - throw new HttpsException(getCause(responseCode)); - } catch (Exception e) { - e.printStackTrace(); - } - } - return response; - - } catch (IOException ioe) { - throw new HttpsException(ioe.getMessage(), ioe, responseCode); - } finally { - method.releaseConnection(); - } - - } - - /* - * 对parameters进行encode处理 - */ - public static String encodeParameters(PostParameter[] postParams) { - StringBuffer buf = new StringBuffer(); - for (int j = 0; j < postParams.length; j++) { - if (j != 0) { - buf.append("&"); - } - try { - buf.append(URLEncoder.encode(postParams[j].getName(), "UTF-8")) - .append("=") - .append(URLEncoder.encode(postParams[j].getValue(), - "UTF-8")); - } catch (java.io.UnsupportedEncodingException neverHappen) { - } - } - return buf.toString(); - } - - private static class ByteArrayPart extends PartBase { - private byte[] mData; - private String mName; - - public ByteArrayPart(byte[] data, String name, String type) - throws IOException { - super(name, type, "UTF-8", "binary"); - mName = name; - mData = data; - } - - protected void sendData(OutputStream out) throws IOException { - out.write(mData); - } - - protected long lengthOfData() throws IOException { - return mData.length; - } - - protected void sendDispositionHeader(OutputStream out) - throws IOException { - super.sendDispositionHeader(out); - StringBuilder buf = new StringBuilder(); - buf.append("; filename=\"").append(mName).append("\""); - out.write(buf.toString().getBytes()); - } - } - - private static String getCause(int statusCode) { - String cause = null; - switch (statusCode) { - case NOT_MODIFIED: - break; - case BAD_REQUEST: - cause = "The request was invalid. An accompanying error message will explain why. This is the status versionCode will be returned during rate limiting."; - break; - case NOT_AUTHORIZED: - cause = "Authentication credentials were missing or incorrect."; - break; - case FORBIDDEN: - cause = "The request is understood, but it has been refused. An accompanying error message will explain why."; - break; - case NOT_FOUND: - cause = "The URI requested is invalid or the resource requested, such as a user, does not exists."; - break; - case NOT_ACCEPTABLE: - cause = "Returned by the Search API when an invalid format is specified in the request."; - break; - case INTERNAL_SERVER_ERROR: - cause = "Something is broken. Please post to the group so the Weibo team can investigate."; - break; - case BAD_GATEWAY: - cause = "Weibo is down or being upgraded."; - break; - case SERVICE_UNAVAILABLE: - cause = "Service Unavailable: The Weibo servers are up, but overloaded with requests. Try again later. The search and trend methods use this to indicate when you are being rate limited."; - break; - default: - cause = ""; - } - return statusCode + ":" + cause; - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/https/HttpsException.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/https/HttpsException.java deleted file mode 100644 index b28487f..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/https/HttpsException.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.baoying.enginex.executor.util.https; - -/** - * An exception class that will be thrown when WeiboAPI calls are failed.
- * In case the Weibo server returned HTTP error versionCode, you can get the HTTP status versionCode using getStatusCode() method. - * @author Yusuke Yamamoto - yusuke at mac.com - */ -public class HttpsException extends Exception { - private int statusCode = -1; - private int errorCode = -1; - private String request; - private String error; - private static final long serialVersionUID = -2623309261327598087L; - - public HttpsException(String msg) { - super(msg); - } - - public HttpsException(Exception cause) { - super(cause); - } - - public HttpsException(String msg, Exception cause) { - super(msg, cause); - } - - public HttpsException(String msg, Exception cause, int statusCode) { - super(msg, cause); - this.statusCode = statusCode; - - } - - public int getStatusCode() { - return this.statusCode; - } - - public int getErrorCode() { - return errorCode; - } - - public String getRequest() { - return request; - } - - public String getError() { - return error; - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/https/MySSLSocketFactory.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/https/MySSLSocketFactory.java deleted file mode 100644 index f415676..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/https/MySSLSocketFactory.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.baoying.enginex.executor.util.https; - -import org.apache.commons.httpclient.ConnectTimeoutException; -import org.apache.commons.httpclient.params.HttpConnectionParams; -import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; - -import javax.net.SocketFactory; -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; -import java.io.IOException; -import java.net.*; -import java.security.KeyManagementException; -import java.security.NoSuchAlgorithmException; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; - -/** -Provide a custom socket factory that implements org.apache.commons.httpclient.protocol.ProtocolSocketFactory interface. -The socket factory is responsible for opening a socket to the target server using either the standard or a third party -SSL library and performing any required initialization such as performing the connection handshake. Generally the initialization -is performed automatically when the socket is created. -@author sinaWeibo -*/ -public class MySSLSocketFactory implements ProtocolSocketFactory { - private SSLContext sslcontext = null; - private SSLContext createSSLContext() { - SSLContext sslcontext = null; - try { - sslcontext = SSLContext.getInstance("SSL"); - sslcontext.init(null, - new TrustManager[] { new TrustAnyTrustManager() }, - new java.security.SecureRandom()); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } catch (KeyManagementException e) { - e.printStackTrace(); - } - return sslcontext; - } - - private SSLContext getSSLContext() { - if (this.sslcontext == null) { - this.sslcontext = createSSLContext(); - } - return this.sslcontext; - } - - public Socket createSocket(Socket socket, String host, int port, - boolean autoClose) throws IOException, UnknownHostException { - return getSSLContext().getSocketFactory().createSocket(socket, host, - port, autoClose); - } - - public Socket createSocket(String host, int port) throws IOException, - UnknownHostException { - return getSSLContext().getSocketFactory().createSocket(host, port); - } - - public Socket createSocket(String host, int port, InetAddress clientHost, - int clientPort) throws IOException, UnknownHostException { - return getSSLContext().getSocketFactory().createSocket(host, port, - clientHost, clientPort); - } - - public Socket createSocket(String host, int port, InetAddress localAddress, - int localPort, HttpConnectionParams params) throws IOException, - UnknownHostException, ConnectTimeoutException { - if (params == null) { - throw new IllegalArgumentException("Parameters may not be null"); - } - int timeout = params.getConnectionTimeout(); - SocketFactory socketfactory = getSSLContext().getSocketFactory(); - if (timeout == 0) { - return socketfactory.createSocket(host, port, localAddress, - localPort); - } else { - Socket socket = socketfactory.createSocket(); - SocketAddress localaddr = new InetSocketAddress(localAddress, - localPort); - SocketAddress remoteaddr = new InetSocketAddress(host, port); - socket.bind(localaddr); - socket.connect(remoteaddr, timeout); - return socket; - } - } - - private static class TrustAnyTrustManager implements X509TrustManager { - public void checkClientTrusted(X509Certificate[] chain, String authType) - throws CertificateException { - } - - public void checkServerTrusted(X509Certificate[] chain, String authType) - throws CertificateException { - } - - public X509Certificate[] getAcceptedIssuers() { - return new X509Certificate[] {}; - } - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/https/PostParameter.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/https/PostParameter.java deleted file mode 100644 index 699056d..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/https/PostParameter.java +++ /dev/null @@ -1,208 +0,0 @@ -package com.baoying.enginex.executor.util.https; - -import java.io.File; -import java.net.URLEncoder; -import java.util.List; - - -/** - * A data class representing HTTP Post parameter - * @author Yusuke Yamamoto - yusuke at mac.com - */ -public class PostParameter implements java.io.Serializable{ - String name; - String value; - private File file = null; - - private static final long serialVersionUID = -8708108746980739212L; - - public PostParameter(String name, String value) { - this.name = name; - this.value = value; - } - - public PostParameter(String name, double value) { - this.name = name; - this.value = String.valueOf(value); - } - - public PostParameter(String name, int value) { - this.name = name; - this.value = String.valueOf(value); - } - - public PostParameter(String name, File file) { - this.name = name; - this.file = file; - } - - public String getName(){ - return name; - } - public String getValue(){ - return value; - } - - public File getFile() { - return file; - } - - public boolean isFile(){ - return null != file; - } - - private static final String JPEG = "image/jpeg"; - private static final String GIF = "image/gif"; - private static final String PNG = "image/png"; - private static final String OCTET = "application/octet-stream"; - - /** - * - * @return content-type - */ - public String getContentType() { - if (!isFile()) { - throw new IllegalStateException("not a file"); - } - String contentType; - String extensions = file.getName(); - int index = extensions.lastIndexOf("."); - if (-1 == index) { - // no extension - contentType = OCTET; - } else { - extensions = extensions.substring(extensions.lastIndexOf(".") + 1).toLowerCase(); - if (extensions.length() == 3) { - if ("gif".equals(extensions)) { - contentType = GIF; - } else if ("png".equals(extensions)) { - contentType = PNG; - } else if ("jpg".equals(extensions)) { - contentType = JPEG; - } else { - contentType = OCTET; - } - } else if (extensions.length() == 4) { - if ("jpeg".equals(extensions)) { - contentType = JPEG; - } else { - contentType = OCTET; - } - } else { - contentType = OCTET; - } - } - return contentType; - } - - - public static boolean containsFile(PostParameter[] params) { - boolean containsFile = false; - if(null == params){ - return false; - } - for (PostParameter param : params) { - if (param.isFile()) { - containsFile = true; - break; - } - } - return containsFile; - } - /*package*/ static boolean containsFile(List params) { - boolean containsFile = false; - for (PostParameter param : params) { - if (param.isFile()) { - containsFile = true; - break; - } - } - return containsFile; - } - - public static PostParameter[] getParameterArray(String name, String value) { - return new PostParameter[]{new PostParameter(name,value)}; - } - public static PostParameter[] getParameterArray(String name, int value) { - return getParameterArray(name,String.valueOf(value)); - } - - public static PostParameter[] getParameterArray(String name1, String value1 - , String name2, String value2) { - return new PostParameter[]{new PostParameter(name1, value1) - , new PostParameter(name2, value2)}; - } - public static PostParameter[] getParameterArray(String name1, int value1 - , String name2, int value2) { - return getParameterArray(name1,String.valueOf(value1),name2,String.valueOf(value2)); - } - - @Override - public int hashCode() { - int result = name.hashCode(); - result = 31 * result + value.hashCode(); - result = 31 * result + (file != null ? file.hashCode() : 0); - return result; - } - - @Override public boolean equals(Object obj) { - if (null == obj) { - return false; - } - if (this == obj) { - return true; - } - if (obj instanceof PostParameter) { - PostParameter that = (PostParameter) obj; - - if (file != null ? !file.equals(that.file) : that.file != null) - return false; - - return this.name.equals(that.name) && - this.value.equals(that.value); - } - return false; - } - - @Override - public String toString() { - return "PostParameter{" + - "name='" + name + '\'' + - ", value='" + value + '\'' + - ", file=" + file + - '}'; - } - - public int compareTo(Object o) { - int compared; - PostParameter that = (PostParameter) o; - compared = name.compareTo(that.name); - if (0 == compared) { - compared = value.compareTo(that.value); - } - return compared; - } - - public static String encodeParameters(PostParameter[] httpParams) { - if (null == httpParams) { - return ""; - } - StringBuffer buf = new StringBuffer(); - for (int j = 0; j < httpParams.length; j++) { - if (httpParams[j].isFile()) { - throw new IllegalArgumentException("parameter [" + httpParams[j].name + "]should be text"); - } - if (j != 0) { - buf.append("&"); - } - try { - buf.append(URLEncoder.encode(httpParams[j].name, "UTF-8")) - .append("=").append(URLEncoder.encode(httpParams[j].value, "UTF-8")); - } catch (java.io.UnsupportedEncodingException neverHappen) { - } - } - return buf.toString(); - - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/https/Response.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/https/Response.java deleted file mode 100644 index 9d60b9a..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/https/Response.java +++ /dev/null @@ -1,225 +0,0 @@ -package com.baoying.enginex.executor.util.https; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Document; -import org.xml.sax.SAXException; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import java.io.*; -import java.net.HttpURLConnection; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.zip.GZIPInputStream; - -/** - * A data class representing HTTP Response - * - * @author Yusuke Yamamoto - yusuke at mac.com - */ -public class Response { - private final static boolean DEBUG = true; - static Logger log = LoggerFactory.getLogger(Response.class.getName()); - - - private static ThreadLocal builders = - new ThreadLocal() { - @Override - protected DocumentBuilder initialValue() { - try { - return - DocumentBuilderFactory.newInstance() - .newDocumentBuilder(); - } catch (ParserConfigurationException ex) { - throw new ExceptionInInitializerError(ex); - } - } - }; - - private int statusCode; - private Document responseAsDocument = null; - private String responseAsString = null; - private InputStream is; - private HttpURLConnection con; - private boolean streamConsumed = false; - - public Response() { - - } - public Response(HttpURLConnection con) throws IOException { - this.con = con; - this.statusCode = con.getResponseCode(); - if(null == (is = con.getErrorStream())){ - is = con.getInputStream(); - } - if (null != is && "gzip".equals(con.getContentEncoding())) { - // the response is gzipped - is = new GZIPInputStream(is); - } - } - - // for test purpose - /*package*/ Response(String content) { - this.responseAsString = content; - } - - public int getStatusCode() { - return statusCode; - } - - public String getResponseHeader(String name) { - if (con != null) - return con.getHeaderField(name); - else - return null; - } - - /** - * Returns the response stream.
- * This method cannot be called after calling asString() or asDcoument()
- * It is suggested to call disconnect() after consuming the stream. - * - * Disconnects the internal HttpURLConnection silently. - * @return response body stream - * @throws HttpsException - * @see #disconnect() - */ - public InputStream asStream() { - if(streamConsumed){ - throw new IllegalStateException("Stream has already been consumed."); - } - return is; - } - - /** - * Returns the response body as string.
- * Disconnects the internal HttpURLConnection silently. - * @return response body - * @throws HttpsException - */ - public String asString() throws HttpsException{ - if(null == responseAsString){ - BufferedReader br; - try { - InputStream stream = asStream(); - if (null == stream) { - return null; - } - br = new BufferedReader(new InputStreamReader(stream, "UTF-8")); - StringBuffer buf = new StringBuffer(); - String line; - while (null != (line = br.readLine())) { - buf.append(line).append("\n"); - } - this.responseAsString = buf.toString(); - /* if(Configuration.isDalvik()){ - this.responseAsString = unescape(responseAsString); - }*/ - log(responseAsString); - stream.close(); - con.disconnect(); - streamConsumed = true; - } catch (NullPointerException npe) { - // don't remember in which case npe can be thrown - throw new HttpsException(npe.getMessage(), npe); - } catch (IOException ioe) { - throw new HttpsException(ioe.getMessage(), ioe); - } - } - return responseAsString; - } - - /** - * Returns the response body as org.w3c.dom.Document.
- * Disconnects the internal HttpURLConnection silently. - * @return response body as org.w3c.dom.Document - * @throws HttpsException - */ - public Document asDocument() throws HttpsException { - if (null == responseAsDocument) { - try { - // it should be faster to read the inputstream directly. - // but makes it difficult to troubleshoot - this.responseAsDocument = builders.get().parse(new ByteArrayInputStream(asString().getBytes("UTF-8"))); - } catch (SAXException saxe) { - throw new HttpsException("The response body was not well-formed:\n" + responseAsString, saxe); - } catch (IOException ioe) { - throw new HttpsException("There's something with the connection.", ioe); - } - } - return responseAsDocument; - } - - public InputStreamReader asReader() { - try { - return new InputStreamReader(is, "UTF-8"); - } catch (java.io.UnsupportedEncodingException uee) { - return new InputStreamReader(is); - } - } - - public void disconnect(){ - con.disconnect(); - } - - private static Pattern escaped = Pattern.compile("&#([0-9]{3,5});"); - - /** - * Unescape UTF-8 escaped characters to string. - * @author pengjianq...@gmail.com - * - * @param original The string to be unescaped. - * @return The unescaped string - */ - public static String unescape(String original) { - Matcher mm = escaped.matcher(original); - StringBuffer unescaped = new StringBuffer(); - while (mm.find()) { - mm.appendReplacement(unescaped, Character.toString( - (char) Integer.parseInt(mm.group(1), 10))); - } - mm.appendTail(unescaped); - return unescaped.toString(); - } - - @Override - public String toString() { - if(null != responseAsString){ - return responseAsString; - } - return "Response{" + - "statusCode=" + statusCode + - ", response=" + responseAsDocument + - ", responseString='" + responseAsString + '\'' + - ", is=" + is + - ", con=" + con + - '}'; - } - - private void log(String message) { - if (DEBUG) { - log.debug("[" + new java.util.Date() + "]" + message); - } - } - - private void log(String message, String message2) { - if (DEBUG) { - log(message + message2); - } - } - - public String getResponseAsString() { - return responseAsString; - } - - public void setResponseAsString(String responseAsString) { - this.responseAsString = responseAsString; - } - - public void setStatusCode(int statusCode) { - this.statusCode = statusCode; - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/ArgumentTokenizer.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/ArgumentTokenizer.java deleted file mode 100644 index 5b9597f..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/ArgumentTokenizer.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval; - -import java.util.Enumeration; - -/** - * This class allow for tokenizer methods to be called on a String of arguments. - */ -public class ArgumentTokenizer implements Enumeration { - - /** - * The default delimitor. - */ - public final char defaultDelimiter = - EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR; - - // The arguments to be tokenized. This is updated every time the nextToken - // method is called. - private String arguments = null; - - // The separator between the arguments. - private char delimiter = defaultDelimiter; - - /** - * Constructor that takes a String of arguments and a delimitoer. - * - * @param arguments - * The String of srguments to be tokenized. - * @param delimiter - * The argument tokenizer. - */ - public ArgumentTokenizer(final String arguments, final char delimiter) { - this.arguments = arguments; - this.delimiter = delimiter; - } - - /** - * Indicates if there are more elements. - * - * @return True if there are more elements and false if not. - */ - public boolean hasMoreElements() { - return hasMoreTokens(); - } - - /** - * Indicates if there are more tokens. - * - * @return True if there are more tokens and false if not. - */ - public boolean hasMoreTokens() { - - if (arguments.length() > 0) { - return true; - } - - return false; - } - - /** - * Returns the next element. - * - * @return The next element. - */ - public Object nextElement() { - return nextToken(); - } - - /** - * Returns the next token. - * - * @return The next element. - */ - public String nextToken() { - int charCtr = 0; - int size = arguments.length(); - int parenthesesCtr = 0; - String returnArgument = null; - - // Loop until we hit the end of the arguments String. - while (charCtr < size) { - if (arguments.charAt(charCtr) == '(') { - parenthesesCtr++; - } else if (arguments.charAt(charCtr) == ')') { - parenthesesCtr--; - } else if (arguments.charAt(charCtr) == delimiter - && parenthesesCtr == 0) { - - returnArgument = arguments.substring(0, charCtr); - arguments = arguments.substring(charCtr + 1); - break; - } - - charCtr++; - } - - if (returnArgument == null) { - returnArgument = arguments; - arguments = ""; - } - - return returnArgument; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/EvaluationConstants.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/EvaluationConstants.java deleted file mode 100644 index 877eb1a..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/EvaluationConstants.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.baoying.enginex.executor.util.jeval; - -/** - * Contains constants used by classes in this package. - */ -public class EvaluationConstants { - - /** - * The single quote character. - */ - public static final char SINGLE_QUOTE = '\''; - - /** - * The double quote character. - */ - public static final char DOUBLE_QUOTE = '"'; - - /** - * The open brace character. - */ - public static final char OPEN_BRACE = '{'; - - /** - * The closed brace character. - */ - public static final char CLOSED_BRACE = '}'; - - /** - * The pound sign character. - */ - public static final char POUND_SIGN = '#'; - - /** - * The open variable string. - */ - public static final String OPEN_VARIABLE = String.valueOf(POUND_SIGN) - + String.valueOf(OPEN_BRACE); - - /** - * The closed brace string. - */ - public static final String CLOSED_VARIABLE = String.valueOf(CLOSED_BRACE); - - /** - * The true value for a Boolean string. - */ - public static final String BOOLEAN_STRING_TRUE = "1.0"; - - /** - * The false value for a Boolean string. - */ - public static final String BOOLEAN_STRING_FALSE = "0.0"; - - /** - * The comma character. - */ - public static final char COMMA = ','; - - /** - * The function argument separator. - */ - public static final char FUNCTION_ARGUMENT_SEPARATOR = COMMA; -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/EvaluationException.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/EvaluationException.java deleted file mode 100644 index 548a14f..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/EvaluationException.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval; - -/** - * This exception is thrown when an error occurs during the evaluation process. - */ -public class EvaluationException extends Exception { - - private static final long serialVersionUID = -3010333364122748053L; - - /** - * This constructor takes a custom message as input. - * - * @param message - * A custom message for the exception to display. - */ - public EvaluationException(String message) { - super(message); - } - - /** - * This constructor takes an exception as input. - * - * @param exception - * An exception. - */ - public EvaluationException(Exception exception) { - super(exception); - } - - /** - * This constructor takes an exception as input. - * - * @param message - * A custom message for the exception to display. - * @param exception - * An exception. - */ - public EvaluationException(String message, Exception exception) { - super(message, exception); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/EvaluationHelper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/EvaluationHelper.java deleted file mode 100644 index 3a94b9e..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/EvaluationHelper.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval; - -public class EvaluationHelper { - - /** - * Replaces all old string within the expression with new strings. - * - * @param expression - * The string being processed. - * @param oldString - * The string to replace. - * @param newString - * The string to replace the old string with. - * - * @return The new expression with all of the old strings replaced with new - * strings. - */ - public static String replaceAll(final String expression, - final String oldString, final String newString) { - - String replacedExpression = expression; - - if (replacedExpression != null) { - int charCtr = 0; - int oldStringIndex = replacedExpression.indexOf(oldString, charCtr); - - while (oldStringIndex > -1) { - // Remove the old string from the expression. - final StringBuffer buffer = new StringBuffer(replacedExpression - .substring(0, oldStringIndex) - + replacedExpression.substring(oldStringIndex - + oldString.length())); - - // Insert the new string into the expression. - buffer.insert(oldStringIndex, newString); - - replacedExpression = buffer.toString(); - - charCtr = oldStringIndex + newString.length(); - - // Determine if we need to continue to search. - if (charCtr < replacedExpression.length()) { - oldStringIndex = replacedExpression.indexOf(oldString, - charCtr); - } else { - oldStringIndex = -1; - } - } - } - - return replacedExpression; - } - - /** - * Determines if a character is a space or white space. - * - * @param character - * The character being evaluated. - * - * @return True if the character is a space or white space and false if not. - */ - public static boolean isSpace(final char character) { - - if (character == ' ' || character == '\t' || character == '\n' - || character == '\r' || character == '\f') { - return true; - } - - return false; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/EvaluationResult.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/EvaluationResult.java deleted file mode 100644 index 59e820c..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/EvaluationResult.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval; - -/** - * This class can be used to wrap the result of an expression evaluation. It - * contains useful methods for evaluating the contents of the result. - */ -public class EvaluationResult { - - // The value returned from the evaluation of an expression. - private String result; - - // The quote character specified in the evaluation of the expression. - private char quoteCharacter; - - /** - * Constructor. - * - * @param result - * The value returned from the evaluation of an expression. - * @param quoteCharacter - * The quote character specified in the evaluation of the - * expression. - */ - public EvaluationResult(String result, char quoteCharacter) { - - this.result = result; - this.quoteCharacter = quoteCharacter; - } - - /** - * Returns the quote character. - * - * @return The quote character. - */ - public char getQuoteCharacter() { - return quoteCharacter; - } - - /** - * Sets the quote character. - * - * @param quoteCharacter - * The quoteCharacter to set. - */ - public void setQuoteCharacter(char quoteCharacter) { - this.quoteCharacter = quoteCharacter; - } - - /** - * Returns the result value. - * - * @return The result value. - */ - public String getResult() { - return result; - } - - /** - * Sets the result value. - * - * @param result - * The result to set. - */ - public void setResult(String result) { - this.result = result; - } - - /** - * Returns true if the result value is equal to the value of a Boolean true - * string (1.0). - * - * @return True if the result value is equal to the value of a Boolean true - * string (1.0). - */ - public boolean isBooleanTrue() { - - if (result != null - && EvaluationConstants.BOOLEAN_STRING_TRUE.equals(result)) { - - return true; - } - - return false; - } - - /** - * Returns true if the result value is equal to the value of a Boolean false - * string (0.0). - * - * @return True if the result value is equal to the value of a Boolean false - * string (0.0). - */ - public boolean isBooleanFalse() { - - if (result != null - && EvaluationConstants.BOOLEAN_STRING_FALSE.equals(result)) { - - return true; - } - - return false; - } - - /** - * Returns true if the result value starts with a quote character and ends - * with a quote character. - * - * @return True if the result value starts with a quote character and ends - * with a quote character. - */ - public boolean isString() { - - if (result != null && result.length() >= 2) { - - if (result.charAt(0) == quoteCharacter - && result.charAt(result.length() - 1) == quoteCharacter) { - - return true; - } - } - - return false; - } - - /** - * Returns a Double for the result value. - * - * @return A Double for the result value. - * - * @throws NumberFormatException - * Thrown if the result value is not a double. - */ - public Double getDouble() throws NumberFormatException { - - return new Double(result); - } - - /** - * Returns the unwrapped string for the result value. An unwrapped string is - * a string value without the quote characters that wrap the result value. - * For a string to be returned, then the first character must be a quote - * character and the last character must be a quote character. Otherwise, a - * null value is returned. - * - * @return The normal string for the result value. Null will be returned if - * the result value is not of a string type. - */ - public String getUnwrappedString() { - - if (result != null && result.length() >= 2) { - - if (result.charAt(0) == quoteCharacter - && result.charAt(result.length() - 1) == quoteCharacter) { - - return result.substring(1, result.length() - 1); - } - } - - return null; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/Evaluator.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/Evaluator.java deleted file mode 100644 index 9c6fc7b..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/Evaluator.java +++ /dev/null @@ -1,1703 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval; - -import com.baoying.enginex.executor.util.jeval.function.*; -import com.baoying.enginex.executor.util.jeval.function.math.MathFunctions; -import com.baoying.enginex.executor.util.jeval.function.string.StringFunctions; -import com.baoying.enginex.executor.util.jeval.operator.*; - -import java.util.*; - -/** - * This class is used to evaluate mathematical, string, Boolean and functional - * expressions. It is the main entry point into the JEval API.
- *
- * The following types of expressions are supported:
- *
    - *
  • mathematical Expression involving numbers. Numbers are treated - * as doubles, so resulting numbers will contain at least one decimal place.
  • - *
  • string String can also be added together, compared, etc...
  • - *
  • Boolean Expression that evaluate to true (1.0) and false (0.0).
  • - *
  • functional Custom functions can be created or there are many - * Math and String functions that JEval supplies with this class.
  • - *
- * The following operators are supported:
- *
    - *
  • ( open parentheses
  • - *
  • ) closed parentheses
  • - *
  • + addition (for numbers and strings)
  • - *
  • - subtraction
  • - *
  • * multiplication
  • - *
  • / division
  • - *
  • % modulus
  • - *
  • + unary plus
  • - *
  • - unary minus
  • - *
  • = equal (for numbers and strings)
  • - *
  • != not equal (for numbers and strings)
  • - *
  • < less than (for numbers and strings)
  • - *
  • <= less than or equal (for numbers and strings)
  • - *
  • > greater than (for numbers and strings)
  • - *
  • >= greater than or equal (for numbers and strings)
  • - *
  • && boolean and
  • - *
  • || boolean or
  • - *
  • ! boolean not
  • - *
- * Allows for prebuilt and custom functions.
- *
    - *
  • JEval already comes with many functions which represent most of the - * methods in the Math and String classes in the standard JDK.
  • - *
  • Thirty-nine math and string functions come built in. See the - * net.sourceforge.jeval.functions.math and - * net.sourceforge.jeval.functions.string packages for details on these ready to - * use functions. You can choose to not load these functions if we you want to - * gain a small improvement in performance.
  • - *
  • Functions must be followed by an open parentheses and a closed - * parentheses which contain any required parameters.
  • - *
  • For more details on functions, see the Function class and the test - * classes.
  • - *
- * Allows for variables.
- *
    - *
  • Variable must be enclosed by a pound sign and open brace #{ and a closed - * brace }. i.e. expression = "#{a} + #{b}"
  • - *
  • Two math variables come built in. The E and PI variables represent the - * same value as the Math.E and Math.PI constants in the standard Java SDK. You - * can choose not to load these variables.
  • - *
- * Notes on expression parsing: - *
    - *
  • Spaces are ignored when parsing expressions.
  • - *
  • The order of precedence used by this class is as follows from highest to - * lowest.
  • - *
  • The expression is evaluated as one or more subexpressions. - * Subexpressions within open parentheses and closed parentheses are evaluated - * before other parts of the expression.
  • - *
  • Inner most subexpression are evaluated first working outward.
  • - *
  • Subexpressions at the same level are evaluated from left to right.
  • - *
  • When evaluating expressions and subexpressions, operators are evaluated - * with the following precedence listed below.
  • - *
  • Operators with with the same precedence are evaluated from left to - * right.
  • - *
  • Once the expression is parsed, Variables are replaced with their values. - * The evaluator has its own internal variable map that it used to resolve - * variable values. All of the variable related methods on the evaluator refer - * to this internal map. You can choose to set you own variable resolver on your - * evaluator instance. If you do this, then variables resolved by your resolver - * will override any variables in the evaluator's internal variable map.
  • - *
  • Functions are then executed and replaced with their results. Function - * arguments are each individually evaluated as subexpressions that are comma - * separated. This gives you the ability to use nested functions in your - * expressions. You can choose not to evaluate function arguments as expressions - * and instead let the functions handle the arguments themselves. This in effect - * turns off nested expressions, unless you versionCode nested expression support into - * your own custom functions.
  • - *
  • Once all variables and functions are resolved, then the parsed - * expression and subexpressions are evaluated according to operator precedence.
  • - *
- * Operator precedence: - *
    - *
  • + unary plus, - unary minus, ! boolean not
  • - *
  • * multiplication, / division, % modulus
  • - *
  • + addition, - subtraction
  • - *
  • < less than, <= less than or equal, > greater than, >= greater than or - * equal
  • - *
  • = equal, != not equal
  • - *
  • && boolean and
  • - *
  • || boolean or
  • - *
- * Function and variable names can not break any of the following rules:
- *
    - *
  • can not start with a number
  • - *
  • can not contain an operator (see the above list of operators)/li> - *
  • can not contain a quote character - single or double/li> - *
  • can not contain a brace character - open or closed/li> - *
  • can not contain one of the following special characters: #, ~ , ^ !
  • - *
- * Other Notes: - *
    - *
  • This class is not thread safe.
  • - *
  • Allows for the quote character (single or double) to be specified at run - * time. Quote characters are required for specifying string values.
  • - *
  • Expressions can contain different types of expressions within the same - * expression. However, Numeric and string types can not be mixed in a left / - * right operand pair.
  • - *
  • An expression can be parsed before being evaluated by calling the parse() - * method. This may save on response time if parsing takes more than a few - * seconds. However, parsing is usually very fast, so this is probably not - * needed.
  • - *
  • If an expression does not change, it will not be parsed each - * time the expression is evaluated. Therefore, variables values can change and - * the expression can be evaluated again without having to re-parse the - * expression.
  • - *
  • Nested functions calls are supported. Nested function support can be - * turned off to improve performance. Custom functions can be coded to handle - * nested calls instead if desired.
  • - *
  • The string used to start variables, "#{", can not appear in an - * expression. - *
  • See the evaluate methods in this class, JUnit tests and samples for more - * details.
  • - *
- */ -public class Evaluator { - - // Contains all of the operators. - private List operators = new ArrayList(); - - // Contains all of the functions in use. - private Map functions = new HashMap(); - - // Contains all of the variables in use. - private Map variables = new HashMap(); - - // The quote character in use. - private char quoteCharacter = EvaluationConstants.SINGLE_QUOTE; - - // The open parentheses operator. - private Operator openParenthesesOperator = new OpenParenthesesOperator(); - - // The closed parentheses operator. - private Operator closedParenthesesOperator = new ClosedParenthesesOperator(); - - // Indicates if the user wants to load the system math variables. - private boolean loadMathVariables; - - // Indicates if the user wants to load the system math functions. - private boolean loadMathFunctions; - - // Indicates if the user wants to load the system string functions. - private boolean loadStringFunctions; - - // Indicates if the user wants to process nested function calls. - private boolean processNestedFunctions; - - // Saves the previous expression, because we do not want to parse it, if - // it did not change. - private String previousExpression = null; - - // The previous stack of parsed operators - private Stack previousOperatorStack = null; - - // The previous stack of parsed operands. - private Stack previousOperandStack = null; - - // The stack of parsed operators - private Stack operatorStack = null; - - // The stack of parsed operands. - private Stack operandStack = null; - - // Allows for user to set their own variable resolver. - private VariableResolver variableResolver = null; - - /** - * The default constructor. This constructor calls the five parameter - * Evaluator constructor and passes in the following default values: - * SINGLE_QUOTE, true, true, true and true. - */ - public Evaluator() { - this(EvaluationConstants.SINGLE_QUOTE, true, true, true, true); - } - - /** - * The main constructor for Evaluator. - * - * @param quoteCharacter - * The quote character to use when evaluating expression. - * @param loadMathVariables - * Indicates if the standard Math variables should be loaded or - * not. - * @param loadMathFunctions - * Indicates if the standard Math functions should be loaded or - * not. - * @param loadStringFunctions - * Indicates if the standard String functions should be loaded or - * not. - * @param processNestedFunctions - * Indicates if nested function calls should be processed or not. - * - * @exception IllegalArgumentException - * Thrown when the quote character is not a valid quote - * character. - */ - public Evaluator(final char quoteCharacter, - final boolean loadMathVariables, final boolean loadMathFunctions, - final boolean loadStringFunctions, - final boolean processNestedFunctions) { - - // Install the operators used by Evaluator. - installOperators(); - - // Install the system variables. - this.loadMathVariables = loadMathVariables; - loadSystemVariables(); - - // Install the system functions. - this.loadMathFunctions = loadMathFunctions; - this.loadStringFunctions = loadStringFunctions; - loadSystemFunctions(); - - // Set the default quote character. - setQuoteCharacter(quoteCharacter); - - // Process nested function calls. - this.processNestedFunctions = processNestedFunctions; - } - - /** - * Returns the current quote character in use. - * - * @return The quote character in use. - */ - public char getQuoteCharacter() { - return quoteCharacter; - } - - /** - * Sets the quote character to use when evaluating expressions. - * - * @param quoteCharacter - * The quote character to use when evaluating expressions. - * - * @exception IllegalArgumentException - * Thrown when the quote character is not a valid quote - * character. - */ - public void setQuoteCharacter(final char quoteCharacter) { - if (quoteCharacter == EvaluationConstants.SINGLE_QUOTE - || quoteCharacter == EvaluationConstants.DOUBLE_QUOTE) { - this.quoteCharacter = quoteCharacter; - } else { - throw new IllegalArgumentException("Invalid quote character."); - } - } - - /** - * Adds a function to the list of functions to use when evaluating - * expressions. - * - * @param function - * The function being added. - * - * @exception IllegalArgumentException - * Thrown when the function name is not valid or the function - * name is already in use. - */ - public void putFunction(final Function function) { - // Make sure the function name is valid. - isValidName(function.getName()); - - // Make sure the function name isn't already in use. - final Function existingFunction = (Function) functions.get(function - .getName()); - - if (existingFunction == null) { - functions.put(function.getName(), function); - } else { - throw new IllegalArgumentException("A function with the same name " - + "already exists."); - } - } - - /** - * Returns a funtion from the list of functions. If the function can not be - * found in the list of functions, then null will be returned. - * - * @param functionName - * The name of the function to retrieve the value for. - * - * @return The value for a function in the list of function. - */ - public Function getFunction(final String functionName) { - return (Function) functions.get(functionName); - } - - /** - * Removes the function from the list of functions to use when evaluating - * expressions. - * - * @param functionName - * The name of the function to remove. - */ - public void removeFunction(final String functionName) { - if (functions.containsKey(functionName)) { - functions.remove(functionName); - } else { - throw new IllegalArgumentException("The function does not exist."); - } - } - - /** - * Removes all of the functions at one time. - */ - public void clearFunctions() { - // Remove all functions. - functions.clear(); - - // Reload the system functions if necessary. - loadSystemFunctions(); - } - - /** - * Rturns the map of functions currently set on this object. - * - * @return the map of functions currently set on this object. - */ - public Map getFunctions() { - return functions; - } - - /** - * Sets the map of functions for this object. - * - * @param functions The map of functions for this object. - */ - public void setFunctions(Map functions) { - this.functions = functions; - } - - /** - * Adds or replaces a variable to the list of variables to use when - * evaluating expressions. If the variable already exists, then its value - * will be overlaid. - * - * @param variableName - * The name of the variable being set. - * @param variableValue - * The value for the variable being set. - */ - public void putVariable(final String variableName, - final String variableValue) { - // Make sure the variable name is valid. - isValidName(variableName); - - variables.put(variableName, variableValue); - } - - /** - * Returns the value for a variable in the list of variables. If the - * variable can not be found in the list of variables, then null will be - * returned. - * - * @param variableName - * The name of the variable to retrieve the value for. - * - * @return The value for a variable in the list of variables. - * - * @throws Throws - * an EvaluatorException if the variable name can not be - * resolved. - */ - public String getVariableValue(final String variableName) - throws EvaluationException { - - String variableValue = null; - - /* - * If the user has implemented a variable resolver and set it onto this - * object, then use it before looking in the variable map. - */ - if (variableResolver != null) { - - try { - variableValue = variableResolver.resolveVariable(variableName); - } catch (FunctionException fe) { - throw new EvaluationException(fe.getMessage(), fe); - } - } - - /* - * If no variable value at this point, then go to the internal variable - * map to resolve the variable. - */ - if (variableValue == null) { - - variableValue = (String) variables.get(variableName); - } - - if (variableValue == null) { - - throw new EvaluationException( - "Can not resolve variable with name equal to \"" - + variableName + "\"."); - } - - return variableValue; - } - - /** - * Removes the variable from the list of variables to use when evaluating - * expressions. - * - * @param variableName - * The name of the variable to remove. - */ - public void removeVaraible(final String variableName) { - if (variables.containsKey(variableName)) { - variables.remove(variableName); - } else { - throw new IllegalArgumentException("The variable does not exist."); - } - } - - /** - * Removes all of the variables at one time. - */ - public void clearVariables() { - // Remove all functions. - variables.clear(); - - // Reload the system variables if necessary. - loadSystemVariables(); - } - - /** - * Rturns the map of variables currently set on this object. - * - * @return the map of variables currently set on this object. - */ - public Map getVariables() { - return variables; - } - - /** - * Sets the map of variables for this object. - * - * @param variables The map of variables for this object. - */ - public void setVariables(Map variables) { - this.variables = variables; - } - - /** - * Returns the variable resolver. The variable resolver can be used by - * the user to resolve their own variables. Variables in the variable - * resolver override any variables that are in this classes internal - * variable map. - * - * @return The variable resolver. - */ - public VariableResolver getVariableResolver() { - return variableResolver; - } - - /** - * Sets the variable resolver for this class. Varaibles resolved by the - * variable resolver will override any variables in this class's internal - * variable map. - * - * @param variableResolver The variable resolver for this class. - */ - public void setVariableResolver(VariableResolver variableResolver) { - this.variableResolver = variableResolver; - } - - /** - * This method evaluates mathematical, boolean or functional expressions. - * See the class description and test classes for more information on how to - * write an expression. If quotes exist around a string expression, then - * they will be left in the result string. Function will also have their - * results wrapped with the appripriate quote characters. - * - * @param expression - * The expression to evaluate. - * - * @return The result of the evaluated. expression. Numbers are treated as - * doubles, so resulting numbers will contain at least one decimal - * place. - * - * @exception EvaluateException - * Thrown when an error is found while evaluating the - * expression. - */ - public String evaluate(final String expression) throws EvaluationException { - return evaluate(expression, true, true); - } - - /** - * This method evaluates mathematical, boolean or functional expressions. - * See the class description and test classes for more information on how to - * write an expression. The expression used will be the one previously - * specified when using the parse method. If the parse method has not been - * called before calling this method, then an exception will be thrown. If - * quotes exist around a string expression, then they will be left in the - * result string. Function will also have their results wrapped with the - * appropriate quote characters. - * - * @return The result of the evaluated. expression. Numbers are treated as - * doubles, so resulting numbers will contain at least one decimal - * place. - * - * @exception EvaluateException - * Thrown when an error is found while evaluating the - * expression. - */ - public String evaluate() throws EvaluationException { - // Get the previously parsed expression. - final String expression = previousExpression; - - if (expression == null || expression.length() == 0) { - throw new EvaluationException("No expression has been specified."); - } - - return evaluate(expression, true, true); - } - - /** - * This method evaluates mathematical, boolean or functional expressions. - * See the class description and test classes for more information on how to - * write an expression. - * - * @param expression - * The expression to evaluate. - * @param keepQuotes - * Indicates if the the quotes should be kept in the result or - * not. This is only for string expression that are enclosed in - * quotes prior to being evaluated. - * @param wrapStringFunctionResults - * Indicates if the results from functions that return strings - * should be wrapped in quotes. The quote character used will be - * whatever is the current quote character for this object. - * - * @return The result of the evaluated expression. Numbers are treated as - * doubles, so resulting numbers will contain at least one decimal - * place. - * - * @exception EvaluateException - * Thrown when an error is found while evaluating the - * expression. - */ - public String evaluate(final String expression, final boolean keepQuotes, - final boolean wrapStringFunctionResults) throws EvaluationException { - - // Parse the expression. - parse(expression); - - String result = getResult(operatorStack, operandStack, - wrapStringFunctionResults); - - // Remove the quotes if necessary. - if (isExpressionString(result) && !keepQuotes) { - result = result.substring(1, result.length() - 1); - } - - return result; - } - - /** - * This method evaluates mathematical, boolean or functional expressions. - * The expression used will be the one previously specified when using the - * parse method. If the parse method has not been called before calling this - * method, then an exception will be thrown. See the class description and - * test classes for more information on how to write an expression. - * - * @param keepQuotes - * Indicates if the the quotes should be kept in the result or - * not. This is only for string expressions that are enclosed in - * quotes prior to being evaluated. - * @param wrapStringFunctionResults - * Indicates if the results from functions that return strings - * should be wrapped in quotes. The quote character used will be - * whatever is the current quote character for this object. - * - * @return The result of the evaluated expression. Numbers are treated as - * doubles, so resulting numbers will contain at least one decimal - * place. - * - * @exception EvaluateException - * Thrown when an error is found while evaluating the - * expression. - */ - public String evaluate(final boolean keepQuotes, - final boolean wrapStringFunctionResults) throws EvaluationException { - - // Get the previously parsed expression. - final String expression = previousExpression; - - if (expression == null || expression.length() == 0) { - throw new EvaluationException("No expression has been specified."); - } - - return evaluate(expression, keepQuotes, wrapStringFunctionResults); - } - - /** - * This method is a simple wrapper around the evaluate(String) method. Its - * purpose is to return a more friendly boolean return value instead of the - * string "1.0" (for true) and "0.0" (for false) that is normally returned. - * - * @param expression - * The expression to evaluate. - * - * @return A boolean value that represents the result of the evaluated - * expression. - * - * @exception EvaluateException - * Thrown when an error is found while evaluating the - * expression. It is also thrown if the result is not able to - * be converted to a boolean value. - */ - public boolean getBooleanResult(final String expression) - throws EvaluationException { - - final String result = evaluate(expression); - - try { - Double doubleResult = new Double(result); - - if (doubleResult.doubleValue() == 1.0) { - return true; - } - } catch (NumberFormatException exception) { - return false; - } - - return false; - } - - /** - * This method is a simple wrapper around the evaluate(String) method. Its - * purpose is to return a more friendly double return value instead of the - * string number that is normally returned. - * - * @param expression - * The expression to evaluate. - * - * @return A double value that represents the result of the evaluated - * expression. - * - * @exception EvaluateException - * Thrown when an error is found while evaluating the - * expression. It is also thrown if the result is not able to - * be converted to a double value. - */ - public double getNumberResult(final String expression) - throws EvaluationException { - - final String result = evaluate(expression); - Double doubleResult = null; - - try { - doubleResult = new Double(result); - } catch (NumberFormatException nfe) { - throw new EvaluationException( - "Expression does not produce a number.", nfe); - } - - return doubleResult.doubleValue(); - } - - /** - * This method parses a mathematical, boolean or functional expressions. - * When the expression is eventually evaluated, as long as the expression - * has not changed, it will not have to be reparsed. See the class - * description and test classes for more information on how to write an - * expression. - * - * @param expression - * The expression to evaluate. - * - * @exception EvaluateException - * Thrown when an error is found while evaluating the - * expression. - */ - public void parse(final String expression) throws EvaluationException { - - // Save the expression. - boolean parse = true; - if (!expression.equals(previousExpression)) { - previousExpression = expression; - } else { - parse = false; - operatorStack = (Stack) previousOperatorStack.clone(); - operandStack = (Stack) previousOperandStack.clone(); - } - - try { - if (parse) { - // These stacks will keep track of the operands and operators. - operandStack = new Stack(); - operatorStack = new Stack(); - - // Flags to help us keep track of what we are processing. - boolean haveOperand = false; - boolean haveOperator = false; - Operator unaryOperator = null; - - // We are going to process until we get to the end, so get the - // length. - int numChars = expression.length(); - int charCtr = 0; - - // Process until the counter exceeds the length. The goal is to - // get - // all of the operands and operators. - while (charCtr < numChars) { - Operator operator = null; - int operatorIndex = -1; - - // Skip any white space. - if (EvaluationHelper.isSpace(expression.charAt(charCtr))) { - charCtr++; - continue; - } - - // Get the next operator. - NextOperator nextOperator = getNextOperator(expression, - charCtr, null); - - if (nextOperator != null) { - operator = nextOperator.getOperator(); - operatorIndex = nextOperator.getIndex(); - } - - // Check if it is time to process an operand. - if (operatorIndex > charCtr || operatorIndex == -1) { - charCtr = processOperand(expression, charCtr, - operatorIndex, operandStack, unaryOperator); - - haveOperand = true; - haveOperator = false; - unaryOperator = null; - } - - // Check if it is time to process an operator. - if (operatorIndex == charCtr) { - if (nextOperator.getOperator().isUnary() - && (haveOperator || charCtr == 0)) { - charCtr = processUnaryOperator(operatorIndex, - nextOperator.getOperator()); - - if (unaryOperator == null) { - // We have an unary operator. - unaryOperator = nextOperator.getOperator(); - } else { - throw new EvaluationException( - "Consecutive unary " - + "operators are not allowed (index=" - + charCtr + ")."); - } - } else { - charCtr = processOperator(expression, - operatorIndex, operator, operatorStack, - operandStack, haveOperand, unaryOperator); - - unaryOperator = null; - } - - if (!(nextOperator.getOperator() instanceof ClosedParenthesesOperator)) { - haveOperand = false; - haveOperator = true; - } - } - } - - // Save the parsed operators and operands. - previousOperatorStack = (Stack) operatorStack.clone(); - previousOperandStack = (Stack) operandStack.clone(); - } - } catch (Exception e) { - // Clear the previous expression, because it is invalid. - previousExpression = ""; - - throw new EvaluationException(e.getMessage(), e); - } - } - - /** - * Install all of the operators into the list of operators to use when - * evaluating expressions. - */ - private void installOperators() { - // Install the most used operators first. - operators.add(openParenthesesOperator); - operators.add(closedParenthesesOperator); - operators.add(new AdditionOperator()); - operators.add(new SubtractionOperator()); - operators.add(new MultiplicationOperator()); - operators.add(new DivisionOperator()); - operators.add(new EqualOperator()); - operators.add(new NotEqualOperator()); - - // If there is a first character conflict between two operators, - // then install the operator with the greatest length first. - operators.add(new LessThanOrEqualOperator()); // Length of 2. - operators.add(new LessThanOperator()); // Length of 1. - operators.add(new GreaterThanOrEqualOperator()); // Length of 2. - operators.add(new GreaterThanOperator()); // Length of 1. - - // Install the least used operators last. - operators.add(new BooleanAndOperator()); - operators.add(new BooleanOrOperator()); - operators.add(new BooleanNotOperator()); - operators.add(new ModulusOperator()); - } - - /** - * Processes the operand that has been found in the expression. - * - * @param expression - * The expression being evaluated. - * @param operatorIndex - * The position in the expression where the current operator - * being processed is located. - * @param operandStack - * The stack of operands. - * @param unaryOperator - * The unary operator if we are working with one. - * - * @return The new position in the expression where processing should - * continue. - * - * @exception EvaluateException - * Thrown is an error is encoutnered while processing the - * expression. - */ - private int processOperand(final String expression, final int charCtr, - final int operatorIndex, final Stack operandStack, - final Operator unaryOperator) throws EvaluationException { - - String operandString = null; - int rtnCtr = -1; - - // Get the operand to process. - if (operatorIndex == -1) { - operandString = expression.substring(charCtr).trim(); - rtnCtr = expression.length(); - } else { - operandString = expression.substring(charCtr, operatorIndex).trim(); - rtnCtr = operatorIndex; - } - - if (operandString.length() == 0) { - throw new EvaluationException("Expression is invalid."); - } - - final ExpressionOperand operand = new ExpressionOperand(operandString, - unaryOperator); - operandStack.push(operand); - - return rtnCtr; - } - - /** - * Processes the operator that has been found in the expression. - * - * @param expression - * The expression being evaluated. - * @param operatorIndex - * The position in the expression where the current operator - * being processed is located. - * @param operator - * The operator being processed. - * @param operatorStack - * The stack of operators. - * @param operandStack - * The stack of operands. - * @param haveOperand - * Indicates if have an operand to process. - * @param unaryOperator - * The unary operand associated with thi operator. This may be - * null. - * - * @return The new position in the expression where processing should - * continue. - * - * @exception EvaluateException - * Thrown is an error is encoutnered while processing the - * expression. - */ - private int processOperator(final String expression, - final int originalOperatorIndex, final Operator originalOperator, - final Stack operatorStack, final Stack operandStack, - final boolean haveOperand, final Operator unaryOperator) - throws EvaluationException { - - int operatorIndex = originalOperatorIndex; - Operator operator = originalOperator; - - // If we have and operand and the current operator is an instance - // of OpenParenthesesOperator, then we are ready to process a function. - if (haveOperand && operator instanceof OpenParenthesesOperator) { - NextOperator nextOperator = processFunction(expression, - operatorIndex, operandStack); - - operator = nextOperator.getOperator(); - operatorIndex = nextOperator.getIndex() + operator.getLength(); - - nextOperator = getNextOperator(expression, operatorIndex, null); - - // Look to see if there is another operator. - // If there is, the process it, else get out of this routine. - if (nextOperator != null) { - operator = nextOperator.getOperator(); - operatorIndex = nextOperator.getIndex(); - } else { - return operatorIndex; - } - } - - // Determine what type of operator we are left with and process - // accordingly. - if (operator instanceof OpenParenthesesOperator) { - final ExpressionOperator expressionOperator = new ExpressionOperator( - operator, unaryOperator); - operatorStack.push(expressionOperator); - } else if (operator instanceof ClosedParenthesesOperator) { - ExpressionOperator stackOperator = null; - - if (operatorStack.size() > 0) { - stackOperator = (ExpressionOperator) operatorStack.peek(); - } - - // Process until we reach an open parentheses. - while (stackOperator != null - && !(stackOperator.getOperator() instanceof OpenParenthesesOperator)) { - processTree(operandStack, operatorStack); - - if (operatorStack.size() > 0) { - stackOperator = (ExpressionOperator) operatorStack.peek(); - } else { - stackOperator = null; - } - } - - if (operatorStack.isEmpty()) { - throw new EvaluationException("Expression is invalid."); - } - - // Pop the open parameter from the stack. - final ExpressionOperator expressionOperator = (ExpressionOperator) operatorStack - .pop(); - - if (!(expressionOperator.getOperator() instanceof OpenParenthesesOperator)) { - throw new EvaluationException("Expression is invalid."); - } - - // Process the unary operator if we have one. - if (expressionOperator.getUnaryOperator() != null) { - Object operand = operandStack.pop(); - - ExpressionTree tree = new ExpressionTree(this, operand, null, - null, expressionOperator.getUnaryOperator()); - - operandStack.push(tree); - } - } else { - // Process non-param operator. - if (operatorStack.size() > 0) { - ExpressionOperator stackOperator = (ExpressionOperator) operatorStack - .peek(); - - while (stackOperator != null - && stackOperator.getOperator().getPrecedence() >= operator - .getPrecedence()) { - processTree(operandStack, operatorStack); - - if (operatorStack.size() > 0) { - stackOperator = (ExpressionOperator) operatorStack - .peek(); - } else { - stackOperator = null; - } - } - } - - ExpressionOperator expressionOperator = new ExpressionOperator( - operator, unaryOperator); - - operatorStack.push(expressionOperator); - } - - final int rtnCtr = operatorIndex + operator.getLength(); - - return rtnCtr; - } - - /** - * Processes the unary operator that has been found in the expression. - * - * @param operatorIndex - * The position in the expression where the current operator - * being processed is located. - * @param operator - * The operator being processed. - * - * @return The new position in the expression where processing should - * continue. - */ - private int processUnaryOperator(final int operatorIndex, - final Operator operator) { - - final int rtnCtr = operatorIndex + operator.getSymbol().length(); - - return rtnCtr; - } - - /** - * Processes the function that has been found in the expression. - * - * @param expression - * The expression being evaluated. - * @param operatorIndex - * The position in the expression where the current operator - * being processed is located. - * @param operandStack - * The stack of operands. - * @param operatorStack - * The stack of operators. - * @param operator - * The current operator being processed. - * @param unaryOperator - * The unary operator associated with this function. This can be - * null. - * - * @return The next operator in the expression. This should be the closed - * parentheses operator. - * - * @exception EvaluateException - * Thrown is an error is encoutnered while processing the - * expression. - */ - private NextOperator processFunction(final String expression, - final int operatorIndex, final Stack operandStack) - throws EvaluationException { - - int parenthesisCount = 1; - NextOperator nextOperator = null; - int nextOperatorIndex = operatorIndex; - - // Loop until we find the function's closing parentheses. - while (parenthesisCount > 0) { - nextOperator = getNextOperator(expression, nextOperatorIndex + 1, - null); - - if (nextOperator == null) { - throw new EvaluationException("Function is not closed."); - } else if (nextOperator.getOperator() instanceof OpenParenthesesOperator) { - parenthesisCount++; - } else if (nextOperator.getOperator() instanceof ClosedParenthesesOperator) { - parenthesisCount--; - } - - // Get the next operator index. - nextOperatorIndex = nextOperator.getIndex(); - } - - // Get the function argument. - String arguments = expression.substring(operatorIndex + 1, - nextOperatorIndex); - - // Pop the function name from the stack. - final ExpressionOperand operand = (ExpressionOperand) operandStack - .pop(); - final Operator unaryOperator = operand.getUnaryOperator(); - final String functionName = operand.getValue(); - - // Validate that the function name is valid. - try { - isValidName(functionName); - } catch (IllegalArgumentException iae) { - throw new EvaluationException("Invalid function name of \"" - + functionName + "\".", iae); - } - - // Get the function object. - final Function function = (Function) functions.get(functionName); - - if (function == null) { - throw new EvaluationException("A function is not defined (index=" - + operatorIndex + ")."); - } - - final ParsedFunction parsedFunction = new ParsedFunction(function, - arguments, unaryOperator); - operandStack.push(parsedFunction); - - return nextOperator; - } - - /** - * Processes an expresssion tree that has been parsed into an operand stack - * and oeprator stack. - * - * @param operandStack - * The stack of operands. - * @param operatorStack - * The stack of operators. - */ - private void processTree(final Stack operandStack, final Stack operatorStack) { - - Object rightOperand = null; - Object leftOperand = null; - Operator operator = null; - - // Get the right operand node from the tree. - if (operandStack.size() > 0) { - rightOperand = operandStack.pop(); - } - - // Get the left operand node from the tree. - if (operandStack.size() > 0) { - leftOperand = operandStack.pop(); - } - - // Get the operator node from the tree. - operator = ((ExpressionOperator) operatorStack.pop()).getOperator(); - - // Build an expressin tree from the nodes. - final ExpressionTree tree = new ExpressionTree(this, leftOperand, - rightOperand, operator, null); - - // Push the tree onto the stack. - operandStack.push(tree); - } - - /** - * Returns the final result of the evaluated expression. - * - * @param operatorStack - * The stack of operators. - * @param operandStack - * The stack of operands. - * @param wrapStringFunctionResults - * Indicates if the results from functions that return strings - * should be wrapped in quotes. The quote character used will be - * whatever is the current quote character for this object. - * - * @return The final result of the evaluated expression. - * - * @exception EvaluateException - * Thrown is an error is encoutnered while processing the - * expression. - */ - private String getResult(final Stack operatorStack, - final Stack operandStack, final boolean wrapStringFunctionResults) - throws EvaluationException { - - // The result to return. - String resultString = null; - - // Process the rest of the operators left on the stack. - while (operatorStack.size() > 0) { - processTree(operandStack, operatorStack); - } - - // At this point only one operand should be left on the tree. - // It may be a tree operand that contains other tree and/or - // other operands. - if (operandStack.size() != 1) { - throw new EvaluationException("Expression is invalid."); - } - - final Object finalOperand = operandStack.pop(); - - // Check if the final operand is a tree. - if (finalOperand instanceof ExpressionTree) { - // Get the final result. - resultString = ((ExpressionTree) finalOperand) - .evaluate(wrapStringFunctionResults); - } - // Check if the final operand is an operand. - else if (finalOperand instanceof ExpressionOperand) { - ExpressionOperand resultExpressionOperand = (ExpressionOperand) finalOperand; - - resultString = ((ExpressionOperand) finalOperand).getValue(); - resultString = replaceVariables(resultString); - - // Check if the operand is a string or not. If it not a string, - // then it must be a number. - if (!isExpressionString(resultString)) { - Double resultDouble = null; - try { - resultDouble = new Double(resultString); - } catch (Exception e) { - throw new EvaluationException("Expression is invalid.", e); - } - - // Process a unary operator if one exists. - if (resultExpressionOperand.getUnaryOperator() != null) { - resultDouble = new Double(resultExpressionOperand - .getUnaryOperator().evaluate( - resultDouble.doubleValue())); - } - - // Get the final result. - resultString = resultDouble.toString(); - } else { - if (resultExpressionOperand.getUnaryOperator() != null) { - throw new EvaluationException("Invalid operand for " - + "unary operator."); - } - } - } else if (finalOperand instanceof ParsedFunction) { - final ParsedFunction parsedFunction = (ParsedFunction) finalOperand; - final Function function = parsedFunction.getFunction(); - String arguments = parsedFunction.getArguments(); - - if (processNestedFunctions) { - arguments = processNestedFunctions(arguments); - } - - arguments = replaceVariables(arguments); - - // Get the final result. - try { - FunctionResult functionResult = - function.execute(this, arguments); - resultString = functionResult.getResult(); - - if (functionResult.getType() == - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC) { - - Double resultDouble = new Double(resultString); - - // Process a unary operator if one exists. - if (parsedFunction.getUnaryOperator() != null) { - resultDouble = new Double(parsedFunction - .getUnaryOperator().evaluate( - resultDouble.doubleValue())); - } - - // Get the final result. - resultString = resultDouble.toString(); - } - else if (functionResult.getType() == - FunctionConstants.FUNCTION_RESULT_TYPE_STRING) { - - // The result must be a string result. - if (wrapStringFunctionResults) { - resultString = quoteCharacter + resultString - + quoteCharacter; - } - - if (parsedFunction.getUnaryOperator() != null) { - throw new EvaluationException("Invalid operand for " - + "unary operator."); - } - } - } catch (FunctionException fe) { - throw new EvaluationException(fe.getMessage(), fe); - } - } else { - throw new EvaluationException("Expression is invalid."); - } - - return resultString; - } - - /** - * Returns the next operator in the expression. - * - * @param expression - * The expression being evaluated. - * @param start - * The position in the expression to start searching for the next - * operator. - * @param match - * The operator to search for. This can be null if you want the - * very next operator. If it is not null, it searches until it - * finds the match. - * - * @return The next operator in the expression. Returns null if no next - * operator is returned. - */ - private NextOperator getNextOperator(final String expression, - final int start, final Operator match) { - - final int numChars = expression.length(); - int numQuoteCharacters = 0; - - for (int charCtr = start; charCtr < numChars; charCtr++) { - // Keep track of open strings. - if (expression.charAt(charCtr) == quoteCharacter) { - numQuoteCharacters++; - } - - // Do not look into open strings. - if ((numQuoteCharacters % 2) == 1) { - continue; - } - - // Assumes the operators are installed in order of length. - final int numOperators = operators.size(); - for (int operatorCtr = 0; operatorCtr < numOperators; operatorCtr++) { - Operator operator = (Operator) operators.get(operatorCtr); - - if (match != null) { - // Look through the operators until we find the - // one we are searching for. - if (!match.equals(operator)) { - continue; - } - } - - // The operator can 1 or 2 characters in length. - if (operator.getLength() == 2) { - int endCtr = -1; - if (charCtr + 2 <= expression.length()) { - endCtr = charCtr + 2; - } else { - endCtr = expression.length(); - } - - // Look for a match. - if (expression.substring(charCtr, endCtr).equals( - operator.getSymbol())) { - NextOperator nextOperator = new NextOperator(operator, - charCtr); - - return nextOperator; - } - } else { - // Look for a match. - if (expression.charAt(charCtr) == operator.getSymbol() - .charAt(0)) { - NextOperator nextOperator = new NextOperator(operator, - charCtr); - - return nextOperator; - } - } - } - } - - return null; - } - - /** - * Determines if the string represents a valid expression string or not. - * Valid expression strings must start and end with a quote character. - * - * @param expressionString - * The string being evaluated. - * - * @return True if the string is a valid string and false if not. - */ - protected boolean isExpressionString(final String expressionString) - throws EvaluationException { - - if (expressionString.length() > 1 - && expressionString.charAt(0) == quoteCharacter - && expressionString.charAt(expressionString.length() - 1) == quoteCharacter) { - return true; - } - - if (expressionString.indexOf(quoteCharacter) >= 0) { - throw new EvaluationException("Invalid use of quotes."); - } - - return false; - } - - /** - * This method verifies if a function or variable name is valid or not. - * - * Function and variable names must follow these rules... - *
    - *
  • can not start with a number
  • - *
  • can not contain an operator (see the above list of operators)
  • - *
  • can not contain a quote character - single or double
  • - *
  • can not contain a brace character - open or closed
  • - *
  • can not contain one of the following special characters: #, ~ , ^ !
  • - *
      - * - * @param name - * The function or variable name being validated. - * - * @exception IllegalArgumentException - * Thrown if the name is invalid. - */ - public void isValidName(final String name) throws IllegalArgumentException { - - if (name.length() == 0) { - throw new IllegalArgumentException("Variable is empty."); - } - - // Check if name starts with a number. - final char firstChar = name.charAt(0); -// if (firstChar >= '0' && firstChar <= '9') { -// throw new IllegalArgumentException("A variable or function name " -// + "can not start with a number."); -// } - - // Check if name contains with a quote character. - if (name.indexOf(EvaluationConstants.SINGLE_QUOTE) > -1) { - throw new IllegalArgumentException("A variable or function name " - + "can not contain a quote character."); - } else if (name.indexOf(EvaluationConstants.DOUBLE_QUOTE) > -1) { - throw new IllegalArgumentException("A variable or function name " - + "can not contain a quote character."); - } - - // Check if name contains with a brace character. - if (name.indexOf(EvaluationConstants.OPEN_BRACE) > -1) { - throw new IllegalArgumentException("A variable or function name " - + "can not contain an open brace character."); - } else if (name.indexOf(EvaluationConstants.CLOSED_BRACE) > -1) { - throw new IllegalArgumentException("A variable or function name " - + "can not contain a closed brace character."); - } else if (name.indexOf(EvaluationConstants.POUND_SIGN) > -1) { - throw new IllegalArgumentException("A variable or function name " - + "can not contain a pound sign character."); - } - - // Check if name contains an operator character. - final Iterator operatorIterator = operators.iterator(); - - while (operatorIterator.hasNext()) { - final Operator operator = (Operator) operatorIterator.next(); - - if (name.indexOf(operator.getSymbol()) > -1) { - throw new IllegalArgumentException( - "A variable or function name " - + "can not contain an operator symbol."); - } - } - - // Check if name contains other special characters. - if (name.indexOf("!") > -1) { - throw new IllegalArgumentException("A variable or function name " - + "can not contain a special character."); - } else if (name.indexOf("~") > -1) { - throw new IllegalArgumentException("A variable or function name " - + "can not contain a special character."); - } else if (name.indexOf("^") > -1) { - throw new IllegalArgumentException("A variable or function name " - + "can not contain a special character."); - } else if (name.indexOf(",") > -1) { - throw new IllegalArgumentException("A variable or function name " - + "can not contain a special character."); - } - } - - /** - * This method loads the system functions is necessary. - */ - private void loadSystemFunctions() { - // Install the math functions. - if (loadMathFunctions) { - final FunctionGroup mathFunctions = new MathFunctions(); - - mathFunctions.load(this); - } - - // Install the string functions. - if (loadStringFunctions) { - final FunctionGroup stringFunctions = new StringFunctions(); - - stringFunctions.load(this); - } - } - - /** - * This method loads the system variables is necessary. - */ - private void loadSystemVariables() { - // Install the math variables. - if (loadMathVariables) { - // Add the two math variables. - putVariable("E", new Double(Math.E).toString()); - putVariable("PI", new Double(Math.PI).toString()); - } - } - - /** - * Replaces the variables in the expression with the values of the variables - * for this instance of the evaluator. - * - * @param expression - * The expression being processed. - * - * @return A new expression with the variables replaced with their values. - * - * @exception EvaluateException - * Thrown is an error is encoutnered while processing the - * expression. - */ - public String replaceVariables(final String expression) - throws EvaluationException { - - int openIndex = expression.indexOf(EvaluationConstants.OPEN_VARIABLE); - - if (openIndex < 0) { - return expression; - } - - String replacedExpression = expression; - - while (openIndex >= 0) { - - int closedIndex = -1; - if (openIndex >= 0) { - - closedIndex = replacedExpression.indexOf( - EvaluationConstants.CLOSED_VARIABLE, openIndex + 1); - if (closedIndex > openIndex) { - - String variableName = replacedExpression.substring( - openIndex - + EvaluationConstants.OPEN_VARIABLE - .length(), closedIndex); - - // Validate that the variable name is valid. - try { - isValidName(variableName); - } catch (IllegalArgumentException iae) { - throw new EvaluationException("Invalid variable name of \"" - + variableName + "\".", iae); - } - - String variableValue = getVariableValue(variableName); - - String variableString = EvaluationConstants.OPEN_VARIABLE - + variableName - + EvaluationConstants.CLOSED_VARIABLE; - - replacedExpression = EvaluationHelper.replaceAll( - replacedExpression, variableString, variableValue); - } else { - - break; - } - } - - // Start looking at the beginning of the string, since - // the length string has changed and characters have moved - // positions. - openIndex = replacedExpression.indexOf( - EvaluationConstants.OPEN_VARIABLE); - } - - // If an open brace is left over, then a variable could not be replaced. - int openBraceIndex = replacedExpression - .indexOf(EvaluationConstants.OPEN_VARIABLE); - if (openBraceIndex > -1) { - throw new EvaluationException( - "A variable has not been closed (index=" + openBraceIndex - + ")."); - } - - return replacedExpression; - } - - /** - * This method process nested function calls that may be in the arguments - * passed into a higher level function. - * - * @param arguments The arguments to process. - * - * @return The arguments with any nested function calls evaluated. - * - * @throws EvaluationException Thrown if an error occurs. - */ - protected String processNestedFunctions(final String arguments) - throws EvaluationException { - - StringBuffer evaluatedArguments = new StringBuffer(); - - // Process nested function calls. - if (arguments.length() > 0) { - - Evaluator argumentsEvaluator = new Evaluator(quoteCharacter, - loadMathVariables, loadMathFunctions, loadStringFunctions, - processNestedFunctions); - argumentsEvaluator.setFunctions(getFunctions()); - argumentsEvaluator.setVariables(getVariables()); - argumentsEvaluator.setVariableResolver(getVariableResolver()); - - final ArgumentTokenizer tokenizer = new ArgumentTokenizer( - arguments, EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR); - - List evalautedArgumentList = new ArrayList(); - while (tokenizer.hasMoreTokens()) { - - String argument = tokenizer.nextToken().trim(); - - try { - argument = argumentsEvaluator.evaluate(argument); - } catch (Exception e) { - throw new EvaluationException(e.getMessage(), e); - } - - evalautedArgumentList.add(argument); - } - - Iterator evaluatedArgumentIterator = evalautedArgumentList - .iterator(); - - while (evaluatedArgumentIterator.hasNext()) { - - if (evaluatedArguments.length() > 0) { - - evaluatedArguments - .append(EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR); - } - - String evaluatedArgument = (String) evaluatedArgumentIterator - .next(); - evaluatedArguments.append(evaluatedArgument); - } - } - - return evaluatedArguments.toString(); - } - - /** - * Returns the value used during construction of this object to specify if - * math variables should be loaded. - * - * @return the loadMathVariables - */ - public boolean isLoadMathVariables() { - return loadMathVariables; - } - - /** - * Returns the value used during construction of this object to specify if - * math functions should be loaded. - * - * @return the loadMathFunctions - */ - public boolean getLoadMathFunctions() { - return loadMathFunctions; - } - - /** - * Returns the value used during construction of this object to specify if - * string functions should be loaded. - * - * @return the loadStringFunctions - */ - public boolean getLoadStringFunctions() { - return loadStringFunctions; - } - - /** - * Returns the value used during construction of this object to specify if - * nested functions should be processed. - * - * @return the processNestedFunctions - */ - public boolean getProcessNestedFunctions() { - return processNestedFunctions; - } - - public String getPreviousExpression() { - return previousExpression; - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/ExpressionOperand.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/ExpressionOperand.java deleted file mode 100644 index 69289f1..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/ExpressionOperand.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval; - -import com.baoying.enginex.executor.util.jeval.operator.Operator; - -/** - * Represents an operand being processed in the expression. - */ -public class ExpressionOperand { - - // The value of the operand. - private String value = null; - - // The unary operator for the operand, if one exists. - private Operator unaryOperator = null; - - /** - * Create a new ExpressionOperand. - * - * @param value - * The value for the new ExpressionOperand. - * @param unaryOperator - * The unary operator for this object. - */ - public ExpressionOperand(final String value, final Operator unaryOperator) { - this.value = value; - this.unaryOperator = unaryOperator; - } - - /** - * Returns the value of this object. - * - * @return The value of this object. - */ - public String getValue() { - return value; - } - - /** - * Returns the unary operator for this object. - * - * @return The unary operator for this object. - */ - public Operator getUnaryOperator() { - return unaryOperator; - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/ExpressionOperator.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/ExpressionOperator.java deleted file mode 100644 index 275a978..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/ExpressionOperator.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval; - -import com.baoying.enginex.executor.util.jeval.operator.Operator; - -/** - * Represents an operator being processed in the expression. - */ -public class ExpressionOperator { - - // The operator that this object represents. - private Operator operator = null; - - // The unary operator for this object, if there is one. - private Operator unaryOperator = null; - - /** - * Creates a new ExpressionOperator. - * - * @param operator - * The operator this object represents. - * @param unaryOperator - * The unary operator for this object. - */ - public ExpressionOperator(final Operator operator, - final Operator unaryOperator) { - this.operator = operator; - this.unaryOperator = unaryOperator; - } - - /** - * Returns the operator for this object. - * - * @return The operator for this object. - */ - public Operator getOperator() { - return operator; - } - - /** - * Returns the unary operator for this object. - * - * @return The unary operator for this object. - */ - public Operator getUnaryOperator() { - return unaryOperator; - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/ExpressionTree.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/ExpressionTree.java deleted file mode 100644 index c29df68..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/ExpressionTree.java +++ /dev/null @@ -1,368 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval; - -import com.baoying.enginex.executor.util.jeval.function.Function; -import com.baoying.enginex.executor.util.jeval.function.FunctionConstants; -import com.baoying.enginex.executor.util.jeval.function.FunctionException; -import com.baoying.enginex.executor.util.jeval.function.FunctionResult; -import com.baoying.enginex.executor.util.jeval.operator.Operator; - -/** - * Represents an expression tree made up of a left operand, right operand, - * operator and unary operator. - */ -public class ExpressionTree { - - // The left node in the tree. - private Object leftOperand = null; - - // The right node in the tree. - private Object rightOperand = null; - - // The operator for the two operands. - private Operator operator = null; - - // The unary operator, if one exists. - private Operator unaryOperator = null; - - // The Evaluator object processing this tree. - private Evaluator evaluator = null; - - /** - * Creates a new ExpressionTree. - * - * @param evaluator - * The Evaluator object processing this tree. - * @param leftOperand - * The left operand to place as the left node of the tree. - * @param rightOperand - * The right operand to place as the right node of the tree. - * @param operator - * The operator to place as the operator node of the tree. - * @param unaryOperator - * The new unary operator for this tree. - */ - public ExpressionTree(final Evaluator evaluator, final Object leftOperand, - final Object rightOperand, final Operator operator, - final Operator unaryOperator) { - - this.evaluator = evaluator; - this.leftOperand = leftOperand; - this.rightOperand = rightOperand; - this.operator = operator; - this.unaryOperator = unaryOperator; - } - - /** - * Returns the left operand of this tree. - * - * @return The left operand of this tree. - */ - public Object getLeftOperand() { - return leftOperand; - } - - /** - * Returns the right operand of this tree. - * - * @return The right operand of this tree. - */ - public Object getRightOperand() { - return rightOperand; - } - - /** - * Returns the operator for this tree. - * - * @return The operator of this tree. - */ - public Operator getOperator() { - return operator; - } - - /** - * Returns the unary operator for this tree. - * - * @return The unary operator of this tree. - */ - public Operator getUnaryOperator() { - return unaryOperator; - } - - /** - * Evaluates the operands for this tree using the operator and the unary - * operator. - * - * @param wrapStringFunctionResults - * Indicates if the results from functions that return strings - * should be wrapped in quotes. The quote character used will be - * whatever is the current quote character for this object. - * - * @exception EvaluateException - * Thrown is an error is encountered while processing the - * expression. - */ - public String evaluate(final boolean wrapStringFunctionResults) - throws EvaluationException { - - String rtnResult = null; - - // Get the left operand. - String leftResultString = null; - Double leftResultDouble = null; - - if (leftOperand instanceof ExpressionTree) { - leftResultString = ((ExpressionTree) leftOperand) - .evaluate(wrapStringFunctionResults); - - try { - leftResultDouble = new Double(leftResultString); - leftResultString = null; - } catch (NumberFormatException exception) { - leftResultDouble = null; - } - } else if (leftOperand instanceof ExpressionOperand) { - - final ExpressionOperand leftExpressionOperand = (ExpressionOperand) leftOperand; - - leftResultString = leftExpressionOperand.getValue(); - leftResultString = evaluator.replaceVariables(leftResultString); - - // Check if the operand is a string or not. If it not a string, - // then it must be a number. - if (!evaluator.isExpressionString(leftResultString)) { - try { - leftResultDouble = new Double(leftResultString); - leftResultString = null; - } catch (NumberFormatException nfe) { - throw new EvaluationException("Expression is invalid.", nfe); - } - - if (leftExpressionOperand.getUnaryOperator() != null) { - leftResultDouble = new Double(leftExpressionOperand - .getUnaryOperator().evaluate( - leftResultDouble.doubleValue())); - } - } else { - if (leftExpressionOperand.getUnaryOperator() != null) { - throw new EvaluationException("Invalid operand for " - + "unary operator."); - } - } - } else if (leftOperand instanceof ParsedFunction) { - - final ParsedFunction parsedFunction = (ParsedFunction) leftOperand; - final Function function = parsedFunction.getFunction(); - String arguments = parsedFunction.getArguments(); - arguments = evaluator.replaceVariables(arguments); - - if (evaluator.getProcessNestedFunctions()) { - arguments = evaluator.processNestedFunctions(arguments); - } - - try { - FunctionResult functionResult = - function.execute(evaluator, arguments); - leftResultString = functionResult.getResult(); - - if (functionResult.getType() == - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC) { - - Double resultDouble = new Double(leftResultString); - - // Process a unary operator if one exists. - if (parsedFunction.getUnaryOperator() != null) { - resultDouble = new Double(parsedFunction - .getUnaryOperator().evaluate( - resultDouble.doubleValue())); - } - - // Get the final result. - leftResultString = resultDouble.toString(); - } - else if (functionResult.getType() == - FunctionConstants.FUNCTION_RESULT_TYPE_STRING) { - - // The result must be a string result. - if (wrapStringFunctionResults) { - leftResultString = evaluator.getQuoteCharacter() - + leftResultString - + evaluator.getQuoteCharacter(); - } - - if (parsedFunction.getUnaryOperator() != null) { - throw new EvaluationException("Invalid operand for " - + "unary operator."); - } - } - } catch (FunctionException fe) { - throw new EvaluationException(fe.getMessage(), fe); - } - - if (!evaluator.isExpressionString(leftResultString)) { - try { - leftResultDouble = new Double(leftResultString); - leftResultString = null; - } catch (NumberFormatException nfe) { - throw new EvaluationException("Expression is invalid.", nfe); - } - } - } else { - if (leftOperand != null) { - throw new EvaluationException("Expression is invalid."); - } - } - - // Get the right operand. - String rightResultString = null; - Double rightResultDouble = null; - - if (rightOperand instanceof ExpressionTree) { - rightResultString = ((ExpressionTree) rightOperand) - .evaluate(wrapStringFunctionResults); - - try { - rightResultDouble = new Double(rightResultString); - rightResultString = null; - } catch (NumberFormatException exception) { - rightResultDouble = null; - } - - } else if (rightOperand instanceof ExpressionOperand) { - - final ExpressionOperand rightExpressionOperand = (ExpressionOperand) rightOperand; - rightResultString = ((ExpressionOperand) rightOperand).getValue(); - rightResultString = evaluator.replaceVariables(rightResultString); - - // Check if the operand is a string or not. If it not a string, - // then it must be a number. - if (!evaluator.isExpressionString(rightResultString)) { - try { - rightResultDouble = new Double(rightResultString); - rightResultString = null; - } catch (NumberFormatException nfe) { - throw new EvaluationException("Expression is invalid.", nfe); - } - - if (rightExpressionOperand.getUnaryOperator() != null) { - rightResultDouble = new Double(rightExpressionOperand - .getUnaryOperator().evaluate( - rightResultDouble.doubleValue())); - } - } else { - if (rightExpressionOperand.getUnaryOperator() != null) { - throw new EvaluationException("Invalid operand for " - + "unary operator."); - } - } - } else if (rightOperand instanceof ParsedFunction) { - - final ParsedFunction parsedFunction = (ParsedFunction) rightOperand; - final Function function = parsedFunction.getFunction(); - String arguments = parsedFunction.getArguments(); - arguments = evaluator.replaceVariables(arguments); - - if (evaluator.getProcessNestedFunctions()) { - arguments = evaluator.processNestedFunctions(arguments); - } - - try { - FunctionResult functionResult = - function.execute(evaluator, arguments); - rightResultString = functionResult.getResult(); - - if (functionResult.getType() == - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC) { - - Double resultDouble = new Double(rightResultString); - - // Process a unary operator if one exists. - if (parsedFunction.getUnaryOperator() != null) { - resultDouble = new Double(parsedFunction - .getUnaryOperator().evaluate( - resultDouble.doubleValue())); - } - - // Get the final result. - rightResultString = resultDouble.toString(); - } - else if (functionResult.getType() == - FunctionConstants.FUNCTION_RESULT_TYPE_STRING) { - - // The result must be a string result. - if (wrapStringFunctionResults) { - rightResultString = evaluator.getQuoteCharacter() - + rightResultString - + evaluator.getQuoteCharacter(); - } - - if (parsedFunction.getUnaryOperator() != null) { - throw new EvaluationException("Invalid operand for " - + "unary operator."); - } - } - } catch (FunctionException fe) { - throw new EvaluationException(fe.getMessage(), fe); - } - - if (!evaluator.isExpressionString(rightResultString)) { - try { - rightResultDouble = new Double(rightResultString); - rightResultString = null; - } catch (NumberFormatException nfe) { - throw new EvaluationException("Expression is invalid.", nfe); - } - } - } else if (rightOperand == null) { - // Do nothing. - } else { - throw new EvaluationException("Expression is invalid."); - } - - // Evaluate the the expression. - if (leftResultDouble != null && rightResultDouble != null) { - double doubleResult = operator.evaluate(leftResultDouble - .doubleValue(), rightResultDouble.doubleValue()); - - if (getUnaryOperator() != null) { - doubleResult = getUnaryOperator().evaluate(doubleResult); - } - - rtnResult = new Double(doubleResult).toString(); - } else if (leftResultString != null && rightResultString != null) { - rtnResult = operator.evaluate(leftResultString, rightResultString); - } else if (leftResultDouble != null && rightResultDouble == null) { - double doubleResult = -1; - - if (unaryOperator != null) { - doubleResult = unaryOperator.evaluate(leftResultDouble - .doubleValue()); - } else { - // Do not allow numeric (left) and - // string (right) to be evaluated together. - throw new EvaluationException("Expression is invalid."); - } - - rtnResult = new Double(doubleResult).toString(); - } else { - throw new EvaluationException("Expression is invalid."); - } - - return rtnResult; - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/NextOperator.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/NextOperator.java deleted file mode 100644 index 87547d7..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/NextOperator.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval; - -import com.baoying.enginex.executor.util.jeval.operator.Operator; - -/** - * Represents the next operator in the expression to process. - */ -class NextOperator { - - // The operator this object represetns. - private Operator operator = null; - - // The index of the operator in the expression. - private int index = -1; - - /** - * Create a new NextOperator from an operator and index. - * - * @param operator - * The operator this object represents. - * @param index - * The index of the operator in the expression. - */ - public NextOperator(final Operator operator, final int index) { - this.operator = operator; - this.index = index; - } - - /** - * Returns the operator for this object. - * - * @return The operator represented by this object. - */ - public Operator getOperator() { - return operator; - } - - /** - * Returns the index for this object. - * - * @return The index of the operator in the expression. - */ - public int getIndex() { - return index; - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/ParsedFunction.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/ParsedFunction.java deleted file mode 100644 index dd4b433..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/ParsedFunction.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval; - -import com.baoying.enginex.executor.util.jeval.function.Function; -import com.baoying.enginex.executor.util.jeval.operator.Operator; - -/** - * This class represents a function that has been parsed. - */ -public class ParsedFunction { - - // The function that has been parsed. - // FIXME Make all class instance methods final if possible. - private final Function function; - - // The arguments to the function. - private final String arguments; - - // The unary operator for this object, if there is one. - private final Operator unaryOperator; - - /** - * The constructor for this class. - * - * @param function - * The function that has been parsed. - * @param arguments - * The arguments to the function. - * @param unaryOperator - * The unary operator for this object, if there is one. - */ - public ParsedFunction(final Function function, final String arguments, - final Operator unaryOperator) { - - this.function = function; - this.arguments = arguments; - this.unaryOperator = unaryOperator; - } - - /** - * Returns the function that has been parsed. - * - * @return The function that has been parsed. - */ - public Function getFunction() { - return function; - } - - /** - * Returns the arguments to the function. - * - * @return The arguments to the function. - */ - public String getArguments() { - return arguments; - } - - /** - * Returns the unary operator for this object, if there is one. - * - * @return The unary operator for this object, if there is one. - */ - public Operator getUnaryOperator() { - return unaryOperator; - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/VariableResolver.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/VariableResolver.java deleted file mode 100644 index 6ac8ce3..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/VariableResolver.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.baoying.enginex.executor.util.jeval; - -import com.baoying.enginex.executor.util.jeval.function.FunctionException; - -/** - * This interface can be implement with a custom resolver and set onto the - * Evaluator class. It will then be used to resolve variables when they are - * replaced in an expression as it gets evaluated. Varaibles resolved by the - * resolved will override any varibles that exist in the variable map of an - * Evaluator instance. - */ -public interface VariableResolver { - - /** - * Returns a variable value for the specified variable name. - * - * @param variableName - * The name of the variable to return the variable value for. - * - * @return A variable value for the specified variable name. If the variable - * name can not be resolved, then null should be returned. - * - * @throws Can throw a FunctionException if needed. - */ - public String resolveVariable(String variableName) throws FunctionException; -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/Function.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/Function.java deleted file mode 100644 index 5150299..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/Function.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function; - -import com.baoying.enginex.executor.util.jeval.Evaluator; - -/** - * A function that can be specified in an expression. - */ -public interface Function { - - /** - * Returns the name of the function. - * - * @return The name of this function class. - */ - public String getName(); - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * The arguments that will be evaluated by the function. It is up - * to the function implementation to break the string into one or - * more arguments. - * - * @return The value of the evaluated argument and its type. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(Evaluator evaluator, String arguments) - throws FunctionException; -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/FunctionConstants.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/FunctionConstants.java deleted file mode 100644 index 4512b00..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/FunctionConstants.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function; - -/** - * Contains constants used by classes in this package. - */ -public class FunctionConstants { - - /** - * Indicates that the function result is a numeric or Boolean value. - */ - public static final int FUNCTION_RESULT_TYPE_NUMERIC = 0; - - /** - * Indicates that the function result is a string value. - */ - public static final int FUNCTION_RESULT_TYPE_STRING = 1; -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/FunctionException.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/FunctionException.java deleted file mode 100644 index 9fc83cb..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/FunctionException.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function; - -/** - * This exception is thrown when an error occurs while processing a function. - */ -public class FunctionException extends Exception { - - private static final long serialVersionUID = 4767250768467137620L; - - /** - * This constructor takes a custom message as input. - * - * @param message - * A custom message for the exception to display. - */ - public FunctionException(String message) { - super(message); - } - - /** - * This constructor takes an exception as input. - * - * @param exception - * An exception. - */ - public FunctionException(Exception exception) { - super(exception); - } - - /** - * This constructor takes an exception as input. - * - * @param message - * A custom message for the exception to display. - * @param exception - * An exception. - */ - public FunctionException(String message, Exception exception) { - super(message, exception); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/FunctionGroup.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/FunctionGroup.java deleted file mode 100644 index 96db715..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/FunctionGroup.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function; - -import com.baoying.enginex.executor.util.jeval.Evaluator; -import java.util.List; - -/** - * A groups of functions that can loaded at one time into an instance of - * Evaluator. - */ -public interface FunctionGroup { - /** - * Returns the name of the function group. - * - * @return The name of this function group class. - */ - public String getName(); - - /** - * Returns a list of the functions that are loaded by this class. - * - * @return A list of the functions loaded by this class. - */ - public List getFunctions(); - - /** - * Loads the functions in this function group into an instance of Evaluator. - * - * @param evaluator - * An instance of Evaluator to load the functions into. - */ - public void load(Evaluator evaluator); - - /** - * Unloads the functions in this function group from an instance of - * Evaluator. - * - * @param evaluator - * An instance of Evaluator to unload the functions from. - */ - public void unload(Evaluator evaluator); -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/FunctionHelper.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/FunctionHelper.java deleted file mode 100644 index 6aa8d4d..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/FunctionHelper.java +++ /dev/null @@ -1,284 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function; - -import com.baoying.enginex.executor.util.jeval.ArgumentTokenizer; - -import java.util.ArrayList; - -/** - * This class contains many methods that are helpful when writing functions. - * Some of these methods were created to help with the creation of the math and - * string functions packaged with Evaluator. - */ -public class FunctionHelper { - - /** - * This method first removes any white space at the beginning and end of the - * input string. It then removes the specified quote character from the the - * first and last characters of the string if a quote character exists in - * those positions. If quote characters are not in the first and last - * positions after the white space is trimmed, then a FunctionException will - * be thrown. - * - * @param arguments - * The arguments to trim and revove quote characters from. - * @param quoteCharacter - * The character to remove from the first and last position of - * the trimmed string. - * - * @return The arguments with white space and quote characters removed. - * - * @exception FunctionException - * Thrown if quote characters do not exist in the first and - * last positions after the white space is trimmed. - */ - public static String trimAndRemoveQuoteChars(final String arguments, - final char quoteCharacter) throws FunctionException { - - String trimmedArgument = arguments; - - trimmedArgument = trimmedArgument.trim(); - - if (trimmedArgument.charAt(0) == quoteCharacter) { - trimmedArgument = trimmedArgument.substring(1, trimmedArgument - .length()); - } else { - throw new FunctionException("Value does not start with a quote."); - } - - if (trimmedArgument.charAt(trimmedArgument.length() - 1) == quoteCharacter) { - trimmedArgument = trimmedArgument.substring(0, trimmedArgument - .length() - 1); - } else { - throw new FunctionException("Value does not end with a quote."); - } - - return trimmedArgument; - } - - /** - * This methods takes a string of input function arguments, evaluates each - * argument and creates a Double value for each argument from the result of - * the evaluations. - * - * @param arguments - * The arguments to parse. - * @param delimiter - * The delimiter to use while parsing. - * - * @return An array list of Double values found in the input string. - * - * @exception FunctionException - * Thrown if the string does not properly parse into Double - * values. - */ - public static ArrayList getDoubles(final String arguments, - final char delimiter) throws FunctionException { - - ArrayList returnValues = new ArrayList(); - - try { - - final ArgumentTokenizer tokenizer = new ArgumentTokenizer( - arguments, delimiter); - - while (tokenizer.hasMoreTokens()) { - final String token = tokenizer.nextToken().trim(); - returnValues.add(new Double(token)); - } - } catch (Exception e) { - throw new FunctionException("Invalid values in string.", e); - } - - return returnValues; - } - - /** - * This methods takes a string of input function arguments, evaluates each - * argument and creates a String value for each argument from the result of - * the evaluations. - * - * @param arguments - * The arguments of values to parse. - * @param delimiter - * The delimiter to use while parsing. - * - * @return An array list of String values found in the input string. - * - * @exception FunctionException - * Thrown if the stirng does not properly parse into String - * values. - */ - public static ArrayList getStrings(final String arguments, - final char delimiter) throws FunctionException { - - final ArrayList returnValues = new ArrayList(); - - try { - ArgumentTokenizer tokenizer = new ArgumentTokenizer(arguments, - delimiter); - - while (tokenizer.hasMoreTokens()) { - final String token = tokenizer.nextToken(); - returnValues.add(token); - } - } catch (Exception e) { - throw new FunctionException("Invalid values in string.", e); - } - - return returnValues; - } - - /** - * This methods takes a string of input function arguments, evaluates each - * argument and creates a one Integer and one String value for each argument - * from the result of the evaluations. - * - * @param arguments - * The arguments of values to parse. - * @param delimiter - * The delimiter to use while parsing. - * - * @return An array list of object values found in the input string. - * - * @exception FunctionException - * Thrown if the stirng does not properly parse into the - * proper objects. - */ - public static ArrayList getOneStringAndOneInteger(final String arguments, - final char delimiter) throws FunctionException { - - ArrayList returnValues = new ArrayList(); - - try { - final ArgumentTokenizer tokenizer = new ArgumentTokenizer( - arguments, delimiter); - - int tokenCtr = 0; - while (tokenizer.hasMoreTokens()) { - if (tokenCtr == 0) { - final String token = tokenizer.nextToken(); - returnValues.add(token); - } else if (tokenCtr == 1) { - final String token = tokenizer.nextToken().trim(); - returnValues.add(new Integer(new Double(token).intValue())); - } else { - throw new FunctionException("Invalid values in string."); - } - - tokenCtr++; - } - } catch (Exception e) { - throw new FunctionException("Invalid values in string.", e); - } - - return returnValues; - } - - /** - * This methods takes a string of input function arguments, evaluates each - * argument and creates a two Strings and one Integer value for each - * argument from the result of the evaluations. - * - * @param arguments - * The arguments of values to parse. - * @param delimiter - * The delimiter to use while parsing. - * - * @return An array list of object values found in the input string. - * - * @exception FunctionException - * Thrown if the stirng does not properly parse into the - * proper objects. - */ - public static ArrayList getTwoStringsAndOneInteger(final String arguments, - final char delimiter) throws FunctionException { - - final ArrayList returnValues = new ArrayList(); - - try { - final ArgumentTokenizer tokenizer = new ArgumentTokenizer( - arguments, delimiter); - - int tokenCtr = 0; - while (tokenizer.hasMoreTokens()) { - if (tokenCtr == 0 || tokenCtr == 1) { - final String token = tokenizer.nextToken(); - returnValues.add(token); - } else if (tokenCtr == 2) { - final String token = tokenizer.nextToken().trim(); - returnValues.add(new Integer(new Double(token).intValue())); - } else { - throw new FunctionException("Invalid values in string."); - } - - tokenCtr++; - } - } catch (Exception e) { - throw new FunctionException("Invalid values in string.", e); - } - - return returnValues; - } - - /** - * This methods takes a string of input function arguments, evaluates each - * argument and creates a one String and two Integers value for each - * argument from the result of the evaluations. - * - * @param arguments - * The arguments of values to parse. - * @param delimiter - * The delimiter to use while parsing. - * - * @return An array list of object values found in the input string. - * - * @exception FunctionException - * Thrown if the stirng does not properly parse into the - * proper objects. - */ - public static ArrayList getOneStringAndTwoIntegers(final String arguments, - final char delimiter) throws FunctionException { - - final ArrayList returnValues = new ArrayList(); - - try { - final ArgumentTokenizer tokenizer = new ArgumentTokenizer( - arguments, delimiter); - - int tokenCtr = 0; - while (tokenizer.hasMoreTokens()) { - if (tokenCtr == 0) { - final String token = tokenizer.nextToken().trim(); - returnValues.add(token); - } else if (tokenCtr == 1 || tokenCtr == 2) { - final String token = tokenizer.nextToken().trim(); - returnValues.add(new Integer(new Double(token).intValue())); - } else { - throw new FunctionException("Invalid values in string."); - } - - tokenCtr++; - } - } catch (Exception e) { - throw new FunctionException("Invalid values in string.", e); - } - - return returnValues; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/FunctionResult.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/FunctionResult.java deleted file mode 100644 index 59ad1f9..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/FunctionResult.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function; - -/** - * This is a wrapper for the result value returned from a function that not only - * contains the result, but the type. All custom functions must return a - * FunctionResult. - */ -public class FunctionResult { - - // The value returned from a function call. - private String result; - - // The type of the result. Can be a numberic or string. Boolean values come - // back as numeric values. - private int type; - - /** - * Constructor. - * - * @param result - * The result value. - * @param type - * The result type. - * - * @throws FunctionException - * Thrown if result type is invalid. - */ - public FunctionResult(String result, int type) throws FunctionException { - - if (type < FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC - || type > FunctionConstants.FUNCTION_RESULT_TYPE_STRING) { - - throw new FunctionException("Invalid function result type."); - } - - this.result = result; - this.type = type; - } - - /** - * Returns the result value. - * - * @return The result value. - */ - public String getResult() { - return result; - } - - /** - * Returns the result type. - * - * @return The result type. - */ - public int getType() { - return type; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Abs.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Abs.java deleted file mode 100644 index 595fc5c..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Abs.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.Function; -import com.baoying.enginex.executor.util.jeval.function.FunctionConstants; -import com.baoying.enginex.executor.util.jeval.function.FunctionException; -import com.baoying.enginex.executor.util.jeval.function.FunctionResult; - -/** - * This class is a function that executes within Evaluator. The function returns - * the absolute value of a double value. See the Math.abs(double) method in the - * JDK for a complete description of how this function works. - */ -public class Abs implements Function { - /** - * Returns the name of the function - "abs". - * - * @return The name of this function class. - */ - public String getName() { - return "abs"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted to a double value and - * evaluated. - * - * @return The absolute value of the argument. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - Double result = null; - Double number = null; - - try { - number = new Double(arguments); - } catch (Exception e) { - throw new FunctionException("Invalid argument.", e); - } - - result = new Double(Math.abs(number.doubleValue())); - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } - -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Acos.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Acos.java deleted file mode 100644 index c57f8cf..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Acos.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.Function; -import com.baoying.enginex.executor.util.jeval.function.FunctionConstants; -import com.baoying.enginex.executor.util.jeval.function.FunctionException; -import com.baoying.enginex.executor.util.jeval.function.FunctionResult; - -/** - * This class is a function that executes within Evaluator. The function returns - * the arc cosine of an angle. See the Math.ceil(double) method in the JDK for a - * complete description of how this function works. - */ -public class Acos implements Function { - /** - * Returns the name of the function - "acos". - * - * @return The name of this function class. - */ - public String getName() { - return "acos"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted to a double value and - * evaluated. - * - * @return The arc cosine value of the argument. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - Double result = null; - Double number = null; - - try { - number = new Double(arguments); - } catch (Exception e) { - throw new FunctionException("Invalid argument.", e); - } - - result = new Double(Math.acos(number.doubleValue())); - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Asin.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Asin.java deleted file mode 100644 index 8d610e1..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Asin.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.Function; -import com.baoying.enginex.executor.util.jeval.function.FunctionConstants; -import com.baoying.enginex.executor.util.jeval.function.FunctionException; -import com.baoying.enginex.executor.util.jeval.function.FunctionResult; - -/** - * This class is a function that executes within Evaluator. The function returns - * the arc sine of an angle See the Math.asin(double) method in the JDK for a - * complete description of how this function works. - */ -public class Asin implements Function { - /** - * Returns the name of the function - "asin". - * - * @return The name of this function class. - */ - public String getName() { - return "asin"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted to a double value and - * evaluated. - * - * @return The arc sine of the argument. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - Double result = null; - Double number = null; - - try { - number = new Double(arguments); - } catch (Exception e) { - throw new FunctionException("Invalid argument.", e); - } - - result = new Double(Math.asin(number.doubleValue())); - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } - -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Atan.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Atan.java deleted file mode 100644 index 360dbc8..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Atan.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.Function; -import com.baoying.enginex.executor.util.jeval.function.FunctionConstants; -import com.baoying.enginex.executor.util.jeval.function.FunctionException; -import com.baoying.enginex.executor.util.jeval.function.FunctionResult; - -/** - * This class is a function that executes within Evaluator. The function returns - * the arc tangent of an angle. See the Math.atan(double) method in the JDK for - * a complete description of how this function works. - */ -public class Atan implements Function { - /** - * Returns the name of the function - "atan". - * - * @return The name of this function class. - */ - public String getName() { - return "atan"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted to a double value and - * evaluated. - * - * @return The arc tangent of the argument. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - Double result = null; - Double number = null; - - try { - number = new Double(arguments); - } catch (Exception e) { - throw new FunctionException("Invalid argument.", e); - } - - result = new Double(Math.atan(number.doubleValue())); - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Atan2.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Atan2.java deleted file mode 100644 index a5d677d..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Atan2.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.*; - -import java.util.ArrayList; - -/** - * This class is a function that executes within Evaluator. The function - * converts rectangular coordinates to polar. See the Math.atan2(double, double) - * method in the JDK for a complete description of how this function works. - */ -public class Atan2 implements Function { - /** - * Returns the name of the function - "atan2". - * - * @return The name of this function class. - */ - public String getName() { - return "atan2"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted into two double - * values and evaluated. - * - * @return The arc tangent2 value of the argument. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - Double result = null; - - ArrayList numbers = FunctionHelper.getDoubles(arguments, - EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR); - - if (numbers.size() != 2) { - throw new FunctionException("Two numeric arguments are required."); - } - - try { - double argumentOne = ((Double) numbers.get(0)).doubleValue(); - double argumentTwo = ((Double) numbers.get(1)).doubleValue(); - result = new Double(Math.atan2(argumentOne, argumentTwo)); - } catch (Exception e) { - throw new FunctionException("Two numeric arguments are required.", e); - } - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Average.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Average.java deleted file mode 100644 index 657f219..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Average.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.*; - -import java.math.BigDecimal; -import java.util.ArrayList; - - -/** - * 计算多个数字的平均值 - * @author sunyk - * - */ -public class Average implements Function { - - @Override - public String getName() { - return "avg"; - } - - @Override - public FunctionResult execute(Evaluator evaluator, String arguments) - throws FunctionException { - Double result = null; - - ArrayList numbers = FunctionHelper.getDoubles(arguments, - EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR); - - int count = numbers.size() ; - if (count < 2) { - throw new FunctionException("Two numeric arguments are required at least."); - } - - double sum=0; - for (Double num : numbers) { - //为什么使用这样的方法,而不直接相加呢? - //原因是Java中的简单浮点数类型float和double不能够进行运算,会出现类似如下情况 - //eg:sum(1,2,3,1.2,2.0,3.6)=12.79999999999而不等于12.8 - BigDecimal b1=new BigDecimal(Double.toString(sum)); - BigDecimal b2=new BigDecimal(Double.toString(num)); - sum=b1.add(b2).doubleValue(); - } - - result = new Double(sum/count); - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Ceil.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Ceil.java deleted file mode 100644 index 20afe35..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Ceil.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.Function; -import com.baoying.enginex.executor.util.jeval.function.FunctionConstants; -import com.baoying.enginex.executor.util.jeval.function.FunctionException; -import com.baoying.enginex.executor.util.jeval.function.FunctionResult; - -/** - * This class is a function that executes within Evaluator. The function returns - * the ceiling value of a double value. See the Math.ceil(double) method in the - * JDK for a complete description of how this function works. - */ -public class Ceil implements Function { - /** - * Returns the name of the function - "ceil". - * - * @return The name of this function class. - */ - public String getName() { - return "ceil"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted to a double value and - * evaluated. - * - * @return The ceiling of the argument. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - Double result = null; - Double number = null; - - try { - number = new Double(arguments); - } catch (Exception e) { - throw new FunctionException("Invalid argument.", e); - } - - result = new Double(Math.ceil(number.doubleValue())); - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Cos.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Cos.java deleted file mode 100644 index 743a7b9..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Cos.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.Function; -import com.baoying.enginex.executor.util.jeval.function.FunctionConstants; -import com.baoying.enginex.executor.util.jeval.function.FunctionException; -import com.baoying.enginex.executor.util.jeval.function.FunctionResult; - -/** - * This class is a function that executes within Evaluator. The function returns - * the trigonometric cosine of an angle. See the Math.cos(double) method in the - * JDK for a complete description of how this function works. - */ -public class Cos implements Function { - /** - * Returns the name of the function - "cos". - * - * @return The name of this function class. - */ - public String getName() { - return "cos"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted to a double value and - * evaluated. - * - * @return The cosine of the argument. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - Double result = null; - Double number = null; - - try { - number = new Double(arguments); - } catch (Exception e) { - throw new FunctionException("Invalid argument.", e); - } - - result = new Double(Math.cos(number.doubleValue())); - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Exp.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Exp.java deleted file mode 100644 index 9002ced..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Exp.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.Function; -import com.baoying.enginex.executor.util.jeval.function.FunctionConstants; -import com.baoying.enginex.executor.util.jeval.function.FunctionException; -import com.baoying.enginex.executor.util.jeval.function.FunctionResult; - -/** - * This class is a function that executes within Evaluator. The function returns - * the exponential number e (i.e., 2.718...) raised to the power of a double - * value. See the Math.exp(double) method in the JDK for a complete description - * of how this function works. - */ -public class Exp implements Function { - /** - * Returns the name of the function - "exp". - * - * @return The name of this function class. - */ - public String getName() { - return "exp"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted to a double value and - * evaluated. - * - * @return The the value e to the argument power, where e is the base of the - * natural logarithms - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - Double result = null; - Double number = null; - - try { - number = new Double(arguments); - } catch (Exception e) { - throw new FunctionException("Invalid argument.", e); - } - - result = new Double(Math.exp(number.doubleValue())); - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Floor.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Floor.java deleted file mode 100644 index 7b92197..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Floor.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.Function; -import com.baoying.enginex.executor.util.jeval.function.FunctionConstants; -import com.baoying.enginex.executor.util.jeval.function.FunctionException; -import com.baoying.enginex.executor.util.jeval.function.FunctionResult; - -/** - * This class is a function that executes within Evaluator. The function returns - * the floor value of a double value. See the Math.floor(double) method in the - * JDK for a complete description of how this function works. - */ -public class Floor implements Function { - /** - * Returns the name of the function - "floor". - * - * @return The name of this function class. - */ - public String getName() { - return "floor"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted to a double value and - * evaluated. - * - * @return The floor of the argument. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - Double result = null; - Double number = null; - - try { - number = new Double(arguments); - } catch (Exception e) { - throw new FunctionException("Invalid argument.", e); - } - - result = new Double(Math.floor(number.doubleValue())); - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Groovy.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Groovy.java deleted file mode 100644 index 9b5341e..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Groovy.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.baoying.enginex.executor.util.MD5; -import com.baoying.enginex.executor.util.jeval.EvaluationException; -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.Function; -import com.baoying.enginex.executor.util.jeval.function.FunctionException; -import com.baoying.enginex.executor.util.jeval.function.FunctionResult; -import com.github.benmanes.caffeine.cache.Cache; -import com.github.benmanes.caffeine.cache.Caffeine; -import com.mysql.cj.xdevapi.JsonArray; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import javax.script.Invocable; -import javax.script.ScriptEngine; -import javax.script.ScriptEngineManager; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -/** - * This class is a function that executes within Evaluator. The function returns - * the ceiling value of a double value. See the Math.ceil(double) method in the - * JDK for a complete description of how this function works. - */ -@Component -public class Groovy implements Function { - - private static final Logger logger = LoggerFactory.getLogger(Groovy.class); - - private static final ScriptEngineManager factory = new ScriptEngineManager(); - - public static String GROOVY_SHELL_KEY_PREFIX = "GROOVY_SHELL#"; - -// private RedisManager redisManager; - - private static Cache scriptClassCache = Caffeine.newBuilder() - .expireAfterWrite(1, TimeUnit.HOURS) - .expireAfterAccess(1, TimeUnit.HOURS) - .build(); - - /** - * Returns the name of the function - "def main". - * - * @return The name of this function class. - */ - public String getName() { - return "def main"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted to a double value and - * evaluated. - * - * @return The ceiling of the argument. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - return null; - } - -// public String execute(final String expression, Map data) throws EvaluationException { -// String result = null; -// try { -// ScriptEngine scriptEngine = null; -// String scriptMd5 = PYTHON_SHELL_KEY_PREFIX + MD5.GetMD5Code(expression); -// ScriptEngine value = (ScriptEngine) SerializeUtils.deserialize(redisManager.get(scriptMd5.getBytes())); -// if(value != null){ -// scriptEngine = value; -// } else { -// scriptEngine = factory.getEngineByName("groovy"); -// scriptEngine.eval(expression); -// redisManager.set(scriptMd5.getBytes(), SerializeUtils.serialize(scriptEngine), 120); -// } -// -// Object functionResult = ((Invocable) scriptEngine).invokeFunction("main", data); -// result = functionResult.toString(); -// } catch (Exception e) { -// throw new EvaluationException("执行groovy脚本出错", e); -// } -// return result; -// } - - public String execute(final String expression, Map data) throws EvaluationException { - String result = null; - try { - ScriptEngine scriptEngine = null; - String scriptMd5 = GROOVY_SHELL_KEY_PREFIX + MD5.GetMD5Code(expression); - ScriptEngine value = scriptClassCache.getIfPresent(scriptMd5); - if(value != null){ - scriptEngine = value; - } else { - scriptEngine = factory.getEngineByName("groovy"); - scriptEngine.eval(expression); - scriptClassCache.put(scriptMd5, scriptEngine); - } - - Object functionResult = ((Invocable) scriptEngine).invokeFunction("main", data); - if (functionResult!=null){ - result = functionResult.toString(); - } -// result = functionResult.toString(); - } catch (Exception e) { - throw new EvaluationException("执行groovy脚本出错", e); - } - return result; - } - @Autowired - private Python python; - public Object executeForObject(final String expression, Map data) throws EvaluationException { - Object result = null; - try { - ScriptEngine scriptEngine = null; - String scriptMd5 = GROOVY_SHELL_KEY_PREFIX + MD5.GetMD5Code(expression); - ScriptEngine value = scriptClassCache.getIfPresent(scriptMd5); - if(value != null){ - scriptEngine = value; - } else { - scriptEngine = factory.getEngineByName("groovy"); - scriptEngine.eval(expression); - scriptClassCache.put(scriptMd5, scriptEngine); - } - - Object functionResult = ((Invocable) scriptEngine).invokeFunction("main", data); - if (functionResult!=null){ -// if (functionResult instanceof HashMap||functionResult instanceof ArrayList){ -// result = JSON.toJSONString(functionResult); -// }else -// if (functionResult instanceof String){ -// result = functionResult.toString(); -// }else { -// result = functionResult; -// } - result = functionResult; - } - } catch (Exception e) { - throw new EvaluationException("执行groovy脚本出错", e); - } - return result; - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/IEEEremainder.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/IEEEremainder.java deleted file mode 100644 index 78fb2dd..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/IEEEremainder.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.*; - -import java.util.ArrayList; - -/** - * This class is a function that executes within Evaluator. The function returns - * the remainder operation on two arguments as prescribed by the IEEE 754 - * standard. See the Math.IEEERemainder(double, double) method in the JDK for a - * complete description of how this function works. - */ -public class IEEEremainder implements Function { - /** - * Returns the name of the function - "IEEEremainder". - * - * @return The name of this function class. - */ - public String getName() { - return "IEEEremainder"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted into two double - * values and evaluated. - * - * @return The the remainder operation on two arguments as prescribed by the - * IEEE 754 standard. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - Double result = null; - - ArrayList numbers = FunctionHelper.getDoubles(arguments, - EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR); - - if (numbers.size() != 2) { - throw new FunctionException("Two numeric arguments are required."); - } - - try { - double argumentOne = ((Double) numbers.get(0)).doubleValue(); - double argumentTwo = ((Double) numbers.get(1)).doubleValue(); - result = new Double(Math.IEEEremainder(argumentOne, argumentTwo)); - } catch (Exception e) { - throw new FunctionException("Two numeric arguments are required.", e); - } - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Ln.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Ln.java deleted file mode 100644 index f5ba912..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Ln.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.Function; -import com.baoying.enginex.executor.util.jeval.function.FunctionConstants; -import com.baoying.enginex.executor.util.jeval.function.FunctionException; -import com.baoying.enginex.executor.util.jeval.function.FunctionResult; - -/** - * log以e为底的对数 - * - * @author Administrator - * - */ -public class Ln implements Function { - - @Override - public String getName() { - return "ln"; - } - - @Override - public FunctionResult execute(Evaluator evaluator, String arguments) - throws FunctionException { - Double result = null; - Double number = null; - - try { - number = new Double(arguments); - } catch (Exception e) { - throw new FunctionException("Invalid argument.", e); - } - - result = new Double(Math.log(number)/Math.log(Math.E)); - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Log.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Log.java deleted file mode 100644 index 1b4e6ce..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Log.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.Function; -import com.baoying.enginex.executor.util.jeval.function.FunctionConstants; -import com.baoying.enginex.executor.util.jeval.function.FunctionException; -import com.baoying.enginex.executor.util.jeval.function.FunctionResult; - -/** - * This class is a function that executes within Evaluator. The function returns - * the natural logarithm (base e) of a double value. See the Math.log(double) - * method in the JDK for a complete description of how this function works. - */ -public class Log implements Function { - /** - * Returns the name of the function - "log". - * - * @return The name of this function class. - */ - public String getName() { - return "log"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted to a double value and - * evaluated. - * - * @return The natural logarithm of the argument. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - Double result = null; - Double number = null; - - try { - number = new Double(arguments); - } catch (Exception e) { - throw new FunctionException("Invalid argument.", e); - } - - result = new Double(Math.log(number.doubleValue())); - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/MathFunctions.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/MathFunctions.java deleted file mode 100644 index f3aac2d..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/MathFunctions.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.Function; -import com.baoying.enginex.executor.util.jeval.function.FunctionGroup; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -/** - * A groups of functions that can loaded at one time into an instance of - * Evaluator. This group contains all of the functions located in the - * net.sourceforge.jeval.function.math package. - */ -public class MathFunctions implements FunctionGroup { - /** - * Used to store instances of all of the functions loaded by this class. - */ - private List functions = new ArrayList(); - - /** - * Default contructor for this class. The functions loaded by this class are - * instantiated in this constructor. - */ - public MathFunctions() { - functions.add(new Abs()); - functions.add(new Acos()); - functions.add(new Asin()); - functions.add(new Atan()); - functions.add(new Atan2()); - functions.add(new Ceil()); - functions.add(new Cos()); - functions.add(new Exp()); - functions.add(new Floor()); - functions.add(new IEEEremainder()); - functions.add(new Log()); - functions.add(new Pow()); - functions.add(new Random()); - functions.add(new Rint()); - functions.add(new Round()); - functions.add(new Sin()); - functions.add(new Sqrt()); - functions.add(new Tan()); - functions.add(new ToDegrees()); - functions.add(new ToRadians()); - functions.add(new Max()); - functions.add(new Min()); - functions.add(new Sum()); - functions.add(new Ln()); - functions.add(new Average()); - functions.add(new Groovy()); - } - - /** - * Returns the name of the function group - "numberFunctions". - * - * @return The name of this function group class. - */ - public String getName() { - return "numberFunctions"; - } - - /** - * Returns a list of the functions that are loaded by this class. - * - * @return A list of the functions loaded by this class. - */ - public List getFunctions() { - return functions; - } - - /** - * Loads the functions in this function group into an instance of Evaluator. - * - * @param evaluator - * An instance of Evaluator to load the functions into. - */ - public void load(final Evaluator evaluator) { - Iterator functionIterator = functions.iterator(); - - while (functionIterator.hasNext()) { - evaluator.putFunction((Function) functionIterator.next()); - } - } - - /** - * Unloads the functions in this function group from an instance of - * Evaluator. - * - * @param evaluator - * An instance of Evaluator to unload the functions from. - */ - public void unload(final Evaluator evaluator) { - Iterator functionIterator = functions.iterator(); - - while (functionIterator.hasNext()) { - evaluator.removeFunction(((Function) functionIterator.next()) - .getName()); - } - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Max.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Max.java deleted file mode 100644 index 02a0b72..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Max.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.*; - -import java.util.ArrayList; -import java.util.Collections; - -/** - * 获取多个值得最大值 - * @author sunyk - * - */ -public class Max implements Function { - - @Override - public FunctionResult execute(Evaluator evaluator, String arguments) - throws FunctionException { - Double result = null; - - ArrayList numbers = FunctionHelper.getDoubles(arguments, - EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR); - - int count = numbers.size() ; - if (count < 2) { - throw new FunctionException("Two numeric arguments are required at least."); - } - - result = (Double)Collections.max(numbers); - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } - - @Override - public String getName() { - return "max"; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Min.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Min.java deleted file mode 100644 index 3f9ba55..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Min.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.*; - -import java.util.ArrayList; -import java.util.Collections; - -/** - * 获取多个值最小值 - * @author sunyk - * - */ -public class Min implements Function { - - @Override - public FunctionResult execute(Evaluator evaluator, String arguments) - throws FunctionException { - Double result = null; - - ArrayList numbers = FunctionHelper.getDoubles(arguments, - EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR); - - int count = numbers.size() ; - if (count < 2) { - throw new FunctionException("Two numeric arguments are required at least."); - } - - result = (Double)Collections.min(numbers); - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } - - @Override - public String getName() { - return "min"; - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Pow.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Pow.java deleted file mode 100644 index 369f939..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Pow.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.*; - -import java.util.ArrayList; - -/** - * This class is a function that executes within Evaluator. The function returns - * the value of the first argument raised to the second power of the second - * argument. See the Math.pow(double, double) method in the JDK for a complete - * description of how this function works. - */ -public class Pow implements Function { - /** - * Returns the name of the function - "pow". - * - * @return The name of this function class. - */ - public String getName() { - return "pow"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted into two double - * values and evaluated. - * - * @return The value of the first argument raised to the second power of the - * second argument. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - Double result = null; - - ArrayList numbers = FunctionHelper.getDoubles(arguments, - EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR); - - if (numbers.size() != 2) { - throw new FunctionException("Two numeric arguments are required."); - } - - try { - double argumentOne = ((Double) numbers.get(0)).doubleValue(); - double argumentTwo = ((Double) numbers.get(1)).doubleValue(); - result = new Double(Math.pow(argumentOne, argumentTwo)); - } catch (Exception e) { - throw new FunctionException("Two numeric arguments are required.", e); - } - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Python.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Python.java deleted file mode 100644 index 093592c..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Python.java +++ /dev/null @@ -1,183 +0,0 @@ -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.baoying.enginex.executor.util.MD5; -import com.baoying.enginex.executor.util.jeval.EvaluationException; -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.Function; -import com.baoying.enginex.executor.util.jeval.function.FunctionException; -import com.baoying.enginex.executor.util.jeval.function.FunctionResult; -import com.github.benmanes.caffeine.cache.Cache; -import com.github.benmanes.caffeine.cache.Caffeine; -import org.apache.hadoop.hbase.shaded.org.apache.avro.data.Json; -import org.python.core.*; -import org.python.util.PythonInterpreter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - -import javax.script.Invocable; -import javax.script.ScriptEngine; -import javax.script.ScriptEngineManager; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.nio.charset.Charset; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; -import java.util.concurrent.TimeUnit; - -@Component -public class Python implements Function { - - private static final Logger logger = LoggerFactory.getLogger(Groovy.class); - - private static final ScriptEngineManager factory = new ScriptEngineManager(); - - public static String PYTHON_SHELL_KEY_PREFIX = "JYTHON_SHELL#"; - - private static Cache scriptClassCache = Caffeine.newBuilder() - .expireAfterWrite(1, TimeUnit.HOURS) - .expireAfterAccess(1, TimeUnit.HOURS) - .build(); - /** - * Returns the name of the function - "def main". - * - * @return The name of this function class. - */ - @Override - public String getName() { - return "if __name__ == \"__main__\":"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted to a double value and - * evaluated. - * - * @return The ceiling of the argument. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - @Override - public FunctionResult execute(Evaluator evaluator, String arguments) throws FunctionException { - return null; - } - - public Object executeForObject(final String expression, Map data) throws EvaluationException { - Object result = null; - try { - ScriptEngine scriptEngine = null; - String scriptMd5 = PYTHON_SHELL_KEY_PREFIX + MD5.GetMD5Code(expression); - ScriptEngine value = scriptClassCache.getIfPresent(scriptMd5); - Object functionResult = null; - - if(value != null){ - scriptEngine = value; - } else { - scriptEngine = factory.getEngineByName("python"); - scriptEngine.eval(expression); - scriptClassCache.put(scriptMd5, scriptEngine); - } - PyDictionary pyDictionary = new PyDictionary(); - for (Map.Entry entry : data.entrySet()) { - pyDictionary.put(entry.getKey(),entry.getValue()); - } - -// PythonInterpreter interpreter = new PythonInterpreter(); -// interpreter.exec(new String(expression.getBytes())); -// PyFunction python_main = interpreter.get("python_main", PyFunction.class); -// PyObject pyObject = python_main.__call__(pyDictionary); -// System.out.println(pyObject); -// String ret = pyObject.toString(); -// String newStr = new String(ret.getBytes("iso8859-1"), "utf-8"); //通过new String(ret.getBytes("iso8859-1"), "utf-8")转一下就好了 -// System.out.println(newStr); //newStr就不会乱码了 -// System.out.println(getEncode(String.valueOf(pyObject))); - functionResult = ((Invocable) scriptEngine).invokeFunction("python_main", pyDictionary); - if (functionResult instanceof PyDictionary){ - PyObject resultPy = (PyObject)functionResult; - String ret = resultPy.toString();//这里ret可能会乱码 - System.out.println(ret); - } - result = functionResult; - } catch (Exception e) { - e.printStackTrace(); - throw new EvaluationException("执行Python脚本出错", e); - } - return result; - } - // 这里可以提供更多地编码格式,另外由于部分编码格式是一致的所以会返回 第一个匹配的编码格式 GBK 和 GB2312 - public static final String[] encodes = new String[] { "UTF-8", "GBK", "GB2312", "ISO-8859-1", "ISO-8859-2" }; - - /** - * 获取字符串编码格式 - * - * @param str - * @return - */ - public static String getEncode(String str) { - byte[] data = str.getBytes(); - byte[] b = null; - a:for (int i = 0; i < encodes.length; i++) { - try { - b = str.getBytes(encodes[i]); - if (b.length!=data.length) - continue; - for (int j = 0; j < b.length; j++) { - if (b[j] != data[j]) { - continue a; - } - } - return encodes[i]; - } catch (UnsupportedEncodingException e) { - continue; - } - } - return null; - } - - public static void main(String[] args) throws IOException { -// Properties props = new Properties(); -//// props.put("python.home", "F:\\Java\\jython\\jython2.7.1\\Lib"); -// props.put("python.console.encoding", "UTF-8"); -// props.put("python.security.respectJavaAccessibility", "false"); -// props.put("python.import.site", "false"); -// Properties preprops = System.getProperties(); -// PythonInterpreter.initialize(preprops, props, new String[0]); -// PythonInterpreter interpreter = new PythonInterpreter(); -// interpreter.exec("#coding=UTF-8 \n" + -// "print('a智障v')"); -// interpreter.execfile("E:\\python\\迭代求阶乘.py"); - - -// PythonInterpreter interpreter = new PythonInterpreter(); -// interpreter.exec("# -*- encoding: utf-8 -*- \na='智障'; "); -// interpreter.exec("print a;"); -// interpreter.exec("print '智障';"); -// String s = "python \ndef python_main(_):\n" + -// " # result 为返回结果其中内部字段解释为:ruleScore(规则命中时得分),hitResult规则是否命中可选值为:命中/未命中\n" + -// " # fieldList 为输出字段列表,内部为字典表,updateInputMap 为需要更新到入参的变量是一个字典表\n" + -// "\n" + -// " result = {\"ruleScore\":0,\"hitResult\":\"未命中\",\"fieldList\":[],\"updateInputMap\":{}}\n" + -// " print(_)\n" + -// " print(\"未命中\")\n" + -// " result[\"ruleScore\"] = 420\n" + -// " result[\"hitResult\"] = \"命中\"\n" + -// " return result\n" + -// "\n" + -// "if __name__ == \"__main__\":\n" + -// " python_main(params)"; -// String[] param = new String[2]; -// param[0] = "python3"; -// param[1] = s; -// Runtime.getRuntime().exec(s); - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Random.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Random.java deleted file mode 100644 index c1facd7..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Random.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.Function; -import com.baoying.enginex.executor.util.jeval.function.FunctionConstants; -import com.baoying.enginex.executor.util.jeval.function.FunctionException; -import com.baoying.enginex.executor.util.jeval.function.FunctionResult; - -/** - * This class is a function that executes within Evaluator. The function returns - * a random double value greater than or equal to 0.0 and less than 1.0. See the - * Math.random() method in the JDK for a complete description of how this - * function works. - */ -public class Random implements Function { - /** - * Returns the name of the function - "random". - * - * @return The name of this function class. - */ - public String getName() { - return "random"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * Not used. - * - * @return A random double value greater than or equal to 0.0 and less than - * 1.0. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - Double result = new Double(Math.random()); - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Rint.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Rint.java deleted file mode 100644 index ce74086..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Rint.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.Function; -import com.baoying.enginex.executor.util.jeval.function.FunctionConstants; -import com.baoying.enginex.executor.util.jeval.function.FunctionException; -import com.baoying.enginex.executor.util.jeval.function.FunctionResult; - -/** - * This class is a function that executes within Evaluator. The function returns - * the double value that is closest in value to the argument and is equal to a - * mathematical integer. See the Math.rint(double) method in the JDK for a - * complete description of how this function works. - */ -public class Rint implements Function { - /** - * Returns the name of the function - "rint". - * - * @return The name of this function class. - */ - public String getName() { - return "rint"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted to a double value and - * evaluated. - * - * @return A double value that is closest in value to the argument and is - * equal to a mathematical integer. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - Double result = null; - Double number = null; - - try { - number = new Double(arguments); - } catch (Exception e) { - throw new FunctionException("Invalid argument.", e); - } - - result = new Double(Math.rint(number.doubleValue())); - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Round.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Round.java deleted file mode 100644 index b3e7768..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Round.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.Function; -import com.baoying.enginex.executor.util.jeval.function.FunctionConstants; -import com.baoying.enginex.executor.util.jeval.function.FunctionException; -import com.baoying.enginex.executor.util.jeval.function.FunctionResult; - -/** - * This class is a function that executes within Evaluator. The function returns - * the closet long to a double value. See the Math.round(double) method in the - * JDK for a complete description of how this function works. - */ -public class Round implements Function { - /** - * Returns the name of the function - "round". - * - * @return The name of this function class. - */ - public String getName() { - return "round"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted to a double value and - * evaluated. - * - * @return A long value that is closest to the argument. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - Long result = null; - Double number = null; - - try { - number = new Double(arguments); - } catch (Exception e) { - throw new FunctionException("Invalid argument.", e); - } - - result = new Long(Math.round(number.doubleValue())); - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Sin.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Sin.java deleted file mode 100644 index 026368e..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Sin.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.Function; -import com.baoying.enginex.executor.util.jeval.function.FunctionConstants; -import com.baoying.enginex.executor.util.jeval.function.FunctionException; -import com.baoying.enginex.executor.util.jeval.function.FunctionResult; - -/** - * This class is a function that executes within Evaluator. The function returns - * the sine of an angle. See the Math.sin(double) method in the JDK for a - * complete description of how this function works. - */ -public class Sin implements Function { - /** - * Returns the name of the function - "sin". - * - * @return The name of this function class. - */ - public String getName() { - return "sin"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted to a double value and - * evaluated. - * - * @return The sine of the argument. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - Double result = null; - Double number = null; - - try { - number = new Double(arguments); - } catch (Exception e) { - throw new FunctionException("Invalid argument.", e); - } - - result = new Double(Math.sin(number.doubleValue())); - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Sqrt.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Sqrt.java deleted file mode 100644 index 1fb0089..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Sqrt.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.Function; -import com.baoying.enginex.executor.util.jeval.function.FunctionConstants; -import com.baoying.enginex.executor.util.jeval.function.FunctionException; -import com.baoying.enginex.executor.util.jeval.function.FunctionResult; - -/** - * This class is a function that executes within Evaluator. The function returns - * a square root of a double value. See the Math.sqrt(double) method in the JDK - * for a complete description of how this function works. - */ -public class Sqrt implements Function { - /** - * Returns the name of the function - "sqrt". - * - * @return The name of this function class. - */ - public String getName() { - return "sqrt"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted to a double value and - * evaluated. - * - * @return A square root of the argument. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - Double result = null; - Double number = null; - - try { - number = new Double(arguments); - } catch (Exception e) { - throw new FunctionException("Invalid argument.", e); - } - - result = new Double(Math.sqrt(number.doubleValue())); - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Sum.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Sum.java deleted file mode 100644 index 36bf40c..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Sum.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.*; - -import java.math.BigDecimal; -import java.util.ArrayList; - -/** - * 计算多个数字的和 - * @author sunyk - * - */ -public class Sum implements Function { - - @Override - public String getName() { - return "sum"; - } - - @Override - public FunctionResult execute(Evaluator evaluator, String arguments) - throws FunctionException { - Double result = null; - - ArrayList numbers = FunctionHelper.getDoubles(arguments, - EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR); - - int count = numbers.size() ; - if (count < 2) { - throw new FunctionException("Two numeric arguments are required at least."); - } - - double sum=0; - for (Double num : numbers) { - //为什么使用这样的方法,而不直接相加呢? - //原因是Java中的简单浮点数类型float和double不能够进行运算,会出现类似如下情况 - //eg:sum(1,2,3,1.2,2.0,3.6)=12.79999999999而不等于12.8 - BigDecimal b1=new BigDecimal(Double.toString(sum)); - BigDecimal b2=new BigDecimal(Double.toString(num)); - sum=b1.add(b2).doubleValue(); - } - result = new Double(sum); - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } - -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Tan.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Tan.java deleted file mode 100644 index a5d1716..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/Tan.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.Function; -import com.baoying.enginex.executor.util.jeval.function.FunctionConstants; -import com.baoying.enginex.executor.util.jeval.function.FunctionException; -import com.baoying.enginex.executor.util.jeval.function.FunctionResult; - -/** - * This class is a function that executes within Evaluator. The function returns - * trigonometric tangent of an angle. See the Math.tan(double) method in the JDK - * for a complete description of how this function works. - */ -public class Tan implements Function { - /** - * Returns the name of the function - "tan". - * - * @return The name of this function class. - */ - public String getName() { - return "tan"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted to a double value and - * evaluated. - * - * @return A trigonometric tangent of an angle. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(Evaluator evaluator, String arguments) - throws FunctionException { - Double result = null; - Double number = null; - - try { - number = new Double(arguments); - } catch (Exception e) { - throw new FunctionException("Invalid argument.", e); - } - - result = new Double(Math.tan(number.doubleValue())); - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/ToDegrees.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/ToDegrees.java deleted file mode 100644 index 71191ba..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/ToDegrees.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.Function; -import com.baoying.enginex.executor.util.jeval.function.FunctionConstants; -import com.baoying.enginex.executor.util.jeval.function.FunctionException; -import com.baoying.enginex.executor.util.jeval.function.FunctionResult; - -/** - * This class is a function that executes within Evaluator. The function - * converts an angle measured in radians to the equivalent angle measured in - * degrees. See the Math.toDegrees(double) method in the JDK for a complete - * description of how this function works. - */ -public class ToDegrees implements Function { - /** - * Returns the name of the function - "toDegrees". - * - * @return The name of this function class. - */ - public String getName() { - return "toDegrees"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted to a double value and - * evaluated. - * - * @return A measurement of the argument in degrees. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(Evaluator evaluator, String arguments) - throws FunctionException { - Double result = null; - Double number = null; - - try { - number = new Double(arguments); - } catch (Exception e) { - throw new FunctionException("Invalid argument.", e); - } - - result = new Double(Math.toDegrees(number.doubleValue())); - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/ToRadians.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/ToRadians.java deleted file mode 100644 index 1beb88e..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/math/ToRadians.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.math; - -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.Function; -import com.baoying.enginex.executor.util.jeval.function.FunctionConstants; -import com.baoying.enginex.executor.util.jeval.function.FunctionException; -import com.baoying.enginex.executor.util.jeval.function.FunctionResult; - -/** - * This class is a function that executes within Evaluator. The function - * converts an angle measured in degress to the equivalent angle measured in - * radians. See the Math.toRadians(double) method in the JDK for a complete - * description of how this function works. - */ -public class ToRadians implements Function { - /** - * Returns the name of the function - "toRadians". - * - * @return The name of this function class. - */ - public String getName() { - return "toRadians"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted to a double value and - * evaluated. - * - * @return A measurement of the argument in radians. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(Evaluator evaluator, String arguments) - throws FunctionException { - Double result = null; - Double number = null; - - try { - number = new Double(arguments); - } catch (Exception e) { - throw new FunctionException("Invalid argument.", e); - } - - result = new Double(Math.toRadians(number.doubleValue())); - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/CharAt.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/CharAt.java deleted file mode 100644 index f32dce5..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/CharAt.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.string; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.*; - -import java.util.ArrayList; - -/** - * This class is a function that executes within Evaluator. The function returns - * the character at the specified index in the source string. See the - * String.charAt(int) method in the JDK for a complete description of how this - * function works. - */ -public class CharAt implements Function { - /** - * Returns the name of the function - "charAt". - * - * @return The name of this function class. - */ - public String getName() { - return "charAt"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted into one string and - * one integer argument. The first argument is the source string - * and the second argument is the index. The string argument(s) - * HAS to be enclosed in quotes. White space that is not enclosed - * within quotes will be trimmed. Quote characters in the first - * and last positions of any string argument (after being - * trimmed) will be removed also. The quote characters used must - * be the same as the quote characters used by the current - * instance of Evaluator. If there are multiple arguments, they - * must be separated by a comma (","). - * - * @return A character that is located at the specified index. The value is - * returned as a string. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - String result = null; - String exceptionMessage = "One string and one integer argument " - + "are required."; - - ArrayList values = FunctionHelper.getOneStringAndOneInteger(arguments, - EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR); - - if (values.size() != 2) { - throw new FunctionException(exceptionMessage); - } - - try { - String argumentOne = FunctionHelper.trimAndRemoveQuoteChars( - (String) values.get(0), evaluator.getQuoteCharacter()); - int index = ((Integer) values.get(1)).intValue(); - - char[] character = new char[1]; - character[0] = argumentOne.charAt(index); - - result = new String(character); - } catch (FunctionException fe) { - throw new FunctionException(fe.getMessage(), fe); - } catch (Exception e) { - throw new FunctionException(exceptionMessage, e); - } - - return new FunctionResult(result, - FunctionConstants.FUNCTION_RESULT_TYPE_STRING); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/CompareTo.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/CompareTo.java deleted file mode 100644 index 53f6dcf..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/CompareTo.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.string; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.*; - -import java.util.ArrayList; - -/** - * This class is a function that executes within Evaluator. The function - * compares two strings lexicographically. See the String.compareTo(String) - * method in the JDK for a complete description of how this function works. - */ -public class CompareTo implements Function { - /** - * Returns the name of the function - "compareTo". - * - * @return The name of this function class. - */ - public String getName() { - return "compareTo"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted into two string - * arguments. The first argument is the first string to compare - * and the second argument is the second string to compare. The - * string argument(s) HAS to be enclosed in quotes. White space - * that is not enclosed within quotes will be trimmed. Quote - * characters in the first and last positions of any string - * argument (after being trimmed) will be removed also. The quote - * characters used must be the same as the quote characters used - * by the current instance of Evaluator. If there are multiple - * arguments, they must be separated by a comma (","). - * - * @return Returns an integer value of zero if the strings are equal, an - * integer value less than zero if the first string precedes the - * second string or an integer value greater than zero if the first - * string follows the second string. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - Integer result = null; - String exceptionMessage = "Two string arguments are required."; - - ArrayList strings = FunctionHelper.getStrings(arguments, - EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR); - - if (strings.size() != 2) { - throw new FunctionException(exceptionMessage); - } - - try { - String argumentOne = FunctionHelper.trimAndRemoveQuoteChars( - (String) strings.get(0), evaluator.getQuoteCharacter()); - String argumentTwo = FunctionHelper.trimAndRemoveQuoteChars( - (String) strings.get(1), evaluator.getQuoteCharacter()); - result = new Integer(argumentOne.compareTo(argumentTwo)); - } catch (FunctionException fe) { - throw new FunctionException(fe.getMessage(), fe); - } catch (Exception e) { - throw new FunctionException(exceptionMessage, e); - } - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/CompareToIgnoreCase.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/CompareToIgnoreCase.java deleted file mode 100644 index 8f98fce..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/CompareToIgnoreCase.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.string; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.*; - -import java.util.ArrayList; - -/** - * This class is a function that executes within Evaluator. The function - * compares two strings lexicographically, ignoreing case considerations. See - * the String.compareTo(String) method in the JDK for a complete description of - * how this function works. - */ -public class CompareToIgnoreCase implements Function { - /** - * Returns the name of the function - "compareToIgnoreCase". - * - * @return The name of this function class. - */ - public String getName() { - return "compareToIgnoreCase"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted into two string - * arguments. The first argument is the first string to compare - * and the second argument is the second argument to compare. The - * string argument(s) HAS to be enclosed in quotes. White space - * that is not enclosed within quotes will be trimmed. Quote - * characters in the first and last positions of any string - * argument (after being trimmed) will be removed also. The quote - * characters used must be the same as the quote characters used - * by the current instance of Evaluator. If there are multiple - * arguments, they must be separated by a comma (","). - * - * @return Returns an integer value of zero if the strings are equal, an - * integer value less than zero if the first string precedes the - * second string or an integer value greater than zero if the first - * string follows the second string. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - Integer result = null; - String exceptionMessage = "Two string arguments are required."; - - ArrayList strings = FunctionHelper.getStrings(arguments, - EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR); - - if (strings.size() != 2) { - throw new FunctionException(exceptionMessage); - } - - try { - String argumentOne = FunctionHelper.trimAndRemoveQuoteChars( - (String) strings.get(0), evaluator.getQuoteCharacter()); - String argumentTwo = FunctionHelper.trimAndRemoveQuoteChars( - (String) strings.get(1), evaluator.getQuoteCharacter()); - result = new Integer(argumentOne.compareToIgnoreCase(argumentTwo)); - } catch (FunctionException fe) { - throw new FunctionException(fe.getMessage(), fe); - } catch (Exception e) { - throw new FunctionException(exceptionMessage, e); - } - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/Concat.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/Concat.java deleted file mode 100644 index 4115ebb..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/Concat.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.string; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.*; - -import java.util.ArrayList; - -/** - * This class is a function that executes within Evaluator. The function - * concatenates the second string to the end of the first. See the - * String.concat(String) method in the JDK for a complete description of how - * this function works. - */ -public class Concat implements Function { - /** - * Returns the name of the function - "concat". - * - * @return The name of this function class. - */ - public String getName() { - return "concat"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted into two string - * arguments. The first argument is the string in which the - * second argument string will be concatenated. The string - * argument(s) HAS to be enclosed in quotes. White space that is - * not enclosed within quotes will be trimmed. Quote characters - * in the first and last positions of any string argument (after - * being trimmed) will be removed also. The quote characters used - * must be the same as the quote characters used by the current - * instance of Evaluator. If there are multiple arguments, they - * must be separated by a comma (","). - * - * @return Returns a strng that is made up the first string, followed by the - * second string. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - String result = null; - String exceptionMessage = "Two string arguments are required."; - - ArrayList strings = FunctionHelper.getStrings(arguments, - EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR); - - if (strings.size() != 2) { - throw new FunctionException(exceptionMessage); - } - - try { - String argumentOne = FunctionHelper.trimAndRemoveQuoteChars( - (String) strings.get(0), evaluator.getQuoteCharacter()); - String argumentTwo = FunctionHelper.trimAndRemoveQuoteChars( - (String) strings.get(1), evaluator.getQuoteCharacter()); - result = argumentOne.concat(argumentTwo); - } catch (FunctionException fe) { - throw new FunctionException(fe.getMessage(), fe); - } catch (Exception e) { - throw new FunctionException(exceptionMessage, e); - } - - return new FunctionResult(result, - FunctionConstants.FUNCTION_RESULT_TYPE_STRING); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/Contains.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/Contains.java deleted file mode 100644 index 1ee0c16..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/Contains.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.string; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.*; - -import java.util.ArrayList; - -/** - * This class is a function that executes within Evaluator. The function returns - * the index within the source string of the first occurrence of the substring, - * starting at the specified index. See the String.indexOf(String, int) method - * in the JDK for a complete description of how this function works. - */ -public class Contains implements Function { - /** - * Returns the name of the function - "indexOf". - * - * @return The name of this function class. - */ - public String getName() { - return "contains"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted into two string - * arguments and one integer argument. The first argument is the - * source string, the second argument is the substring and the - * third argument is the index. The string argument(s) HAS to be - * enclosed in quotes. White space that is not enclosed within - * quotes will be trimmed. Quote characters in the first and last - * positions of any string argument (after being trimmed) will be - * removed also. The quote characters used must be the same as - * the quote characters used by the current instance of - * Evaluator. If there are multiple arguments, they must be - * separated by a comma (","). - * - * @return Returns The index at where the substring is found. If the - * substring is not found, then -1 is returned. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - String result = null; - String exceptionMessage = "Two string arguments are required."; - - ArrayList strings = FunctionHelper.getStrings(arguments, - EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR); - - if (strings.size() != 2) { - throw new FunctionException(exceptionMessage); - } - - try { - String argumentOne = FunctionHelper.trimAndRemoveQuoteChars( - (String) strings.get(0), evaluator.getQuoteCharacter()); - String argumentTwo = FunctionHelper.trimAndRemoveQuoteChars( - (String) strings.get(1), evaluator.getQuoteCharacter()); - - if (argumentOne.contains(argumentTwo)) { - result = EvaluationConstants.BOOLEAN_STRING_TRUE; - } else { - result = EvaluationConstants.BOOLEAN_STRING_FALSE; - } - } catch (FunctionException fe) { - throw new FunctionException(fe.getMessage(), fe); - } catch (Exception e) { - throw new FunctionException(exceptionMessage, e); - } - - return new FunctionResult(result, - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/EndsWith.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/EndsWith.java deleted file mode 100644 index 15afc4c..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/EndsWith.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.string; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.*; - -import java.util.ArrayList; - -/** - * This class is a function that executes within Evaluator. The function tests - * if the string ends with a specified suffix. See the String.endswith(String) - * method in the JDK for a complete description of how this function works. - */ -public class EndsWith implements Function { - /** - * Returns the name of the function - "endsWith". - * - * @return The name of this function class. - */ - public String getName() { - return "endsWith"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted into two string - * arguments. The first argument is the string to test and second - * argument is the suffix. The string argument(s) HAS to be - * enclosed in quotes. White space that is not enclosed within - * quotes will be trimmed. Quote characters in the first and last - * positions of any string argument (after being trimmed) will be - * removed also. The quote characters used must be the same as - * the quote characters used by the current instance of - * Evaluator. If there are multiple arguments, they must be - * separated by a comma (","). - * - * @return Returns "1.0" (true) if the string ends with the suffix, - * otherwise it returns "0.0" (false). The return value respresents - * a Boolean value that is compatible with the Boolean operators - * used by Evaluator. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - String result = null; - String exceptionMessage = "Two string arguments are required."; - - ArrayList strings = FunctionHelper.getStrings(arguments, - EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR); - - if (strings.size() != 2) { - throw new FunctionException(exceptionMessage); - } - - try { - String argumentOne = FunctionHelper.trimAndRemoveQuoteChars( - (String) strings.get(0), evaluator.getQuoteCharacter()); - String argumentTwo = FunctionHelper.trimAndRemoveQuoteChars( - (String) strings.get(1), evaluator.getQuoteCharacter()); - - if (argumentOne.endsWith(argumentTwo)) { - result = EvaluationConstants.BOOLEAN_STRING_TRUE; - } else { - result = EvaluationConstants.BOOLEAN_STRING_FALSE; - } - } catch (FunctionException fe) { - throw new FunctionException(fe.getMessage(), fe); - } catch (Exception e) { - throw new FunctionException(exceptionMessage, e); - } - - return new FunctionResult(result, - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/Equals.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/Equals.java deleted file mode 100644 index 21b52d0..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/Equals.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.string; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.*; - -import java.util.ArrayList; - -/** - * This class is a function that executes within Evaluator. The function tests - * one string equals another. See the String.equals(String) method in the JDK - * for a complete description of how this function works. - */ -public class Equals implements Function { - /** - * Returns the name of the function - "equals". - * - * @return The name of this function class. - */ - public String getName() { - return "equals"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted into two string - * arguments. The first argument is a string that will be - * compared to the second argument / string. The string - * argument(s) HAS to be enclosed in quotes. White space that is - * not enclosed within quotes will be trimmed. Quote characters - * in the first and last positions of any string argument (after - * being trimmed) will be removed also. The quote characters used - * must be the same as the quote characters used by the current - * instance of Evaluator. If there are multiple arguments, they - * must be separated by a comma (","). - * - * @return Returns "1.0" (true) if the string ends with the suffix, - * otherwise it returns "0.0" (false). The return value respresents - * a Boolean value that is compatible with the Boolean operators - * used by Evaluator. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - String result = null; - String exceptionMessage = "Two string arguments are required."; - - ArrayList strings = FunctionHelper.getStrings(arguments, - EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR); - - if (strings.size() != 2) { - throw new FunctionException(exceptionMessage); - } - - try { - String argumentOne = FunctionHelper.trimAndRemoveQuoteChars( - (String) strings.get(0), evaluator.getQuoteCharacter()); - String argumentTwo = FunctionHelper.trimAndRemoveQuoteChars( - (String) strings.get(1), evaluator.getQuoteCharacter()); - - if (argumentOne.equals(argumentTwo)) { - result = EvaluationConstants.BOOLEAN_STRING_TRUE; - } else { - result = EvaluationConstants.BOOLEAN_STRING_FALSE; - } - } catch (FunctionException fe) { - throw new FunctionException(fe.getMessage(), fe); - } catch (Exception e) { - throw new FunctionException(exceptionMessage, e); - } - - return new FunctionResult(result, - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/EqualsIgnoreCase.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/EqualsIgnoreCase.java deleted file mode 100644 index fc941bf..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/EqualsIgnoreCase.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.string; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.*; - -import java.util.ArrayList; - -/** - * This class is a function that executes within Evaluator. The function tests - * one string equals another, but ignores case. See the - * String.equalsIgnoreCase(String) method in the JDK for a complete description - * of how this function works. - */ -public class EqualsIgnoreCase implements Function { - /** - * Returns the name of the function - "equalsIgnoreCase". - * - * @return The name of this function class. - */ - public String getName() { - return "equalsIgnoreCase"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted into two string - * arguments. The first argument is a string that will be - * compared to the second argument / string. The string - * argument(s) HAS to be enclosed in quotes. White space that is - * not enclosed within quotes will be trimmed. Quote characters - * in the first and last positions of any string argument (after - * being trimmed) will be removed also. The quote characters used - * must be the same as the quote characters used by the current - * instance of Evaluator. If there are multiple arguments, they - * must be separated by a comma (","). - * - * @return Returns "1.0" (true) if the string ends with the suffix, - * otherwise it returns "0.0" (false). The return value respresents - * a Boolean value that is compatible with the Boolean operators - * used by Evaluator. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - String result = null; - String exceptionMessage = "Two string arguments are required."; - - ArrayList strings = FunctionHelper.getStrings(arguments, - EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR); - - if (strings.size() != 2) { - throw new FunctionException(exceptionMessage); - } - - try { - String argumentOne = FunctionHelper.trimAndRemoveQuoteChars( - (String) strings.get(0), evaluator.getQuoteCharacter()); - String argumentTwo = FunctionHelper.trimAndRemoveQuoteChars( - (String) strings.get(1), evaluator.getQuoteCharacter()); - - if (argumentOne.equalsIgnoreCase(argumentTwo)) { - result = EvaluationConstants.BOOLEAN_STRING_TRUE; - } else { - result = EvaluationConstants.BOOLEAN_STRING_FALSE; - } - } catch (FunctionException fe) { - throw new FunctionException(fe.getMessage(), fe); - } catch (Exception e) { - throw new FunctionException(exceptionMessage, e); - } - - return new FunctionResult(result, - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/Eval.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/Eval.java deleted file mode 100644 index 7383b5c..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/Eval.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.string; - -import com.baoying.enginex.executor.util.jeval.EvaluationException; -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.Function; -import com.baoying.enginex.executor.util.jeval.function.FunctionConstants; -import com.baoying.enginex.executor.util.jeval.function.FunctionException; -import com.baoying.enginex.executor.util.jeval.function.FunctionResult; - -/** - * This class is a function that executes within Evaluator. The function returns - * the result of a Evaluator compatible expression. See the - * Evaluator.evaluate(String) method for a complete description of how this - * function works. - */ -public class Eval implements Function { - /** - * Returns the name of the function - "eval". - * - * @return The name of this function class. - */ - public String getName() { - return "eval"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of evaluator. - * @param arguments - * A string expression that is compatible with Evaluator. *** THE - * STRING ARGUMENT SHOULD NOT BE ENCLOSED IN QUOTES OR THE - * EXPRESSION MAY NOT BE EVALUATED CORRECTLY.*** *** FUNCTION - * CALLS ARE VALID WITHIN THE EVAL FUNCTION. *** - * - * @return The evaluated result fot the input expression. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, - final String arguments) throws FunctionException { - String result = null; - - try { - result = evaluator.evaluate(arguments, false, true); - } catch (EvaluationException ee) { - throw new FunctionException(ee.getMessage(), ee); - } - - int resultType = FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC; - try { - Double.parseDouble(result); - } catch (NumberFormatException nfe) { - resultType = FunctionConstants.FUNCTION_RESULT_TYPE_STRING; - } - - return new FunctionResult(result, resultType); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/IndexOf.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/IndexOf.java deleted file mode 100644 index 06d2401..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/IndexOf.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.string; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.*; - -import java.util.ArrayList; - -/** - * This class is a function that executes within Evaluator. The function returns - * the index within the source string of the first occurrence of the substring, - * starting at the specified index. See the String.indexOf(String, int) method - * in the JDK for a complete description of how this function works. - */ -public class IndexOf implements Function { - /** - * Returns the name of the function - "indexOf". - * - * @return The name of this function class. - */ - public String getName() { - return "indexOf"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted into two string - * arguments and one integer argument. The first argument is the - * source string, the second argument is the substring and the - * third argument is the index. The string argument(s) HAS to be - * enclosed in quotes. White space that is not enclosed within - * quotes will be trimmed. Quote characters in the first and last - * positions of any string argument (after being trimmed) will be - * removed also. The quote characters used must be the same as - * the quote characters used by the current instance of - * Evaluator. If there are multiple arguments, they must be - * separated by a comma (","). - * - * @return Returns The index at where the substring is found. If the - * substring is not found, then -1 is returned. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - Integer result = null; - String exceptionMessage = "Two string arguments and one integer " - + "argument are required."; - - ArrayList values = FunctionHelper.getTwoStringsAndOneInteger(arguments, - EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR); - - if (values.size() != 3) { - throw new FunctionException(exceptionMessage); - } - - try { - String argumentOne = FunctionHelper.trimAndRemoveQuoteChars( - (String) values.get(0), evaluator.getQuoteCharacter()); - String argumentTwo = FunctionHelper.trimAndRemoveQuoteChars( - (String) values.get(1), evaluator.getQuoteCharacter()); - int index = ((Integer) values.get(2)).intValue(); - result = new Integer(argumentOne.indexOf(argumentTwo, index)); - } catch (FunctionException fe) { - throw new FunctionException(fe.getMessage(), fe); - } catch (Exception e) { - throw new FunctionException(exceptionMessage, e); - } - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/LastIndexOf.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/LastIndexOf.java deleted file mode 100644 index d899277..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/LastIndexOf.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.string; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.*; - -import java.util.ArrayList; - -/** - * This class is a function that executes within Evaluator. The function returns - * the index within the source string of the last occurrence of the substring, - * starting at the specified index. See the String.lastIndexOf(String, int) - * method in the JDK for a complete description of how this function works. - */ -public class LastIndexOf implements Function { - /** - * Returns the name of the function - "lastIndexOf". - * - * @return The name of this function class. - */ - public String getName() { - return "lastIndexOf"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted into two string - * arguments and one integer argument. The first argument is the - * source string, the second argument is the substring and the - * third argument is the index. The string argument(s) HAS to be - * enclosed in quotes. White space that is not enclosed within - * quotes will be trimmed. Quote characters in the first and last - * positions of any string argument (after being trimmed) will be - * removed also. The quote characters used must be the same as - * the quote characters used by the current instance of - * Evaluator. If there are multiple arguments, they must be - * separated by a comma (","). - * - * @return Returns The index at where the substring is found. If the - * substring is not found, then -1 is returned. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - Integer result = null; - String exceptionMessage = "Two string arguments and one integer " - + "argument are required."; - - ArrayList values = FunctionHelper.getTwoStringsAndOneInteger(arguments, - EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR); - - if (values.size() != 3) { - throw new FunctionException(exceptionMessage); - } - - try { - String argumentOne = FunctionHelper.trimAndRemoveQuoteChars( - (String) values.get(0), evaluator.getQuoteCharacter()); - String argumentTwo = FunctionHelper.trimAndRemoveQuoteChars( - (String) values.get(1), evaluator.getQuoteCharacter()); - int index = ((Integer) values.get(2)).intValue(); - result = new Integer(argumentOne.lastIndexOf(argumentTwo, index)); - } catch (FunctionException fe) { - throw new FunctionException(fe.getMessage(), fe); - } catch (Exception e) { - throw new FunctionException(exceptionMessage, e); - } - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/Length.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/Length.java deleted file mode 100644 index 07563b3..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/Length.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.string; - -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.*; - -/** - * This class is a function that executes within Evaluator. The function returns - * the length of the source string. See the String.length() method in the JDK - * for a complete description of how this function works. - */ -public class Length implements Function { - /** - * Returns the name of the function - "length". - * - * @return The name of this function class. - */ - public String getName() { - return "length"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted into one string - * argument. The string argument(s) HAS to be enclosed in quotes. - * White space that is not enclosed within quotes will be - * trimmed. Quote characters in the first and last positions of - * any string argument (after being trimmed) will be removed - * also. The quote characters used must be the same as the quote - * characters used by the current instance of Evaluator. If there - * are multiple arguments, they must be separated by a comma - * (","). - * - * @return The length of the source string. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - Integer result = null; - String exceptionMessage = "One string argument is required."; - - try { - String stringValue = arguments; - - String argumentOne = FunctionHelper.trimAndRemoveQuoteChars( - stringValue, evaluator.getQuoteCharacter()); - - result = new Integer(argumentOne.length()); - } catch (FunctionException fe) { - throw new FunctionException(fe.getMessage(), fe); - } catch (Exception e) { - throw new FunctionException(exceptionMessage, e); - } - - return new FunctionResult(result.toString(), - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/NotContains.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/NotContains.java deleted file mode 100644 index 8fa4f67..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/NotContains.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.string; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.*; - -import java.util.ArrayList; - -/** - * This class is a function that executes within Evaluator. The function returns - * the index within the source string of the first occurrence of the substring, - * starting at the specified index. See the String.indexOf(String, int) method - * in the JDK for a complete description of how this function works. - */ -public class NotContains implements Function { - /** - * Returns the name of the function - "indexOf". - * - * @return The name of this function class. - */ - public String getName() { - return "notContains"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted into two string - * arguments and one integer argument. The first argument is the - * source string, the second argument is the substring and the - * third argument is the index. The string argument(s) HAS to be - * enclosed in quotes. White space that is not enclosed within - * quotes will be trimmed. Quote characters in the first and last - * positions of any string argument (after being trimmed) will be - * removed also. The quote characters used must be the same as - * the quote characters used by the current instance of - * Evaluator. If there are multiple arguments, they must be - * separated by a comma (","). - * - * @return Returns The index at where the substring is found. If the - * substring is not found, then -1 is returned. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - String result = null; - String exceptionMessage = "Two string arguments are required."; - - ArrayList strings = FunctionHelper.getStrings(arguments, - EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR); - - if (strings.size() != 2) { - throw new FunctionException(exceptionMessage); - } - - try { - String argumentOne = FunctionHelper.trimAndRemoveQuoteChars( - (String) strings.get(0), evaluator.getQuoteCharacter()); - String argumentTwo = FunctionHelper.trimAndRemoveQuoteChars( - (String) strings.get(1), evaluator.getQuoteCharacter()); - - if (argumentOne.contains(argumentTwo)) { - result = EvaluationConstants.BOOLEAN_STRING_FALSE; - } else { - result = EvaluationConstants.BOOLEAN_STRING_TRUE; - } - } catch (FunctionException fe) { - throw new FunctionException(fe.getMessage(), fe); - } catch (Exception e) { - throw new FunctionException(exceptionMessage, e); - } - - return new FunctionResult(result, - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/NotEquals.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/NotEquals.java deleted file mode 100644 index e47941a..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/NotEquals.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.string; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.*; - -import java.util.ArrayList; - -/** - * This class is a function that executes within Evaluator. The function tests - * one string equals another. See the String.equals(String) method in the JDK - * for a complete description of how this function works. - */ -public class NotEquals implements Function { - /** - * Returns the name of the function - "equals". - * - * @return The name of this function class. - */ - public String getName() { - return "notEquals"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted into two string - * arguments. The first argument is a string that will be - * compared to the second argument / string. The string - * argument(s) HAS to be enclosed in quotes. White space that is - * not enclosed within quotes will be trimmed. Quote characters - * in the first and last positions of any string argument (after - * being trimmed) will be removed also. The quote characters used - * must be the same as the quote characters used by the current - * instance of Evaluator. If there are multiple arguments, they - * must be separated by a comma (","). - * - * @return Returns "1.0" (true) if the string ends with the suffix, - * otherwise it returns "0.0" (false). The return value respresents - * a Boolean value that is compatible with the Boolean operators - * used by Evaluator. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - String result = null; - String exceptionMessage = "Two string arguments are required."; - - ArrayList strings = FunctionHelper.getStrings(arguments, - EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR); - - if (strings.size() != 2) { - throw new FunctionException(exceptionMessage); - } - - try { - String argumentOne = FunctionHelper.trimAndRemoveQuoteChars( - (String) strings.get(0), evaluator.getQuoteCharacter()); - String argumentTwo = FunctionHelper.trimAndRemoveQuoteChars( - (String) strings.get(1), evaluator.getQuoteCharacter()); - - if (argumentOne.equals(argumentTwo)) { - result = EvaluationConstants.BOOLEAN_STRING_FALSE; - } else { - result = EvaluationConstants.BOOLEAN_STRING_TRUE; - } - } catch (FunctionException fe) { - throw new FunctionException(fe.getMessage(), fe); - } catch (Exception e) { - throw new FunctionException(exceptionMessage, e); - } - - return new FunctionResult(result, - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/Replace.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/Replace.java deleted file mode 100644 index ca97f5a..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/Replace.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.string; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.*; - -import java.util.ArrayList; - -/** - * This class is a function that executes within Evaluator. The function returns - * a new string with all of the occurances of the old character in the source - * string replaced with the new character. See the String.replace(char, char) - * method in the JDK for a complete description of how this function works. - */ -public class Replace implements Function { - /** - * Returns the name of the function - "replace". - * - * @return The name of this function class. - */ - public String getName() { - return "replace"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted into one string and - * two character arguments. The first argument is the source - * string to replace the charactes in. The second argument is the - * old character to replace in the source string. The third - * argument is the new character to replace the old character - * with in the source string. The string and character - * argument(s) HAS to be enclosed in quotes. White space that is - * not enclosed within quotes will be trimmed. Quote characters - * in the first and last positions of any string argument (after - * being trimmed) will be removed also. The quote characters used - * must be the same as the quote characters used by the current - * instance of Evaluator. If there are multiple arguments, they - * must be separated by a comma (","). - * - * @return Returns a string with every occurence of the old character - * replaced with the new character. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - String result = null; - String exceptionMessage = "One string argument and two character " - + "arguments are required."; - - ArrayList values = FunctionHelper.getStrings(arguments, - EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR); - - if (values.size() != 3) { - throw new FunctionException(exceptionMessage); - } - - try { - String argumentOne = FunctionHelper.trimAndRemoveQuoteChars( - (String) values.get(0), evaluator.getQuoteCharacter()); - - String argumentTwo = FunctionHelper.trimAndRemoveQuoteChars( - (String) values.get(1), evaluator.getQuoteCharacter()); - - String argumentThree = FunctionHelper.trimAndRemoveQuoteChars( - (String) values.get(2), evaluator.getQuoteCharacter()); - - char oldCharacter = ' '; - if (argumentTwo.length() == 1) { - oldCharacter = argumentTwo.charAt(0); - } else { - throw new FunctionException(exceptionMessage); - } - - char newCharacter = ' '; - if (argumentThree.length() == 1) { - newCharacter = argumentThree.charAt(0); - } else { - throw new FunctionException(exceptionMessage); - } - - result = argumentOne.replace(oldCharacter, newCharacter); - } catch (FunctionException fe) { - throw new FunctionException(fe.getMessage(), fe); - } catch (Exception e) { - throw new FunctionException(exceptionMessage, e); - } - - return new FunctionResult(result, - FunctionConstants.FUNCTION_RESULT_TYPE_STRING); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/StartsWith.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/StartsWith.java deleted file mode 100644 index 8afbefe..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/StartsWith.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.string; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.*; - -import java.util.ArrayList; - -/** - * This class is a function that executes within Evaluator. The function tests - * if the string starts with a specified prefix beginning at a specified index. - * See the String.startsWith(String, int) method in the JDK for a complete - * description of how this function works. - */ -public class StartsWith implements Function { - /** - * Returns the name of the function - "startsWith". - * - * @return The name of this function class. - */ - public String getName() { - return "startsWith"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted into two string - * arguments and one integer argument. The first argument is the - * string to test, the second argument is the prefix and the - * third argument is the index to start at. The string - * argument(s) HAS to be enclosed in quotes. White space that is - * not enclosed within quotes will be trimmed. Quote characters - * in the first and last positions of any string argument (after - * being trimmed) will be removed also. The quote characters used - * must be the same as the quote characters used by the current - * instance of Evaluator. If there are multiple arguments, they - * must be separated by a comma (","). - * - * @return Returns "1.0" (true) if the string ends with the suffix, - * otherwise it returns "0.0" (false). The return value respresents - * a Boolean value that is compatible with the Boolean operators - * used by Evaluator. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - String result = null; - String exceptionMessage = "Two string arguments and one integer " - + "argument are required."; - - ArrayList values = FunctionHelper.getTwoStringsAndOneInteger(arguments, - EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR); - - if (values.size() != 3) { - throw new FunctionException(exceptionMessage); - } - - try { - String argumentOne = FunctionHelper.trimAndRemoveQuoteChars( - (String) values.get(0), evaluator.getQuoteCharacter()); - String argumentTwo = FunctionHelper.trimAndRemoveQuoteChars( - (String) values.get(1), evaluator.getQuoteCharacter()); - int index = ((Integer) values.get(2)).intValue(); - - if (argumentOne.startsWith(argumentTwo, index)) { - result = EvaluationConstants.BOOLEAN_STRING_TRUE; - } else { - result = EvaluationConstants.BOOLEAN_STRING_FALSE; - } - } catch (FunctionException fe) { - throw new FunctionException(fe.getMessage(), fe); - } catch (Exception e) { - throw new FunctionException(exceptionMessage, e); - } - - return new FunctionResult(result, - FunctionConstants.FUNCTION_RESULT_TYPE_NUMERIC); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/StringFunctions.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/StringFunctions.java deleted file mode 100644 index 2424b55..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/StringFunctions.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.string; - -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.Function; -import com.baoying.enginex.executor.util.jeval.function.FunctionGroup; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -/** - * A groups of functions that can loaded at one time into an instance of - * Evaluator. This group contains all of the functions located in the - * net.sourceforge.jeval.function.string package. - */ -public class StringFunctions implements FunctionGroup { - /** - * Used to store instances of all of the functions loaded by this class. - */ - private List functions = new ArrayList(); - - /** - * Default contructor for this class. The functions loaded by this class are - * instantiated in this constructor. - */ - public StringFunctions() { - functions.add(new CharAt()); - functions.add(new CompareTo()); - functions.add(new CompareToIgnoreCase()); - functions.add(new Concat()); - functions.add(new EndsWith()); - functions.add(new Equals()); - functions.add(new EqualsIgnoreCase()); - functions.add(new Eval()); - functions.add(new IndexOf()); - functions.add(new LastIndexOf()); - functions.add(new Length()); - functions.add(new Replace()); - functions.add(new StartsWith()); - functions.add(new Substring()); - functions.add(new ToLowerCase()); - functions.add(new ToUpperCase()); - functions.add(new Trim()); - functions.add(new Contains()); - functions.add(new NotContains()); - functions.add(new NotEquals()); - } - - /** - * Returns the name of the function group - "stringFunctions". - * - * @return The name of this function group class. - */ - public String getName() { - return "stringFunctions"; - } - - /** - * Returns a list of the functions that are loaded by this class. - * - * @return A list of the functions loaded by this class. - */ - public List getFunctions() { - return functions; - } - - /** - * Loads the functions in this function group into an instance of Evaluator. - * - * @param evaluator - * An instance of Evaluator to load the functions into. - */ - public void load(final Evaluator evaluator) { - Iterator functionIterator = functions.iterator(); - - while (functionIterator.hasNext()) { - evaluator.putFunction((Function) functionIterator.next()); - } - } - - /** - * Unloads the functions in this function group from an instance of - * Evaluator. - * - * @param evaluator - * An instance of Evaluator to unload the functions from. - */ - public void unload(final Evaluator evaluator) { - Iterator functionIterator = functions.iterator(); - - while (functionIterator.hasNext()) { - evaluator.removeFunction(((Function) functionIterator.next()) - .getName()); - } - } -} diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/Substring.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/Substring.java deleted file mode 100644 index 61485c1..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/Substring.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.string; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.*; - -import java.util.ArrayList; - -/** - * This class is a function that executes within Evaluator. The function returns - * a string that is a substring of the source string. See the - * String.substring(int, int) method in the JDK for a complete description of - * how this function works. - */ -public class Substring implements Function { - /** - * Returns the name of the function - "substring". - * - * @return The name of this function class. - */ - public String getName() { - return "substring"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted into one string - * argument and two integer arguments. The first argument is the - * source string, the second argument is the beginning index and - * the third argument is the ending index. The string argument(s) - * HAS to be enclosed in quotes. White space that is not enclosed - * within quotes will be trimmed. Quote characters in the first - * and last positions of any string argument (after being - * trimmed) will be removed also. The quote characters used must - * be the same as the quote characters used by the current - * instance of Evaluator. If there are multiple arguments, they - * must be separated by a comma (","). - * - * @return Returns the specified substring. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - String result = null; - String exceptionMessage = "One string argument and two integer " - + "arguments are required."; - - ArrayList values = FunctionHelper.getOneStringAndTwoIntegers(arguments, - EvaluationConstants.FUNCTION_ARGUMENT_SEPARATOR); - - if (values.size() != 3) { - throw new FunctionException(exceptionMessage); - } - - try { - String argumentOne = FunctionHelper.trimAndRemoveQuoteChars( - (String) values.get(0), evaluator.getQuoteCharacter()); - int beginningIndex = ((Integer) values.get(1)).intValue(); - int endingIndex = ((Integer) values.get(2)).intValue(); - result = argumentOne.substring(beginningIndex, endingIndex); - } catch (FunctionException fe) { - throw new FunctionException(fe.getMessage(), fe); - } catch (Exception e) { - throw new FunctionException(exceptionMessage, e); - } - - return new FunctionResult(result, - FunctionConstants.FUNCTION_RESULT_TYPE_STRING); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/ToLowerCase.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/ToLowerCase.java deleted file mode 100644 index 12eb7b5..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/ToLowerCase.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.string; - -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.*; - -/** - * This class is a function that executes within Evaluator. The function returns - * the source string in lower case. See the String.toLowerCase() method in the - * JDK for a complete description of how this function works. - */ -public class ToLowerCase implements Function { - /** - * Returns the name of the function - "toLowerCase". - * - * @return The name of this function class. - */ - public String getName() { - return "toLowerCase"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted into one string - * argument. The string argument(s) HAS to be enclosed in quotes. - * White space that is not enclosed within quotes will be - * trimmed. Quote characters in the first and last positions of - * any string argument (after being trimmed) will be removed - * also. The quote characters used must be the same as the quote - * characters used by the current instance of Evaluator. If there - * are multiple arguments, they must be separated by a comma - * (","). - * - * @return The source string, converted to lowercase. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - String result = null; - String exceptionMessage = "One string argument is required."; - - try { - String stringValue = arguments; - - String argumentOne = FunctionHelper.trimAndRemoveQuoteChars( - stringValue, evaluator.getQuoteCharacter()); - - result = argumentOne.toLowerCase(); - } catch (FunctionException fe) { - throw new FunctionException(fe.getMessage(), fe); - } catch (Exception e) { - throw new FunctionException(exceptionMessage, e); - } - - return new FunctionResult(result, - FunctionConstants.FUNCTION_RESULT_TYPE_STRING); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/ToUpperCase.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/ToUpperCase.java deleted file mode 100644 index 71f3160..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/ToUpperCase.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.string; - -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.*; - -/** - * This class is a function that executes within Evaluator. The function returns - * the source string in upper case. See the String.toUpperCase() method in the - * JDK for a complete description of how this function works. - */ -public class ToUpperCase implements Function { - /** - * Returns the name of the function - "toUpperCase". - * - * @return The name of this function class. - */ - public String getName() { - return "toUpperCase"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted into one string - * argument. The string argument(s) HAS to be enclosed in quotes. - * White space that is not enclosed within quotes will be - * trimmed. Quote characters in the first and last positions of - * any string argument (after being trimmed) will be removed - * also. The quote characters used must be the same as the quote - * characters used by the current instance of Evaluator. If there - * are multiple arguments, they must be separated by a comma - * (","). - * - * @return The source string, converted to lowercase. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - String result = null; - String exceptionMessage = "One string argument is required."; - - try { - String stringValue = arguments; - - String argumentOne = FunctionHelper.trimAndRemoveQuoteChars( - stringValue, evaluator.getQuoteCharacter()); - - result = argumentOne.toUpperCase(); - } catch (FunctionException fe) { - throw new FunctionException(fe.getMessage(), fe); - } catch (Exception e) { - throw new FunctionException(exceptionMessage, e); - } - - return new FunctionResult(result, - FunctionConstants.FUNCTION_RESULT_TYPE_STRING); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/Trim.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/Trim.java deleted file mode 100644 index 2a4fae7..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/function/string/Trim.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.function.string; - -import com.baoying.enginex.executor.util.jeval.Evaluator; -import com.baoying.enginex.executor.util.jeval.function.*; - -/** - * This class is a function that executes within Evaluator. The function returns - * the source string with white space removed from both ends. See the - * String.trim() method in the JDK for a complete description of how this - * function works. - */ -public class Trim implements Function { - /** - * Returns the name of the function - "trim". - * - * @return The name of this function class. - */ - public String getName() { - return "trim"; - } - - /** - * Executes the function for the specified argument. This method is called - * internally by Evaluator. - * - * @param evaluator - * An instance of Evaluator. - * @param arguments - * A string argument that will be converted into one string - * argument. The string argument(s) HAS to be enclosed in quotes. - * White space that is not enclosed within quotes will be - * trimmed. Quote characters in the first and last positions of - * any string argument (after being trimmed) will be removed - * also. The quote characters used must be the same as the quote - * characters used by the current instance of Evaluator. If there - * are multiple arguments, they must be separated by a comma - * (","). - * - * @return The source string, with white space removed from both ends. - * - * @exception FunctionException - * Thrown if the argument(s) are not valid for this function. - */ - public FunctionResult execute(final Evaluator evaluator, final String arguments) - throws FunctionException { - String result = null; - String exceptionMessage = "One string argument is required."; - - try { - String stringValue = arguments; - - String argumentOne = FunctionHelper.trimAndRemoveQuoteChars( - stringValue, evaluator.getQuoteCharacter()); - - result = argumentOne.trim(); - } catch (FunctionException fe) { - throw new FunctionException(fe.getMessage(), fe); - } catch (Exception e) { - throw new FunctionException(exceptionMessage, e); - } - - return new FunctionResult(result, - FunctionConstants.FUNCTION_RESULT_TYPE_STRING); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/AbstractOperator.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/AbstractOperator.java deleted file mode 100644 index 412a0d6..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/AbstractOperator.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.operator; - -import com.baoying.enginex.executor.util.jeval.EvaluationException; - -/** - * This is the standard operator that is the parent to all operators found in - * expressions. - */ -public abstract class AbstractOperator implements Operator { - - private String symbol = null; - - private int precedence = 0; - - private boolean unary = false; - - /** - * A constructor that takes the operator symbol and precedence as input. - * - * @param symbol - * The character(s) that makes up the operator. - * @param precedence - * The precedence level given to this operator. - */ - public AbstractOperator(final String symbol, final int precedence) { - - this.symbol = symbol; - this.precedence = precedence; - } - - /** - * A constructor that takes the operator symbol, precedence, unary indicator - * and unary precedence as input. - * - * @param symbol - * The character(s) that makes up the operator. - * @param precedence - * The precedence level given to this operator. - * @param unary - * Indicates of the operator is a unary operator or not. - */ - public AbstractOperator( - - String symbol, int precedence, boolean unary) { - - this.symbol = symbol; - this.precedence = precedence; - this.unary = unary; - } - - /** - * Evaluates two double operands. - * - * @param leftOperand - * The left operand being evaluated. - * @param rightOperand - * The right operand being evaluated. - */ - public double evaluate(final double leftOperand, final double rightOperand) { - return 0; - } - - /** - * Evaluates two string operands. - * - * @param leftOperand - * The left operand being evaluated. - * @param rightOperand - * The right operand being evaluated. - * - * @return String The value of the evaluated operands. - * - * @exception EvaluateException - * Thrown when an error is found while evaluating the - * expression. - */ - public String evaluate(final String leftOperand, final String rightOperand) - throws EvaluationException { - throw new EvaluationException("Invalid operation for a string."); - } - - /** - * Evaluate one double operand. - * - * @param operand - * The operand being evaluated. - */ - public double evaluate(double operand) { - return 0; - } - - /** - * Returns the character(s) that makes up the operator. - * - * @return The operator symbol. - */ - public String getSymbol() { - return symbol; - } - - /** - * Returns the precedence given to this operator. - * - * @return The precedecne given to this operator. - */ - public int getPrecedence() { - return precedence; - } - - /** - * Returns the length of the operator symbol. - * - * @return The length of the operator symbol. - */ - public int getLength() { - return symbol.length(); - } - - /** - * Returns an indicator of if the operator is unary or not. - * - * @return An indicator of if the operator is unary or not. - */ - public boolean isUnary() { - return unary; - } - - /** - * Determines if this operator is equal to another operator. Equality is - * determined by comparing the operator symbol of both operators. - * - * @param object - * The object to compare with this operator. - * - * @return True if the object is equal and false if not. - * - * @exception IllegalStateException - * Thrown if the input object is not of the Operator type. - */ - public boolean equals(final Object object) { - if (object == null) { - return false; - } - - if (!(object instanceof AbstractOperator)) { - throw new IllegalStateException("Invalid operator object."); - } - - AbstractOperator operator = (AbstractOperator) object; - - if (symbol.equals(operator.getSymbol())) { - return true; - } - - return false; - } - - /** - * Returns the String representation of this operator, which is the symbol. - * - * @return The operator symbol. - */ - public String toString() { - return getSymbol(); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/AdditionOperator.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/AdditionOperator.java deleted file mode 100644 index 7e5bd77..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/AdditionOperator.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.operator; - -/** - * The addition operator. - */ -public class AdditionOperator extends AbstractOperator { - - /** - * Default constructor. - */ - public AdditionOperator() { - super("+", 5, true); - } - - /** - * Evaluates two double operands. - * - * @param leftOperand - * The left operand being evaluated. - * @param rightOperand - * The right operand being evaluated. - */ - public double evaluate(final double leftOperand, final double rightOperand) { - Double rtnValue = new Double(leftOperand + rightOperand); - - return rtnValue.doubleValue(); - } - - /** - * Evaluates two string operands. - * - * @param leftOperand - * The left operand being evaluated. - * @param rightOperand - * The right operand being evaluated. - */ - public String evaluate(final String leftOperand, final String rightOperand) { - String rtnValue = new String(leftOperand.substring(0, leftOperand - .length() - 1) - + rightOperand.substring(1, rightOperand.length())); - - return rtnValue; - } - - /** - * Evaluate one double operand. - * - * @param operand - * The operand being evaluated. - */ - public double evaluate(double operand) { - return operand; - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/BooleanAndOperator.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/BooleanAndOperator.java deleted file mode 100644 index 2c20c47..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/BooleanAndOperator.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.operator; - -/** - * The boolean and operator. - */ -public class BooleanAndOperator extends AbstractOperator { - - /** - * Default constructor. - */ - public BooleanAndOperator() { - super("&&", 2); - } - - /** - * Evaluates two double operands. - * - * @param leftOperand - * The left operand being evaluated. - * @param rightOperand - * The right operand being evaluated. - */ - public double evaluate(final double leftOperand, final double rightOperand) { - if (leftOperand == 1 && rightOperand == 1) { - return 1; - } - - return 0; - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/BooleanNotOperator.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/BooleanNotOperator.java deleted file mode 100644 index d7e955a..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/BooleanNotOperator.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.operator; - -/** - * The boolean not operator. - */ -public class BooleanNotOperator extends AbstractOperator { - - /** - * Default constructor. - */ - public BooleanNotOperator() { - super("!", 0, true); - } - - /** - * Evaluate one double operand. - * - * @param operand - * The operand being evaluated. - */ - public double evaluate(final double operand) { - if (operand == 1) { - return 0; - } - - return 1; - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/BooleanOrOperator.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/BooleanOrOperator.java deleted file mode 100644 index d7c0aa8..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/BooleanOrOperator.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.operator; - -/** - * The boolean or operator. - */ -public class BooleanOrOperator extends AbstractOperator { - - /** - * Default constructor. - */ - public BooleanOrOperator() { - super("||", 1); - } - - /** - * Evaluates two double operands. - * - * @param leftOperand - * The left operand being evaluated. - * @param rightOperand - * The right operand being evaluated. - */ - public double evaluate(final double leftOperand, final double rightOperand) { - if (leftOperand == 1 || rightOperand == 1) { - return 1; - } - - return 0; - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/ClosedParenthesesOperator.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/ClosedParenthesesOperator.java deleted file mode 100644 index 825faf6..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/ClosedParenthesesOperator.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.operator; - -/** - * The closed parentheses operator. - */ -public class ClosedParenthesesOperator extends AbstractOperator { - - /** - * Default constructor. - */ - public ClosedParenthesesOperator() { - super(")", 0); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/DivisionOperator.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/DivisionOperator.java deleted file mode 100644 index 89092be..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/DivisionOperator.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.operator; - -/** - * The division operator. - */ -public class DivisionOperator extends AbstractOperator { - - /** - * Default constructor. - */ - public DivisionOperator() { - super("/", 6); - } - - /** - * Evaluates two double operands. - * - * @param leftOperand - * The left operand being evaluated. - * @param rightOperand - * The right operand being evaluated. - */ - public double evaluate(final double leftOperand, final double rightOperand) { - Double rtnValue = new Double(leftOperand / rightOperand); - - return rtnValue.doubleValue(); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/EqualOperator.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/EqualOperator.java deleted file mode 100644 index 0fc50f2..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/EqualOperator.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.operator; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; - -/** - * The equal operator. - */ -public class EqualOperator extends AbstractOperator { - - /** - * Default constructor. - */ - public EqualOperator() { - super("==", 3); - } - - /** - * Evaluates two double operands. - * - * @param leftOperand - * The left operand being evaluated. - * @param rightOperand - * The right operand being evaluated. - */ - public double evaluate(final double leftOperand, final double rightOperand) { - if (leftOperand == rightOperand) { - return 1; - } - - return 0; - } - - /** - * Evaluates two string operands. - * - * @param leftOperand - * The left operand being evaluated. - * @param rightOperand - * The right operand being evaluated. - */ - public String evaluate(String leftOperand, String rightOperand) { - if (leftOperand.compareTo(rightOperand) == 0) { - return EvaluationConstants.BOOLEAN_STRING_TRUE; - } - - return EvaluationConstants.BOOLEAN_STRING_FALSE; - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/GreaterThanOperator.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/GreaterThanOperator.java deleted file mode 100644 index 7b96ea9..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/GreaterThanOperator.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.operator; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; - -/** - * The greater than operator. - */ -public class GreaterThanOperator extends AbstractOperator { - /** - * Default constructor. - */ - public GreaterThanOperator() { - super(">", 4); - } - - /** - * Evaluates two double operands. - * - * @param leftOperand - * The left operand being evaluated. - * @param rightOperand - * The right operand being evaluated. - */ - public double evaluate(final double leftOperand, final double rightOperand) { - if (leftOperand > rightOperand) { - return 1; - } - - return 0; - } - - /** - * Evaluates two string operands. - * - * @param leftOperand - * The left operand being evaluated. - * @param rightOperand - * The right operand being evaluated. - */ - public String evaluate(final String leftOperand, final String rightOperand) { - if (leftOperand.compareTo(rightOperand) > 0) { - return EvaluationConstants.BOOLEAN_STRING_TRUE; - } - - return EvaluationConstants.BOOLEAN_STRING_FALSE; - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/GreaterThanOrEqualOperator.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/GreaterThanOrEqualOperator.java deleted file mode 100644 index c1a0360..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/GreaterThanOrEqualOperator.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.operator; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; - -/** - * The greater than or equal operator. - */ -public class GreaterThanOrEqualOperator extends AbstractOperator { - /** - * Default constructor. - */ - public GreaterThanOrEqualOperator() { - super(">=", 4); - } - - /** - * Evaluates two double operands. - * - * @param leftOperand - * The left operand being evaluated. - * @param rightOperand - * The right operand being evaluated. - */ - public double evaluate(final double leftOperand, final double rightOperand) { - if (leftOperand >= rightOperand) { - return 1; - } - - return 0; - } - - /** - * Evaluates two string operands. - * - * @param leftOperand - * The left operand being evaluated. - * @param rightOperand - * The right operand being evaluated. - */ - public String evaluate(final String leftOperand, final String rightOperand) { - if (leftOperand.compareTo(rightOperand) >= 0) { - return EvaluationConstants.BOOLEAN_STRING_TRUE; - } - - return EvaluationConstants.BOOLEAN_STRING_FALSE; - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/LessThanOperator.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/LessThanOperator.java deleted file mode 100644 index 304bd5c..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/LessThanOperator.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.operator; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; - -/** - * The less than operator. - */ -public class LessThanOperator extends AbstractOperator { - - /** - * Default constructor. - */ - public LessThanOperator() { - super("<", 4); - } - - /** - * Evaluates two double operands. - * - * @param leftOperand - * The left operand being evaluated. - * @param rightOperand - * The right operand being evaluated. - */ - public double evaluate(final double leftOperand, final double rightOperand) { - if (leftOperand < rightOperand) { - return 1; - } - - return 0; - } - - /** - * Evaluates two string operands. - * - * @param leftOperand - * The left operand being evaluated. - * @param rightOperand - * The right operand being evaluated. - */ - public String evaluate(final String leftOperand, final String rightOperand) { - if (leftOperand.compareTo(rightOperand) < 0) { - return EvaluationConstants.BOOLEAN_STRING_TRUE; - } - - return EvaluationConstants.BOOLEAN_STRING_FALSE; - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/LessThanOrEqualOperator.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/LessThanOrEqualOperator.java deleted file mode 100644 index 44b287c..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/LessThanOrEqualOperator.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.operator; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; - -/** - * The less than or equal operator. - */ -public class LessThanOrEqualOperator extends AbstractOperator { - - /** - * Default constructor. - */ - public LessThanOrEqualOperator() { - super("<=", 4); - } - - /** - * Evaluates two double operands. - * - * @param leftOperand - * The left operand being evaluated. - * @param rightOperand - * The right operand being evaluated. - */ - public double evaluate(final double leftOperand, final double rightOperand) { - if (leftOperand <= rightOperand) { - return 1; - } - - return 0; - } - - /** - * Evaluates two string operands. - * - * @param leftOperand - * The left operand being evaluated. - * @param rightOperand - * The right operand being evaluated. - */ - public String evaluate(String leftOperand, String rightOperand) { - if (leftOperand.compareTo(rightOperand) <= 0) { - return EvaluationConstants.BOOLEAN_STRING_TRUE; - } - - return EvaluationConstants.BOOLEAN_STRING_FALSE; - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/ModulusOperator.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/ModulusOperator.java deleted file mode 100644 index 4e8d5c1..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/ModulusOperator.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.operator; - -/** - * The modulus operator. - */ -public class ModulusOperator extends AbstractOperator { - - /** - * Default constructor. - */ - public ModulusOperator() { - super("%", 6); - } - - /** - * Evaluates two double operands. - * - * @param leftOperand - * The left operand being evaluated. - * @param rightOperand - * The right operand being evaluated. - */ - public double evaluate(final double leftOperand, final double rightOperand) { - Double rtnValue = new Double(leftOperand % rightOperand); - - return rtnValue.doubleValue(); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/MultiplicationOperator.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/MultiplicationOperator.java deleted file mode 100644 index 71026a4..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/MultiplicationOperator.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.operator; - -/** - * The multiplication operator. - */ -public class MultiplicationOperator extends AbstractOperator { - - /** - * Default constructor. - */ - public MultiplicationOperator() { - super("*", 6); - } - - /** - * Evaluates two double operands. - * - * @param leftOperand - * The left operand being evaluated. - * @param rightOperand - * The right operand being evaluated. - */ - public double evaluate(final double leftOperand, final double rightOperand) { - Double rtnValue = new Double(leftOperand * rightOperand); - - return rtnValue.doubleValue(); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/NotEqualOperator.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/NotEqualOperator.java deleted file mode 100644 index 60af1db..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/NotEqualOperator.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.operator; - -import com.baoying.enginex.executor.util.jeval.EvaluationConstants; - -/** - * The not equal operator. - */ -public class NotEqualOperator extends AbstractOperator { - - /** - * Default constructor. - */ - public NotEqualOperator() { - super("!=", 3); - } - - /** - * Evaluates two double operands. - * - * @param leftOperand - * The left operand being evaluated. - * @param rightOperand - * The right operand being evaluated. - */ - public double evaluate(final double leftOperand, final double rightOperand) { - if (leftOperand != rightOperand) { - return 1; - } - - return 0; - } - - /** - * Evaluates two string operands. - * - * @param leftOperand - * The left operand being evaluated. - * @param rightOperand - * The right operand being evaluated. - */ - public String evaluate(String leftOperand, String rightOperand) { - if (leftOperand.compareTo(rightOperand) != 0) { - return EvaluationConstants.BOOLEAN_STRING_TRUE; - } - - return EvaluationConstants.BOOLEAN_STRING_FALSE; - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/OpenParenthesesOperator.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/OpenParenthesesOperator.java deleted file mode 100644 index b5eb5e1..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/OpenParenthesesOperator.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.operator; - -/** - * The open parentheses operator. - */ -public class OpenParenthesesOperator extends AbstractOperator { - - /** - * Default constructor. - */ - public OpenParenthesesOperator() { - super("(", 0); - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/Operator.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/Operator.java deleted file mode 100644 index 758091e..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/Operator.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.operator; - -import com.baoying.enginex.executor.util.jeval.EvaluationException; - -/** - * An oerator than can specified in an expression. - */ -public interface Operator { - - /** - * Evaluates two double operands. - * - * @param leftOperand - * The left operand being evaluated. - * @param rightOperand - * The right operand being evaluated. - */ - public abstract double evaluate(double leftOperand, double rightOperand); - - /** - * Evaluates two string operands. - * - * @param leftOperand - * The left operand being evaluated. - * @param rightOperand - * The right operand being evaluated. - * - * @return String The value of the evaluated operands. - * - * @exception EvaluateException - * Thrown when an error is found while evaluating the - * expression. - */ - public abstract String evaluate(final String leftOperand, - final String rightOperand) throws EvaluationException; - - /** - * Evaluate one double operand. - * - * @param operand - * The operand being evaluated. - */ - public abstract double evaluate(final double operand); - - /** - * Returns the character(s) that makes up the operator. - * - * @return The operator symbol. - */ - public abstract String getSymbol(); - - /** - * Returns the precedence given to this operator. - * - * @return The precedecne given to this operator. - */ - public abstract int getPrecedence(); - - /** - * Returns the length of the operator symbol. - * - * @return The length of the operator symbol. - */ - public abstract int getLength(); - - /** - * Returns an indicator of if the operator is unary or not. - * - * @return An indicator of if the operator is unary or not. - */ - public abstract boolean isUnary(); -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/SubtractionOperator.java b/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/SubtractionOperator.java deleted file mode 100644 index 9dbca9b..0000000 --- a/jar-enginex-runner/src/main/java/com/baoying/enginex/executor/util/jeval/operator/SubtractionOperator.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2002-2007 Robert Breidecker. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.baoying.enginex.executor.util.jeval.operator; - -/** - * The subtraction operator. - */ -public class SubtractionOperator extends AbstractOperator { - - /** - * Default constructor. - */ - public SubtractionOperator() { - super("-", 5, true); - } - - /** - * Evaluates two double operands. - * - * @param leftOperand - * The left operand being evaluated. - * @param rightOperand - * The right operand being evaluated. - */ - public double evaluate(final double leftOperand, final double rightOperand) { - Double rtnValue = new Double(leftOperand - rightOperand); - - return rtnValue.doubleValue(); - } - - /** - * Evaluate one double operand. - * - * @param operand - * The operand being evaluated. - */ - public double evaluate(final double operand) { - return -operand; - } -} \ No newline at end of file diff --git a/jar-enginex-runner/src/main/resources/application-dev.properties b/jar-enginex-runner/src/main/resources/application-dev.properties deleted file mode 100644 index 6181b46..0000000 --- a/jar-enginex-runner/src/main/resources/application-dev.properties +++ /dev/null @@ -1,38 +0,0 @@ -server.port=8081 - -logging.config=classpath:logging-config.xml - -# mysql -spring.datasource.default.url = jdbc:mysql://localhost:3306/riskmanage?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true -spring.datasource.default.username = root -spring.datasource.default.password = enginex513 -spring.datasource.default.driver-class-name = com.mysql.cj.jdbc.Driver - -# redis -redis.host=localhost -redis.port=6379 -redis.db=1 -redis.password=localhost -redis.pool.maxTotal=3000 -redis.pool.maxIdle=100 -redis.pool.maxWait=1000 -redis.pool.timeout=100000 - -# mail -spring.mail.host=smtp.exmail.qq.com -spring.mail.username=xxx -spring.mail.password=xxx -spring.mail.port=465 -spring.mail.properties.mail.smtp.auth=true -spring.mail.properties.mail.smtp.timeout=50000 -spring.mail.properties.mail.smtp.starttls.enable=true -spring.mail.properties.mail.smtp.socketFactory.port=465 -spring.mail.properties.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory -spring.mail.properties.mail.smtp.socketFactory.fallback=false - -# canal -switch.use.cache=off -switch.canal.cache=off -canal.hostname=localhost -canal.port=11111 - diff --git a/jar-enginex-runner/src/main/resources/application-prod.properties b/jar-enginex-runner/src/main/resources/application-prod.properties deleted file mode 100644 index 2dbd1b7..0000000 --- a/jar-enginex-runner/src/main/resources/application-prod.properties +++ /dev/null @@ -1,45 +0,0 @@ -server.port=8081 - -logging.config=classpath:logging-config.xml - -# mysql -spring.datasource.default.url = jdbc:mysql://localhost:3306/riskmanage?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true -spring.datasource.default.username = root -spring.datasource.default.password = enginex513! -spring.datasource.default.driver-class-name = com.mysql.cj.jdbc.Driver - -# redis -redis.host=localhost -redis.port=6379 -redis.db=1 -redis.password=localhost -redis.pool.maxTotal=3000 -redis.pool.maxIdle=100 -redis.pool.maxWait=1000 -redis.pool.timeout=100000 - -# mail -spring.mail.host=smtp.exmail.qq.com -spring.mail.username=xxx -spring.mail.password=xxx -spring.mail.port=465 -spring.mail.properties.mail.smtp.auth=true -spring.mail.properties.mail.smtp.timeout=50000 -spring.mail.properties.mail.smtp.starttls.enable=true -spring.mail.properties.mail.smtp.socketFactory.port=465 -spring.mail.properties.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory -spring.mail.properties.mail.smtp.socketFactory.fallback=false - -# hbase -spring.data.hbase.quorum: localhost:2181 -spring.data.hbase.rootDir: /usr/local/hbase/datatest -spring.data.hbase.nodeParent: /hbase - -# canal -switch.use.cache=off -switch.canal.cache=off -canal.hostname=localhost -canal.port=11111 - -# \u76D1\u63A7\u4E2D\u5FC3 \u6570\u636E\u5B58\u50A8\u65B9\u5F0F mysql \u6216\u8005 hbase -monitor.data.storage.type=mysql \ No newline at end of file diff --git a/jar-enginex-runner/src/main/resources/application-test.properties b/jar-enginex-runner/src/main/resources/application-test.properties deleted file mode 100644 index 1cae7c9..0000000 --- a/jar-enginex-runner/src/main/resources/application-test.properties +++ /dev/null @@ -1,45 +0,0 @@ -server.port=8081 - -logging.config=classpath:logging-config.xml - -# mysql -spring.datasource.default.url = jdbc:mysql://localhost:3306/riskmanage?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true -spring.datasource.default.username = root -spring.datasource.default.password = enginex513 -spring.datasource.default.driver-class-name = com.mysql.cj.jdbc.Driver - -# redis -redis.host=localhost -redis.port=6379 -redis.db=1 -redis.password=enginex123 -redis.pool.maxTotal=3000 -redis.pool.maxIdle=100 -redis.pool.maxWait=1000 -redis.pool.timeout=100000 - -# mail -spring.mail.host=smtp.exmail.qq.com -spring.mail.username=xxx -spring.mail.password=xxx -spring.mail.port=465 -spring.mail.properties.mail.smtp.auth=true -spring.mail.properties.mail.smtp.timeout=50000 -spring.mail.properties.mail.smtp.starttls.enable=true -spring.mail.properties.mail.smtp.socketFactory.port=465 -spring.mail.properties.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory -spring.mail.properties.mail.smtp.socketFactory.fallback=false - -# hbase -spring.data.hbase.quorum: localhost:2181 -spring.data.hbase.rootDir: /usr/local/hbase/datatest -spring.data.hbase.nodeParent: /hbase - -# canal -switch.use.cache=off -switch.canal.cache=on -canal.hostname=localhost -canal.port=11111 - -# \u76D1\u63A7\u4E2D\u5FC3 \u6570\u636E\u5B58\u50A8\u65B9\u5F0F mysql \u6216\u8005 hbase -monitor.data.storage.type=mysql \ No newline at end of file diff --git a/jar-enginex-runner/src/main/resources/application.properties b/jar-enginex-runner/src/main/resources/application.properties deleted file mode 100644 index 257b306..0000000 --- a/jar-enginex-runner/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ -spring.profiles.active=dev \ No newline at end of file diff --git a/jar-enginex-runner/src/main/resources/logging-config.xml b/jar-enginex-runner/src/main/resources/logging-config.xml deleted file mode 100644 index fc9a3ec..0000000 --- a/jar-enginex-runner/src/main/resources/logging-config.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/jar-enginex-runner/src/test/java/com/baoying/enginex/executor/JarEnginexExecutorApplicationTests.java b/jar-enginex-runner/src/test/java/com/baoying/enginex/executor/JarEnginexExecutorApplicationTests.java deleted file mode 100644 index 64d7062..0000000 --- a/jar-enginex-runner/src/test/java/com/baoying/enginex/executor/JarEnginexExecutorApplicationTests.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.baoying.enginex.executor; - -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -@SpringBootTest -class JarEnginexExecutorApplicationTests { - - @Test - void contextLoads() { - } - -} diff --git a/jar-enginex-runner/src/test/java/com/baoying/enginex/executor/JevalTest.java b/jar-enginex-runner/src/test/java/com/baoying/enginex/executor/JevalTest.java deleted file mode 100644 index 4b25ac9..0000000 --- a/jar-enginex-runner/src/test/java/com/baoying/enginex/executor/JevalTest.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.baoying.enginex.executor; - -import com.baoying.enginex.executor.util.JevalUtil; -import com.baoying.enginex.executor.util.jeval.EvaluationException; -import com.baoying.enginex.executor.util.jeval.Evaluator; - -import java.util.HashMap; - -public class JevalTest { - public static void main(String[] args) throws EvaluationException { - HashMap map = new HashMap<>(); - map.put("ceshiyong","'a'"); - String expression = "(contains(#{ceshiyong},'a'))"; - System.out.println(JevalUtil.evaluateBoolean(expression.toString(), map)); - } -} diff --git a/jar-enginex-runner/src/test/java/com/baoying/enginex/executor/RegexTest.java b/jar-enginex-runner/src/test/java/com/baoying/enginex/executor/RegexTest.java deleted file mode 100644 index 629cac1..0000000 --- a/jar-enginex-runner/src/test/java/com/baoying/enginex/executor/RegexTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.baoying.enginex.executor; - -import com.alibaba.fastjson.JSON; -import com.baoying.enginex.executor.util.ExecuteUtils; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class RegexTest { - public static void main(String[] args) { - Pattern pattern$ = Pattern.compile("\\$\\{[a-zA-Z0-9_\u4e00-\u9fa5()()-]+\\}"); - Matcher matcher$ = pattern$.matcher("${aa}"); - - while (matcher$.find()){ - System.out.println(matcher$.group()); - } -// System.out.println("".matches("大abcd")); -// Pattern pattern = Pattern.compile("(abcd)+"); -// Pattern pattern = Pattern.compile("(\\[(0|([1-9]([0-9])*))\\])+$"); -// Matcher matcher = pattern.matcher("addd[0][1][2][3][4][5]"); -// -// System.out.println(matcher.find()); -// System.out.println(matcher.group(0)); -// String fieldEnStr = "a.s.d.1.2.3."; -// System.out.println(JSON.toJSONString(fieldEnStr.split("\\."))); - } - private static void testRegex(){ - String formula = "@1@2@3@4@5@6@7@"; - Pattern pattern = Pattern.compile("@[a-zA-Z0-9_\u4e00-\u9fa5()()-]+@"); - Matcher matcher = pattern.matcher(formula); - while (matcher.find()) { - String fieldEn = matcher.group().replace("@", ""); - System.out.println(matcher.group()); - } - } -} diff --git a/jar-enginex-runner/src/test/java/com/baoying/enginex/executor/grouping/Auth.java b/jar-enginex-runner/src/test/java/com/baoying/enginex/executor/grouping/Auth.java deleted file mode 100644 index da71fa2..0000000 --- a/jar-enginex-runner/src/test/java/com/baoying/enginex/executor/grouping/Auth.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.baoying.enginex.executor.grouping; - -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -public class Auth { - private Integer id; - private String name; -} diff --git a/jar-enginex-runner/src/test/java/com/baoying/enginex/executor/grouping/GroupTest.java b/jar-enginex-runner/src/test/java/com/baoying/enginex/executor/grouping/GroupTest.java deleted file mode 100644 index afb66ca..0000000 --- a/jar-enginex-runner/src/test/java/com/baoying/enginex/executor/grouping/GroupTest.java +++ /dev/null @@ -1,250 +0,0 @@ -package com.baoying.enginex.executor.grouping; - -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import org.junit.platform.commons.util.StringUtils; - -import java.awt.*; -import java.util.*; -import java.util.List; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; - -public class GroupTest { - public static void main(String[] args) { -// test2(); -// test3(); -// test1(); - test4(); - - } - public static void test1(){ - List list = new ArrayList(); - for (int i = 0; i < 100; i++) { - list.add(new User(i,"用户 : "+i,i%10+18,new Role((int)(Math.random()*10+1),"角色 : "+i%10,new Auth((int)(Math.random()*10+1),"权限 : "+i%20)))); - } - Map> result = new HashMap<>(); - - Map> collect = list.stream().collect(Collectors.groupingBy(user -> user.getAge())); - for (Map.Entry> entry : collect.entrySet()) { - Integer key = entry.getKey(); - Map> collect1 = entry.getValue().stream().collect(Collectors.groupingByConcurrent(user -> user.getRole().getId())); - for (Map.Entry> childEntry : collect1.entrySet()) { - result.put(""+key+":"+childEntry.getKey(),childEntry.getValue()); - } - } -// System.out.println(collect); - } -// public static void handlerGroup(Map> param,List keys){ -// Map> result = new HashMap<>(); -// for (Map.Entry> listEntry : param.entrySet()) { -// //前一次分组时的key -// String parentKey = listEntry.getKey(); -// //第一次分组完成的一个数组 -// List list = listEntry.getValue(); -// //默认key为父级key -// String resultKey = parentKey; -// -// for (String key : keys) { -// Map> collect = list.stream().collect(Collectors.groupingBy(json -> json.get(key).toString())); -// for (Map.Entry> childEntry : collect.entrySet()) { -// resultKey += (":"+ childEntry.getKey()); -// result.put(resultKey,childEntry.getValue()); -// } -// -// } -// } -// } - - - public static void test2(){ - List> list = new ArrayList(); - Map map = null; - for (int i = 0; i < 100; i++) { - map = new HashMap(); - map.put("id",i); - map.put("name","用户 : "+i); - map.put("age",i%10); - list.add(map); - } - Map>> collect = list.stream().collect(Collectors.groupingBy(item -> item.get("age"))); - - for (Map.Entry>> entry : collect.entrySet()) { - System.out.println(entry.getKey()); - System.out.println(entry.getValue()); - System.out.println(entry.getValue().size()); - } - } - - public static void test3(){ - List> list = new ArrayList(); - JSONObject map = null; - for (int i = 0; i < 100; i++) { - map = new JSONObject(); - map.put("id",i); - map.put("name","用户 : "+i); - map.put("age",i%10); - list.add(map); - } - Map>> collect = list.stream().collect(Collectors.groupingBy(item -> item.get("age"))); - - for (Map.Entry>> entry : collect.entrySet()) { - System.out.println(entry.getKey()); - System.out.println(entry.getValue()); - System.out.println(entry.getValue().size()); - } - - } - - public static void test4(){ - List list = new ArrayList(); - JSONObject map = null; - List authList; - for (int i = 0; i < 10000; i++) { - map = new JSONObject(); - map.put("id",i%5); - map.put("name","用户"+i%3); - map.put("age",i%13); - authList = new ArrayList<>(); - authList.add(new Auth(i%7,"权限"+i%7)); - map.put("role",new Role(i%11,"角色"+i%7,null,authList)); - - list.add(map); - } - -// Map> stringListMap = handlerGroup(list, Arrays.asList("age", "name", "id","role.id")); - Map> stringListMap = recursionGroup(list, Arrays.asList("age", "name", "role.name","role.authList[0].name")); - System.out.println(stringListMap); - } - -// public static Map> handlerGroup(List param, List keys ){ -// //没有给分组的key则直接返回 -// if (keys==null||keys.isEmpty()){ -// return null; -// } -// Map> result = recursionGroup(param, keys,0,""); -// return result; -// } -// -// public static Map> recursionGroup(List param,List keys,int index,String parentKey){ -// -// if (StringUtils.isNotBlank(parentKey)){ -// parentKey+=":"; -// } -// final String preKey = parentKey; -// Map> result = new HashMap<>(); -// -// Map> temp = new HashMap<>(); -// if (keys.get(index)!=null){ -// //做本次分组 -// Map> collect = param.stream().collect(Collectors.groupingBy(json -> { -// String[] split = keys.get(index).split("\\."); -// if (split.length>1){ -// JSONObject jsonObject = json; -// for (int i = 0; i < split.length; i++) { -// if (iindex+1){ -// //执行分组 -// for (Map.Entry> entry : collect.entrySet()) { -// temp.putAll(recursionGroup(entry.getValue(),keys,index+1,entry.getKey())); -// } -// }else { -// temp = collect; -// } -// }else { -// //没有分组的key无法执行 -// } -// result = temp.entrySet().stream().collect(Collectors.toMap(item->preKey+item.getKey(),item->item.getValue())); -// return result; -// } - - public static Map> recursionGroup(List param,List keys){ - return param.stream().collect(Collectors.groupingBy(item->{ - String cond = ""; - for (String key : keys) { - if (StringUtils.isNotBlank(cond)){ - cond+=":"; - } - String[] split = key.split("\\."); - if (split.length>1){ - JSONObject jsonObject = item; - for (int i = 0; i < split.length; i++) { - if (i authList; - - public Role(Integer id, String name, Auth auth, List authList) { - this.id = id; - this.name = name; - this.auth = auth; - this.authList = authList; - } - - public Role(Integer id, String name, Auth auth) { - this.id = id; - this.name = name; - this.auth = auth; - } -} diff --git a/jar-enginex-runner/src/test/java/com/baoying/enginex/executor/grouping/User.java b/jar-enginex-runner/src/test/java/com/baoying/enginex/executor/grouping/User.java deleted file mode 100644 index b7f2792..0000000 --- a/jar-enginex-runner/src/test/java/com/baoying/enginex/executor/grouping/User.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.baoying.enginex.executor.grouping; - -import lombok.AllArgsConstructor; -import lombok.Data; - -@Data -@AllArgsConstructor -public class User { - private Integer id; - private String name; - private Integer age; - private Role role; -} diff --git a/jar-enginex-runner/src/test/java/com/baoying/enginex/executor/sql/RedisTest.java b/jar-enginex-runner/src/test/java/com/baoying/enginex/executor/sql/RedisTest.java deleted file mode 100644 index c2b6194..0000000 --- a/jar-enginex-runner/src/test/java/com/baoying/enginex/executor/sql/RedisTest.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.baoying.enginex.executor.sql; - -import redis.clients.jedis.*; - -import java.util.List; - -public class RedisTest { - public static void main(String[] args) { -// JedisPoolConfig config = new JedisPoolConfig(); -// config.setMaxTotal(1); -// config.setMaxIdle(1); -// config.setMaxWaitMillis(3000); -// config.setTestOnBorrow(true); -// config.setTestOnReturn(true); -// -// JedisPool pool = new JedisPool(config, -// "127.0.0.1", -// 6379, -// 3000, -// "root", -// 1); -// Jedis jedis = pool.getResource(); - JedisShardInfo jedisShardInfo = new JedisShardInfo("47.102.125.25",6379,3000,"root"); - jedisShardInfo.setPassword("enginex123"); - Jedis jedis = new Jedis(jedisShardInfo); - jedis.select(1); - if (jedis.isConnected()){ - - Object eval = jedis.eval("local result = 0;\n" + - "local flag = true;\n" + - "local cursor = '0';\n" + - "while(flag)\n" + - "do\n" + - "local scanResult = redis.call('hscan','THRESHOLD_MOBILE_DAY:20211116:手机号1',cursor ,'match','12*');\n" + - "cursor = scanResult[1];\n" + - " for k, v in pairs(scanResult[2]) do\n" + - " if k%2 == 0 then\n" + - " result = result+v;\n" + - " end\n" + - " end\n" + - " if scanResult == nil or cursor == '0'then\n" + - " flag = false;\n" + - " end\n" + - "end\n" + - "return result;"); - -// System.out.println(jedis.eval("return redis.call('get', 'test1')")); -// Object eval = jedis.eval("return redis.call('LRANGE', 'list1' , 0 , -1)"); - long value = 0; - if (eval instanceof List){ - System.out.println(eval); - List result = (List) eval; - - if (result.get(1) instanceof List){ - System.out.println(result.get(1)); - List kv = (List)result.get(1); - for (int i = 0; i < kv.size(); i++) { - if (i%2 == 0){ - continue; - } - value += Long.valueOf(kv.get(i)); - } - - } - - } - - System.out.println(value); -// String aaa = jedis.get("test1"); -// System.out.println(aaa); - } - - - } -} diff --git a/jar-enginex-runner/src/test/java/com/baoying/enginex/executor/sql/SqlForTest.java b/jar-enginex-runner/src/test/java/com/baoying/enginex/executor/sql/SqlForTest.java deleted file mode 100644 index ea73f20..0000000 --- a/jar-enginex-runner/src/test/java/com/baoying/enginex/executor/sql/SqlForTest.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.baoying.enginex.executor.sql; - -import com.alibaba.fastjson.JSON; -import com.baoying.enginex.executor.datamanage.mapper.SimpleMapper; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import java.util.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -//@SpringBootTest -//@RunWith(SpringRunner.class) -public class SqlForTest { - - @Autowired - private SimpleMapper simpleMapper; - @Test - public void testForSql(){ - - String sqlStr = " select * from t_list_db " + - " where id in " + - " \n" + - " #{item}\n" + - " "; - Map param = new HashMap<>(); - param.put("sqlStr",sqlStr); - List ids = new ArrayList<>(); - ids.add(112L); - ids.add(114L); - ids.add(115L); - param.put("list",ids); - List> test = simpleMapper.test(param); - - System.out.println(JSON.toJSONString(test)); - - } - - public static void main(String[] args) { - String sqlStr = " select * from t_list_db " + - " where id in ( #{aaaa} )"; - Pattern sqlnPattern = Pattern.compile("\\s*in\\s*\\(\\s*#\\{([a-zA-Z0-9_\u4e00-\u9fa5()()-]+)\\}\\s*\\)"); - Matcher matcher = sqlnPattern.matcher(sqlStr); - if ( matcher.find()){ - System.out.println(matcher.group(0)); - } - } -}