Commit 231fd68435320fe68dd2065e37cb219db11cb74e
Merge remote-tracking branch 'upstream/develop' into crm-msg
Showing
102 changed files
with
2825 additions
and
969 deletions
Too many changes.
To preserve performance only 100 of 102 files are displayed.
sql/mysql/Ureport.sql renamed to sql/mysql/optinal/Ureport.sql
sql/mysql/optinal/crm.sql deleted
| 1 | --- `ruoyi-vue-pro`.crm_contact_business_link definition | ||
| 2 | - | ||
| 3 | -CREATE TABLE `crm_contact_business` ( | ||
| 4 | - `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键', | ||
| 5 | - `contact_id` int(11) DEFAULT NULL COMMENT '联系人id', | ||
| 6 | - `business_id` int(11) DEFAULT NULL COMMENT '商机id', | ||
| 7 | - `creator` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', | ||
| 8 | - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 9 | - `updater` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', | ||
| 10 | - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 11 | - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 12 | - `tenant_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '租户编号', | ||
| 13 | - PRIMARY KEY (`id`) | ||
| 14 | -) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='联系人商机关联表'; | ||
| 15 | \ No newline at end of file | 0 | \ No newline at end of file |
sql/mysql/optinal/mall.sql deleted
sql/mysql/optinal/pay_wallet.sql deleted
| 1 | --- ---------------------------- | ||
| 2 | --- 转账单表 | ||
| 3 | --- ---------------------------- | ||
| 4 | -DROP TABLE IF EXISTS `pay_transfer`; | ||
| 5 | -CREATE TABLE `pay_transfer` | ||
| 6 | -( | ||
| 7 | - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', | ||
| 8 | - `no` varchar(64) NOT NULL COMMENT '转账单号', | ||
| 9 | - `app_id` bigint NOT NULL COMMENT '应用编号', | ||
| 10 | - `channel_id` bigint NOT NULL COMMENT '转账渠道编号', | ||
| 11 | - `channel_code` varchar(32) NOT NULL COMMENT '转账渠道编码', | ||
| 12 | - `merchant_transfer_id` varchar(64) NOT NULL COMMENT '商户转账单编号', | ||
| 13 | - `type` int NOT NULL COMMENT '类型', | ||
| 14 | - `status` tinyint NOT NULL COMMENT '转账状态', | ||
| 15 | - `success_time` datetime NULL COMMENT '转账成功时间', | ||
| 16 | - `price` int NOT NULL COMMENT '转账金额,单位:分', | ||
| 17 | - `subject` varchar(512) NOT NULL COMMENT '转账标题', | ||
| 18 | - `user_name` varchar(64) NULL COMMENT '收款人姓名', | ||
| 19 | - `alipay_logon_id` varchar(64) NULL COMMENT '支付宝登录号', | ||
| 20 | - `openid` varchar(64) NULL COMMENT '微信 openId', | ||
| 21 | - `notify_url` varchar(1024) NOT NULL COMMENT '异步通知商户地址', | ||
| 22 | - `user_ip` varchar(50) NOT NULL COMMENT '用户 IP', | ||
| 23 | - `channel_extras` varchar(512) NULL DEFAULT NULL COMMENT '渠道的额外参数', | ||
| 24 | - `channel_transfer_no` varchar(64) NULL DEFAULT NULL COMMENT '渠道转账单号', | ||
| 25 | - `channel_error_code` varchar(128) NULL DEFAULT NULL COMMENT '调用渠道的错误码', | ||
| 26 | - `channel_error_msg` varchar(256) NULL DEFAULT NULL COMMENT '调用渠道的错误提示', | ||
| 27 | - `channel_notify_data` varchar(4096) NULL DEFAULT NULL COMMENT '渠道的同步/异步通知的内容', | ||
| 28 | - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | ||
| 29 | - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 30 | - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | ||
| 31 | - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 32 | - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 33 | - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | ||
| 34 | - PRIMARY KEY (`id`) USING BTREE | ||
| 35 | -) ENGINE=InnoDB COMMENT='转账单表'; | ||
| 36 | - | ||
| 37 | --- ---------------------------- | ||
| 38 | --- Table structure for pay_demo_transfer | ||
| 39 | --- ---------------------------- | ||
| 40 | -DROP TABLE IF EXISTS `pay_demo_transfer`; | ||
| 41 | -CREATE TABLE `pay_demo_transfer` ( | ||
| 42 | - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '订单编号', | ||
| 43 | - `app_id` bigint NOT NULL COMMENT '应用编号', | ||
| 44 | - `type` int NOT NULL COMMENT '转账类型', | ||
| 45 | - `price` int NOT NULL COMMENT '转账金额,单位:分', | ||
| 46 | - `user_name` varchar(64) NULL COMMENT '收款人姓名', | ||
| 47 | - `alipay_logon_id` varchar(64) NULL COMMENT '支付宝登录号', | ||
| 48 | - `openid` varchar(64) NULL COMMENT '微信 openId', | ||
| 49 | - `transfer_status` tinyint NOT NULL DEFAULT 0 COMMENT '转账状态', | ||
| 50 | - `pay_transfer_id` bigint NULL DEFAULT NULL COMMENT '转账订单编号', | ||
| 51 | - `pay_channel_code` varchar(16) NULL DEFAULT NULL COMMENT '转账支付成功渠道', | ||
| 52 | - `transfer_time` datetime NULL DEFAULT NULL COMMENT '转账支付时间', | ||
| 53 | - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '创建者', | ||
| 54 | - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 55 | - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '更新者', | ||
| 56 | - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 57 | - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 58 | - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | ||
| 59 | - PRIMARY KEY (`id`) USING BTREE | ||
| 60 | -) ENGINE = InnoDB COMMENT = '示例业务转账订单'; | ||
| 61 | - | ||
| 62 | - | ||
| 63 | --- ALTER TABLE `pay_channel` | ||
| 64 | --- MODIFY COLUMN `config` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '支付渠道配置' AFTER `app_id`; | ||
| 65 | - | ||
| 66 | --- ---------------------------- | ||
| 67 | --- 充值套餐表 | ||
| 68 | --- ---------------------------- | ||
| 69 | -DROP TABLE IF EXISTS `pay_wallet_recharge_package`; | ||
| 70 | -CREATE TABLE `pay_wallet_recharge_package` | ||
| 71 | -( | ||
| 72 | - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', | ||
| 73 | - `name` varchar(64) NOT NULL COMMENT '套餐名', | ||
| 74 | - `pay_price` int NOT NULL COMMENT '支付金额', | ||
| 75 | - `bonus_price` int NOT NULL COMMENT '赠送金额', | ||
| 76 | - `status` tinyint NOT NULL COMMENT '状态', | ||
| 77 | - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '创建者', | ||
| 78 | - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 79 | - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | ||
| 80 | - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 81 | - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 82 | - `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', | ||
| 83 | - PRIMARY KEY (`id`) USING BTREE | ||
| 84 | -) ENGINE=InnoDB COMMENT='充值套餐表'; | ||
| 85 | - | ||
| 86 | --- ---------------------------- | ||
| 87 | --- Table structure for pay_wallet_recharge | ||
| 88 | --- ---------------------------- | ||
| 89 | -DROP TABLE IF EXISTS `pay_wallet_recharge`; | ||
| 90 | -CREATE TABLE `pay_wallet_recharge` ( | ||
| 91 | - `id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '编号', | ||
| 92 | - `wallet_id` bigint(0) NOT NULL COMMENT '会员钱包 id', | ||
| 93 | - `total_price` int(0) NOT NULL COMMENT '用户实际到账余额,例如充 100 送 20,则该值是 120', | ||
| 94 | - `pay_price` int(0) NOT NULL COMMENT '实际支付金额', | ||
| 95 | - `bonus_price` int(0) NOT NULL COMMENT '钱包赠送金额', | ||
| 96 | - `package_id` bigint(0) DEFAULT NULL COMMENT '充值套餐编号', | ||
| 97 | - `pay_status` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否已支付:[0:未支付 1:已经支付过]', | ||
| 98 | - `pay_order_id` bigint(0) DEFAULT NULL COMMENT '支付订单编号', | ||
| 99 | - `pay_channel_code` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '支付成功的支付渠道', | ||
| 100 | - `pay_time` datetime(0) DEFAULT NULL COMMENT '订单支付时间', | ||
| 101 | - `pay_refund_id` bigint(0) DEFAULT NULL COMMENT '支付退款单编号', | ||
| 102 | - `refund_total_price` int(0) NOT NULL DEFAULT 0 COMMENT '退款金额,包含赠送金额', | ||
| 103 | - `refund_pay_price` int(0) NOT NULL DEFAULT 0 COMMENT '退款支付金额', | ||
| 104 | - `refund_bonus_price` int(0) NOT NULL DEFAULT 0 COMMENT '退款钱包赠送金额', | ||
| 105 | - `refund_time` datetime(0) DEFAULT NULL COMMENT '退款时间', | ||
| 106 | - `refund_status` int(0) NOT NULL DEFAULT 0 COMMENT '退款状态', | ||
| 107 | - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', | ||
| 108 | - `create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', | ||
| 109 | - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', | ||
| 110 | - `update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间', | ||
| 111 | - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | ||
| 112 | - `tenant_id` bigint(0) NOT NULL DEFAULT 0 COMMENT '租户编号', | ||
| 113 | - PRIMARY KEY (`id`) USING BTREE | ||
| 114 | -) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员钱包充值' ROW_FORMAT = Dynamic; | ||
| 115 | - | ||
| 116 | --- 钱包充值套餐,钱包余额菜单脚本 | ||
| 117 | - | ||
| 118 | -INSERT INTO system_menu( | ||
| 119 | - name, permission, type, sort, parent_id, | ||
| 120 | - path, icon, component, status, component_name | ||
| 121 | -) | ||
| 122 | -VALUES ( | ||
| 123 | - '钱包管理', '', 1, 5, 1117, | ||
| 124 | - 'wallet', 'ep:caret-right', '', 0, '' | ||
| 125 | - ); | ||
| 126 | -SELECT @parentId1 := LAST_INSERT_ID(); | ||
| 127 | - | ||
| 128 | -INSERT INTO system_menu( | ||
| 129 | - name, permission, type, sort, parent_id, | ||
| 130 | - path, icon, component, status, component_name | ||
| 131 | -) | ||
| 132 | -VALUES ( | ||
| 133 | - '充值套餐', '', 2, 2, @parentId1, | ||
| 134 | - 'wallet-recharge-package', 'fa:leaf', 'pay/wallet/rechargePackage/index', 0, 'WalletRechargePackage' | ||
| 135 | - ); | ||
| 136 | -SELECT @parentId := LAST_INSERT_ID(); | ||
| 137 | - | ||
| 138 | --- 按钮 SQL | ||
| 139 | -INSERT INTO system_menu( | ||
| 140 | - name, permission, type, sort, parent_id, | ||
| 141 | - path, icon, component, status | ||
| 142 | -) | ||
| 143 | -VALUES ( | ||
| 144 | - '钱包充值套餐查询', 'pay:wallet-recharge-package:query', 3, 1, @parentId, | ||
| 145 | - '', '', '', 0 | ||
| 146 | - ); | ||
| 147 | -INSERT INTO system_menu( | ||
| 148 | - name, permission, type, sort, parent_id, | ||
| 149 | - path, icon, component, status | ||
| 150 | -) | ||
| 151 | -VALUES ( | ||
| 152 | - '钱包充值套餐创建', 'pay:wallet-recharge-package:create', 3, 2, @parentId, | ||
| 153 | - '', '', '', 0 | ||
| 154 | - ); | ||
| 155 | -INSERT INTO system_menu( | ||
| 156 | - name, permission, type, sort, parent_id, | ||
| 157 | - path, icon, component, status | ||
| 158 | -) | ||
| 159 | -VALUES ( | ||
| 160 | - '钱包充值套餐更新', 'pay:wallet-recharge-package:update', 3, 3, @parentId, | ||
| 161 | - '', '', '', 0 | ||
| 162 | - ); | ||
| 163 | -INSERT INTO system_menu( | ||
| 164 | - name, permission, type, sort, parent_id, | ||
| 165 | - path, icon, component, status | ||
| 166 | -) | ||
| 167 | -VALUES ( | ||
| 168 | - '钱包充值套餐删除', 'pay:wallet-recharge-package:delete', 3, 4, @parentId, | ||
| 169 | - '', '', '', 0 | ||
| 170 | - ); | ||
| 171 | - | ||
| 172 | -INSERT INTO system_menu( | ||
| 173 | - name, permission, type, sort, parent_id, | ||
| 174 | - path, icon, component, status, component_name | ||
| 175 | -) | ||
| 176 | -VALUES ( | ||
| 177 | - '钱包余额', '', 2, 1, @parentId1, | ||
| 178 | - 'wallet-balance', 'fa:leaf', 'pay/wallet/balance/index', 0, 'WalletBalance' | ||
| 179 | - ); | ||
| 180 | - | ||
| 181 | -SELECT @parentId := LAST_INSERT_ID(); | ||
| 182 | - | ||
| 183 | --- 按钮 SQL | ||
| 184 | -INSERT INTO system_menu( | ||
| 185 | - name, permission, type, sort, parent_id, | ||
| 186 | - path, icon, component, status | ||
| 187 | -) | ||
| 188 | -VALUES ( | ||
| 189 | - '钱包余额查询', 'pay:wallet:query', 3, 1, @parentId, | ||
| 190 | - '', '', '', 0 | ||
| 191 | - ); | ||
| 192 | - | ||
| 193 | --- 支付实战和转账实战数据库脚本 | ||
| 194 | - | ||
| 195 | -update system_menu set deleted = 1 where id = 2161; | ||
| 196 | - | ||
| 197 | -INSERT INTO system_menu( | ||
| 198 | - name, permission, type, sort, parent_id, | ||
| 199 | - path, icon, component, status, component_name | ||
| 200 | -) | ||
| 201 | -VALUES ( | ||
| 202 | - '接入示例', '', 1, 99, 1117, | ||
| 203 | - 'demo', 'ep:caret-right', '', 0, '' | ||
| 204 | - ); | ||
| 205 | - | ||
| 206 | -SELECT @parentId1 := LAST_INSERT_ID(); | ||
| 207 | - | ||
| 208 | -INSERT INTO system_menu( | ||
| 209 | - name, permission, type, sort, parent_id, | ||
| 210 | - path, icon, component, status, component_name | ||
| 211 | -) | ||
| 212 | -VALUES ( | ||
| 213 | - '支付实战', '', 2, 1, @parentId1, | ||
| 214 | - 'demo-order', 'fa:leaf', 'pay/demo/order/index', 0, NULL | ||
| 215 | - ); | ||
| 216 | - | ||
| 217 | -INSERT INTO system_menu( | ||
| 218 | - name, permission, type, sort, parent_id, | ||
| 219 | - path, icon, component, status, component_name | ||
| 220 | -) | ||
| 221 | -VALUES ( | ||
| 222 | - '转账实战', '', 2, 1, @parentId1, | ||
| 223 | - 'demo-transfer', 'fa:leaf', 'pay/demo/transfer/index', 0, NULL | ||
| 224 | - ); | ||
| 225 | - | ||
| 226 | --- 转账状态和转账类型数据字典 | ||
| 227 | -INSERT INTO `system_dict_type`(`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES ('支付转账类型', 'pay_transfer_type', 0, '', '1', '2023-10-28 16:27:18', '1', '2023-10-28 16:27:18', b'0', '1970-01-01 00:00:00'); | ||
| 228 | -INSERT INTO `system_dict_type`(`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES ('转账订单状态', 'pay_transfer_status', 0, '', '1', '2023-10-28 16:18:32', '1', '2023-10-28 16:18:32', b'0', '1970-01-01 00:00:00'); | ||
| 229 | - | ||
| 230 | -INSERT INTO `system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (4, '钱包余额', '4', 'pay_transfer_type', 0, 'info', '', '', '1', '2023-10-28 16:28:37', '1', '2023-10-28 16:28:37', b'0'); | ||
| 231 | -INSERT INTO `system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3, '银行卡', '3', 'pay_transfer_type', 0, 'default', '', '', '1', '2023-10-28 16:28:21', '1', '2023-10-28 16:28:21', b'0'); | ||
| 232 | -INSERT INTO `system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2, '微信余额', '2', 'pay_transfer_type', 0, 'info', '', '', '1', '2023-10-28 16:28:07', '1', '2023-10-28 16:28:07', b'0'); | ||
| 233 | -INSERT INTO `system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '支付宝余额', '1', 'pay_transfer_type', 0, 'default', '', '', '1', '2023-10-28 16:27:44', '1', '2023-10-28 16:27:44', b'0'); | ||
| 234 | -INSERT INTO `system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (4, '转账失败', '30', 'pay_transfer_status', 0, 'warning', '', '', '1', '2023-10-28 16:24:16', '1', '2023-10-28 16:24:16', b'0'); | ||
| 235 | -INSERT INTO `system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3, '转账成功', '20', 'pay_transfer_status', 0, 'success', '', '', '1', '2023-10-28 16:23:50', '1', '2023-10-28 16:23:50', b'0'); | ||
| 236 | -INSERT INTO `system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2, '转账进行中', '10', 'pay_transfer_status', 0, 'info', '', '', '1', '2023-10-28 16:23:12', '1', '2023-10-28 16:23:12', b'0'); | ||
| 237 | -INSERT INTO `system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '等待转账', '0', 'pay_transfer_status', 0, 'default', '', '', '1', '2023-10-28 16:21:43', '1', '2023-10-28 16:23:22', b'0'); | ||
| 238 | - | ||
| 239 | --- 转账订单菜单脚本 | ||
| 240 | - | ||
| 241 | -INSERT INTO system_menu( | ||
| 242 | - name, permission, type, sort, parent_id, | ||
| 243 | - path, icon, component, status, component_name | ||
| 244 | -) | ||
| 245 | -VALUES ( | ||
| 246 | - '转账订单', '', 2, 3, 1117, | ||
| 247 | - 'transfer', 'ep:credit-card', 'pay/transfer/index', 0, 'PayTransfer' | ||
| 248 | - ); | ||
| 249 | - | ||
| 250 | --- 转账通知脚本 | ||
| 251 | - | ||
| 252 | -ALTER TABLE `pay_app` | ||
| 253 | - ADD COLUMN `transfer_notify_url` varchar(1024) NOT NULL COMMENT '转账结果的回调地址' AFTER `refund_notify_url`; | ||
| 254 | -ALTER TABLE `pay_notify_task` | ||
| 255 | - MODIFY COLUMN `merchant_order_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '商户订单编号' AFTER `status`, | ||
| 256 | - ADD COLUMN `merchant_transfer_id` varchar(64) COMMENT '商户转账单编号' AFTER `merchant_order_id`; | ||
| 257 | \ No newline at end of file | 0 | \ No newline at end of file |
sql/mysql/optinal/product_browse_history.sql deleted
| 1 | -CREATE TABLE product_browse_history | ||
| 2 | -( | ||
| 3 | - id bigint AUTO_INCREMENT COMMENT '记录编号' | ||
| 4 | - PRIMARY KEY, | ||
| 5 | - user_id bigint NOT NULL COMMENT '用户编号', | ||
| 6 | - spu_id bigint NOT NULL COMMENT '商品 SPU 编号', | ||
| 7 | - user_deleted bit DEFAULT b'0' NOT NULL COMMENT '用户是否删除', | ||
| 8 | - creator varchar(64) DEFAULT '' NULL COMMENT '创建者', | ||
| 9 | - create_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间', | ||
| 10 | - updater varchar(64) DEFAULT '' NULL COMMENT '更新者', | ||
| 11 | - update_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', | ||
| 12 | - deleted bit DEFAULT b'0' NOT NULL COMMENT '是否删除', | ||
| 13 | - tenant_id bigint DEFAULT 0 NOT NULL COMMENT '租户编号' | ||
| 14 | -) | ||
| 15 | - COMMENT '商品浏览记录表'; | ||
| 16 | - | ||
| 17 | -CREATE INDEX idx_spuId | ||
| 18 | - ON product_browse_history (spu_id); | ||
| 19 | - | ||
| 20 | -CREATE INDEX idx_userId | ||
| 21 | - ON product_browse_history (user_id); | ||
| 22 | - |
sql/mysql/ruoyi-vue-pro.sql
| @@ -2370,6 +2370,7 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i | @@ -2370,6 +2370,7 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i | ||
| 2370 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2369, '拼团记录', 'promotion:combination-record:query', 2, 2, 2303, 'record', 'ep:avatar', 'mall/promotion/combination/record/index.vue', 'PromotionCombinationRecord', 0, b'1', b'1', b'1', '1', '2023-10-08 07:10:22', '1', '2023-10-08 07:34:11', b'0'); | 2370 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2369, '拼团记录', 'promotion:combination-record:query', 2, 2, 2303, 'record', 'ep:avatar', 'mall/promotion/combination/record/index.vue', 'PromotionCombinationRecord', 0, b'1', b'1', b'1', '1', '2023-10-08 07:10:22', '1', '2023-10-08 07:34:11', b'0'); |
| 2371 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2374, '会员统计', '', 2, 2, 2358, 'member', 'ep:avatar', 'statistics/member/index', 'MemberStatistics', 0, b'1', b'1', b'1', '', '2023-10-11 04:39:24', '1', '2023-10-11 12:50:22', b'0'); | 2371 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2374, '会员统计', '', 2, 2, 2358, 'member', 'ep:avatar', 'statistics/member/index', 'MemberStatistics', 0, b'1', b'1', b'1', '', '2023-10-11 04:39:24', '1', '2023-10-11 12:50:22', b'0'); |
| 2372 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2375, '会员统计查询', 'statistics:member:query', 3, 1, 2374, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-11 04:39:24', '', '2023-10-11 04:39:24', b'0'); | 2372 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2375, '会员统计查询', 'statistics:member:query', 3, 1, 2374, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-11 04:39:24', '', '2023-10-11 04:39:24', b'0'); |
| 2373 | +--此处缺少trade:order:query 和 trade:order:update权限,会导致订单的发货和更多按钮无法显示。 | ||
| 2373 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2376, '订单核销', 'trade:order:pick-up', 3, 10, 2076, '', '', '', '', 0, b'1', b'1', b'1', '1', '2023-10-14 17:11:58', '1', '2023-10-14 17:11:58', b'0'); | 2374 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2376, '订单核销', 'trade:order:pick-up', 3, 10, 2076, '', '', '', '', 0, b'1', b'1', b'1', '1', '2023-10-14 17:11:58', '1', '2023-10-14 17:11:58', b'0'); |
| 2374 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2377, '文章分类', '', 2, 0, 2387, 'article/category', 'fa:certificate', 'mall/promotion/article/category/index', 'ArticleCategory', 0, b'1', b'1', b'1', '', '2023-10-16 01:26:18', '1', '2023-10-16 09:38:26', b'0'); | 2375 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2377, '文章分类', '', 2, 0, 2387, 'article/category', 'fa:certificate', 'mall/promotion/article/category/index', 'ArticleCategory', 0, b'1', b'1', b'1', '', '2023-10-16 01:26:18', '1', '2023-10-16 09:38:26', b'0'); |
| 2375 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2378, '分类查询', 'promotion:article-category:query', 3, 1, 2377, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-16 01:26:18', '', '2023-10-16 01:26:18', b'0'); | 2376 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2378, '分类查询', 'promotion:article-category:query', 3, 1, 2377, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-16 01:26:18', '', '2023-10-16 01:26:18', b'0'); |
| @@ -2478,6 +2479,15 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i | @@ -2478,6 +2479,15 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i | ||
| 2478 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2523, '客户限制配置导出', 'crm:customer-limit-config:export', 3, 5, 2518, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-11-18 13:33:53', '', '2023-11-18 13:33:53', b'0'); | 2479 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2523, '客户限制配置导出', 'crm:customer-limit-config:export', 3, 5, 2518, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-11-18 13:33:53', '', '2023-11-18 13:33:53', b'0'); |
| 2479 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2524, '系统配置', '', 1, 99, 2397, 'config', 'ep:connection', '', '', 0, b'1', b'1', b'1', '1', '2023-11-18 21:58:00', '1', '2023-11-18 21:58:00', b'0'); | 2480 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2524, '系统配置', '', 1, 99, 2397, 'config', 'ep:connection', '', '', 0, b'1', b'1', b'1', '1', '2023-11-18 21:58:00', '1', '2023-11-18 21:58:00', b'0'); |
| 2480 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2525, 'WebSocket 测试', '', 2, 7, 2, 'websocket', 'ep:connection', 'infra/webSocket/index', 'InfraWebSocket', 0, b'1', b'1', b'1', '1', '2023-11-23 19:41:55', '1', '2023-11-24 19:22:30', b'0'); | 2481 | INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2525, 'WebSocket 测试', '', 2, 7, 2, 'websocket', 'ep:connection', 'infra/webSocket/index', 'InfraWebSocket', 0, b'1', b'1', b'1', '1', '2023-11-23 19:41:55', '1', '2023-11-24 19:22:30', b'0'); |
| 2482 | +INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, | ||
| 2483 | + `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, | ||
| 2484 | + `updater`, `update_time`, `deleted`) | ||
| 2485 | +VALUES (2526, '抄送流程', '', 2, 21, 1200, 'processInstanceCC', 'eye', '/bpm/task/cc/index', | ||
| 2486 | + 'BpmCCProcessInstance', 0, true, true, true, 1, '2023-01-13 16:14:00', '1', '2023-01-13 16:14:00', false), | ||
| 2487 | + (2527, '抄送流程查询', 'bpm:process-instance-cc:query', 3, 1, 2526, '', '', '', NULL, 0, b'1', b'1', b'1', '1', | ||
| 2488 | + '2023-01-13 16:14:00', '1', '2023-01-13 16:14:00', b'0'), | ||
| 2489 | + (2528, '抄送流程创建', 'bpm:process-instance-cc:create', 3, 2, 2526, '', '', '', NULL, 0, b'1', b'1', b'1', '1', | ||
| 2490 | + '2023-01-13 16:14:00', '1', '2023-01-13 16:14:00', b'0'); | ||
| 2481 | COMMIT; | 2491 | COMMIT; |
| 2482 | 2492 | ||
| 2483 | -- ---------------------------- | 2493 | -- ---------------------------- |
yudao-framework/yudao-spring-boot-starter-flowable/src/main/java/cn/iocoder/yudao/framework/flowable/config/YudaoFlowableConfiguration.java
| @@ -17,8 +17,8 @@ public class YudaoFlowableConfiguration { | @@ -17,8 +17,8 @@ public class YudaoFlowableConfiguration { | ||
| 17 | * | 17 | * |
| 18 | * 如果不创建,会导致项目启动时,Flowable 报错的问题 | 18 | * 如果不创建,会导致项目启动时,Flowable 报错的问题 |
| 19 | */ | 19 | */ |
| 20 | - @Bean | ||
| 21 | - @ConditionalOnMissingBean | 20 | + @Bean(name = "applicationTaskExecutor") |
| 21 | + @ConditionalOnMissingBean(name = "applicationTaskExecutor") | ||
| 22 | public AsyncListenableTaskExecutor taskExecutor() { | 22 | public AsyncListenableTaskExecutor taskExecutor() { |
| 23 | ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); | 23 | ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); |
| 24 | executor.setCorePoolSize(8); | 24 | executor.setCorePoolSize(8); |
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/query/QueryWrapperX.java
| @@ -151,7 +151,7 @@ public class QueryWrapperX<T> extends QueryWrapper<T> { | @@ -151,7 +151,7 @@ public class QueryWrapperX<T> extends QueryWrapper<T> { | ||
| 151 | switch (SqlConstants.DB_TYPE) { | 151 | switch (SqlConstants.DB_TYPE) { |
| 152 | case ORACLE: | 152 | case ORACLE: |
| 153 | case ORACLE_12C: | 153 | case ORACLE_12C: |
| 154 | - super.eq("ROWNUM", n); | 154 | + super.le("ROWNUM", n); |
| 155 | break; | 155 | break; |
| 156 | case SQL_SERVER: | 156 | case SQL_SERVER: |
| 157 | case SQL_SERVER2005: | 157 | case SQL_SERVER2005: |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/candidate/vo/BpmTaskCandidateRuleVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.controller.admin.candidate.vo; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.rule.BpmTaskAssignRuleBaseVO; | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | +import jakarta.validation.constraints.NotNull; | ||
| 6 | +import lombok.Data; | ||
| 7 | + | ||
| 8 | +import java.util.Set; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 流程任务分配规则 Base VO,提供给添加、修改、详细的子 VO 使用 | ||
| 12 | + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | ||
| 13 | + * | ||
| 14 | + * @see BpmTaskAssignRuleBaseVO | ||
| 15 | + */ | ||
| 16 | +@Data | ||
| 17 | +public class BpmTaskCandidateRuleVO { | ||
| 18 | + | ||
| 19 | + @Schema(description = "规则类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "bpm_task_assign_rule_type") | ||
| 20 | + @NotNull(message = "规则类型不能为空") | ||
| 21 | + private Integer type; | ||
| 22 | + | ||
| 23 | + @Schema(description = "规则值数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "1,2,3") | ||
| 24 | + @NotNull(message = "规则值数组不能为空") | ||
| 25 | + private Set<Long> options; | ||
| 26 | + | ||
| 27 | +} |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/BpmProcessInstanceController.java
| @@ -3,17 +3,17 @@ package cn.iocoder.yudao.module.bpm.controller.admin.task; | @@ -3,17 +3,17 @@ package cn.iocoder.yudao.module.bpm.controller.admin.task; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.*; | 5 | import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.*; |
| 6 | +import cn.iocoder.yudao.module.bpm.service.cc.BpmProcessInstanceCopyService; | ||
| 6 | import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService; | 7 | import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService; |
| 7 | -import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 8 | -import io.swagger.v3.oas.annotations.Parameter; | ||
| 9 | import io.swagger.v3.oas.annotations.Operation; | 8 | import io.swagger.v3.oas.annotations.Operation; |
| 9 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 10 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 11 | +import jakarta.annotation.Resource; | ||
| 12 | +import jakarta.validation.Valid; | ||
| 10 | import org.springframework.security.access.prepost.PreAuthorize; | 13 | import org.springframework.security.access.prepost.PreAuthorize; |
| 11 | import org.springframework.validation.annotation.Validated; | 14 | import org.springframework.validation.annotation.Validated; |
| 12 | import org.springframework.web.bind.annotation.*; | 15 | import org.springframework.web.bind.annotation.*; |
| 13 | 16 | ||
| 14 | -import jakarta.annotation.Resource; | ||
| 15 | -import jakarta.validation.Valid; | ||
| 16 | - | ||
| 17 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 17 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 18 | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | 18 | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| 19 | 19 | ||
| @@ -26,6 +26,9 @@ public class BpmProcessInstanceController { | @@ -26,6 +26,9 @@ public class BpmProcessInstanceController { | ||
| 26 | @Resource | 26 | @Resource |
| 27 | private BpmProcessInstanceService processInstanceService; | 27 | private BpmProcessInstanceService processInstanceService; |
| 28 | 28 | ||
| 29 | + @Resource | ||
| 30 | + private BpmProcessInstanceCopyService processInstanceCopyService; | ||
| 31 | + | ||
| 29 | @GetMapping("/my-page") | 32 | @GetMapping("/my-page") |
| 30 | @Operation(summary = "获得我的实例分页列表", description = "在【我的流程】菜单中,进行调用") | 33 | @Operation(summary = "获得我的实例分页列表", description = "在【我的流程】菜单中,进行调用") |
| 31 | @PreAuthorize("@ss.hasPermission('bpm:process-instance:query')") | 34 | @PreAuthorize("@ss.hasPermission('bpm:process-instance:query')") |
| @@ -56,4 +59,22 @@ public class BpmProcessInstanceController { | @@ -56,4 +59,22 @@ public class BpmProcessInstanceController { | ||
| 56 | processInstanceService.cancelProcessInstance(getLoginUserId(), cancelReqVO); | 59 | processInstanceService.cancelProcessInstance(getLoginUserId(), cancelReqVO); |
| 57 | return success(true); | 60 | return success(true); |
| 58 | } | 61 | } |
| 62 | + | ||
| 63 | + // TODO @kyle:抄送要不单独 controller? | ||
| 64 | + | ||
| 65 | + @PostMapping("/cc/create") | ||
| 66 | + @Operation(summary = "抄送流程") | ||
| 67 | + @PreAuthorize("@ss.hasPermission('bpm:process-instance-cc:create')") | ||
| 68 | + public CommonResult<Boolean> createProcessInstanceCC(@Valid @RequestBody BpmProcessInstanceCCReqVO createReqVO) { | ||
| 69 | + return success(processInstanceCopyService.ccProcessInstance(getLoginUserId(), createReqVO)); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + @GetMapping("/cc/my-page") | ||
| 73 | + @Operation(summary = "获得抄送流程分页列表") | ||
| 74 | + @PreAuthorize("@ss.hasPermission('bpm:process-instance-cc:query')") | ||
| 75 | + public CommonResult<PageResult<BpmProcessInstanceCCPageItemRespVO>> getProcessInstanceCCPage( | ||
| 76 | + @Valid BpmProcessInstanceCCMyPageReqVO pageReqVO) { | ||
| 77 | + return success(processInstanceCopyService.getMyProcessInstanceCCPage(getLoginUserId(), pageReqVO)); | ||
| 78 | + } | ||
| 79 | + | ||
| 59 | } | 80 | } |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceCCMyPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | +import lombok.Data; | ||
| 6 | +import lombok.EqualsAndHashCode; | ||
| 7 | +import lombok.ToString; | ||
| 8 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 9 | + | ||
| 10 | +import java.time.LocalDateTime; | ||
| 11 | + | ||
| 12 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 13 | + | ||
| 14 | +// TODO @kyle:建议改成 BpmProcessInstanceCopyMyPageReqVO;cc 缩写不容易理解,所以改成 copy,虽然会长一点,但是可读性更重要; | ||
| 15 | +@Schema(description = "管理后台 - 流程实例抄送的分页 Request VO") | ||
| 16 | +@Data | ||
| 17 | +@EqualsAndHashCode(callSuper = true) | ||
| 18 | +@ToString(callSuper = true) | ||
| 19 | +public class BpmProcessInstanceCCMyPageReqVO extends PageParam { | ||
| 20 | + | ||
| 21 | + @Schema(description = "流程名称", example = "芋道") | ||
| 22 | + private String processInstanceName; | ||
| 23 | + | ||
| 24 | + @Schema(description = "流程编号", example = "123456768") | ||
| 25 | + private String processInstanceId; | ||
| 26 | + | ||
| 27 | + @Schema(description = "创建时间") | ||
| 28 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 29 | + private LocalDateTime[] createTime; | ||
| 30 | + | ||
| 31 | +} |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceCCPageItemRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.time.LocalDateTime; | ||
| 7 | + | ||
| 8 | +@Schema(description = "管理后台 - 流程实例抄送的分页 Item Response VO") | ||
| 9 | +@Data | ||
| 10 | +public class BpmProcessInstanceCCPageItemRespVO { | ||
| 11 | + | ||
| 12 | + // TODO @kyle:如果已经写了 swagger 注解,可以不用写 java 注释哈; | ||
| 13 | + /** | ||
| 14 | + * 编号 | ||
| 15 | + */ | ||
| 16 | + @Schema(description = "抄送主键") | ||
| 17 | + private Long id; | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * 发起人Id | ||
| 21 | + */ | ||
| 22 | + @Schema(description = "发起人Id") | ||
| 23 | + private Long startUserId; | ||
| 24 | + | ||
| 25 | + @Schema(description = "发起人别名") | ||
| 26 | + private String startUserNickname; | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 流程主键 | ||
| 30 | + */ | ||
| 31 | + @Schema(description = "流程实例的主键") | ||
| 32 | + private String processInstanceId; | ||
| 33 | + | ||
| 34 | + @Schema(description = "流程实例的名称") | ||
| 35 | + private String processInstanceName; | ||
| 36 | + /** | ||
| 37 | + * 任务主键 | ||
| 38 | + */ | ||
| 39 | + @Schema(description = "发起抄送的任务编号") | ||
| 40 | + private String taskId; | ||
| 41 | + | ||
| 42 | + @Schema(description = "发起抄送的任务名称") | ||
| 43 | + private String taskName; | ||
| 44 | + | ||
| 45 | + @Schema(description = "抄送原因") | ||
| 46 | + private String reason; | ||
| 47 | + | ||
| 48 | + @Schema(description = "抄送人") | ||
| 49 | + private String creator; | ||
| 50 | + | ||
| 51 | + @Schema(description = "抄送人别名") | ||
| 52 | + private String creatorNickname; | ||
| 53 | + | ||
| 54 | + @Schema(description = "抄送时间") | ||
| 55 | + private LocalDateTime createTime; | ||
| 56 | + | ||
| 57 | +} |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceCCReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.module.bpm.controller.admin.candidate.vo.BpmTaskCandidateRuleVO; | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | +import jakarta.validation.constraints.NotBlank; | ||
| 6 | +import jakarta.validation.constraints.NotEmpty; | ||
| 7 | +import jakarta.validation.constraints.NotNull; | ||
| 8 | +import lombok.Data; | ||
| 9 | +import lombok.EqualsAndHashCode; | ||
| 10 | +import lombok.ToString; | ||
| 11 | + | ||
| 12 | +// TODO @kyle:这个 VO 可以改成 BpmProcessInstanceCopyCreateReqVO | ||
| 13 | +@Schema(description = "管理后台 - 流程实例的抄送 Request VO") | ||
| 14 | +@Data | ||
| 15 | +@EqualsAndHashCode(callSuper = true) | ||
| 16 | +@ToString(callSuper = true) | ||
| 17 | +public class BpmProcessInstanceCCReqVO extends BpmTaskCandidateRuleVO { | ||
| 18 | + | ||
| 19 | + @Schema(description = "任务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 20 | + @NotEmpty(message = "任务编号不能为空") | ||
| 21 | + private String taskKey; | ||
| 22 | + | ||
| 23 | + @Schema(description = "任务名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 24 | + @NotEmpty(message = "任务名称不能为空") | ||
| 25 | + private String taskName; | ||
| 26 | + | ||
| 27 | + @Schema(description = "流程实例的编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 28 | + @NotEmpty(message = "流程实例的编号不能为空") | ||
| 29 | + private String processInstanceKey; | ||
| 30 | + | ||
| 31 | + @Schema(description = "发起流程的用户的编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 32 | + @NotNull(message = "发起流程的用户的编号不能为空") | ||
| 33 | + private Long startUserId; | ||
| 34 | + | ||
| 35 | + @Schema(description = "任务实例名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 36 | + @NotEmpty(message = "任务实例名称不能为空") | ||
| 37 | + private String processInstanceName; | ||
| 38 | + | ||
| 39 | + @Schema(description = "抄送原因", requiredMode = Schema.RequiredMode.REQUIRED, example = "请帮忙审查下!") | ||
| 40 | + @NotBlank(message = "抄送原因不能为空") | ||
| 41 | + private String reason; | ||
| 42 | + | ||
| 43 | + // TODO @kyle:看了下字段有点多,尽量不传递可推导的字段; | ||
| 44 | + // 需要传递:taskId(任务编号)、reason、userIds(被抄送的人) | ||
| 45 | + // 不需要传递:taskKey、taskName、processInstanceKey、startUserId、processInstanceName 因为这些可以后端查询到 | ||
| 46 | + | ||
| 47 | +} |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskApproveReqVO.java
| 1 | package cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task; | 1 | package cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.module.bpm.controller.admin.candidate.vo.BpmTaskCandidateRuleVO; | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.Data; | 5 | import lombok.Data; |
| 5 | 6 |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/cc/BpmProcessInstanceCopyConvert.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.convert.cc; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | ||
| 5 | +import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceCCPageItemRespVO; | ||
| 6 | +import cn.iocoder.yudao.module.bpm.dal.dataobject.cc.BpmProcessInstanceCopyDO; | ||
| 7 | +import cn.iocoder.yudao.module.bpm.service.cc.BpmProcessInstanceCopyVO; | ||
| 8 | +import org.mapstruct.Mapper; | ||
| 9 | +import org.mapstruct.factory.Mappers; | ||
| 10 | + | ||
| 11 | +import java.util.List; | ||
| 12 | +import java.util.Map; | ||
| 13 | + | ||
| 14 | +// TODO kyle:类注释不太对 | ||
| 15 | +/** | ||
| 16 | + * 动态表单 Convert | ||
| 17 | + * | ||
| 18 | + * @author 芋艿 | ||
| 19 | + */ | ||
| 20 | +@Mapper | ||
| 21 | +public interface BpmProcessInstanceCopyConvert { | ||
| 22 | + | ||
| 23 | + BpmProcessInstanceCopyConvert INSTANCE = Mappers.getMapper(BpmProcessInstanceCopyConvert.class); | ||
| 24 | + | ||
| 25 | + // TODO @kyle:可以使用 BeanUtils copy 替代这些简单的哈; | ||
| 26 | + BpmProcessInstanceCopyDO copy(BpmProcessInstanceCopyDO bean); | ||
| 27 | + | ||
| 28 | + BpmProcessInstanceCopyVO convert(BpmProcessInstanceCopyDO bean); | ||
| 29 | + | ||
| 30 | + List<BpmProcessInstanceCCPageItemRespVO> convertList(List<BpmProcessInstanceCopyDO> list); | ||
| 31 | + | ||
| 32 | + // TODO @kyle:/* taskId */ 这种注释一般不用写,可以一眼看明白的;避免变量看着略微不清晰哈 | ||
| 33 | + default PageResult<BpmProcessInstanceCCPageItemRespVO> convertPage(PageResult<BpmProcessInstanceCopyDO> page | ||
| 34 | + , Map<String/* taskId */, String/* taskName */> taskMap | ||
| 35 | + , Map<String/* processInstaneId */, String/* processInstaneName */> processInstaneMap | ||
| 36 | + , Map<Long/* userId */, String/* userName */> userMap | ||
| 37 | + ) { | ||
| 38 | + List<BpmProcessInstanceCCPageItemRespVO> list = convertList(page.getList()); | ||
| 39 | + for (BpmProcessInstanceCCPageItemRespVO vo : list) { | ||
| 40 | + MapUtils.findAndThen(userMap, Long.valueOf(vo.getCreator()), | ||
| 41 | + vo::setCreatorNickname); | ||
| 42 | + MapUtils.findAndThen(userMap, vo.getStartUserId(), | ||
| 43 | + vo::setStartUserNickname); | ||
| 44 | + MapUtils.findAndThen(taskMap, vo.getTaskId(), | ||
| 45 | + vo::setTaskName); | ||
| 46 | + MapUtils.findAndThen(processInstaneMap, vo.getProcessInstanceId(), | ||
| 47 | + vo::setProcessInstanceName); | ||
| 48 | + } | ||
| 49 | + // TODO @kyle:可以精简成下面的哈; | ||
| 50 | +// List<BpmProcessInstanceCCPageItemRespVO> list2 = BeanUtils.toBean(page.getList(), | ||
| 51 | +// BpmProcessInstanceCCPageItemRespVO.class, | ||
| 52 | +// copy -> { | ||
| 53 | +// MapUtils.findAndThen(userMap, Long.valueOf(copy.getCreator()), copy::setCreatorNickname); | ||
| 54 | +// MapUtils.findAndThen(userMap, copy.getStartUserId(), copy::setStartUserNickname); | ||
| 55 | +// MapUtils.findAndThen(taskMap, copy.getTaskId(), copy::setTaskName); | ||
| 56 | +// MapUtils.findAndThen(processInstaneMap, copy.getProcessInstanceId(), copy::setProcessInstanceName); | ||
| 57 | +// }); | ||
| 58 | + return new PageResult<>(list, page.getTotal()); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | +} |
yudao-module-mall/yudao-module-statistics-biz/src/main/java/cn/iocoder/yudao/module/statistics/dal/dataobject/member/MemberStatisticsDO.java renamed to yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/cc/BpmProcessInstanceCopyDO.java
| 1 | -package cn.iocoder.yudao.module.statistics.dal.dataobject.member; | 1 | +package cn.iocoder.yudao.module.bpm.dal.dataobject.cc; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | -import com.baomidou.mybatisplus.annotation.KeySequence; | ||
| 5 | import com.baomidou.mybatisplus.annotation.TableId; | 4 | import com.baomidou.mybatisplus.annotation.TableId; |
| 6 | import com.baomidou.mybatisplus.annotation.TableName; | 5 | import com.baomidou.mybatisplus.annotation.TableName; |
| 7 | import lombok.*; | 6 | import lombok.*; |
| 8 | 7 | ||
| 9 | -import java.time.LocalDateTime; | ||
| 10 | - | ||
| 11 | /** | 8 | /** |
| 12 | - * 会员统计 DO | ||
| 13 | - * <p> | ||
| 14 | - * 以天为维度,统计全部的数据 | 9 | + * 流程抄送 DO |
| 15 | * | 10 | * |
| 16 | - * @author 芋道源码 | 11 | + * @author kyle |
| 12 | + * @date 2022-05-19 TODO @kyle:@date 不是标准 java doc,可以使用 @since 替代,然后日期是不是不对 | ||
| 17 | */ | 13 | */ |
| 18 | -@TableName("member_statistics") | ||
| 19 | -@KeySequence("member_statistics_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | 14 | +@TableName(value = "bpm_process_instance_copy", autoResultMap = true) |
| 20 | @Data | 15 | @Data |
| 21 | @EqualsAndHashCode(callSuper = true) | 16 | @EqualsAndHashCode(callSuper = true) |
| 22 | @ToString(callSuper = true) | 17 | @ToString(callSuper = true) |
| 23 | @Builder | 18 | @Builder |
| 24 | @NoArgsConstructor | 19 | @NoArgsConstructor |
| 25 | @AllArgsConstructor | 20 | @AllArgsConstructor |
| 26 | -public class MemberStatisticsDO extends BaseDO { | 21 | +public class BpmProcessInstanceCopyDO extends BaseDO { |
| 27 | 22 | ||
| 28 | /** | 23 | /** |
| 29 | - * 编号,主键自增 | 24 | + * 编号 |
| 30 | */ | 25 | */ |
| 31 | @TableId | 26 | @TableId |
| 32 | private Long id; | 27 | private Long id; |
| 33 | 28 | ||
| 29 | + // TODO @kyle:字段如果是关联或者冗余,要写下注释。以 processInstanceId 举例子。 | ||
| 34 | /** | 30 | /** |
| 35 | - * 统计日期 | 31 | + * 发起人 Id |
| 36 | */ | 32 | */ |
| 37 | - private LocalDateTime time; | ||
| 38 | - | 33 | + private Long startUserId; |
| 39 | /** | 34 | /** |
| 40 | - * 注册用户数量 | 35 | + * 流程名 |
| 41 | */ | 36 | */ |
| 42 | - private Integer userRegisterCount; | 37 | + private String processInstanceName; |
| 43 | /** | 38 | /** |
| 44 | - * 访问用户数量(UV) | 39 | + * 流程实例的编号 |
| 40 | + * | ||
| 41 | + * 关联 ProcessInstance 的 id 属性 | ||
| 45 | */ | 42 | */ |
| 46 | - private Integer userVisitCount; | 43 | + private String processInstanceId; |
| 44 | + | ||
| 47 | /** | 45 | /** |
| 48 | - * 访问页面数量(PV) | 46 | + * 任务主键 |
| 49 | */ | 47 | */ |
| 50 | - private Integer pageVisitCount; | 48 | + private String taskId; |
| 51 | 49 | ||
| 52 | /** | 50 | /** |
| 53 | - * 充值用户数量 | 51 | + * 任务名称 |
| 54 | */ | 52 | */ |
| 55 | - private Integer rechargeUserCount; | 53 | + private String taskName; |
| 56 | 54 | ||
| 57 | /** | 55 | /** |
| 58 | - * 创建订单用户数 | 56 | + * 用户编号 |
| 59 | */ | 57 | */ |
| 60 | - private Integer orderCreateUserCount; | 58 | + private Long userId; |
| 59 | + | ||
| 61 | /** | 60 | /** |
| 62 | - * 支付订单用户数 | 61 | + * 抄送原因 |
| 63 | */ | 62 | */ |
| 64 | - private Integer orderPayUserCount; | 63 | + private String reason; |
| 64 | + | ||
| 65 | + // TODO @kyle:这个字段,可以用 category 简化点 | ||
| 65 | /** | 66 | /** |
| 66 | - * 总支付金额,单位:分 | 67 | + * 流程分类 |
| 67 | */ | 68 | */ |
| 68 | - private Integer orderPayPrice; | 69 | + private String processDefinitionCategory; |
| 69 | 70 | ||
| 70 | } | 71 | } |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/mysql/cc/BpmProcessInstanceCopyMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.dal.mysql.cc; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 6 | +import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceCCMyPageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.bpm.dal.dataobject.cc.BpmProcessInstanceCopyDO; | ||
| 8 | +import org.apache.ibatis.annotations.Mapper; | ||
| 9 | + | ||
| 10 | +@Mapper | ||
| 11 | +public interface BpmProcessInstanceCopyMapper extends BaseMapperX<BpmProcessInstanceCopyDO> { // TODO @kyle:方法和类之间要空行下; | ||
| 12 | + default PageResult<BpmProcessInstanceCopyDO> selectPage(Long loginUserId, BpmProcessInstanceCCMyPageReqVO reqVO){ | ||
| 13 | + return selectPage(reqVO, new LambdaQueryWrapperX<BpmProcessInstanceCopyDO>() | ||
| 14 | + .eqIfPresent(BpmProcessInstanceCopyDO::getUserId, loginUserId) | ||
| 15 | + .eqIfPresent(BpmProcessInstanceCopyDO::getProcessInstanceId, reqVO.getProcessInstanceId()) | ||
| 16 | + .likeIfPresent(BpmProcessInstanceCopyDO::getProcessInstanceName, reqVO.getProcessInstanceName()) | ||
| 17 | + .betweenIfPresent(BpmProcessInstanceCopyDO::getCreateTime, reqVO.getCreateTime()) | ||
| 18 | + .orderByDesc(BpmProcessInstanceCopyDO::getId)); | ||
| 19 | + } | ||
| 20 | +} |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/bpm/config/BpmCandidateProcessorConfiguration.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.framework.bpm.config; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.module.bpm.framework.flowable.core.behavior.script.BpmTaskAssignScript; | ||
| 4 | +import cn.iocoder.yudao.module.bpm.service.candidate.sourceInfoProcessor.*; | ||
| 5 | +import org.springframework.beans.factory.ObjectProvider; | ||
| 6 | +import org.springframework.context.annotation.Bean; | ||
| 7 | +import org.springframework.context.annotation.Configuration; | ||
| 8 | + | ||
| 9 | +// TODO @芋艿:Candidate 相关还在完善中,用户可以暂时忽略,仅 yudao 开发的同学需要关注~计划是把 Candidate 和 Assign 融合成一套 | ||
| 10 | +/** | ||
| 11 | + * BPM 通用的 Configuration 配置类,提供给 Activiti 和 Flowable | ||
| 12 | + * @author kyle | ||
| 13 | + */ | ||
| 14 | +@Configuration(proxyBeanMethods = false) | ||
| 15 | +public class BpmCandidateProcessorConfiguration { | ||
| 16 | + @Bean | ||
| 17 | + public BpmCandidateAdminUserApiSourceInfoProcessor bpmCandidateAdminUserApiSourceInfoProcessor() { | ||
| 18 | + return new BpmCandidateAdminUserApiSourceInfoProcessor(); | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + @Bean | ||
| 22 | + public BpmCandidateDeptApiSourceInfoProcessor bpmCandidateDeptApiSourceInfoProcessor() { | ||
| 23 | + return new BpmCandidateDeptApiSourceInfoProcessor(); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + @Bean | ||
| 27 | + public BpmCandidatePostApiSourceInfoProcessor bpmCandidatePostApiSourceInfoProcessor() { | ||
| 28 | + return new BpmCandidatePostApiSourceInfoProcessor(); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + @Bean | ||
| 32 | + public BpmCandidateRoleApiSourceInfoProcessor bpmCandidateRoleApiSourceInfoProcessor() { | ||
| 33 | + return new BpmCandidateRoleApiSourceInfoProcessor(); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + @Bean | ||
| 37 | + public BpmCandidateUserGroupApiSourceInfoProcessor bpmCandidateUserGroupApiSourceInfoProcessor() { | ||
| 38 | + return new BpmCandidateUserGroupApiSourceInfoProcessor(); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * 可以自己定制脚本,然后通过这里设置到处理器里面去 | ||
| 43 | + * @param scriptsOp 脚本包装对象 | ||
| 44 | + * @return | ||
| 45 | + */ | ||
| 46 | + @Bean | ||
| 47 | + public BpmCandidateScriptApiSourceInfoProcessor bpmCandidateScriptApiSourceInfoProcessor(ObjectProvider<BpmTaskAssignScript> scriptsOp) { | ||
| 48 | + BpmCandidateScriptApiSourceInfoProcessor bpmCandidateScriptApiSourceInfoProcessor = new BpmCandidateScriptApiSourceInfoProcessor(); | ||
| 49 | + bpmCandidateScriptApiSourceInfoProcessor.setScripts(scriptsOp); | ||
| 50 | + return bpmCandidateScriptApiSourceInfoProcessor; | ||
| 51 | + } | ||
| 52 | +} |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/candidate/BpmCandidateSourceInfo.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.service.candidate; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.module.bpm.controller.admin.candidate.vo.BpmTaskCandidateRuleVO; | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | +import lombok.AllArgsConstructor; | ||
| 6 | +import lombok.Data; | ||
| 7 | +import lombok.NoArgsConstructor; | ||
| 8 | + | ||
| 9 | +import jakarta.validation.constraints.NotEmpty; | ||
| 10 | +import jakarta.validation.constraints.NotNull; | ||
| 11 | +import java.util.HashSet; | ||
| 12 | +import java.util.Set; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * 获取候选人信息 | ||
| 16 | + */ | ||
| 17 | +@AllArgsConstructor | ||
| 18 | +@NoArgsConstructor | ||
| 19 | +@Data | ||
| 20 | +public class BpmCandidateSourceInfo { | ||
| 21 | + | ||
| 22 | + @Schema(description = "流程id") | ||
| 23 | + @NotNull | ||
| 24 | + private String processInstanceId; | ||
| 25 | + | ||
| 26 | + @Schema(description = "当前任务ID") | ||
| 27 | + @NotNull | ||
| 28 | + private String taskId; | ||
| 29 | + /** | ||
| 30 | + * 通过这些规则,生成最终需要生成的用户 | ||
| 31 | + */ | ||
| 32 | + @Schema(description = "当前任务预选规则") | ||
| 33 | + @NotEmpty(message = "不允许空规则") | ||
| 34 | + private Set<BpmTaskCandidateRuleVO> rules; | ||
| 35 | + | ||
| 36 | + @Schema(description = "发起抄送的用户") | ||
| 37 | + private String creator; | ||
| 38 | + | ||
| 39 | + @Schema(description = "抄送原因", requiredMode = Schema.RequiredMode.REQUIRED, example = "请帮忙审查下!") | ||
| 40 | + @NotEmpty(message = "抄送原因不能为空") | ||
| 41 | + private String reason; | ||
| 42 | + | ||
| 43 | + public void addRule(BpmTaskCandidateRuleVO vo) { | ||
| 44 | + assert vo != null; | ||
| 45 | + if (rules == null) { | ||
| 46 | + rules = new HashSet<>(); | ||
| 47 | + } | ||
| 48 | + rules.add(vo); | ||
| 49 | + } | ||
| 50 | +} | ||
| 0 | \ No newline at end of file | 51 | \ No newline at end of file |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/candidate/BpmCandidateSourceInfoProcessor.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.service.candidate; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.iocoder.yudao.module.bpm.controller.admin.candidate.vo.BpmTaskCandidateRuleVO; | ||
| 5 | +import cn.iocoder.yudao.module.bpm.enums.definition.BpmTaskAssignRuleTypeEnum; | ||
| 6 | +import org.flowable.engine.delegate.DelegateExecution; | ||
| 7 | + | ||
| 8 | +import java.util.Collections; | ||
| 9 | +import java.util.HashSet; | ||
| 10 | +import java.util.Set; | ||
| 11 | + | ||
| 12 | +public interface BpmCandidateSourceInfoProcessor { | ||
| 13 | + /** | ||
| 14 | + * 获取该处理器支持的类型 | ||
| 15 | + * 来自 {@link BpmTaskAssignRuleTypeEnum} | ||
| 16 | + * | ||
| 17 | + * @return | ||
| 18 | + */ | ||
| 19 | + Set<Integer> getSupportedTypes(); | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * 对规则和人员做校验 | ||
| 23 | + * | ||
| 24 | + * @param type 规则 | ||
| 25 | + * @param options 人员id | ||
| 26 | + */ | ||
| 27 | + void validRuleOptions(Integer type, Set<Long> options); | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * 默认的处理 | ||
| 31 | + * 如果想去操作所有的规则,则可以覆盖此方法 | ||
| 32 | + * | ||
| 33 | + * @param request 原始请求 | ||
| 34 | + * @param delegateExecution 审批过程中的对象 | ||
| 35 | + * @return 必须包含的是用户ID,而不是其他的ID | ||
| 36 | + * @throws Exception | ||
| 37 | + */ | ||
| 38 | + default Set<Long> process(BpmCandidateSourceInfo request, DelegateExecution delegateExecution) throws Exception { | ||
| 39 | + Set<BpmTaskCandidateRuleVO> rules = request.getRules(); | ||
| 40 | + Set<Long> results = new HashSet<>(); | ||
| 41 | + for (BpmTaskCandidateRuleVO rule : rules) { | ||
| 42 | + // 每个处理器都有机会处理自己支持的事件 | ||
| 43 | + if (CollUtil.contains(getSupportedTypes(), rule.getType())) { | ||
| 44 | + results.addAll(doProcess(request, rule, delegateExecution)); | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + return results; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + default Set<Long> doProcess(BpmCandidateSourceInfo request, BpmTaskCandidateRuleVO rule, DelegateExecution delegateExecution) { | ||
| 51 | + return Collections.emptySet(); | ||
| 52 | + } | ||
| 53 | +} | ||
| 0 | \ No newline at end of file | 54 | \ No newline at end of file |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/candidate/BpmCandidateSourceInfoProcessorChain.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.service.candidate; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.hutool.core.collection.ListUtil; | ||
| 5 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | ||
| 6 | +import cn.iocoder.yudao.module.bpm.controller.admin.candidate.vo.BpmTaskCandidateRuleVO; | ||
| 7 | +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | ||
| 8 | +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | ||
| 9 | +import org.flowable.engine.delegate.DelegateExecution; | ||
| 10 | +import org.springframework.beans.factory.ObjectProvider; | ||
| 11 | +import org.springframework.stereotype.Service; | ||
| 12 | + | ||
| 13 | +import jakarta.annotation.Resource; | ||
| 14 | +import java.util.*; | ||
| 15 | + | ||
| 16 | +@Service | ||
| 17 | +public class BpmCandidateSourceInfoProcessorChain { | ||
| 18 | + | ||
| 19 | + // 保存处理节点 | ||
| 20 | + | ||
| 21 | + private List<BpmCandidateSourceInfoProcessor> processorList; | ||
| 22 | + @Resource | ||
| 23 | + private AdminUserApi adminUserApi; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 可添加其他处理器 | ||
| 27 | + * | ||
| 28 | + * @param processorOp | ||
| 29 | + * @return | ||
| 30 | + */ | ||
| 31 | + @Resource | ||
| 32 | + // 动态扩展处理节点 | ||
| 33 | + public BpmCandidateSourceInfoProcessorChain addProcessor(ObjectProvider<BpmCandidateSourceInfoProcessor> processorOp) { | ||
| 34 | + List<BpmCandidateSourceInfoProcessor> processor = ListUtil.toList(processorOp.iterator()); | ||
| 35 | + if (null == processorList) { | ||
| 36 | + processorList = new ArrayList<>(processor.size()); | ||
| 37 | + } | ||
| 38 | + processorList.addAll(processor); | ||
| 39 | + return this; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + // 获取处理器处理 | ||
| 43 | + public Set<Long> process(BpmCandidateSourceInfo sourceInfo, DelegateExecution execution) throws Exception { | ||
| 44 | + // Verify our parameters | ||
| 45 | + if (sourceInfo == null) { | ||
| 46 | + throw new IllegalArgumentException(); | ||
| 47 | + } | ||
| 48 | + for (BpmCandidateSourceInfoProcessor processor : processorList) { | ||
| 49 | + try { | ||
| 50 | + for (BpmTaskCandidateRuleVO vo : sourceInfo.getRules()) { | ||
| 51 | + if (CollUtil.contains(processor.getSupportedTypes(), vo.getType())) { | ||
| 52 | + processor.validRuleOptions(vo.getType(), vo.getOptions()); | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + } catch (Exception e) { | ||
| 56 | + e.printStackTrace(); | ||
| 57 | + throw e; | ||
| 58 | + } | ||
| 59 | + } | ||
| 60 | + Set<Long> saveResult = Collections.emptySet(); | ||
| 61 | + Exception saveException = null; | ||
| 62 | + for (BpmCandidateSourceInfoProcessor processor : processorList) { | ||
| 63 | + try { | ||
| 64 | + saveResult = processor.process(sourceInfo, execution); | ||
| 65 | + if (CollUtil.isNotEmpty(saveResult)) { | ||
| 66 | + removeDisableUsers(saveResult); | ||
| 67 | + break; | ||
| 68 | + } | ||
| 69 | + } catch (Exception e) { | ||
| 70 | + saveException = e; | ||
| 71 | + break; | ||
| 72 | + } | ||
| 73 | + } | ||
| 74 | + // Return the exception or result state from the last execute() | ||
| 75 | + if ((saveException != null)) { | ||
| 76 | + throw saveException; | ||
| 77 | + } else { | ||
| 78 | + return (saveResult); | ||
| 79 | + } | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + public Set<Long> calculateTaskCandidateUsers(DelegateExecution execution, BpmCandidateSourceInfo sourceInfo) { | ||
| 83 | + Set<Long> results = Collections.emptySet(); | ||
| 84 | + try { | ||
| 85 | + results = process(sourceInfo, execution); | ||
| 86 | + } catch (Exception e) { | ||
| 87 | + e.printStackTrace(); | ||
| 88 | + } | ||
| 89 | + return results; | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + /** | ||
| 93 | + * 移除禁用用户 | ||
| 94 | + * | ||
| 95 | + * @param assigneeUserIds | ||
| 96 | + */ | ||
| 97 | + public void removeDisableUsers(Set<Long> assigneeUserIds) { | ||
| 98 | + if (CollUtil.isEmpty(assigneeUserIds)) { | ||
| 99 | + return; | ||
| 100 | + } | ||
| 101 | + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(assigneeUserIds); | ||
| 102 | + assigneeUserIds.removeIf(id -> { | ||
| 103 | + AdminUserRespDTO user = userMap.get(id); | ||
| 104 | + return user == null || !CommonStatusEnum.ENABLE.getStatus().equals(user.getStatus()); | ||
| 105 | + }); | ||
| 106 | + } | ||
| 107 | +} | ||
| 0 | \ No newline at end of file | 108 | \ No newline at end of file |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/candidate/sourceInfoProcessor/BpmCandidateAdminUserApiSourceInfoProcessor.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.service.candidate.sourceInfoProcessor; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.util.collection.SetUtils; | ||
| 4 | +import cn.iocoder.yudao.module.bpm.controller.admin.candidate.vo.BpmTaskCandidateRuleVO; | ||
| 5 | +import cn.iocoder.yudao.module.bpm.enums.definition.BpmTaskAssignRuleTypeEnum; | ||
| 6 | +import cn.iocoder.yudao.module.bpm.service.candidate.BpmCandidateSourceInfo; | ||
| 7 | +import cn.iocoder.yudao.module.bpm.service.candidate.BpmCandidateSourceInfoProcessor; | ||
| 8 | +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | ||
| 9 | +import org.flowable.engine.delegate.DelegateExecution; | ||
| 10 | + | ||
| 11 | +import jakarta.annotation.Resource; | ||
| 12 | +import java.util.Set; | ||
| 13 | + | ||
| 14 | +public class BpmCandidateAdminUserApiSourceInfoProcessor implements BpmCandidateSourceInfoProcessor { | ||
| 15 | + @Resource | ||
| 16 | + private AdminUserApi api; | ||
| 17 | + | ||
| 18 | + @Override | ||
| 19 | + public Set<Integer> getSupportedTypes() { | ||
| 20 | + return SetUtils.asSet(BpmTaskAssignRuleTypeEnum.USER.getType()); | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + @Override | ||
| 24 | + public void validRuleOptions(Integer type, Set<Long> options) { | ||
| 25 | + api.validateUserList(options); | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + @Override | ||
| 29 | + public Set<Long> doProcess(BpmCandidateSourceInfo request, BpmTaskCandidateRuleVO rule, DelegateExecution delegateExecution) { | ||
| 30 | + return rule.getOptions(); | ||
| 31 | + } | ||
| 32 | +} | ||
| 0 | \ No newline at end of file | 33 | \ No newline at end of file |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/candidate/sourceInfoProcessor/BpmCandidateDeptApiSourceInfoProcessor.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.service.candidate.sourceInfoProcessor; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.util.collection.SetUtils; | ||
| 4 | +import cn.iocoder.yudao.module.bpm.controller.admin.candidate.vo.BpmTaskCandidateRuleVO; | ||
| 5 | +import cn.iocoder.yudao.module.bpm.enums.definition.BpmTaskAssignRuleTypeEnum; | ||
| 6 | +import cn.iocoder.yudao.module.bpm.service.candidate.BpmCandidateSourceInfo; | ||
| 7 | +import cn.iocoder.yudao.module.bpm.service.candidate.BpmCandidateSourceInfoProcessor; | ||
| 8 | +import cn.iocoder.yudao.module.system.api.dept.DeptApi; | ||
| 9 | +import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; | ||
| 10 | +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | ||
| 11 | +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | ||
| 12 | +import org.flowable.engine.delegate.DelegateExecution; | ||
| 13 | + | ||
| 14 | +import jakarta.annotation.Resource; | ||
| 15 | +import java.util.Collections; | ||
| 16 | +import java.util.List; | ||
| 17 | +import java.util.Objects; | ||
| 18 | +import java.util.Set; | ||
| 19 | + | ||
| 20 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | ||
| 21 | + | ||
| 22 | +public class BpmCandidateDeptApiSourceInfoProcessor implements BpmCandidateSourceInfoProcessor { | ||
| 23 | + @Resource | ||
| 24 | + private DeptApi api; | ||
| 25 | + @Resource | ||
| 26 | + private AdminUserApi adminUserApi; | ||
| 27 | + | ||
| 28 | + @Override | ||
| 29 | + public Set<Integer> getSupportedTypes() { | ||
| 30 | + return SetUtils.asSet(BpmTaskAssignRuleTypeEnum.DEPT_MEMBER.getType(), | ||
| 31 | + BpmTaskAssignRuleTypeEnum.DEPT_LEADER.getType()); | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + @Override | ||
| 35 | + public void validRuleOptions(Integer type, Set<Long> options) { | ||
| 36 | + api.validateDeptList(options); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + @Override | ||
| 40 | + public Set<Long> doProcess(BpmCandidateSourceInfo request, BpmTaskCandidateRuleVO rule, DelegateExecution delegateExecution) { | ||
| 41 | + if (Objects.equals(BpmTaskAssignRuleTypeEnum.DEPT_MEMBER.getType(), rule.getType())) { | ||
| 42 | + List<AdminUserRespDTO> users = adminUserApi.getUserListByDeptIds(rule.getOptions()); | ||
| 43 | + return convertSet(users, AdminUserRespDTO::getId); | ||
| 44 | + } else if (Objects.equals(BpmTaskAssignRuleTypeEnum.DEPT_LEADER.getType(), rule.getType())) { | ||
| 45 | + List<DeptRespDTO> depts = api.getDeptList(rule.getOptions()); | ||
| 46 | + return convertSet(depts, DeptRespDTO::getLeaderUserId); | ||
| 47 | + } | ||
| 48 | + return Collections.emptySet(); | ||
| 49 | + } | ||
| 50 | +} | ||
| 0 | \ No newline at end of file | 51 | \ No newline at end of file |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/candidate/sourceInfoProcessor/BpmCandidatePostApiSourceInfoProcessor.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.service.candidate.sourceInfoProcessor; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.util.collection.SetUtils; | ||
| 4 | +import cn.iocoder.yudao.module.bpm.controller.admin.candidate.vo.BpmTaskCandidateRuleVO; | ||
| 5 | +import cn.iocoder.yudao.module.bpm.enums.definition.BpmTaskAssignRuleTypeEnum; | ||
| 6 | +import cn.iocoder.yudao.module.bpm.service.candidate.BpmCandidateSourceInfo; | ||
| 7 | +import cn.iocoder.yudao.module.bpm.service.candidate.BpmCandidateSourceInfoProcessor; | ||
| 8 | +import cn.iocoder.yudao.module.system.api.dept.PostApi; | ||
| 9 | +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | ||
| 10 | +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | ||
| 11 | +import org.flowable.engine.delegate.DelegateExecution; | ||
| 12 | + | ||
| 13 | +import jakarta.annotation.Resource; | ||
| 14 | +import java.util.List; | ||
| 15 | +import java.util.Set; | ||
| 16 | + | ||
| 17 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | ||
| 18 | + | ||
| 19 | +public class BpmCandidatePostApiSourceInfoProcessor implements BpmCandidateSourceInfoProcessor { | ||
| 20 | + @Resource | ||
| 21 | + private PostApi api; | ||
| 22 | + @Resource | ||
| 23 | + private AdminUserApi adminUserApi; | ||
| 24 | + | ||
| 25 | + @Override | ||
| 26 | + public Set<Integer> getSupportedTypes() { | ||
| 27 | + return SetUtils.asSet(BpmTaskAssignRuleTypeEnum.POST.getType()); | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + @Override | ||
| 31 | + public void validRuleOptions(Integer type, Set<Long> options) { | ||
| 32 | + api.validPostList(options); | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + @Override | ||
| 36 | + public Set<Long> doProcess(BpmCandidateSourceInfo request, BpmTaskCandidateRuleVO rule, DelegateExecution delegateExecution) { | ||
| 37 | + List<AdminUserRespDTO> users = adminUserApi.getUserListByPostIds(rule.getOptions()); | ||
| 38 | + return convertSet(users, AdminUserRespDTO::getId); | ||
| 39 | + } | ||
| 40 | +} | ||
| 0 | \ No newline at end of file | 41 | \ No newline at end of file |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/candidate/sourceInfoProcessor/BpmCandidateRoleApiSourceInfoProcessor.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.service.candidate.sourceInfoProcessor; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.util.collection.SetUtils; | ||
| 4 | +import cn.iocoder.yudao.module.bpm.controller.admin.candidate.vo.BpmTaskCandidateRuleVO; | ||
| 5 | +import cn.iocoder.yudao.module.bpm.enums.definition.BpmTaskAssignRuleTypeEnum; | ||
| 6 | +import cn.iocoder.yudao.module.bpm.service.candidate.BpmCandidateSourceInfo; | ||
| 7 | +import cn.iocoder.yudao.module.bpm.service.candidate.BpmCandidateSourceInfoProcessor; | ||
| 8 | +import cn.iocoder.yudao.module.system.api.permission.PermissionApi; | ||
| 9 | +import cn.iocoder.yudao.module.system.api.permission.RoleApi; | ||
| 10 | +import org.flowable.engine.delegate.DelegateExecution; | ||
| 11 | + | ||
| 12 | +import jakarta.annotation.Resource; | ||
| 13 | +import java.util.Set; | ||
| 14 | + | ||
| 15 | +public class BpmCandidateRoleApiSourceInfoProcessor implements BpmCandidateSourceInfoProcessor { | ||
| 16 | + @Resource | ||
| 17 | + private RoleApi api; | ||
| 18 | + | ||
| 19 | + @Resource | ||
| 20 | + private PermissionApi permissionApi; | ||
| 21 | + | ||
| 22 | + @Override | ||
| 23 | + public Set<Integer> getSupportedTypes() { | ||
| 24 | + return SetUtils.asSet(BpmTaskAssignRuleTypeEnum.ROLE.getType()); | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + @Override | ||
| 28 | + public void validRuleOptions(Integer type, Set<Long> options) { | ||
| 29 | + api.validRoleList(options); | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + @Override | ||
| 33 | + public Set<Long> doProcess(BpmCandidateSourceInfo request, BpmTaskCandidateRuleVO rule, DelegateExecution delegateExecution) { | ||
| 34 | + return permissionApi.getUserRoleIdListByRoleIds(rule.getOptions()); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | +} | ||
| 0 | \ No newline at end of file | 38 | \ No newline at end of file |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/candidate/sourceInfoProcessor/BpmCandidateScriptApiSourceInfoProcessor.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.service.candidate.sourceInfoProcessor; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | ||
| 5 | +import cn.iocoder.yudao.framework.common.util.collection.SetUtils; | ||
| 6 | +import cn.iocoder.yudao.module.bpm.controller.admin.candidate.vo.BpmTaskCandidateRuleVO; | ||
| 7 | +import cn.iocoder.yudao.module.bpm.enums.DictTypeConstants; | ||
| 8 | +import cn.iocoder.yudao.module.bpm.enums.definition.BpmTaskAssignRuleTypeEnum; | ||
| 9 | +import cn.iocoder.yudao.module.bpm.framework.flowable.core.behavior.script.BpmTaskAssignScript; | ||
| 10 | +import cn.iocoder.yudao.module.bpm.service.candidate.BpmCandidateSourceInfo; | ||
| 11 | +import cn.iocoder.yudao.module.bpm.service.candidate.BpmCandidateSourceInfoProcessor; | ||
| 12 | +import cn.iocoder.yudao.module.system.api.dict.DictDataApi; | ||
| 13 | +import org.flowable.engine.delegate.DelegateExecution; | ||
| 14 | +import org.springframework.beans.factory.ObjectProvider; | ||
| 15 | + | ||
| 16 | +import jakarta.annotation.Resource; | ||
| 17 | +import java.util.*; | ||
| 18 | +import java.util.stream.Collectors; | ||
| 19 | + | ||
| 20 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 21 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | ||
| 22 | +import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.TASK_ASSIGN_SCRIPT_NOT_EXISTS; | ||
| 23 | + | ||
| 24 | +public class BpmCandidateScriptApiSourceInfoProcessor implements BpmCandidateSourceInfoProcessor { | ||
| 25 | + @Resource | ||
| 26 | + private DictDataApi dictDataApi; | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 任务分配脚本 | ||
| 30 | + */ | ||
| 31 | + private Map<Long, BpmTaskAssignScript> scriptMap = Collections.emptyMap(); | ||
| 32 | + | ||
| 33 | + public void setScripts(ObjectProvider<BpmTaskAssignScript> scriptsOp) { | ||
| 34 | + List<BpmTaskAssignScript> scripts = scriptsOp.orderedStream().collect(Collectors.toList()); | ||
| 35 | + setScripts(scripts); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + public void setScripts(List<BpmTaskAssignScript> scripts) { | ||
| 39 | + this.scriptMap = convertMap(scripts, script -> script.getEnum().getId()); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + @Override | ||
| 43 | + public Set<Integer> getSupportedTypes() { | ||
| 44 | + return SetUtils.asSet(BpmTaskAssignRuleTypeEnum.SCRIPT.getType()); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + @Override | ||
| 48 | + public void validRuleOptions(Integer type, Set<Long> options) { | ||
| 49 | + dictDataApi.validateDictDataList(DictTypeConstants.TASK_ASSIGN_SCRIPT, | ||
| 50 | + CollectionUtils.convertSet(options, String::valueOf)); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + @Override | ||
| 54 | + public Set<Long> doProcess(BpmCandidateSourceInfo request, BpmTaskCandidateRuleVO rule, DelegateExecution delegateExecution) { | ||
| 55 | + return calculateTaskCandidateUsersByScript(delegateExecution, rule.getOptions()); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + private Set<Long> calculateTaskCandidateUsersByScript(DelegateExecution execution, Set<Long> options) { | ||
| 59 | + // 获得对应的脚本 | ||
| 60 | + List<BpmTaskAssignScript> scripts = new ArrayList<>(options.size()); | ||
| 61 | + options.forEach(id -> { | ||
| 62 | + BpmTaskAssignScript script = scriptMap.get(id); | ||
| 63 | + if (script == null) { | ||
| 64 | + throw exception(TASK_ASSIGN_SCRIPT_NOT_EXISTS, id); | ||
| 65 | + } | ||
| 66 | + scripts.add(script); | ||
| 67 | + }); | ||
| 68 | + // 逐个计算任务 | ||
| 69 | + Set<Long> userIds = new HashSet<>(); | ||
| 70 | + scripts.forEach(script -> CollUtil.addAll(userIds, script.calculateTaskCandidateUsers(execution))); | ||
| 71 | + return userIds; | ||
| 72 | + } | ||
| 73 | +} | ||
| 0 | \ No newline at end of file | 74 | \ No newline at end of file |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/candidate/sourceInfoProcessor/BpmCandidateUserGroupApiSourceInfoProcessor.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.service.candidate.sourceInfoProcessor; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.util.collection.SetUtils; | ||
| 4 | +import cn.iocoder.yudao.module.bpm.controller.admin.candidate.vo.BpmTaskCandidateRuleVO; | ||
| 5 | +import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmUserGroupDO; | ||
| 6 | +import cn.iocoder.yudao.module.bpm.enums.definition.BpmTaskAssignRuleTypeEnum; | ||
| 7 | +import cn.iocoder.yudao.module.bpm.service.candidate.BpmCandidateSourceInfo; | ||
| 8 | +import cn.iocoder.yudao.module.bpm.service.candidate.BpmCandidateSourceInfoProcessor; | ||
| 9 | +import cn.iocoder.yudao.module.bpm.service.definition.BpmUserGroupService; | ||
| 10 | +import org.flowable.engine.delegate.DelegateExecution; | ||
| 11 | + | ||
| 12 | +import jakarta.annotation.Resource; | ||
| 13 | +import java.util.HashSet; | ||
| 14 | +import java.util.List; | ||
| 15 | +import java.util.Set; | ||
| 16 | + | ||
| 17 | +public class BpmCandidateUserGroupApiSourceInfoProcessor implements BpmCandidateSourceInfoProcessor { | ||
| 18 | + @Resource | ||
| 19 | + private BpmUserGroupService api; | ||
| 20 | + @Resource | ||
| 21 | + private BpmUserGroupService userGroupService; | ||
| 22 | + | ||
| 23 | + @Override | ||
| 24 | + public Set<Integer> getSupportedTypes() { | ||
| 25 | + return SetUtils.asSet(BpmTaskAssignRuleTypeEnum.USER_GROUP.getType()); | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + @Override | ||
| 29 | + public void validRuleOptions(Integer type, Set<Long> options) { | ||
| 30 | + api.validUserGroups(options); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + @Override | ||
| 34 | + public Set<Long> doProcess(BpmCandidateSourceInfo request, BpmTaskCandidateRuleVO rule, DelegateExecution delegateExecution) { | ||
| 35 | + List<BpmUserGroupDO> userGroups = userGroupService.getUserGroupList(rule.getOptions()); | ||
| 36 | + Set<Long> userIds = new HashSet<>(); | ||
| 37 | + userGroups.forEach(group -> userIds.addAll(group.getMemberUserIds())); | ||
| 38 | + return userIds; | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | +} | ||
| 0 | \ No newline at end of file | 42 | \ No newline at end of file |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/cc/BpmProcessInstanceCopyService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.service.cc; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceCCMyPageReqVO; | ||
| 5 | +import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceCCPageItemRespVO; | ||
| 6 | +import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceCCReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.bpm.service.candidate.BpmCandidateSourceInfo; | ||
| 8 | + | ||
| 9 | +// TODO @kyle:这个 Service 要不挪到 task 包下;保持统一,task 下有流程、任务、抄送等; | ||
| 10 | +// TODO @kyle:中文和英文之间,有个空格,会更清晰点;例如说;流程抄送 Service 接口;中文写作习惯~ | ||
| 11 | +/** | ||
| 12 | + * 流程抄送Service接口 | ||
| 13 | + * | ||
| 14 | + * 现在是在审批的时候进行流程抄送 | ||
| 15 | + */ | ||
| 16 | +public interface BpmProcessInstanceCopyService { | ||
| 17 | + | ||
| 18 | + // TODO @kyle:无用的方法,可以去掉哈;另外,考虑到避免过多的 VO,这里就可以返回 BpmProcessInstanceCopyDO | ||
| 19 | + /** | ||
| 20 | + * 查询流程抄送 | ||
| 21 | + * | ||
| 22 | + * @param copyId 流程抄送主键 | ||
| 23 | + * @return 流程抄送 | ||
| 24 | + */ | ||
| 25 | + BpmProcessInstanceCopyVO queryById(Long copyId); | ||
| 26 | + | ||
| 27 | + // TODO 芋艿:这块要 review 下;思考下~~ | ||
| 28 | + /** | ||
| 29 | + * 抄送 | ||
| 30 | + * @param sourceInfo 抄送源信息,方便抄送处理 | ||
| 31 | + * @return | ||
| 32 | + */ | ||
| 33 | + boolean makeCopy(BpmCandidateSourceInfo sourceInfo); | ||
| 34 | + | ||
| 35 | + // TODO @kyle:可以方法名改成 createProcessInstanceCopy;现在项目一般新增都用 create 为主; | ||
| 36 | + /** | ||
| 37 | + * 流程实例的抄送 | ||
| 38 | + * | ||
| 39 | + * @param userId 当前登录用户 | ||
| 40 | + * @param createReqVO 创建的抄送请求 | ||
| 41 | + * @return 是否抄送成功,抄送成功则返回true TODO @kyle:这里可以不用返回哈;目前一般是失败,就抛出业务异常; | ||
| 42 | + */ | ||
| 43 | + boolean ccProcessInstance(Long userId, BpmProcessInstanceCCReqVO createReqVO); | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * 抄送的流程 | ||
| 47 | + * @param loginUserId 登录用户id | ||
| 48 | + * @param pageReqVO 分页请求 | ||
| 49 | + * @return 抄送的分页结果 | ||
| 50 | + */ | ||
| 51 | + PageResult<BpmProcessInstanceCCPageItemRespVO> getMyProcessInstanceCCPage(Long loginUserId, | ||
| 52 | + BpmProcessInstanceCCMyPageReqVO pageReqVO); | ||
| 53 | +} |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/cc/BpmProcessInstanceCopyServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.service.cc; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 5 | +import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceCCMyPageReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceCCPageItemRespVO; | ||
| 7 | +import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceCCReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.bpm.convert.cc.BpmProcessInstanceCopyConvert; | ||
| 9 | +import cn.iocoder.yudao.module.bpm.dal.dataobject.cc.BpmProcessInstanceCopyDO; | ||
| 10 | +import cn.iocoder.yudao.module.bpm.dal.mysql.cc.BpmProcessInstanceCopyMapper; | ||
| 11 | +import cn.iocoder.yudao.module.bpm.service.candidate.BpmCandidateSourceInfo; | ||
| 12 | +import cn.iocoder.yudao.module.bpm.service.candidate.BpmCandidateSourceInfoProcessorChain; | ||
| 13 | +import cn.iocoder.yudao.module.bpm.service.cc.dto.BpmDelegateExecutionDTO; | ||
| 14 | +import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService; | ||
| 15 | +import cn.iocoder.yudao.module.bpm.service.task.BpmTaskService; | ||
| 16 | +import cn.iocoder.yudao.module.bpm.util.FlowableUtils; | ||
| 17 | +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | ||
| 18 | +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | ||
| 19 | +import jakarta.annotation.Resource; | ||
| 20 | +import lombok.extern.slf4j.Slf4j; | ||
| 21 | +import org.flowable.engine.RuntimeService; | ||
| 22 | +import org.flowable.engine.delegate.DelegateExecution; | ||
| 23 | +import org.flowable.engine.repository.ProcessDefinition; | ||
| 24 | +import org.flowable.engine.runtime.ProcessInstance; | ||
| 25 | +import org.springframework.context.annotation.Lazy; | ||
| 26 | +import org.springframework.stereotype.Service; | ||
| 27 | +import org.springframework.validation.annotation.Validated; | ||
| 28 | + | ||
| 29 | +import java.time.LocalDateTime; | ||
| 30 | +import java.util.*; | ||
| 31 | +import java.util.stream.Collectors; | ||
| 32 | + | ||
| 33 | +// TODO @kyle:类注释要写下 | ||
| 34 | +@Slf4j // TODO @kyle:按照 @Service、@Validated、@Slf4j,从重要到不重要的顺序; | ||
| 35 | +@Service | ||
| 36 | +@Validated | ||
| 37 | +public class BpmProcessInstanceCopyServiceImpl implements BpmProcessInstanceCopyService { | ||
| 38 | + @Resource // TODO @kyle:第一个变量,和类之间要有空行; | ||
| 39 | + private BpmProcessInstanceCopyMapper processInstanceCopyMapper; | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * 和flowable有关的,查询流程名用的 TODO @kyle:可以不写哈注释; | ||
| 43 | + */ | ||
| 44 | + @Resource | ||
| 45 | + private RuntimeService runtimeService; | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 找抄送人用的 TODO @kyle:可以不写哈注释; | ||
| 49 | + */ | ||
| 50 | + @Resource | ||
| 51 | + private BpmCandidateSourceInfoProcessorChain processorChain; | ||
| 52 | + | ||
| 53 | + // TODO @kyle:多余的变量,可以去掉哈 | ||
| 54 | + @Resource | ||
| 55 | + @Lazy // 解决循环依赖 | ||
| 56 | + private BpmTaskService bpmTaskService; | ||
| 57 | + @Resource | ||
| 58 | + @Lazy // 解决循环依赖 | ||
| 59 | + private BpmProcessInstanceService bpmProcessInstanceService; | ||
| 60 | + @Resource | ||
| 61 | + private AdminUserApi adminUserApi; | ||
| 62 | + | ||
| 63 | + @Override | ||
| 64 | + public BpmProcessInstanceCopyVO queryById(Long copyId) { | ||
| 65 | + BpmProcessInstanceCopyDO bpmProcessInstanceCopyDO = processInstanceCopyMapper.selectById(copyId); | ||
| 66 | + return BpmProcessInstanceCopyConvert.INSTANCE.convert(bpmProcessInstanceCopyDO); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + // TODO @kyle:makeCopy 和 ccProcessInstance 的调用关系,感受上反了; | ||
| 70 | + // makeCopy 有点像基于规则,查找抄送人,然后创建; | ||
| 71 | + // ccProcessInstance 是已经有了抄送人,然后创建; | ||
| 72 | + // 建议的改造:独立基于 processInstanceCopyMapper 做 insert | ||
| 73 | + @Override | ||
| 74 | + public boolean makeCopy(BpmCandidateSourceInfo sourceInfo) { | ||
| 75 | + if (null == sourceInfo) { | ||
| 76 | + return false; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + DelegateExecution executionEntity = new BpmDelegateExecutionDTO(sourceInfo.getProcessInstanceId()); | ||
| 80 | + Set<Long> ccCandidates = processorChain.calculateTaskCandidateUsers(executionEntity, sourceInfo); | ||
| 81 | + if (CollUtil.isEmpty(ccCandidates)) { | ||
| 82 | + log.warn("相关抄送人不存在 {}", sourceInfo.getTaskId()); | ||
| 83 | + return false; | ||
| 84 | + } else { | ||
| 85 | + BpmProcessInstanceCopyDO copyDO = new BpmProcessInstanceCopyDO(); | ||
| 86 | + // 调用 | ||
| 87 | + // 设置任务id | ||
| 88 | + copyDO.setTaskId(sourceInfo.getTaskId()); | ||
| 89 | + copyDO.setTaskName(FlowableUtils.getTaskNameByTaskId(sourceInfo.getTaskId())); | ||
| 90 | + copyDO.setProcessInstanceId(sourceInfo.getProcessInstanceId()); | ||
| 91 | + ProcessInstance processInstance = runtimeService.createProcessInstanceQuery() | ||
| 92 | + .processInstanceId(sourceInfo.getProcessInstanceId()) | ||
| 93 | + .singleResult(); | ||
| 94 | + if (null == processInstance) { | ||
| 95 | + log.warn("相关流程实例不存在 {}", sourceInfo.getTaskId()); | ||
| 96 | + return false; | ||
| 97 | + } | ||
| 98 | + copyDO.setStartUserId(FlowableUtils.getStartUserIdFromProcessInstance(processInstance)); | ||
| 99 | + copyDO.setProcessInstanceName(processInstance.getName()); | ||
| 100 | + ProcessDefinition processDefinition = FlowableUtils.getProcessDefinition(processInstance.getProcessDefinitionId()); | ||
| 101 | + copyDO.setProcessDefinitionCategory(processDefinition.getCategory()); | ||
| 102 | + copyDO.setReason(sourceInfo.getReason()); | ||
| 103 | + copyDO.setCreator(sourceInfo.getCreator()); | ||
| 104 | + copyDO.setCreateTime(LocalDateTime.now()); | ||
| 105 | + List<BpmProcessInstanceCopyDO> copyList = new ArrayList<>(ccCandidates.size()); | ||
| 106 | + for (Long userId : ccCandidates) { | ||
| 107 | + BpmProcessInstanceCopyDO copy = BpmProcessInstanceCopyConvert.INSTANCE.copy(copyDO); | ||
| 108 | + copy.setUserId(userId); | ||
| 109 | + copyList.add(copy); | ||
| 110 | + } | ||
| 111 | + return processInstanceCopyMapper.insertBatch(copyList); | ||
| 112 | + } | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + @Override | ||
| 116 | + public boolean ccProcessInstance(Long userId, BpmProcessInstanceCCReqVO reqVO) { | ||
| 117 | + // 在能正常审批的情况下抄送流程 | ||
| 118 | + BpmCandidateSourceInfo sourceInfo = new BpmCandidateSourceInfo(); | ||
| 119 | + sourceInfo.setTaskId(reqVO.getTaskKey()); | ||
| 120 | + sourceInfo.setProcessInstanceId(reqVO.getProcessInstanceKey()); | ||
| 121 | + sourceInfo.addRule(reqVO); | ||
| 122 | + sourceInfo.setCreator(String.valueOf(userId)); | ||
| 123 | + sourceInfo.setReason(reqVO.getReason()); | ||
| 124 | + if (!makeCopy(sourceInfo)) { | ||
| 125 | + throw new RuntimeException("抄送任务失败"); | ||
| 126 | + } | ||
| 127 | + return false; | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + //获取流程抄送分页 TODO @kyle:接口已经注释,这里不用注释了哈; | ||
| 131 | + @Override | ||
| 132 | + public PageResult<BpmProcessInstanceCCPageItemRespVO> getMyProcessInstanceCCPage(Long loginUserId, BpmProcessInstanceCCMyPageReqVO pageReqVO) { | ||
| 133 | + // 通过 BpmProcessInstanceExtDO 表,先查询到对应的分页 | ||
| 134 | + // TODO @kyle:一般读逻辑,Service 返回 PageResult<BpmProcessInstanceCopyDO> 即可。关联数据的查询和拼接,交给 Controller;目的是:保证 Service 聚焦写逻辑,清晰简洁; | ||
| 135 | + PageResult<BpmProcessInstanceCopyDO> pageResult = processInstanceCopyMapper.selectPage(loginUserId, pageReqVO); | ||
| 136 | + if (CollUtil.isEmpty(pageResult.getList())) { | ||
| 137 | + return new PageResult<>(pageResult.getTotal()); | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + // TODO @kyle:这种可以简洁点;参考如下 | ||
| 141 | +// Map<String, ProcessInstance> processInstanceMap = bpmProcessInstanceService.getProcessInstanceMap( | ||
| 142 | +// convertSet(pageResult.getList(), BpmProcessInstanceCopyDO::getProcessInstanceId)); | ||
| 143 | + | ||
| 144 | + Set<String/* taskId */> taskIds = new HashSet<>(); | ||
| 145 | + Set<String/* processInstaneId */> processInstaneIds = new HashSet<>(); | ||
| 146 | + Set<Long/* userId */> userIds = new HashSet<>(); | ||
| 147 | + for (BpmProcessInstanceCopyDO doItem : pageResult.getList()) { | ||
| 148 | + taskIds.add(doItem.getTaskId()); | ||
| 149 | + processInstaneIds.add(doItem.getProcessInstanceId()); | ||
| 150 | + userIds.add(doItem.getStartUserId()); | ||
| 151 | + Long userId = Long.valueOf(doItem.getCreator()); | ||
| 152 | + userIds.add(userId); | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + Map<String, String> taskNameByTaskIds = FlowableUtils.getTaskNameByTaskIds(taskIds); | ||
| 156 | + Map<String, String> processInstanceNameByTaskIds = FlowableUtils.getProcessInstanceNameByTaskIds(processInstaneIds); | ||
| 157 | + | ||
| 158 | + Map<Long, String> userMap = adminUserApi.getUserList(userIds).stream().collect(Collectors.toMap( | ||
| 159 | + AdminUserRespDTO::getId, AdminUserRespDTO::getNickname)); | ||
| 160 | + | ||
| 161 | + // 转换返回 | ||
| 162 | + return BpmProcessInstanceCopyConvert.INSTANCE.convertPage(pageResult, taskNameByTaskIds, processInstanceNameByTaskIds, userMap); | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | +} |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/cc/BpmProcessInstanceCopyVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.service.cc; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.time.LocalDateTime; | ||
| 7 | + | ||
| 8 | +// TODO @kyle:看看是不是要删除 | ||
| 9 | +/** | ||
| 10 | + * 流程抄送视图对象 wf_copy | ||
| 11 | + * | ||
| 12 | + * @author ruoyi | ||
| 13 | + * @date 2022-05-19 | ||
| 14 | + */ | ||
| 15 | +@Data | ||
| 16 | +public class BpmProcessInstanceCopyVO { | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * 编号 | ||
| 20 | + */ | ||
| 21 | + @Schema(description = "抄送主键") | ||
| 22 | + private Long id; | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 发起人Id | ||
| 26 | + */ | ||
| 27 | + @Schema(description = "发起人Id") | ||
| 28 | + private Long startUserId; | ||
| 29 | + | ||
| 30 | + @Schema(description = "发起人别名") | ||
| 31 | + private String startUserNickname; | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * 流程主键 | ||
| 35 | + */ | ||
| 36 | + @Schema(description = "流程实例的主键") | ||
| 37 | + private String processInstanceId; | ||
| 38 | + | ||
| 39 | + @Schema(description = "流程实例的名字") | ||
| 40 | + private String processInstanceName; | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * 任务主键 | ||
| 44 | + */ | ||
| 45 | + @Schema(description = "发起抄送的任务编号") | ||
| 46 | + private String taskId; | ||
| 47 | + | ||
| 48 | + @Schema(description = "发起抄送的任务名称") | ||
| 49 | + private String taskName; | ||
| 50 | + /** | ||
| 51 | + * 用户主键 | ||
| 52 | + */ | ||
| 53 | + @Schema(description = "用户编号") | ||
| 54 | + private Long userId; | ||
| 55 | + | ||
| 56 | + @Schema(description = "用户别名") | ||
| 57 | + private Long userNickname; | ||
| 58 | + | ||
| 59 | + @Schema(description = "抄送原因") | ||
| 60 | + private String reason; | ||
| 61 | + | ||
| 62 | + @Schema(description = "抄送人") | ||
| 63 | + private String creator; | ||
| 64 | + | ||
| 65 | + @Schema(description = "抄送时间") | ||
| 66 | + private LocalDateTime createTime; | ||
| 67 | +} |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/cc/dto/BpmDelegateExecutionDTO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.service.cc.dto; | ||
| 2 | + | ||
| 3 | +import org.flowable.bpmn.model.FlowElement; | ||
| 4 | +import org.flowable.bpmn.model.FlowableListener; | ||
| 5 | +import org.flowable.engine.delegate.DelegateExecution; | ||
| 6 | +import org.flowable.engine.delegate.ReadOnlyDelegateExecution; | ||
| 7 | +import org.flowable.variable.api.persistence.entity.VariableInstance; | ||
| 8 | + | ||
| 9 | +import java.util.Collection; | ||
| 10 | +import java.util.List; | ||
| 11 | +import java.util.Map; | ||
| 12 | +import java.util.Set; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * 仅为了传输processInstanceId | ||
| 16 | + */ | ||
| 17 | +public class BpmDelegateExecutionDTO implements DelegateExecution { | ||
| 18 | + | ||
| 19 | + public BpmDelegateExecutionDTO(String getProcessInstanceId) { | ||
| 20 | + this.getProcessInstanceId = getProcessInstanceId; | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + private final String getProcessInstanceId; | ||
| 24 | + | ||
| 25 | + @Override | ||
| 26 | + public String getId() { | ||
| 27 | + return null; | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + @Override | ||
| 31 | + public String getProcessInstanceId() { | ||
| 32 | + return null; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + @Override | ||
| 36 | + public String getRootProcessInstanceId() { | ||
| 37 | + return null; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + @Override | ||
| 41 | + public String getEventName() { | ||
| 42 | + return null; | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + @Override | ||
| 46 | + public void setEventName(String eventName) { | ||
| 47 | + | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + @Override | ||
| 51 | + public String getProcessInstanceBusinessKey() { | ||
| 52 | + return null; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + @Override | ||
| 56 | + public String getProcessInstanceBusinessStatus() { | ||
| 57 | + return null; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + @Override | ||
| 61 | + public String getProcessDefinitionId() { | ||
| 62 | + return null; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + @Override | ||
| 66 | + public String getPropagatedStageInstanceId() { | ||
| 67 | + return null; | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + @Override | ||
| 71 | + public String getParentId() { | ||
| 72 | + return null; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + @Override | ||
| 76 | + public String getSuperExecutionId() { | ||
| 77 | + return null; | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + @Override | ||
| 81 | + public String getCurrentActivityId() { | ||
| 82 | + return null; | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + @Override | ||
| 86 | + public String getTenantId() { | ||
| 87 | + return null; | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + @Override | ||
| 91 | + public FlowElement getCurrentFlowElement() { | ||
| 92 | + return null; | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + @Override | ||
| 96 | + public void setCurrentFlowElement(FlowElement flowElement) { | ||
| 97 | + | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + @Override | ||
| 101 | + public FlowableListener getCurrentFlowableListener() { | ||
| 102 | + return null; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + @Override | ||
| 106 | + public void setCurrentFlowableListener(FlowableListener currentListener) { | ||
| 107 | + | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + @Override | ||
| 111 | + public ReadOnlyDelegateExecution snapshotReadOnly() { | ||
| 112 | + return null; | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + @Override | ||
| 116 | + public DelegateExecution getParent() { | ||
| 117 | + return null; | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + @Override | ||
| 121 | + public List<? extends DelegateExecution> getExecutions() { | ||
| 122 | + return null; | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + @Override | ||
| 126 | + public void setActive(boolean isActive) { | ||
| 127 | + | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + @Override | ||
| 131 | + public boolean isActive() { | ||
| 132 | + return false; | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + @Override | ||
| 136 | + public boolean isEnded() { | ||
| 137 | + return false; | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + @Override | ||
| 141 | + public void setConcurrent(boolean isConcurrent) { | ||
| 142 | + | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + @Override | ||
| 146 | + public boolean isConcurrent() { | ||
| 147 | + return false; | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + @Override | ||
| 151 | + public boolean isProcessInstanceType() { | ||
| 152 | + return false; | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + @Override | ||
| 156 | + public void inactivate() { | ||
| 157 | + | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + @Override | ||
| 161 | + public boolean isScope() { | ||
| 162 | + return false; | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + @Override | ||
| 166 | + public void setScope(boolean isScope) { | ||
| 167 | + | ||
| 168 | + } | ||
| 169 | + | ||
| 170 | + @Override | ||
| 171 | + public boolean isMultiInstanceRoot() { | ||
| 172 | + return false; | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + @Override | ||
| 176 | + public void setMultiInstanceRoot(boolean isMultiInstanceRoot) { | ||
| 177 | + | ||
| 178 | + } | ||
| 179 | + | ||
| 180 | + @Override | ||
| 181 | + public Map<String, Object> getVariables() { | ||
| 182 | + return null; | ||
| 183 | + } | ||
| 184 | + | ||
| 185 | + @Override | ||
| 186 | + public Map<String, VariableInstance> getVariableInstances() { | ||
| 187 | + return null; | ||
| 188 | + } | ||
| 189 | + | ||
| 190 | + @Override | ||
| 191 | + public Map<String, Object> getVariables(Collection<String> collection) { | ||
| 192 | + return null; | ||
| 193 | + } | ||
| 194 | + | ||
| 195 | + @Override | ||
| 196 | + public Map<String, VariableInstance> getVariableInstances(Collection<String> collection) { | ||
| 197 | + return null; | ||
| 198 | + } | ||
| 199 | + | ||
| 200 | + @Override | ||
| 201 | + public Map<String, Object> getVariables(Collection<String> collection, boolean b) { | ||
| 202 | + return null; | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + @Override | ||
| 206 | + public Map<String, VariableInstance> getVariableInstances(Collection<String> collection, boolean b) { | ||
| 207 | + return null; | ||
| 208 | + } | ||
| 209 | + | ||
| 210 | + @Override | ||
| 211 | + public Map<String, Object> getVariablesLocal() { | ||
| 212 | + return null; | ||
| 213 | + } | ||
| 214 | + | ||
| 215 | + @Override | ||
| 216 | + public Map<String, VariableInstance> getVariableInstancesLocal() { | ||
| 217 | + return null; | ||
| 218 | + } | ||
| 219 | + | ||
| 220 | + @Override | ||
| 221 | + public Map<String, Object> getVariablesLocal(Collection<String> collection) { | ||
| 222 | + return null; | ||
| 223 | + } | ||
| 224 | + | ||
| 225 | + @Override | ||
| 226 | + public Map<String, VariableInstance> getVariableInstancesLocal(Collection<String> collection) { | ||
| 227 | + return null; | ||
| 228 | + } | ||
| 229 | + | ||
| 230 | + @Override | ||
| 231 | + public Map<String, Object> getVariablesLocal(Collection<String> collection, boolean b) { | ||
| 232 | + return null; | ||
| 233 | + } | ||
| 234 | + | ||
| 235 | + @Override | ||
| 236 | + public Map<String, VariableInstance> getVariableInstancesLocal(Collection<String> collection, boolean b) { | ||
| 237 | + return null; | ||
| 238 | + } | ||
| 239 | + | ||
| 240 | + @Override | ||
| 241 | + public Object getVariable(String s) { | ||
| 242 | + return null; | ||
| 243 | + } | ||
| 244 | + | ||
| 245 | + @Override | ||
| 246 | + public VariableInstance getVariableInstance(String s) { | ||
| 247 | + return null; | ||
| 248 | + } | ||
| 249 | + | ||
| 250 | + @Override | ||
| 251 | + public Object getVariable(String s, boolean b) { | ||
| 252 | + return null; | ||
| 253 | + } | ||
| 254 | + | ||
| 255 | + @Override | ||
| 256 | + public VariableInstance getVariableInstance(String s, boolean b) { | ||
| 257 | + return null; | ||
| 258 | + } | ||
| 259 | + | ||
| 260 | + @Override | ||
| 261 | + public Object getVariableLocal(String s) { | ||
| 262 | + return null; | ||
| 263 | + } | ||
| 264 | + | ||
| 265 | + @Override | ||
| 266 | + public VariableInstance getVariableInstanceLocal(String s) { | ||
| 267 | + return null; | ||
| 268 | + } | ||
| 269 | + | ||
| 270 | + @Override | ||
| 271 | + public Object getVariableLocal(String s, boolean b) { | ||
| 272 | + return null; | ||
| 273 | + } | ||
| 274 | + | ||
| 275 | + @Override | ||
| 276 | + public VariableInstance getVariableInstanceLocal(String s, boolean b) { | ||
| 277 | + return null; | ||
| 278 | + } | ||
| 279 | + | ||
| 280 | + @Override | ||
| 281 | + public <T> T getVariable(String s, Class<T> aClass) { | ||
| 282 | + return null; | ||
| 283 | + } | ||
| 284 | + | ||
| 285 | + @Override | ||
| 286 | + public <T> T getVariableLocal(String s, Class<T> aClass) { | ||
| 287 | + return null; | ||
| 288 | + } | ||
| 289 | + | ||
| 290 | + @Override | ||
| 291 | + public Set<String> getVariableNames() { | ||
| 292 | + return null; | ||
| 293 | + } | ||
| 294 | + | ||
| 295 | + @Override | ||
| 296 | + public Set<String> getVariableNamesLocal() { | ||
| 297 | + return null; | ||
| 298 | + } | ||
| 299 | + | ||
| 300 | + @Override | ||
| 301 | + public void setVariable(String s, Object o) { | ||
| 302 | + | ||
| 303 | + } | ||
| 304 | + | ||
| 305 | + @Override | ||
| 306 | + public void setVariable(String s, Object o, boolean b) { | ||
| 307 | + | ||
| 308 | + } | ||
| 309 | + | ||
| 310 | + @Override | ||
| 311 | + public Object setVariableLocal(String s, Object o) { | ||
| 312 | + return null; | ||
| 313 | + } | ||
| 314 | + | ||
| 315 | + @Override | ||
| 316 | + public Object setVariableLocal(String s, Object o, boolean b) { | ||
| 317 | + return null; | ||
| 318 | + } | ||
| 319 | + | ||
| 320 | + @Override | ||
| 321 | + public void setVariables(Map<String, ?> map) { | ||
| 322 | + | ||
| 323 | + } | ||
| 324 | + | ||
| 325 | + @Override | ||
| 326 | + public void setVariablesLocal(Map<String, ?> map) { | ||
| 327 | + | ||
| 328 | + } | ||
| 329 | + | ||
| 330 | + @Override | ||
| 331 | + public boolean hasVariables() { | ||
| 332 | + return false; | ||
| 333 | + } | ||
| 334 | + | ||
| 335 | + @Override | ||
| 336 | + public boolean hasVariablesLocal() { | ||
| 337 | + return false; | ||
| 338 | + } | ||
| 339 | + | ||
| 340 | + @Override | ||
| 341 | + public boolean hasVariable(String s) { | ||
| 342 | + return false; | ||
| 343 | + } | ||
| 344 | + | ||
| 345 | + @Override | ||
| 346 | + public boolean hasVariableLocal(String s) { | ||
| 347 | + return false; | ||
| 348 | + } | ||
| 349 | + | ||
| 350 | + @Override | ||
| 351 | + public void removeVariable(String s) { | ||
| 352 | + | ||
| 353 | + } | ||
| 354 | + | ||
| 355 | + @Override | ||
| 356 | + public void removeVariableLocal(String s) { | ||
| 357 | + | ||
| 358 | + } | ||
| 359 | + | ||
| 360 | + @Override | ||
| 361 | + public void removeVariables(Collection<String> collection) { | ||
| 362 | + | ||
| 363 | + } | ||
| 364 | + | ||
| 365 | + @Override | ||
| 366 | + public void removeVariablesLocal(Collection<String> collection) { | ||
| 367 | + | ||
| 368 | + } | ||
| 369 | + | ||
| 370 | + @Override | ||
| 371 | + public void removeVariables() { | ||
| 372 | + | ||
| 373 | + } | ||
| 374 | + | ||
| 375 | + @Override | ||
| 376 | + public void removeVariablesLocal() { | ||
| 377 | + | ||
| 378 | + } | ||
| 379 | + | ||
| 380 | + @Override | ||
| 381 | + public void setTransientVariable(String s, Object o) { | ||
| 382 | + | ||
| 383 | + } | ||
| 384 | + | ||
| 385 | + @Override | ||
| 386 | + public void setTransientVariableLocal(String s, Object o) { | ||
| 387 | + | ||
| 388 | + } | ||
| 389 | + | ||
| 390 | + @Override | ||
| 391 | + public void setTransientVariables(Map<String, Object> map) { | ||
| 392 | + | ||
| 393 | + } | ||
| 394 | + | ||
| 395 | + @Override | ||
| 396 | + public Object getTransientVariable(String s) { | ||
| 397 | + return null; | ||
| 398 | + } | ||
| 399 | + | ||
| 400 | + @Override | ||
| 401 | + public Map<String, Object> getTransientVariables() { | ||
| 402 | + return null; | ||
| 403 | + } | ||
| 404 | + | ||
| 405 | + @Override | ||
| 406 | + public void setTransientVariablesLocal(Map<String, Object> map) { | ||
| 407 | + | ||
| 408 | + } | ||
| 409 | + | ||
| 410 | + @Override | ||
| 411 | + public Object getTransientVariableLocal(String s) { | ||
| 412 | + return null; | ||
| 413 | + } | ||
| 414 | + | ||
| 415 | + @Override | ||
| 416 | + public Map<String, Object> getTransientVariablesLocal() { | ||
| 417 | + return null; | ||
| 418 | + } | ||
| 419 | + | ||
| 420 | + @Override | ||
| 421 | + public void removeTransientVariableLocal(String s) { | ||
| 422 | + | ||
| 423 | + } | ||
| 424 | + | ||
| 425 | + @Override | ||
| 426 | + public void removeTransientVariable(String s) { | ||
| 427 | + | ||
| 428 | + } | ||
| 429 | + | ||
| 430 | + @Override | ||
| 431 | + public void removeTransientVariables() { | ||
| 432 | + | ||
| 433 | + } | ||
| 434 | + | ||
| 435 | + @Override | ||
| 436 | + public void removeTransientVariablesLocal() { | ||
| 437 | + | ||
| 438 | + } | ||
| 439 | +} |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java
| @@ -19,6 +19,8 @@ import cn.iocoder.yudao.module.bpm.enums.task.BpmCommentTypeEnum; | @@ -19,6 +19,8 @@ import cn.iocoder.yudao.module.bpm.enums.task.BpmCommentTypeEnum; | ||
| 19 | import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceDeleteReasonEnum; | 19 | import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceDeleteReasonEnum; |
| 20 | import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum; | 20 | import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum; |
| 21 | import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskAddSignTypeEnum; | 21 | import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskAddSignTypeEnum; |
| 22 | +import cn.iocoder.yudao.module.bpm.service.candidate.BpmCandidateSourceInfo; | ||
| 23 | +import cn.iocoder.yudao.module.bpm.service.cc.BpmProcessInstanceCopyService; | ||
| 22 | import cn.iocoder.yudao.module.bpm.service.definition.BpmModelService; | 24 | import cn.iocoder.yudao.module.bpm.service.definition.BpmModelService; |
| 23 | import cn.iocoder.yudao.module.bpm.service.message.BpmMessageService; | 25 | import cn.iocoder.yudao.module.bpm.service.message.BpmMessageService; |
| 24 | import cn.iocoder.yudao.module.system.api.dept.DeptApi; | 26 | import cn.iocoder.yudao.module.system.api.dept.DeptApi; |
| @@ -94,6 +96,9 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -94,6 +96,9 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 94 | @Resource | 96 | @Resource |
| 95 | private ManagementService managementService; | 97 | private ManagementService managementService; |
| 96 | 98 | ||
| 99 | + @Resource | ||
| 100 | + private BpmProcessInstanceCopyService processInstanceCopyService; | ||
| 101 | + | ||
| 97 | @Override | 102 | @Override |
| 98 | public PageResult<BpmTaskTodoPageItemRespVO> getTodoTaskPage(Long userId, BpmTaskTodoPageReqVO pageVO) { | 103 | public PageResult<BpmTaskTodoPageItemRespVO> getTodoTaskPage(Long userId, BpmTaskTodoPageReqVO pageVO) { |
| 99 | // 查询待办任务 | 104 | // 查询待办任务 |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/util/FlowableUtils.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.util; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import cn.hutool.core.collection.CollUtil; | ||
| 5 | +import cn.hutool.extra.spring.SpringUtil; | ||
| 6 | +import cn.iocoder.yudao.framework.common.util.number.NumberUtils; | ||
| 7 | +import org.flowable.bpmn.model.BpmnModel; | ||
| 8 | +import org.flowable.bpmn.model.ExtensionElement; | ||
| 9 | +import org.flowable.bpmn.model.FlowElement; | ||
| 10 | +import org.flowable.bpmn.model.FlowNode; | ||
| 11 | +import org.flowable.engine.RepositoryService; | ||
| 12 | +import org.flowable.engine.RuntimeService; | ||
| 13 | +import org.flowable.engine.TaskService; | ||
| 14 | +import org.flowable.engine.repository.ProcessDefinition; | ||
| 15 | +import org.flowable.engine.runtime.ProcessInstance; | ||
| 16 | +import org.flowable.task.api.Task; | ||
| 17 | + | ||
| 18 | +import java.util.*; | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * 流程引擎工具类封装 | ||
| 22 | + * | ||
| 23 | + * @author: linjinp | ||
| 24 | + * @create: 2019-12-24 13:51 | ||
| 25 | + **/ | ||
| 26 | +public class FlowableUtils { | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 获取流程名称 | ||
| 30 | + * | ||
| 31 | + * @param processDefinitionId | ||
| 32 | + * @return | ||
| 33 | + */ | ||
| 34 | + public static String getProcessDefinitionName(String processDefinitionId) { | ||
| 35 | + RepositoryService repositoryService = SpringUtil.getBean(RepositoryService.class); | ||
| 36 | + ProcessDefinition processDefinition = repositoryService.getProcessDefinition(processDefinitionId); | ||
| 37 | + return processDefinition.getName(); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + public static ProcessDefinition getProcessDefinition(String processDefinitionId) { | ||
| 41 | + RepositoryService repositoryService = SpringUtil.getBean(RepositoryService.class); | ||
| 42 | + return repositoryService.getProcessDefinition(processDefinitionId); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * 获取节点数据 | ||
| 47 | + * | ||
| 48 | + * @param processInstanceId | ||
| 49 | + * @param nodeId | ||
| 50 | + * @return | ||
| 51 | + */ | ||
| 52 | + public static FlowNode getFlowNode(String processInstanceId, String nodeId) { | ||
| 53 | + | ||
| 54 | + RuntimeService runtimeService = SpringUtil.getBean(RuntimeService.class); | ||
| 55 | + RepositoryService repositoryService = SpringUtil.getBean(RepositoryService.class); | ||
| 56 | + | ||
| 57 | + String definitionld = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult().getProcessDefinitionId(); // 获取bpm(模型)对象 | ||
| 58 | + BpmnModel bpmnModel = repositoryService.getBpmnModel(definitionld); | ||
| 59 | + // 传节点定义key获取当前节点 | ||
| 60 | + FlowNode flowNode = (FlowNode) bpmnModel.getFlowElement(nodeId); | ||
| 61 | + return flowNode; | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + public static ExtensionElement generateFlowNodeIdExtension(String nodeId) { | ||
| 65 | + ExtensionElement extensionElement = new ExtensionElement(); | ||
| 66 | + extensionElement.setElementText(nodeId); | ||
| 67 | + extensionElement.setName("nodeId"); | ||
| 68 | + extensionElement.setNamespacePrefix("flowable"); | ||
| 69 | + extensionElement.setNamespace("nodeId"); | ||
| 70 | + return extensionElement; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + public static String getNodeIdFromExtension(FlowElement flowElement) { | ||
| 74 | + Map<String, List<ExtensionElement>> extensionElements = flowElement.getExtensionElements(); | ||
| 75 | + return extensionElements.get("nodeId").get(0).getElementText(); | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + public static Long getStartUserIdFromProcessInstance(ProcessInstance instance) { | ||
| 79 | + if (null == instance) { | ||
| 80 | + return null; | ||
| 81 | + } | ||
| 82 | + return NumberUtils.parseLong(instance.getStartUserId()); | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + public static String getTaskNameByTaskId(String taskId) { | ||
| 86 | + TaskService taskService = SpringUtil.getBean(TaskService.class); | ||
| 87 | + Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); | ||
| 88 | + return task.getName(); | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + // TODO @kyle:Utils 里不做查询;可以封装到 bpmTaskService 里 | ||
| 92 | + public static Map<String/* taskId */, String/* taskName */> getTaskNameByTaskIds(Collection<String> taskIds) { | ||
| 93 | + TaskService taskService = SpringUtil.getBean(TaskService.class); | ||
| 94 | + List<Task> tasks = taskService.createTaskQuery().taskIds(taskIds).list(); | ||
| 95 | + if (CollUtil.isNotEmpty(tasks)) { | ||
| 96 | + Map<String/* taskId */, String/* taskName */> taskMap = new HashMap<>(tasks.size()); | ||
| 97 | + for (Task task : tasks) { | ||
| 98 | + taskMap.putIfAbsent(task.getId(), task.getName()); | ||
| 99 | + } | ||
| 100 | + return taskMap; | ||
| 101 | + } | ||
| 102 | + return Collections.emptyMap(); | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + public static String getProcessInstanceNameByTaskId(String processInstanceId) { | ||
| 106 | + RuntimeService runtimeService = SpringUtil.getBean(RuntimeService.class); | ||
| 107 | + ProcessInstance processInstance = runtimeService.createProcessInstanceQuery() | ||
| 108 | + .processInstanceId(processInstanceId) | ||
| 109 | + .singleResult(); | ||
| 110 | + return processInstance.getName(); | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + // TODO @kyle:Utils 里不做查询;可以封装到 bpmTaskService 里 | ||
| 114 | + public static Map<String/* processInstaneId */, String/* processInstaneName */> getProcessInstanceNameByTaskIds(Set<String> taskIds) { | ||
| 115 | + RuntimeService runtimeService = SpringUtil.getBean(RuntimeService.class); | ||
| 116 | + List<ProcessInstance> processInstances = runtimeService.createProcessInstanceQuery().processInstanceIds(taskIds).list(); | ||
| 117 | + if (CollUtil.isNotEmpty(processInstances)) { | ||
| 118 | + Map<String/* processInstaneId */, String/* processInstaneName */> processInstaneMap = new HashMap<>(processInstances.size()); | ||
| 119 | + for (ProcessInstance processInstance : processInstances) { | ||
| 120 | + processInstaneMap.putIfAbsent(processInstance.getId(), processInstance.getName()); | ||
| 121 | + } | ||
| 122 | + return processInstaneMap; | ||
| 123 | + } | ||
| 124 | + return Collections.emptyMap(); | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | +} |
yudao-module-bpm/yudao-module-bpm-biz/src/test/java/cn/iocoder/yudao/module/bpm/service/candidate/BpmCandidateSourceInfoProcessorChainTest.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.service.candidate; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.map.MapUtil; | ||
| 4 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | ||
| 5 | +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | ||
| 6 | +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | ||
| 7 | +import cn.iocoder.yudao.module.bpm.controller.admin.candidate.vo.BpmTaskCandidateRuleVO; | ||
| 8 | +import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmUserGroupDO; | ||
| 9 | +import cn.iocoder.yudao.module.bpm.enums.definition.BpmTaskAssignRuleTypeEnum; | ||
| 10 | +import cn.iocoder.yudao.module.bpm.enums.definition.BpmTaskRuleScriptEnum; | ||
| 11 | +import cn.iocoder.yudao.module.bpm.framework.flowable.core.behavior.script.BpmTaskAssignScript; | ||
| 12 | +import cn.iocoder.yudao.module.bpm.framework.flowable.core.behavior.script.impl.BpmTaskAssignLeaderX1Script; | ||
| 13 | +import cn.iocoder.yudao.module.bpm.framework.flowable.core.behavior.script.impl.BpmTaskAssignLeaderX2Script; | ||
| 14 | +import cn.iocoder.yudao.module.bpm.service.candidate.sourceInfoProcessor.BpmCandidateScriptApiSourceInfoProcessor; | ||
| 15 | +import cn.iocoder.yudao.module.bpm.service.definition.BpmUserGroupService; | ||
| 16 | +import cn.iocoder.yudao.module.system.api.dept.DeptApi; | ||
| 17 | +import cn.iocoder.yudao.module.system.api.dept.PostApi; | ||
| 18 | +import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; | ||
| 19 | +import cn.iocoder.yudao.module.system.api.dict.DictDataApi; | ||
| 20 | +import cn.iocoder.yudao.module.system.api.permission.PermissionApi; | ||
| 21 | +import cn.iocoder.yudao.module.system.api.permission.RoleApi; | ||
| 22 | +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | ||
| 23 | +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | ||
| 24 | +import jakarta.annotation.Resource; | ||
| 25 | +import org.flowable.engine.delegate.DelegateExecution; | ||
| 26 | +import org.junit.jupiter.api.Test; | ||
| 27 | +import org.springframework.boot.test.mock.mockito.MockBean; | ||
| 28 | +import org.springframework.context.annotation.Import; | ||
| 29 | + | ||
| 30 | +import java.util.Arrays; | ||
| 31 | +import java.util.List; | ||
| 32 | +import java.util.Map; | ||
| 33 | +import java.util.Set; | ||
| 34 | + | ||
| 35 | +import static cn.iocoder.yudao.framework.common.util.collection.SetUtils.asSet; | ||
| 36 | +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; | ||
| 37 | +import static java.util.Collections.singleton; | ||
| 38 | +import static org.junit.jupiter.api.Assertions.assertEquals; | ||
| 39 | +import static org.mockito.ArgumentMatchers.eq; | ||
| 40 | +import static org.mockito.Mockito.when; | ||
| 41 | + | ||
| 42 | +@Import({BpmCandidateSourceInfoProcessorChain.class, | ||
| 43 | + BpmCandidateScriptApiSourceInfoProcessor.class, BpmTaskAssignLeaderX1Script.class, | ||
| 44 | + BpmTaskAssignLeaderX2Script.class}) | ||
| 45 | +public class BpmCandidateSourceInfoProcessorChainTest extends BaseDbUnitTest { | ||
| 46 | + @Resource | ||
| 47 | + private BpmCandidateSourceInfoProcessorChain processorChain; | ||
| 48 | + | ||
| 49 | + @MockBean | ||
| 50 | + private BpmUserGroupService userGroupService; | ||
| 51 | + @MockBean | ||
| 52 | + private DeptApi deptApi; | ||
| 53 | + @MockBean | ||
| 54 | + private AdminUserApi adminUserApi; | ||
| 55 | + @MockBean | ||
| 56 | + private PermissionApi permissionApi; | ||
| 57 | + @MockBean | ||
| 58 | + private RoleApi roleApi; | ||
| 59 | + @MockBean | ||
| 60 | + private PostApi postApi; | ||
| 61 | + @MockBean | ||
| 62 | + private DictDataApi dictDataApi; | ||
| 63 | + @Resource | ||
| 64 | + private BpmCandidateScriptApiSourceInfoProcessor bpmCandidateScriptApiSourceInfoProcessor; | ||
| 65 | + | ||
| 66 | + @Test | ||
| 67 | + public void testCalculateTaskCandidateUsers_Role() { | ||
| 68 | + // 准备参数 | ||
| 69 | + BpmTaskCandidateRuleVO rule = new BpmTaskCandidateRuleVO().setOptions(asSet(1L, 2L)) | ||
| 70 | + .setType(BpmTaskAssignRuleTypeEnum.ROLE.getType()); | ||
| 71 | + // mock 方法 | ||
| 72 | + when(permissionApi.getUserRoleIdListByRoleIds(eq(rule.getOptions()))) | ||
| 73 | + .thenReturn(asSet(11L, 22L)); | ||
| 74 | + mockGetUserMap(asSet(11L, 22L)); | ||
| 75 | + | ||
| 76 | + // 调用 | ||
| 77 | + BpmCandidateSourceInfo sourceInfo = new BpmCandidateSourceInfo(); | ||
| 78 | + sourceInfo.addRule(rule); | ||
| 79 | + Set<Long> results = processorChain.calculateTaskCandidateUsers(null, sourceInfo); | ||
| 80 | + // 断言 | ||
| 81 | + assertEquals(asSet(11L, 22L), results); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + @Test | ||
| 85 | + public void testCalculateTaskCandidateUsers_DeptMember() { | ||
| 86 | + // 准备参数 | ||
| 87 | + BpmTaskCandidateRuleVO rule = new BpmTaskCandidateRuleVO().setOptions(asSet(1L, 2L)) | ||
| 88 | + .setType(BpmTaskAssignRuleTypeEnum.DEPT_MEMBER.getType()); | ||
| 89 | + // mock 方法 | ||
| 90 | + List<AdminUserRespDTO> users = CollectionUtils.convertList(asSet(11L, 22L), | ||
| 91 | + id -> new AdminUserRespDTO().setId(id)); | ||
| 92 | + when(adminUserApi.getUserListByDeptIds(eq(rule.getOptions()))).thenReturn(users); | ||
| 93 | + mockGetUserMap(asSet(11L, 22L)); | ||
| 94 | + | ||
| 95 | + // 调用 | ||
| 96 | + BpmCandidateSourceInfo sourceInfo = new BpmCandidateSourceInfo(); | ||
| 97 | + sourceInfo.addRule(rule); | ||
| 98 | + Set<Long> results = processorChain.calculateTaskCandidateUsers(null, sourceInfo); | ||
| 99 | + // 断言 | ||
| 100 | + assertEquals(asSet(11L, 22L), results); | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + @Test | ||
| 104 | + public void testCalculateTaskCandidateUsers_DeptLeader() { | ||
| 105 | + // 准备参数 | ||
| 106 | + BpmTaskCandidateRuleVO rule = new BpmTaskCandidateRuleVO().setOptions(asSet(1L, 2L)) | ||
| 107 | + .setType(BpmTaskAssignRuleTypeEnum.DEPT_LEADER.getType()); | ||
| 108 | + // mock 方法 | ||
| 109 | + DeptRespDTO dept1 = randomPojo(DeptRespDTO.class, o -> o.setLeaderUserId(11L)); | ||
| 110 | + DeptRespDTO dept2 = randomPojo(DeptRespDTO.class, o -> o.setLeaderUserId(22L)); | ||
| 111 | + when(deptApi.getDeptList(eq(rule.getOptions()))).thenReturn(Arrays.asList(dept1, dept2)); | ||
| 112 | + mockGetUserMap(asSet(11L, 22L)); | ||
| 113 | + | ||
| 114 | + // 调用 | ||
| 115 | + BpmCandidateSourceInfo sourceInfo = new BpmCandidateSourceInfo(); | ||
| 116 | + sourceInfo.addRule(rule); | ||
| 117 | + Set<Long> results = processorChain.calculateTaskCandidateUsers(null, sourceInfo); | ||
| 118 | + // 断言 | ||
| 119 | + assertEquals(asSet(11L, 22L), results); | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + @Test | ||
| 123 | + public void testCalculateTaskCandidateUsers_Post() { | ||
| 124 | + // 准备参数 | ||
| 125 | + BpmTaskCandidateRuleVO rule = new BpmTaskCandidateRuleVO().setOptions(asSet(1L, 2L)) | ||
| 126 | + .setType(BpmTaskAssignRuleTypeEnum.POST.getType()); | ||
| 127 | + // mock 方法 | ||
| 128 | + List<AdminUserRespDTO> users = CollectionUtils.convertList(asSet(11L, 22L), | ||
| 129 | + id -> new AdminUserRespDTO().setId(id)); | ||
| 130 | + when(adminUserApi.getUserListByPostIds(eq(rule.getOptions()))).thenReturn(users); | ||
| 131 | + mockGetUserMap(asSet(11L, 22L)); | ||
| 132 | + | ||
| 133 | + // 调用 | ||
| 134 | + BpmCandidateSourceInfo sourceInfo = new BpmCandidateSourceInfo(); | ||
| 135 | + sourceInfo.addRule(rule); | ||
| 136 | + Set<Long> results = processorChain.calculateTaskCandidateUsers(null, sourceInfo); | ||
| 137 | + // 断言 | ||
| 138 | + assertEquals(asSet(11L, 22L), results); | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + @Test | ||
| 142 | + public void testCalculateTaskCandidateUsers_User() { | ||
| 143 | + // 准备参数 | ||
| 144 | + BpmTaskCandidateRuleVO rule = new BpmTaskCandidateRuleVO().setOptions(asSet(1L, 2L)) | ||
| 145 | + .setType(BpmTaskAssignRuleTypeEnum.USER.getType()); | ||
| 146 | + // mock 方法 | ||
| 147 | + mockGetUserMap(asSet(1L, 2L)); | ||
| 148 | + | ||
| 149 | + // 调用 | ||
| 150 | + BpmCandidateSourceInfo sourceInfo = new BpmCandidateSourceInfo(); | ||
| 151 | + sourceInfo.addRule(rule); | ||
| 152 | + Set<Long> results = processorChain.calculateTaskCandidateUsers(null, sourceInfo); | ||
| 153 | + // 断言 | ||
| 154 | + assertEquals(asSet(1L, 2L), results); | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + @Test | ||
| 158 | + public void testCalculateTaskCandidateUsers_UserGroup() { | ||
| 159 | + // 准备参数 | ||
| 160 | + BpmTaskCandidateRuleVO rule = new BpmTaskCandidateRuleVO().setOptions(asSet(1L, 2L)) | ||
| 161 | + .setType(BpmTaskAssignRuleTypeEnum.USER_GROUP.getType()); | ||
| 162 | + // mock 方法 | ||
| 163 | + BpmUserGroupDO userGroup1 = randomPojo(BpmUserGroupDO.class, o -> o.setMemberUserIds(asSet(11L, 12L))); | ||
| 164 | + BpmUserGroupDO userGroup2 = randomPojo(BpmUserGroupDO.class, o -> o.setMemberUserIds(asSet(21L, 22L))); | ||
| 165 | + when(userGroupService.getUserGroupList(eq(rule.getOptions()))).thenReturn(Arrays.asList(userGroup1, userGroup2)); | ||
| 166 | + mockGetUserMap(asSet(11L, 12L, 21L, 22L)); | ||
| 167 | + | ||
| 168 | + // 调用 | ||
| 169 | + BpmCandidateSourceInfo sourceInfo = new BpmCandidateSourceInfo(); | ||
| 170 | + sourceInfo.addRule(rule); | ||
| 171 | + Set<Long> results = processorChain.calculateTaskCandidateUsers(null, sourceInfo); | ||
| 172 | + // 断言 | ||
| 173 | + assertEquals(asSet(11L, 12L, 21L, 22L), results); | ||
| 174 | + } | ||
| 175 | + | ||
| 176 | + private void mockGetUserMap(Set<Long> assigneeUserIds) { | ||
| 177 | + Map<Long, AdminUserRespDTO> userMap = CollectionUtils.convertMap(assigneeUserIds, id -> id, | ||
| 178 | + id -> new AdminUserRespDTO().setId(id).setStatus(CommonStatusEnum.ENABLE.getStatus())); | ||
| 179 | + when(adminUserApi.getUserMap(eq(assigneeUserIds))).thenReturn(userMap); | ||
| 180 | + } | ||
| 181 | + | ||
| 182 | + @Test | ||
| 183 | + public void testCalculateTaskCandidateUsers_Script() { | ||
| 184 | + // 准备参数 | ||
| 185 | + BpmTaskCandidateRuleVO rule = new BpmTaskCandidateRuleVO().setOptions(asSet(20L, 21L)) | ||
| 186 | + .setType(BpmTaskAssignRuleTypeEnum.SCRIPT.getType()); | ||
| 187 | + // mock 方法 | ||
| 188 | + BpmTaskAssignScript script1 = new BpmTaskAssignScript() { | ||
| 189 | + | ||
| 190 | + @Override | ||
| 191 | + public Set<Long> calculateTaskCandidateUsers(DelegateExecution task) { | ||
| 192 | + return singleton(11L); | ||
| 193 | + } | ||
| 194 | + | ||
| 195 | + @Override | ||
| 196 | + public BpmTaskRuleScriptEnum getEnum() { | ||
| 197 | + return BpmTaskRuleScriptEnum.LEADER_X1; | ||
| 198 | + } | ||
| 199 | + }; | ||
| 200 | + BpmTaskAssignScript script2 = new BpmTaskAssignScript() { | ||
| 201 | + | ||
| 202 | + @Override | ||
| 203 | + public Set<Long> calculateTaskCandidateUsers(DelegateExecution task) { | ||
| 204 | + return singleton(22L); | ||
| 205 | + } | ||
| 206 | + | ||
| 207 | + @Override | ||
| 208 | + public BpmTaskRuleScriptEnum getEnum() { | ||
| 209 | + return BpmTaskRuleScriptEnum.LEADER_X2; | ||
| 210 | + } | ||
| 211 | + }; | ||
| 212 | + bpmCandidateScriptApiSourceInfoProcessor.setScripts(Arrays.asList(script1, script2)); | ||
| 213 | + mockGetUserMap(asSet(11L, 22L)); | ||
| 214 | + | ||
| 215 | + // 调用 | ||
| 216 | + BpmCandidateSourceInfo sourceInfo = new BpmCandidateSourceInfo(); | ||
| 217 | + sourceInfo.addRule(rule); | ||
| 218 | + Set<Long> results = processorChain.calculateTaskCandidateUsers(null, sourceInfo); | ||
| 219 | + // 断言 | ||
| 220 | + assertEquals(asSet(11L, 22L), results); | ||
| 221 | + } | ||
| 222 | + | ||
| 223 | + @Test | ||
| 224 | + public void testRemoveDisableUsers() { | ||
| 225 | + // 准备参数. 1L 可以找到;2L 是禁用的;3L 找不到 | ||
| 226 | + Set<Long> assigneeUserIds = asSet(1L, 2L, 3L); | ||
| 227 | + // mock 方法 | ||
| 228 | + AdminUserRespDTO user1 = randomPojo(AdminUserRespDTO.class, o -> o.setId(1L) | ||
| 229 | + .setStatus(CommonStatusEnum.ENABLE.getStatus())); | ||
| 230 | + AdminUserRespDTO user2 = randomPojo(AdminUserRespDTO.class, o -> o.setId(2L) | ||
| 231 | + .setStatus(CommonStatusEnum.DISABLE.getStatus())); | ||
| 232 | + Map<Long, AdminUserRespDTO> userMap = MapUtil.builder(user1.getId(), user1) | ||
| 233 | + .put(user2.getId(), user2).build(); | ||
| 234 | + when(adminUserApi.getUserMap(eq(assigneeUserIds))).thenReturn(userMap); | ||
| 235 | + | ||
| 236 | + // 调用 | ||
| 237 | + processorChain.removeDisableUsers(assigneeUserIds); | ||
| 238 | + // 断言 | ||
| 239 | + assertEquals(asSet(1L), assigneeUserIds); | ||
| 240 | + } | ||
| 241 | + | ||
| 242 | +} | ||
| 0 | \ No newline at end of file | 243 | \ No newline at end of file |
yudao-module-bpm/yudao-module-bpm-biz/src/test/java/cn/iocoder/yudao/module/bpm/service/cc/BpmProcessInstanceCopyServiceTest.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.bpm.service.cc; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | ||
| 4 | +import jakarta.annotation.Resource; | ||
| 5 | +import org.junit.jupiter.api.Test; | ||
| 6 | +import org.springframework.context.annotation.Import; | ||
| 7 | + | ||
| 8 | +@Import({BpmProcessInstanceCopyServiceImpl.class}) | ||
| 9 | +class BpmProcessInstanceCopyServiceTest extends BaseDbUnitTest { | ||
| 10 | + @Resource | ||
| 11 | + private BpmProcessInstanceCopyServiceImpl service; | ||
| 12 | + | ||
| 13 | + @Test | ||
| 14 | + void queryById() { | ||
| 15 | + } | ||
| 16 | +} | ||
| 0 | \ No newline at end of file | 17 | \ No newline at end of file |
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/DictTypeConstants.java
| @@ -13,6 +13,6 @@ public interface DictTypeConstants { | @@ -13,6 +13,6 @@ public interface DictTypeConstants { | ||
| 13 | String CRM_AUDIT_STATUS = "crm_audit_status"; // CRM 审批状态 | 13 | String CRM_AUDIT_STATUS = "crm_audit_status"; // CRM 审批状态 |
| 14 | String CRM_PRODUCT_UNIT = "crm_product_unit"; // CRM 产品单位 | 14 | String CRM_PRODUCT_UNIT = "crm_product_unit"; // CRM 产品单位 |
| 15 | String CRM_PRODUCT_STATUS = "crm_product_status"; // CRM 产品状态 | 15 | String CRM_PRODUCT_STATUS = "crm_product_status"; // CRM 产品状态 |
| 16 | - String CRM_FOLLOW_UP_TYPE = "crm_follow_up_type"; // 跟进方式 | 16 | + String CRM_FOLLOW_UP_TYPE = "crm_follow_up_type"; // CRM 跟进方式 |
| 17 | 17 | ||
| 18 | } | 18 | } |
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/ErrorCodeConstants.java
| @@ -19,6 +19,7 @@ public interface ErrorCodeConstants { | @@ -19,6 +19,7 @@ public interface ErrorCodeConstants { | ||
| 19 | 19 | ||
| 20 | // ========== 商机管理 1-020-002-000 ========== | 20 | // ========== 商机管理 1-020-002-000 ========== |
| 21 | ErrorCode BUSINESS_NOT_EXISTS = new ErrorCode(1_020_002_000, "商机不存在"); | 21 | ErrorCode BUSINESS_NOT_EXISTS = new ErrorCode(1_020_002_000, "商机不存在"); |
| 22 | + ErrorCode BUSINESS_CONTRACT_EXISTS = new ErrorCode(1_020_002_001, "商机已关联合同,不能删除"); | ||
| 22 | 23 | ||
| 23 | // TODO @lilleo:商机状态、商机类型,都单独错误码段 | 24 | // TODO @lilleo:商机状态、商机类型,都单独错误码段 |
| 24 | 25 | ||
| @@ -83,6 +84,7 @@ public interface ErrorCodeConstants { | @@ -83,6 +84,7 @@ public interface ErrorCodeConstants { | ||
| 83 | 84 | ||
| 84 | // ========== 跟进记录 1_020_013_000 ========== | 85 | // ========== 跟进记录 1_020_013_000 ========== |
| 85 | ErrorCode FOLLOW_UP_RECORD_NOT_EXISTS = new ErrorCode(1_020_013_000, "跟进记录不存在"); | 86 | ErrorCode FOLLOW_UP_RECORD_NOT_EXISTS = new ErrorCode(1_020_013_000, "跟进记录不存在"); |
| 87 | + ErrorCode FOLLOW_UP_RECORD_DELETE_DENIED = new ErrorCode(1_020_013_001, "删除跟进记录失败,原因:没有权限"); | ||
| 86 | 88 | ||
| 87 | // ========== 待办消息 1_020_014_000 ========== | 89 | // ========== 待办消息 1_020_014_000 ========== |
| 88 | ErrorCode BACKLOG_CONTACT_STATUS_INVALID = new ErrorCode(1_020_014_000, "客户联系状态有误"); | 90 | ErrorCode BACKLOG_CONTACT_STATUS_INVALID = new ErrorCode(1_020_014_000, "客户联系状态有误"); |
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/LogRecordConstants.java
| @@ -11,6 +11,12 @@ public interface LogRecordConstants { | @@ -11,6 +11,12 @@ public interface LogRecordConstants { | ||
| 11 | // ======================= CRM_LEADS 线索 ======================= | 11 | // ======================= CRM_LEADS 线索 ======================= |
| 12 | 12 | ||
| 13 | String CRM_LEADS_TYPE = "CRM 线索"; | 13 | String CRM_LEADS_TYPE = "CRM 线索"; |
| 14 | + String CRM_LEADS_CREATE_SUB_TYPE = "创建线索"; | ||
| 15 | + String CRM_LEADS_CREATE_SUCCESS = "创建了线索{{#clue.name}}"; | ||
| 16 | + String CRM_LEADS_UPDATE_SUB_TYPE = "更新线索"; | ||
| 17 | + String CRM_LEADS_UPDATE_SUCCESS = "更新了线索【{{#clueName}}】: {_DIFF{#updateReqVO}}"; | ||
| 18 | + String CRM_LEADS_DELETE_SUB_TYPE = "删除线索"; | ||
| 19 | + String CRM_LEADS_DELETE_SUCCESS = "删除了线索【{{#clueName}}】"; | ||
| 14 | 20 | ||
| 15 | // ======================= CRM_CUSTOMER 客户 ======================= | 21 | // ======================= CRM_CUSTOMER 客户 ======================= |
| 16 | 22 |
yudao-module-crm/yudao-module-crm-api/src/main/java/cn/iocoder/yudao/module/crm/enums/business/CrmBizEndStatus.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.enums.business; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.util.ObjectUtil; | ||
| 4 | +import cn.iocoder.yudao.framework.common.core.IntArrayValuable; | ||
| 5 | +import lombok.Getter; | ||
| 6 | +import lombok.RequiredArgsConstructor; | ||
| 7 | + | ||
| 8 | +import java.util.Arrays; | ||
| 9 | + | ||
| 10 | +// TODO @lzxhqs:1)title、description、create 可以删除,非标准的 javadoc 注释哈,然后可以在类上加下这个类的注释;2)CrmBizEndStatus 改成 CrmBusinessEndStatus,非必要不缩写哈,可阅读比较重要 | ||
| 11 | +/** | ||
| 12 | + * @author lzxhqs | ||
| 13 | + * @version 1.0 | ||
| 14 | + * @title CrmBizEndStatus | ||
| 15 | + * @description | ||
| 16 | + * @create 2024/1/12 | ||
| 17 | + */ | ||
| 18 | +@RequiredArgsConstructor | ||
| 19 | +@Getter | ||
| 20 | +public enum CrmBizEndStatus implements IntArrayValuable { | ||
| 21 | + | ||
| 22 | + WIN(1, "赢单"), | ||
| 23 | + LOSE(2, "输单"), | ||
| 24 | + INVALID(3, "无效"); | ||
| 25 | + | ||
| 26 | + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CrmBizEndStatus::getStatus).toArray(); | ||
| 27 | + | ||
| 28 | + // TODO @lzxhqs:这里的方法,建议放到 49 行之后;一般类里是,静态变量,普通变量;静态方法;普通方法 | ||
| 29 | + public static boolean isWin(Integer status) { | ||
| 30 | + return ObjectUtil.equal(WIN.getStatus(), status); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + public static boolean isLose(Integer status) { | ||
| 34 | + return ObjectUtil.equal(LOSE.getStatus(), status); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + public static boolean isInvalid(Integer status) { | ||
| 38 | + return ObjectUtil.equal(INVALID.getStatus(), status); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * 场景类型 | ||
| 43 | + */ | ||
| 44 | + private final Integer status; | ||
| 45 | + /** | ||
| 46 | + * 场景名称 | ||
| 47 | + */ | ||
| 48 | + private final String name; | ||
| 49 | + | ||
| 50 | + @Override | ||
| 51 | + public int[] array() { | ||
| 52 | + return ARRAYS; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/CrmBusinessStatusTypeController.java
| @@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | @@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageParam; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | ||
| 7 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 8 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 8 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | 9 | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 9 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | 10 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| @@ -24,19 +25,17 @@ import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; | @@ -24,19 +25,17 @@ import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; | ||
| 24 | import io.swagger.v3.oas.annotations.Operation; | 25 | import io.swagger.v3.oas.annotations.Operation; |
| 25 | import io.swagger.v3.oas.annotations.Parameter; | 26 | import io.swagger.v3.oas.annotations.Parameter; |
| 26 | import io.swagger.v3.oas.annotations.tags.Tag; | 27 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 28 | +import jakarta.annotation.Resource; | ||
| 29 | +import jakarta.servlet.http.HttpServletResponse; | ||
| 30 | +import jakarta.validation.Valid; | ||
| 27 | import org.springframework.security.access.prepost.PreAuthorize; | 31 | import org.springframework.security.access.prepost.PreAuthorize; |
| 28 | import org.springframework.validation.annotation.Validated; | 32 | import org.springframework.validation.annotation.Validated; |
| 29 | import org.springframework.web.bind.annotation.*; | 33 | import org.springframework.web.bind.annotation.*; |
| 30 | 34 | ||
| 31 | -import jakarta.annotation.Resource; | ||
| 32 | -import jakarta.servlet.http.HttpServletResponse; | ||
| 33 | -import jakarta.validation.Valid; | ||
| 34 | import java.io.IOException; | 35 | import java.io.IOException; |
| 35 | import java.util.Collection; | 36 | import java.util.Collection; |
| 36 | import java.util.List; | 37 | import java.util.List; |
| 37 | -import java.util.Objects; | ||
| 38 | import java.util.Set; | 38 | import java.util.Set; |
| 39 | -import java.util.stream.Collectors; | ||
| 40 | 39 | ||
| 41 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 40 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 42 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | 41 | import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
| @@ -85,13 +84,13 @@ public class CrmBusinessStatusTypeController { | @@ -85,13 +84,13 @@ public class CrmBusinessStatusTypeController { | ||
| 85 | @Parameter(name = "id", description = "编号", required = true, example = "1024") | 84 | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| 86 | @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") | 85 | @PreAuthorize("@ss.hasPermission('crm:business-status-type:query')") |
| 87 | public CommonResult<CrmBusinessStatusTypeRespVO> getBusinessStatusType(@RequestParam("id") Long id) { | 86 | public CommonResult<CrmBusinessStatusTypeRespVO> getBusinessStatusType(@RequestParam("id") Long id) { |
| 88 | - CrmBusinessStatusTypeDO businessStatusType = businessStatusTypeService.getBusinessStatusType(id); | 87 | + CrmBusinessStatusTypeDO statusType = businessStatusTypeService.getBusinessStatusType(id); |
| 89 | // 处理状态回显 | 88 | // 处理状态回显 |
| 90 | - // TODO @ljlleo:可以使用 CollectionUtils.convertSet 替代常用的 stream 操作,更简洁一点;下面几个也是哈; | 89 | + // TODO @lzxhqs:可以在 businessStatusService 加个 getBusinessStatusListByTypeId 方法,直接返回 List<CrmBusinessStatusDO> 哈,常用的,尽量封装个简单易懂的方法,不用追求绝对通用哈; |
| 91 | CrmBusinessStatusQueryVO queryVO = new CrmBusinessStatusQueryVO(); | 90 | CrmBusinessStatusQueryVO queryVO = new CrmBusinessStatusQueryVO(); |
| 92 | queryVO.setTypeId(id); | 91 | queryVO.setTypeId(id); |
| 93 | List<CrmBusinessStatusDO> statusList = businessStatusService.selectList(queryVO); | 92 | List<CrmBusinessStatusDO> statusList = businessStatusService.selectList(queryVO); |
| 94 | - return success(CrmBusinessStatusTypeConvert.INSTANCE.convert(businessStatusType, statusList)); | 93 | + return success(CrmBusinessStatusTypeConvert.INSTANCE.convert(statusType, statusList)); |
| 95 | } | 94 | } |
| 96 | 95 | ||
| 97 | @GetMapping("/page") | 96 | @GetMapping("/page") |
| @@ -100,12 +99,7 @@ public class CrmBusinessStatusTypeController { | @@ -100,12 +99,7 @@ public class CrmBusinessStatusTypeController { | ||
| 100 | public CommonResult<PageResult<CrmBusinessStatusTypeRespVO>> getBusinessStatusTypePage(@Valid CrmBusinessStatusTypePageReqVO pageReqVO) { | 99 | public CommonResult<PageResult<CrmBusinessStatusTypeRespVO>> getBusinessStatusTypePage(@Valid CrmBusinessStatusTypePageReqVO pageReqVO) { |
| 101 | PageResult<CrmBusinessStatusTypeDO> pageResult = businessStatusTypeService.getBusinessStatusTypePage(pageReqVO); | 100 | PageResult<CrmBusinessStatusTypeDO> pageResult = businessStatusTypeService.getBusinessStatusTypePage(pageReqVO); |
| 102 | // 处理部门回显 | 101 | // 处理部门回显 |
| 103 | - // TODO @ljlleo:可以使用 CollectionUtils.convertSet 替代常用的 stream 操作,更简洁一点;下面几个也是哈; | ||
| 104 | - Set<Long> deptIds = pageResult.getList().stream() | ||
| 105 | - .map(CrmBusinessStatusTypeDO::getDeptIds) | ||
| 106 | - .filter(Objects::nonNull) | ||
| 107 | - .flatMap(Collection::stream) | ||
| 108 | - .collect(Collectors.toSet()); | 102 | + Set<Long> deptIds = CollectionUtils.convertSetByFlatMap(pageResult.getList(), CrmBusinessStatusTypeDO::getDeptIds,Collection::stream); |
| 109 | List<DeptRespDTO> deptList = deptApi.getDeptList(deptIds); | 103 | List<DeptRespDTO> deptList = deptApi.getDeptList(deptIds); |
| 110 | return success(CrmBusinessStatusTypeConvert.INSTANCE.convertPage(pageResult, deptList)); | 104 | return success(CrmBusinessStatusTypeConvert.INSTANCE.convertPage(pageResult, deptList)); |
| 111 | } | 105 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/business/CrmBusinessSaveReqVO.java
| 1 | package cn.iocoder.yudao.module.crm.controller.admin.business.vo.business; | 1 | package cn.iocoder.yudao.module.crm.controller.admin.business.vo.business; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | ||
| 4 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.product.CrmBusinessProductSaveReqVO; | ||
| 5 | +import cn.iocoder.yudao.module.crm.enums.business.CrmBizEndStatus; | ||
| 3 | import cn.iocoder.yudao.module.crm.framework.operatelog.core.CrmCustomerParseFunction; | 6 | import cn.iocoder.yudao.module.crm.framework.operatelog.core.CrmCustomerParseFunction; |
| 4 | import com.mzt.logapi.starter.annotation.DiffLogField; | 7 | import com.mzt.logapi.starter.annotation.DiffLogField; |
| 5 | import io.swagger.v3.oas.annotations.media.Schema; | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| @@ -9,10 +12,11 @@ import org.springframework.format.annotation.DateTimeFormat; | @@ -9,10 +12,11 @@ import org.springframework.format.annotation.DateTimeFormat; | ||
| 9 | 12 | ||
| 10 | import java.math.BigDecimal; | 13 | import java.math.BigDecimal; |
| 11 | import java.time.LocalDateTime; | 14 | import java.time.LocalDateTime; |
| 15 | +import java.util.ArrayList; | ||
| 16 | +import java.util.List; | ||
| 12 | 17 | ||
| 13 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | 18 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 14 | 19 | ||
| 15 | -// TODO @ljileo:DiffLogField function 完善一下 | ||
| 16 | @Schema(description = "管理后台 - CRM 商机创建/更新 Request VO") | 20 | @Schema(description = "管理后台 - CRM 商机创建/更新 Request VO") |
| 17 | @Data | 21 | @Data |
| 18 | public class CrmBusinessSaveReqVO { | 22 | public class CrmBusinessSaveReqVO { |
| @@ -54,7 +58,7 @@ public class CrmBusinessSaveReqVO { | @@ -54,7 +58,7 @@ public class CrmBusinessSaveReqVO { | ||
| 54 | @DiffLogField(name = "商机金额") | 58 | @DiffLogField(name = "商机金额") |
| 55 | private Integer price; | 59 | private Integer price; |
| 56 | 60 | ||
| 57 | - // TODO @ljileo:折扣使用 Integer 类型,存储时,默认 * 100;展示的时候,前端需要 / 100;避免精度丢失问题 | 61 | + // TODO @lzxhqs:折扣使用 Integer 类型,存储时,默认 * 100;展示的时候,前端需要 / 100;避免精度丢失问题 |
| 58 | @Schema(description = "整单折扣") | 62 | @Schema(description = "整单折扣") |
| 59 | @DiffLogField(name = "整单折扣") | 63 | @DiffLogField(name = "整单折扣") |
| 60 | private Integer discountPercent; | 64 | private Integer discountPercent; |
| @@ -67,6 +71,15 @@ public class CrmBusinessSaveReqVO { | @@ -67,6 +71,15 @@ public class CrmBusinessSaveReqVO { | ||
| 67 | @DiffLogField(name = "备注") | 71 | @DiffLogField(name = "备注") |
| 68 | private String remark; | 72 | private String remark; |
| 69 | 73 | ||
| 70 | - // TODO @ljileo:修改的时候,应该可以传递添加的产品; | 74 | + @Schema(description = "结束状态", example = "1") |
| 75 | + @InEnum(CrmBizEndStatus.class) | ||
| 76 | + private Integer endStatus; | ||
| 77 | + | ||
| 78 | + // TODO @lzxhqs:不设置默认 new ArrayList<>();一般 pojo 不设置默认值哈 | ||
| 79 | + @Schema(description = "商机产品列表") | ||
| 80 | + private List<CrmBusinessProductSaveReqVO> products = new ArrayList<>(); | ||
| 81 | + | ||
| 82 | + @Schema(description = "联系人编号", example = "110") | ||
| 83 | + private Long contactId; // 使用场景,在【联系人详情】添加商机时,如果需要关联两者,需要传递 contactId 字段 | ||
| 71 | 84 | ||
| 72 | } | 85 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/product/CrmBusinessProductPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.business.vo.product; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | +import lombok.Data; | ||
| 6 | +import lombok.EqualsAndHashCode; | ||
| 7 | +import lombok.ToString; | ||
| 8 | + | ||
| 9 | +// TODO @lzxhqs:这个类,如果没用到,可以考虑删除哈 | ||
| 10 | +@Schema(description = "管理后台 - 商机产品分页 Request VO") | ||
| 11 | +@Data | ||
| 12 | +@EqualsAndHashCode(callSuper = true) | ||
| 13 | +@ToString(callSuper = true) | ||
| 14 | +public class CrmBusinessProductPageReqVO extends PageParam { | ||
| 15 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/product/CrmBusinessProductRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.business.vo.product; | ||
| 2 | + | ||
| 3 | +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +@Schema(description = "管理后台 - 商机产品关联 Response VO") | ||
| 8 | +@Data | ||
| 9 | +@ExcelIgnoreUnannotated | ||
| 10 | +public class CrmBusinessProductRespVO { | ||
| 11 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/product/CrmBusinessProductSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.controller.admin.business.vo.product; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import jakarta.validation.constraints.NotNull; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +import java.math.BigDecimal; | ||
| 8 | + | ||
| 9 | +@Schema(description = "管理后台 - CRM 商机产品关联表 创建/更新 Request VO") | ||
| 10 | +@Data | ||
| 11 | +public class CrmBusinessProductSaveReqVO { | ||
| 12 | + | ||
| 13 | + @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "32129") | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + // TODO @lzxhqs:这个字段,应该是 Long 类型 | ||
| 17 | + @Schema(description = "商机编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30320") | ||
| 18 | + @NotNull(message = "商机编号不能为空") | ||
| 19 | + private Integer businessId; | ||
| 20 | + | ||
| 21 | + // TODO @lzxhqs:这个字段,应该是 Long 类型 | ||
| 22 | + @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "30320") | ||
| 23 | + @NotNull(message = "产品编号不能为空") | ||
| 24 | + private Integer productId; | ||
| 25 | + | ||
| 26 | + @Schema(description = "产品单价", requiredMode = Schema.RequiredMode.REQUIRED, example = "30320") | ||
| 27 | + @NotNull(message = "产品单价不能为空") | ||
| 28 | + private BigDecimal price; | ||
| 29 | + | ||
| 30 | + @Schema(description = "销售价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "30320") | ||
| 31 | + @NotNull(message = "销售价格不能为空") | ||
| 32 | + private BigDecimal salesPrice; | ||
| 33 | + | ||
| 34 | + @Schema(description = "数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "30320") | ||
| 35 | + @NotNull(message = "数量不能为空") | ||
| 36 | + private BigDecimal num; | ||
| 37 | + | ||
| 38 | + @Schema(description = "折扣", requiredMode = Schema.RequiredMode.REQUIRED, example = "30320") | ||
| 39 | + @NotNull(message = "折扣不能为空") | ||
| 40 | + private BigDecimal discount; | ||
| 41 | + | ||
| 42 | + @Schema(description = "小计(折扣后价格)", requiredMode = Schema.RequiredMode.REQUIRED, example = "30320") | ||
| 43 | + @NotNull(message = "小计(折扣后价格)不能为空") | ||
| 44 | + private BigDecimal subtotal; | ||
| 45 | + | ||
| 46 | + // TODO @lzxhqs:字符串,用 @NotEmpty,因为要考虑 "" 前端搞了这个玩意 | ||
| 47 | + @Schema(description = "单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "30320") | ||
| 48 | + @NotNull(message = "单位不能为空") | ||
| 49 | + private String unit; | ||
| 50 | + | ||
| 51 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/status/CrmBusinessStatusSaveReqVO.java
| @@ -21,11 +21,11 @@ public class CrmBusinessStatusSaveReqVO { | @@ -21,11 +21,11 @@ public class CrmBusinessStatusSaveReqVO { | ||
| 21 | @NotEmpty(message = "状态名不能为空") | 21 | @NotEmpty(message = "状态名不能为空") |
| 22 | private String name; | 22 | private String name; |
| 23 | 23 | ||
| 24 | - // TODO @lilleo:percent 应该是 Integer; | 24 | + // TODO @lzxhqs::percent 应该是 Integer; |
| 25 | @Schema(description = "赢单率") | 25 | @Schema(description = "赢单率") |
| 26 | private String percent; | 26 | private String percent; |
| 27 | 27 | ||
| 28 | - // TODO @lilleo:这个是不是不用前端新增和修改的时候传递,交给顺序计算出来,存储起来就好了; | 28 | + // TODO @lzxhqs:这个是不是不用前端新增和修改的时候传递,交给顺序计算出来,存储起来就好了; |
| 29 | @Schema(description = "排序") | 29 | @Schema(description = "排序") |
| 30 | private Integer sort; | 30 | private Integer sort; |
| 31 | 31 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/business/vo/type/CrmBusinessStatusTypeSaveReqVO.java
| @@ -19,11 +19,11 @@ public class CrmBusinessStatusTypeSaveReqVO { | @@ -19,11 +19,11 @@ public class CrmBusinessStatusTypeSaveReqVO { | ||
| 19 | @NotEmpty(message = "状态类型名不能为空") | 19 | @NotEmpty(message = "状态类型名不能为空") |
| 20 | private String name; | 20 | private String name; |
| 21 | 21 | ||
| 22 | + // TODO @lzxhqs: VO 里面,我们不使用默认值哈。这里 Lists.newArrayList() 看看怎么去掉。上面 deptIds 也是类似噢 | ||
| 22 | @Schema(description = "使用的部门编号", requiredMode = Schema.RequiredMode.REQUIRED) | 23 | @Schema(description = "使用的部门编号", requiredMode = Schema.RequiredMode.REQUIRED) |
| 23 | private List<Long> deptIds = Lists.newArrayList(); | 24 | private List<Long> deptIds = Lists.newArrayList(); |
| 24 | 25 | ||
| 25 | - // TODO @ljlleo VO 里面,我们不使用默认值哈。这里 Lists.newArrayList() 看看怎么去掉。上面 deptIds 也是类似噢 | ||
| 26 | @Schema(description = "商机状态集合", requiredMode = Schema.RequiredMode.REQUIRED) | 26 | @Schema(description = "商机状态集合", requiredMode = Schema.RequiredMode.REQUIRED) |
| 27 | - private List<CrmBusinessStatusSaveReqVO> statusList = Lists.newArrayList(); | 27 | + private List<CrmBusinessStatusSaveReqVO> statusList; |
| 28 | 28 | ||
| 29 | } | 29 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contact/CrmContactController.java
| @@ -125,11 +125,8 @@ public class CrmContactController { | @@ -125,11 +125,8 @@ public class CrmContactController { | ||
| 125 | @Operation(summary = "获得联系人的精简列表") | 125 | @Operation(summary = "获得联系人的精简列表") |
| 126 | @PreAuthorize("@ss.hasPermission('crm:contact:query')") | 126 | @PreAuthorize("@ss.hasPermission('crm:contact:query')") |
| 127 | public CommonResult<List<CrmContactRespVO>> getSimpleContactList() { | 127 | public CommonResult<List<CrmContactRespVO>> getSimpleContactList() { |
| 128 | - // TODO @puhui999:这种还是搞个 getContactList 方法好点哈; | ||
| 129 | - CrmContactPageReqVO reqVO = new CrmContactPageReqVO(); | ||
| 130 | - reqVO.setPageSize(PAGE_SIZE_NONE); // 不分页 | ||
| 131 | - PageResult<CrmContactDO> pageResult = contactService.getContactPage(reqVO, getLoginUserId()); | ||
| 132 | - return success(convertList(pageResult.getList(), contact -> // 只返回 id、name 字段 | 128 | + List<CrmContactDO> list = contactService.getSimpleContactList(getLoginUserId()); |
| 129 | + return success(convertList(list, contact -> // 只返回 id、name 字段 | ||
| 133 | new CrmContactRespVO().setId(contact.getId()).setName(contact.getName()))); | 130 | new CrmContactRespVO().setId(contact.getId()).setName(contact.getName()))); |
| 134 | } | 131 | } |
| 135 | 132 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/contract/vo/CrmContractRespVO.java
| 1 | package cn.iocoder.yudao.module.crm.controller.admin.contract.vo; | 1 | package cn.iocoder.yudao.module.crm.controller.admin.contract.vo; |
| 2 | 2 | ||
| 3 | +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||
| 4 | +import com.alibaba.excel.annotation.ExcelProperty; | ||
| 3 | import io.swagger.v3.oas.annotations.media.Schema; | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | import lombok.Data; | 6 | import lombok.Data; |
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 5 | 8 | ||
| 6 | import java.time.LocalDateTime; | 9 | import java.time.LocalDateTime; |
| 7 | 10 | ||
| 8 | -// TODO @puhui999:导出注解哈 | 11 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 12 | + | ||
| 9 | @Schema(description = "管理后台 - CRM 合同 Response VO") | 13 | @Schema(description = "管理后台 - CRM 合同 Response VO") |
| 10 | @Data | 14 | @Data |
| 15 | +@ExcelIgnoreUnannotated | ||
| 11 | public class CrmContractRespVO { | 16 | public class CrmContractRespVO { |
| 12 | 17 | ||
| 13 | @Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") | 18 | @Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430") |
| 19 | + @ExcelProperty("合同编号") | ||
| 14 | private Long id; | 20 | private Long id; |
| 15 | 21 | ||
| 16 | @Schema(description = "合同名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") | 22 | @Schema(description = "合同名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五") |
| 23 | + @ExcelProperty("合同名称") | ||
| 17 | private String name; | 24 | private String name; |
| 18 | 25 | ||
| 19 | @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18336") | 26 | @Schema(description = "客户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18336") |
| 27 | + @ExcelProperty("客户编号") | ||
| 20 | private Long customerId; | 28 | private Long customerId; |
| 21 | 29 | ||
| 22 | @Schema(description = "商机编号", example = "10864") | 30 | @Schema(description = "商机编号", example = "10864") |
| 31 | + @ExcelProperty("商机编号") | ||
| 23 | private Long businessId; | 32 | private Long businessId; |
| 24 | 33 | ||
| 25 | @Schema(description = "工作流编号", example = "1043") | 34 | @Schema(description = "工作流编号", example = "1043") |
| 35 | + @ExcelProperty("工作流编号") | ||
| 26 | private Long processInstanceId; | 36 | private Long processInstanceId; |
| 27 | 37 | ||
| 28 | @Schema(description = "下单日期", requiredMode = Schema.RequiredMode.REQUIRED) | 38 | @Schema(description = "下单日期", requiredMode = Schema.RequiredMode.REQUIRED) |
| 39 | + @ExcelProperty("下单日期") | ||
| 40 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 29 | private LocalDateTime orderDate; | 41 | private LocalDateTime orderDate; |
| 30 | 42 | ||
| 31 | @Schema(description = "负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17144") | 43 | @Schema(description = "负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17144") |
| 44 | + @ExcelProperty("负责人的用户编号") | ||
| 32 | private Long ownerUserId; | 45 | private Long ownerUserId; |
| 33 | 46 | ||
| 34 | // TODO @芋艿:未来应该支持自动生成; | 47 | // TODO @芋艿:未来应该支持自动生成; |
| 35 | @Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20230101") | 48 | @Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20230101") |
| 49 | + @ExcelProperty("合同编号") | ||
| 36 | private String no; | 50 | private String no; |
| 37 | 51 | ||
| 38 | @Schema(description = "开始时间") | 52 | @Schema(description = "开始时间") |
| 53 | + @ExcelProperty("开始时间") | ||
| 54 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 39 | private LocalDateTime startTime; | 55 | private LocalDateTime startTime; |
| 40 | 56 | ||
| 41 | @Schema(description = "结束时间") | 57 | @Schema(description = "结束时间") |
| 58 | + @ExcelProperty("结束时间") | ||
| 59 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 42 | private LocalDateTime endTime; | 60 | private LocalDateTime endTime; |
| 43 | 61 | ||
| 44 | @Schema(description = "合同金额", example = "5617") | 62 | @Schema(description = "合同金额", example = "5617") |
| 63 | + @ExcelProperty("合同金额") | ||
| 45 | private Integer price; | 64 | private Integer price; |
| 46 | 65 | ||
| 47 | @Schema(description = "整单折扣") | 66 | @Schema(description = "整单折扣") |
| 67 | + @ExcelProperty("整单折扣") | ||
| 48 | private Integer discountPercent; | 68 | private Integer discountPercent; |
| 49 | 69 | ||
| 50 | @Schema(description = "产品总金额", example = "19510") | 70 | @Schema(description = "产品总金额", example = "19510") |
| 71 | + @ExcelProperty("产品总金额") | ||
| 51 | private Integer productPrice; | 72 | private Integer productPrice; |
| 52 | 73 | ||
| 53 | @Schema(description = "联系人编号", example = "18546") | 74 | @Schema(description = "联系人编号", example = "18546") |
| 75 | + @ExcelProperty("联系人编号") | ||
| 54 | private Long contactId; | 76 | private Long contactId; |
| 55 | 77 | ||
| 56 | @Schema(description = "公司签约人", example = "14036") | 78 | @Schema(description = "公司签约人", example = "14036") |
| 79 | + @ExcelProperty("公司签约人") | ||
| 57 | private Long signUserId; | 80 | private Long signUserId; |
| 58 | 81 | ||
| 59 | @Schema(description = "最后跟进时间") | 82 | @Schema(description = "最后跟进时间") |
| 83 | + @ExcelProperty("最后跟进时间") | ||
| 84 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 60 | private LocalDateTime contactLastTime; | 85 | private LocalDateTime contactLastTime; |
| 61 | 86 | ||
| 62 | @Schema(description = "备注", example = "你猜") | 87 | @Schema(description = "备注", example = "你猜") |
| 88 | + @ExcelProperty("备注") | ||
| 63 | private String remark; | 89 | private String remark; |
| 64 | 90 | ||
| 65 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | 91 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 92 | + @ExcelProperty("创建时间") | ||
| 93 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 66 | private LocalDateTime createTime; | 94 | private LocalDateTime createTime; |
| 67 | 95 | ||
| 68 | @Schema(description = "创建人", example = "25682") | 96 | @Schema(description = "创建人", example = "25682") |
| 97 | + @ExcelProperty("创建人") | ||
| 69 | private String creator; | 98 | private String creator; |
| 70 | 99 | ||
| 71 | @Schema(description = "创建人名字", example = "test") | 100 | @Schema(description = "创建人名字", example = "test") |
| 101 | + @ExcelProperty("创建人名字") | ||
| 72 | private String creatorName; | 102 | private String creatorName; |
| 73 | 103 | ||
| 74 | @Schema(description = "客户名字", example = "test") | 104 | @Schema(description = "客户名字", example = "test") |
| 105 | + @ExcelProperty("客户名字") | ||
| 75 | private String customerName; | 106 | private String customerName; |
| 76 | 107 | ||
| 77 | @Schema(description = "负责人", example = "test") | 108 | @Schema(description = "负责人", example = "test") |
| 109 | + @ExcelProperty("负责人") | ||
| 78 | private String ownerUserName; | 110 | private String ownerUserName; |
| 79 | 111 | ||
| 80 | @Schema(description = "审批状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | 112 | @Schema(description = "审批状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") |
| 113 | + @ExcelProperty("审批状态") | ||
| 81 | private Integer auditStatus; | 114 | private Integer auditStatus; |
| 82 | 115 | ||
| 83 | } | 116 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/controller/admin/followup/CrmFollowUpRecordController.java
| @@ -28,6 +28,7 @@ import java.util.Map; | @@ -28,6 +28,7 @@ import java.util.Map; | ||
| 28 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 28 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 29 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | 29 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; |
| 30 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSetByFlatMap; | 30 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSetByFlatMap; |
| 31 | +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | ||
| 31 | 32 | ||
| 32 | 33 | ||
| 33 | @Tag(name = "管理后台 - 跟进记录") | 34 | @Tag(name = "管理后台 - 跟进记录") |
| @@ -37,7 +38,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils. | @@ -37,7 +38,7 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils. | ||
| 37 | public class CrmFollowUpRecordController { | 38 | public class CrmFollowUpRecordController { |
| 38 | 39 | ||
| 39 | @Resource | 40 | @Resource |
| 40 | - private CrmFollowUpRecordService crmFollowUpRecordService; | 41 | + private CrmFollowUpRecordService followUpRecordService; |
| 41 | @Resource | 42 | @Resource |
| 42 | private CrmContactService contactService; | 43 | private CrmContactService contactService; |
| 43 | @Resource | 44 | @Resource |
| @@ -47,15 +48,7 @@ public class CrmFollowUpRecordController { | @@ -47,15 +48,7 @@ public class CrmFollowUpRecordController { | ||
| 47 | @Operation(summary = "创建跟进记录") | 48 | @Operation(summary = "创建跟进记录") |
| 48 | @PreAuthorize("@ss.hasPermission('crm:follow-up-record:create')") | 49 | @PreAuthorize("@ss.hasPermission('crm:follow-up-record:create')") |
| 49 | public CommonResult<Long> createFollowUpRecord(@Valid @RequestBody CrmFollowUpRecordSaveReqVO createReqVO) { | 50 | public CommonResult<Long> createFollowUpRecord(@Valid @RequestBody CrmFollowUpRecordSaveReqVO createReqVO) { |
| 50 | - return success(crmFollowUpRecordService.createFollowUpRecord(createReqVO)); | ||
| 51 | - } | ||
| 52 | - | ||
| 53 | - @PutMapping("/update") | ||
| 54 | - @Operation(summary = "更新跟进记录") | ||
| 55 | - @PreAuthorize("@ss.hasPermission('crm:follow-up-record:update')") | ||
| 56 | - public CommonResult<Boolean> updateFollowUpRecord(@Valid @RequestBody CrmFollowUpRecordSaveReqVO updateReqVO) { | ||
| 57 | - crmFollowUpRecordService.updateFollowUpRecord(updateReqVO); | ||
| 58 | - return success(true); | 51 | + return success(followUpRecordService.createFollowUpRecord(createReqVO)); |
| 59 | } | 52 | } |
| 60 | 53 | ||
| 61 | @DeleteMapping("/delete") | 54 | @DeleteMapping("/delete") |
| @@ -63,7 +56,7 @@ public class CrmFollowUpRecordController { | @@ -63,7 +56,7 @@ public class CrmFollowUpRecordController { | ||
| 63 | @Parameter(name = "id", description = "编号", required = true) | 56 | @Parameter(name = "id", description = "编号", required = true) |
| 64 | @PreAuthorize("@ss.hasPermission('crm:follow-up-record:delete')") | 57 | @PreAuthorize("@ss.hasPermission('crm:follow-up-record:delete')") |
| 65 | public CommonResult<Boolean> deleteFollowUpRecord(@RequestParam("id") Long id) { | 58 | public CommonResult<Boolean> deleteFollowUpRecord(@RequestParam("id") Long id) { |
| 66 | - crmFollowUpRecordService.deleteFollowUpRecord(id); | 59 | + followUpRecordService.deleteFollowUpRecord(id, getLoginUserId()); |
| 67 | return success(true); | 60 | return success(true); |
| 68 | } | 61 | } |
| 69 | 62 | ||
| @@ -72,7 +65,7 @@ public class CrmFollowUpRecordController { | @@ -72,7 +65,7 @@ public class CrmFollowUpRecordController { | ||
| 72 | @Parameter(name = "id", description = "编号", required = true, example = "1024") | 65 | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| 73 | @PreAuthorize("@ss.hasPermission('crm:follow-up-record:query')") | 66 | @PreAuthorize("@ss.hasPermission('crm:follow-up-record:query')") |
| 74 | public CommonResult<CrmFollowUpRecordRespVO> getFollowUpRecord(@RequestParam("id") Long id) { | 67 | public CommonResult<CrmFollowUpRecordRespVO> getFollowUpRecord(@RequestParam("id") Long id) { |
| 75 | - CrmFollowUpRecordDO followUpRecord = crmFollowUpRecordService.getFollowUpRecord(id); | 68 | + CrmFollowUpRecordDO followUpRecord = followUpRecordService.getFollowUpRecord(id); |
| 76 | return success(BeanUtils.toBean(followUpRecord, CrmFollowUpRecordRespVO.class)); | 69 | return success(BeanUtils.toBean(followUpRecord, CrmFollowUpRecordRespVO.class)); |
| 77 | } | 70 | } |
| 78 | 71 | ||
| @@ -80,7 +73,7 @@ public class CrmFollowUpRecordController { | @@ -80,7 +73,7 @@ public class CrmFollowUpRecordController { | ||
| 80 | @Operation(summary = "获得跟进记录分页") | 73 | @Operation(summary = "获得跟进记录分页") |
| 81 | @PreAuthorize("@ss.hasPermission('crm:follow-up-record:query')") | 74 | @PreAuthorize("@ss.hasPermission('crm:follow-up-record:query')") |
| 82 | public CommonResult<PageResult<CrmFollowUpRecordRespVO>> getFollowUpRecordPage(@Valid CrmFollowUpRecordPageReqVO pageReqVO) { | 75 | public CommonResult<PageResult<CrmFollowUpRecordRespVO>> getFollowUpRecordPage(@Valid CrmFollowUpRecordPageReqVO pageReqVO) { |
| 83 | - PageResult<CrmFollowUpRecordDO> pageResult = crmFollowUpRecordService.getFollowUpRecordPage(pageReqVO); | 76 | + PageResult<CrmFollowUpRecordDO> pageResult = followUpRecordService.getFollowUpRecordPage(pageReqVO); |
| 84 | /// 拼接数据 | 77 | /// 拼接数据 |
| 85 | Map<Long, CrmContactDO> contactMap = convertMap(contactService.getContactList( | 78 | Map<Long, CrmContactDO> contactMap = convertMap(contactService.getContactList( |
| 86 | convertSetByFlatMap(pageResult.getList(), item -> item.getContactIds().stream())), CrmContactDO::getId); | 79 | convertSetByFlatMap(pageResult.getList(), item -> item.getContactIds().stream())), CrmContactDO::getId); |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/business/CrmBusinessConvert.java
| 1 | package cn.iocoder.yudao.module.crm.convert.business; | 1 | package cn.iocoder.yudao.module.crm.convert.business; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | ||
| 4 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 5 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 5 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessRespVO; | 6 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessRespVO; |
| 6 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessTransferReqVO; | 7 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessTransferReqVO; |
| @@ -8,6 +9,7 @@ import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | @@ -8,6 +9,7 @@ import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | ||
| 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; | 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; |
| 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; | 10 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; |
| 10 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | 11 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 12 | +import cn.iocoder.yudao.module.crm.service.followup.bo.CrmUpdateFollowUpReqBO; | ||
| 11 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO; | 13 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO; |
| 12 | import org.mapstruct.Mapper; | 14 | import org.mapstruct.Mapper; |
| 13 | import org.mapstruct.Mapping; | 15 | import org.mapstruct.Mapping; |
| @@ -45,4 +47,11 @@ public interface CrmBusinessConvert { | @@ -45,4 +47,11 @@ public interface CrmBusinessConvert { | ||
| 45 | return voPageResult; | 47 | return voPageResult; |
| 46 | } | 48 | } |
| 47 | 49 | ||
| 50 | + @Mapping(target = "id", source = "reqBO.bizId") | ||
| 51 | + CrmBusinessDO convert(CrmUpdateFollowUpReqBO reqBO); | ||
| 52 | + | ||
| 53 | + default List<CrmBusinessDO> convertList(List<CrmUpdateFollowUpReqBO> list) { | ||
| 54 | + return CollectionUtils.convertList(list, INSTANCE::convert); | ||
| 55 | + } | ||
| 56 | + | ||
| 48 | } | 57 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/businessproduct/CrmBusinessProductConvert.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.convert.businessproduct; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.product.CrmBusinessProductSaveReqVO; | ||
| 4 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessProductDO; | ||
| 5 | +import org.mapstruct.Mapper; | ||
| 6 | +import org.mapstruct.factory.Mappers; | ||
| 7 | + | ||
| 8 | +// TODO @lzxhqs:看看是不是用 BeanUtils 替代了 | ||
| 9 | +/** | ||
| 10 | + * @author lzxhqs | ||
| 11 | + * @version 1.0 | ||
| 12 | + * @title CrmBusinessProductConvert | ||
| 13 | + * @description | ||
| 14 | + * @create 2024/1/12 | ||
| 15 | + */ | ||
| 16 | +@Mapper | ||
| 17 | +public interface CrmBusinessProductConvert { | ||
| 18 | + CrmBusinessProductConvert INSTANCE = Mappers.getMapper(CrmBusinessProductConvert.class); | ||
| 19 | + | ||
| 20 | + CrmBusinessProductDO convert(CrmBusinessProductSaveReqVO product); | ||
| 21 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/businessstatustype/CrmBusinessStatusTypeConvert.java
| @@ -14,6 +14,7 @@ import java.util.Map; | @@ -14,6 +14,7 @@ import java.util.Map; | ||
| 14 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | 14 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; |
| 15 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | 15 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; |
| 16 | 16 | ||
| 17 | +// TODO @lzxhqs:看看是不是用 BeanUtils 替代了 | ||
| 17 | /** | 18 | /** |
| 18 | * 商机状态类型 Convert | 19 | * 商机状态类型 Convert |
| 19 | * | 20 | * |
| @@ -24,7 +25,6 @@ public interface CrmBusinessStatusTypeConvert { | @@ -24,7 +25,6 @@ public interface CrmBusinessStatusTypeConvert { | ||
| 24 | 25 | ||
| 25 | CrmBusinessStatusTypeConvert INSTANCE = Mappers.getMapper(CrmBusinessStatusTypeConvert.class); | 26 | CrmBusinessStatusTypeConvert INSTANCE = Mappers.getMapper(CrmBusinessStatusTypeConvert.class); |
| 26 | 27 | ||
| 27 | - | ||
| 28 | CrmBusinessStatusTypeRespVO convert(CrmBusinessStatusTypeDO bean); | 28 | CrmBusinessStatusTypeRespVO convert(CrmBusinessStatusTypeDO bean); |
| 29 | 29 | ||
| 30 | PageResult<CrmBusinessStatusTypeRespVO> convertPage(PageResult<CrmBusinessStatusTypeDO> page); | 30 | PageResult<CrmBusinessStatusTypeRespVO> convertPage(PageResult<CrmBusinessStatusTypeDO> page); |
| @@ -38,10 +38,7 @@ public interface CrmBusinessStatusTypeConvert { | @@ -38,10 +38,7 @@ public interface CrmBusinessStatusTypeConvert { | ||
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | default CrmBusinessStatusTypeRespVO convert(CrmBusinessStatusTypeDO bean, List<CrmBusinessStatusDO> statusList) { | 40 | default CrmBusinessStatusTypeRespVO convert(CrmBusinessStatusTypeDO bean, List<CrmBusinessStatusDO> statusList) { |
| 41 | - // TODO @ljlleo 可以链式赋值,简化成一行; | ||
| 42 | - CrmBusinessStatusTypeRespVO result = convert(bean); | ||
| 43 | - result.setStatusList(statusList); | ||
| 44 | - return result; | 41 | + return convert(bean).setStatusList(statusList); |
| 45 | } | 42 | } |
| 46 | 43 | ||
| 47 | } | 44 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/convert/contact/CrmContactConvert.java
| @@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactRespVO; | @@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactRespVO; | ||
| 8 | import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactTransferReqVO; | 8 | import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactTransferReqVO; |
| 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; | 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; |
| 10 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | 10 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 11 | +import cn.iocoder.yudao.module.crm.service.followup.bo.CrmUpdateFollowUpReqBO; | ||
| 11 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO; | 12 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionTransferReqBO; |
| 12 | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | 13 | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| 13 | import org.mapstruct.Mapper; | 14 | import org.mapstruct.Mapper; |
| @@ -66,4 +67,11 @@ public interface CrmContactConvert { | @@ -66,4 +67,11 @@ public interface CrmContactConvert { | ||
| 66 | findAndThen(userMap, Long.parseLong(contactRespVO.getCreator()), user -> contactRespVO.setCreatorName(user.getNickname())); | 67 | findAndThen(userMap, Long.parseLong(contactRespVO.getCreator()), user -> contactRespVO.setCreatorName(user.getNickname())); |
| 67 | } | 68 | } |
| 68 | 69 | ||
| 70 | + @Mapping(target = "id", source = "reqBO.bizId") | ||
| 71 | + CrmContactDO convert(CrmUpdateFollowUpReqBO reqBO); | ||
| 72 | + | ||
| 73 | + default List<CrmContactDO> convertList(List<CrmUpdateFollowUpReqBO> list) { | ||
| 74 | + return CollectionUtils.convertList(list, INSTANCE::convert); | ||
| 75 | + } | ||
| 76 | + | ||
| 69 | } | 77 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessDO.java
| 1 | package cn.iocoder.yudao.module.crm.dal.dataobject.business; | 1 | package cn.iocoder.yudao.module.crm.dal.dataobject.business; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | +import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | ||
| 5 | +import cn.iocoder.yudao.module.crm.enums.business.CrmBizEndStatus; | ||
| 4 | import com.baomidou.mybatisplus.annotation.KeySequence; | 6 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 5 | import com.baomidou.mybatisplus.annotation.TableId; | 7 | import com.baomidou.mybatisplus.annotation.TableId; |
| 6 | import com.baomidou.mybatisplus.annotation.TableName; | 8 | import com.baomidou.mybatisplus.annotation.TableName; |
| @@ -52,6 +54,7 @@ public class CrmBusinessDO extends BaseDO { | @@ -52,6 +54,7 @@ public class CrmBusinessDO extends BaseDO { | ||
| 52 | * 客户编号 | 54 | * 客户编号 |
| 53 | * | 55 | * |
| 54 | * TODO @ljileo:这个字段,后续要写下关联的实体哈 | 56 | * TODO @ljileo:这个字段,后续要写下关联的实体哈 |
| 57 | + * 关联 {@link CrmCustomerDO#getId()} | ||
| 55 | */ | 58 | */ |
| 56 | private Long customerId; | 59 | private Long customerId; |
| 57 | /** | 60 | /** |
| @@ -77,9 +80,9 @@ public class CrmBusinessDO extends BaseDO { | @@ -77,9 +80,9 @@ public class CrmBusinessDO extends BaseDO { | ||
| 77 | */ | 80 | */ |
| 78 | private String remark; | 81 | private String remark; |
| 79 | /** | 82 | /** |
| 80 | - * 1赢单2输单3无效 | 83 | + * 结束状态 |
| 81 | * | 84 | * |
| 82 | - * TODO @lijie:搞个枚举; | 85 | + * 枚举 {@link CrmBizEndStatus} |
| 83 | */ | 86 | */ |
| 84 | private Integer endStatus; | 87 | private Integer endStatus; |
| 85 | /** | 88 | /** |
| @@ -93,7 +96,7 @@ public class CrmBusinessDO extends BaseDO { | @@ -93,7 +96,7 @@ public class CrmBusinessDO extends BaseDO { | ||
| 93 | /** | 96 | /** |
| 94 | * 跟进状态 | 97 | * 跟进状态 |
| 95 | * | 98 | * |
| 96 | - * TODO @lijie:目前就是 Boolean;是否跟进 | 99 | + * TODO @lzxhqs:目前就是 Boolean;是否跟进 |
| 97 | */ | 100 | */ |
| 98 | private Integer followUpStatus; | 101 | private Integer followUpStatus; |
| 99 | 102 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessProductDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.dal.dataobject.business; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 4 | +import cn.iocoder.yudao.module.crm.dal.dataobject.product.CrmProductDO; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.KeySequence; | ||
| 6 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 7 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 8 | +import lombok.*; | ||
| 9 | + | ||
| 10 | +import java.math.BigDecimal; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * 商机产品关联表 DO | ||
| 14 | + * | ||
| 15 | + * @author lzxhqs | ||
| 16 | + */ | ||
| 17 | +@TableName("crm_business_product") | ||
| 18 | +@KeySequence("crm_business_product_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | ||
| 19 | +@Data | ||
| 20 | +@EqualsAndHashCode(callSuper = true) | ||
| 21 | +@ToString(callSuper = true) | ||
| 22 | +@Builder | ||
| 23 | +@NoArgsConstructor | ||
| 24 | +@AllArgsConstructor | ||
| 25 | +public class CrmBusinessProductDO extends BaseDO { | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * 主键 | ||
| 29 | + */ | ||
| 30 | + @TableId | ||
| 31 | + private Long id; | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * 商机编号 | ||
| 35 | + * | ||
| 36 | + * 关联 {@link CrmBusinessDO#getId()} | ||
| 37 | + */ | ||
| 38 | + private Long businessId; | ||
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * 产品编号 | ||
| 42 | + * | ||
| 43 | + * 关联 {@link CrmProductDO#getId()} | ||
| 44 | + */ | ||
| 45 | + private Long productId; | ||
| 46 | + | ||
| 47 | + // TODO @lzxhqs:改成 Integer,单位:分。目前整体倾向放大 100 倍哈 | ||
| 48 | + /** | ||
| 49 | + * 产品单价 | ||
| 50 | + */ | ||
| 51 | + private BigDecimal price; | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 销售价格 | ||
| 55 | + */ | ||
| 56 | + private BigDecimal salesPrice; | ||
| 57 | + | ||
| 58 | + // TODO @lzxhqs:改成 count | ||
| 59 | + /** | ||
| 60 | + * 数量 | ||
| 61 | + */ | ||
| 62 | + private BigDecimal num; | ||
| 63 | + | ||
| 64 | + // TODO @lzxhqs:改成 discountPercent | ||
| 65 | + /** | ||
| 66 | + * 折扣 | ||
| 67 | + */ | ||
| 68 | + private BigDecimal discount; | ||
| 69 | + | ||
| 70 | + // TODO @lzxhqs:改成 totalPrice;总计价格,和现有项目风格一致; | ||
| 71 | + /** | ||
| 72 | + * 小计(折扣后价格) | ||
| 73 | + */ | ||
| 74 | + private BigDecimal subtotal; | ||
| 75 | + | ||
| 76 | + /** | ||
| 77 | + * 单位 | ||
| 78 | + */ | ||
| 79 | + private String unit; | ||
| 80 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessStatusDO.java
| @@ -35,11 +35,9 @@ public class CrmBusinessStatusDO { | @@ -35,11 +35,9 @@ public class CrmBusinessStatusDO { | ||
| 35 | */ | 35 | */ |
| 36 | private String name; | 36 | private String name; |
| 37 | /** | 37 | /** |
| 38 | - * 赢单率 | ||
| 39 | - * | ||
| 40 | - * TODO 这里是不是改成 Integer 存储,百分比 * 100 ; | 38 | + * 赢单率,百分比 |
| 41 | */ | 39 | */ |
| 42 | - private String percent; | 40 | + private Integer percent; |
| 43 | /** | 41 | /** |
| 44 | * 排序 | 42 | * 排序 |
| 45 | */ | 43 | */ |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/dataobject/business/CrmBusinessStatusTypeDO.java
| 1 | package cn.iocoder.yudao.module.crm.dal.dataobject.business; | 1 | package cn.iocoder.yudao.module.crm.dal.dataobject.business; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | ||
| 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | 4 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | import cn.iocoder.yudao.framework.mybatis.core.type.LongListTypeHandler; | 5 | import cn.iocoder.yudao.framework.mybatis.core.type.LongListTypeHandler; |
| 5 | import com.baomidou.mybatisplus.annotation.KeySequence; | 6 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| @@ -43,6 +44,7 @@ public class CrmBusinessStatusTypeDO extends BaseDO { | @@ -43,6 +44,7 @@ public class CrmBusinessStatusTypeDO extends BaseDO { | ||
| 43 | * 开启状态 | 44 | * 开启状态 |
| 44 | * | 45 | * |
| 45 | * TODO 改成 Integer,关联 CommonStatus | 46 | * TODO 改成 Integer,关联 CommonStatus |
| 47 | + * 枚举 {@link CommonStatusEnum} | ||
| 46 | */ | 48 | */ |
| 47 | private Boolean status; | 49 | private Boolean status; |
| 48 | 50 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessProductMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.dal.mysql.business; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||
| 5 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessProductDO; | ||
| 6 | +import org.apache.ibatis.annotations.Mapper; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 商机产品 Mapper // TODO @lzxhqs:类注释,和作者之间要有一个空行 | ||
| 10 | + * @author lzxhqs | ||
| 11 | + */ | ||
| 12 | +@Mapper | ||
| 13 | +public interface CrmBusinessProductMapper extends BaseMapperX<CrmBusinessProductDO> { | ||
| 14 | + default void deleteByBusinessId(Long id) { // TODO @lzxhqs:第一个方法,和类之间最好空一行; | ||
| 15 | + delete(CrmBusinessProductDO::getBusinessId, id); | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + default CrmBusinessProductDO selectByBusinessId(Long id) { // TODO @lzxhqs:id 最好改成 businessId,上面也是;这样一看更容易懂 | ||
| 19 | + return selectOne(CrmBusinessProductDO::getBusinessId, id); | ||
| 20 | + } | ||
| 21 | +} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/business/CrmBusinessStatusTypeMapper.java
| @@ -28,4 +28,17 @@ public interface CrmBusinessStatusTypeMapper extends BaseMapperX<CrmBusinessStat | @@ -28,4 +28,17 @@ public interface CrmBusinessStatusTypeMapper extends BaseMapperX<CrmBusinessStat | ||
| 28 | .eqIfPresent(CrmBusinessStatusTypeDO::getStatus, queryVO.getStatus()) | 28 | .eqIfPresent(CrmBusinessStatusTypeDO::getStatus, queryVO.getStatus()) |
| 29 | .inIfPresent(CrmBusinessStatusTypeDO::getId, queryVO.getIdList())); | 29 | .inIfPresent(CrmBusinessStatusTypeDO::getId, queryVO.getIdList())); |
| 30 | } | 30 | } |
| 31 | + | ||
| 32 | + // TODO @lzxhqs:这个可以改成 selectByName。业务上基于在判断 id 匹配;这样更通用一些;mapper 尽量通用,不关注或者特别关联业务; | ||
| 33 | + /** | ||
| 34 | + * 根据ID和name查询 | ||
| 35 | + * | ||
| 36 | + * @param id 商机状态类型id | ||
| 37 | + * @param name 状态类型名 | ||
| 38 | + * @return result | ||
| 39 | + */ | ||
| 40 | + default CrmBusinessStatusTypeDO selectByIdAndName(Long id, String name) { | ||
| 41 | + return selectOne(CrmBusinessStatusTypeDO::getId, id, CrmBusinessStatusTypeDO::getName, name); | ||
| 42 | + } | ||
| 43 | + | ||
| 31 | } | 44 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/dal/mysql/contract/CrmContractMapper.java
| @@ -63,5 +63,8 @@ public interface CrmContractMapper extends BaseMapperX<CrmContractDO> { | @@ -63,5 +63,8 @@ public interface CrmContractMapper extends BaseMapperX<CrmContractDO> { | ||
| 63 | default Long selectCountByContactId(Long contactId) { | 63 | default Long selectCountByContactId(Long contactId) { |
| 64 | return selectCount(CrmContractDO::getContactId, contactId); | 64 | return selectCount(CrmContractDO::getContactId, contactId); |
| 65 | } | 65 | } |
| 66 | + default CrmContractDO selectByBizId(Long businessId) { // TODO @lzxhqs:1)方法和方法之间要有空行;2)selectCountByBusinessId,一个是应该求数量,一个是不要缩写 BizId 可读性; | ||
| 67 | + return selectOne(CrmContractDO::getBusinessId, businessId); | ||
| 68 | + } | ||
| 66 | 69 | ||
| 67 | } | 70 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessService.java
| @@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusi | @@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusi | ||
| 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; |
| 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 10 | +import cn.iocoder.yudao.module.crm.service.followup.bo.CrmUpdateFollowUpReqBO; | ||
| 10 | import jakarta.validation.Valid; | 11 | import jakarta.validation.Valid; |
| 11 | 12 | ||
| 12 | import java.util.Collection; | 13 | import java.util.Collection; |
| @@ -36,6 +37,13 @@ public interface CrmBusinessService { | @@ -36,6 +37,13 @@ public interface CrmBusinessService { | ||
| 36 | void updateBusiness(@Valid CrmBusinessSaveReqVO updateReqVO); | 37 | void updateBusiness(@Valid CrmBusinessSaveReqVO updateReqVO); |
| 37 | 38 | ||
| 38 | /** | 39 | /** |
| 40 | + * 更新商机相关跟进信息 | ||
| 41 | + * | ||
| 42 | + * @param updateFollowUpReqBOList 跟进信息 | ||
| 43 | + */ | ||
| 44 | + void updateBusinessFollowUpBatch(List<CrmUpdateFollowUpReqBO> updateFollowUpReqBOList); | ||
| 45 | + | ||
| 46 | + /** | ||
| 39 | * 删除商机 | 47 | * 删除商机 |
| 40 | * | 48 | * |
| 41 | * @param id 编号 | 49 | * @param id 编号 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessServiceImpl.java
| @@ -7,14 +7,22 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | @@ -7,14 +7,22 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 7 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessPageReqVO; | 7 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessPageReqVO; |
| 8 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessSaveReqVO; | 8 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessSaveReqVO; |
| 9 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessTransferReqVO; | 9 | import cn.iocoder.yudao.module.crm.controller.admin.business.vo.business.CrmBusinessTransferReqVO; |
| 10 | +import cn.iocoder.yudao.module.crm.controller.admin.business.vo.product.CrmBusinessProductSaveReqVO; | ||
| 10 | import cn.iocoder.yudao.module.crm.convert.business.CrmBusinessConvert; | 11 | import cn.iocoder.yudao.module.crm.convert.business.CrmBusinessConvert; |
| 12 | +import cn.iocoder.yudao.module.crm.convert.businessproduct.CrmBusinessProductConvert; | ||
| 11 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; | 13 | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO; |
| 14 | +import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessProductDO; | ||
| 12 | import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactBusinessDO; | 15 | import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactBusinessDO; |
| 16 | +import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; | ||
| 13 | import cn.iocoder.yudao.module.crm.dal.mysql.business.CrmBusinessMapper; | 17 | import cn.iocoder.yudao.module.crm.dal.mysql.business.CrmBusinessMapper; |
| 18 | +import cn.iocoder.yudao.module.crm.dal.mysql.business.CrmBusinessProductMapper; | ||
| 19 | +import cn.iocoder.yudao.module.crm.dal.mysql.contactbusinesslink.CrmContactBusinessMapper; | ||
| 20 | +import cn.iocoder.yudao.module.crm.dal.mysql.contract.CrmContractMapper; | ||
| 14 | import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; | 21 | import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; |
| 15 | import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; | 22 | import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; |
| 16 | import cn.iocoder.yudao.module.crm.framework.permission.core.annotations.CrmPermission; | 23 | import cn.iocoder.yudao.module.crm.framework.permission.core.annotations.CrmPermission; |
| 17 | import cn.iocoder.yudao.module.crm.service.contact.CrmContactBusinessService; | 24 | import cn.iocoder.yudao.module.crm.service.contact.CrmContactBusinessService; |
| 25 | +import cn.iocoder.yudao.module.crm.service.followup.bo.CrmUpdateFollowUpReqBO; | ||
| 18 | import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; | 26 | import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; |
| 19 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO; | 27 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO; |
| 20 | import com.mzt.logapi.context.LogRecordContext; | 28 | import com.mzt.logapi.context.LogRecordContext; |
| @@ -25,11 +33,13 @@ import org.springframework.stereotype.Service; | @@ -25,11 +33,13 @@ import org.springframework.stereotype.Service; | ||
| 25 | import org.springframework.transaction.annotation.Transactional; | 33 | import org.springframework.transaction.annotation.Transactional; |
| 26 | import org.springframework.validation.annotation.Validated; | 34 | import org.springframework.validation.annotation.Validated; |
| 27 | 35 | ||
| 36 | +import java.util.ArrayList; | ||
| 28 | import java.util.Collection; | 37 | import java.util.Collection; |
| 29 | import java.util.List; | 38 | import java.util.List; |
| 30 | 39 | ||
| 31 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | 40 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 32 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | 41 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| 42 | +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.BUSINESS_CONTRACT_EXISTS; | ||
| 33 | import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.BUSINESS_NOT_EXISTS; | 43 | import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.BUSINESS_NOT_EXISTS; |
| 34 | import static cn.iocoder.yudao.module.crm.enums.LogRecordConstants.*; | 44 | import static cn.iocoder.yudao.module.crm.enums.LogRecordConstants.*; |
| 35 | 45 | ||
| @@ -46,6 +56,15 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | @@ -46,6 +56,15 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | ||
| 46 | private CrmBusinessMapper businessMapper; | 56 | private CrmBusinessMapper businessMapper; |
| 47 | 57 | ||
| 48 | @Resource | 58 | @Resource |
| 59 | + private CrmBusinessProductMapper businessProductMapper; | ||
| 60 | + // TODO @lzxhqs:不直接调用这个 mapper,要调用对方的 service;每个业务独立收敛 | ||
| 61 | + @Resource | ||
| 62 | + private CrmContractMapper contractMapper; | ||
| 63 | + | ||
| 64 | + // TODO @lzxhqs:不直接调用这个 mapper,要调用对方的 service;每个业务独立收敛 | ||
| 65 | + @Resource | ||
| 66 | + private CrmContactBusinessMapper contactBusinessMapper; | ||
| 67 | + @Resource | ||
| 49 | private CrmPermissionService permissionService; | 68 | private CrmPermissionService permissionService; |
| 50 | @Resource | 69 | @Resource |
| 51 | private CrmContactBusinessService contactBusinessService; | 70 | private CrmContactBusinessService contactBusinessService; |
| @@ -61,18 +80,72 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | @@ -61,18 +80,72 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | ||
| 61 | .setOwnerUserId(userId); | 80 | .setOwnerUserId(userId); |
| 62 | businessMapper.insert(business); | 81 | businessMapper.insert(business); |
| 63 | // TODO 商机待定:插入商机与产品的关联表;校验商品存在 | 82 | // TODO 商机待定:插入商机与产品的关联表;校验商品存在 |
| 64 | - | 83 | + // TODO lzxhqs:新增时,是不是不用调用这个方法哈; |
| 84 | + verifyCrmBusinessProduct(business.getId()); | ||
| 85 | + // TODO @lzxhqs:用 CollUtils.isNotEmpty; | ||
| 86 | + if (!createReqVO.getProducts().isEmpty()) { | ||
| 87 | + createBusinessProducts(createReqVO.getProducts(), business.getId()); | ||
| 88 | + } | ||
| 65 | // TODO 商机待定:在联系人的详情页,如果直接【新建商机】,则需要关联下。这里要搞个 CrmContactBusinessDO 表 | 89 | // TODO 商机待定:在联系人的详情页,如果直接【新建商机】,则需要关联下。这里要搞个 CrmContactBusinessDO 表 |
| 90 | + createContactBusiness(business.getId(), createReqVO.getContactId()); | ||
| 66 | 91 | ||
| 67 | // 2. 创建数据权限 | 92 | // 2. 创建数据权限 |
| 93 | + // 设置当前操作的人为负责人 | ||
| 68 | permissionService.createPermission(new CrmPermissionCreateReqBO().setBizType(CrmBizTypeEnum.CRM_BUSINESS.getType()) | 94 | permissionService.createPermission(new CrmPermissionCreateReqBO().setBizType(CrmBizTypeEnum.CRM_BUSINESS.getType()) |
| 69 | - .setBizId(business.getId()).setUserId(userId).setLevel(CrmPermissionLevelEnum.OWNER.getLevel())); // 设置当前操作的人为负责人 | 95 | + .setBizId(business.getId()).setUserId(userId).setLevel(CrmPermissionLevelEnum.OWNER.getLevel())); |
| 70 | 96 | ||
| 71 | // 4. 记录操作日志上下文 | 97 | // 4. 记录操作日志上下文 |
| 72 | LogRecordContext.putVariable("business", business); | 98 | LogRecordContext.putVariable("business", business); |
| 73 | return business.getId(); | 99 | return business.getId(); |
| 74 | } | 100 | } |
| 75 | 101 | ||
| 102 | + // TODO @lzxhqs:CrmContactBusinessService 调用这个;这样逻辑才能收敛哈; | ||
| 103 | + /** | ||
| 104 | + * @param businessId 商机id | ||
| 105 | + * @param contactId 联系人id | ||
| 106 | + * @throws | ||
| 107 | + * @description 联系人与商机的关联 | ||
| 108 | + * @author lzxhqs | ||
| 109 | + */ | ||
| 110 | + private void createContactBusiness(Long businessId, Long contactId) { | ||
| 111 | + CrmContactBusinessDO contactBusiness = new CrmContactBusinessDO(); | ||
| 112 | + contactBusiness.setBusinessId(businessId); | ||
| 113 | + contactBusiness.setContactId(contactId); | ||
| 114 | + contactBusinessMapper.insert(contactBusiness); | ||
| 115 | + | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + // TODO @lzxhqs:这个方法注释格式不对;删除@description,然后把 插入商机产品关联表 作为方法注释; | ||
| 119 | + /** | ||
| 120 | + * @param products 产品集合 | ||
| 121 | + * @description 插入商机产品关联表 | ||
| 122 | + * @author lzxhqs | ||
| 123 | + */ | ||
| 124 | + private void createBusinessProducts(List<CrmBusinessProductSaveReqVO> products, Long businessId) { | ||
| 125 | + // TODO @lzxhqs:可以用 CollectionUtils.convertList; | ||
| 126 | + List<CrmBusinessProductDO> list = new ArrayList<>(); | ||
| 127 | + for (CrmBusinessProductSaveReqVO product : products) { | ||
| 128 | + CrmBusinessProductDO businessProductDO = CrmBusinessProductConvert.INSTANCE.convert(product); | ||
| 129 | + businessProductDO.setBusinessId(businessId); | ||
| 130 | + list.add(businessProductDO); | ||
| 131 | + } | ||
| 132 | + businessProductMapper.insertBatch(list); | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + /** | ||
| 136 | + * @param id businessId | ||
| 137 | + * @description 校验管理的产品存在则删除 | ||
| 138 | + * @author lzxhqs | ||
| 139 | + */ | ||
| 140 | + private void verifyCrmBusinessProduct(Long id) { | ||
| 141 | + CrmBusinessProductDO businessProductDO = businessProductMapper.selectByBusinessId(id); | ||
| 142 | + if (businessProductDO != null) { | ||
| 143 | + //通过商机Id删除 | ||
| 144 | + businessProductMapper.deleteByBusinessId(id); | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + } | ||
| 148 | + | ||
| 76 | @Override | 149 | @Override |
| 77 | @Transactional(rollbackFor = Exception.class) | 150 | @Transactional(rollbackFor = Exception.class) |
| 78 | @LogRecord(type = CRM_BUSINESS_TYPE, subType = CRM_BUSINESS_UPDATE_SUB_TYPE, bizNo = "{{#updateReqVO.id}}", | 151 | @LogRecord(type = CRM_BUSINESS_TYPE, subType = CRM_BUSINESS_UPDATE_SUB_TYPE, bizNo = "{{#updateReqVO.id}}", |
| @@ -86,6 +159,11 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | @@ -86,6 +159,11 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | ||
| 86 | CrmBusinessDO updateObj = BeanUtils.toBean(updateReqVO, CrmBusinessDO.class); | 159 | CrmBusinessDO updateObj = BeanUtils.toBean(updateReqVO, CrmBusinessDO.class); |
| 87 | businessMapper.updateById(updateObj); | 160 | businessMapper.updateById(updateObj); |
| 88 | // TODO 商机待定:插入商机与产品的关联表;校验商品存在 | 161 | // TODO 商机待定:插入商机与产品的关联表;校验商品存在 |
| 162 | + // TODO @lzxhqs:更新时,可以调用 CollectionUtils 的 diffList,尽量避免这种先删除再插入;而是新增的插入、变更的更新,没的删除;不然这个表每次更新,会多好多数据; | ||
| 163 | + verifyCrmBusinessProduct(updateReqVO.getId()); | ||
| 164 | + if (!updateReqVO.getProducts().isEmpty()) { | ||
| 165 | + createBusinessProducts(updateReqVO.getProducts(), updateReqVO.getId()); | ||
| 166 | + } | ||
| 89 | 167 | ||
| 90 | // TODO @商机待定:如果状态发生变化,插入商机状态变更记录表 | 168 | // TODO @商机待定:如果状态发生变化,插入商机状态变更记录表 |
| 91 | // 3. 记录操作日志上下文 | 169 | // 3. 记录操作日志上下文 |
| @@ -94,6 +172,11 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | @@ -94,6 +172,11 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | ||
| 94 | } | 172 | } |
| 95 | 173 | ||
| 96 | @Override | 174 | @Override |
| 175 | + public void updateBusinessFollowUpBatch(List<CrmUpdateFollowUpReqBO> updateFollowUpReqBOList) { | ||
| 176 | + businessMapper.updateBatch(CrmBusinessConvert.INSTANCE.convertList(updateFollowUpReqBOList)); | ||
| 177 | + } | ||
| 178 | + | ||
| 179 | + @Override | ||
| 97 | @Transactional(rollbackFor = Exception.class) | 180 | @Transactional(rollbackFor = Exception.class) |
| 98 | @LogRecord(type = CRM_BUSINESS_TYPE, subType = CRM_BUSINESS_DELETE_SUB_TYPE, bizNo = "{{#id}}", | 181 | @LogRecord(type = CRM_BUSINESS_TYPE, subType = CRM_BUSINESS_DELETE_SUB_TYPE, bizNo = "{{#id}}", |
| 99 | success = CRM_BUSINESS_DELETE_SUCCESS) | 182 | success = CRM_BUSINESS_DELETE_SUCCESS) |
| @@ -102,6 +185,7 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | @@ -102,6 +185,7 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | ||
| 102 | // 校验存在 | 185 | // 校验存在 |
| 103 | CrmBusinessDO business = validateBusinessExists(id); | 186 | CrmBusinessDO business = validateBusinessExists(id); |
| 104 | // TODO @商机待定:需要校验有没关联合同。CrmContractDO 的 businessId 字段 | 187 | // TODO @商机待定:需要校验有没关联合同。CrmContractDO 的 businessId 字段 |
| 188 | + validateContractExists(id); | ||
| 105 | 189 | ||
| 106 | // 删除 | 190 | // 删除 |
| 107 | businessMapper.deleteById(id); | 191 | businessMapper.deleteById(id); |
| @@ -112,6 +196,19 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | @@ -112,6 +196,19 @@ public class CrmBusinessServiceImpl implements CrmBusinessService { | ||
| 112 | LogRecordContext.putVariable("businessName", business.getName()); | 196 | LogRecordContext.putVariable("businessName", business.getName()); |
| 113 | } | 197 | } |
| 114 | 198 | ||
| 199 | + /** | ||
| 200 | + * @param businessId 商机id | ||
| 201 | + * @throws | ||
| 202 | + * @description 删除校验合同是关联合同 | ||
| 203 | + * @author lzxhqs | ||
| 204 | + */ | ||
| 205 | + private void validateContractExists(Long businessId) { | ||
| 206 | + CrmContractDO contract = contractMapper.selectByBizId(businessId); | ||
| 207 | + if (contract != null) { | ||
| 208 | + throw exception(BUSINESS_CONTRACT_EXISTS); | ||
| 209 | + } | ||
| 210 | + } | ||
| 211 | + | ||
| 115 | private CrmBusinessDO validateBusinessExists(Long id) { | 212 | private CrmBusinessDO validateBusinessExists(Long id) { |
| 116 | CrmBusinessDO crmBusiness = businessMapper.selectById(id); | 213 | CrmBusinessDO crmBusiness = businessMapper.selectById(id); |
| 117 | if (crmBusiness == null) { | 214 | if (crmBusiness == null) { |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/business/CrmBusinessStatusTypeServiceImpl.java
| @@ -95,14 +95,18 @@ public class CrmBusinessStatusTypeServiceImpl implements CrmBusinessStatusTypeSe | @@ -95,14 +95,18 @@ public class CrmBusinessStatusTypeServiceImpl implements CrmBusinessStatusTypeSe | ||
| 95 | 95 | ||
| 96 | // TODO @ljlleo 这个方法,这个参考 validateDeptNameUnique 实现。 | 96 | // TODO @ljlleo 这个方法,这个参考 validateDeptNameUnique 实现。 |
| 97 | private void validateBusinessStatusTypeExists(String name, Long id) { | 97 | private void validateBusinessStatusTypeExists(String name, Long id) { |
| 98 | - LambdaQueryWrapper<CrmBusinessStatusTypeDO> wrapper = new LambdaQueryWrapperX<>(); | ||
| 99 | - if(null != id) { | ||
| 100 | - wrapper.ne(CrmBusinessStatusTypeDO::getId, id); | ||
| 101 | - } | ||
| 102 | - long cnt = businessStatusTypeMapper.selectCount(wrapper.eq(CrmBusinessStatusTypeDO::getName, name)); | ||
| 103 | - if (cnt > 0) { | 98 | + CrmBusinessStatusTypeDO businessStatusTypeDO = businessStatusTypeMapper.selectByIdAndName(id, name); |
| 99 | + if (businessStatusTypeDO != null) { | ||
| 104 | throw exception(BUSINESS_STATUS_TYPE_NAME_EXISTS); | 100 | throw exception(BUSINESS_STATUS_TYPE_NAME_EXISTS); |
| 105 | } | 101 | } |
| 102 | +// LambdaQueryWrapper<CrmBusinessStatusTypeDO> wrapper = new LambdaQueryWrapperX<>(); | ||
| 103 | +// if(null != id) { | ||
| 104 | +// wrapper.ne(CrmBusinessStatusTypeDO::getId, id); | ||
| 105 | +// } | ||
| 106 | +// long cnt = businessStatusTypeMapper.selectCount(wrapper.eq(CrmBusinessStatusTypeDO::getName, name)); | ||
| 107 | +// if (cnt > 0) { | ||
| 108 | +// throw exception(BUSINESS_STATUS_TYPE_NAME_EXISTS); | ||
| 109 | +// } | ||
| 106 | } | 110 | } |
| 107 | 111 | ||
| 108 | @Override | 112 | @Override |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueService.java
| @@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueSaveReqVO; | @@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueSaveReqVO; | ||
| 6 | import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueTransferReqVO; | 6 | import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueTransferReqVO; |
| 7 | import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueTransformReqVO; | 7 | import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueTransformReqVO; |
| 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.clue.CrmClueDO; | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.clue.CrmClueDO; |
| 9 | +import cn.iocoder.yudao.module.crm.service.followup.bo.CrmUpdateFollowUpReqBO; | ||
| 9 | import jakarta.validation.Valid; | 10 | import jakarta.validation.Valid; |
| 10 | 11 | ||
| 11 | import java.util.Collection; | 12 | import java.util.Collection; |
| @@ -34,6 +35,13 @@ public interface CrmClueService { | @@ -34,6 +35,13 @@ public interface CrmClueService { | ||
| 34 | void updateClue(@Valid CrmClueSaveReqVO updateReqVO); | 35 | void updateClue(@Valid CrmClueSaveReqVO updateReqVO); |
| 35 | 36 | ||
| 36 | /** | 37 | /** |
| 38 | + * 更新线索相关的跟进信息 | ||
| 39 | + * | ||
| 40 | + * @param clueUpdateFollowUpReqBO 信息 | ||
| 41 | + */ | ||
| 42 | + void updateClueFollowUp(CrmUpdateFollowUpReqBO clueUpdateFollowUpReqBO); | ||
| 43 | + | ||
| 44 | + /** | ||
| 37 | * 删除线索 | 45 | * 删除线索 |
| 38 | * | 46 | * |
| 39 | * @param id 编号 | 47 | * @param id 编号 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/clue/CrmClueServiceImpl.java
| @@ -2,8 +2,11 @@ package cn.iocoder.yudao.module.crm.service.clue; | @@ -2,8 +2,11 @@ package cn.iocoder.yudao.module.crm.service.clue; | ||
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | import cn.hutool.core.collection.ListUtil; | 4 | import cn.hutool.core.collection.ListUtil; |
| 5 | +import cn.hutool.core.lang.Assert; | ||
| 5 | import cn.hutool.core.util.ObjectUtil; | 6 | import cn.hutool.core.util.ObjectUtil; |
| 7 | +import cn.hutool.core.util.StrUtil; | ||
| 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 8 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 9 | +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | ||
| 7 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 10 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 8 | import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmCluePageReqVO; | 11 | import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmCluePageReqVO; |
| 9 | import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueSaveReqVO; | 12 | import cn.iocoder.yudao.module.crm.controller.admin.clue.vo.CrmClueSaveReqVO; |
| @@ -17,8 +20,13 @@ import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; | @@ -17,8 +20,13 @@ import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; | ||
| 17 | import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; | 20 | import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; |
| 18 | import cn.iocoder.yudao.module.crm.framework.permission.core.annotations.CrmPermission; | 21 | import cn.iocoder.yudao.module.crm.framework.permission.core.annotations.CrmPermission; |
| 19 | import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; | 22 | import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; |
| 23 | +import cn.iocoder.yudao.module.crm.service.followup.bo.CrmUpdateFollowUpReqBO; | ||
| 20 | import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; | 24 | import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; |
| 25 | +import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO; | ||
| 21 | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | 26 | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| 27 | +import com.mzt.logapi.context.LogRecordContext; | ||
| 28 | +import com.mzt.logapi.service.impl.DiffParseFunction; | ||
| 29 | +import com.mzt.logapi.starter.annotation.LogRecord; | ||
| 22 | import jakarta.annotation.Resource; | 30 | import jakarta.annotation.Resource; |
| 23 | import org.springframework.stereotype.Service; | 31 | import org.springframework.stereotype.Service; |
| 24 | import org.springframework.transaction.annotation.Transactional; | 32 | import org.springframework.transaction.annotation.Transactional; |
| @@ -28,11 +36,12 @@ import java.util.Collection; | @@ -28,11 +36,12 @@ import java.util.Collection; | ||
| 28 | import java.util.List; | 36 | import java.util.List; |
| 29 | import java.util.Objects; | 37 | import java.util.Objects; |
| 30 | import java.util.Set; | 38 | import java.util.Set; |
| 31 | -import java.util.stream.Collectors; | ||
| 32 | 39 | ||
| 33 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | 40 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 34 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | 41 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| 42 | +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | ||
| 35 | import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*; | 43 | import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*; |
| 44 | +import static cn.iocoder.yudao.module.crm.enums.LogRecordConstants.*; | ||
| 36 | import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_NOT_EXISTS; | 45 | import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_NOT_EXISTS; |
| 37 | 46 | ||
| 38 | /** | 47 | /** |
| @@ -57,46 +66,82 @@ public class CrmClueServiceImpl implements CrmClueService { | @@ -57,46 +66,82 @@ public class CrmClueServiceImpl implements CrmClueService { | ||
| 57 | private AdminUserApi adminUserApi; | 66 | private AdminUserApi adminUserApi; |
| 58 | 67 | ||
| 59 | @Override | 68 | @Override |
| 60 | - // TODO @min:补充相关几个方法的操作日志; | 69 | + @Transactional(rollbackFor = Exception.class) |
| 70 | + @LogRecord(type = CRM_LEADS_TYPE, subType = CRM_LEADS_CREATE_SUB_TYPE, bizNo = "{{#clue.id}}", | ||
| 71 | + success = CRM_LEADS_CREATE_SUCCESS) | ||
| 61 | public Long createClue(CrmClueSaveReqVO createReqVO) { | 72 | public Long createClue(CrmClueSaveReqVO createReqVO) { |
| 62 | - // 校验关联数据 | 73 | + // 1. 校验关联数据 |
| 63 | validateRelationDataExists(createReqVO); | 74 | validateRelationDataExists(createReqVO); |
| 64 | 75 | ||
| 65 | - // 插入 | 76 | + // 2. 插入 |
| 66 | CrmClueDO clue = BeanUtils.toBean(createReqVO, CrmClueDO.class); | 77 | CrmClueDO clue = BeanUtils.toBean(createReqVO, CrmClueDO.class); |
| 67 | clueMapper.insert(clue); | 78 | clueMapper.insert(clue); |
| 68 | - // 返回 | 79 | + |
| 80 | + // 3. 创建数据权限 | ||
| 81 | + CrmPermissionCreateReqBO createReqBO = new CrmPermissionCreateReqBO() | ||
| 82 | + .setBizType(CrmBizTypeEnum.CRM_LEADS.getType()) | ||
| 83 | + .setBizId(clue.getId()) | ||
| 84 | + // 设置当前操作的人为负责人 | ||
| 85 | + .setUserId(getLoginUserId()) | ||
| 86 | + .setLevel(CrmPermissionLevelEnum.OWNER.getLevel()); | ||
| 87 | + crmPermissionService.createPermission(createReqBO); | ||
| 88 | + | ||
| 89 | + // 4. 记录操作日志上下文 | ||
| 90 | + LogRecordContext.putVariable("clue", clue); | ||
| 69 | return clue.getId(); | 91 | return clue.getId(); |
| 70 | } | 92 | } |
| 71 | 93 | ||
| 72 | @Override | 94 | @Override |
| 95 | + @Transactional(rollbackFor = Exception.class) | ||
| 96 | + @LogRecord(type = CRM_LEADS_TYPE, subType = CRM_LEADS_UPDATE_SUB_TYPE, bizNo = "{{#updateReqVO.id}}", | ||
| 97 | + success = CRM_LEADS_UPDATE_SUCCESS) | ||
| 73 | @CrmPermission(bizType = CrmBizTypeEnum.CRM_LEADS, bizId = "#updateReqVO.id", level = CrmPermissionLevelEnum.WRITE) | 98 | @CrmPermission(bizType = CrmBizTypeEnum.CRM_LEADS, bizId = "#updateReqVO.id", level = CrmPermissionLevelEnum.WRITE) |
| 74 | public void updateClue(CrmClueSaveReqVO updateReqVO) { | 99 | public void updateClue(CrmClueSaveReqVO updateReqVO) { |
| 75 | - // 校验线索是否存在 | ||
| 76 | - validateClueExists(updateReqVO.getId()); | ||
| 77 | - // 校验关联数据 | 100 | + Assert.notNull(updateReqVO.getId(), "线索编号不能为空"); |
| 101 | + // 1. 校验线索是否存在 | ||
| 102 | + CrmClueDO oldClue = validateClueExists(updateReqVO.getId()); | ||
| 103 | + // 2. 校验关联数据 | ||
| 78 | validateRelationDataExists(updateReqVO); | 104 | validateRelationDataExists(updateReqVO); |
| 79 | 105 | ||
| 80 | - // 更新 | 106 | + // 3. 更新 |
| 81 | CrmClueDO updateObj = BeanUtils.toBean(updateReqVO, CrmClueDO.class); | 107 | CrmClueDO updateObj = BeanUtils.toBean(updateReqVO, CrmClueDO.class); |
| 82 | clueMapper.updateById(updateObj); | 108 | clueMapper.updateById(updateObj); |
| 109 | + | ||
| 110 | + // 3. 记录操作日志上下文 | ||
| 111 | + LogRecordContext.putVariable(DiffParseFunction.OLD_OBJECT, BeanUtils.toBean(oldClue, CrmCustomerSaveReqVO.class)); | ||
| 112 | + LogRecordContext.putVariable("clueName", oldClue.getName()); | ||
| 83 | } | 113 | } |
| 84 | 114 | ||
| 85 | @Override | 115 | @Override |
| 116 | + public void updateClueFollowUp(CrmUpdateFollowUpReqBO clueUpdateFollowUpReqBO) { | ||
| 117 | + clueMapper.updateById(BeanUtils.toBean(clueUpdateFollowUpReqBO, CrmClueDO.class).setId(clueUpdateFollowUpReqBO.getBizId())); | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + @Override | ||
| 121 | + @Transactional(rollbackFor = Exception.class) | ||
| 122 | + @LogRecord(type = CRM_LEADS_TYPE, subType = CRM_LEADS_DELETE_SUB_TYPE, bizNo = "{{#id}}", | ||
| 123 | + success = CRM_LEADS_DELETE_SUCCESS) | ||
| 86 | @CrmPermission(bizType = CrmBizTypeEnum.CRM_LEADS, bizId = "#id", level = CrmPermissionLevelEnum.OWNER) | 124 | @CrmPermission(bizType = CrmBizTypeEnum.CRM_LEADS, bizId = "#id", level = CrmPermissionLevelEnum.OWNER) |
| 87 | public void deleteClue(Long id) { | 125 | public void deleteClue(Long id) { |
| 88 | - // 校验存在 | ||
| 89 | - validateClueExists(id); | ||
| 90 | - // 删除 | 126 | + // 1. 校验存在 |
| 127 | + CrmClueDO clue = validateClueExists(id); | ||
| 128 | + | ||
| 129 | + // 2. 删除 | ||
| 91 | clueMapper.deleteById(id); | 130 | clueMapper.deleteById(id); |
| 92 | - // 删除数据权限 | 131 | + |
| 132 | + // 3. 删除数据权限 | ||
| 93 | crmPermissionService.deletePermission(CrmBizTypeEnum.CRM_LEADS.getType(), id); | 133 | crmPermissionService.deletePermission(CrmBizTypeEnum.CRM_LEADS.getType(), id); |
| 134 | + | ||
| 135 | + // 4. 记录操作日志上下文 | ||
| 136 | + LogRecordContext.putVariable("clueName", clue.getName()); | ||
| 94 | } | 137 | } |
| 95 | 138 | ||
| 96 | - private void validateClueExists(Long id) { | ||
| 97 | - if (clueMapper.selectById(id) == null) { | 139 | + private CrmClueDO validateClueExists(Long id) { |
| 140 | + CrmClueDO crmClueDO = clueMapper.selectById(id); | ||
| 141 | + if (crmClueDO == null) { | ||
| 98 | throw exception(CLUE_NOT_EXISTS); | 142 | throw exception(CLUE_NOT_EXISTS); |
| 99 | } | 143 | } |
| 144 | + return crmClueDO; | ||
| 100 | } | 145 | } |
| 101 | 146 | ||
| 102 | @Override | 147 | @Override |
| @@ -139,29 +184,24 @@ public class CrmClueServiceImpl implements CrmClueService { | @@ -139,29 +184,24 @@ public class CrmClueServiceImpl implements CrmClueService { | ||
| 139 | List<CrmClueDO> clues = getClueList(clueIds, userId); | 184 | List<CrmClueDO> clues = getClueList(clueIds, userId); |
| 140 | if (CollUtil.isEmpty(clues) || ObjectUtil.notEqual(clues.size(), clueIds.size())) { | 185 | if (CollUtil.isEmpty(clues) || ObjectUtil.notEqual(clues.size(), clueIds.size())) { |
| 141 | clueIds.removeAll(convertSet(clues, CrmClueDO::getId)); | 186 | clueIds.removeAll(convertSet(clues, CrmClueDO::getId)); |
| 142 | - // TODO @min:可以使用 StrUtil.join(",", clueIds) 简化这种常见操作 | ||
| 143 | - throw exception(CLUE_ANY_CLUE_NOT_EXISTS, clueIds.stream().map(String::valueOf).collect(Collectors.joining(","))); | 187 | + throw exception(CLUE_ANY_CLUE_NOT_EXISTS, StrUtil.join(",", clueIds)); |
| 144 | } | 188 | } |
| 145 | 189 | ||
| 146 | - // 过滤出未转化的客户 | ||
| 147 | - // TODO @min:1)存在已经转化的,直接提示哈。避免操作的用户,以为都转化成功了;2)常见的过滤逻辑,可以使用 CollectionUtils.filterList() | ||
| 148 | - List<CrmClueDO> unTransformClues = clues.stream() | ||
| 149 | - .filter(clue -> ObjectUtil.notEqual(Boolean.TRUE, clue.getTransformStatus())).toList(); | ||
| 150 | - // 传入的线索中包含已经转化的情况,抛出业务异常 | ||
| 151 | - if (ObjectUtil.notEqual(clues.size(), unTransformClues.size())) { | ||
| 152 | - // TODO @min:可以使用 StrUtil.join(",", clueIds) 简化这种常见操作 | ||
| 153 | - clueIds.removeAll(convertSet(unTransformClues, CrmClueDO::getId)); | ||
| 154 | - throw exception(CLUE_ANY_CLUE_ALREADY_TRANSLATED, clueIds.stream().map(String::valueOf).collect(Collectors.joining(","))); | 190 | + // 存在已经转化的,直接提示哈。避免操作的用户,以为都转化成功了 |
| 191 | + List<CrmClueDO> translatedClues = CollectionUtils.filterList(clues, | ||
| 192 | + clue -> ObjectUtil.equal(Boolean.TRUE, clue.getTransformStatus())); | ||
| 193 | + if (CollUtil.isNotEmpty(translatedClues)) { | ||
| 194 | + throw exception(CLUE_ANY_CLUE_ALREADY_TRANSLATED, StrUtil.join(",", convertSet(translatedClues, CrmClueDO::getId))); | ||
| 155 | } | 195 | } |
| 156 | 196 | ||
| 157 | // 遍历线索(未转化的线索),创建对应的客户 | 197 | // 遍历线索(未转化的线索),创建对应的客户 |
| 158 | - unTransformClues.forEach(clue -> { | 198 | + reqVO.getIds().forEach(id -> { |
| 159 | // 1. 创建客户 | 199 | // 1. 创建客户 |
| 160 | - CrmCustomerSaveReqVO customerSaveReqVO = BeanUtils.toBean(clue, CrmCustomerSaveReqVO.class).setId(null); | 200 | + CrmCustomerSaveReqVO customerSaveReqVO = BeanUtils.toBean(id, CrmCustomerSaveReqVO.class).setId(null); |
| 161 | Long customerId = customerService.createCustomer(customerSaveReqVO, userId); | 201 | Long customerId = customerService.createCustomer(customerSaveReqVO, userId); |
| 162 | - // TODO @puhui999:如果有跟进记录,需要一起转过去; | 202 | + // TODO @puhui999:如果有跟进记录,需要一起转过去;提问:艿艿这里是复制线索所有的跟进吗?还是直接把线索相关的跟进 bizType、bizId 全改为关联客户? |
| 163 | // 2. 更新线索 | 203 | // 2. 更新线索 |
| 164 | - clueMapper.updateById(new CrmClueDO().setId(clue.getId()) | 204 | + clueMapper.updateById(new CrmClueDO().setId(id) |
| 165 | .setTransformStatus(Boolean.TRUE).setCustomerId(customerId)); | 205 | .setTransformStatus(Boolean.TRUE).setCustomerId(customerId)); |
| 166 | }); | 206 | }); |
| 167 | } | 207 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactService.java
| @@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactSaveReq | @@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactSaveReq | ||
| 6 | import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactTransferReqVO; | 6 | import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.CrmContactTransferReqVO; |
| 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; | 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.contact.CrmContactDO; |
| 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 9 | +import cn.iocoder.yudao.module.crm.service.followup.bo.CrmUpdateFollowUpReqBO; | ||
| 9 | import jakarta.validation.Valid; | 10 | import jakarta.validation.Valid; |
| 10 | 11 | ||
| 11 | import java.util.Collection; | 12 | import java.util.Collection; |
| @@ -58,6 +59,13 @@ public interface CrmContactService { | @@ -58,6 +59,13 @@ public interface CrmContactService { | ||
| 58 | void updateOwnerUserIdByCustomerId(Long customerId, Long ownerUserId); | 59 | void updateOwnerUserIdByCustomerId(Long customerId, Long ownerUserId); |
| 59 | 60 | ||
| 60 | /** | 61 | /** |
| 62 | + * 更新联系人相关跟进信息 | ||
| 63 | + * | ||
| 64 | + * @param updateFollowUpReqBOList 跟进信息 | ||
| 65 | + */ | ||
| 66 | + void updateContactFollowUpBatch(List<CrmUpdateFollowUpReqBO> updateFollowUpReqBOList); | ||
| 67 | + | ||
| 68 | + /** | ||
| 61 | * 获得联系人 | 69 | * 获得联系人 |
| 62 | * | 70 | * |
| 63 | * @param id 编号 | 71 | * @param id 编号 |
| @@ -90,6 +98,14 @@ public interface CrmContactService { | @@ -90,6 +98,14 @@ public interface CrmContactService { | ||
| 90 | List<CrmContactDO> getContactList(); | 98 | List<CrmContactDO> getContactList(); |
| 91 | 99 | ||
| 92 | /** | 100 | /** |
| 101 | + * 获取联系人列表(校验权限) | ||
| 102 | + * | ||
| 103 | + * @param userId 用户编号 | ||
| 104 | + * @return 联系人列表 | ||
| 105 | + */ | ||
| 106 | + List<CrmContactDO> getSimpleContactList(Long userId); | ||
| 107 | + | ||
| 108 | + /** | ||
| 93 | * 获得联系人分页 | 109 | * 获得联系人分页 |
| 94 | * | 110 | * |
| 95 | * 数据权限:基于 {@link CrmContactDO} | 111 | * 数据权限:基于 {@link CrmContactDO} |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contact/CrmContactServiceImpl.java
| @@ -17,6 +17,7 @@ import cn.iocoder.yudao.module.crm.framework.permission.core.annotations.CrmPerm | @@ -17,6 +17,7 @@ import cn.iocoder.yudao.module.crm.framework.permission.core.annotations.CrmPerm | ||
| 17 | import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService; | 17 | import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService; |
| 18 | import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; | 18 | import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; |
| 19 | import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; | 19 | import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; |
| 20 | +import cn.iocoder.yudao.module.crm.service.followup.bo.CrmUpdateFollowUpReqBO; | ||
| 20 | import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; | 21 | import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; |
| 21 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO; | 22 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO; |
| 22 | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | 23 | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| @@ -32,6 +33,7 @@ import java.util.Collection; | @@ -32,6 +33,7 @@ import java.util.Collection; | ||
| 32 | import java.util.List; | 33 | import java.util.List; |
| 33 | 34 | ||
| 34 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | 35 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 36 | +import static cn.iocoder.yudao.framework.common.pojo.PageParam.PAGE_SIZE_NONE; | ||
| 35 | import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*; | 37 | import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*; |
| 36 | import static cn.iocoder.yudao.module.crm.enums.LogRecordConstants.*; | 38 | import static cn.iocoder.yudao.module.crm.enums.LogRecordConstants.*; |
| 37 | import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_NOT_EXISTS; | 39 | import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_NOT_EXISTS; |
| @@ -192,6 +194,11 @@ public class CrmContactServiceImpl implements CrmContactService { | @@ -192,6 +194,11 @@ public class CrmContactServiceImpl implements CrmContactService { | ||
| 192 | contactMapper.updateOwnerUserIdByCustomerId(customerId, ownerUserId); | 194 | contactMapper.updateOwnerUserIdByCustomerId(customerId, ownerUserId); |
| 193 | } | 195 | } |
| 194 | 196 | ||
| 197 | + @Override | ||
| 198 | + public void updateContactFollowUpBatch(List<CrmUpdateFollowUpReqBO> updateFollowUpReqBOList) { | ||
| 199 | + contactMapper.updateBatch(CrmContactConvert.INSTANCE.convertList(updateFollowUpReqBOList)); | ||
| 200 | + } | ||
| 201 | + | ||
| 195 | //======================= 查询相关 ======================= | 202 | //======================= 查询相关 ======================= |
| 196 | 203 | ||
| 197 | @Override | 204 | @Override |
| @@ -222,6 +229,13 @@ public class CrmContactServiceImpl implements CrmContactService { | @@ -222,6 +229,13 @@ public class CrmContactServiceImpl implements CrmContactService { | ||
| 222 | } | 229 | } |
| 223 | 230 | ||
| 224 | @Override | 231 | @Override |
| 232 | + public List<CrmContactDO> getSimpleContactList(Long userId) { | ||
| 233 | + CrmContactPageReqVO reqVO = new CrmContactPageReqVO(); | ||
| 234 | + reqVO.setPageSize(PAGE_SIZE_NONE); // 不分页 | ||
| 235 | + return contactMapper.selectPage(reqVO, userId).getList(); | ||
| 236 | + } | ||
| 237 | + | ||
| 238 | + @Override | ||
| 225 | public PageResult<CrmContactDO> getContactPage(CrmContactPageReqVO pageReqVO, Long userId) { | 239 | public PageResult<CrmContactDO> getContactPage(CrmContactPageReqVO pageReqVO, Long userId) { |
| 226 | return contactMapper.selectPage(pageReqVO, userId); | 240 | return contactMapper.selectPage(pageReqVO, userId); |
| 227 | } | 241 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/CrmContractService.java
| @@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractSaveR | @@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractSaveR | ||
| 6 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractTransferReqVO; | 6 | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.CrmContractTransferReqVO; |
| 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; | 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; |
| 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 9 | +import cn.iocoder.yudao.module.crm.service.followup.bo.CrmUpdateFollowUpReqBO; | ||
| 9 | import jakarta.validation.Valid; | 10 | import jakarta.validation.Valid; |
| 10 | 11 | ||
| 11 | import java.util.Collection; | 12 | import java.util.Collection; |
| @@ -42,6 +43,21 @@ public interface CrmContractService { | @@ -42,6 +43,21 @@ public interface CrmContractService { | ||
| 42 | void deleteContract(Long id); | 43 | void deleteContract(Long id); |
| 43 | 44 | ||
| 44 | /** | 45 | /** |
| 46 | + * 合同转移 | ||
| 47 | + * | ||
| 48 | + * @param reqVO 请求 | ||
| 49 | + * @param userId 用户编号 | ||
| 50 | + */ | ||
| 51 | + void transferContract(CrmContractTransferReqVO reqVO, Long userId); | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 更新合同相关的更进信息 | ||
| 55 | + * | ||
| 56 | + * @param contractUpdateFollowUpReqBO 信息 | ||
| 57 | + */ | ||
| 58 | + void updateContractFollowUp(CrmUpdateFollowUpReqBO contractUpdateFollowUpReqBO); | ||
| 59 | + | ||
| 60 | + /** | ||
| 45 | * 获得合同 | 61 | * 获得合同 |
| 46 | * | 62 | * |
| 47 | * @param id 编号 | 63 | * @param id 编号 |
| @@ -79,14 +95,6 @@ public interface CrmContractService { | @@ -79,14 +95,6 @@ public interface CrmContractService { | ||
| 79 | PageResult<CrmContractDO> getContractPageByCustomerId(CrmContractPageReqVO pageReqVO); | 95 | PageResult<CrmContractDO> getContractPageByCustomerId(CrmContractPageReqVO pageReqVO); |
| 80 | 96 | ||
| 81 | /** | 97 | /** |
| 82 | - * 合同转移 | ||
| 83 | - * | ||
| 84 | - * @param reqVO 请求 | ||
| 85 | - * @param userId 用户编号 | ||
| 86 | - */ | ||
| 87 | - void transferContract(CrmContractTransferReqVO reqVO, Long userId); | ||
| 88 | - | ||
| 89 | - /** | ||
| 90 | * 查询属于某个联系人的合同数量 | 98 | * 查询属于某个联系人的合同数量 |
| 91 | * | 99 | * |
| 92 | * @param contactId 联系人ID | 100 | * @param contactId 联系人ID |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/contract/CrmContractServiceImpl.java
| @@ -13,6 +13,7 @@ import cn.iocoder.yudao.module.crm.dal.mysql.contract.CrmContractMapper; | @@ -13,6 +13,7 @@ import cn.iocoder.yudao.module.crm.dal.mysql.contract.CrmContractMapper; | ||
| 13 | import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; | 13 | import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; |
| 14 | import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; | 14 | import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; |
| 15 | import cn.iocoder.yudao.module.crm.framework.permission.core.annotations.CrmPermission; | 15 | import cn.iocoder.yudao.module.crm.framework.permission.core.annotations.CrmPermission; |
| 16 | +import cn.iocoder.yudao.module.crm.service.followup.bo.CrmUpdateFollowUpReqBO; | ||
| 16 | import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; | 17 | import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; |
| 17 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO; | 18 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO; |
| 18 | import com.mzt.logapi.context.LogRecordContext; | 19 | import com.mzt.logapi.context.LogRecordContext; |
| @@ -135,6 +136,11 @@ public class CrmContractServiceImpl implements CrmContractService { | @@ -135,6 +136,11 @@ public class CrmContractServiceImpl implements CrmContractService { | ||
| 135 | LogRecordContext.putVariable("contract", contract); | 136 | LogRecordContext.putVariable("contract", contract); |
| 136 | } | 137 | } |
| 137 | 138 | ||
| 139 | + @Override | ||
| 140 | + public void updateContractFollowUp(CrmUpdateFollowUpReqBO contractUpdateFollowUpReqBO) { | ||
| 141 | + contractMapper.updateById(BeanUtils.toBean(contractUpdateFollowUpReqBO, CrmContractDO.class).setId(contractUpdateFollowUpReqBO.getBizId())); | ||
| 142 | + } | ||
| 143 | + | ||
| 138 | //======================= 查询相关 ======================= | 144 | //======================= 查询相关 ======================= |
| 139 | 145 | ||
| 140 | @Override | 146 | @Override |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerService.java
| @@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerPageR | @@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerPageR | ||
| 6 | import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerSaveReqVO; | 6 | import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerSaveReqVO; |
| 7 | import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerTransferReqVO; | 7 | import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerTransferReqVO; |
| 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; | 8 | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| 9 | +import cn.iocoder.yudao.module.crm.service.followup.bo.CrmUpdateFollowUpReqBO; | ||
| 9 | import jakarta.validation.Valid; | 10 | import jakarta.validation.Valid; |
| 10 | 11 | ||
| 11 | import java.util.Collection; | 12 | import java.util.Collection; |
| @@ -90,6 +91,13 @@ public interface CrmCustomerService { | @@ -90,6 +91,13 @@ public interface CrmCustomerService { | ||
| 90 | */ | 91 | */ |
| 91 | void lockCustomer(@Valid CrmCustomerLockReqVO lockReqVO, Long userId); | 92 | void lockCustomer(@Valid CrmCustomerLockReqVO lockReqVO, Long userId); |
| 92 | 93 | ||
| 94 | + /** | ||
| 95 | + * 更新客户相关更进信息 | ||
| 96 | + * | ||
| 97 | + * @param customerUpdateFollowUpReqBO 请求 | ||
| 98 | + */ | ||
| 99 | + void updateCustomerFollowUp(CrmUpdateFollowUpReqBO customerUpdateFollowUpReqBO); | ||
| 100 | + | ||
| 93 | // ==================== 公海相关操作 ==================== | 101 | // ==================== 公海相关操作 ==================== |
| 94 | 102 | ||
| 95 | /** | 103 | /** |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/customer/CrmCustomerServiceImpl.java
| @@ -21,6 +21,7 @@ import cn.iocoder.yudao.module.crm.framework.permission.core.util.CrmPermissionU | @@ -21,6 +21,7 @@ import cn.iocoder.yudao.module.crm.framework.permission.core.util.CrmPermissionU | ||
| 21 | import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService; | 21 | import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService; |
| 22 | import cn.iocoder.yudao.module.crm.service.contact.CrmContactService; | 22 | import cn.iocoder.yudao.module.crm.service.contact.CrmContactService; |
| 23 | import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; | 23 | import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; |
| 24 | +import cn.iocoder.yudao.module.crm.service.followup.bo.CrmUpdateFollowUpReqBO; | ||
| 24 | import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; | 25 | import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; |
| 25 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO; | 26 | import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO; |
| 26 | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | 27 | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| @@ -203,6 +204,11 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | @@ -203,6 +204,11 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | ||
| 203 | LogRecordContext.putVariable("customer", customer); | 204 | LogRecordContext.putVariable("customer", customer); |
| 204 | } | 205 | } |
| 205 | 206 | ||
| 207 | + @Override | ||
| 208 | + public void updateCustomerFollowUp(CrmUpdateFollowUpReqBO customerUpdateFollowUpReqBO) { | ||
| 209 | + customerMapper.updateById(BeanUtils.toBean(customerUpdateFollowUpReqBO, CrmCustomerDO.class).setId(customerUpdateFollowUpReqBO.getBizId())); | ||
| 210 | + } | ||
| 211 | + | ||
| 206 | // ==================== 公海相关操作 ==================== | 212 | // ==================== 公海相关操作 ==================== |
| 207 | 213 | ||
| 208 | @Override | 214 | @Override |
| @@ -221,16 +227,16 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | @@ -221,16 +227,16 @@ public class CrmCustomerServiceImpl implements CrmCustomerService { | ||
| 221 | // 1.3. 校验客户是否锁定 | 227 | // 1.3. 校验客户是否锁定 |
| 222 | validateCustomerIsLocked(customer, true); | 228 | validateCustomerIsLocked(customer, true); |
| 223 | 229 | ||
| 224 | - // 2. 设置负责人为 NULL | 230 | + // 2.1 设置负责人为 NULL |
| 225 | int updateOwnerUserIncr = customerMapper.updateOwnerUserIdById(customer.getId(), null); | 231 | int updateOwnerUserIncr = customerMapper.updateOwnerUserIdById(customer.getId(), null); |
| 226 | if (updateOwnerUserIncr == 0) { | 232 | if (updateOwnerUserIncr == 0) { |
| 227 | throw exception(CUSTOMER_UPDATE_OWNER_USER_FAIL); | 233 | throw exception(CUSTOMER_UPDATE_OWNER_USER_FAIL); |
| 228 | } | 234 | } |
| 229 | - // 3. 删除负责人数据权限 | 235 | + // 2.2 删除负责人数据权限 |
| 230 | permissionService.deletePermission(CrmBizTypeEnum.CRM_CUSTOMER.getType(), customer.getId(), | 236 | permissionService.deletePermission(CrmBizTypeEnum.CRM_CUSTOMER.getType(), customer.getId(), |
| 231 | CrmPermissionLevelEnum.OWNER.getLevel()); | 237 | CrmPermissionLevelEnum.OWNER.getLevel()); |
| 232 | - // TODO @puhui999:联系人的负责人,也要设置为 null;这块和领取是对应的;因为领取后,负责人也要关联过来; | ||
| 233 | - // 提问:那是不是可以这样理解客户所有联系人的负责人默认为客户的负责人,然后添加客户团队成员时才存在“同时分配给”的操作? | 238 | + |
| 239 | + // 3. 联系人的负责人,也要设置为 null。因为:因为领取后,负责人也要关联过来,这块和 receiveCustomer 是对应的 | ||
| 234 | contactService.updateOwnerUserIdByCustomerId(customer.getId(), null); | 240 | contactService.updateOwnerUserIdByCustomerId(customer.getId(), null); |
| 235 | 241 | ||
| 236 | // 记录操作日志上下文 | 242 | // 记录操作日志上下文 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/followup/CrmFollowUpRecordService.java
| @@ -14,7 +14,7 @@ import jakarta.validation.Valid; | @@ -14,7 +14,7 @@ import jakarta.validation.Valid; | ||
| 14 | public interface CrmFollowUpRecordService { | 14 | public interface CrmFollowUpRecordService { |
| 15 | 15 | ||
| 16 | /** | 16 | /** |
| 17 | - * 创建跟进记录 | 17 | + * 创建跟进记录 (数据权限基于 bizType、 bizId) |
| 18 | * | 18 | * |
| 19 | * @param createReqVO 创建信息 | 19 | * @param createReqVO 创建信息 |
| 20 | * @return 编号 | 20 | * @return 编号 |
| @@ -22,18 +22,12 @@ public interface CrmFollowUpRecordService { | @@ -22,18 +22,12 @@ public interface CrmFollowUpRecordService { | ||
| 22 | Long createFollowUpRecord(@Valid CrmFollowUpRecordSaveReqVO createReqVO); | 22 | Long createFollowUpRecord(@Valid CrmFollowUpRecordSaveReqVO createReqVO); |
| 23 | 23 | ||
| 24 | /** | 24 | /** |
| 25 | - * 更新跟进记录 | 25 | + * 删除跟进记录 (数据权限基于 bizType、 bizId) |
| 26 | * | 26 | * |
| 27 | - * @param updateReqVO 更新信息 | 27 | + * @param id 编号 |
| 28 | + * @param userId 用户编号 | ||
| 28 | */ | 29 | */ |
| 29 | - void updateFollowUpRecord(@Valid CrmFollowUpRecordSaveReqVO updateReqVO); | ||
| 30 | - | ||
| 31 | - /** | ||
| 32 | - * 删除跟进记录 | ||
| 33 | - * | ||
| 34 | - * @param id 编号 | ||
| 35 | - */ | ||
| 36 | - void deleteFollowUpRecord(Long id); | 30 | + void deleteFollowUpRecord(Long id, Long userId); |
| 37 | 31 | ||
| 38 | /** | 32 | /** |
| 39 | * 获得跟进记录 | 33 | * 获得跟进记录 |
| @@ -44,7 +38,7 @@ public interface CrmFollowUpRecordService { | @@ -44,7 +38,7 @@ public interface CrmFollowUpRecordService { | ||
| 44 | CrmFollowUpRecordDO getFollowUpRecord(Long id); | 38 | CrmFollowUpRecordDO getFollowUpRecord(Long id); |
| 45 | 39 | ||
| 46 | /** | 40 | /** |
| 47 | - * 获得跟进记录分页 | 41 | + * 获得跟进记录分页 (数据权限基于 bizType、 bizId) |
| 48 | * | 42 | * |
| 49 | * @param pageReqVO 分页查询 | 43 | * @param pageReqVO 分页查询 |
| 50 | * @return 跟进记录分页 | 44 | * @return 跟进记录分页 |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/followup/CrmFollowUpRecordServiceImpl.java
| 1 | package cn.iocoder.yudao.module.crm.service.followup; | 1 | package cn.iocoder.yudao.module.crm.service.followup; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.hutool.core.util.ObjUtil; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 6 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 5 | import cn.iocoder.yudao.module.crm.controller.admin.followup.vo.CrmFollowUpRecordPageReqVO; | 7 | import cn.iocoder.yudao.module.crm.controller.admin.followup.vo.CrmFollowUpRecordPageReqVO; |
| 6 | import cn.iocoder.yudao.module.crm.controller.admin.followup.vo.CrmFollowUpRecordSaveReqVO; | 8 | import cn.iocoder.yudao.module.crm.controller.admin.followup.vo.CrmFollowUpRecordSaveReqVO; |
| 7 | import cn.iocoder.yudao.module.crm.dal.dataobject.followup.CrmFollowUpRecordDO; | 9 | import cn.iocoder.yudao.module.crm.dal.dataobject.followup.CrmFollowUpRecordDO; |
| 10 | +import cn.iocoder.yudao.module.crm.dal.dataobject.permission.CrmPermissionDO; | ||
| 8 | import cn.iocoder.yudao.module.crm.dal.mysql.followup.CrmFollowUpRecordMapper; | 11 | import cn.iocoder.yudao.module.crm.dal.mysql.followup.CrmFollowUpRecordMapper; |
| 12 | +import cn.iocoder.yudao.module.crm.enums.common.CrmBizTypeEnum; | ||
| 13 | +import cn.iocoder.yudao.module.crm.enums.permission.CrmPermissionLevelEnum; | ||
| 14 | +import cn.iocoder.yudao.module.crm.framework.permission.core.annotations.CrmPermission; | ||
| 15 | +import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService; | ||
| 16 | +import cn.iocoder.yudao.module.crm.service.clue.CrmClueService; | ||
| 17 | +import cn.iocoder.yudao.module.crm.service.contact.CrmContactService; | ||
| 18 | +import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; | ||
| 19 | +import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; | ||
| 20 | +import cn.iocoder.yudao.module.crm.service.followup.bo.CrmUpdateFollowUpReqBO; | ||
| 21 | +import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService; | ||
| 9 | import jakarta.annotation.Resource; | 22 | import jakarta.annotation.Resource; |
| 10 | import org.springframework.stereotype.Service; | 23 | import org.springframework.stereotype.Service; |
| 11 | import org.springframework.validation.annotation.Validated; | 24 | import org.springframework.validation.annotation.Validated; |
| 12 | 25 | ||
| 26 | +import java.time.LocalDateTime; | ||
| 27 | +import java.util.Collections; | ||
| 28 | +import java.util.List; | ||
| 29 | + | ||
| 13 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | 30 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 31 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.anyMatch; | ||
| 32 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | ||
| 33 | +import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.FOLLOW_UP_RECORD_DELETE_DENIED; | ||
| 14 | import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.FOLLOW_UP_RECORD_NOT_EXISTS; | 34 | import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.FOLLOW_UP_RECORD_NOT_EXISTS; |
| 15 | 35 | ||
| 16 | /** | 36 | /** |
| @@ -25,36 +45,134 @@ public class CrmFollowUpRecordServiceImpl implements CrmFollowUpRecordService { | @@ -25,36 +45,134 @@ public class CrmFollowUpRecordServiceImpl implements CrmFollowUpRecordService { | ||
| 25 | @Resource | 45 | @Resource |
| 26 | private CrmFollowUpRecordMapper crmFollowUpRecordMapper; | 46 | private CrmFollowUpRecordMapper crmFollowUpRecordMapper; |
| 27 | 47 | ||
| 48 | + @Resource | ||
| 49 | + private CrmPermissionService permissionService; | ||
| 50 | + @Resource | ||
| 51 | + private CrmBusinessService businessService; | ||
| 52 | + @Resource | ||
| 53 | + private CrmClueService clueService; | ||
| 54 | + @Resource | ||
| 55 | + private CrmContactService contactService; | ||
| 56 | + @Resource | ||
| 57 | + private CrmContractService contractService; | ||
| 58 | + @Resource | ||
| 59 | + private CrmCustomerService customerService; | ||
| 60 | + | ||
| 28 | @Override | 61 | @Override |
| 62 | + @CrmPermission(bizTypeValue = "#createReqVO.bizType", bizId = "#createReqVO.bizId", level = CrmPermissionLevelEnum.WRITE) | ||
| 29 | public Long createFollowUpRecord(CrmFollowUpRecordSaveReqVO createReqVO) { | 63 | public Long createFollowUpRecord(CrmFollowUpRecordSaveReqVO createReqVO) { |
| 64 | + // 创建更进记录 | ||
| 30 | CrmFollowUpRecordDO followUpRecord = BeanUtils.toBean(createReqVO, CrmFollowUpRecordDO.class); | 65 | CrmFollowUpRecordDO followUpRecord = BeanUtils.toBean(createReqVO, CrmFollowUpRecordDO.class); |
| 31 | crmFollowUpRecordMapper.insert(followUpRecord); | 66 | crmFollowUpRecordMapper.insert(followUpRecord); |
| 32 | - // TODO @puhui999:需要更新 bizId 对应的记录; | ||
| 33 | - // TODO @puhui999:需要更新 businessIds、contactIds 对应的记录; | 67 | + |
| 68 | + LocalDateTime now = LocalDateTime.now(); | ||
| 69 | + // TODO @puhui999:感觉可以这里基于 type 做 102 到 104 这种判断;然后,每个类型的调用封装一个小方法,之后调用这些小方法;再之后,74-76、80-82 也是等价的处理; | ||
| 70 | + // 2. 更新 bizId 对应的记录; | ||
| 71 | + updateBizTypeFollowUp(followUpRecord, now); | ||
| 72 | + // 3.1 更新 contactIds 对应的记录 | ||
| 73 | + if (CollUtil.isNotEmpty(createReqVO.getContactIds())) { | ||
| 74 | + contactService.updateContactFollowUpBatch(convertList(createReqVO.getContactIds(), contactId -> | ||
| 75 | + new CrmUpdateFollowUpReqBO().setBizId(contactId).setContactNextTime(followUpRecord.getNextTime()) | ||
| 76 | + .setContactLastTime(now).setContactLastContent(followUpRecord.getContent()))); | ||
| 77 | + } | ||
| 78 | + // 3.2 需要更新 businessIds、contactIds 对应的记录 | ||
| 79 | + if (CollUtil.isNotEmpty(createReqVO.getBusinessIds())) { | ||
| 80 | + businessService.updateBusinessFollowUpBatch(convertList(createReqVO.getBusinessIds(), businessId -> | ||
| 81 | + new CrmUpdateFollowUpReqBO().setBizId(businessId).setContactNextTime(followUpRecord.getNextTime()) | ||
| 82 | + .setContactLastTime(now).setContactLastContent(followUpRecord.getContent()))); | ||
| 83 | + } | ||
| 34 | return followUpRecord.getId(); | 84 | return followUpRecord.getId(); |
| 35 | } | 85 | } |
| 36 | 86 | ||
| 37 | - @Override | ||
| 38 | - public void updateFollowUpRecord(CrmFollowUpRecordSaveReqVO updateReqVO) { | ||
| 39 | - // 校验存在 | ||
| 40 | - validateFollowUpRecordExists(updateReqVO.getId()); | ||
| 41 | - // 更新 | ||
| 42 | - CrmFollowUpRecordDO updateObj = BeanUtils.toBean(updateReqVO, CrmFollowUpRecordDO.class); | ||
| 43 | - crmFollowUpRecordMapper.updateById(updateObj); | 87 | + /** |
| 88 | + * 执行更新 | ||
| 89 | + * | ||
| 90 | + * @param followUpRecord 跟进记录 | ||
| 91 | + * @param now 跟进时间 | ||
| 92 | + */ | ||
| 93 | + private void updateBizTypeFollowUp(CrmFollowUpRecordDO followUpRecord, LocalDateTime now) { | ||
| 94 | + updateBusinessFollowUp(followUpRecord, now); | ||
| 95 | + updateClueFollowUp(followUpRecord, now); | ||
| 96 | + updateContactFollowUp(followUpRecord, now); | ||
| 97 | + updateContractFollowUp(followUpRecord, now); | ||
| 98 | + updateCustomerFollowUp(followUpRecord, now); | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + private void updateBusinessFollowUp(CrmFollowUpRecordDO followUpRecord, LocalDateTime now) { | ||
| 102 | + if (ObjUtil.notEqual(CrmBizTypeEnum.CRM_BUSINESS.getType(), followUpRecord.getBizType())) { | ||
| 103 | + return; | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + // 更新商机跟进信息 | ||
| 107 | + businessService.updateBusinessFollowUpBatch(Collections.singletonList(new CrmUpdateFollowUpReqBO() | ||
| 108 | + .setBizId(followUpRecord.getBizId()).setContactNextTime(followUpRecord.getNextTime()).setContactLastTime(now) | ||
| 109 | + .setContactLastContent(followUpRecord.getContent()))); | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + private void updateClueFollowUp(CrmFollowUpRecordDO followUpRecord, LocalDateTime now) { | ||
| 113 | + if (ObjUtil.notEqual(CrmBizTypeEnum.CRM_LEADS.getType(), followUpRecord.getBizType())) { | ||
| 114 | + return; | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + // 更新线索跟进信息 | ||
| 118 | + clueService.updateClueFollowUp(new CrmUpdateFollowUpReqBO().setBizId(followUpRecord.getBizId()).setContactLastTime(now) | ||
| 119 | + .setContactNextTime(followUpRecord.getNextTime()).setContactLastContent(followUpRecord.getContent())); | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + private void updateContactFollowUp(CrmFollowUpRecordDO followUpRecord, LocalDateTime now) { | ||
| 123 | + if (ObjUtil.notEqual(CrmBizTypeEnum.CRM_CONTACT.getType(), followUpRecord.getBizType())) { | ||
| 124 | + return; | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + // 更新联系人跟进信息 | ||
| 128 | + contactService.updateContactFollowUpBatch(Collections.singletonList(new CrmUpdateFollowUpReqBO() | ||
| 129 | + .setBizId(followUpRecord.getBizId()).setContactNextTime(followUpRecord.getNextTime()).setContactLastTime(now) | ||
| 130 | + .setContactLastContent(followUpRecord.getContent()))); | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + private void updateContractFollowUp(CrmFollowUpRecordDO followUpRecord, LocalDateTime now) { | ||
| 134 | + if (ObjUtil.notEqual(CrmBizTypeEnum.CRM_CONTRACT.getType(), followUpRecord.getBizType())) { | ||
| 135 | + return; | ||
| 136 | + } | ||
| 137 | + | ||
| 138 | + // 更新合同跟进信息 | ||
| 139 | + contractService.updateContractFollowUp(new CrmUpdateFollowUpReqBO().setBizId(followUpRecord.getBizId()).setContactLastTime(now) | ||
| 140 | + .setContactNextTime(followUpRecord.getNextTime()).setContactLastContent(followUpRecord.getContent())); | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + private void updateCustomerFollowUp(CrmFollowUpRecordDO followUpRecord, LocalDateTime now) { | ||
| 144 | + if (ObjUtil.notEqual(CrmBizTypeEnum.CRM_CUSTOMER.getType(), followUpRecord.getBizType())) { | ||
| 145 | + return; | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + // 更新客户跟进信息 | ||
| 149 | + customerService.updateCustomerFollowUp(new CrmUpdateFollowUpReqBO().setBizId(followUpRecord.getBizId()).setContactLastTime(now) | ||
| 150 | + .setContactNextTime(followUpRecord.getNextTime()).setContactLastContent(followUpRecord.getContent())); | ||
| 44 | } | 151 | } |
| 45 | 152 | ||
| 46 | @Override | 153 | @Override |
| 47 | - public void deleteFollowUpRecord(Long id) { | 154 | + public void deleteFollowUpRecord(Long id, Long userId) { |
| 48 | // 校验存在 | 155 | // 校验存在 |
| 49 | - validateFollowUpRecordExists(id); | 156 | + CrmFollowUpRecordDO followUpRecord = validateFollowUpRecordExists(id); |
| 157 | + // 校验权限 | ||
| 158 | + List<CrmPermissionDO> permissionList = permissionService.getPermissionListByBiz( | ||
| 159 | + followUpRecord.getBizType(), followUpRecord.getBizId()); | ||
| 160 | + boolean condition = anyMatch(permissionList, permission -> | ||
| 161 | + ObjUtil.equal(permission.getUserId(), userId) && ObjUtil.equal(permission.getLevel(), CrmPermissionLevelEnum.OWNER.getLevel())); | ||
| 162 | + if (!condition) { | ||
| 163 | + throw exception(FOLLOW_UP_RECORD_DELETE_DENIED); | ||
| 164 | + } | ||
| 165 | + | ||
| 50 | // 删除 | 166 | // 删除 |
| 51 | crmFollowUpRecordMapper.deleteById(id); | 167 | crmFollowUpRecordMapper.deleteById(id); |
| 52 | } | 168 | } |
| 53 | 169 | ||
| 54 | - private void validateFollowUpRecordExists(Long id) { | ||
| 55 | - if (crmFollowUpRecordMapper.selectById(id) == null) { | 170 | + private CrmFollowUpRecordDO validateFollowUpRecordExists(Long id) { |
| 171 | + CrmFollowUpRecordDO followUpRecord = crmFollowUpRecordMapper.selectById(id); | ||
| 172 | + if (followUpRecord == null) { | ||
| 56 | throw exception(FOLLOW_UP_RECORD_NOT_EXISTS); | 173 | throw exception(FOLLOW_UP_RECORD_NOT_EXISTS); |
| 57 | } | 174 | } |
| 175 | + return followUpRecord; | ||
| 58 | } | 176 | } |
| 59 | 177 | ||
| 60 | @Override | 178 | @Override |
| @@ -62,7 +180,9 @@ public class CrmFollowUpRecordServiceImpl implements CrmFollowUpRecordService { | @@ -62,7 +180,9 @@ public class CrmFollowUpRecordServiceImpl implements CrmFollowUpRecordService { | ||
| 62 | return crmFollowUpRecordMapper.selectById(id); | 180 | return crmFollowUpRecordMapper.selectById(id); |
| 63 | } | 181 | } |
| 64 | 182 | ||
| 183 | + | ||
| 65 | @Override | 184 | @Override |
| 185 | + @CrmPermission(bizTypeValue = "#pageReqVO.bizType", bizId = "#pageReqVO.bizId", level = CrmPermissionLevelEnum.READ) | ||
| 66 | public PageResult<CrmFollowUpRecordDO> getFollowUpRecordPage(CrmFollowUpRecordPageReqVO pageReqVO) { | 186 | public PageResult<CrmFollowUpRecordDO> getFollowUpRecordPage(CrmFollowUpRecordPageReqVO pageReqVO) { |
| 67 | return crmFollowUpRecordMapper.selectPage(pageReqVO); | 187 | return crmFollowUpRecordMapper.selectPage(pageReqVO); |
| 68 | } | 188 | } |
yudao-module-crm/yudao-module-crm-biz/src/main/java/cn/iocoder/yudao/module/crm/service/followup/bo/CrmUpdateFollowUpReqBO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.crm.service.followup.bo; | ||
| 2 | + | ||
| 3 | +import com.mzt.logapi.starter.annotation.DiffLogField; | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | +import jakarta.validation.constraints.NotNull; | ||
| 6 | +import lombok.Data; | ||
| 7 | + | ||
| 8 | +import java.time.LocalDateTime; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 跟进信息 Update Req BO | ||
| 12 | + * | ||
| 13 | + * @author HUIHUI | ||
| 14 | + */ | ||
| 15 | +@Data | ||
| 16 | +public class CrmUpdateFollowUpReqBO { | ||
| 17 | + | ||
| 18 | + @Schema(description = "数据编号", example = "3167") | ||
| 19 | + @NotNull(message = "数据编号不能为空") | ||
| 20 | + private Long bizId; | ||
| 21 | + | ||
| 22 | + @Schema(description = "最后跟进时间") | ||
| 23 | + @DiffLogField(name = "最后跟进时间") | ||
| 24 | + @NotNull(message = "最后跟进时间不能为空") | ||
| 25 | + private LocalDateTime contactLastTime; | ||
| 26 | + | ||
| 27 | + @Schema(description = "下次联系时间") | ||
| 28 | + @DiffLogField(name = "下次联系时间") | ||
| 29 | + private LocalDateTime contactNextTime; | ||
| 30 | + | ||
| 31 | + @Schema(description = "最后更进内容") | ||
| 32 | + @DiffLogField(name = "最后更进内容") | ||
| 33 | + @NotNull(message = "最后更进内容不能为空") | ||
| 34 | + private String contactLastContent; | ||
| 35 | + | ||
| 36 | +} |
yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/category/ProductCategoryServiceImplTest.java
| @@ -2,16 +2,15 @@ package cn.iocoder.yudao.module.product.service.category; | @@ -2,16 +2,15 @@ package cn.iocoder.yudao.module.product.service.category; | ||
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | 3 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 4 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | 4 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 5 | -import cn.iocoder.yudao.module.product.controller.admin.category.vo.ProductCategoryCreateReqVO; | ||
| 6 | import cn.iocoder.yudao.module.product.controller.admin.category.vo.ProductCategoryListReqVO; | 5 | import cn.iocoder.yudao.module.product.controller.admin.category.vo.ProductCategoryListReqVO; |
| 7 | import cn.iocoder.yudao.module.product.controller.admin.category.vo.ProductCategorySaveReqVO; | 6 | import cn.iocoder.yudao.module.product.controller.admin.category.vo.ProductCategorySaveReqVO; |
| 8 | import cn.iocoder.yudao.module.product.dal.dataobject.category.ProductCategoryDO; | 7 | import cn.iocoder.yudao.module.product.dal.dataobject.category.ProductCategoryDO; |
| 9 | import cn.iocoder.yudao.module.product.dal.mysql.category.ProductCategoryMapper; | 8 | import cn.iocoder.yudao.module.product.dal.mysql.category.ProductCategoryMapper; |
| 9 | +import jakarta.annotation.Resource; | ||
| 10 | import org.junit.jupiter.api.Disabled; | 10 | import org.junit.jupiter.api.Disabled; |
| 11 | import org.junit.jupiter.api.Test; | 11 | import org.junit.jupiter.api.Test; |
| 12 | import org.springframework.context.annotation.Import; | 12 | import org.springframework.context.annotation.Import; |
| 13 | 13 | ||
| 14 | -import jakarta.annotation.Resource; | ||
| 15 | import java.util.List; | 14 | import java.util.List; |
| 16 | 15 | ||
| 17 | import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; | 16 | import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; |
| @@ -21,7 +20,8 @@ import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId | @@ -21,7 +20,8 @@ import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId | ||
| 21 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; | 20 | import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; |
| 22 | import static cn.iocoder.yudao.module.product.dal.dataobject.category.ProductCategoryDO.PARENT_ID_NULL; | 21 | import static cn.iocoder.yudao.module.product.dal.dataobject.category.ProductCategoryDO.PARENT_ID_NULL; |
| 23 | import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.CATEGORY_NOT_EXISTS; | 22 | import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.CATEGORY_NOT_EXISTS; |
| 24 | -import static org.junit.jupiter.api.Assertions.*; | 23 | +import static org.junit.jupiter.api.Assertions.assertEquals; |
| 24 | +import static org.junit.jupiter.api.Assertions.assertNull; | ||
| 25 | 25 | ||
| 26 | /** | 26 | /** |
| 27 | * {@link ProductCategoryServiceImpl} 的单元测试类 | 27 | * {@link ProductCategoryServiceImpl} 的单元测试类 |
| @@ -41,22 +41,22 @@ public class ProductCategoryServiceImplTest extends BaseDbUnitTest { | @@ -41,22 +41,22 @@ public class ProductCategoryServiceImplTest extends BaseDbUnitTest { | ||
| 41 | @Test | 41 | @Test |
| 42 | public void testCreateCategory_success() { | 42 | public void testCreateCategory_success() { |
| 43 | // 准备参数 | 43 | // 准备参数 |
| 44 | - ProductCategoryCreateReqVO reqVO = randomPojo(ProductCategoryCreateReqVO.class); | 44 | + //ProductCategoryCreateReqVO reqVO = randomPojo(ProductCategoryCreateReqVO.class); |
| 45 | 45 | ||
| 46 | // mock 父类 | 46 | // mock 父类 |
| 47 | - ProductCategoryDO parentProductCategory = randomPojo(ProductCategoryDO.class, o -> { | ||
| 48 | - reqVO.setParentId(o.getId()); | ||
| 49 | - o.setParentId(PARENT_ID_NULL); | ||
| 50 | - }); | ||
| 51 | - productCategoryMapper.insert(parentProductCategory); | ||
| 52 | - | ||
| 53 | - // 调用 | ||
| 54 | - Long categoryId = productCategoryService.createCategory(reqVO); | ||
| 55 | - // 断言 | ||
| 56 | - assertNotNull(categoryId); | ||
| 57 | - // 校验记录的属性是否正确 | ||
| 58 | - ProductCategoryDO category = productCategoryMapper.selectById(categoryId); | ||
| 59 | - assertPojoEquals(reqVO, category); | 47 | + //ProductCategoryDO parentProductCategory = randomPojo(ProductCategoryDO.class, o -> { |
| 48 | + // reqVO.setParentId(o.getId()); | ||
| 49 | + // o.setParentId(PARENT_ID_NULL); | ||
| 50 | + //}); | ||
| 51 | + //productCategoryMapper.insert(parentProductCategory); | ||
| 52 | + // | ||
| 53 | + //// 调用 | ||
| 54 | + //Long categoryId = productCategoryService.createCategory(reqVO); | ||
| 55 | + //// 断言 | ||
| 56 | + //assertNotNull(categoryId); | ||
| 57 | + //// 校验记录的属性是否正确 | ||
| 58 | + //ProductCategoryDO category = productCategoryMapper.selectById(categoryId); | ||
| 59 | + //assertPojoEquals(reqVO, category); | ||
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | @Test | 62 | @Test |
yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/comment/ProductCommentServiceImplTest.java
| @@ -3,26 +3,25 @@ package cn.iocoder.yudao.module.product.service.comment; | @@ -3,26 +3,25 @@ package cn.iocoder.yudao.module.product.service.comment; | ||
| 3 | import cn.hutool.core.date.DateUtil; | 3 | import cn.hutool.core.date.DateUtil; |
| 4 | import cn.hutool.core.util.RandomUtil; | 4 | import cn.hutool.core.util.RandomUtil; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 6 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; | 7 | import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; |
| 7 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentPageReqVO; | 8 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentPageReqVO; |
| 8 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentReplyReqVO; | 9 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentReplyReqVO; |
| 9 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentRespVO; | 10 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentRespVO; |
| 10 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentUpdateVisibleReqVO; | 11 | import cn.iocoder.yudao.module.product.controller.admin.comment.vo.ProductCommentUpdateVisibleReqVO; |
| 11 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO; | 12 | import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentPageReqVO; |
| 12 | -import cn.iocoder.yudao.module.product.controller.app.comment.vo.AppCommentStatisticsRespVO; | ||
| 13 | -import cn.iocoder.yudao.module.product.convert.comment.ProductCommentConvert; | ||
| 14 | import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO; | 13 | import cn.iocoder.yudao.module.product.dal.dataobject.comment.ProductCommentDO; |
| 15 | import cn.iocoder.yudao.module.product.dal.mysql.comment.ProductCommentMapper; | 14 | import cn.iocoder.yudao.module.product.dal.mysql.comment.ProductCommentMapper; |
| 16 | import cn.iocoder.yudao.module.product.enums.comment.ProductCommentScoresEnum; | 15 | import cn.iocoder.yudao.module.product.enums.comment.ProductCommentScoresEnum; |
| 17 | import cn.iocoder.yudao.module.product.service.sku.ProductSkuService; | 16 | import cn.iocoder.yudao.module.product.service.sku.ProductSkuService; |
| 18 | import cn.iocoder.yudao.module.product.service.spu.ProductSpuService; | 17 | import cn.iocoder.yudao.module.product.service.spu.ProductSpuService; |
| 18 | +import jakarta.annotation.Resource; | ||
| 19 | import org.junit.jupiter.api.Disabled; | 19 | import org.junit.jupiter.api.Disabled; |
| 20 | import org.junit.jupiter.api.Test; | 20 | import org.junit.jupiter.api.Test; |
| 21 | import org.springframework.boot.test.mock.mockito.MockBean; | 21 | import org.springframework.boot.test.mock.mockito.MockBean; |
| 22 | import org.springframework.context.annotation.Import; | 22 | import org.springframework.context.annotation.Import; |
| 23 | import org.springframework.context.annotation.Lazy; | 23 | import org.springframework.context.annotation.Lazy; |
| 24 | 24 | ||
| 25 | -import jakarta.annotation.Resource; | ||
| 26 | import java.time.LocalDateTime; | 25 | import java.time.LocalDateTime; |
| 27 | import java.util.Date; | 26 | import java.util.Date; |
| 28 | 27 | ||
| @@ -129,7 +128,8 @@ public class ProductCommentServiceImplTest extends BaseDbUnitTest { | @@ -129,7 +128,8 @@ public class ProductCommentServiceImplTest extends BaseDbUnitTest { | ||
| 129 | productCommentPageReqVO.setReplyStatus(Boolean.TRUE); | 128 | productCommentPageReqVO.setReplyStatus(Boolean.TRUE); |
| 130 | 129 | ||
| 131 | PageResult<ProductCommentDO> commentPage = productCommentService.getCommentPage(productCommentPageReqVO); | 130 | PageResult<ProductCommentDO> commentPage = productCommentService.getCommentPage(productCommentPageReqVO); |
| 132 | - PageResult<ProductCommentRespVO> result = ProductCommentConvert.INSTANCE.convertPage(productCommentMapper.selectPage(productCommentPageReqVO)); | 131 | + PageResult<ProductCommentRespVO> result = BeanUtils.toBean(productCommentMapper.selectPage(productCommentPageReqVO), |
| 132 | + ProductCommentRespVO.class); | ||
| 133 | assertEquals(result.getTotal(), commentPage.getTotal()); | 133 | assertEquals(result.getTotal(), commentPage.getTotal()); |
| 134 | 134 | ||
| 135 | PageResult<ProductCommentDO> all = productCommentService.getCommentPage(new ProductCommentPageReqVO()); | 135 | PageResult<ProductCommentDO> all = productCommentService.getCommentPage(new ProductCommentPageReqVO()); |
| @@ -148,10 +148,10 @@ public class ProductCommentServiceImplTest extends BaseDbUnitTest { | @@ -148,10 +148,10 @@ public class ProductCommentServiceImplTest extends BaseDbUnitTest { | ||
| 148 | assertEquals(2, result3.getTotal()); | 148 | assertEquals(2, result3.getTotal()); |
| 149 | 149 | ||
| 150 | // 测试分页 tab count | 150 | // 测试分页 tab count |
| 151 | - AppCommentStatisticsRespVO tabsCount = productCommentService.getCommentStatistics(spuId, Boolean.TRUE); | ||
| 152 | - assertEquals(4, tabsCount.getGoodCount()); | ||
| 153 | - assertEquals(2, tabsCount.getMediocreCount()); | ||
| 154 | - assertEquals(0, tabsCount.getNegativeCount()); | 151 | + //AppCommentStatisticsRespVO tabsCount = productCommentService.getCommentStatistics(spuId, Boolean.TRUE); |
| 152 | + //assertEquals(4, tabsCount.getGoodCount()); | ||
| 153 | + //assertEquals(2, tabsCount.getMediocreCount()); | ||
| 154 | + //assertEquals(0, tabsCount.getNegativeCount()); | ||
| 155 | 155 | ||
| 156 | } | 156 | } |
| 157 | 157 |
yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/decorate/DecorateComponentEnum.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.enums.decorate; | ||
| 2 | - | ||
| 3 | -import lombok.AllArgsConstructor; | ||
| 4 | -import lombok.Getter; | ||
| 5 | - | ||
| 6 | -/** | ||
| 7 | - * 页面组件枚举 | ||
| 8 | - * | ||
| 9 | - * @author jason | ||
| 10 | - */ | ||
| 11 | -@Getter | ||
| 12 | -@AllArgsConstructor | ||
| 13 | -@SuppressWarnings("JavadocLinkAsPlainText") | ||
| 14 | -public enum DecorateComponentEnum { | ||
| 15 | - | ||
| 16 | - /** | ||
| 17 | - * 格式:[{ | ||
| 18 | - * "name": "标题" | ||
| 19 | - * "picUrl": "https://www.iocoder.cn/xxx.png", | ||
| 20 | - * "url": "/pages/users/index" | ||
| 21 | - * }] | ||
| 22 | - * | ||
| 23 | - * 最多 10 个 | ||
| 24 | - */ | ||
| 25 | - MENU("menu", "菜单"), | ||
| 26 | - /** | ||
| 27 | - * 格式:[{ | ||
| 28 | - * "name": "标题" | ||
| 29 | - * "url": "/pages/users/index" | ||
| 30 | - * }] | ||
| 31 | - */ | ||
| 32 | - ROLLING_NEWS("scrolling-news", "滚动新闻"), | ||
| 33 | - /** | ||
| 34 | - * 格式:[{ | ||
| 35 | - * "picUrl": "https://www.iocoder.cn/xxx.png", | ||
| 36 | - * "url": "/pages/users/index" | ||
| 37 | - * }] | ||
| 38 | - */ | ||
| 39 | - SLIDE_SHOW("slide-show", "轮播图"), | ||
| 40 | - /** | ||
| 41 | - * 格式:[{ | ||
| 42 | - * "name": "标题" | ||
| 43 | - * "type": "类型", // best、hot、new、benefit、good | ||
| 44 | - * "tag": "标签" // 例如说:多买多省 | ||
| 45 | - * }] | ||
| 46 | - * | ||
| 47 | - * 最多 4 个 | ||
| 48 | - */ | ||
| 49 | - PRODUCT_RECOMMEND("product-recommend", "商品推荐"); | ||
| 50 | - | ||
| 51 | - /** | ||
| 52 | - * 页面组件代码 | ||
| 53 | - */ | ||
| 54 | - private final String code; | ||
| 55 | - | ||
| 56 | - /** | ||
| 57 | - * 页面组件说明 | ||
| 58 | - */ | ||
| 59 | - private final String desc; | ||
| 60 | - | ||
| 61 | -} |
yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/decorate/DecoratePageEnum.java renamed to yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/diy/DiyPageEnum.java
| 1 | -package cn.iocoder.yudao.module.promotion.enums.decorate; | 1 | +package cn.iocoder.yudao.module.promotion.enums.diy; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.core.IntArrayValuable; | 3 | import cn.iocoder.yudao.framework.common.core.IntArrayValuable; |
| 4 | import lombok.AllArgsConstructor; | 4 | import lombok.AllArgsConstructor; |
| @@ -13,13 +13,13 @@ import java.util.Arrays; | @@ -13,13 +13,13 @@ import java.util.Arrays; | ||
| 13 | */ | 13 | */ |
| 14 | @AllArgsConstructor | 14 | @AllArgsConstructor |
| 15 | @Getter | 15 | @Getter |
| 16 | -public enum DecoratePageEnum implements IntArrayValuable { | 16 | +public enum DiyPageEnum implements IntArrayValuable { |
| 17 | 17 | ||
| 18 | INDEX(1, "首页"), | 18 | INDEX(1, "首页"), |
| 19 | MY(2, "我的"), | 19 | MY(2, "我的"), |
| 20 | ; | 20 | ; |
| 21 | 21 | ||
| 22 | - private static final int[] ARRAYS = Arrays.stream(values()).mapToInt(DecoratePageEnum::getPage).toArray(); | 22 | + private static final int[] ARRAYS = Arrays.stream(values()).mapToInt(DiyPageEnum::getPage).toArray(); |
| 23 | 23 | ||
| 24 | /** | 24 | /** |
| 25 | * 页面编号 | 25 | * 页面编号 |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/combination/CombinationRecordController.java
| @@ -43,7 +43,8 @@ public class CombinationRecordController { | @@ -43,7 +43,8 @@ public class CombinationRecordController { | ||
| 43 | @GetMapping("/page") | 43 | @GetMapping("/page") |
| 44 | @Operation(summary = "获得拼团记录分页") | 44 | @Operation(summary = "获得拼团记录分页") |
| 45 | @PreAuthorize("@ss.hasPermission('promotion:combination-record:query')") | 45 | @PreAuthorize("@ss.hasPermission('promotion:combination-record:query')") |
| 46 | - public CommonResult<PageResult<CombinationRecordPageItemRespVO>> getBargainRecordPage(@Valid CombinationRecordReqPageVO pageVO) { | 46 | + public CommonResult<PageResult<CombinationRecordPageItemRespVO>> getCombinationRecordPage( |
| 47 | + @Valid CombinationRecordReqPageVO pageVO) { | ||
| 47 | PageResult<CombinationRecordDO> recordPage = combinationRecordService.getCombinationRecordPage(pageVO); | 48 | PageResult<CombinationRecordDO> recordPage = combinationRecordService.getCombinationRecordPage(pageVO); |
| 48 | // 拼接数据 | 49 | // 拼接数据 |
| 49 | List<CombinationActivityDO> activities = combinationActivityService.getCombinationActivityListByIds( | 50 | List<CombinationActivityDO> activities = combinationActivityService.getCombinationActivityListByIds( |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/decorate/DecorateComponentController.http deleted
| 1 | -### /promotion/decorate/save 保存页面装修组件 | ||
| 2 | -POST {{baseUrl}}/promotion/decorate/save | ||
| 3 | -Content-Type: application/json | ||
| 4 | -Authorization: Bearer {{token}} | ||
| 5 | -tenant-id: {{adminTenentId}} | ||
| 6 | - | ||
| 7 | -{ | ||
| 8 | - "page": 1, | ||
| 9 | - "code": "slide-show", | ||
| 10 | - "status": 0, | ||
| 11 | - "value": "null" | ||
| 12 | -} | ||
| 13 | - | ||
| 14 | -### /promotion/decorate/list 获取指定页面的组件列表 | ||
| 15 | -GET {{baseUrl}}/promotion/decorate/list?page=1 | ||
| 16 | -Content-Type: application/json | ||
| 17 | -Authorization: Bearer {{token}} | ||
| 18 | -tenant-id: {{adminTenentId}} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/decorate/DecorateComponentController.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.controller.admin.decorate; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 4 | -import cn.iocoder.yudao.framework.common.validation.InEnum; | ||
| 5 | -import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentRespVO; | ||
| 6 | -import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentSaveReqVO; | ||
| 7 | -import cn.iocoder.yudao.module.promotion.convert.decorate.DecorateComponentConvert; | ||
| 8 | -import cn.iocoder.yudao.module.promotion.enums.decorate.DecoratePageEnum; | ||
| 9 | -import cn.iocoder.yudao.module.promotion.service.decorate.DecorateComponentService; | ||
| 10 | -import io.swagger.v3.oas.annotations.Operation; | ||
| 11 | -import io.swagger.v3.oas.annotations.Parameter; | ||
| 12 | -import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 13 | -import org.springframework.security.access.prepost.PreAuthorize; | ||
| 14 | -import org.springframework.validation.annotation.Validated; | ||
| 15 | -import org.springframework.web.bind.annotation.*; | ||
| 16 | - | ||
| 17 | -import jakarta.annotation.Resource; | ||
| 18 | -import jakarta.validation.Valid; | ||
| 19 | -import java.util.List; | ||
| 20 | - | ||
| 21 | -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 22 | - | ||
| 23 | -@Tag(name = "管理后台 - 店铺页面装修") | ||
| 24 | -@RestController | ||
| 25 | -@RequestMapping("/promotion/decorate") | ||
| 26 | -@Validated | ||
| 27 | -public class DecorateComponentController { | ||
| 28 | - | ||
| 29 | - @Resource | ||
| 30 | - private DecorateComponentService decorateComponentService; | ||
| 31 | - | ||
| 32 | - @PostMapping("/save") | ||
| 33 | - @Operation(summary = "保存页面装修组件") | ||
| 34 | - @PreAuthorize("@ss.hasPermission('promotion:decorate:save')") | ||
| 35 | - public CommonResult<Boolean> saveDecorateComponent(@Valid @RequestBody DecorateComponentSaveReqVO reqVO) { | ||
| 36 | - decorateComponentService.saveDecorateComponent(reqVO); | ||
| 37 | - return success(true); | ||
| 38 | - } | ||
| 39 | - | ||
| 40 | - @GetMapping("/list") | ||
| 41 | - @Operation(summary = "获取指定页面的组件列表") | ||
| 42 | - @Parameter(name = "page", description = "页面 id", required = true) | ||
| 43 | - @PreAuthorize("@ss.hasPermission('promotion:decorate:query')") | ||
| 44 | - public CommonResult<List<DecorateComponentRespVO>> getDecorateComponentListByPage( | ||
| 45 | - @RequestParam("page") @InEnum(DecoratePageEnum.class) Integer page) { | ||
| 46 | - return success(DecorateComponentConvert.INSTANCE.convertList02( | ||
| 47 | - decorateComponentService.getDecorateComponentListByPage(page, null))); | ||
| 48 | - } | ||
| 49 | - | ||
| 50 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/decorate/vo/DecorateComponentRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo; | ||
| 2 | - | ||
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | -import lombok.Data; | ||
| 5 | - | ||
| 6 | -@Schema(description = "管理后台 - 页面装修 Resp VO") | ||
| 7 | -@Data | ||
| 8 | -public class DecorateComponentRespVO { | ||
| 9 | - | ||
| 10 | - @Schema(description = "组件编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "nav-menu") | ||
| 11 | - private String code; | ||
| 12 | - | ||
| 13 | - @Schema(description = "组件的内容配置项", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "TODO") | ||
| 14 | - private String value; | ||
| 15 | - | ||
| 16 | - @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 17 | - private Integer status; | ||
| 18 | - | ||
| 19 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/decorate/vo/DecorateComponentSaveReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.framework.common.validation.InEnum; | ||
| 4 | -import cn.iocoder.yudao.module.promotion.enums.decorate.DecoratePageEnum; | ||
| 5 | -import io.swagger.v3.oas.annotations.media.Schema; | ||
| 6 | -import lombok.Data; | ||
| 7 | - | ||
| 8 | -import jakarta.validation.constraints.NotEmpty; | ||
| 9 | -import jakarta.validation.constraints.NotNull; | ||
| 10 | - | ||
| 11 | -@Schema(description = "管理后台 - 页面装修的保存 Request VO ") | ||
| 12 | -@Data | ||
| 13 | -public class DecorateComponentSaveReqVO { | ||
| 14 | - | ||
| 15 | - @Schema(description = "页面 id ", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 16 | - @NotNull(message = "页面 id 不能为空") | ||
| 17 | - @InEnum(DecoratePageEnum.class) | ||
| 18 | - private Integer page; | ||
| 19 | - | ||
| 20 | - @Schema(description = "组件编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "nav-menu") | ||
| 21 | - @NotEmpty(message = "组件编码不能为空") | ||
| 22 | - private String code; | ||
| 23 | - | ||
| 24 | - @Schema(description = "组件对应值, json 字符串, 含内容配置,具体数据", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 25 | - @NotEmpty(message = "组件值为空") | ||
| 26 | - private String value; | ||
| 27 | - | ||
| 28 | - @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 29 | - private Integer status; | ||
| 30 | - | ||
| 31 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/decorate/AppDecorateController.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.controller.app.decorate; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | ||
| 4 | -import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 5 | -import cn.iocoder.yudao.framework.common.validation.InEnum; | ||
| 6 | -import cn.iocoder.yudao.module.promotion.controller.app.decorate.vo.AppDecorateComponentRespVO; | ||
| 7 | -import cn.iocoder.yudao.module.promotion.convert.decorate.DecorateComponentConvert; | ||
| 8 | -import cn.iocoder.yudao.module.promotion.enums.decorate.DecoratePageEnum; | ||
| 9 | -import cn.iocoder.yudao.module.promotion.service.decorate.DecorateComponentService; | ||
| 10 | -import io.swagger.v3.oas.annotations.Operation; | ||
| 11 | -import io.swagger.v3.oas.annotations.Parameter; | ||
| 12 | -import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 13 | -import org.springframework.validation.annotation.Validated; | ||
| 14 | -import org.springframework.web.bind.annotation.GetMapping; | ||
| 15 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 16 | -import org.springframework.web.bind.annotation.RequestParam; | ||
| 17 | -import org.springframework.web.bind.annotation.RestController; | ||
| 18 | - | ||
| 19 | -import jakarta.annotation.Resource; | ||
| 20 | -import java.util.List; | ||
| 21 | - | ||
| 22 | -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 23 | - | ||
| 24 | -@Tag(name = "用户 APP - 店铺装修") | ||
| 25 | -@RestController | ||
| 26 | -@RequestMapping("/promotion/decorate") | ||
| 27 | -@Validated | ||
| 28 | -@Deprecated // 废弃 | ||
| 29 | -public class AppDecorateController { | ||
| 30 | - | ||
| 31 | - @Resource | ||
| 32 | - private DecorateComponentService decorateComponentService; | ||
| 33 | - | ||
| 34 | - @GetMapping("/list") | ||
| 35 | - @Operation(summary = "获取指定页面的组件列表") | ||
| 36 | - @Parameter(name = "page", description = "页面编号", required = true) | ||
| 37 | - public CommonResult<List<AppDecorateComponentRespVO>> getDecorateComponentListByPage( | ||
| 38 | - @RequestParam("page") @InEnum(DecoratePageEnum.class) Integer page) { | ||
| 39 | - return success(DecorateComponentConvert.INSTANCE.convertList( | ||
| 40 | - decorateComponentService.getDecorateComponentListByPage(page, CommonStatusEnum.ENABLE.getStatus()))); | ||
| 41 | - } | ||
| 42 | - | ||
| 43 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/decorate/vo/AppDecorateComponentRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.controller.app.decorate.vo; | ||
| 2 | - | ||
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | -import lombok.Data; | ||
| 5 | - | ||
| 6 | -@Schema(description = "用户 App - 页面组件 Resp VO") | ||
| 7 | -@Data | ||
| 8 | -public class AppDecorateComponentRespVO { | ||
| 9 | - | ||
| 10 | - @Schema(description = "组件编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "nav-menu") | ||
| 11 | - private String code; | ||
| 12 | - | ||
| 13 | - @Schema(description = "组件的内容配置项", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "TODO") | ||
| 14 | - private String value; | ||
| 15 | - | ||
| 16 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/diy/AppDiyTemplateController.java
| @@ -5,19 +5,19 @@ import cn.iocoder.yudao.module.promotion.controller.app.diy.vo.AppDiyTemplatePro | @@ -5,19 +5,19 @@ import cn.iocoder.yudao.module.promotion.controller.app.diy.vo.AppDiyTemplatePro | ||
| 5 | import cn.iocoder.yudao.module.promotion.convert.diy.DiyTemplateConvert; | 5 | import cn.iocoder.yudao.module.promotion.convert.diy.DiyTemplateConvert; |
| 6 | import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyPageDO; | 6 | import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyPageDO; |
| 7 | import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyTemplateDO; | 7 | import cn.iocoder.yudao.module.promotion.dal.dataobject.diy.DiyTemplateDO; |
| 8 | -import cn.iocoder.yudao.module.promotion.enums.decorate.DecoratePageEnum; | 8 | +import cn.iocoder.yudao.module.promotion.enums.diy.DiyPageEnum; |
| 9 | import cn.iocoder.yudao.module.promotion.service.diy.DiyPageService; | 9 | import cn.iocoder.yudao.module.promotion.service.diy.DiyPageService; |
| 10 | import cn.iocoder.yudao.module.promotion.service.diy.DiyTemplateService; | 10 | import cn.iocoder.yudao.module.promotion.service.diy.DiyTemplateService; |
| 11 | import io.swagger.v3.oas.annotations.Operation; | 11 | import io.swagger.v3.oas.annotations.Operation; |
| 12 | import io.swagger.v3.oas.annotations.Parameter; | 12 | import io.swagger.v3.oas.annotations.Parameter; |
| 13 | import io.swagger.v3.oas.annotations.tags.Tag; | 13 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 14 | +import jakarta.annotation.Resource; | ||
| 14 | import org.springframework.validation.annotation.Validated; | 15 | import org.springframework.validation.annotation.Validated; |
| 15 | import org.springframework.web.bind.annotation.GetMapping; | 16 | import org.springframework.web.bind.annotation.GetMapping; |
| 16 | import org.springframework.web.bind.annotation.RequestMapping; | 17 | import org.springframework.web.bind.annotation.RequestMapping; |
| 17 | import org.springframework.web.bind.annotation.RequestParam; | 18 | import org.springframework.web.bind.annotation.RequestParam; |
| 18 | import org.springframework.web.bind.annotation.RestController; | 19 | import org.springframework.web.bind.annotation.RestController; |
| 19 | 20 | ||
| 20 | -import jakarta.annotation.Resource; | ||
| 21 | import java.util.List; | 21 | import java.util.List; |
| 22 | 22 | ||
| 23 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 23 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| @@ -56,8 +56,8 @@ public class AppDiyTemplateController { | @@ -56,8 +56,8 @@ public class AppDiyTemplateController { | ||
| 56 | } | 56 | } |
| 57 | // 查询模板下的页面 | 57 | // 查询模板下的页面 |
| 58 | List<DiyPageDO> pages = diyPageService.getDiyPageByTemplateId(diyTemplate.getId()); | 58 | List<DiyPageDO> pages = diyPageService.getDiyPageByTemplateId(diyTemplate.getId()); |
| 59 | - String home = findFirst(pages, page -> DecoratePageEnum.INDEX.getName().equals(page.getName()), DiyPageDO::getProperty); | ||
| 60 | - String user = findFirst(pages, page -> DecoratePageEnum.MY.getName().equals(page.getName()), DiyPageDO::getProperty); | 59 | + String home = findFirst(pages, page -> DiyPageEnum.INDEX.getName().equals(page.getName()), DiyPageDO::getProperty); |
| 60 | + String user = findFirst(pages, page -> DiyPageEnum.MY.getName().equals(page.getName()), DiyPageDO::getProperty); | ||
| 61 | // 拼接返回 | 61 | // 拼接返回 |
| 62 | return DiyTemplateConvert.INSTANCE.convertPropertyVo2(diyTemplate, home, user); | 62 | return DiyTemplateConvert.INSTANCE.convertPropertyVo2(diyTemplate, home, user); |
| 63 | } | 63 | } |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/decorate/DecorateComponentConvert.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.convert.decorate; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentRespVO; | ||
| 4 | -import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentSaveReqVO; | ||
| 5 | -import cn.iocoder.yudao.module.promotion.controller.app.decorate.vo.AppDecorateComponentRespVO; | ||
| 6 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.decorate.DecorateComponentDO; | ||
| 7 | -import org.mapstruct.Mapper; | ||
| 8 | -import org.mapstruct.factory.Mappers; | ||
| 9 | - | ||
| 10 | -import java.util.List; | ||
| 11 | - | ||
| 12 | -@Mapper | ||
| 13 | -public interface DecorateComponentConvert { | ||
| 14 | - | ||
| 15 | - DecorateComponentConvert INSTANCE = Mappers.getMapper(DecorateComponentConvert.class); | ||
| 16 | - | ||
| 17 | - List<DecorateComponentRespVO> convertList02(List<DecorateComponentDO> list); | ||
| 18 | - | ||
| 19 | - DecorateComponentDO convert(DecorateComponentSaveReqVO bean); | ||
| 20 | - | ||
| 21 | - List<AppDecorateComponentRespVO> convertList(List<DecorateComponentDO> list); | ||
| 22 | - | ||
| 23 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/bargain/BargainRecordDO.java
| @@ -63,7 +63,7 @@ public class BargainRecordDO extends BaseDO { | @@ -63,7 +63,7 @@ public class BargainRecordDO extends BaseDO { | ||
| 63 | * | 63 | * |
| 64 | * 砍价成功的条件是:(2 选 1) | 64 | * 砍价成功的条件是:(2 选 1) |
| 65 | * 1. 砍价到 {@link BargainActivityDO#getBargainMinPrice()} 底价 | 65 | * 1. 砍价到 {@link BargainActivityDO#getBargainMinPrice()} 底价 |
| 66 | - * 2. 助力人数到达 {@link BargainActivityDO#getUserSize()} 人 | 66 | + * 2. 助力人数到达 {@link BargainActivityDO#getHelpMaxCount()} 人 |
| 67 | * | 67 | * |
| 68 | * 枚举 {@link BargainRecordStatusEnum} | 68 | * 枚举 {@link BargainRecordStatusEnum} |
| 69 | */ | 69 | */ |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/decorate/DecorateComponentDO.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.dataobject.decorate; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | ||
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 5 | -import cn.iocoder.yudao.module.promotion.enums.decorate.DecoratePageEnum; | ||
| 6 | -import cn.iocoder.yudao.module.promotion.enums.decorate.DecorateComponentEnum; | ||
| 7 | -import com.baomidou.mybatisplus.annotation.*; | ||
| 8 | - | ||
| 9 | -import lombok.Data; | ||
| 10 | - | ||
| 11 | -/** | ||
| 12 | - * 页面装修组件 DO, 一个页面由多个组件构成 | ||
| 13 | - * | ||
| 14 | - * @author jason | ||
| 15 | - */ | ||
| 16 | -@TableName(value ="promotion_decorate_component") | ||
| 17 | -@KeySequence("promotion_decorate_component_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | ||
| 18 | -@Data | ||
| 19 | -public class DecorateComponentDO extends BaseDO { | ||
| 20 | - | ||
| 21 | - /** | ||
| 22 | - * 编号 | ||
| 23 | - */ | ||
| 24 | - @TableId | ||
| 25 | - private Long id; | ||
| 26 | - | ||
| 27 | - /** | ||
| 28 | - * 所属页面 id | ||
| 29 | - * | ||
| 30 | - * 枚举 {@link DecoratePageEnum#getPage()} | ||
| 31 | - */ | ||
| 32 | - private Integer page; | ||
| 33 | - | ||
| 34 | - /** | ||
| 35 | - * 组件编码 | ||
| 36 | - * 枚举 {@link DecorateComponentEnum#getCode()} | ||
| 37 | - */ | ||
| 38 | - private String code; | ||
| 39 | - | ||
| 40 | - /** | ||
| 41 | - * 组件值:json 格式。包含配置和数据 | ||
| 42 | - */ | ||
| 43 | - private String value; | ||
| 44 | - | ||
| 45 | - /** | ||
| 46 | - * 状态 | ||
| 47 | - * | ||
| 48 | - * 枚举 {@link CommonStatusEnum} | ||
| 49 | - */ | ||
| 50 | - private Integer status; | ||
| 51 | - | ||
| 52 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/decorate/DecorateComponentMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.dal.mysql.decorate; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 5 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.decorate.DecorateComponentDO; | ||
| 6 | -import org.apache.ibatis.annotations.Mapper; | ||
| 7 | - | ||
| 8 | -import java.util.List; | ||
| 9 | - | ||
| 10 | -@Mapper | ||
| 11 | -public interface DecorateComponentMapper extends BaseMapperX<DecorateComponentDO> { | ||
| 12 | - | ||
| 13 | - default List<DecorateComponentDO> selectListByPageAndStatus(Integer page, Integer status) { | ||
| 14 | - return selectList(new LambdaQueryWrapperX<DecorateComponentDO>() | ||
| 15 | - .eq(DecorateComponentDO::getPage, page) | ||
| 16 | - .eqIfPresent(DecorateComponentDO::getStatus, status)); | ||
| 17 | - } | ||
| 18 | - | ||
| 19 | - default DecorateComponentDO selectByPageAndCode(Integer page, String code) { | ||
| 20 | - return selectOne(DecorateComponentDO::getPage, page, | ||
| 21 | - DecorateComponentDO::getCode, code); | ||
| 22 | - } | ||
| 23 | - | ||
| 24 | -} | ||
| 25 | - | ||
| 26 | - | ||
| 27 | - | ||
| 28 | - |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/decorate/DecorateComponentService.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.service.decorate; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentSaveReqVO; | ||
| 4 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.decorate.DecorateComponentDO; | ||
| 5 | -import cn.iocoder.yudao.module.promotion.enums.decorate.DecoratePageEnum; | ||
| 6 | - | ||
| 7 | -import java.util.List; | ||
| 8 | - | ||
| 9 | -/** | ||
| 10 | - * 装修组件 Service 接口 | ||
| 11 | - * | ||
| 12 | - * @author jason | ||
| 13 | - */ | ||
| 14 | -public interface DecorateComponentService { | ||
| 15 | - | ||
| 16 | - /** | ||
| 17 | - * 保存页面的组件信息 | ||
| 18 | - * | ||
| 19 | - * @param reqVO 请求 VO | ||
| 20 | - */ | ||
| 21 | - void saveDecorateComponent(DecorateComponentSaveReqVO reqVO); | ||
| 22 | - | ||
| 23 | - /** | ||
| 24 | - * 根据页面 id,获取页面的组件信息 | ||
| 25 | - * | ||
| 26 | - * @param page 页面编号 {@link DecoratePageEnum#getPage()} | ||
| 27 | - * @param status 状态 | ||
| 28 | - */ | ||
| 29 | - List<DecorateComponentDO> getDecorateComponentListByPage(Integer page, Integer status); | ||
| 30 | - | ||
| 31 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/decorate/DecorateComponentServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.service.decorate; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.module.promotion.controller.admin.decorate.vo.DecorateComponentSaveReqVO; | ||
| 4 | -import cn.iocoder.yudao.module.promotion.convert.decorate.DecorateComponentConvert; | ||
| 5 | -import cn.iocoder.yudao.module.promotion.dal.dataobject.decorate.DecorateComponentDO; | ||
| 6 | -import cn.iocoder.yudao.module.promotion.dal.mysql.decorate.DecorateComponentMapper; | ||
| 7 | -import org.springframework.stereotype.Service; | ||
| 8 | - | ||
| 9 | -import jakarta.annotation.Resource; | ||
| 10 | -import java.util.List; | ||
| 11 | - | ||
| 12 | -/** | ||
| 13 | - * 装修组件 Service 实现 | ||
| 14 | - * | ||
| 15 | - * @author jason | ||
| 16 | - */ | ||
| 17 | -@Service | ||
| 18 | -public class DecorateComponentServiceImpl implements DecorateComponentService { | ||
| 19 | - | ||
| 20 | - @Resource | ||
| 21 | - private DecorateComponentMapper decorateComponentMapper; | ||
| 22 | - | ||
| 23 | - @Override | ||
| 24 | - public void saveDecorateComponent(DecorateComponentSaveReqVO reqVO) { | ||
| 25 | - // 1. 如果存在,则进行更新 | ||
| 26 | - DecorateComponentDO dbComponent = decorateComponentMapper.selectByPageAndCode(reqVO.getPage(), reqVO.getCode()); | ||
| 27 | - if (dbComponent != null) { | ||
| 28 | - decorateComponentMapper.updateById(DecorateComponentConvert.INSTANCE.convert(reqVO).setId(dbComponent.getId())); | ||
| 29 | - return; | ||
| 30 | - } | ||
| 31 | - // 2. 不存在,则进行新增 | ||
| 32 | - decorateComponentMapper.insert(DecorateComponentConvert.INSTANCE.convert(reqVO)); | ||
| 33 | - } | ||
| 34 | - | ||
| 35 | - @Override | ||
| 36 | - public List<DecorateComponentDO> getDecorateComponentListByPage(Integer page, Integer status) { | ||
| 37 | - return decorateComponentMapper.selectListByPageAndStatus(page, status); | ||
| 38 | - } | ||
| 39 | - | ||
| 40 | -} |
yudao-module-mall/yudao-module-promotion-biz/src/test/java/cn/iocoder/yudao/module/promotion/service/decorate/DecorateComponentServiceImplTest.java deleted
| 1 | -package cn.iocoder.yudao.module.promotion.service.decorate; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest; | ||
| 4 | -import cn.iocoder.yudao.module.promotion.dal.mysql.decorate.DecorateComponentMapper; | ||
| 5 | -import org.junit.jupiter.api.BeforeEach; | ||
| 6 | -import org.mockito.InjectMocks; | ||
| 7 | -import org.mockito.Mock; | ||
| 8 | - | ||
| 9 | -// TODO @芋艿:后续 review 下 | ||
| 10 | -/** | ||
| 11 | - * @author jason | ||
| 12 | - */ | ||
| 13 | -public class DecorateComponentServiceImplTest extends BaseMockitoUnitTest { | ||
| 14 | - | ||
| 15 | - @InjectMocks | ||
| 16 | - private DecorateComponentServiceImpl decoratePageService; | ||
| 17 | - | ||
| 18 | - @Mock | ||
| 19 | - private DecorateComponentMapper decorateComponentMapper; | ||
| 20 | - | ||
| 21 | - @BeforeEach | ||
| 22 | - public void init(){ | ||
| 23 | - | ||
| 24 | - } | ||
| 25 | - | ||
| 26 | -// @Test | ||
| 27 | -// void testResp(){ | ||
| 28 | -// List<DecorateComponentDO> list = new ArrayList<>(1); | ||
| 29 | -// DecorateComponentDO decorateDO = new DecorateComponentDO() | ||
| 30 | -// .setPage(INDEX.getPage()).setValue("") | ||
| 31 | -// .setCode(ROLLING_NEWS.getCode()).setId(1L); | ||
| 32 | -// list.add(decorateDO); | ||
| 33 | -// //mock 方法 | ||
| 34 | -// Mockito.when(decorateComponentMapper.selectListByPageAndStatus(eq(1))).thenReturn(list); | ||
| 35 | -// } | ||
| 36 | -} |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/aftersale/AfterSaleServiceImpl.java
| @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.trade.service.aftersale; | @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.trade.service.aftersale; | ||
| 2 | 2 | ||
| 3 | import cn.hutool.core.map.MapUtil; | 3 | import cn.hutool.core.map.MapUtil; |
| 4 | import cn.hutool.core.util.ObjectUtil; | 4 | import cn.hutool.core.util.ObjectUtil; |
| 5 | +import cn.hutool.core.util.StrUtil; | ||
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageParam; | 6 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 7 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | 8 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; |
| @@ -368,7 +369,8 @@ public class AfterSaleServiceImpl implements AfterSaleService { | @@ -368,7 +369,8 @@ public class AfterSaleServiceImpl implements AfterSaleService { | ||
| 368 | @Override | 369 | @Override |
| 369 | public void afterCommit() { | 370 | public void afterCommit() { |
| 370 | // 创建退款单 | 371 | // 创建退款单 |
| 371 | - PayRefundCreateReqDTO createReqDTO = AfterSaleConvert.INSTANCE.convert(userIp, afterSale, tradeOrderProperties); | 372 | + PayRefundCreateReqDTO createReqDTO = AfterSaleConvert.INSTANCE.convert(userIp, afterSale, tradeOrderProperties) |
| 373 | + .setReason(StrUtil.format("退款【{}】", afterSale.getSpuName())); | ||
| 372 | Long payRefundId = payRefundApi.createRefund(createReqDTO); | 374 | Long payRefundId = payRefundApi.createRefund(createReqDTO); |
| 373 | // 更新售后单的退款单号 | 375 | // 更新售后单的退款单号 |
| 374 | tradeAfterSaleMapper.updateById(new AfterSaleDO().setId(afterSale.getId()).setPayRefundId(payRefundId)); | 376 | tradeAfterSaleMapper.updateById(new AfterSaleDO().setId(afterSale.getId()).setPayRefundId(payRefundId)); |
yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/group/MemberGroupService.java
| @@ -64,7 +64,6 @@ public interface MemberGroupService { | @@ -64,7 +64,6 @@ public interface MemberGroupService { | ||
| 64 | */ | 64 | */ |
| 65 | PageResult<MemberGroupDO> getGroupPage(MemberGroupPageReqVO pageReqVO); | 65 | PageResult<MemberGroupDO> getGroupPage(MemberGroupPageReqVO pageReqVO); |
| 66 | 66 | ||
| 67 | - | ||
| 68 | /** | 67 | /** |
| 69 | * 获得指定状态的用户分组列表 | 68 | * 获得指定状态的用户分组列表 |
| 70 | * | 69 | * |
| @@ -73,7 +72,6 @@ public interface MemberGroupService { | @@ -73,7 +72,6 @@ public interface MemberGroupService { | ||
| 73 | */ | 72 | */ |
| 74 | List<MemberGroupDO> getGroupListByStatus(Integer status); | 73 | List<MemberGroupDO> getGroupListByStatus(Integer status); |
| 75 | 74 | ||
| 76 | - | ||
| 77 | /** | 75 | /** |
| 78 | * 获得开启状态的用户分组列表 | 76 | * 获得开启状态的用户分组列表 |
| 79 | * | 77 | * |
yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointRecordService.java
| 1 | package cn.iocoder.yudao.module.member.service.point; | 1 | package cn.iocoder.yudao.module.member.service.point; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordPageReqVO; | 4 | import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordPageReqVO; |
| 6 | import cn.iocoder.yudao.module.member.controller.app.point.vo.AppMemberPointRecordPageReqVO; | 5 | import cn.iocoder.yudao.module.member.controller.app.point.vo.AppMemberPointRecordPageReqVO; |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/demo/PayDemoTransferDO.java
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/dal/dataobject/transfer/PayTransferDO.java
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/ip/AreaController.java
| @@ -2,11 +2,11 @@ package cn.iocoder.yudao.module.system.controller.admin.ip; | @@ -2,11 +2,11 @@ package cn.iocoder.yudao.module.system.controller.admin.ip; | ||
| 2 | 2 | ||
| 3 | import cn.hutool.core.lang.Assert; | 3 | import cn.hutool.core.lang.Assert; |
| 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 5 | import cn.iocoder.yudao.framework.ip.core.Area; | 6 | import cn.iocoder.yudao.framework.ip.core.Area; |
| 6 | import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; | 7 | import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils; |
| 7 | import cn.iocoder.yudao.framework.ip.core.utils.IPUtils; | 8 | import cn.iocoder.yudao.framework.ip.core.utils.IPUtils; |
| 8 | import cn.iocoder.yudao.module.system.controller.admin.ip.vo.AreaNodeRespVO; | 9 | import cn.iocoder.yudao.module.system.controller.admin.ip.vo.AreaNodeRespVO; |
| 9 | -import cn.iocoder.yudao.module.system.convert.ip.AreaConvert; | ||
| 10 | import io.swagger.v3.oas.annotations.Operation; | 10 | import io.swagger.v3.oas.annotations.Operation; |
| 11 | import io.swagger.v3.oas.annotations.Parameter; | 11 | import io.swagger.v3.oas.annotations.Parameter; |
| 12 | import io.swagger.v3.oas.annotations.tags.Tag; | 12 | import io.swagger.v3.oas.annotations.tags.Tag; |
| @@ -31,7 +31,7 @@ public class AreaController { | @@ -31,7 +31,7 @@ public class AreaController { | ||
| 31 | public CommonResult<List<AreaNodeRespVO>> getAreaTree() { | 31 | public CommonResult<List<AreaNodeRespVO>> getAreaTree() { |
| 32 | Area area = AreaUtils.getArea(Area.ID_CHINA); | 32 | Area area = AreaUtils.getArea(Area.ID_CHINA); |
| 33 | Assert.notNull(area, "获取不到中国"); | 33 | Assert.notNull(area, "获取不到中国"); |
| 34 | - return success(AreaConvert.INSTANCE.convertList(area.getChildren())); | 34 | + return success(BeanUtils.toBean(area.getChildren(), AreaNodeRespVO.class)); |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | @GetMapping("/get-by-ip") | 37 | @GetMapping("/get-by-ip") |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notice/vo/NoticeSaveReqVO.java
| @@ -11,8 +11,7 @@ import jakarta.validation.constraints.Size; | @@ -11,8 +11,7 @@ import jakarta.validation.constraints.Size; | ||
| 11 | @Data | 11 | @Data |
| 12 | public class NoticeSaveReqVO { | 12 | public class NoticeSaveReqVO { |
| 13 | 13 | ||
| 14 | - @Schema(description = "岗位公告编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 15 | - @NotNull(message = "岗位公告编号不能为空") | 14 | + @Schema(description = "岗位公告编号", example = "1024") |
| 16 | private Long id; | 15 | private Long id; |
| 17 | 16 | ||
| 18 | @Schema(description = "公告标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "小博主") | 17 | @Schema(description = "公告标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "小博主") |