| | |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3106, 1, 'èªè¡ç产', '1', 'mes_pro_work_order_type', 0, 'primary', '', '', '1', '2026-02-17 11:43:47', '1', '2026-02-17 11:43:47', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3107, 2, '代工', '2', 'mes_pro_work_order_type', 0, 'warning', '', '', '1', '2026-02-17 11:43:47', '1', '2026-02-17 11:43:47', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3108, 3, 'éè´', '3', 'mes_pro_work_order_type', 0, 'info', '', '', '1', '2026-02-17 11:43:47', '1', '2026-02-17 11:43:47', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3109, 3, 'è¿ç»´è®¡å', '3', 'mes_pro_work_order_source_type', 0, 'primary', '', '', '1', '2026-08-18 00:00:00', '1', '2026-08-18 00:00:00', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3110, 4, 'çµåè¿ç»´', '4', 'mes_pro_work_order_type', 0, 'primary', '', '', '1', '2026-08-18 00:00:00', '1', '2026-08-18 00:00:00', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3111, 5, 'åçµ', '5', 'mes_pro_work_order_type', 0, 'warning', '', '', '1', '2026-08-18 00:00:00', '1', '2026-08-18 00:00:00', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3112, 6, 'æ£ä¿®', '6', 'mes_pro_work_order_type', 0, 'info', '', '', '1', '2026-08-18 00:00:00', '1', '2026-08-18 00:00:00', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3121, 1, 'IQCï¼æ¥ææ£éªï¼', '1', 'mes_qc_type', 0, 'primary', '', 'æ¥æè´¨éæ£éª', '1', '2026-02-18 14:12:05', '1', '2026-02-18 14:12:05', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3122, 2, 'IPQCï¼è¿ç¨æ£éªï¼', '2', 'mes_qc_type', 0, 'warning', '', 'ç产å¶ç¨è´¨éæ£éª', '1', '2026-02-18 14:12:05', '1', '2026-03-24 15:21:34', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3123, 3, 'OQCï¼åºè´§æ£éªï¼', '3', 'mes_qc_type', 0, 'success', '', 'åºè´§è´¨éæ£éª', '1', '2026-02-18 14:12:05', '1', '2026-02-18 14:12:05', b'0'); |
| | |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3224, 3, 'å¾
æ§è¡é¢åº', '3', 'mes_wm_product_issue_status', 0, 'primary', '', '已审æ¹ï¼æ£è´§å®æ', '1', '2026-02-26 16:39:12', '1', '2026-03-23 13:18:02', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3225, 4, '已宿', '4', 'mes_wm_product_issue_status', 0, 'success', '', '已宿åºåº', '1', '2026-02-26 16:39:12', '1', '2026-03-23 13:18:02', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3226, 5, '已忶', '5', 'mes_wm_product_issue_status', 0, 'success', '', '已宿åºåº', '1', '2026-02-26 16:39:12', '1', '2026-03-23 13:18:02', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1061137, 1, 'æ£å¸¸é¢æ', '1', 'mes_wm_product_issue_type', 0, 'primary', '', 'æ£å¸¸çäº§é¢æ', '1', '2026-08-18 00:00:00', '1', '2026-08-18 00:00:00', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1061138, 2, 'ç´§æ¥è¡¥æ', '2', 'mes_wm_product_issue_type', 0, 'warning', '', 'ç产ç°åºç´§æ¥è¡¥æ', '1', '2026-08-18 00:00:00', '1', '2026-08-18 00:00:00', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3232, 1, 'è稿', '0', 'mes_wm_return_issue_status', 0, 'info', '', 'èç¨¿ç¶æï¼å¯ç¼è¾', '1', '2026-02-28 14:11:12', '1', '2026-02-28 14:28:24', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3233, 2, 'å¾
æ£éª', '1', 'mes_wm_return_issue_status', 0, 'default', '', '已确认ï¼çå¾
è´¨æ£', '1', '2026-02-28 14:11:12', '1', '2026-02-28 14:28:28', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3234, 3, 'å¾
䏿¶', '2', 'mes_wm_return_issue_status', 0, 'warning', '', 'æ£éªå®æï¼çå¾
ä»åºä¸æ¶', '1', '2026-02-28 14:11:12', '1', '2026-02-28 14:28:31', b'0'); |
| | |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3277, 1, 'åºåè°æ´', '1', 'mes_wm_misc_receipt_type', 0, 'primary', '', 'åºåè°æ´å
¥åº', '1', '2026-03-03 07:34:33', '1', '2026-03-03 07:34:33', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3278, 1, 'åºåè°æ´', '1', 'mes_wm_misc_issue_type', 0, 'primary', '', 'åºåè°æ´åºåº', '1', '2026-03-03 07:34:33', '1', '2026-03-03 07:34:33', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3279, 2, 'æ¥åºåºåº', '2', 'mes_wm_misc_issue_type', 0, 'danger', '', 'æ¥åºåºåº', '1', '2026-03-03 07:36:13', '1', '2026-03-03 07:36:13', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1061144, 3, 'åºæ§ç©èµåºåº', '3', 'mes_wm_misc_issue_type', 0, 'warning', '', 'åºæ§ç©èµåºåº', '1', '2026-08-18 00:00:00', '1', '2026-08-18 00:00:00', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1061145, 4, '设å¤åºåº', '4', 'mes_wm_misc_issue_type', 0, 'primary', '', 'çµå设å¤åºåº', '1', '2026-08-18 00:00:00', '1', '2026-08-18 00:00:00', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1061146, 2, '设å¤å
¥åº', '2', 'mes_wm_misc_receipt_type', 0, 'primary', '', 'çµå设å¤å
¥åº', '1', '2026-08-18 00:00:00', '1', '2026-08-18 00:00:00', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1061147, 3, 'åºæ§ç©èµå
¥åº', '3', 'mes_wm_misc_receipt_type', 0, 'warning', '', 'åºæ§ç©èµå
¥åº', '1', '2026-08-18 00:00:00', '1', '2026-08-18 00:00:00', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1061148, 1, 'æ®éä»åº', '1', 'mes_wm_warehouse_type', 0, 'default', '', 'éç¨ç©èµä»åº', '1', '2026-08-18 00:00:00', '1', '2026-08-18 00:00:00', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1061149, 2, '设å¤ä»', '2', 'mes_wm_warehouse_type', 0, 'primary', '', 'çµå设å¤ä»å¨', '1', '2026-08-18 00:00:00', '1', '2026-08-18 00:00:00', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1061150, 3, 'å¤ä»¶ä»', '3', 'mes_wm_warehouse_type', 0, 'warning', '', 'å¤åå¤ä»¶ä»å¨', '1', '2026-08-18 00:00:00', '1', '2026-08-18 00:00:00', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1061151, 4, 'èæä»', '4', 'mes_wm_warehouse_type', 0, 'info', '', 'æ¥å¸¸èæä»å¨', '1', '2026-08-18 00:00:00', '1', '2026-08-18 00:00:00', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1061152, 5, 'å±ååä»', '5', 'mes_wm_warehouse_type', 0, 'danger', '', 'å±é©åå¦åä¸ç¨ä»å¨', '1', '2026-08-18 00:00:00', '1', '2026-08-18 00:00:00', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3280, 1, 'è稿', '0', 'mes_wm_outsource_receipt_status', 0, 'info', '', 'èç¨¿ç¶æ', '1', '2026-03-03 14:03:57', '1', '2026-03-03 14:03:57', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3281, 2, 'å¾
æ£éª', '1', 'mes_wm_outsource_receipt_status', 0, 'warning', '', '已确认ï¼çå¾
è´¨æ£', '1', '2026-03-03 14:03:57', '1', '2026-03-03 14:03:57', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3282, 3, 'å¾
䏿¶', '2', 'mes_wm_outsource_receipt_status', 0, 'primary', '', 'æ£éªå®æï¼çå¾
ä»åºä¸æ¶', '1', '2026-03-03 14:03:57', '1', '2026-03-03 14:03:57', b'0'); |
| | |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3380, 6, 'è´¨éç¶æ', '900', 'mes_wm_stock_taking_plan_param_type', 0, 'default', '', 'æè´¨éç¶æçç¹', '1', '2026-03-09 00:00:00', '1', '2026-03-09 00:00:00', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3381, 1, 'ç©æ', 'ITEM', 'mes_md_item_or_product', 0, 'info', '', '', '1', '2026-03-15 01:55:06', '1', '2026-03-15 01:55:06', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3382, 2, '产å', 'PRODUCT', 'mes_md_item_or_product', 0, 'success', '', '', '1', '2026-03-15 01:55:06', '1', '2026-03-15 01:55:06', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1061139, 1, 'çµå设å¤', '1', 'mes_material_category', 0, 'primary', '', 'ååå¨ãå¼å
³æãè¾çµçº¿è·¯ãåçµæºç»ãå¨è½è®¾å¤ç', '1', '2026-08-18 00:00:00', '1', '2026-08-18 00:00:00', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1061140, 2, 'å¤åå¤ä»¶', '2', 'mes_material_category', 0, 'warning', '', 'çµå设å¤ç»´ä¿®æ´æ¢ç¨å¤åå¤ä»¶', '1', '2026-08-18 00:00:00', '1', '2026-08-18 00:00:00', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1061141, 3, 'èæ', '3', 'mes_material_category', 0, 'info', '', 'æ¥å¸¸è¿ç»´æ¶èæ§ææ', '1', '2026-08-18 00:00:00', '1', '2026-08-18 00:00:00', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1061142, 4, 'å·¥ç¨ææ', '4', 'mes_material_category', 0, 'success', '', 'çµåå·¥ç¨å»ºè®¾ç¨ææ', '1', '2026-08-18 00:00:00', '1', '2026-08-18 00:00:00', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1061143, 5, 'å®é²ç©èµ', '5', 'mes_material_category', 0, 'danger', '', 'å®å
¨çäº§é²æ¤ç©èµ', '1', '2026-08-18 00:00:00', '1', '2026-08-18 00:00:00', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3383, 1, 'è稿', '0', 'mes_wm_item_consume_status', 0, 'info', '', 'èç¨¿ç¶æ', '1', '2026-03-19 15:06:23', '1', '2026-03-19 15:06:23', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3384, 2, '已宿', '4', 'mes_wm_item_consume_status', 0, 'success', '', '已宿', '1', '2026-03-19 15:06:23', '1', '2026-03-19 15:06:23', b'0'); |
| | | INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (3385, 1, 'å°è´§éç¥å', '100', 'mes_qc_source_doc_type', 0, 'primary', '', 'IQC', '1', '2026-03-26 13:01:09', '1', '2026-03-26 13:01:09', b'0'); |
| | |
| | | INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (2067, 'MES éè´å
¥åºåç¶æ', 'mes_wm_item_receipt_status', 0, 'MES éè´å
¥åºåç¶æ', '1', '2026-02-22 14:54:05', '1', '2026-02-22 14:54:05', b'0', NULL); |
| | | INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (2068, 'MES åæ®ç¶æ', 'mes_order_status', 0, '', '1', '2026-02-23 21:16:03', '1', '2026-02-23 21:17:37', b'0', NULL); |
| | | INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (2069, 'MES 颿åºåºåç¶æ', 'mes_wm_product_issue_status', 0, 'MES 颿åºåºåç¶æ', '1', '2026-02-26 16:39:44', '1', '2026-04-05 15:05:11', b'0', NULL); |
| | | INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (1061099, 'MES çäº§é¢æåæ®ç±»å', 'mes_wm_product_issue_type', 0, 'MES çäº§é¢æåæ®ç±»åï¼1=æ£å¸¸é¢æï¼2=ç´§æ¥è¡¥æï¼', '1', '2026-08-18 00:00:00', '1', '2026-08-18 00:00:00', b'0', NULL); |
| | | INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (2073, 'MES ç产éæåç¶æ', 'mes_wm_return_issue_status', 0, 'MES ç产éæåç¶æ', '1', '2026-02-28 14:11:09', '1', '2026-04-05 15:05:14', b'0', NULL); |
| | | INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (2074, 'MES ç产éæç±»å', 'mes_wm_return_issue_type', 0, 'MES ç产éæç±»å', '1', '2026-02-28 14:11:09', '1', '2026-04-05 15:05:16', b'0', NULL); |
| | | INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (2075, 'MES è´¨éç¶æ', 'mes_wm_quality_status', 0, 'MES è´¨éç¶æï¼å¾
æ£/åæ ¼/ä¸åæ ¼ï¼', '1', '2026-02-28 15:00:53', '1', '2026-02-28 15:00:53', b'0', NULL); |
| | |
| | | INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (2105, 'MES æé¡¹å
¥åºç±»å', 'mes_wm_misc_receipt_type', 0, 'æé¡¹å
¥åºç±»å', '1', '2026-03-03 07:18:12', '1', '2026-04-05 15:05:23', b'0', NULL); |
| | | INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (2106, 'MES æé¡¹å
¥åºç¶æ', 'mes_wm_misc_receipt_status', 0, 'æé¡¹å
¥åºç¶æ', '1', '2026-03-03 07:18:12', '1', '2026-04-05 15:05:25', b'0', NULL); |
| | | INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (2109, 'MES æé¡¹åºåºç±»å', 'mes_wm_misc_issue_type', 0, 'MES æé¡¹åºåºç±»å', '1', '2026-03-03 07:34:33', '1', '2026-03-03 07:34:33', b'0', NULL); |
| | | INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (1061101, 'MES ä»åº/åºåºç±»å', 'mes_wm_warehouse_type', 0, 'MES ä»åº/åºåºç±»åï¼1=æ®éä»åºï¼2=设å¤ä»ï¼3=å¤ä»¶ä»ï¼4=èæä»ï¼5=å±ååä»ï¼', '1', '2026-08-18 00:00:00', '1', '2026-08-18 00:00:00', b'0', NULL); |
| | | INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (2110, 'MES å¤åå
¥åºåç¶æ', 'mes_wm_outsource_receipt_status', 0, 'MES å¤åå
¥åºåç¶æ', '1', '2026-03-03 14:03:20', '1', '2026-03-03 14:03:20', b'0', NULL); |
| | | INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (2112, 'MES å¤ååæåç¶æ', 'mes_wm_outsource_issue_status', 0, 'MES å¤ååæåç¶æ', '1', '2026-03-03 16:30:56', '1', '2026-04-05 15:05:47', b'0', NULL); |
| | | INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (2113, 'MES ç¼ç è§ååæ®µç±»å', 'mes_md_auto_code_part_type', 0, 'MES ç¼ç è§ååæ®µç±»å', '1', '2026-03-04 14:45:46', '1', '2026-03-04 15:24:40', b'0', NULL); |
| | |
| | | INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (2126, 'MES çç¹ä»»å¡ç¶æ', 'mes_wm_stock_taking_task_status', 0, 'MES çç¹ä»»å¡ç¶æ', '1', '2026-03-09 00:00:00', '1', '2026-03-09 00:00:00', b'0', NULL); |
| | | INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (2127, 'MES çç¹ä»»å¡è¡ç¶æ', 'mes_wm_stock_taking_task_line_status', 0, 'MES çç¹ä»»å¡è¡ç¶æ', '1', '2026-03-09 00:00:00', '1', '2026-04-05 15:02:18', b'0', NULL); |
| | | INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (2129, 'MES ç©æäº§åæ è¯', 'mes_md_item_or_product', 0, 'ç©æåç±»ï¼ç©æ(ITEM) / 产å(PRODUCT)', '1', '2026-03-15 01:55:06', '1', '2026-03-15 01:55:06', b'0', NULL); |
| | | INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (1061100, 'MES çµåç©èµåç±»', 'mes_material_category', 0, 'çµåç©èµåç±»ï¼1=çµå设å¤ï¼2=å¤åå¤ä»¶ï¼3=èæï¼4=å·¥ç¨ææï¼5=å®é²ç©èµï¼', '1', '2026-08-18 00:00:00', '1', '2026-08-18 00:00:00', b'0', NULL); |
| | | INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (2130, 'MES ä¾åºåéè´§åç¶æ', 'mes_wm_return_vendor_status', 0, 'éè´éè´§åç¶æ', '', '2026-03-29 13:49:57', '', '2026-04-05 15:53:46', b'0', NULL); |
| | | INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (2131, 'MES åè´§éç¥åç¶æ', 'mes_wm_sales_notice_status', 0, 'MES åè´§éç¥åç¶æ', '1', '2026-03-30 08:54:30', '1', '2026-04-05 15:53:46', b'0', NULL); |
| | | INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (2132, 'MES æé¡¹åºåºåç¶æ', 'mes_wm_misc_issue_status', 0, 'æé¡¹åºåºåç¶æ', '1', '2026-03-30 15:00:18', '1', '2026-04-05 15:05:41', b'0', NULL); |
| | |
| | | UNCLASSIFIED(0, "æªå¤å®"), |
| | | GENERAL(1, "ä¸è¬é®é¢"), |
| | | REPAIR(2, "ç»´ä¿®é®é¢"), |
| | | RETURN(3, "éè´§é®é¢"); |
| | | RETURN(3, "éè´§é®é¢"), |
| | | POWER_OUTAGE_REPAIR(4, "åçµæ¥ä¿®"), |
| | | POWER_FAULT(5, "ç¨çµæ
é"), |
| | | SERVICE_COMPLAINT(6, "æå¡æè¯"), |
| | | POWER_QUALITY_DISPUTE(7, "ä¾çµè´¨éå¼è®®"); |
| | | |
| | | public static final Integer[] ARRAYS = Arrays.stream(values()) |
| | | .map(AfterSaleIssueTypeEnum::getType).toArray(Integer[]::new); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.controller.admin.decision; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.bi.controller.admin.decision.vo.DecisionAlertPageReqVO; |
| | | import cn.iocoder.yudao.module.bi.controller.admin.decision.vo.DecisionAlertRespVO; |
| | | import cn.iocoder.yudao.module.bi.dal.dataobject.decision.BiAlertRecordDO; |
| | | import cn.iocoder.yudao.module.bi.service.decision.BiAlertRecordService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | |
| | | @Tag(name = "管çåå° - å³çæ¯æ é¢è¦ä¸å¿") |
| | | @RestController |
| | | @RequestMapping("/bi/decision/alert") |
| | | @Validated |
| | | public class DecisionAlertController { |
| | | |
| | | @Resource |
| | | private BiAlertRecordService alertRecordService; |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "è·åé¢è¦è®°å½å页") |
| | | @PreAuthorize("@ss.hasPermission('bi:decision:alert:query')") |
| | | public CommonResult<PageResult<BiAlertRecordDO>> getAlertPage(@Valid DecisionAlertPageReqVO reqVO) { |
| | | return success(alertRecordService.getRecordPage(reqVO)); |
| | | } |
| | | |
| | | @GetMapping("/unprocessed-count") |
| | | @Operation(summary = "è·åæªå¤çé¢è¦æ°é") |
| | | @PreAuthorize("@ss.hasPermission('bi:decision:alert:query')") |
| | | public CommonResult<Long> getUnprocessedCount() { |
| | | return success(alertRecordService.getUnprocessedCount()); |
| | | } |
| | | |
| | | @PostMapping("/confirm/{id}") |
| | | @Operation(summary = "确认é¢è¦") |
| | | @PreAuthorize("@ss.hasPermission('bi:decision:alert:confirm')") |
| | | public CommonResult<Boolean> confirmAlert(@PathVariable("id") Long id) { |
| | | alertRecordService.confirmRecord(id, 1L); |
| | | return success(true); |
| | | } |
| | | |
| | | @PostMapping("/handle") |
| | | @Operation(summary = "å¤çé¢è¦") |
| | | @PreAuthorize("@ss.hasPermission('bi:decision:alert:handle')") |
| | | public CommonResult<Boolean> handleAlert(@RequestParam("id") Long id, |
| | | @RequestParam(value = "handleRemark", required = false) String handleRemark) { |
| | | alertRecordService.handleRecord(id, 1L, handleRemark); |
| | | return success(true); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.controller.admin.decision; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.bi.controller.admin.decision.vo.DecisionAlertRulePageReqVO; |
| | | import cn.iocoder.yudao.module.bi.dal.dataobject.decision.BiAlertRuleDO; |
| | | import cn.iocoder.yudao.module.bi.service.decision.BiAlertRuleService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | |
| | | @Tag(name = "管çåå° - å³çæ¯æ é¢è¦è§å") |
| | | @RestController |
| | | @RequestMapping("/bi/decision/alert-rule") |
| | | @Validated |
| | | public class DecisionAlertRuleController { |
| | | |
| | | @Resource |
| | | private BiAlertRuleService alertRuleService; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "å建é¢è¦è§å") |
| | | @PreAuthorize("@ss.hasPermission('bi:decision:alert-rule:create')") |
| | | public CommonResult<Long> createRule(@Valid @RequestBody BiAlertRuleDO rule) { |
| | | return success(alertRuleService.createRule(rule)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "æ´æ°é¢è¦è§å") |
| | | @PreAuthorize("@ss.hasPermission('bi:decision:alert-rule:update')") |
| | | public CommonResult<Boolean> updateRule(@Valid @RequestBody BiAlertRuleDO rule) { |
| | | alertRuleService.updateRule(rule); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤é¢è¦è§å") |
| | | @PreAuthorize("@ss.hasPermission('bi:decision:alert-rule:delete')") |
| | | public CommonResult<Boolean> deleteRule(@RequestParam("id") Long id) { |
| | | alertRuleService.deleteRule(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "è·åé¢è¦è§å") |
| | | @PreAuthorize("@ss.hasPermission('bi:decision:alert-rule:query')") |
| | | public CommonResult<BiAlertRuleDO> getRule(@RequestParam("id") Long id) { |
| | | return success(alertRuleService.getRule(id)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "è·åé¢è¦è§åå页") |
| | | @PreAuthorize("@ss.hasPermission('bi:decision:alert-rule:query')") |
| | | public CommonResult<PageResult<BiAlertRuleDO>> getRulePage(@Valid DecisionAlertRulePageReqVO pageReq) { |
| | | return success(alertRuleService.getRulePage(pageReq)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.controller.admin.decision; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.bi.controller.admin.decision.vo.DecisionForecastReqVO; |
| | | import cn.iocoder.yudao.module.bi.controller.admin.decision.vo.DecisionForecastRespVO; |
| | | import cn.iocoder.yudao.module.bi.dal.dataobject.decision.BiForecastDataDO; |
| | | import cn.iocoder.yudao.module.bi.service.decision.BiForecastService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | |
| | | @Tag(name = "管çåå° - å³çæ¯æ è´è·é¢æµ") |
| | | @RestController |
| | | @RequestMapping("/bi/decision/forecast") |
| | | @Validated |
| | | public class DecisionForecastController { |
| | | |
| | | @Resource |
| | | private BiForecastService forecastService; |
| | | |
| | | @GetMapping("/list") |
| | | @Operation(summary = "è·å颿µæ°æ®") |
| | | @PreAuthorize("@ss.hasPermission('bi:decision:kpi:query')") |
| | | public CommonResult<List<BiForecastDataDO>> getForecastList(@Valid DecisionForecastReqVO reqVO) { |
| | | // é»è®¤æ¥æè¿30天 |
| | | LocalDateTime endTime = LocalDateTime.now(); |
| | | LocalDateTime beginTime = endTime.minusDays(30); |
| | | return success(forecastService.getForecastList(reqVO.getForecastCode(), beginTime, endTime)); |
| | | } |
| | | |
| | | @PostMapping("/generate") |
| | | @Operation(summary = "çæé¢æµï¼å ä½ï¼") |
| | | @PreAuthorize("@ss.hasPermission('bi:decision:kpi:query')") |
| | | public CommonResult<Boolean> generateForecast(@RequestParam("forecastCode") String forecastCode) { |
| | | forecastService.generateForecast(forecastCode, LocalDateTime.now()); |
| | | return success(true); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.controller.admin.decision; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.module.bi.controller.admin.decision.vo.*; |
| | | import cn.iocoder.yudao.module.bi.service.decision.BiDecisionKpiService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Map; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | |
| | | @Tag(name = "管çåå° - å³çæ¯æ KPI") |
| | | @RestController |
| | | @RequestMapping("/bi/decision/kpi") |
| | | @Validated |
| | | public class DecisionKpiController { |
| | | |
| | | @Resource |
| | | private BiDecisionKpiService decisionKpiService; |
| | | |
| | | @GetMapping("/overview") |
| | | @Operation(summary = "è·åKPIæ¦è§") |
| | | @PreAuthorize("@ss.hasPermission('bi:decision:kpi:query')") |
| | | public CommonResult<Map<String, Object>> getKpiOverview() { |
| | | return success(decisionKpiService.getKpiOverview()); |
| | | } |
| | | |
| | | @GetMapping("/detail/{kpiCode}") |
| | | @Operation(summary = "è·åKPI详æ
") |
| | | @PreAuthorize("@ss.hasPermission('bi:decision:kpi:query')") |
| | | public CommonResult<Map<String, Object>> getKpiDetail(@PathVariable("kpiCode") String kpiCode) { |
| | | return success(decisionKpiService.getKpiDetail(kpiCode)); |
| | | } |
| | | |
| | | @GetMapping("/category/{category}") |
| | | @Operation(summary = "æåç±»è·åKPI") |
| | | @PreAuthorize("@ss.hasPermission('bi:decision:kpi:query')") |
| | | public CommonResult<Map<String, Object>> getKpiByCategory(@PathVariable("category") String category) { |
| | | return success(decisionKpiService.getKpiByCategory(category)); |
| | | } |
| | | |
| | | @PostMapping("/refresh/{kpiCode}") |
| | | @Operation(summary = "å·æ°KPIå¼") |
| | | @PreAuthorize("@ss.hasPermission('bi:decision:kpi:query')") |
| | | public CommonResult<BigDecimal> refreshKpi(@PathVariable("kpiCode") String kpiCode) { |
| | | return success(decisionKpiService.refreshKpi(kpiCode)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.controller.admin.decision; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.bi.controller.admin.decision.vo.DecisionKpiDefinitionPageReqVO; |
| | | import cn.iocoder.yudao.module.bi.dal.dataobject.decision.BiKpiDefinitionDO; |
| | | import cn.iocoder.yudao.module.bi.service.decision.BiKpiDefinitionService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | |
| | | @Tag(name = "管çåå° - å³çæ¯æ KPIææ å®ä¹") |
| | | @RestController |
| | | @RequestMapping("/bi/decision/kpi-definition") |
| | | @Validated |
| | | public class DecisionKpiDefinitionController { |
| | | |
| | | @Resource |
| | | private BiKpiDefinitionService kpiDefinitionService; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "å建KPIææ ") |
| | | @PreAuthorize("@ss.hasPermission('bi:decision:kpi:create')") |
| | | public CommonResult<Long> createKpi(@Valid @RequestBody BiKpiDefinitionDO kpi) { |
| | | return success(kpiDefinitionService.createKpi(kpi)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "æ´æ°KPIææ ") |
| | | @PreAuthorize("@ss.hasPermission('bi:decision:kpi:update')") |
| | | public CommonResult<Boolean> updateKpi(@Valid @RequestBody BiKpiDefinitionDO kpi) { |
| | | kpiDefinitionService.updateKpi(kpi); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤KPIææ ") |
| | | @PreAuthorize("@ss.hasPermission('bi:decision:kpi:delete')") |
| | | public CommonResult<Boolean> deleteKpi(@RequestParam("id") Long id) { |
| | | kpiDefinitionService.deleteKpi(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "è·åKPIææ ") |
| | | @PreAuthorize("@ss.hasPermission('bi:decision:kpi:query')") |
| | | public CommonResult<BiKpiDefinitionDO> getKpi(@RequestParam("id") Long id) { |
| | | return success(kpiDefinitionService.getKpi(id)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "è·åKPIææ å页") |
| | | @PreAuthorize("@ss.hasPermission('bi:decision:kpi:query')") |
| | | public CommonResult<PageResult<BiKpiDefinitionDO>> getKpiPage(@Valid DecisionKpiDefinitionPageReqVO pageReq) { |
| | | return success(kpiDefinitionService.getKpiPage(pageReq)); |
| | | } |
| | | |
| | | @GetMapping("/list-all") |
| | | @Operation(summary = "è·åææKPIææ ") |
| | | @PreAuthorize("@ss.hasPermission('bi:decision:kpi:query')") |
| | | public CommonResult<PageResult<BiKpiDefinitionDO>> getKpiList() { |
| | | return success(kpiDefinitionService.getKpiPage(new DecisionKpiDefinitionPageReqVO())); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.controller.admin.decision.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | @Schema(description = "管çåå° - é¢è¦è®°å½å页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class DecisionAlertPageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "ç¶æï¼0-æªå¤ç 1-已确认 2-å·²å¤ç", example = "0") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "严é级å«ï¼1-è¦å 2-严é 3-ç´§æ¥", example = "1") |
| | | private Integer severity; |
| | | |
| | | @Schema(description = "KPIç¼ç ", example = "power_supply_amount") |
| | | private String kpiCode; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.controller.admin.decision.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - é¢è¦è®°å½ Response VO") |
| | | @Data |
| | | public class DecisionAlertRespVO { |
| | | |
| | | @Schema(description = "è®°å½ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | private Long id; |
| | | |
| | | @Schema(description = "å
³èè§åID", example = "1") |
| | | private Long ruleId; |
| | | |
| | | @Schema(description = "KPIç¼ç ", example = "power_supply_amount") |
| | | private String kpiCode; |
| | | |
| | | @Schema(description = "KPIåç§°", example = "ä¾çµé") |
| | | private String kpiName; |
| | | |
| | | @Schema(description = "å®é
å¼", example = "15000.00") |
| | | private BigDecimal actualValue; |
| | | |
| | | @Schema(description = "éå¼", example = "10000.00") |
| | | private BigDecimal thresholdValue; |
| | | |
| | | @Schema(description = "严é级å«ï¼1-è¦å 2-严é 3-ç´§æ¥", example = "1") |
| | | private Integer severity; |
| | | |
| | | @Schema(description = "é¢è¦æ¶æ¯", example = "ä¾çµéå½åå¼15000è¶
åºéå¼10000") |
| | | private String alertMessage; |
| | | |
| | | @Schema(description = "ç¶æï¼0-æªå¤ç 1-已确认 2-å·²å¤ç", example = "0") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "å¤ç人ID", example = "1") |
| | | private Long handlerId; |
| | | |
| | | @Schema(description = "å¤çæ¶é´", example = "2026-08-20 10:00:00") |
| | | private LocalDateTime handleTime; |
| | | |
| | | @Schema(description = "å¤ç夿³¨", example = "已确认") |
| | | private String handleRemark; |
| | | |
| | | @Schema(description = "è§¦åæ¶é´", example = "2026-08-20 09:55:00") |
| | | private LocalDateTime triggeredTime; |
| | | |
| | | @Schema(description = "å建æ¶é´", example = "2026-08-20 09:55:00") |
| | | private LocalDateTime createTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.controller.admin.decision.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | @Schema(description = "管çåå° - é¢è¦è§åå页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class DecisionAlertRulePageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "å
³èKPIææ ID", example = "1") |
| | | private Long kpiId; |
| | | |
| | | @Schema(description = "æ¯å¦å¯ç¨ï¼0-ç¦ç¨ 1-å¯ç¨", example = "1") |
| | | private Integer enabled; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.controller.admin.decision.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | @Schema(description = "管çåå° - è´è·é¢æµ Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class DecisionForecastReqVO extends PageParam { |
| | | |
| | | @Schema(description = "颿µç¼ç ", requiredMode = Schema.RequiredMode.REQUIRED, example = "load_forecast_daily") |
| | | private String forecastCode; |
| | | |
| | | @Schema(description = "维度", example = "region") |
| | | private String dimension; |
| | | |
| | | @Schema(description = "维度å¼", example = "åä¸") |
| | | private String dimensionValue; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.controller.admin.decision.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - è´è·é¢æµ Response VO") |
| | | @Data |
| | | public class DecisionForecastRespVO { |
| | | |
| | | @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | private Long id; |
| | | |
| | | @Schema(description = "颿µç¼ç ", example = "load_forecast_daily") |
| | | private String forecastCode; |
| | | |
| | | @Schema(description = "颿µåç§°", example = "æ¥è´è·é¢æµ") |
| | | private String forecastName; |
| | | |
| | | @Schema(description = "颿µæ¶é´ç¹", example = "2026-08-21 00:00:00") |
| | | private LocalDateTime pointTime; |
| | | |
| | | @Schema(description = "颿µå¼", example = "5000.00") |
| | | private BigDecimal forecastValue; |
| | | |
| | | @Schema(description = "å®é
å¼", example = "4800.00") |
| | | private BigDecimal actualValue; |
| | | |
| | | @Schema(description = "置信åºé´ä¸é", example = "4500.00") |
| | | private BigDecimal lowerBound; |
| | | |
| | | @Schema(description = "置信åºé´ä¸é", example = "5500.00") |
| | | private BigDecimal upperBound; |
| | | |
| | | @Schema(description = "置信水平(%)", example = "95.00") |
| | | private BigDecimal confidenceLevel; |
| | | |
| | | @Schema(description = "模åçæ¬", example = "v1.0") |
| | | private String modelVersion; |
| | | |
| | | @Schema(description = "维度", example = "region") |
| | | private String dimension; |
| | | |
| | | @Schema(description = "维度å¼", example = "åä¸") |
| | | private String dimensionValue; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.controller.admin.decision.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Schema(description = "管çåå° - å³çæ¯æ KPI åç±» Response VO") |
| | | @Data |
| | | public class DecisionKpiByCategoryRespVO { |
| | | |
| | | @Schema(description = "åç±»", requiredMode = Schema.RequiredMode.REQUIRED, example = "power_supply") |
| | | private String category; |
| | | |
| | | @Schema(description = "KPIå表") |
| | | private List<Map<String, Object>> kpis; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.controller.admin.decision.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | @Schema(description = "管çåå° - KPIææ å®ä¹å页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class DecisionKpiDefinitionPageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "KPIåç§°", example = "ä¾çµé") |
| | | private String name; |
| | | |
| | | @Schema(description = "åç±»", example = "power_supply") |
| | | private String category; |
| | | |
| | | @Schema(description = "ç¶æï¼0-ç¦ç¨ 1-å¯ç¨", example = "1") |
| | | private Integer status; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.controller.admin.decision.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Schema(description = "管çåå° - å³çæ¯æ KPI 详æ
Response VO") |
| | | @Data |
| | | public class DecisionKpiDetailRespVO { |
| | | |
| | | @Schema(description = "KPIç¼ç ", requiredMode = Schema.RequiredMode.REQUIRED, example = "power_supply_amount") |
| | | private String code; |
| | | |
| | | @Schema(description = "KPIåç§°", requiredMode = Schema.RequiredMode.REQUIRED, example = "ä¾çµé") |
| | | private String name; |
| | | |
| | | @Schema(description = "åä½", example = "ä¸åç¦æ¶") |
| | | private String unit; |
| | | |
| | | @Schema(description = "åç±»", example = "power_supply") |
| | | private String category; |
| | | |
| | | @Schema(description = "å½åå¼", example = "12345.67") |
| | | private BigDecimal value; |
| | | |
| | | @Schema(description = "æ¶é´åºåæ°æ®(JSON)", example = "[{\"time\":\"2026-08\",\"value\":1000}]") |
| | | private String timeSeries; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.controller.admin.decision.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Schema(description = "管çåå° - å³çæ¯æ KPI æ¦è§ Response VO") |
| | | @Data |
| | | public class DecisionKpiOverviewRespVO { |
| | | |
| | | @Schema(description = "KPIç¼ç ", requiredMode = Schema.RequiredMode.REQUIRED, example = "power_supply_amount") |
| | | private String code; |
| | | |
| | | @Schema(description = "KPIåç§°", requiredMode = Schema.RequiredMode.REQUIRED, example = "ä¾çµé") |
| | | private String name; |
| | | |
| | | @Schema(description = "åç±»", example = "power_supply") |
| | | private String category; |
| | | |
| | | @Schema(description = "åä½", example = "ä¸åç¦æ¶") |
| | | private String unit; |
| | | |
| | | @Schema(description = "å½åå¼", example = "12345.67") |
| | | private BigDecimal value; |
| | | |
| | | @Schema(description = "é¢è¦ç¶æï¼normal/warn/critical", example = "normal") |
| | | private String alertStatus; |
| | | |
| | | @Schema(description = "é»è®¤å¾è¡¨ç±»å", example = "number") |
| | | private String chartType; |
| | | |
| | | @Schema(description = "ç¶æï¼0-ç¦ç¨ 1-å¯ç¨", example = "1") |
| | | private Integer status; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.dal.dataobject.decision; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * é¢è¦è®°å½ DO |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @TableName("bi_alert_record") |
| | | @KeySequence("bi_alert_record_seq") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class BiAlertRecordDO extends BaseDO { |
| | | |
| | | @TableId |
| | | private Long id; |
| | | |
| | | /** |
| | | * å
³èè§åID |
| | | */ |
| | | private Long ruleId; |
| | | |
| | | /** |
| | | * å
³èKPIææ ID |
| | | */ |
| | | private Long kpiId; |
| | | |
| | | /** |
| | | * KPIç¼ç (åä½) |
| | | */ |
| | | private String kpiCode; |
| | | |
| | | /** |
| | | * KPIåç§°(åä½) |
| | | */ |
| | | private String kpiName; |
| | | |
| | | /** |
| | | * å®é
å¼ |
| | | */ |
| | | private BigDecimal actualValue; |
| | | |
| | | /** |
| | | * éå¼(åä½) |
| | | */ |
| | | private BigDecimal thresholdValue; |
| | | |
| | | /** |
| | | * 严éçº§å« |
| | | */ |
| | | private Integer severity; |
| | | |
| | | /** |
| | | * é¢è¦æ¶æ¯ |
| | | */ |
| | | private String alertMessage; |
| | | |
| | | /** |
| | | * ç¶æï¼0-æªå¤ç 1-已确认 2-å·²å¤ç |
| | | */ |
| | | private Integer status; |
| | | |
| | | /** |
| | | * å¤ç人ID |
| | | */ |
| | | private Long handlerId; |
| | | |
| | | /** |
| | | * å¤çæ¶é´ |
| | | */ |
| | | private LocalDateTime handleTime; |
| | | |
| | | /** |
| | | * å¤ç夿³¨ |
| | | */ |
| | | private String handleRemark; |
| | | |
| | | /** |
| | | * è§¦åæ¶é´ |
| | | */ |
| | | private LocalDateTime triggeredTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.dal.dataobject.decision; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * é¢è¦è§å DO |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @TableName("bi_alert_rule") |
| | | @KeySequence("bi_alert_rule_seq") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class BiAlertRuleDO extends BaseDO { |
| | | |
| | | @TableId |
| | | private Long id; |
| | | |
| | | /** |
| | | * å
³èKPIææ ID |
| | | */ |
| | | private Long kpiId; |
| | | |
| | | /** |
| | | * è§ååç§° |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * 严é级å«ï¼1-è¦å 2-严é 3-ç´§æ¥ |
| | | */ |
| | | private Integer severity; |
| | | |
| | | /** |
| | | * æ¯è¾è¿ç®ç¬¦ |
| | | */ |
| | | private String comparisonOperator; |
| | | |
| | | /** |
| | | * éå¼ |
| | | */ |
| | | private BigDecimal thresholdValue; |
| | | |
| | | /** |
| | | * éç¥æ¹å¼ï¼system/message/email(éå·åé) |
| | | */ |
| | | private String notificationType; |
| | | |
| | | /** |
| | | * æ¯å¦å¯ç¨ï¼0-ç¦ç¨ 1-å¯ç¨ |
| | | */ |
| | | private Integer enabled; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.dal.dataobject.decision; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * è´è·é¢æµæ°æ® DO |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @TableName("bi_forecast_data") |
| | | @KeySequence("bi_forecast_data_seq") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class BiForecastDataDO extends BaseDO { |
| | | |
| | | @TableId |
| | | private Long id; |
| | | |
| | | /** |
| | | * 颿µç¼ç ï¼å¦ï¼load_forecast_daily |
| | | */ |
| | | private String forecastCode; |
| | | |
| | | /** |
| | | * 颿µåç§° |
| | | */ |
| | | private String forecastName; |
| | | |
| | | /** |
| | | * 颿µæ¶é´ç¹ |
| | | */ |
| | | private LocalDateTime pointTime; |
| | | |
| | | /** |
| | | * 颿µå¼ |
| | | */ |
| | | private BigDecimal forecastValue; |
| | | |
| | | /** |
| | | * å®é
å¼(åå¡«ç¨äºæ ¡éª) |
| | | */ |
| | | private BigDecimal actualValue; |
| | | |
| | | /** |
| | | * 置信åºé´ä¸é |
| | | */ |
| | | private BigDecimal lowerBound; |
| | | |
| | | /** |
| | | * 置信åºé´ä¸é |
| | | */ |
| | | private BigDecimal upperBound; |
| | | |
| | | /** |
| | | * 置信水平(%) |
| | | */ |
| | | private BigDecimal confidenceLevel; |
| | | |
| | | /** |
| | | * 模åçæ¬ |
| | | */ |
| | | private String modelVersion; |
| | | |
| | | /** |
| | | * 维度ï¼å¦ï¼region/line/station |
| | | */ |
| | | private String dimension; |
| | | |
| | | /** |
| | | * ç»´åº¦å¼ |
| | | */ |
| | | private String dimensionValue; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.dal.dataobject.decision; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * KPIææ å®ä¹ DO |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @TableName("bi_kpi_definition") |
| | | @KeySequence("bi_kpi_definition_seq") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class BiKpiDefinitionDO extends BaseDO { |
| | | |
| | | @TableId |
| | | private Long id; |
| | | |
| | | /** |
| | | * KPIç¼ç |
| | | */ |
| | | private String code; |
| | | |
| | | /** |
| | | * KPIåç§° |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * åç±»ï¼power_supply/device_operation/production/quality/procurement/safety |
| | | */ |
| | | private String category; |
| | | |
| | | /** |
| | | * åä½ |
| | | */ |
| | | private String unit; |
| | | |
| | | /** |
| | | * æ°æ®æ¥æºï¼sql/interface/manual |
| | | */ |
| | | private String dataSource; |
| | | |
| | | /** |
| | | * æ¥è¯¢SQL |
| | | */ |
| | | private String querySql; |
| | | |
| | | /** |
| | | * é»è®¤å¾è¡¨ç±»å |
| | | */ |
| | | private String chartType; |
| | | |
| | | /** |
| | | * é¢è¦éå¼-è¦å |
| | | */ |
| | | private BigDecimal thresholdWarn; |
| | | |
| | | /** |
| | | * é¢è¦éå¼-严é |
| | | */ |
| | | private BigDecimal thresholdCritical; |
| | | |
| | | /** |
| | | * æ¯è¾è¿ç®ç¬¦ï¼>/</>=/<= |
| | | */ |
| | | private String comparisonOperator; |
| | | |
| | | /** |
| | | * å·æ°é´é(ç§) |
| | | */ |
| | | private Integer refreshInterval; |
| | | |
| | | /** |
| | | * æåº |
| | | */ |
| | | private Integer sort; |
| | | |
| | | /** |
| | | * ç¶æï¼0-ç¦ç¨ 1-å¯ç¨ |
| | | */ |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.dal.mysql.decision; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.module.bi.dal.dataobject.decision.BiAlertRecordDO; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface BiAlertRecordMapper extends BaseMapperX<BiAlertRecordDO> { |
| | | |
| | | default Long selectCountByStatus(Integer status) { |
| | | return selectCount(new LambdaQueryWrapper<BiAlertRecordDO>() |
| | | .eq(BiAlertRecordDO::getStatus, status)); |
| | | } |
| | | |
| | | default List<BiAlertRecordDO> selectListByStatus(Integer status) { |
| | | return selectList(new LambdaQueryWrapper<BiAlertRecordDO>() |
| | | .eq(BiAlertRecordDO::getStatus, status)); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.dal.mysql.decision; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.module.bi.dal.dataobject.decision.BiAlertRuleDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @Mapper |
| | | public interface BiAlertRuleMapper extends BaseMapperX<BiAlertRuleDO> { |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.dal.mysql.decision; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.module.bi.dal.dataobject.decision.BiForecastDataDO; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface BiForecastDataMapper extends BaseMapperX<BiForecastDataDO> { |
| | | |
| | | default List<BiForecastDataDO> selectListByCodeAndTimeRange(String forecastCode, |
| | | LocalDateTime beginTime, |
| | | LocalDateTime endTime) { |
| | | return selectList(new LambdaQueryWrapper<BiForecastDataDO>() |
| | | .eq(BiForecastDataDO::getForecastCode, forecastCode) |
| | | .between(BiForecastDataDO::getPointTime, beginTime, endTime) |
| | | .orderByAsc(BiForecastDataDO::getPointTime)); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.dal.mysql.decision; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.module.bi.dal.dataobject.decision.BiKpiDefinitionDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @Mapper |
| | | public interface BiKpiDefinitionMapper extends BaseMapperX<BiKpiDefinitionDO> { |
| | | } |
| | |
| | | // ========== ä»åºåæ é
ç½®ç¸å
³ 1-080-151 ~ 1-080-170 ========== |
| | | ErrorCode BI_WAREHOUSE_COORDINATE_NOT_EXISTS = new ErrorCode(1_080_151, "ä»åºåæ é
ç½®ä¸åå¨"); |
| | | |
| | | // ========== å³çæ¯æ - KPIææ 1_080_152 ~ 1_080_180 ========== |
| | | ErrorCode KPI_NOT_EXISTS = new ErrorCode(1_080_152, "KPIææ ä¸åå¨"); |
| | | ErrorCode KPI_CODE_DUPLICATE = new ErrorCode(1_080_153, "KPIç¼ç å·²åå¨"); |
| | | |
| | | // ========== å³çæ¯æ - é¢è¦è§å 1_080_181 ~ 1_080_200 ========== |
| | | ErrorCode ALERT_RULE_NOT_EXISTS = new ErrorCode(1_080_181, "é¢è¦è§åä¸åå¨"); |
| | | ErrorCode ALERT_RULE_KPI_NOT_EXISTS = new ErrorCode(1_080_182, "å
³èçKPIææ ä¸åå¨"); |
| | | |
| | | // ========== å³çæ¯æ - é¢è¦è®°å½ 1_080_201 ~ 1_080_220 ========== |
| | | ErrorCode ALERT_RECORD_NOT_EXISTS = new ErrorCode(1_080_201, "é¢è¦è®°å½ä¸åå¨"); |
| | | ErrorCode ALERT_RECORD_ALREADY_HANDLED = new ErrorCode(1_080_202, "é¢è¦è®°å½å·²å¤ç"); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.service.decision; |
| | | |
| | | import cn.iocoder.yudao.module.bi.dal.dataobject.decision.BiAlertRecordDO; |
| | | import cn.iocoder.yudao.module.bi.dal.dataobject.decision.BiAlertRuleDO; |
| | | import cn.iocoder.yudao.module.bi.dal.dataobject.decision.BiKpiDefinitionDO; |
| | | import cn.iocoder.yudao.module.bi.dal.mysql.decision.BiAlertRecordMapper; |
| | | import cn.iocoder.yudao.module.bi.dal.mysql.decision.BiAlertRuleMapper; |
| | | import cn.iocoder.yudao.module.bi.dal.mysql.decision.BiKpiDefinitionMapper; |
| | | import jakarta.annotation.Resource; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.jdbc.core.JdbcTemplate; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * é¢è¦å®æ¶è¯ä¼°ä»»å¡ |
| | | * |
| | | * å®ææ«ææææ´»è·é¢è¦è§åï¼è¯ä¼°éå¼å¹¶çæé¢è¦è®°å½ |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class AlertEvaluationTask { |
| | | |
| | | @Resource |
| | | private BiAlertRuleMapper alertRuleMapper; |
| | | |
| | | @Resource |
| | | private BiKpiDefinitionMapper kpiMapper; |
| | | |
| | | @Resource |
| | | private BiAlertRecordMapper alertRecordMapper; |
| | | |
| | | @Resource |
| | | private JdbcTemplate jdbcTemplate; |
| | | |
| | | /** |
| | | * æ¯5åéè¯ä¼°ä¸æ¬¡æææ´»è·è§å |
| | | */ |
| | | @Scheduled(fixedDelayString = "${bi.alert.evaluation.interval:300000}") |
| | | public void evaluateAllAlertRules() { |
| | | log.debug("[evaluateAllAlertRules][å¼å§è¯ä¼°é¢è¦è§å]"); |
| | | List<BiAlertRuleDO> rules = alertRuleMapper.selectList( |
| | | BiAlertRuleDO::getEnabled, 1); |
| | | if (rules.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | for (BiAlertRuleDO rule : rules) { |
| | | try { |
| | | evaluateRule(rule); |
| | | } catch (Exception e) { |
| | | log.error("[evaluateAllAlertRules][è§å {} è¯ä¼°å¼å¸¸]", rule.getId(), e); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void evaluateRule(BiAlertRuleDO rule) { |
| | | BiKpiDefinitionDO kpi = kpiMapper.selectById(rule.getKpiId()); |
| | | if (kpi == null || kpi.getStatus() == 0) { |
| | | return; |
| | | } |
| | | |
| | | // æ§è¡ KPI æ¥è¯¢ |
| | | BigDecimal currentValue = executeQuery(kpi.getQuerySql()); |
| | | if (currentValue == null) { |
| | | return; |
| | | } |
| | | |
| | | // æ¯è¾éå¼ |
| | | int cmp = currentValue.compareTo(rule.getThresholdValue()); |
| | | boolean triggered = switch (rule.getComparisonOperator()) { |
| | | case ">" -> cmp > 0; |
| | | case "<" -> cmp < 0; |
| | | case ">=" -> cmp >= 0; |
| | | case "<=" -> cmp <= 0; |
| | | default -> false; |
| | | }; |
| | | |
| | | if (!triggered) { |
| | | return; |
| | | } |
| | | |
| | | // æ£æ¥æ¯å¦å·²ææªå¤ççåKPIé¢è¦ï¼å»éï¼ |
| | | Long existingCount = alertRecordMapper.selectCountByStatus(0); |
| | | if (existingCount > 0) { |
| | | List<BiAlertRecordDO> existing = alertRecordMapper.selectListByStatus(0); |
| | | boolean dup = existing.stream().anyMatch(r -> r.getKpiId().equals(rule.getKpiId())); |
| | | if (dup) { |
| | | return; |
| | | } |
| | | } |
| | | |
| | | // çæé¢è¦è®°å½ |
| | | BiAlertRecordDO record = BiAlertRecordDO.builder() |
| | | .ruleId(rule.getId()) |
| | | .kpiId(kpi.getId()) |
| | | .kpiCode(kpi.getCode()) |
| | | .kpiName(kpi.getName()) |
| | | .actualValue(currentValue) |
| | | .thresholdValue(rule.getThresholdValue()) |
| | | .severity(rule.getSeverity()) |
| | | .alertMessage(String.format("%s å½åå¼ %s è¶
åºéå¼ %s", |
| | | kpi.getName(), currentValue, rule.getThresholdValue())) |
| | | .status(0) |
| | | .triggeredTime(LocalDateTime.now()) |
| | | .build(); |
| | | alertRecordMapper.insert(record); |
| | | log.warn("[evaluateRule][触åé¢è¦] KPI={}, å½åå¼={}, éå¼={}", |
| | | kpi.getName(), currentValue, rule.getThresholdValue()); |
| | | } |
| | | |
| | | private BigDecimal executeQuery(String sql) { |
| | | if (sql == null || sql.isBlank()) { |
| | | return null; |
| | | } |
| | | try { |
| | | List<Map<String, Object>> result = jdbcTemplate.queryForList(sql); |
| | | if (result.isEmpty()) { |
| | | return null; |
| | | } |
| | | Object value = result.get(0).values().iterator().next(); |
| | | if (value instanceof Number) { |
| | | return BigDecimal.valueOf(((Number) value).doubleValue()); |
| | | } |
| | | return null; |
| | | } catch (Exception e) { |
| | | log.error("[executeQuery][SQLæ§è¡å¤±è´¥] {}", sql, e); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.service.decision; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.bi.controller.admin.decision.vo.DecisionAlertPageReqVO; |
| | | import cn.iocoder.yudao.module.bi.dal.dataobject.decision.BiAlertRecordDO; |
| | | |
| | | import jakarta.validation.Valid; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * é¢è¦è®°å½ Service æ¥å£ |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | public interface BiAlertRecordService { |
| | | |
| | | Long createRecord(@Valid BiAlertRecordDO record); |
| | | |
| | | void confirmRecord(Long id, Long handlerId); |
| | | |
| | | void handleRecord(Long id, Long handlerId, String handleRemark); |
| | | |
| | | PageResult<BiAlertRecordDO> getRecordPage(DecisionAlertPageReqVO pageReq); |
| | | |
| | | Long getUnprocessedCount(); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.service.decision; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.bi.controller.admin.decision.vo.DecisionAlertPageReqVO; |
| | | import cn.iocoder.yudao.module.bi.dal.dataobject.decision.BiAlertRecordDO; |
| | | import cn.iocoder.yudao.module.bi.dal.mysql.decision.BiAlertRecordMapper; |
| | | import cn.iocoder.yudao.module.bi.enums.ErrorCodeConstants; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | |
| | | /** |
| | | * é¢è¦è®°å½ Service å®ç° |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @Service |
| | | public class BiAlertRecordServiceImpl implements BiAlertRecordService { |
| | | |
| | | @Resource |
| | | private BiAlertRecordMapper alertRecordMapper; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long createRecord(BiAlertRecordDO record) { |
| | | record.setStatus(0); // æªå¤ç |
| | | record.setTriggeredTime(LocalDateTime.now()); |
| | | alertRecordMapper.insert(record); |
| | | return record.getId(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void confirmRecord(Long id, Long handlerId) { |
| | | BiAlertRecordDO record = alertRecordMapper.selectById(id); |
| | | if (record == null) { |
| | | throw exception(ErrorCodeConstants.ALERT_RECORD_NOT_EXISTS); |
| | | } |
| | | if (record.getStatus() >= 1) { |
| | | throw exception(ErrorCodeConstants.ALERT_RECORD_ALREADY_HANDLED); |
| | | } |
| | | alertRecordMapper.updateById(BiAlertRecordDO.builder() |
| | | .id(id) |
| | | .status(1) // 已确认 |
| | | .handlerId(handlerId) |
| | | .build()); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void handleRecord(Long id, Long handlerId, String handleRemark) { |
| | | BiAlertRecordDO record = alertRecordMapper.selectById(id); |
| | | if (record == null) { |
| | | throw exception(ErrorCodeConstants.ALERT_RECORD_NOT_EXISTS); |
| | | } |
| | | if (record.getStatus() >= 2) { |
| | | throw exception(ErrorCodeConstants.ALERT_RECORD_ALREADY_HANDLED); |
| | | } |
| | | alertRecordMapper.updateById(BiAlertRecordDO.builder() |
| | | .id(id) |
| | | .status(2) // å·²å¤ç |
| | | .handlerId(handlerId) |
| | | .handleTime(LocalDateTime.now()) |
| | | .handleRemark(handleRemark) |
| | | .build()); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<BiAlertRecordDO> getRecordPage(DecisionAlertPageReqVO pageReq) { |
| | | return alertRecordMapper.selectPage(pageReq, new LambdaQueryWrapperX<BiAlertRecordDO>() |
| | | .eqIfPresent(BiAlertRecordDO::getStatus, pageReq.getStatus()) |
| | | .eqIfPresent(BiAlertRecordDO::getSeverity, pageReq.getSeverity()) |
| | | .eqIfPresent(BiAlertRecordDO::getKpiCode, pageReq.getKpiCode()) |
| | | .orderByDesc(BiAlertRecordDO::getTriggeredTime)); |
| | | } |
| | | |
| | | @Override |
| | | public Long getUnprocessedCount() { |
| | | return alertRecordMapper.selectCountByStatus(0); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.service.decision; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.bi.controller.admin.decision.vo.DecisionAlertRulePageReqVO; |
| | | import cn.iocoder.yudao.module.bi.dal.dataobject.decision.BiAlertRuleDO; |
| | | |
| | | import jakarta.validation.Valid; |
| | | |
| | | /** |
| | | * é¢è¦è§å Service æ¥å£ |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | public interface BiAlertRuleService { |
| | | |
| | | Long createRule(@Valid BiAlertRuleDO rule); |
| | | |
| | | void updateRule(@Valid BiAlertRuleDO rule); |
| | | |
| | | void deleteRule(Long id); |
| | | |
| | | BiAlertRuleDO getRule(Long id); |
| | | |
| | | PageResult<BiAlertRuleDO> getRulePage(DecisionAlertRulePageReqVO pageReq); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.service.decision; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.bi.controller.admin.decision.vo.DecisionAlertRulePageReqVO; |
| | | import cn.iocoder.yudao.module.bi.dal.dataobject.decision.BiAlertRuleDO; |
| | | import cn.iocoder.yudao.module.bi.dal.dataobject.decision.BiKpiDefinitionDO; |
| | | import cn.iocoder.yudao.module.bi.dal.mysql.decision.BiAlertRuleMapper; |
| | | import cn.iocoder.yudao.module.bi.dal.mysql.decision.BiKpiDefinitionMapper; |
| | | import cn.iocoder.yudao.module.bi.enums.ErrorCodeConstants; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | |
| | | /** |
| | | * é¢è¦è§å Service å®ç° |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @Service |
| | | public class BiAlertRuleServiceImpl implements BiAlertRuleService { |
| | | |
| | | @Resource |
| | | private BiAlertRuleMapper alertRuleMapper; |
| | | |
| | | @Resource |
| | | private BiKpiDefinitionMapper kpiMapper; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long createRule(BiAlertRuleDO rule) { |
| | | // æ ¡éªKPIåå¨ |
| | | if (kpiMapper.selectById(rule.getKpiId()) == null) { |
| | | throw exception(ErrorCodeConstants.ALERT_RULE_KPI_NOT_EXISTS); |
| | | } |
| | | alertRuleMapper.insert(rule); |
| | | return rule.getId(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateRule(BiAlertRuleDO rule) { |
| | | if (alertRuleMapper.selectById(rule.getId()) == null) { |
| | | throw exception(ErrorCodeConstants.ALERT_RULE_NOT_EXISTS); |
| | | } |
| | | if (rule.getKpiId() != null && kpiMapper.selectById(rule.getKpiId()) == null) { |
| | | throw exception(ErrorCodeConstants.ALERT_RULE_KPI_NOT_EXISTS); |
| | | } |
| | | alertRuleMapper.updateById(rule); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteRule(Long id) { |
| | | if (alertRuleMapper.selectById(id) == null) { |
| | | throw exception(ErrorCodeConstants.ALERT_RULE_NOT_EXISTS); |
| | | } |
| | | alertRuleMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public BiAlertRuleDO getRule(Long id) { |
| | | return alertRuleMapper.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<BiAlertRuleDO> getRulePage(DecisionAlertRulePageReqVO pageReq) { |
| | | return alertRuleMapper.selectPage(pageReq, new LambdaQueryWrapperX<BiAlertRuleDO>() |
| | | .eqIfPresent(BiAlertRuleDO::getKpiId, pageReq.getKpiId()) |
| | | .eqIfPresent(BiAlertRuleDO::getEnabled, pageReq.getEnabled()) |
| | | .orderByDesc(BiAlertRuleDO::getId)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.service.decision; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * å³çæ¯æ KPI èå Service æ¥å£ |
| | | * |
| | | * 跨模åèå宿¶ KPI æ°æ® |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | public interface BiDecisionKpiService { |
| | | |
| | | /** |
| | | * è·å KPI æ¦è§æ°æ® |
| | | */ |
| | | Map<String, Object> getKpiOverview(); |
| | | |
| | | /** |
| | | * è·åå个 KPI 详æ
ï¼å«æ¶é´åºåï¼ |
| | | */ |
| | | Map<String, Object> getKpiDetail(String kpiCode); |
| | | |
| | | /** |
| | | * æåç±»è·å KPI |
| | | */ |
| | | Map<String, Object> getKpiByCategory(String category); |
| | | |
| | | /** |
| | | * å·æ° KPI å¼ |
| | | */ |
| | | BigDecimal refreshKpi(String kpiCode); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.service.decision; |
| | | |
| | | import cn.iocoder.yudao.module.bi.dal.mysql.decision.BiKpiDefinitionMapper; |
| | | import cn.iocoder.yudao.module.bi.dal.dataobject.decision.BiKpiDefinitionDO; |
| | | import jakarta.annotation.Resource; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.jdbc.core.JdbcTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * å³çæ¯æ KPI èå Service å®ç° |
| | | * |
| | | * éè¿ JdbcTemplate è·¨æ¨¡åæ§è¡èå SQL |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class BiDecisionKpiServiceImpl implements BiDecisionKpiService { |
| | | |
| | | @Resource |
| | | private BiKpiDefinitionMapper kpiMapper; |
| | | |
| | | @Resource |
| | | private JdbcTemplate jdbcTemplate; |
| | | |
| | | @Override |
| | | public Map<String, Object> getKpiOverview() { |
| | | List<BiKpiDefinitionDO> kpis = kpiMapper.selectList(); |
| | | List<Map<String, Object>> items = new ArrayList<>(); |
| | | |
| | | for (BiKpiDefinitionDO kpi : kpis) { |
| | | Map<String, Object> item = new LinkedHashMap<>(); |
| | | item.put("code", kpi.getCode()); |
| | | item.put("name", kpi.getName()); |
| | | item.put("category", kpi.getCategory()); |
| | | item.put("unit", kpi.getUnit()); |
| | | item.put("chartType", kpi.getChartType()); |
| | | item.put("status", kpi.getStatus()); |
| | | |
| | | // æ§è¡æ¥è¯¢è·åå½åå¼ |
| | | BigDecimal value = executeKpiSql(kpi.getQuerySql()); |
| | | item.put("value", value); |
| | | |
| | | // 夿é¢è¦ç¶æ |
| | | String alertStatus = evaluateAlertStatus(kpi, value); |
| | | item.put("alertStatus", alertStatus); |
| | | |
| | | items.add(item); |
| | | } |
| | | |
| | | Map<String, Object> result = new LinkedHashMap<>(); |
| | | result.put("kpis", items); |
| | | result.put("total", items.size()); |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getKpiDetail(String kpiCode) { |
| | | BiKpiDefinitionDO kpi = kpiMapper.selectOne(BiKpiDefinitionDO::getCode, kpiCode); |
| | | if (kpi == null) { |
| | | return Collections.emptyMap(); |
| | | } |
| | | |
| | | Map<String, Object> result = new LinkedHashMap<>(); |
| | | result.put("code", kpi.getCode()); |
| | | result.put("name", kpi.getName()); |
| | | result.put("unit", kpi.getUnit()); |
| | | result.put("category", kpi.getCategory()); |
| | | result.put("value", executeKpiSql(kpi.getQuerySql())); |
| | | |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> getKpiByCategory(String category) { |
| | | List<BiKpiDefinitionDO> kpis = kpiMapper.selectList( |
| | | BiKpiDefinitionDO::getCategory, category); |
| | | List<Map<String, Object>> items = new ArrayList<>(); |
| | | |
| | | for (BiKpiDefinitionDO kpi : kpis) { |
| | | Map<String, Object> item = new LinkedHashMap<>(); |
| | | item.put("code", kpi.getCode()); |
| | | item.put("name", kpi.getName()); |
| | | item.put("unit", kpi.getUnit()); |
| | | item.put("value", executeKpiSql(kpi.getQuerySql())); |
| | | items.add(item); |
| | | } |
| | | |
| | | Map<String, Object> result = new LinkedHashMap<>(); |
| | | result.put("category", category); |
| | | result.put("kpis", items); |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal refreshKpi(String kpiCode) { |
| | | BiKpiDefinitionDO kpi = kpiMapper.selectOne(BiKpiDefinitionDO::getCode, kpiCode); |
| | | if (kpi == null) { |
| | | return BigDecimal.ZERO; |
| | | } |
| | | return executeKpiSql(kpi.getQuerySql()); |
| | | } |
| | | |
| | | /** |
| | | * æ§è¡ KPI æ¥è¯¢ SQL |
| | | */ |
| | | private BigDecimal executeKpiSql(String querySql) { |
| | | if (querySql == null || querySql.isBlank()) { |
| | | return BigDecimal.ZERO; |
| | | } |
| | | try { |
| | | List<Map<String, Object>> result = jdbcTemplate.queryForList(querySql); |
| | | if (result.isEmpty()) { |
| | | return BigDecimal.ZERO; |
| | | } |
| | | // å第ä¸è¡ç¬¬ä¸åçå¼ |
| | | Map<String, Object> row = result.get(0); |
| | | Object value = row.values().iterator().next(); |
| | | if (value instanceof Number) { |
| | | return BigDecimal.valueOf(((Number) value).doubleValue()); |
| | | } |
| | | return BigDecimal.ZERO; |
| | | } catch (Exception e) { |
| | | log.error("[executeKpiSql][SQLæ§è¡å¤±è´¥] {}", querySql, e); |
| | | return BigDecimal.ZERO; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è¯ä¼°é¢è¦ç¶æ |
| | | */ |
| | | private String evaluateAlertStatus(BiKpiDefinitionDO kpi, BigDecimal value) { |
| | | if (kpi.getThresholdCritical() != null) { |
| | | int cmp = value.compareTo(kpi.getThresholdCritical()); |
| | | boolean triggered = ">".equals(kpi.getComparisonOperator()) ? cmp > 0 |
| | | : "<".equals(kpi.getComparisonOperator()) ? cmp < 0 |
| | | : ">=".equals(kpi.getComparisonOperator()) ? cmp >= 0 |
| | | : "<=".equals(kpi.getComparisonOperator()) ? cmp <= 0 : false; |
| | | if (triggered) { |
| | | return "critical"; |
| | | } |
| | | } |
| | | if (kpi.getThresholdWarn() != null) { |
| | | int cmp = value.compareTo(kpi.getThresholdWarn()); |
| | | boolean triggered = ">".equals(kpi.getComparisonOperator()) ? cmp > 0 |
| | | : "<".equals(kpi.getComparisonOperator()) ? cmp < 0 |
| | | : ">=".equals(kpi.getComparisonOperator()) ? cmp >= 0 |
| | | : "<=".equals(kpi.getComparisonOperator()) ? cmp <= 0 : false; |
| | | if (triggered) { |
| | | return "warn"; |
| | | } |
| | | } |
| | | return "normal"; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.service.decision; |
| | | |
| | | import cn.iocoder.yudao.module.bi.dal.dataobject.decision.BiForecastDataDO; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * è´è·é¢æµ Service æ¥å£ |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | public interface BiForecastService { |
| | | |
| | | List<BiForecastDataDO> getForecastList(String forecastCode, LocalDateTime beginTime, LocalDateTime endTime); |
| | | |
| | | void generateForecast(String forecastCode, LocalDateTime pointTime); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.service.decision; |
| | | |
| | | import cn.iocoder.yudao.module.bi.dal.dataobject.decision.BiForecastDataDO; |
| | | import cn.iocoder.yudao.module.bi.dal.mysql.decision.BiForecastDataMapper; |
| | | import jakarta.annotation.Resource; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * è´è·é¢æµ Service å®ç° |
| | | * |
| | | * æ¬æä½¿ç¨ç®åç§»å¨å¹³åå ä½ï¼é¢ç ML æ¨¡åæ¥å£ |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class BiForecastServiceImpl implements BiForecastService { |
| | | |
| | | @Resource |
| | | private BiForecastDataMapper forecastDataMapper; |
| | | |
| | | @Override |
| | | public List<BiForecastDataDO> getForecastList(String forecastCode, LocalDateTime beginTime, LocalDateTime endTime) { |
| | | return forecastDataMapper.selectListByCodeAndTimeRange(forecastCode, beginTime, endTime); |
| | | } |
| | | |
| | | @Override |
| | | public void generateForecast(String forecastCode, LocalDateTime pointTime) { |
| | | // æ¬æå ä½ï¼ç®åç§»å¨å¹³å颿µ |
| | | // å®é
项ç®åºéæ ML 模åï¼ARIMA/Prophet/LSTMï¼ |
| | | log.info("[generateForecast][çæé¢æµ] forecastCode={}, pointTime={}, å½å为å ä½å®ç°", forecastCode, pointTime); |
| | | |
| | | BiForecastDataDO forecast = BiForecastDataDO.builder() |
| | | .forecastCode(forecastCode) |
| | | .forecastName("è´è·é¢æµ(å ä½)") |
| | | .pointTime(pointTime) |
| | | .forecastValue(BigDecimal.ZERO) |
| | | .lowerBound(BigDecimal.ZERO) |
| | | .upperBound(BigDecimal.ZERO) |
| | | .confidenceLevel(new BigDecimal("95.00")) |
| | | .modelVersion("v1.0-placeholder") |
| | | .build(); |
| | | forecastDataMapper.insert(forecast); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.service.decision; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.bi.controller.admin.decision.vo.DecisionKpiDefinitionPageReqVO; |
| | | import cn.iocoder.yudao.module.bi.dal.dataobject.decision.BiKpiDefinitionDO; |
| | | |
| | | import jakarta.validation.Valid; |
| | | |
| | | /** |
| | | * KPIææ å®ä¹ Service æ¥å£ |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | public interface BiKpiDefinitionService { |
| | | |
| | | Long createKpi(@Valid BiKpiDefinitionDO kpi); |
| | | |
| | | void updateKpi(@Valid BiKpiDefinitionDO kpi); |
| | | |
| | | void deleteKpi(Long id); |
| | | |
| | | BiKpiDefinitionDO getKpi(Long id); |
| | | |
| | | BiKpiDefinitionDO getKpiByCode(String code); |
| | | |
| | | PageResult<BiKpiDefinitionDO> getKpiPage(DecisionKpiDefinitionPageReqVO pageReq); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.bi.service.decision; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.bi.controller.admin.decision.vo.DecisionKpiDefinitionPageReqVO; |
| | | import cn.iocoder.yudao.module.bi.dal.dataobject.decision.BiKpiDefinitionDO; |
| | | import cn.iocoder.yudao.module.bi.dal.mysql.decision.BiKpiDefinitionMapper; |
| | | import cn.iocoder.yudao.module.bi.enums.ErrorCodeConstants; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | |
| | | /** |
| | | * KPIææ å®ä¹ Service å®ç° |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @Service |
| | | public class BiKpiDefinitionServiceImpl implements BiKpiDefinitionService { |
| | | |
| | | @Resource |
| | | private BiKpiDefinitionMapper kpiMapper; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long createKpi(BiKpiDefinitionDO kpi) { |
| | | // æ ¡éªç¼ç å¯ä¸ |
| | | if (kpiMapper.selectOne(BiKpiDefinitionDO::getCode, kpi.getCode()) != null) { |
| | | throw exception(ErrorCodeConstants.KPI_CODE_DUPLICATE); |
| | | } |
| | | kpiMapper.insert(kpi); |
| | | return kpi.getId(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateKpi(BiKpiDefinitionDO kpi) { |
| | | // æ ¡éªåå¨ |
| | | BiKpiDefinitionDO exist = kpiMapper.selectById(kpi.getId()); |
| | | if (exist == null) { |
| | | throw exception(ErrorCodeConstants.KPI_NOT_EXISTS); |
| | | } |
| | | // æ ¡éªç¼ç å¯ä¸ï¼æé¤èªèº«ï¼ |
| | | BiKpiDefinitionDO byCode = kpiMapper.selectOne(BiKpiDefinitionDO::getCode, kpi.getCode()); |
| | | if (byCode != null && !byCode.getId().equals(kpi.getId())) { |
| | | throw exception(ErrorCodeConstants.KPI_CODE_DUPLICATE); |
| | | } |
| | | kpiMapper.updateById(kpi); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteKpi(Long id) { |
| | | if (kpiMapper.selectById(id) == null) { |
| | | throw exception(ErrorCodeConstants.KPI_NOT_EXISTS); |
| | | } |
| | | kpiMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public BiKpiDefinitionDO getKpi(Long id) { |
| | | return kpiMapper.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public BiKpiDefinitionDO getKpiByCode(String code) { |
| | | return kpiMapper.selectOne(BiKpiDefinitionDO::getCode, code); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<BiKpiDefinitionDO> getKpiPage(DecisionKpiDefinitionPageReqVO pageReq) { |
| | | return kpiMapper.selectPage(pageReq, new LambdaQueryWrapperX<BiKpiDefinitionDO>() |
| | | .likeIfPresent(BiKpiDefinitionDO::getName, pageReq.getName()) |
| | | .eqIfPresent(BiKpiDefinitionDO::getCategory, pageReq.getCategory()) |
| | | .eqIfPresent(BiKpiDefinitionDO::getStatus, pageReq.getStatus()) |
| | | .orderByAsc(BiKpiDefinitionDO::getSort)); |
| | | } |
| | | |
| | | } |
| | |
| | | <version>${revision}</version> |
| | | </dependency> |
| | | |
| | | <!-- MES ç产工å API --> |
| | | <dependency> |
| | | <groupId>cn.iocoder.boot</groupId> |
| | | <artifactId>yudao-module-mes-api</artifactId> |
| | | <version>${revision}</version> |
| | | </dependency> |
| | | |
| | | <!-- ä¸å¡ç»ä»¶ --> |
| | | <dependency> |
| | | <groupId>cn.iocoder.boot</groupId> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.controller.admin.cancellation; |
| | | |
| | | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.cancellation.vo.CrmCancellationAuditReqVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.cancellation.vo.CrmCancellationPageReqVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.cancellation.vo.CrmCancellationRespVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.cancellation.vo.CrmCancellationSaveReqVO; |
| | | import cn.iocoder.yudao.module.crm.service.cancellation.CrmCancellationService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | import static cn.iocoder.yudao.framework.common.pojo.PageParam.PAGE_SIZE_NONE; |
| | | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| | | |
| | | @Tag(name = "管çåå° - CRM éæ·ç³è¯·") |
| | | @RestController |
| | | @RequestMapping("/crm/cancellation") |
| | | @Validated |
| | | public class CrmCancellationController { |
| | | |
| | | @Resource |
| | | private CrmCancellationService cancellationService; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "åå»ºéæ·ç³è¯·") |
| | | @PreAuthorize("@ss.hasPermission('crm:cancellation:create')") |
| | | public CommonResult<Long> createCancellation(@Valid @RequestBody CrmCancellationSaveReqVO createReqVO) { |
| | | return success(cancellationService.createCancellation(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "æ´æ°éæ·ç³è¯·") |
| | | @PreAuthorize("@ss.hasPermission('crm:cancellation:update')") |
| | | public CommonResult<Boolean> updateCancellation(@Valid @RequestBody CrmCancellationSaveReqVO updateReqVO) { |
| | | cancellationService.updateCancellation(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @PutMapping("/audit") |
| | | @Operation(summary = "审æ¹éæ·ç³è¯·ï¼éè¿/驳åï¼") |
| | | @PreAuthorize("@ss.hasPermission('crm:cancellation:update')") |
| | | public CommonResult<Boolean> auditCancellation(@Valid @RequestBody CrmCancellationAuditReqVO auditReqVO) { |
| | | cancellationService.auditCancellation(auditReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @PutMapping("/submit") |
| | | @Operation(summary = "æäº¤éæ·ç³è¯·å®¡æ¹") |
| | | @PreAuthorize("@ss.hasPermission('crm:cancellation:update')") |
| | | public CommonResult<Boolean> submitCancellation(@RequestParam("id") Long id, |
| | | @RequestParam("processDefinitionKey") String processDefinitionKey) { |
| | | cancellationService.submitCancellation(id, processDefinitionKey, getLoginUserId()); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/approve-process-list") |
| | | @Operation(summary = "è·å¾éæ·ç³è¯·å®¡æ¹æµç¨å®ä¹å表") |
| | | @PreAuthorize("@ss.hasPermission('crm:cancellation:query')") |
| | | public CommonResult<List<Map<String, Object>>> getCancellationApproveProcessDefinitionList() { |
| | | return success(cancellationService.getCancellationApproveProcessDefinitionList()); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤éæ·ç³è¯·") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('crm:cancellation:delete')") |
| | | public CommonResult<Boolean> deleteCancellation(@RequestParam("id") Long id) { |
| | | cancellationService.deleteCancellation(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "è·å¾éæ·ç³è¯·") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('crm:cancellation:query')") |
| | | public CommonResult<CrmCancellationRespVO> getCancellation(@RequestParam("id") Long id) { |
| | | return success(cancellationService.getCancellation(id)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "è·å¾éæ·ç³è¯·å页") |
| | | @PreAuthorize("@ss.hasPermission('crm:cancellation:query')") |
| | | public CommonResult<PageResult<CrmCancellationRespVO>> getCancellationPage(@Valid CrmCancellationPageReqVO pageReqVO) { |
| | | return success(cancellationService.getCancellationPage(pageReqVO)); |
| | | } |
| | | |
| | | @GetMapping("/export-excel") |
| | | @Operation(summary = "导åºéæ·ç³è¯· Excel") |
| | | @PreAuthorize("@ss.hasPermission('crm:cancellation:export')") |
| | | @ApiAccessLog(operateType = EXPORT) |
| | | public void exportCancellationExcel(@Valid CrmCancellationPageReqVO exportReqVO, |
| | | HttpServletResponse response) throws IOException { |
| | | exportReqVO.setPageSize(PAGE_SIZE_NONE); |
| | | List<CrmCancellationRespVO> list = cancellationService.getCancellationList(exportReqVO); |
| | | ExcelUtils.write(response, "éæ·ç³è¯·.xls", "æ°æ®", CrmCancellationRespVO.class, list); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.controller.admin.cancellation.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | @Schema(description = "管çåå° - CRM éæ·ç³è¯·å®¡æ¹ Request VO") |
| | | @Data |
| | | public class CrmCancellationAuditReqVO { |
| | | |
| | | @Schema(description = "éæ·ç³è¯·ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "éæ·ç³è¯·ç¼å·ä¸è½ä¸ºç©º") |
| | | private Long id; |
| | | |
| | | @Schema(description = "审æ¹ç»æï¼20=éè¿ / 30=驳å", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "审æ¹ç»æä¸è½ä¸ºç©º") |
| | | private Integer auditStatus; |
| | | |
| | | @Schema(description = "å®¡æ¹æè§") |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.controller.admin.cancellation.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | @Schema(description = "管çåå° - CRM éæ·ç³è¯·å页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class CrmCancellationPageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "éæ·ç¼å·", example = "CL202608190001") |
| | | private String cancellationNo; |
| | | |
| | | @Schema(description = "客æ·ID", example = "2048") |
| | | private Long customerId; |
| | | |
| | | @Schema(description = "éæ·ç±»å", example = "ELECTRICITY") |
| | | private String cancellationType; |
| | | |
| | | @Schema(description = "审æ¹ç¶æ", example = "0") |
| | | private Integer auditStatus; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.controller.admin.cancellation.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_AUDIT_STATUS; |
| | | import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CANCELLATION_TYPE; |
| | | |
| | | @Schema(description = "管çåå° - CRM éæ·ç³è¯· Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class CrmCancellationRespVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("ç¼å·") |
| | | private Long id; |
| | | |
| | | @Schema(description = "éæ·ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("éæ·ç¼å·") |
| | | private String cancellationNo; |
| | | |
| | | @Schema(description = "客æ·ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("客æ·ID") |
| | | private Long customerId; |
| | | |
| | | @Schema(description = "客æ·åç§°") |
| | | @ExcelProperty("客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | @Schema(description = "ååID") |
| | | @ExcelProperty("ååID") |
| | | private Long contractId; |
| | | |
| | | @Schema(description = "ååç¼å·") |
| | | @ExcelProperty("ååç¼å·") |
| | | private String contractNo; |
| | | |
| | | @Schema(description = "éæ·ç±»å") |
| | | @ExcelProperty(value = "éæ·ç±»å", converter = DictConvert.class) |
| | | @DictFormat(CRM_CANCELLATION_TYPE) |
| | | private String cancellationType; |
| | | |
| | | @Schema(description = "éæ·åå ") |
| | | @ExcelProperty("éæ·åå ") |
| | | private String cancelReason; |
| | | |
| | | @Schema(description = "é¢è®¡éæ·æ¥æ") |
| | | @ExcelProperty("é¢è®¡éæ·æ¥æ") |
| | | private LocalDate expectedCancelDate; |
| | | |
| | | @Schema(description = "å®é
éæ·æ¥æ") |
| | | @ExcelProperty("å®é
éæ·æ¥æ") |
| | | private LocalDate actualCancelDate; |
| | | |
| | | @Schema(description = "éè´¹éé¢") |
| | | @ExcelProperty("éè´¹éé¢") |
| | | private BigDecimal refundAmount; |
| | | |
| | | @Schema(description = "ç³è¯·ç¨æ·ID") |
| | | @ExcelProperty("ç³è¯·ç¨æ·ID") |
| | | private Long applyUserId; |
| | | |
| | | @Schema(description = "ç³è¯·ç¨æ·å§å") |
| | | @ExcelProperty("ç³è¯·ç¨æ·å§å") |
| | | private String applyUserName; |
| | | |
| | | @Schema(description = "ç³è¯·æ¶é´") |
| | | @ExcelProperty("ç³è¯·æ¶é´") |
| | | private LocalDateTime applyTime; |
| | | |
| | | @Schema(description = "审æ¹ç¶æ") |
| | | @ExcelProperty(value = "审æ¹ç¶æ", converter = DictConvert.class) |
| | | @DictFormat(CRM_AUDIT_STATUS) |
| | | private Integer auditStatus; |
| | | |
| | | @Schema(description = "æµç¨å®ä¾ID") |
| | | private String processInstanceId; |
| | | |
| | | @Schema(description = "夿³¨") |
| | | @ExcelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å建æ¶é´") |
| | | @ExcelProperty("å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.controller.admin.cancellation.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CANCELLATION_TYPE; |
| | | |
| | | @Schema(description = "管çåå° - CRM éæ·ç³è¯·æ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | | public class CrmCancellationSaveReqVO { |
| | | |
| | | @Schema(description = "ç¼å·", example = "1024") |
| | | private Long id; |
| | | |
| | | @Schema(description = "éæ·ç¼å·ï¼ä¸ä¼ åèªå¨çæï¼") |
| | | private String cancellationNo; |
| | | |
| | | @Schema(description = "客æ·ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") |
| | | @NotNull(message = "客æ·IDä¸è½ä¸ºç©º") |
| | | private Long customerId; |
| | | |
| | | @Schema(description = "客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | @Schema(description = "ååID", example = "2048") |
| | | private Long contractId; |
| | | |
| | | @Schema(description = "ååç¼å·") |
| | | private String contractNo; |
| | | |
| | | @Schema(description = "éæ·ç±»åï¼ç¨çµéæ·/æå¡ç»æ¢/ååå°æï¼", example = "ELECTRICITY") |
| | | @DictFormat(CRM_CANCELLATION_TYPE) |
| | | private String cancellationType; |
| | | |
| | | @Schema(description = "éæ·åå ") |
| | | private String cancelReason; |
| | | |
| | | @Schema(description = "é¢è®¡éæ·æ¥æ") |
| | | private LocalDate expectedCancelDate; |
| | | |
| | | @Schema(description = "å®é
éæ·æ¥æ") |
| | | private LocalDate actualCancelDate; |
| | | |
| | | @Schema(description = "éè´¹éé¢") |
| | | private BigDecimal refundAmount; |
| | | |
| | | @Schema(description = "ç³è¯·ç¨æ·ID", example = "1") |
| | | private Long applyUserId; |
| | | |
| | | @Schema(description = "ç³è¯·ç¨æ·å§å", example = "æå·¥") |
| | | private String applyUserName; |
| | | |
| | | @Schema(description = "ç³è¯·æ¶é´") |
| | | private LocalDateTime applyTime; |
| | | |
| | | @Schema(description = "审æ¹ç¶æï¼0è稿/10å¾
审æ¹/20éè¿/30驳åï¼", example = "0") |
| | | private Integer auditStatus; |
| | | |
| | | @Schema(description = "æµç¨å®ä¾ID") |
| | | private String processInstanceId; |
| | | |
| | | @Schema(description = "夿³¨") |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.controller.admin.contract; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.command.CrmContractCommandPageReqVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.command.CrmContractCommandRespVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.command.CrmContractCommandSaveReqVO; |
| | | import cn.iocoder.yudao.module.crm.service.contract.CrmContractCommandService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | |
| | | @Tag(name = "管çåå° - CRM ååæä»¤") |
| | | @RestController |
| | | @RequestMapping("/crm/contract-command") |
| | | @Validated |
| | | public class CrmContractCommandController { |
| | | |
| | | @Resource |
| | | private CrmContractCommandService commandService; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "å建ååæä»¤") |
| | | @PreAuthorize("@ss.hasPermission('crm:contract-command:create')") |
| | | public CommonResult<Long> createCommand(@Valid @RequestBody CrmContractCommandSaveReqVO createReqVO) { |
| | | return success(commandService.createCommand(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "æ´æ°ååæä»¤") |
| | | @PreAuthorize("@ss.hasPermission('crm:contract-command:update')") |
| | | public CommonResult<Boolean> updateCommand(@Valid @RequestBody CrmContractCommandSaveReqVO updateReqVO) { |
| | | commandService.updateCommand(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤ååæä»¤") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('crm:contract-command:delete')") |
| | | public CommonResult<Boolean> deleteCommand(@RequestParam("id") Long id) { |
| | | commandService.deleteCommand(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "è·å¾ååæä»¤") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('crm:contract-command:query')") |
| | | public CommonResult<CrmContractCommandRespVO> getCommand(@RequestParam("id") Long id) { |
| | | return success(commandService.getCommand(id)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "è·å¾ååæä»¤å页") |
| | | @PreAuthorize("@ss.hasPermission('crm:contract-command:query')") |
| | | public CommonResult<PageResult<CrmContractCommandRespVO>> getCommandPage(@Valid CrmContractCommandPageReqVO pageReqVO) { |
| | | return success(commandService.getCommandPage(pageReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/execute") |
| | | @Operation(summary = "æ§è¡ååæä»¤") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('crm:contract-command:update')") |
| | | public CommonResult<Boolean> executeCommand(@RequestParam("id") Long id) { |
| | | commandService.executeCommand(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @PutMapping("/cancel") |
| | | @Operation(summary = "åæ¶ååæä»¤") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('crm:contract-command:update')") |
| | | public CommonResult<Boolean> cancelCommand(@RequestParam("id") Long id) { |
| | | commandService.cancelCommand(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/count-by-contract") |
| | | @Operation(summary = "ç»è®¡æååæä»¤æ°é") |
| | | @Parameter(name = "contractId", description = "ååID", required = true) |
| | | @PreAuthorize("@ss.hasPermission('crm:contract-command:query')") |
| | | public CommonResult<Long> countByContract(@RequestParam("contractId") Long contractId) { |
| | | return success(commandService.countByContractId(contractId)); |
| | | } |
| | | |
| | | } |
| | |
| | | import cn.iocoder.yudao.module.mdm.api.item.dto.MdmItemRespDTO; |
| | | import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService; |
| | | import cn.iocoder.yudao.module.crm.service.contact.CrmContactService; |
| | | import cn.iocoder.yudao.module.crm.service.contract.CrmContractCommandService; |
| | | import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; |
| | | import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; |
| | | import cn.iocoder.yudao.module.crm.service.invoice.CrmInvoiceService; |
| | |
| | | private CrmReceivableService receivableService; |
| | | @Resource |
| | | private CrmInvoiceService invoiceService; |
| | | @Resource |
| | | private CrmContractCommandService contractCommandService; |
| | | |
| | | @Resource |
| | | private MdmItemApi mdmItemApi; |
| | |
| | | if (contractVO.getTotalPrice() != null && contractVO.getTotalInvoicePrice() != null) { |
| | | contractVO.setUnInvoicePrice(contractVO.getTotalPrice().subtract(contractVO.getTotalInvoicePrice())); |
| | | } |
| | | // 2.8 设置æä»¤ä¸åæ°é |
| | | contractVO.setCommandCount(contractCommandService.countByContractId(contractVO.getId())); |
| | | }); |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.controller.admin.contract.vo.command; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | @Schema(description = "管çåå° - CRM ååæä»¤å页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class CrmContractCommandPageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "ååID", example = "2048") |
| | | private Long contractId; |
| | | |
| | | @Schema(description = "æä»¤ç±»å", example = "METER_READ") |
| | | private String commandType; |
| | | |
| | | @Schema(description = "ç¶æ", example = "0") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "ä¸å¡åå·", example = "MD001") |
| | | private String bizNo; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.controller.admin.contract.vo.command; |
| | | |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_COMMAND_STATUS; |
| | | import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_COMMAND_TYPE; |
| | | |
| | | @Schema(description = "管çåå° - CRM ååæä»¤ Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class CrmContractCommandRespVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("ç¼å·") |
| | | private Long id; |
| | | |
| | | @Schema(description = "ååID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("ååID") |
| | | private Long contractId; |
| | | |
| | | @Schema(description = "ååç¼å·") |
| | | @ExcelProperty("ååç¼å·") |
| | | private String contractNo; |
| | | |
| | | @Schema(description = "æä»¤ç±»å") |
| | | @ExcelProperty(value = "æä»¤ç±»å", converter = DictConvert.class) |
| | | @DictFormat(CRM_COMMAND_TYPE) |
| | | private String commandType; |
| | | |
| | | @Schema(description = "ç®æ 模å") |
| | | @ExcelProperty("ç®æ 模å") |
| | | private String targetModule; |
| | | |
| | | @Schema(description = "ç®æ è®°å½ID") |
| | | @ExcelProperty("ç®æ è®°å½ID") |
| | | private Long targetId; |
| | | |
| | | @Schema(description = "ä¸å¡åå·") |
| | | @ExcelProperty("ä¸å¡åå·") |
| | | private String bizNo; |
| | | |
| | | @Schema(description = "æä½äººID") |
| | | @ExcelProperty("æä½äººID") |
| | | private Long operatorId; |
| | | |
| | | @Schema(description = "æä½äººå§å") |
| | | @ExcelProperty("æä½äººå§å") |
| | | private String operatorName; |
| | | |
| | | @Schema(description = "æä½æ¶é´") |
| | | @ExcelProperty("æä½æ¶é´") |
| | | private LocalDateTime operateTime; |
| | | |
| | | @Schema(description = "ç¶æ") |
| | | @ExcelProperty(value = "ç¶æ", converter = DictConvert.class) |
| | | @DictFormat(CRM_COMMAND_STATUS) |
| | | private Integer status; |
| | | |
| | | @Schema(description = "夿³¨") |
| | | @ExcelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å建æ¶é´") |
| | | @ExcelProperty("å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.controller.admin.contract.vo.command; |
| | | |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_COMMAND_STATUS; |
| | | import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_COMMAND_TYPE; |
| | | |
| | | @Schema(description = "管çåå° - CRM ååæä»¤æ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | | public class CrmContractCommandSaveReqVO { |
| | | |
| | | @Schema(description = "ç¼å·", example = "1024") |
| | | private Long id; |
| | | |
| | | @Schema(description = "ååID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") |
| | | @NotNull(message = "ååIDä¸è½ä¸ºç©º") |
| | | private Long contractId; |
| | | |
| | | @Schema(description = "ååç¼å·") |
| | | private String contractNo; |
| | | |
| | | @Schema(description = "æä»¤ç±»åï¼ä¸å表/æè¡¨ä»»å¡/æå¡å·¥åï¼", example = "METER_READ") |
| | | @DictFormat(CRM_COMMAND_TYPE) |
| | | private String commandType; |
| | | |
| | | @Schema(description = "ç®æ 模å", example = "mes-metering") |
| | | private String targetModule; |
| | | |
| | | @Schema(description = "ç®æ è®°å½ID") |
| | | private Long targetId; |
| | | |
| | | @Schema(description = "ä¸å¡åå·") |
| | | private String bizNo; |
| | | |
| | | @Schema(description = "æä½äººID", example = "1") |
| | | private Long operatorId; |
| | | |
| | | @Schema(description = "æä½äººå§å", example = "æå·¥") |
| | | private String operatorName; |
| | | |
| | | @Schema(description = "æä½æ¶é´") |
| | | private LocalDateTime operateTime; |
| | | |
| | | @Schema(description = "ç¶æï¼0å¾
æ§è¡/10å·²ä¸å/20已宿/30已忶ï¼", example = "0") |
| | | @DictFormat(CRM_COMMAND_STATUS) |
| | | private Integer status; |
| | | |
| | | @Schema(description = "夿³¨") |
| | | private String remark; |
| | | |
| | | } |
| | |
| | | @ExcelProperty(value = "夿³¨", index = 11) |
| | | private String remark; |
| | | |
| | | @Schema(description = "ååç±»å", example = "power") |
| | | private String contractType; |
| | | |
| | | @Schema(description = "çµåç级", example = "10kV") |
| | | private String voltageLevel; |
| | | |
| | | @Schema(description = "ç¨çµç±»å", example = "industrial") |
| | | private String electricityType; |
| | | |
| | | @Schema(description = "åå容éï¼kVAï¼", example = "800") |
| | | private BigDecimal contractCapacity; |
| | | |
| | | @Schema(description = "çµä»·æ¨¡å¼", example = "two-part") |
| | | private String tariffMode; |
| | | |
| | | @Schema(description = "è®¡éæ¹å¼", example = "high-high") |
| | | private String meterMode; |
| | | |
| | | @Schema(description = "ç¼´è´¹å¨æï¼æï¼", example = "12") |
| | | private Integer payCycle; |
| | | |
| | | @Schema(description = "æä»¤æ°é") |
| | | private Long commandCount; |
| | | |
| | | @Schema(description = "å建æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty(value = "å建æ¶é´", index = 18) |
| | | private LocalDateTime createTime; |
| | |
| | | @DiffLogField(name = "夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "ååç±»åï¼power/energy/resident/solarï¼", example = "power") |
| | | @DiffLogField(name = "ååç±»å") |
| | | private String contractType; |
| | | |
| | | @Schema(description = "çµåç级", example = "10kV") |
| | | private String voltageLevel; |
| | | |
| | | @Schema(description = "ç¨çµç±»å", example = "industrial") |
| | | private String electricityType; |
| | | |
| | | @Schema(description = "åå容éï¼kVAï¼", example = "800") |
| | | private BigDecimal contractCapacity; |
| | | |
| | | @Schema(description = "çµä»·æ¨¡å¼", example = "two-part") |
| | | private String tariffMode; |
| | | |
| | | @Schema(description = "è®¡éæ¹å¼", example = "high-high") |
| | | private String meterMode; |
| | | |
| | | @Schema(description = "ç¼´è´¹å¨æï¼æï¼", example = "12") |
| | | private Integer payCycle; |
| | | |
| | | @Schema(description = "产åå表") |
| | | private List<Product> products; |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.controller.admin.credit; |
| | | |
| | | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.credit.vo.CrmCreditRatingPageReqVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.credit.vo.CrmCreditRatingRespVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.credit.vo.CrmCreditRatingSaveReqVO; |
| | | import cn.iocoder.yudao.module.crm.service.credit.CrmCreditRatingService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | import static cn.iocoder.yudao.framework.common.pojo.PageParam.PAGE_SIZE_NONE; |
| | | |
| | | @Tag(name = "管çåå° - CRM 客æ·ä¿¡ç¨è¯çº§") |
| | | @RestController |
| | | @RequestMapping("/crm/credit-rating") |
| | | @Validated |
| | | public class CrmCreditRatingController { |
| | | |
| | | @Resource |
| | | private CrmCreditRatingService creditRatingService; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "å建客æ·ä¿¡ç¨è¯çº§") |
| | | @PreAuthorize("@ss.hasPermission('crm:credit-rating:create')") |
| | | public CommonResult<Long> createCreditRating(@Valid @RequestBody CrmCreditRatingSaveReqVO createReqVO) { |
| | | return success(creditRatingService.createCreditRating(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "æ´æ°å®¢æ·ä¿¡ç¨è¯çº§") |
| | | @PreAuthorize("@ss.hasPermission('crm:credit-rating:update')") |
| | | public CommonResult<Boolean> updateCreditRating(@Valid @RequestBody CrmCreditRatingSaveReqVO updateReqVO) { |
| | | creditRatingService.updateCreditRating(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤å®¢æ·ä¿¡ç¨è¯çº§") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('crm:credit-rating:delete')") |
| | | public CommonResult<Boolean> deleteCreditRating(@RequestParam("id") Long id) { |
| | | creditRatingService.deleteCreditRating(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "è·å¾å®¢æ·ä¿¡ç¨è¯çº§") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('crm:credit-rating:query')") |
| | | public CommonResult<CrmCreditRatingRespVO> getCreditRating(@RequestParam("id") Long id) { |
| | | return success(creditRatingService.getCreditRating(id)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "è·å¾å®¢æ·ä¿¡ç¨è¯çº§å页") |
| | | @PreAuthorize("@ss.hasPermission('crm:credit-rating:query')") |
| | | public CommonResult<PageResult<CrmCreditRatingRespVO>> getCreditRatingPage(@Valid CrmCreditRatingPageReqVO pageReqVO) { |
| | | return success(creditRatingService.getCreditRatingPage(pageReqVO)); |
| | | } |
| | | |
| | | @GetMapping("/export-excel") |
| | | @Operation(summary = "导åºå®¢æ·ä¿¡ç¨è¯çº§ Excel") |
| | | @PreAuthorize("@ss.hasPermission('crm:credit-rating:export')") |
| | | @ApiAccessLog(operateType = EXPORT) |
| | | public void exportCreditRatingExcel(@Valid CrmCreditRatingPageReqVO exportReqVO, |
| | | HttpServletResponse response) throws IOException { |
| | | exportReqVO.setPageSize(PAGE_SIZE_NONE); |
| | | List<CrmCreditRatingRespVO> list = creditRatingService.getCreditRatingList(exportReqVO); |
| | | ExcelUtils.write(response, "客æ·ä¿¡ç¨è¯çº§.xls", "æ°æ®", CrmCreditRatingRespVO.class, list); |
| | | } |
| | | |
| | | @GetMapping("/latest-by-customer") |
| | | @Operation(summary = "è·åå®¢æ·ææ°ä¿¡ç¨è¯çº§") |
| | | @Parameter(name = "customerId", description = "客æ·ID", required = true) |
| | | @PreAuthorize("@ss.hasPermission('crm:credit-rating:query')") |
| | | public CommonResult<CrmCreditRatingRespVO> getLatestByCustomer(@RequestParam("customerId") Long customerId) { |
| | | return success(creditRatingService.getLatestByCustomerId(customerId)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.controller.admin.credit.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | @Schema(description = "管çåå° - CRM 客æ·ä¿¡ç¨è¯çº§å页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class CrmCreditRatingPageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "客æ·ID", example = "2048") |
| | | private Long customerId; |
| | | |
| | | @Schema(description = "ä¿¡ç¨ç级", example = "B") |
| | | private String level; |
| | | |
| | | @Schema(description = "è¯å®ç±»å", example = "INITIAL") |
| | | private String evalType; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.controller.admin.credit.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CREDIT_LEVEL; |
| | | |
| | | @Schema(description = "管çåå° - CRM 客æ·ä¿¡ç¨è¯çº§ Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class CrmCreditRatingRespVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("ç¼å·") |
| | | private Long id; |
| | | |
| | | @Schema(description = "客æ·ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("客æ·ID") |
| | | private Long customerId; |
| | | |
| | | @Schema(description = "客æ·åç§°", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | @Schema(description = "ä¿¡ç¨ç级") |
| | | @ExcelProperty(value = "ä¿¡ç¨ç级", converter = DictConvert.class) |
| | | @DictFormat(CRM_CREDIT_LEVEL) |
| | | private String level; |
| | | |
| | | @Schema(description = "ä¿¡ç¨å") |
| | | @ExcelProperty("ä¿¡ç¨å") |
| | | private Integer score; |
| | | |
| | | @Schema(description = "è¯å®ç±»å") |
| | | @ExcelProperty("è¯å®ç±»å") |
| | | private String evalType; |
| | | |
| | | @Schema(description = "è¯å®çç±") |
| | | @ExcelProperty("è¯å®çç±") |
| | | private String evalReason; |
| | | |
| | | @Schema(description = "æä½äººID") |
| | | @ExcelProperty("æä½äººID") |
| | | private Long operatorId; |
| | | |
| | | @Schema(description = "æä½äººå§å") |
| | | @ExcelProperty("æä½äººå§å") |
| | | private String operatorName; |
| | | |
| | | @Schema(description = "æä½æ¶é´") |
| | | @ExcelProperty("æä½æ¶é´") |
| | | private LocalDateTime operateTime; |
| | | |
| | | @Schema(description = "æææè³") |
| | | @ExcelProperty("æææè³") |
| | | private LocalDateTime validUntil; |
| | | |
| | | @Schema(description = "夿³¨") |
| | | @ExcelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å建æ¶é´") |
| | | @ExcelProperty("å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.controller.admin.credit.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CREDIT_LEVEL; |
| | | |
| | | @Schema(description = "管çåå° - CRM 客æ·ä¿¡ç¨è¯çº§æ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | | public class CrmCreditRatingSaveReqVO { |
| | | |
| | | @Schema(description = "ç¼å·", example = "1024") |
| | | private Long id; |
| | | |
| | | @Schema(description = "客æ·ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") |
| | | @NotNull(message = "客æ·IDä¸è½ä¸ºç©º") |
| | | private Long customerId; |
| | | |
| | | @Schema(description = "ä¿¡ç¨ç级ï¼A+/A/B+/B/C/C-/Dï¼", example = "B") |
| | | @DictFormat(CRM_CREDIT_LEVEL) |
| | | private String level; |
| | | |
| | | @Schema(description = "ä¿¡ç¨åï¼0-100ï¼", example = "85") |
| | | private Integer score; |
| | | |
| | | @Schema(description = "è¯å®ç±»åï¼åè¯/å¤è¯/å¨æè°æ´ï¼", example = "INITIAL") |
| | | private String evalType; |
| | | |
| | | @Schema(description = "è¯å®çç±", example = "è¿12个æç¨çµä¿¡ç¨è¯å¥½") |
| | | private String evalReason; |
| | | |
| | | @Schema(description = "æä½äººID", example = "1") |
| | | private Long operatorId; |
| | | |
| | | @Schema(description = "æä½äººå§å", example = "æå·¥") |
| | | private String operatorName; |
| | | |
| | | @Schema(description = "æä½æ¶é´") |
| | | private LocalDateTime operateTime; |
| | | |
| | | @Schema(description = "æææè³") |
| | | private LocalDateTime validUntil; |
| | | |
| | | @Schema(description = "夿³¨") |
| | | private String remark; |
| | | |
| | | } |
| | |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerPoolConfigDO; |
| | | import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerPoolConfigService; |
| | | import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; |
| | | import cn.iocoder.yudao.module.crm.service.receivable.CrmReceivablePlanService; |
| | | import cn.iocoder.yudao.module.system.api.dept.DeptApi; |
| | | import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.stream.Stream; |
| | | |
| | | import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| | |
| | | private CrmCustomerService customerService; |
| | | @Resource |
| | | private CrmCustomerPoolConfigService customerPoolConfigService; |
| | | @Resource |
| | | private CrmReceivablePlanService receivablePlanService; |
| | | |
| | | @Resource |
| | | private DeptApi deptApi; |
| | |
| | | Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap(convertSet(userMap.values(), AdminUserRespDTO::getDeptId)); |
| | | // 1.2 è·åè·ç¦»è¿å
¥å
¬æµ·çæ¶é´ |
| | | Map<Long, Long> poolDayMap = getPoolDayMap(list); |
| | | // 1.3 è·åæ¬ è´¹éé¢ãæ¬ è´¹ç¬æ°ï¼æªå款 + 已龿ç忬¾è®¡åï¼ |
| | | Set<Long> customerIds = convertSet(list, CrmCustomerDO::getId); |
| | | Map<Long, BigDecimal> overdueAmountMap = receivablePlanService.getOverdueAmountMapByCustomerIds(customerIds); |
| | | Map<Long, Integer> overdueCountMap = receivablePlanService.getOverdueCountMapByCustomerIds(customerIds); |
| | | // 2. è½¬æ¢æ VO |
| | | return BeanUtils.toBean(list, CrmCustomerRespVO.class, customerVO -> { |
| | | customerVO.setAreaName(AreaUtils.format(customerVO.getAreaId())); |
| | |
| | | if (customerVO.getOwnerUserId() != null) { |
| | | customerVO.setPoolDay(poolDayMap.get(customerVO.getId())); |
| | | } |
| | | // 2.3 è®¾ç½®æ¬ è´¹é£é©ï¼æ¬ è´¹éé¢/æ¬ è´¹ç¬æ°ï¼ |
| | | customerVO.setOverdueAmount(overdueAmountMap.get(customerVO.getId())); |
| | | customerVO.setOverdueCount(overdueCountMap.get(customerVO.getId())); |
| | | }); |
| | | } |
| | | |
| | |
| | | @Schema(description = "å®¢æ·æ¥æº", example = "1") |
| | | private Integer source; |
| | | |
| | | @Schema(description = "客æ·åç±»", example = "industrial") |
| | | private String customerType; |
| | | |
| | | @Schema(description = "å½åä¿¡ç¨ç级", example = "B") |
| | | private String creditLevel; |
| | | |
| | | @Schema(description = "åºæ¯ç±»å", example = "1") |
| | | @InEnum(CrmSceneTypeEnum.class) |
| | | private Integer sceneType; // åºæ¯ç±»åï¼ä¸º null æ¶å表示å
¨é¨ |
| | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - CRM å®¢æ· Response VO") |
| | |
| | | @Schema(description = "è·ç¦»å å
¥å
¬æµ·æ¶é´", example = "1") |
| | | private Long poolDay; |
| | | |
| | | @Schema(description = "客æ·åç±»ï¼çµåCRMæ©å±ï¼", example = "industrial") |
| | | @ExcelProperty(value = "客æ·åç±»", converter = DictConvert.class) |
| | | @DictFormat(cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_TYPE) |
| | | private String customerType; |
| | | |
| | | @Schema(description = "å½åä¿¡ç¨ç级", example = "B") |
| | | @ExcelProperty(value = "ä¿¡ç¨ç级", converter = DictConvert.class) |
| | | @DictFormat(cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CREDIT_LEVEL) |
| | | private String creditLevel; |
| | | |
| | | @Schema(description = "å½åä¿¡ç¨å", example = "85") |
| | | @ExcelProperty("ä¿¡ç¨å") |
| | | private Integer creditScore; |
| | | |
| | | @Schema(description = "æ¬ è´¹éé¢ï¼æªå款+龿ç忬¾è®¡åå计ï¼", example = "1200.00") |
| | | @ExcelProperty("æ¬ è´¹éé¢") |
| | | private BigDecimal overdueAmount; |
| | | |
| | | @Schema(description = "æ¬ è´¹ç¬æ°", example = "3") |
| | | @ExcelProperty("æ¬ è´¹ç¬æ°") |
| | | private Integer overdueCount; |
| | | |
| | | } |
| | |
| | | |
| | | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| | | import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_INDUSTRY; |
| | | import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_TYPE; |
| | | |
| | | @Schema(description = "管çåå° - CRM å®¢æ·æ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | |
| | | @DiffLogField(name = "夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "客æ·åç±»ï¼æ¿ä¼/å·¥ä¸/å±
æ°/åä¸/åä¸ï¼", example = "industrial") |
| | | @DiffLogField(name = "客æ·åç±»") |
| | | @DictFormat(CRM_CUSTOMER_TYPE) |
| | | private String customerType; |
| | | |
| | | } |
| | |
| | | @ExcelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "æ¥ä»·ç±»å", example = "power") |
| | | @ExcelProperty("æ¥ä»·ç±»å") |
| | | private String quotationType; |
| | | |
| | | @Schema(description = "åå容éï¼kVAï¼", example = "800") |
| | | @ExcelProperty("åå容é") |
| | | private BigDecimal capacity; |
| | | |
| | | @Schema(description = "æå¤§ééï¼kWï¼", example = "400") |
| | | @ExcelProperty("æå¤§éé") |
| | | private BigDecimal maxDemand; |
| | | |
| | | @Schema(description = "çµåº¦åä»·ï¼å
/kWhï¼", example = "0.5283") |
| | | @ExcelProperty("çµåº¦åä»·") |
| | | private BigDecimal unitPrice; |
| | | |
| | | @Schema(description = "çµä»·æ¨¡å¼", example = "two-part") |
| | | @ExcelProperty("çµä»·æ¨¡å¼") |
| | | private String tariffMode; |
| | | |
| | | @Schema(description = "åè°çµè´¹ï¼å
ï¼", example = "120.5") |
| | | @ExcelProperty("åè°çµè´¹") |
| | | private BigDecimal powerFactorFee; |
| | | |
| | | @Schema(description = "ç»ç®å¨æï¼æï¼", example = "12") |
| | | @ExcelProperty("ç»ç®å¨æ") |
| | | private Integer billingCycle; |
| | | |
| | | @Schema(description = "å建æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | |
| | | @Schema(description = "夿³¨", example = "夿³¨ä¿¡æ¯") |
| | | private String remark; |
| | | |
| | | @Schema(description = "æ¥ä»·ç±»åï¼general=éç¨/power=çµå/energy=è½æºæå¡ï¼", example = "power") |
| | | private String quotationType; |
| | | |
| | | @Schema(description = "åå容éï¼kVAï¼", example = "800") |
| | | private BigDecimal capacity; |
| | | |
| | | @Schema(description = "æå¤§ééï¼kWï¼", example = "400") |
| | | private BigDecimal maxDemand; |
| | | |
| | | @Schema(description = "çµåº¦åä»·ï¼å
/kWhï¼", example = "0.5283") |
| | | private BigDecimal unitPrice; |
| | | |
| | | @Schema(description = "çµä»·æ¨¡å¼ï¼single/two-part/tier/touï¼", example = "two-part") |
| | | private String tariffMode; |
| | | |
| | | @Schema(description = "åè°çµè´¹ï¼å
ï¼", example = "120.5") |
| | | private BigDecimal powerFactorFee; |
| | | |
| | | @Schema(description = "ç»ç®å¨æï¼æï¼", example = "12") |
| | | private Integer billingCycle; |
| | | |
| | | @Schema(description = "ç©ææç»å表", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotEmpty(message = "ç©ææç»ä¸è½ä¸ºç©º") |
| | | private List<Item> items; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.controller.admin.refund; |
| | | |
| | | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.refund.vo.CrmRefundAuditReqVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.refund.vo.CrmRefundPageReqVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.refund.vo.CrmRefundRespVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.refund.vo.CrmRefundSaveReqVO; |
| | | import cn.iocoder.yudao.module.crm.service.refund.CrmRefundService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | import static cn.iocoder.yudao.framework.common.pojo.PageParam.PAGE_SIZE_NONE; |
| | | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| | | |
| | | @Tag(name = "管çåå° - CRM éè´¹å") |
| | | @RestController |
| | | @RequestMapping("/crm/refund") |
| | | @Validated |
| | | public class CrmRefundController { |
| | | |
| | | @Resource |
| | | private CrmRefundService refundService; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "å建éè´¹å") |
| | | @PreAuthorize("@ss.hasPermission('crm:refund:create')") |
| | | public CommonResult<Long> createRefund(@Valid @RequestBody CrmRefundSaveReqVO createReqVO) { |
| | | return success(refundService.createRefund(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "æ´æ°éè´¹å") |
| | | @PreAuthorize("@ss.hasPermission('crm:refund:update')") |
| | | public CommonResult<Boolean> updateRefund(@Valid @RequestBody CrmRefundSaveReqVO updateReqVO) { |
| | | refundService.updateRefund(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @PutMapping("/audit") |
| | | @Operation(summary = "审æ¹éè´¹åï¼éè¿/驳åï¼") |
| | | @PreAuthorize("@ss.hasPermission('crm:refund:update')") |
| | | public CommonResult<Boolean> auditRefund(@Valid @RequestBody CrmRefundAuditReqVO auditReqVO) { |
| | | refundService.auditRefund(auditReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @PutMapping("/submit") |
| | | @Operation(summary = "æäº¤éè´¹å审æ¹") |
| | | @PreAuthorize("@ss.hasPermission('crm:refund:update')") |
| | | public CommonResult<Boolean> submitRefund(@RequestParam("id") Long id, |
| | | @RequestParam("processDefinitionKey") String processDefinitionKey) { |
| | | refundService.submitRefund(id, processDefinitionKey, getLoginUserId()); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/approve-process-list") |
| | | @Operation(summary = "è·å¾éè´¹åå®¡æ¹æµç¨å®ä¹å表") |
| | | @PreAuthorize("@ss.hasPermission('crm:refund:query')") |
| | | public CommonResult<List<Map<String, Object>>> getRefundApproveProcessDefinitionList() { |
| | | return success(refundService.getRefundApproveProcessDefinitionList()); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤éè´¹å") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('crm:refund:delete')") |
| | | public CommonResult<Boolean> deleteRefund(@RequestParam("id") Long id) { |
| | | refundService.deleteRefund(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "è·å¾éè´¹å") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('crm:refund:query')") |
| | | public CommonResult<CrmRefundRespVO> getRefund(@RequestParam("id") Long id) { |
| | | return success(refundService.getRefund(id)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "è·å¾éè´¹åå页") |
| | | @PreAuthorize("@ss.hasPermission('crm:refund:query')") |
| | | public CommonResult<PageResult<CrmRefundRespVO>> getRefundPage(@Valid CrmRefundPageReqVO pageReqVO) { |
| | | return success(refundService.getRefundPage(pageReqVO)); |
| | | } |
| | | |
| | | @GetMapping("/export-excel") |
| | | @Operation(summary = "导åºéè´¹å Excel") |
| | | @PreAuthorize("@ss.hasPermission('crm:refund:export')") |
| | | @ApiAccessLog(operateType = EXPORT) |
| | | public void exportRefundExcel(@Valid CrmRefundPageReqVO exportReqVO, |
| | | HttpServletResponse response) throws IOException { |
| | | exportReqVO.setPageSize(PAGE_SIZE_NONE); |
| | | List<CrmRefundRespVO> list = refundService.getRefundList(exportReqVO); |
| | | ExcelUtils.write(response, "éè´¹å.xls", "æ°æ®", CrmRefundRespVO.class, list); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.controller.admin.refund.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | @Schema(description = "管çåå° - CRM éè´¹åå®¡æ¹ Request VO") |
| | | @Data |
| | | public class CrmRefundAuditReqVO { |
| | | |
| | | @Schema(description = "éè´¹åç¼å·", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "éè´¹åç¼å·ä¸è½ä¸ºç©º") |
| | | private Long id; |
| | | |
| | | @Schema(description = "审æ¹ç»æï¼20=éè¿ / 30=驳å", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "审æ¹ç»æä¸è½ä¸ºç©º") |
| | | private Integer auditStatus; |
| | | |
| | | @Schema(description = "å®¡æ¹æè§") |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.controller.admin.refund.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | @Schema(description = "管çåå° - CRM éè´¹åå页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | public class CrmRefundPageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "éè´¹åå·", example = "RF202608190001") |
| | | private String refundNo; |
| | | |
| | | @Schema(description = "客æ·ID", example = "2048") |
| | | private Long customerId; |
| | | |
| | | @Schema(description = "é费类å", example = "ELECTRICITY") |
| | | private String refundType; |
| | | |
| | | @Schema(description = "审æ¹ç¶æ", example = "0") |
| | | private Integer auditStatus; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.controller.admin.refund.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_AUDIT_STATUS; |
| | | import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_REFUND_TYPE; |
| | | |
| | | @Schema(description = "管çåå° - CRM éè´¹å Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class CrmRefundRespVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("ç¼å·") |
| | | private Long id; |
| | | |
| | | @Schema(description = "éè´¹åå·", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("éè´¹åå·") |
| | | private String refundNo; |
| | | |
| | | @Schema(description = "客æ·ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("客æ·ID") |
| | | private Long customerId; |
| | | |
| | | @Schema(description = "客æ·åç§°") |
| | | @ExcelProperty("客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | @Schema(description = "ååID") |
| | | @ExcelProperty("ååID") |
| | | private Long contractId; |
| | | |
| | | @Schema(description = "ååç¼å·") |
| | | @ExcelProperty("ååç¼å·") |
| | | private String contractNo; |
| | | |
| | | @Schema(description = "é费类å") |
| | | @ExcelProperty(value = "é费类å", converter = DictConvert.class) |
| | | @DictFormat(CRM_REFUND_TYPE) |
| | | private String refundType; |
| | | |
| | | @Schema(description = "éè´¹éé¢") |
| | | @ExcelProperty("éè´¹éé¢") |
| | | private BigDecimal refundAmount; |
| | | |
| | | @Schema(description = "éè´¹åå ") |
| | | @ExcelProperty("éè´¹åå ") |
| | | private String refundReason; |
| | | |
| | | @Schema(description = "ç³è¯·ç¨æ·ID") |
| | | @ExcelProperty("ç³è¯·ç¨æ·ID") |
| | | private Long applyUserId; |
| | | |
| | | @Schema(description = "ç³è¯·ç¨æ·å§å") |
| | | @ExcelProperty("ç³è¯·ç¨æ·å§å") |
| | | private String applyUserName; |
| | | |
| | | @Schema(description = "ç³è¯·æ¶é´") |
| | | @ExcelProperty("ç³è¯·æ¶é´") |
| | | private LocalDateTime applyTime; |
| | | |
| | | @Schema(description = "审æ¹ç¶æ") |
| | | @ExcelProperty(value = "审æ¹ç¶æ", converter = DictConvert.class) |
| | | @DictFormat(CRM_AUDIT_STATUS) |
| | | private Integer auditStatus; |
| | | |
| | | @Schema(description = "æµç¨å®ä¾ID") |
| | | private String processInstanceId; |
| | | |
| | | @Schema(description = "夿³¨") |
| | | @ExcelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å建æ¶é´") |
| | | @ExcelProperty("å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.controller.admin.refund.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | import static cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_REFUND_TYPE; |
| | | |
| | | @Schema(description = "管çåå° - CRM éè´¹åæ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | | public class CrmRefundSaveReqVO { |
| | | |
| | | @Schema(description = "ç¼å·", example = "1024") |
| | | private Long id; |
| | | |
| | | @Schema(description = "éè´¹åå·ï¼ä¸ä¼ åèªå¨çæï¼") |
| | | private String refundNo; |
| | | |
| | | @Schema(description = "客æ·ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") |
| | | @NotNull(message = "客æ·IDä¸è½ä¸ºç©º") |
| | | private Long customerId; |
| | | |
| | | @Schema(description = "客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | @Schema(description = "ååID", example = "2048") |
| | | private Long contractId; |
| | | |
| | | @Schema(description = "ååç¼å·") |
| | | private String contractNo; |
| | | |
| | | @Schema(description = "é费类åï¼çµè´¹éè´¹/æå¡é订/容ééè´¹ï¼", example = "ELECTRICITY") |
| | | @DictFormat(CRM_REFUND_TYPE) |
| | | private String refundType; |
| | | |
| | | @Schema(description = "éè´¹éé¢", requiredMode = Schema.RequiredMode.REQUIRED, example = "500.00") |
| | | @NotNull(message = "éè´¹éé¢ä¸è½ä¸ºç©º") |
| | | private BigDecimal refundAmount; |
| | | |
| | | @Schema(description = "éè´¹åå ") |
| | | private String refundReason; |
| | | |
| | | @Schema(description = "ç³è¯·ç¨æ·ID", example = "1") |
| | | private Long applyUserId; |
| | | |
| | | @Schema(description = "ç³è¯·ç¨æ·å§å", example = "æå·¥") |
| | | private String applyUserName; |
| | | |
| | | @Schema(description = "ç³è¯·æ¶é´") |
| | | private LocalDateTime applyTime; |
| | | |
| | | @Schema(description = "审æ¹ç¶æï¼0è稿/10å¾
审æ¹/20éè¿/30驳åï¼", example = "0") |
| | | private Integer auditStatus; |
| | | |
| | | @Schema(description = "æµç¨å®ä¾ID") |
| | | private String processInstanceId; |
| | | |
| | | @Schema(description = "夿³¨") |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.dal.dataobject.cancellation; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.crm.enums.DictTypeConstants; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * CRM éæ·ç³è¯· DO |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @TableName("crm_cancellation") |
| | | @KeySequence("crm_cancellation_seq") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class CrmCancellationDO extends BaseDO { |
| | | |
| | | @TableId |
| | | private Long id; |
| | | private String cancellationNo; |
| | | private Long customerId; |
| | | private String customerName; |
| | | private Long contractId; |
| | | private String contractNo; |
| | | /** |
| | | * éæ·ç±»åï¼ç¨çµéæ·/æå¡ç»æ¢/ååå°æï¼åå
¸ crm_cancellation_typeï¼ |
| | | */ |
| | | private String cancellationType; |
| | | private String cancelReason; |
| | | private LocalDate expectedCancelDate; |
| | | private LocalDate actualCancelDate; |
| | | private BigDecimal refundAmount; |
| | | private Long applyUserId; |
| | | private String applyUserName; |
| | | private LocalDateTime applyTime; |
| | | /** |
| | | * 审æ¹ç¶æï¼0è稿/10å¾
审æ¹/20éè¿/30驳å |
| | | */ |
| | | private Integer auditStatus; |
| | | private String processInstanceId; |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.dal.dataobject.contract; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.crm.enums.DictTypeConstants; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * CRM ååæä»¤ä¸å DO |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @TableName("crm_contract_command") |
| | | @KeySequence("crm_contract_command_seq") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class CrmContractCommandDO extends BaseDO { |
| | | |
| | | @TableId |
| | | private Long id; |
| | | private Long contractId; |
| | | private String contractNo; |
| | | /** |
| | | * æä»¤ç±»åï¼ä¸å表/æè¡¨ä»»å¡/æå¡å·¥åï¼åå
¸ crm_command_typeï¼ |
| | | */ |
| | | private String commandType; |
| | | /** |
| | | * ç®æ 模åï¼mes-work-order/mes-metering/srm-service |
| | | */ |
| | | private String targetModule; |
| | | private Long targetId; |
| | | private String bizNo; |
| | | private Long operatorId; |
| | | private String operatorName; |
| | | private LocalDateTime operateTime; |
| | | /** |
| | | * ç¶æï¼0å¾
æ§è¡/10å·²ä¸å/20已宿/30已忶ï¼åå
¸ crm_command_statusï¼ |
| | | */ |
| | | private Integer status; |
| | | private String remark; |
| | | |
| | | } |
| | |
| | | */ |
| | | private String remark; |
| | | |
| | | /** |
| | | * ååç±»åï¼çµåCRMæ©å±ï¼ |
| | | * |
| | | * åå
¸ crm_contract_typeï¼power=ä¾ç¨çµåå / energy=è½æºæå¡åå / resident=å±
é
åå / solar=å
ä¼åå |
| | | */ |
| | | private String contractType; |
| | | /** |
| | | * çµåç级 |
| | | * |
| | | * åå
¸ crm_voltage_level |
| | | */ |
| | | private String voltageLevel; |
| | | /** |
| | | * ç¨çµç±»å |
| | | * |
| | | * åå
¸ crm_electricity_type |
| | | */ |
| | | private String electricityType; |
| | | /** |
| | | * åå容éï¼kVAï¼ |
| | | */ |
| | | private BigDecimal contractCapacity; |
| | | /** |
| | | * çµä»·æ¨¡å¼ |
| | | * |
| | | * åå
¸ crm_tariff_mode |
| | | */ |
| | | private String tariffMode; |
| | | /** |
| | | * è®¡éæ¹å¼ |
| | | * |
| | | * åå
¸ crm_meter_mode |
| | | */ |
| | | private String meterMode; |
| | | /** |
| | | * ç¼´è´¹å¨æï¼æï¼ |
| | | */ |
| | | private Integer payCycle; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.dal.dataobject.credit; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.crm.enums.DictTypeConstants; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * CRM 客æ·ä¿¡ç¨è¯çº§ DO |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @TableName("crm_credit_rating") |
| | | @KeySequence("crm_credit_rating_seq") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class CrmCreditRatingDO extends BaseDO { |
| | | |
| | | @TableId |
| | | private Long id; |
| | | private Long customerId; |
| | | private String customerName; |
| | | private String level; |
| | | private Integer score; |
| | | private String evalType; |
| | | private String evalReason; |
| | | private Long operatorId; |
| | | private String operatorName; |
| | | private LocalDateTime operateTime; |
| | | private LocalDateTime validUntil; |
| | | private String remark; |
| | | |
| | | } |
| | |
| | | */ |
| | | private String remark; |
| | | |
| | | /** |
| | | * 客æ·åç±»ï¼çµåCRMæ©å±ï¼ |
| | | * |
| | | * 对åºåå
¸ {@link DictTypeConstants#CRM_CUSTOMER_TYPE} |
| | | */ |
| | | private String customerType; |
| | | /** |
| | | * å½åä¿¡ç¨ççº§ï¼ææ°ä¸æ¬¡ä¿¡ç¨è¯çº§çç级ï¼ç±ä¿¡ç¨è¯çº§æ¨¡ååå
¥ï¼ |
| | | * |
| | | * 对åºåå
¸ {@link DictTypeConstants#CRM_CREDIT_LEVEL} |
| | | */ |
| | | private String creditLevel; |
| | | /** |
| | | * å½åä¿¡ç¨å |
| | | */ |
| | | private Integer creditScore; |
| | | |
| | | } |
| | |
| | | */ |
| | | private String remark; |
| | | |
| | | /** |
| | | * æ¥ä»·ç±»åï¼çµåCRMæ©å±ï¼ |
| | | * |
| | | * åå
¸ crm_quotation_typeï¼general=éç¨ / power=çµåæ¥ä»· / energy=è½æºæå¡ |
| | | */ |
| | | private String quotationType; |
| | | /** |
| | | * åå容éï¼kVAï¼ä»
çµå/è½æºæ¥ä»·ï¼ |
| | | */ |
| | | private BigDecimal capacity; |
| | | /** |
| | | * æå¤§ééï¼kWï¼ä»
两é¨å¶çµä»·ï¼ |
| | | */ |
| | | private BigDecimal maxDemand; |
| | | /** |
| | | * çµåº¦åä»·ï¼å
/kWhï¼ |
| | | */ |
| | | private BigDecimal unitPrice; |
| | | /** |
| | | * çµä»·æ¨¡å¼ |
| | | * |
| | | * åå
¸ crm_tariff_modeï¼single=åä¸å¶ / two-part=两é¨å¶ / tier=é¶æ¢¯ / tou=å³°è°·åæ¶ |
| | | */ |
| | | private String tariffMode; |
| | | /** |
| | | * åè°çµè´¹ï¼å
ï¼ |
| | | */ |
| | | private BigDecimal powerFactorFee; |
| | | /** |
| | | * ç»ç®å¨æï¼æï¼ |
| | | */ |
| | | private Integer billingCycle; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.dal.dataobject.refund; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.crm.enums.DictTypeConstants; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * CRM éè´¹å DO |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @TableName("crm_refund") |
| | | @KeySequence("crm_refund_seq") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class CrmRefundDO extends BaseDO { |
| | | |
| | | @TableId |
| | | private Long id; |
| | | private String refundNo; |
| | | private Long customerId; |
| | | private String customerName; |
| | | private Long contractId; |
| | | private String contractNo; |
| | | /** |
| | | * é费类åï¼çµè´¹éè´¹/æå¡é订/容ééè´¹ï¼åå
¸ crm_refund_typeï¼ |
| | | */ |
| | | private String refundType; |
| | | private BigDecimal refundAmount; |
| | | private String refundReason; |
| | | private Long applyUserId; |
| | | private String applyUserName; |
| | | private LocalDateTime applyTime; |
| | | /** |
| | | * 审æ¹ç¶æï¼0è稿/10å¾
审æ¹/20éè¿/30驳å |
| | | */ |
| | | private Integer auditStatus; |
| | | private String processInstanceId; |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.dal.mysql.cancellation; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.cancellation.vo.CrmCancellationPageReqVO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.cancellation.CrmCancellationDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface CrmCancellationMapper extends BaseMapperX<CrmCancellationDO> { |
| | | |
| | | default PageResult<CrmCancellationDO> selectPage(CrmCancellationPageReqVO reqVO) { |
| | | return selectPage(reqVO, buildQuery(reqVO)); |
| | | } |
| | | |
| | | default List<CrmCancellationDO> selectList(CrmCancellationPageReqVO reqVO) { |
| | | return selectList(buildQuery(reqVO)); |
| | | } |
| | | |
| | | default CrmCancellationDO selectByCancellationNo(String cancellationNo) { |
| | | return selectOne(new LambdaQueryWrapperX<CrmCancellationDO>() |
| | | .eq(CrmCancellationDO::getCancellationNo, cancellationNo)); |
| | | } |
| | | |
| | | private LambdaQueryWrapperX<CrmCancellationDO> buildQuery(CrmCancellationPageReqVO reqVO) { |
| | | return new LambdaQueryWrapperX<CrmCancellationDO>() |
| | | .likeIfPresent(CrmCancellationDO::getCancellationNo, reqVO.getCancellationNo()) |
| | | .eqIfPresent(CrmCancellationDO::getCustomerId, reqVO.getCustomerId()) |
| | | .eqIfPresent(CrmCancellationDO::getCancellationType, reqVO.getCancellationType()) |
| | | .eqIfPresent(CrmCancellationDO::getAuditStatus, reqVO.getAuditStatus()) |
| | | .orderByDesc(CrmCancellationDO::getId); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.dal.mysql.contract; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.command.CrmContractCommandPageReqVO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractCommandDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface CrmContractCommandMapper extends BaseMapperX<CrmContractCommandDO> { |
| | | |
| | | default PageResult<CrmContractCommandDO> selectPage(CrmContractCommandPageReqVO reqVO) { |
| | | return selectPage(reqVO, buildQuery(reqVO)); |
| | | } |
| | | |
| | | default List<CrmContractCommandDO> selectListByContractId(Long contractId) { |
| | | return selectList(new LambdaQueryWrapperX<CrmContractCommandDO>() |
| | | .eq(CrmContractCommandDO::getContractId, contractId) |
| | | .orderByDesc(CrmContractCommandDO::getOperateTime)); |
| | | } |
| | | |
| | | private LambdaQueryWrapperX<CrmContractCommandDO> buildQuery(CrmContractCommandPageReqVO reqVO) { |
| | | return new LambdaQueryWrapperX<CrmContractCommandDO>() |
| | | .eqIfPresent(CrmContractCommandDO::getContractId, reqVO.getContractId()) |
| | | .eqIfPresent(CrmContractCommandDO::getCommandType, reqVO.getCommandType()) |
| | | .eqIfPresent(CrmContractCommandDO::getStatus, reqVO.getStatus()) |
| | | .likeIfPresent(CrmContractCommandDO::getBizNo, reqVO.getBizNo()) |
| | | .orderByDesc(CrmContractCommandDO::getOperateTime); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.dal.mysql.credit; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.credit.vo.CrmCreditRatingPageReqVO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.credit.CrmCreditRatingDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface CrmCreditRatingMapper extends BaseMapperX<CrmCreditRatingDO> { |
| | | |
| | | default PageResult<CrmCreditRatingDO> selectPage(CrmCreditRatingPageReqVO reqVO) { |
| | | return selectPage(reqVO, buildQuery(reqVO)); |
| | | } |
| | | |
| | | default List<CrmCreditRatingDO> selectList(CrmCreditRatingPageReqVO reqVO) { |
| | | return selectList(buildQuery(reqVO)); |
| | | } |
| | | |
| | | default CrmCreditRatingDO selectLatestByCustomerId(Long customerId) { |
| | | return selectOne(new LambdaQueryWrapperX<CrmCreditRatingDO>() |
| | | .eq(CrmCreditRatingDO::getCustomerId, customerId) |
| | | .orderByDesc(CrmCreditRatingDO::getOperateTime) |
| | | .orderByDesc(CrmCreditRatingDO::getId) |
| | | .last("LIMIT 1")); |
| | | } |
| | | |
| | | private LambdaQueryWrapperX<CrmCreditRatingDO> buildQuery(CrmCreditRatingPageReqVO reqVO) { |
| | | return new LambdaQueryWrapperX<CrmCreditRatingDO>() |
| | | .eqIfPresent(CrmCreditRatingDO::getCustomerId, reqVO.getCustomerId()) |
| | | .eqIfPresent(CrmCreditRatingDO::getLevel, reqVO.getLevel()) |
| | | .eqIfPresent(CrmCreditRatingDO::getEvalType, reqVO.getEvalType()) |
| | | .orderByDesc(CrmCreditRatingDO::getOperateTime); |
| | | } |
| | | |
| | | } |
| | |
| | | import cn.hutool.core.date.LocalDateTimeUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.MPJLambdaWrapperX; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.receivable.vo.plan.CrmReceivablePlanPageReqVO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; |
| | |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | |
| | | return selectCount(query); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢ä¸æ¹å®¢æ·çæ¬ è´¹åæ¬¾è®¡åï¼æªå款 + å·²é¾æï¼ |
| | | * |
| | | * å£å¾ä¸ {@link #selectPage(CrmReceivablePlanPageReqVO, Long)} çã已龿ãä¸è´ï¼ |
| | | * receivableId ä¸ºç©ºï¼æªå款ï¼ä¸ returnTime æ©äºå½åæ¶é´ |
| | | * |
| | | * @param customerIds 客æ·ç¼å·éå |
| | | * @param now å½åæ¶é´ï¼é¾æå¤å®æ¶é´ç¹ï¼ |
| | | * @return æ¬ è´¹ç忬¾è®¡åå表 |
| | | */ |
| | | default List<CrmReceivablePlanDO> selectOverdueListByCustomerIds(Collection<Long> customerIds, |
| | | LocalDateTime now) { |
| | | return selectList(new LambdaQueryWrapperX<CrmReceivablePlanDO>() |
| | | .in(CrmReceivablePlanDO::getCustomerId, customerIds) |
| | | .isNull(CrmReceivablePlanDO::getReceivableId) // æªå款 |
| | | .lt(CrmReceivablePlanDO::getReturnTime, now)); // 已龿 |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.dal.mysql.refund; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.refund.vo.CrmRefundPageReqVO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.refund.CrmRefundDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface CrmRefundMapper extends BaseMapperX<CrmRefundDO> { |
| | | |
| | | default PageResult<CrmRefundDO> selectPage(CrmRefundPageReqVO reqVO) { |
| | | return selectPage(reqVO, buildQuery(reqVO)); |
| | | } |
| | | |
| | | default List<CrmRefundDO> selectList(CrmRefundPageReqVO reqVO) { |
| | | return selectList(buildQuery(reqVO)); |
| | | } |
| | | |
| | | default CrmRefundDO selectByRefundNo(String refundNo) { |
| | | return selectOne(new LambdaQueryWrapperX<CrmRefundDO>().eq(CrmRefundDO::getRefundNo, refundNo)); |
| | | } |
| | | |
| | | private LambdaQueryWrapperX<CrmRefundDO> buildQuery(CrmRefundPageReqVO reqVO) { |
| | | return new LambdaQueryWrapperX<CrmRefundDO>() |
| | | .likeIfPresent(CrmRefundDO::getRefundNo, reqVO.getRefundNo()) |
| | | .eqIfPresent(CrmRefundDO::getCustomerId, reqVO.getCustomerId()) |
| | | .eqIfPresent(CrmRefundDO::getRefundType, reqVO.getRefundType()) |
| | | .eqIfPresent(CrmRefundDO::getAuditStatus, reqVO.getAuditStatus()) |
| | | .orderByDesc(CrmRefundDO::getId); |
| | | } |
| | | |
| | | } |
| | |
| | | String CRM_SALES_TARGET_DIMENSION = "crm_sales_target_dimension"; // CRM éå®ç®æ 维度 |
| | | String CRM_SALES_TARGET_STATUS = "crm_sales_target_status"; // CRM éå®ç®æ ç¶æ |
| | | |
| | | // ========== çµåè¥éæ©å± ========== |
| | | String CRM_CUSTOMER_TYPE = "crm_customer_type"; // çµå客æ·åç±»ï¼æ¿ä¼/å·¥ä¸/å±
æ°/åä¸/åä¸ï¼ |
| | | String CRM_CREDIT_LEVEL = "crm_credit_level"; // 客æ·ä¿¡ç¨ç级ï¼A+/A/B+/B/C/C-/Dï¼ |
| | | String CRM_QUOTATION_TYPE = "crm_quotation_type"; // æ¥ä»·åç±»åï¼éç¨/çµå/è½æºæå¡ï¼ |
| | | String CRM_TARIFF_MODE = "crm_tariff_mode"; // çµä»·æ¨¡å¼ï¼åä¸å¶/两é¨å¶/é¶æ¢¯/å³°è°·åæ¶ï¼ |
| | | String CRM_CONTRACT_TYPE = "crm_contract_type"; // ååç±»åï¼ä¾ç¨çµ/è½æºæå¡/å±
é
/å
ä¼ï¼ |
| | | String CRM_VOLTAGE_LEVEL = "crm_voltage_level"; // çµåç级ï¼10kV/35kV/110kV/220kV/380V/220Vï¼ |
| | | String CRM_ELECTRICITY_TYPE = "crm_electricity_type"; // ç¨çµç±»åï¼å¤§å·¥ä¸/ä¸è¬å·¥åä¸/å±
æ°/åä¸ï¼ |
| | | String CRM_METER_MODE = "crm_meter_mode"; // è®¡éæ¹å¼ï¼é«ä¾é«è®¡/é«ä¾ä½è®¡/ä½ä¾ä½è®¡ï¼ |
| | | String CRM_COMMAND_TYPE = "crm_command_type"; // ååæä»¤ç±»åï¼ä¸å表/æè¡¨ä»»å¡/æå¡å·¥åï¼ |
| | | String CRM_COMMAND_STATUS = "crm_command_status"; // ååæä»¤ç¶æï¼å¾
æ§è¡/å·²ä¸å/已宿/å·²åæ¶ï¼ |
| | | String CRM_REFUND_TYPE = "crm_refund_type"; // é费类åï¼çµè´¹éè´¹/æå¡é订/容ééè´¹ï¼ |
| | | String CRM_CANCELLATION_TYPE = "crm_cancellation_type"; // éæ·ç±»åï¼ç¨çµéæ·/æå¡ç»æ¢/ååå°æï¼ |
| | | |
| | | } |
| | |
| | | ErrorCode CRM_SALES_TARGET_PERIOD_VALUE_INVALID = new ErrorCode(1_020_017_001, "卿å¼ã{}ãæ ¼å¼ä¸æ£ç¡®ï¼åºä¸º {}"); |
| | | ErrorCode CRM_SALES_TARGET_DIMENSION_TARGET_MISSING = new ErrorCode(1_020_017_002, "请填åç®æ {}ç¼å·"); |
| | | |
| | | // ========== çµåè¥éæ©å± 1_020_018_000 ========== |
| | | ErrorCode CRM_CREDIT_RATING_NOT_EXISTS = new ErrorCode(1_020_018_000, "ä¿¡ç¨è¯çº§è®°å½ä¸åå¨"); |
| | | ErrorCode CRM_CREDIT_RATING_DUPLICATE = new ErrorCode(1_020_018_001, "åä¸å®¢æ·å·²åå¨çæä¸çä¿¡ç¨è¯çº§"); |
| | | |
| | | ErrorCode CRM_CONTRACT_COMMAND_NOT_EXISTS = new ErrorCode(1_020_018_002, "ååæä»¤ä¸åå¨"); |
| | | ErrorCode CRM_COMMAND_EXECUTE_FAIL_STATUS = new ErrorCode(1_020_018_003, "ååæä»¤æ§è¡å¤±è´¥ï¼åå ï¼ç¶æä¸å
许æ§è¡"); |
| | | ErrorCode CRM_COMMAND_DISPATCH_TARGET_MISSING = new ErrorCode(1_020_018_014, "ååæä»¤ä¸å失败ï¼åå ï¼æä»¤æªå
³èç®æ å·¥åï¼targetIdï¼"); |
| | | |
| | | ErrorCode CRM_REFUND_NOT_EXISTS = new ErrorCode(1_020_018_004, "éè´¹åä¸åå¨"); |
| | | ErrorCode CRM_REFUND_NO_DUPLICATE = new ErrorCode(1_020_018_005, "éè´¹åå·å·²åå¨"); |
| | | |
| | | ErrorCode CRM_CANCELLATION_NOT_EXISTS = new ErrorCode(1_020_018_006, "éæ·ç³è¯·ä¸åå¨"); |
| | | ErrorCode CRM_CANCELLATION_NO_DUPLICATE = new ErrorCode(1_020_018_007, "éæ·ç³è¯·ç¼å·å·²åå¨"); |
| | | |
| | | ErrorCode CRM_REFUND_SUBMIT_FAIL_NOT_DRAFT = new ErrorCode(1_020_018_008, "éè´¹å审æ¹å¤±è´¥ï¼åå ï¼éè´¹åä¸å¤äºèç¨¿ç¶æ"); |
| | | ErrorCode CRM_REFUND_BPM_PROCESS_DEFINITION_NOT_EXISTS = new ErrorCode(1_020_018_009, "éè´¹å审æ¹å¤±è´¥ï¼åå ï¼BPM å®¡æ¹æµç¨ä¸åå¨ï¼è¯·å
å¨ BPM 管çåå°é
ç½®éè´¹å®¡æ¹æµç¨"); |
| | | ErrorCode CRM_REFUND_UPDATE_AUDIT_STATUS_FAIL_NOT_PROCESS = new ErrorCode(1_020_018_010, "éè´¹å审æ¹å¤±è´¥ï¼åå ï¼éè´¹åä¸å¤äºå®¡æ¹ä¸ï¼æ æ³æ´æ°å®¡æ¹ç»æ"); |
| | | |
| | | ErrorCode CRM_CANCELLATION_SUBMIT_FAIL_NOT_DRAFT = new ErrorCode(1_020_018_011, "éæ·ç³è¯·å®¡æ¹å¤±è´¥ï¼åå ï¼éæ·ç³è¯·ä¸å¤äºèç¨¿ç¶æ"); |
| | | ErrorCode CRM_CANCELLATION_BPM_PROCESS_DEFINITION_NOT_EXISTS = new ErrorCode(1_020_018_012, "éæ·ç³è¯·å®¡æ¹å¤±è´¥ï¼åå ï¼BPM å®¡æ¹æµç¨ä¸åå¨ï¼è¯·å
å¨ BPM 管çåå°é
ç½®éæ·å®¡æ¹æµç¨"); |
| | | ErrorCode CRM_CANCELLATION_UPDATE_AUDIT_STATUS_FAIL_NOT_PROCESS = new ErrorCode(1_020_018_013, "éæ·ç³è¯·å®¡æ¹å¤±è´¥ï¼åå ï¼éæ·ç³è¯·ä¸å¤äºå®¡æ¹ä¸ï¼æ æ³æ´æ°å®¡æ¹ç»æ"); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.service.cancellation; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.cancellation.vo.CrmCancellationAuditReqVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.cancellation.vo.CrmCancellationPageReqVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.cancellation.vo.CrmCancellationRespVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.cancellation.vo.CrmCancellationSaveReqVO; |
| | | import jakarta.validation.Valid; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface CrmCancellationService { |
| | | |
| | | Long createCancellation(@Valid CrmCancellationSaveReqVO createReqVO); |
| | | |
| | | void updateCancellation(@Valid CrmCancellationSaveReqVO updateReqVO); |
| | | |
| | | void deleteCancellation(Long id); |
| | | |
| | | CrmCancellationRespVO getCancellation(Long id); |
| | | |
| | | PageResult<CrmCancellationRespVO> getCancellationPage(CrmCancellationPageReqVO pageReqVO); |
| | | |
| | | List<CrmCancellationRespVO> getCancellationList(CrmCancellationPageReqVO reqVO); |
| | | |
| | | void auditCancellation(@Valid CrmCancellationAuditReqVO auditReqVO); |
| | | |
| | | void submitCancellation(Long id, String processDefinitionKey, Long userId); |
| | | |
| | | void updateCancellationAuditStatus(Long id, Integer bpmResult); |
| | | |
| | | List<Map<String, Object>> getCancellationApproveProcessDefinitionList(); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.service.cancellation; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjUtil; |
| | | import cn.hutool.core.util.RandomUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.cancellation.vo.CrmCancellationAuditReqVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.cancellation.vo.CrmCancellationPageReqVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.cancellation.vo.CrmCancellationRespVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.cancellation.vo.CrmCancellationSaveReqVO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.cancellation.CrmCancellationDO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| | | import cn.iocoder.yudao.module.crm.dal.mysql.cancellation.CrmCancellationMapper; |
| | | import cn.iocoder.yudao.module.crm.dal.mysql.customer.CrmCustomerMapper; |
| | | import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi; |
| | | import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; |
| | | import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionInfoDO; |
| | | import cn.iocoder.yudao.module.bpm.service.definition.BpmCategoryService; |
| | | import cn.iocoder.yudao.module.bpm.service.definition.BpmProcessDefinitionService; |
| | | import cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants; |
| | | import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum; |
| | | import jakarta.annotation.Resource; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.flowable.engine.repository.ProcessDefinition; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| | | import static cn.iocoder.yudao.module.crm.util.CrmAuditStatusUtils.convertBpmResultToAuditStatus; |
| | | |
| | | @Service |
| | | @Validated |
| | | @Slf4j |
| | | public class CrmCancellationServiceImpl implements CrmCancellationService { |
| | | |
| | | private static final Integer AUDIT_DRAFT = 0; |
| | | |
| | | /** |
| | | * BPM 鿷审æ¹åç±»ç¼ç |
| | | */ |
| | | private static final String CANCELLATION_APPROVE_CATEGORY_CODE = "cancellation_approve"; |
| | | |
| | | @Resource |
| | | private CrmCancellationMapper cancellationMapper; |
| | | @Resource |
| | | private CrmCustomerMapper customerMapper; |
| | | @Resource |
| | | private BpmProcessInstanceApi bpmProcessInstanceApi; |
| | | @Resource |
| | | private BpmCategoryService bpmCategoryService; |
| | | @Resource |
| | | private BpmProcessDefinitionService bpmProcessDefinitionService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long createCancellation(CrmCancellationSaveReqVO createReqVO) { |
| | | if (StrUtil.isBlank(createReqVO.getCancellationNo())) { |
| | | createReqVO.setCancellationNo(generateCancellationNo()); |
| | | } else if (cancellationMapper.selectByCancellationNo(createReqVO.getCancellationNo()) != null) { |
| | | throw exception(ErrorCodeConstants.CRM_CANCELLATION_NO_DUPLICATE); |
| | | } |
| | | CrmCustomerDO customer = customerMapper.selectById(createReqVO.getCustomerId()); |
| | | if (customer == null) { |
| | | throw exception(ErrorCodeConstants.CUSTOMER_NOT_EXISTS); |
| | | } |
| | | if (StrUtil.isBlank(createReqVO.getCustomerName())) { |
| | | createReqVO.setCustomerName(customer.getName()); |
| | | } |
| | | if (createReqVO.getApplyTime() == null) { |
| | | createReqVO.setApplyTime(LocalDateTime.now()); |
| | | } |
| | | if (createReqVO.getAuditStatus() == null) { |
| | | createReqVO.setAuditStatus(AUDIT_DRAFT); |
| | | } |
| | | CrmCancellationDO entity = BeanUtils.toBean(createReqVO, CrmCancellationDO.class); |
| | | cancellationMapper.insert(entity); |
| | | return entity.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void updateCancellation(CrmCancellationSaveReqVO updateReqVO) { |
| | | CrmCancellationDO exists = cancellationMapper.selectById(updateReqVO.getId()); |
| | | if (exists == null) { |
| | | throw exception(ErrorCodeConstants.CRM_CANCELLATION_NOT_EXISTS); |
| | | } |
| | | CrmCancellationDO entity = BeanUtils.toBean(updateReqVO, CrmCancellationDO.class); |
| | | cancellationMapper.updateById(entity); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteCancellation(Long id) { |
| | | CrmCancellationDO exists = cancellationMapper.selectById(id); |
| | | if (exists == null) { |
| | | throw exception(ErrorCodeConstants.CRM_CANCELLATION_NOT_EXISTS); |
| | | } |
| | | cancellationMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public CrmCancellationRespVO getCancellation(Long id) { |
| | | CrmCancellationDO entity = cancellationMapper.selectById(id); |
| | | return entity == null ? null : BeanUtils.toBean(entity, CrmCancellationRespVO.class); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<CrmCancellationRespVO> getCancellationPage(CrmCancellationPageReqVO pageReqVO) { |
| | | return BeanUtils.toBean(cancellationMapper.selectPage(pageReqVO), CrmCancellationRespVO.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<CrmCancellationRespVO> getCancellationList(CrmCancellationPageReqVO reqVO) { |
| | | return BeanUtils.toBean(cancellationMapper.selectList(reqVO), CrmCancellationRespVO.class); |
| | | } |
| | | |
| | | @Override |
| | | public void auditCancellation(CrmCancellationAuditReqVO auditReqVO) { |
| | | CrmCancellationDO exists = cancellationMapper.selectById(auditReqVO.getId()); |
| | | if (exists == null) { |
| | | throw exception(ErrorCodeConstants.CRM_CANCELLATION_NOT_EXISTS); |
| | | } |
| | | CrmCancellationDO update = new CrmCancellationDO(); |
| | | update.setId(exists.getId()); |
| | | update.setAuditStatus(auditReqVO.getAuditStatus()); |
| | | if (StrUtil.isNotBlank(auditReqVO.getRemark())) { |
| | | update.setRemark(auditReqVO.getRemark()); |
| | | } |
| | | cancellationMapper.updateById(update); |
| | | } |
| | | |
| | | @Override |
| | | public void submitCancellation(Long id, String processDefinitionKey, Long userId) { |
| | | // 1. æ ¡éªéæ·ç³è¯·æ¯å¦å¨èç¨¿ç¶æ |
| | | CrmCancellationDO cancellation = cancellationMapper.selectById(id); |
| | | if (cancellation == null) { |
| | | throw exception(ErrorCodeConstants.CRM_CANCELLATION_NOT_EXISTS); |
| | | } |
| | | if (ObjUtil.notEqual(cancellation.getAuditStatus(), CrmAuditStatusEnum.DRAFT.getStatus())) { |
| | | throw exception(ErrorCodeConstants.CRM_CANCELLATION_SUBMIT_FAIL_NOT_DRAFT); |
| | | } |
| | | |
| | | // 2. æ ¡éªéæ·å®¡æ¹åç±»åæµç¨å®ä¹æ¯å¦åå¨ï¼ä¸ä¼ å
¥çæµç¨å®ä¹å¤äºæ¿æ´»ç¶æ |
| | | validateCancellationApproveCategoryAndProcessDefinition(); |
| | | ProcessDefinition processDefinition = bpmProcessDefinitionService.getActiveProcessDefinition(processDefinitionKey); |
| | | if (processDefinition == null) { |
| | | throw exception(ErrorCodeConstants.CRM_CANCELLATION_BPM_PROCESS_DEFINITION_NOT_EXISTS); |
| | | } |
| | | |
| | | // 3. åå»ºéæ·å®¡æ¹æµç¨å®ä¾ |
| | | String processInstanceId = bpmProcessInstanceApi.createProcessInstance(userId, |
| | | new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(processDefinitionKey) |
| | | .setBusinessKey(String.valueOf(id))); |
| | | |
| | | // 4. æ´æ°éæ·ç³è¯·æµç¨ç¼å·ä¸å®¡æ¹ç¶æ |
| | | cancellationMapper.updateById(new CrmCancellationDO().setId(id).setProcessInstanceId(processInstanceId) |
| | | .setAuditStatus(CrmAuditStatusEnum.PROCESS.getStatus())); |
| | | } |
| | | |
| | | @Override |
| | | public void updateCancellationAuditStatus(Long id, Integer bpmResult) { |
| | | // 1.1 æ ¡éªéæ·ç³è¯·æ¯å¦åå¨ |
| | | CrmCancellationDO cancellation = cancellationMapper.selectById(id); |
| | | if (cancellation == null) { |
| | | throw exception(ErrorCodeConstants.CRM_CANCELLATION_NOT_EXISTS); |
| | | } |
| | | // 1.2 åªæå®¡æ¹ä¸ï¼å¯ä»¥æ´æ°å®¡æ¹ç»æ |
| | | if (ObjUtil.notEqual(cancellation.getAuditStatus(), CrmAuditStatusEnum.PROCESS.getStatus())) { |
| | | log.error("[updateCancellationAuditStatus][cancellation({}) ä¸å¤äºå®¡æ¹ä¸ï¼æ æ³æ´æ°å®¡æ¹ç»æ({})]", |
| | | cancellation.getId(), bpmResult); |
| | | throw exception(ErrorCodeConstants.CRM_CANCELLATION_UPDATE_AUDIT_STATUS_FAIL_NOT_PROCESS); |
| | | } |
| | | |
| | | // 2. æ´æ°éæ·ç³è¯·å®¡æ¹ç»æ |
| | | Integer auditStatus = convertBpmResultToAuditStatus(bpmResult); |
| | | cancellationMapper.updateById(new CrmCancellationDO().setId(id).setAuditStatus(auditStatus)); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getCancellationApproveProcessDefinitionList() { |
| | | // 1. æ ¡éªéæ·å®¡æ¹åç±»åæµç¨å®ä¹æ¯å¦åå¨ |
| | | validateCancellationApproveCategoryAndProcessDefinition(); |
| | | |
| | | // 2. è·ååç±»ä¸çæµç¨å®ä¹ä¿¡æ¯ |
| | | List<BpmProcessDefinitionInfoDO> definitionInfoList = bpmProcessDefinitionService |
| | | .getProcessDefinitionInfoListByCategory(CANCELLATION_APPROVE_CATEGORY_CODE); |
| | | |
| | | // 3. è·åæµç¨å®ä¹è¯¦æ
|
| | | Set<String> processDefinitionIds = convertSet(definitionInfoList, BpmProcessDefinitionInfoDO::getProcessDefinitionId); |
| | | List<ProcessDefinition> processDefinitions = bpmProcessDefinitionService.getProcessDefinitionList(processDefinitionIds); |
| | | |
| | | // 4. è¿æ»¤ï¼åªä¿çæ¿æ´»ç¶æï¼ä¸ç¸å key åªä¿çææ°çæ¬ |
| | | Map<String, ProcessDefinition> latestVersionMap = new HashMap<>(); |
| | | for (ProcessDefinition pd : processDefinitions) { |
| | | if (pd.isSuspended()) { |
| | | continue; |
| | | } |
| | | ProcessDefinition existing = latestVersionMap.get(pd.getKey()); |
| | | if (existing == null || pd.getVersion() > existing.getVersion()) { |
| | | latestVersionMap.put(pd.getKey(), pd); |
| | | } |
| | | } |
| | | |
| | | // 5. è¿åæµç¨å®ä¹å表 |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (ProcessDefinition pd : latestVersionMap.values()) { |
| | | Map<String, Object> item = new HashMap<>(); |
| | | item.put("id", pd.getId()); |
| | | item.put("key", pd.getKey()); |
| | | item.put("name", pd.getName()); |
| | | item.put("version", pd.getVersion()); |
| | | result.add(item); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éª BPM 鿷审æ¹åç±»åæµç¨å®ä¹æ¯å¦åå¨ |
| | | */ |
| | | private void validateCancellationApproveCategoryAndProcessDefinition() { |
| | | // 1. æ ¡éªåç±»æ¯å¦åå¨ |
| | | Map<String, ?> categoryMap = bpmCategoryService.getCategoryMap(Collections.singletonList(CANCELLATION_APPROVE_CATEGORY_CODE)); |
| | | if (!categoryMap.containsKey(CANCELLATION_APPROVE_CATEGORY_CODE)) { |
| | | throw exception(ErrorCodeConstants.CRM_CANCELLATION_BPM_PROCESS_DEFINITION_NOT_EXISTS); |
| | | } |
| | | |
| | | // 2. æ ¡éªåç±»ä¸æ¯å¦æå¯ç¨çæµç¨å®ä¹ |
| | | List<BpmProcessDefinitionInfoDO> definitionInfoList = bpmProcessDefinitionService |
| | | .getProcessDefinitionInfoListByCategory(CANCELLATION_APPROVE_CATEGORY_CODE); |
| | | if (CollUtil.isEmpty(definitionInfoList)) { |
| | | throw exception(ErrorCodeConstants.CRM_CANCELLATION_BPM_PROCESS_DEFINITION_NOT_EXISTS); |
| | | } |
| | | |
| | | // 3. æ ¡éªæ¯å¦ææ¿æ´»ç¶æçæµç¨å®ä¹ |
| | | Set<String> processDefinitionIds = convertSet(definitionInfoList, BpmProcessDefinitionInfoDO::getProcessDefinitionId); |
| | | List<ProcessDefinition> processDefinitions = bpmProcessDefinitionService.getProcessDefinitionList(processDefinitionIds); |
| | | boolean hasActiveDefinition = processDefinitions.stream().anyMatch(pd -> !pd.isSuspended()); |
| | | if (!hasActiveDefinition) { |
| | | throw exception(ErrorCodeConstants.CRM_CANCELLATION_BPM_PROCESS_DEFINITION_NOT_EXISTS); |
| | | } |
| | | } |
| | | |
| | | private String generateCancellationNo() { |
| | | return "CL" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")) |
| | | + RandomUtil.randomNumbers(4); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.service.cancellation.listener; |
| | | |
| | | import cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEvent; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.cancellation.CrmCancellationDO; |
| | | import cn.iocoder.yudao.module.crm.dal.mysql.cancellation.CrmCancellationMapper; |
| | | import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum; |
| | | import cn.iocoder.yudao.module.crm.service.cancellation.CrmCancellationService; |
| | | import jakarta.annotation.Resource; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.context.ApplicationListener; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * 鿷审æ¹çç»æçå¬å¨å®ç°ç±» |
| | | * |
| | | * éè¿ businessKeyï¼éæ·ç³è¯·IDï¼å¹é
ï¼è䏿¯åºå®çæµç¨å®ä¹ Keyï¼ |
| | | * è¿æ ·å¯ä»¥æ¯æåç±»ä¸ä»»æ Key çæµç¨æ¨¡åã |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class CrmCancellationStatusListener implements ApplicationListener<BpmProcessInstanceStatusEvent> { |
| | | |
| | | @Resource |
| | | private CrmCancellationService cancellationService; |
| | | @Resource |
| | | private CrmCancellationMapper cancellationMapper; |
| | | |
| | | @Override |
| | | public void onApplicationEvent(BpmProcessInstanceStatusEvent event) { |
| | | // éè¿ businessKey æ¥è¯¢éæ·ç³è¯· |
| | | Long cancellationId; |
| | | try { |
| | | cancellationId = Long.parseLong(event.getBusinessKey()); |
| | | } catch (NumberFormatException e) { |
| | | return; // businessKey 䏿¯æ°åï¼å¿½ç¥ |
| | | } |
| | | |
| | | CrmCancellationDO cancellation = cancellationMapper.selectById(cancellationId); |
| | | if (cancellation == null) { |
| | | return; // 䏿¯éæ·ç³è¯·ï¼å¿½ç¥ |
| | | } |
| | | |
| | | // åªæå®¡æ¹ä¸ç¶æçéæ·ç³è¯·æå¤ç |
| | | if (!CrmAuditStatusEnum.PROCESS.getStatus().equals(cancellation.getAuditStatus())) { |
| | | log.warn("[onApplicationEvent] éæ·ç³è¯·({}) ä¸å¤äºå®¡æ¹ä¸ç¶æï¼å½åç¶æ: {}", cancellationId, cancellation.getAuditStatus()); |
| | | return; |
| | | } |
| | | |
| | | log.info("[onApplicationEvent] éæ·ç³è¯·({}) 审æ¹ç¶ææ´æ°: {}", cancellationId, event.getStatus()); |
| | | // æ´æ°å®¡æ¹ç¶æ |
| | | cancellationService.updateCancellationAuditStatus(cancellationId, event.getStatus()); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.service.contract; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.command.CrmContractCommandPageReqVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.command.CrmContractCommandRespVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.command.CrmContractCommandSaveReqVO; |
| | | import jakarta.validation.Valid; |
| | | |
| | | public interface CrmContractCommandService { |
| | | |
| | | Long createCommand(@Valid CrmContractCommandSaveReqVO createReqVO); |
| | | |
| | | void updateCommand(@Valid CrmContractCommandSaveReqVO updateReqVO); |
| | | |
| | | void deleteCommand(Long id); |
| | | |
| | | CrmContractCommandRespVO getCommand(Long id); |
| | | |
| | | PageResult<CrmContractCommandRespVO> getCommandPage(CrmContractCommandPageReqVO pageReqVO); |
| | | |
| | | /** |
| | | * æ§è¡æä»¤ï¼ç¶æ 0/10 -> 20 å·²å®æï¼ |
| | | */ |
| | | void executeCommand(Long id); |
| | | |
| | | /** |
| | | * åæ¶æä»¤ï¼ä»
å¾
æ§è¡/å·²ä¸åç¶æå¯åæ¶ï¼ |
| | | */ |
| | | void cancelCommand(Long id); |
| | | |
| | | Long countByContractId(Long contractId); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.service.contract; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.command.CrmContractCommandPageReqVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.command.CrmContractCommandRespVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.command.CrmContractCommandSaveReqVO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractCommandDO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; |
| | | import cn.iocoder.yudao.module.crm.dal.mysql.contract.CrmContractCommandMapper; |
| | | import cn.iocoder.yudao.module.crm.dal.mysql.contract.CrmContractMapper; |
| | | import cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants; |
| | | import cn.iocoder.yudao.module.mes.api.workorder.MesProWorkOrderApi; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | |
| | | @Service |
| | | @Validated |
| | | public class CrmContractCommandServiceImpl implements CrmContractCommandService { |
| | | |
| | | private static final Integer STATUS_WAIT = 0; |
| | | private static final Integer STATUS_DISPATCHED = 10; |
| | | private static final Integer STATUS_DONE = 20; |
| | | private static final Integer STATUS_CANCELED = 30; |
| | | |
| | | /** ç®æ 模åï¼MES ç产工åï¼æçå®è½å°åæ®ï¼æ§è¡æ¶ç¡®è®¤å·¥åï¼ */ |
| | | private static final String TARGET_MODULE_MES_WORK_ORDER = "mes-work-order"; |
| | | |
| | | @Resource |
| | | private CrmContractCommandMapper commandMapper; |
| | | @Resource |
| | | private CrmContractMapper contractMapper; |
| | | @Resource |
| | | private MesProWorkOrderApi workOrderApi; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long createCommand(CrmContractCommandSaveReqVO createReqVO) { |
| | | CrmContractDO contract = contractMapper.selectById(createReqVO.getContractId()); |
| | | if (contract == null) { |
| | | throw exception(ErrorCodeConstants.CONTRACT_NOT_EXISTS); |
| | | } |
| | | if (StrUtil.isBlank(createReqVO.getContractNo())) { |
| | | createReqVO.setContractNo(contract.getNo()); |
| | | } |
| | | if (createReqVO.getOperateTime() == null) { |
| | | createReqVO.setOperateTime(LocalDateTime.now()); |
| | | } |
| | | if (createReqVO.getStatus() == null) { |
| | | createReqVO.setStatus(STATUS_WAIT); |
| | | } |
| | | CrmContractCommandDO entity = BeanUtils.toBean(createReqVO, CrmContractCommandDO.class); |
| | | commandMapper.insert(entity); |
| | | return entity.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void updateCommand(CrmContractCommandSaveReqVO updateReqVO) { |
| | | CrmContractCommandDO exists = commandMapper.selectById(updateReqVO.getId()); |
| | | if (exists == null) { |
| | | throw exception(ErrorCodeConstants.CRM_CONTRACT_COMMAND_NOT_EXISTS); |
| | | } |
| | | CrmContractCommandDO entity = BeanUtils.toBean(updateReqVO, CrmContractCommandDO.class); |
| | | commandMapper.updateById(entity); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteCommand(Long id) { |
| | | CrmContractCommandDO exists = commandMapper.selectById(id); |
| | | if (exists == null) { |
| | | throw exception(ErrorCodeConstants.CRM_CONTRACT_COMMAND_NOT_EXISTS); |
| | | } |
| | | commandMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public CrmContractCommandRespVO getCommand(Long id) { |
| | | CrmContractCommandDO entity = commandMapper.selectById(id); |
| | | return entity == null ? null : BeanUtils.toBean(entity, CrmContractCommandRespVO.class); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<CrmContractCommandRespVO> getCommandPage(CrmContractCommandPageReqVO pageReqVO) { |
| | | return BeanUtils.toBean(commandMapper.selectPage(pageReqVO), CrmContractCommandRespVO.class); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void executeCommand(Long id) { |
| | | CrmContractCommandDO exists = commandMapper.selectById(id); |
| | | if (exists == null) { |
| | | throw exception(ErrorCodeConstants.CRM_CONTRACT_COMMAND_NOT_EXISTS); |
| | | } |
| | | if (!STATUS_WAIT.equals(exists.getStatus()) && !STATUS_DISPATCHED.equals(exists.getStatus())) { |
| | | throw exception(ErrorCodeConstants.CRM_COMMAND_EXECUTE_FAIL_STATUS); |
| | | } |
| | | // 跨模åçå®ä¸åï¼mes-work-order ç®æ 模åï¼ç¡®è®¤æä»¤å
³èçå·¥å |
| | | if (TARGET_MODULE_MES_WORK_ORDER.equals(exists.getTargetModule())) { |
| | | if (exists.getTargetId() == null) { |
| | | throw exception(ErrorCodeConstants.CRM_COMMAND_DISPATCH_TARGET_MISSING); |
| | | } |
| | | workOrderApi.confirmWorkOrder(exists.getTargetId()); |
| | | } |
| | | // å
¶ä½ç®æ 模åï¼mes-metering/srm-serviceï¼ææ çå®è½å°åæ®ï¼ä»
è®°å½ç¶ææµè½¬ |
| | | CrmContractCommandDO update = new CrmContractCommandDO(); |
| | | update.setId(id); |
| | | update.setStatus(STATUS_DONE); |
| | | commandMapper.updateById(update); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void cancelCommand(Long id) { |
| | | CrmContractCommandDO exists = commandMapper.selectById(id); |
| | | if (exists == null) { |
| | | throw exception(ErrorCodeConstants.CRM_CONTRACT_COMMAND_NOT_EXISTS); |
| | | } |
| | | if (!STATUS_WAIT.equals(exists.getStatus()) && !STATUS_DISPATCHED.equals(exists.getStatus())) { |
| | | throw exception(ErrorCodeConstants.CRM_COMMAND_EXECUTE_FAIL_STATUS); |
| | | } |
| | | // 跨模åèå¨åæ¶ï¼å·²ä¸åç MES å·¥å忥忶 |
| | | if (TARGET_MODULE_MES_WORK_ORDER.equals(exists.getTargetModule()) |
| | | && exists.getTargetId() != null) { |
| | | workOrderApi.cancelWorkOrder(exists.getTargetId()); |
| | | } |
| | | CrmContractCommandDO update = new CrmContractCommandDO(); |
| | | update.setId(id); |
| | | update.setStatus(STATUS_CANCELED); |
| | | commandMapper.updateById(update); |
| | | } |
| | | |
| | | @Override |
| | | public Long countByContractId(Long contractId) { |
| | | List<CrmContractCommandDO> list = commandMapper.selectListByContractId(contractId); |
| | | return (long) list.size(); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.service.credit; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.credit.vo.CrmCreditRatingPageReqVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.credit.vo.CrmCreditRatingRespVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.credit.vo.CrmCreditRatingSaveReqVO; |
| | | import jakarta.validation.Valid; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface CrmCreditRatingService { |
| | | |
| | | Long createCreditRating(@Valid CrmCreditRatingSaveReqVO createReqVO); |
| | | |
| | | void updateCreditRating(@Valid CrmCreditRatingSaveReqVO updateReqVO); |
| | | |
| | | void deleteCreditRating(Long id); |
| | | |
| | | CrmCreditRatingRespVO getCreditRating(Long id); |
| | | |
| | | PageResult<CrmCreditRatingRespVO> getCreditRatingPage(CrmCreditRatingPageReqVO pageReqVO); |
| | | |
| | | List<CrmCreditRatingRespVO> getCreditRatingList(CrmCreditRatingPageReqVO reqVO); |
| | | |
| | | CrmCreditRatingRespVO getLatestByCustomerId(Long customerId); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.service.credit; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.credit.vo.CrmCreditRatingPageReqVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.credit.vo.CrmCreditRatingRespVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.credit.vo.CrmCreditRatingSaveReqVO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.credit.CrmCreditRatingDO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| | | import cn.iocoder.yudao.module.crm.dal.mysql.credit.CrmCreditRatingMapper; |
| | | import cn.iocoder.yudao.module.crm.dal.mysql.customer.CrmCustomerMapper; |
| | | import cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | |
| | | @Service |
| | | @Validated |
| | | public class CrmCreditRatingServiceImpl implements CrmCreditRatingService { |
| | | |
| | | @Resource |
| | | private CrmCreditRatingMapper creditRatingMapper; |
| | | @Resource |
| | | private CrmCustomerMapper customerMapper; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long createCreditRating(CrmCreditRatingSaveReqVO createReqVO) { |
| | | CrmCustomerDO customer = customerMapper.selectById(createReqVO.getCustomerId()); |
| | | if (customer == null) { |
| | | throw exception(ErrorCodeConstants.CUSTOMER_NOT_EXISTS); |
| | | } |
| | | if (StrUtil.isBlank(createReqVO.getOperatorName())) { |
| | | createReqVO.setOperatorName(customer.getName()); |
| | | } |
| | | if (createReqVO.getOperateTime() == null) { |
| | | createReqVO.setOperateTime(LocalDateTime.now()); |
| | | } |
| | | CrmCreditRatingDO entity = BeanUtils.toBean(createReqVO, CrmCreditRatingDO.class, vo -> vo.setCustomerName(customer.getName())); |
| | | creditRatingMapper.insert(entity); |
| | | customer.setCreditLevel(entity.getLevel()); |
| | | customer.setCreditScore(entity.getScore()); |
| | | customerMapper.updateById(customer); |
| | | return entity.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void updateCreditRating(CrmCreditRatingSaveReqVO updateReqVO) { |
| | | CrmCreditRatingDO exists = creditRatingMapper.selectById(updateReqVO.getId()); |
| | | if (exists == null) { |
| | | throw exception(ErrorCodeConstants.CRM_CREDIT_RATING_NOT_EXISTS); |
| | | } |
| | | CrmCreditRatingDO entity = BeanUtils.toBean(updateReqVO, CrmCreditRatingDO.class); |
| | | creditRatingMapper.updateById(entity); |
| | | CrmCreditRatingDO latest = creditRatingMapper.selectLatestByCustomerId(exists.getCustomerId()); |
| | | CrmCustomerDO customer = customerMapper.selectById(exists.getCustomerId()); |
| | | if (customer != null && latest != null && latest.getId().equals(entity.getId())) { |
| | | customer.setCreditLevel(latest.getLevel()); |
| | | customer.setCreditScore(latest.getScore()); |
| | | customerMapper.updateById(customer); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void deleteCreditRating(Long id) { |
| | | CrmCreditRatingDO exists = creditRatingMapper.selectById(id); |
| | | if (exists == null) { |
| | | throw exception(ErrorCodeConstants.CRM_CREDIT_RATING_NOT_EXISTS); |
| | | } |
| | | creditRatingMapper.deleteById(id); |
| | | CrmCreditRatingDO latest = creditRatingMapper.selectLatestByCustomerId(exists.getCustomerId()); |
| | | CrmCustomerDO customer = customerMapper.selectById(exists.getCustomerId()); |
| | | if (customer != null) { |
| | | customer.setCreditLevel(latest == null ? null : latest.getLevel()); |
| | | customer.setCreditScore(latest == null ? null : latest.getScore()); |
| | | customerMapper.updateById(customer); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public CrmCreditRatingRespVO getCreditRating(Long id) { |
| | | CrmCreditRatingDO entity = creditRatingMapper.selectById(id); |
| | | return entity == null ? null : BeanUtils.toBean(entity, CrmCreditRatingRespVO.class); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<CrmCreditRatingRespVO> getCreditRatingPage(CrmCreditRatingPageReqVO pageReqVO) { |
| | | return BeanUtils.toBean(creditRatingMapper.selectPage(pageReqVO), CrmCreditRatingRespVO.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<CrmCreditRatingRespVO> getCreditRatingList(CrmCreditRatingPageReqVO reqVO) { |
| | | return BeanUtils.toBean(creditRatingMapper.selectList(reqVO), CrmCreditRatingRespVO.class); |
| | | } |
| | | |
| | | @Override |
| | | public CrmCreditRatingRespVO getLatestByCustomerId(Long customerId) { |
| | | CrmCreditRatingDO entity = creditRatingMapper.selectLatestByCustomerId(customerId); |
| | | return entity == null ? null : BeanUtils.toBean(entity, CrmCreditRatingRespVO.class); |
| | | } |
| | | |
| | | } |
| | |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.receivable.CrmReceivablePlanDO; |
| | | import jakarta.validation.Valid; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * CRM 忬¾è®¡å Service æ¥å£ |
| | |
| | | */ |
| | | Long getReceivablePlanRemindCount(Long userId); |
| | | |
| | | /** |
| | | * è·å¾å®¢æ·çæ¬ è´¹éé¢ Mapï¼æªå款 + 已龿ç忬¾è®¡åéé¢åè®¡ï¼ |
| | | * |
| | | * @param customerIds 客æ·ç¼å·éå |
| | | * @return key=客æ·ç¼å·ï¼value=æ¬ è´¹éé¢ |
| | | */ |
| | | Map<Long, BigDecimal> getOverdueAmountMapByCustomerIds(Collection<Long> customerIds); |
| | | |
| | | /** |
| | | * è·å¾å®¢æ·çæ¬ è´¹ç¬æ° Mapï¼æªå款 + 已龿ç忬¾è®¡åæ°éï¼ |
| | | * |
| | | * @param customerIds 客æ·ç¼å·éå |
| | | * @return key=客æ·ç¼å·ï¼value=æ¬ è´¹ç¬æ° |
| | | */ |
| | | Map<Long, Integer> getOverdueCountMapByCustomerIds(Collection<Long> customerIds); |
| | | |
| | | } |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Collection; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | |
| | | return receivablePlanMapper.selectReceivablePlanCountByRemind(userId); |
| | | } |
| | | |
| | | @Override |
| | | public Map<Long, BigDecimal> getOverdueAmountMapByCustomerIds(Collection<Long> customerIds) { |
| | | Map<Long, BigDecimal> result = new HashMap<>(); |
| | | if (CollUtil.isEmpty(customerIds)) { |
| | | return result; |
| | | } |
| | | List<CrmReceivablePlanDO> overdueList = |
| | | receivablePlanMapper.selectOverdueListByCustomerIds(customerIds, LocalDateTime.now()); |
| | | for (CrmReceivablePlanDO plan : overdueList) { |
| | | result.merge(plan.getCustomerId(), plan.getPrice(), BigDecimal::add); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public Map<Long, Integer> getOverdueCountMapByCustomerIds(Collection<Long> customerIds) { |
| | | Map<Long, Integer> result = new HashMap<>(); |
| | | if (CollUtil.isEmpty(customerIds)) { |
| | | return result; |
| | | } |
| | | List<CrmReceivablePlanDO> overdueList = |
| | | receivablePlanMapper.selectOverdueListByCustomerIds(customerIds, LocalDateTime.now()); |
| | | for (CrmReceivablePlanDO plan : overdueList) { |
| | | result.merge(plan.getCustomerId(), 1, Integer::sum); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.service.refund; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.refund.vo.CrmRefundAuditReqVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.refund.vo.CrmRefundPageReqVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.refund.vo.CrmRefundRespVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.refund.vo.CrmRefundSaveReqVO; |
| | | import jakarta.validation.Valid; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public interface CrmRefundService { |
| | | |
| | | Long createRefund(@Valid CrmRefundSaveReqVO createReqVO); |
| | | |
| | | void updateRefund(@Valid CrmRefundSaveReqVO updateReqVO); |
| | | |
| | | void deleteRefund(Long id); |
| | | |
| | | CrmRefundRespVO getRefund(Long id); |
| | | |
| | | PageResult<CrmRefundRespVO> getRefundPage(CrmRefundPageReqVO pageReqVO); |
| | | |
| | | List<CrmRefundRespVO> getRefundList(CrmRefundPageReqVO reqVO); |
| | | |
| | | void auditRefund(@Valid CrmRefundAuditReqVO auditReqVO); |
| | | |
| | | void submitRefund(Long id, String processDefinitionKey, Long userId); |
| | | |
| | | void updateRefundAuditStatus(Long id, Integer bpmResult); |
| | | |
| | | List<Map<String, Object>> getRefundApproveProcessDefinitionList(); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.service.refund; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjUtil; |
| | | import cn.hutool.core.util.RandomUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.refund.vo.CrmRefundAuditReqVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.refund.vo.CrmRefundPageReqVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.refund.vo.CrmRefundRespVO; |
| | | import cn.iocoder.yudao.module.crm.controller.admin.refund.vo.CrmRefundSaveReqVO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.refund.CrmRefundDO; |
| | | import cn.iocoder.yudao.module.crm.dal.mysql.customer.CrmCustomerMapper; |
| | | import cn.iocoder.yudao.module.crm.dal.mysql.refund.CrmRefundMapper; |
| | | import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi; |
| | | import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; |
| | | import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionInfoDO; |
| | | import cn.iocoder.yudao.module.bpm.service.definition.BpmCategoryService; |
| | | import cn.iocoder.yudao.module.bpm.service.definition.BpmProcessDefinitionService; |
| | | import cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants; |
| | | import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum; |
| | | import jakarta.annotation.Resource; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.flowable.engine.repository.ProcessDefinition; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| | | import static cn.iocoder.yudao.module.crm.util.CrmAuditStatusUtils.convertBpmResultToAuditStatus; |
| | | |
| | | @Service |
| | | @Validated |
| | | @Slf4j |
| | | public class CrmRefundServiceImpl implements CrmRefundService { |
| | | |
| | | private static final Integer AUDIT_DRAFT = 0; |
| | | private static final Integer AUDIT_PASS = 20; |
| | | |
| | | /** |
| | | * BPM é费审æ¹åç±»ç¼ç |
| | | */ |
| | | private static final String REFUND_APPROVE_CATEGORY_CODE = "refund_approve"; |
| | | |
| | | @Resource |
| | | private CrmRefundMapper refundMapper; |
| | | @Resource |
| | | private CrmCustomerMapper customerMapper; |
| | | @Resource |
| | | private BpmProcessInstanceApi bpmProcessInstanceApi; |
| | | @Resource |
| | | private BpmCategoryService bpmCategoryService; |
| | | @Resource |
| | | private BpmProcessDefinitionService bpmProcessDefinitionService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long createRefund(CrmRefundSaveReqVO createReqVO) { |
| | | if (StrUtil.isBlank(createReqVO.getRefundNo())) { |
| | | createReqVO.setRefundNo(generateRefundNo()); |
| | | } else if (refundMapper.selectByRefundNo(createReqVO.getRefundNo()) != null) { |
| | | throw exception(ErrorCodeConstants.CRM_REFUND_NO_DUPLICATE); |
| | | } |
| | | CrmCustomerDO customer = customerMapper.selectById(createReqVO.getCustomerId()); |
| | | if (customer == null) { |
| | | throw exception(ErrorCodeConstants.CUSTOMER_NOT_EXISTS); |
| | | } |
| | | if (StrUtil.isBlank(createReqVO.getCustomerName())) { |
| | | createReqVO.setCustomerName(customer.getName()); |
| | | } |
| | | if (createReqVO.getApplyTime() == null) { |
| | | createReqVO.setApplyTime(LocalDateTime.now()); |
| | | } |
| | | if (createReqVO.getAuditStatus() == null) { |
| | | createReqVO.setAuditStatus(AUDIT_DRAFT); |
| | | } |
| | | CrmRefundDO entity = BeanUtils.toBean(createReqVO, CrmRefundDO.class); |
| | | refundMapper.insert(entity); |
| | | return entity.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void updateRefund(CrmRefundSaveReqVO updateReqVO) { |
| | | CrmRefundDO exists = refundMapper.selectById(updateReqVO.getId()); |
| | | if (exists == null) { |
| | | throw exception(ErrorCodeConstants.CRM_REFUND_NOT_EXISTS); |
| | | } |
| | | CrmRefundDO entity = BeanUtils.toBean(updateReqVO, CrmRefundDO.class); |
| | | refundMapper.updateById(entity); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteRefund(Long id) { |
| | | CrmRefundDO exists = refundMapper.selectById(id); |
| | | if (exists == null) { |
| | | throw exception(ErrorCodeConstants.CRM_REFUND_NOT_EXISTS); |
| | | } |
| | | refundMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public CrmRefundRespVO getRefund(Long id) { |
| | | CrmRefundDO entity = refundMapper.selectById(id); |
| | | return entity == null ? null : BeanUtils.toBean(entity, CrmRefundRespVO.class); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<CrmRefundRespVO> getRefundPage(CrmRefundPageReqVO pageReqVO) { |
| | | return BeanUtils.toBean(refundMapper.selectPage(pageReqVO), CrmRefundRespVO.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<CrmRefundRespVO> getRefundList(CrmRefundPageReqVO reqVO) { |
| | | return BeanUtils.toBean(refundMapper.selectList(reqVO), CrmRefundRespVO.class); |
| | | } |
| | | |
| | | @Override |
| | | public void auditRefund(CrmRefundAuditReqVO auditReqVO) { |
| | | CrmRefundDO exists = refundMapper.selectById(auditReqVO.getId()); |
| | | if (exists == null) { |
| | | throw exception(ErrorCodeConstants.CRM_REFUND_NOT_EXISTS); |
| | | } |
| | | CrmRefundDO update = new CrmRefundDO(); |
| | | update.setId(exists.getId()); |
| | | update.setAuditStatus(auditReqVO.getAuditStatus()); |
| | | if (StrUtil.isNotBlank(auditReqVO.getRemark())) { |
| | | update.setRemark(auditReqVO.getRemark()); |
| | | } |
| | | refundMapper.updateById(update); |
| | | } |
| | | |
| | | @Override |
| | | public void submitRefund(Long id, String processDefinitionKey, Long userId) { |
| | | // 1. æ ¡éªéè´¹åæ¯å¦å¨èç¨¿ç¶æ |
| | | CrmRefundDO refund = refundMapper.selectById(id); |
| | | if (refund == null) { |
| | | throw exception(ErrorCodeConstants.CRM_REFUND_NOT_EXISTS); |
| | | } |
| | | if (ObjUtil.notEqual(refund.getAuditStatus(), CrmAuditStatusEnum.DRAFT.getStatus())) { |
| | | throw exception(ErrorCodeConstants.CRM_REFUND_SUBMIT_FAIL_NOT_DRAFT); |
| | | } |
| | | |
| | | // 2. æ ¡éªé费审æ¹åç±»åæµç¨å®ä¹æ¯å¦åå¨ï¼ä¸ä¼ å
¥çæµç¨å®ä¹å¤äºæ¿æ´»ç¶æ |
| | | validateRefundApproveCategoryAndProcessDefinition(); |
| | | ProcessDefinition processDefinition = bpmProcessDefinitionService.getActiveProcessDefinition(processDefinitionKey); |
| | | if (processDefinition == null) { |
| | | throw exception(ErrorCodeConstants.CRM_REFUND_BPM_PROCESS_DEFINITION_NOT_EXISTS); |
| | | } |
| | | |
| | | // 3. å建éè´¹å®¡æ¹æµç¨å®ä¾ |
| | | String processInstanceId = bpmProcessInstanceApi.createProcessInstance(userId, |
| | | new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(processDefinitionKey) |
| | | .setBusinessKey(String.valueOf(id))); |
| | | |
| | | // 4. æ´æ°éè´¹åæµç¨ç¼å·ä¸å®¡æ¹ç¶æ |
| | | refundMapper.updateById(new CrmRefundDO().setId(id).setProcessInstanceId(processInstanceId) |
| | | .setAuditStatus(CrmAuditStatusEnum.PROCESS.getStatus())); |
| | | } |
| | | |
| | | @Override |
| | | public void updateRefundAuditStatus(Long id, Integer bpmResult) { |
| | | // 1.1 æ ¡éªéè´¹åæ¯å¦åå¨ |
| | | CrmRefundDO refund = refundMapper.selectById(id); |
| | | if (refund == null) { |
| | | throw exception(ErrorCodeConstants.CRM_REFUND_NOT_EXISTS); |
| | | } |
| | | // 1.2 åªæå®¡æ¹ä¸ï¼å¯ä»¥æ´æ°å®¡æ¹ç»æ |
| | | if (ObjUtil.notEqual(refund.getAuditStatus(), CrmAuditStatusEnum.PROCESS.getStatus())) { |
| | | log.error("[updateRefundAuditStatus][refund({}) ä¸å¤äºå®¡æ¹ä¸ï¼æ æ³æ´æ°å®¡æ¹ç»æ({})]", refund.getId(), bpmResult); |
| | | throw exception(ErrorCodeConstants.CRM_REFUND_UPDATE_AUDIT_STATUS_FAIL_NOT_PROCESS); |
| | | } |
| | | |
| | | // 2. æ´æ°éè´¹å审æ¹ç»æ |
| | | Integer auditStatus = convertBpmResultToAuditStatus(bpmResult); |
| | | refundMapper.updateById(new CrmRefundDO().setId(id).setAuditStatus(auditStatus)); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getRefundApproveProcessDefinitionList() { |
| | | // 1. æ ¡éªé费审æ¹åç±»åæµç¨å®ä¹æ¯å¦åå¨ |
| | | validateRefundApproveCategoryAndProcessDefinition(); |
| | | |
| | | // 2. è·ååç±»ä¸çæµç¨å®ä¹ä¿¡æ¯ |
| | | List<BpmProcessDefinitionInfoDO> definitionInfoList = bpmProcessDefinitionService |
| | | .getProcessDefinitionInfoListByCategory(REFUND_APPROVE_CATEGORY_CODE); |
| | | |
| | | // 3. è·åæµç¨å®ä¹è¯¦æ
|
| | | Set<String> processDefinitionIds = convertSet(definitionInfoList, BpmProcessDefinitionInfoDO::getProcessDefinitionId); |
| | | List<ProcessDefinition> processDefinitions = bpmProcessDefinitionService.getProcessDefinitionList(processDefinitionIds); |
| | | |
| | | // 4. è¿æ»¤ï¼åªä¿çæ¿æ´»ç¶æï¼ä¸ç¸å key åªä¿çææ°çæ¬ |
| | | Map<String, ProcessDefinition> latestVersionMap = new HashMap<>(); |
| | | for (ProcessDefinition pd : processDefinitions) { |
| | | if (pd.isSuspended()) { |
| | | continue; |
| | | } |
| | | ProcessDefinition existing = latestVersionMap.get(pd.getKey()); |
| | | if (existing == null || pd.getVersion() > existing.getVersion()) { |
| | | latestVersionMap.put(pd.getKey(), pd); |
| | | } |
| | | } |
| | | |
| | | // 5. è¿åæµç¨å®ä¹å表 |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (ProcessDefinition pd : latestVersionMap.values()) { |
| | | Map<String, Object> item = new HashMap<>(); |
| | | item.put("id", pd.getId()); |
| | | item.put("key", pd.getKey()); |
| | | item.put("name", pd.getName()); |
| | | item.put("version", pd.getVersion()); |
| | | result.add(item); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éª BPM é费审æ¹åç±»åæµç¨å®ä¹æ¯å¦åå¨ |
| | | */ |
| | | private void validateRefundApproveCategoryAndProcessDefinition() { |
| | | // 1. æ ¡éªåç±»æ¯å¦åå¨ |
| | | Map<String, ?> categoryMap = bpmCategoryService.getCategoryMap(Collections.singletonList(REFUND_APPROVE_CATEGORY_CODE)); |
| | | if (!categoryMap.containsKey(REFUND_APPROVE_CATEGORY_CODE)) { |
| | | throw exception(ErrorCodeConstants.CRM_REFUND_BPM_PROCESS_DEFINITION_NOT_EXISTS); |
| | | } |
| | | |
| | | // 2. æ ¡éªåç±»ä¸æ¯å¦æå¯ç¨çæµç¨å®ä¹ |
| | | List<BpmProcessDefinitionInfoDO> definitionInfoList = bpmProcessDefinitionService |
| | | .getProcessDefinitionInfoListByCategory(REFUND_APPROVE_CATEGORY_CODE); |
| | | if (CollUtil.isEmpty(definitionInfoList)) { |
| | | throw exception(ErrorCodeConstants.CRM_REFUND_BPM_PROCESS_DEFINITION_NOT_EXISTS); |
| | | } |
| | | |
| | | // 3. æ ¡éªæ¯å¦ææ¿æ´»ç¶æçæµç¨å®ä¹ |
| | | Set<String> processDefinitionIds = convertSet(definitionInfoList, BpmProcessDefinitionInfoDO::getProcessDefinitionId); |
| | | List<ProcessDefinition> processDefinitions = bpmProcessDefinitionService.getProcessDefinitionList(processDefinitionIds); |
| | | boolean hasActiveDefinition = processDefinitions.stream().anyMatch(pd -> !pd.isSuspended()); |
| | | if (!hasActiveDefinition) { |
| | | throw exception(ErrorCodeConstants.CRM_REFUND_BPM_PROCESS_DEFINITION_NOT_EXISTS); |
| | | } |
| | | } |
| | | |
| | | private String generateRefundNo() { |
| | | return "RF" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")) |
| | | + RandomUtil.randomNumbers(4); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.crm.service.refund.listener; |
| | | |
| | | import cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEvent; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.refund.CrmRefundDO; |
| | | import cn.iocoder.yudao.module.crm.dal.mysql.refund.CrmRefundMapper; |
| | | import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum; |
| | | import cn.iocoder.yudao.module.crm.service.refund.CrmRefundService; |
| | | import jakarta.annotation.Resource; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.context.ApplicationListener; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * é费审æ¹çç»æçå¬å¨å®ç°ç±» |
| | | * |
| | | * éè¿ businessKeyï¼éè´¹åIDï¼å¹é
ï¼è䏿¯åºå®çæµç¨å®ä¹ Keyï¼ |
| | | * è¿æ ·å¯ä»¥æ¯æåç±»ä¸ä»»æ Key çæµç¨æ¨¡åã |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class CrmRefundStatusListener implements ApplicationListener<BpmProcessInstanceStatusEvent> { |
| | | |
| | | @Resource |
| | | private CrmRefundService refundService; |
| | | @Resource |
| | | private CrmRefundMapper refundMapper; |
| | | |
| | | @Override |
| | | public void onApplicationEvent(BpmProcessInstanceStatusEvent event) { |
| | | // éè¿ businessKey æ¥è¯¢éè´¹å |
| | | Long refundId; |
| | | try { |
| | | refundId = Long.parseLong(event.getBusinessKey()); |
| | | } catch (NumberFormatException e) { |
| | | return; // businessKey 䏿¯æ°åï¼å¿½ç¥ |
| | | } |
| | | |
| | | CrmRefundDO refund = refundMapper.selectById(refundId); |
| | | if (refund == null) { |
| | | return; // 䏿¯éè´¹åï¼å¿½ç¥ |
| | | } |
| | | |
| | | // åªæå®¡æ¹ä¸ç¶æçéè´¹åæå¤ç |
| | | if (!CrmAuditStatusEnum.PROCESS.getStatus().equals(refund.getAuditStatus())) { |
| | | log.warn("[onApplicationEvent] éè´¹å({}) ä¸å¤äºå®¡æ¹ä¸ç¶æï¼å½åç¶æ: {}", refundId, refund.getAuditStatus()); |
| | | return; |
| | | } |
| | | |
| | | log.info("[onApplicationEvent] éè´¹å({}) 审æ¹ç¶ææ´æ°: {}", refundId, event.getStatus()); |
| | | // æ´æ°å®¡æ¹ç¶æ |
| | | refundService.updateRefundAuditStatus(refundId, event.getStatus()); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.erp.api.purchase; |
| | | |
| | | import cn.iocoder.yudao.module.erp.api.purchase.dto.ErpPurchasePlanCreateReqDTO; |
| | | |
| | | /** |
| | | * ERP éè´è®¡å API æ¥å£ |
| | | * |
| | | * <p>ä¾å
¶ä»æ¨¡åï¼å¦ MES 计åæç¨ï¼èªå¨çæéè´è®¡å |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | public interface ErpPurchasePlanApi { |
| | | |
| | | /** |
| | | * å建éè´è®¡åï¼èç¨¿ï¼ |
| | | * |
| | | * @param createReqDTO åå»ºä¿¡æ¯ |
| | | * @return éè´è®¡åç¼å· |
| | | */ |
| | | Long createPurchasePlan(ErpPurchasePlanCreateReqDTO createReqDTO); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.erp.api.purchase.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ERP éè´è®¡åå建 Request DTO |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @Data |
| | | public class ErpPurchasePlanCreateReqDTO { |
| | | |
| | | /** |
| | | * 计ååç§° |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * éæ±æ¥æº |
| | | * |
| | | * 1: åºåé¢è¦ |
| | | * 2: è¿ç»´/ç产计å |
| | | */ |
| | | private Integer demandSource; |
| | | |
| | | /** |
| | | * è®¡åæ¥æ |
| | | */ |
| | | private LocalDateTime planDate; |
| | | |
| | | /** |
| | | * ä¾åºåç¼å·ï¼å¯éï¼ |
| | | */ |
| | | private Long supplierId; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | /** |
| | | * 计åæç»å表 |
| | | */ |
| | | private List<Item> items; |
| | | |
| | | @Data |
| | | public static class Item { |
| | | |
| | | /** |
| | | * 产åç¼å·ï¼MDM ç©æç¼å·ï¼ |
| | | */ |
| | | private Long productId; |
| | | |
| | | /** |
| | | * 产ååä½ç¼å· |
| | | */ |
| | | private Long productUnitId; |
| | | |
| | | /** |
| | | * 计åéè´æ°é |
| | | */ |
| | | private BigDecimal count; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.erp.api.purchase; |
| | | |
| | | import cn.iocoder.yudao.module.erp.api.purchase.dto.ErpPurchasePlanCreateReqDTO; |
| | | import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.plan.ErpPurchasePlanSaveReqVO; |
| | | import cn.iocoder.yudao.module.erp.service.purchase.ErpPurchasePlanService; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ERP éè´è®¡å API å®ç°ç±» |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @Service |
| | | @Validated |
| | | public class ErpPurchasePlanApiImpl implements ErpPurchasePlanApi { |
| | | |
| | | @Resource |
| | | private ErpPurchasePlanService purchasePlanService; |
| | | |
| | | @Override |
| | | public Long createPurchasePlan(ErpPurchasePlanCreateReqDTO createReqDTO) { |
| | | ErpPurchasePlanSaveReqVO createReqVO = new ErpPurchasePlanSaveReqVO(); |
| | | createReqVO.setName(createReqDTO.getName()); |
| | | createReqVO.setDemandSource(createReqDTO.getDemandSource()); |
| | | createReqVO.setPlanDate(createReqDTO.getPlanDate()); |
| | | createReqVO.setSupplierId(createReqDTO.getSupplierId()); |
| | | createReqVO.setRemark(createReqDTO.getRemark()); |
| | | createReqVO.setItems(convertItems(createReqDTO.getItems())); |
| | | return purchasePlanService.createPurchasePlan(createReqVO); |
| | | } |
| | | |
| | | private List<ErpPurchasePlanSaveReqVO.Item> convertItems(List<ErpPurchasePlanCreateReqDTO.Item> items) { |
| | | if (items == null) { |
| | | return List.of(); |
| | | } |
| | | return items.stream().map(item -> { |
| | | ErpPurchasePlanSaveReqVO.Item vo = new ErpPurchasePlanSaveReqVO.Item(); |
| | | vo.setProductId(item.getProductId()); |
| | | vo.setProductUnitId(item.getProductUnitId()); |
| | | vo.setCount(item.getCount()); |
| | | vo.setRemark(item.getRemark()); |
| | | return vo; |
| | | }).toList(); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.erp.controller.admin.purchase; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.plan.ErpPurchasePlanPageReqVO; |
| | | import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.plan.ErpPurchasePlanRespVO; |
| | | import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.plan.ErpPurchasePlanSaveReqVO; |
| | | import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchasePlanDO; |
| | | import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchasePlanItemDO; |
| | | import cn.iocoder.yudao.module.erp.service.purchase.ErpPurchasePlanService; |
| | | import cn.iocoder.yudao.module.erp.service.purchase.ErpPurchasePlanServiceImpl; |
| | | import cn.iocoder.yudao.module.mdm.api.item.MdmItemApi; |
| | | import cn.iocoder.yudao.module.mdm.api.item.dto.MdmItemRespDTO; |
| | | import cn.iocoder.yudao.module.mdm.api.unit.MdmUnitMeasureApi; |
| | | import cn.iocoder.yudao.module.mdm.api.unit.dto.MdmUnitMeasureRespDTO; |
| | | import cn.iocoder.yudao.module.srm.api.supplier.SrmSupplierApi; |
| | | import cn.iocoder.yudao.module.srm.api.supplier.dto.SrmSupplierRespDTO; |
| | | import cn.iocoder.yudao.module.system.api.dept.DeptApi; |
| | | import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| | | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| | | |
| | | @Tag(name = "管çåå° - ERP éè´è®¡å") |
| | | @RestController |
| | | @RequestMapping("/erp/purchase-plan") |
| | | @Validated |
| | | public class ErpPurchasePlanController { |
| | | |
| | | @Resource |
| | | private ErpPurchasePlanService purchasePlanService; |
| | | @Resource |
| | | private SrmSupplierApi srmSupplierApi; |
| | | @Resource |
| | | private MdmItemApi mdmItemApi; |
| | | @Resource |
| | | private MdmUnitMeasureApi mdmUnitMeasureApi; |
| | | @Resource |
| | | private AdminUserApi adminUserApi; |
| | | @Resource |
| | | private DeptApi deptApi; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "å建éè´è®¡å") |
| | | @PreAuthorize("@ss.hasPermission('erp:purchase-plan:create')") |
| | | public CommonResult<Long> createPurchasePlan(@Valid @RequestBody ErpPurchasePlanSaveReqVO createReqVO) { |
| | | return success(purchasePlanService.createPurchasePlan(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "æ´æ°éè´è®¡å") |
| | | @PreAuthorize("@ss.hasPermission('erp:purchase-plan:update')") |
| | | public CommonResult<Boolean> updatePurchasePlan(@Valid @RequestBody ErpPurchasePlanSaveReqVO updateReqVO) { |
| | | purchasePlanService.updatePurchasePlan(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤éè´è®¡å") |
| | | @Parameter(name = "ids", description = "ç¼å·æ°ç»", required = true) |
| | | @PreAuthorize("@ss.hasPermission('erp:purchase-plan:delete')") |
| | | public CommonResult<Boolean> deletePurchasePlan(@RequestParam("ids") List<Long> ids) { |
| | | purchasePlanService.deletePurchasePlan(ids); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "è·å¾éè´è®¡å") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('erp:purchase-plan:query')") |
| | | public CommonResult<ErpPurchasePlanRespVO> getPurchasePlan(@RequestParam("id") Long id) { |
| | | ErpPurchasePlanDO plan = purchasePlanService.getPurchasePlan(id); |
| | | if (plan == null) { |
| | | return success(null); |
| | | } |
| | | List<ErpPurchasePlanItemDO> planItemList = purchasePlanService.getPurchasePlanItemListByPlanId(id); |
| | | Map<Long, MdmItemRespDTO> itemMap = mdmItemApi.getItemMap( |
| | | convertSet(planItemList, ErpPurchasePlanItemDO::getProductId)); |
| | | Map<Long, MdmUnitMeasureRespDTO> unitMeasureMap = mdmUnitMeasureApi.getUnitMeasureMap( |
| | | convertSet(planItemList, ErpPurchasePlanItemDO::getProductUnitId)); |
| | | return success(BeanUtils.toBean(plan, ErpPurchasePlanRespVO.class, planVO -> { |
| | | planVO.setDemandSourceName(convertDemandSourceName(plan.getDemandSource())); |
| | | planVO.setItems(BeanUtils.toBean(planItemList, ErpPurchasePlanRespVO.Item.class, item -> { |
| | | MapUtils.findAndThen(itemMap, item.getProductId(), mdmItem -> item.setProductName(mdmItem.getName())); |
| | | MapUtils.findAndThen(unitMeasureMap, item.getProductUnitId(), unit -> item.setProductUnitName(unit.getName())); |
| | | })); |
| | | })); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "è·å¾éè´è®¡åå页") |
| | | @PreAuthorize("@ss.hasPermission('erp:purchase-plan:query')") |
| | | public CommonResult<PageResult<ErpPurchasePlanRespVO>> getPurchasePlanPage(@Valid ErpPurchasePlanPageReqVO pageReqVO) { |
| | | PageResult<ErpPurchasePlanDO> pageResult = purchasePlanService.getPurchasePlanPage(pageReqVO); |
| | | return success(buildPurchasePlanVOPageResult(pageResult)); |
| | | } |
| | | |
| | | @GetMapping("/export-excel") |
| | | @Operation(summary = "导åºéè´è®¡å Excel") |
| | | @PreAuthorize("@ss.hasPermission('erp:purchase-plan:export')") |
| | | @ApiAccessLog(operateType = EXPORT) |
| | | public void exportPurchasePlanExcel(@Valid ErpPurchasePlanPageReqVO pageReqVO, |
| | | HttpServletResponse response) throws IOException { |
| | | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| | | List<ErpPurchasePlanRespVO> list = buildPurchasePlanVOPageResult(purchasePlanService.getPurchasePlanPage(pageReqVO)).getList(); |
| | | ExcelUtils.write(response, "éè´è®¡å.xls", "æ°æ®", ErpPurchasePlanRespVO.class, list); |
| | | } |
| | | |
| | | @PutMapping("/submit") |
| | | @Operation(summary = "æäº¤éè´è®¡å审æ¹") |
| | | @PreAuthorize("@ss.hasPermission('erp:purchase-plan:submit')") |
| | | public CommonResult<Boolean> submitPurchasePlan(@RequestParam("id") Long id, |
| | | @RequestParam("processDefinitionKey") String processDefinitionKey) { |
| | | Long userId = getLoginUserId(); |
| | | purchasePlanService.submitPurchasePlan(id, processDefinitionKey, userId); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/approve-process-list") |
| | | @Operation(summary = "è·åéè´è®¡åå®¡æ¹æµç¨å表") |
| | | @PreAuthorize("@ss.hasPermission('erp:purchase-plan:query')") |
| | | public CommonResult<List<Map<String, Object>>> getApproveProcessList() { |
| | | return success(purchasePlanService.getPurchasePlanApproveProcessDefinitionList()); |
| | | } |
| | | |
| | | @PostMapping("/generate-from-stock-alert") |
| | | @Operation(summary = "æ ¹æ®åºåé¢è¦çæéè´è®¡å", description = "éåå¯ç¨å®å
¨åºåçç©æï¼æç¼ºéçæè稿éè´è®¡å") |
| | | @PreAuthorize("@ss.hasPermission('erp:purchase-plan:create')") |
| | | public CommonResult<Long> generatePlanFromStockAlert(@RequestParam(value = "name", required = false) String name, |
| | | @RequestParam(value = "supplierId", required = false) Long supplierId) { |
| | | ErpPurchasePlanDO plan = purchasePlanService.generatePlanFromStockAlert(name, supplierId); |
| | | return success(plan.getId()); |
| | | } |
| | | |
| | | @PostMapping("/generate-requests") |
| | | @Operation(summary = "çæéè´ç³è¯·") |
| | | @PreAuthorize("@ss.hasPermission('erp:purchase-plan:generate-request')") |
| | | public CommonResult<List<Long>> generatePurchaseRequests(@RequestParam("id") Long id) { |
| | | return success(purchasePlanService.generatePurchaseRequests(id)); |
| | | } |
| | | |
| | | private PageResult<ErpPurchasePlanRespVO> buildPurchasePlanVOPageResult(PageResult<ErpPurchasePlanDO> pageResult) { |
| | | if (CollUtil.isEmpty(pageResult.getList())) { |
| | | return PageResult.empty(pageResult.getTotal()); |
| | | } |
| | | // 1.1 计åæç» |
| | | List<ErpPurchasePlanItemDO> planItemList = purchasePlanService.getPurchasePlanItemListByPlanIds( |
| | | convertSet(pageResult.getList(), ErpPurchasePlanDO::getId)); |
| | | Map<Long, List<ErpPurchasePlanItemDO>> planItemMap = convertMultiMap(planItemList, ErpPurchasePlanItemDO::getPlanId); |
| | | // 1.2 ç©æä¿¡æ¯ |
| | | Map<Long, MdmItemRespDTO> itemMap = mdmItemApi.getItemMap( |
| | | convertSet(planItemList, ErpPurchasePlanItemDO::getProductId)); |
| | | // 1.3 ä¾åºåä¿¡æ¯ |
| | | Map<Long, SrmSupplierRespDTO> supplierMap = srmSupplierApi.getSupplierList( |
| | | convertSet(pageResult.getList(), ErpPurchasePlanDO::getSupplierId)).getCheckedData().stream() |
| | | .collect(Collectors.toMap(SrmSupplierRespDTO::getId, v -> v, (a, b) -> a)); |
| | | // 1.4 ç¨æ·ä¿¡æ¯ |
| | | Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap( |
| | | convertSet(pageResult.getList(), ErpPurchasePlanDO::getPlanUserId)); |
| | | // 1.5 é¨é¨ä¿¡æ¯ |
| | | Map<Long, DeptRespDTO> deptMap = deptApi.getDeptMap( |
| | | convertSet(pageResult.getList(), ErpPurchasePlanDO::getPlanDeptId)); |
| | | // 2. å¼å§æ¼æ¥ |
| | | return BeanUtils.toBean(pageResult, ErpPurchasePlanRespVO.class, plan -> { |
| | | plan.setDemandSourceName(convertDemandSourceName(plan.getDemandSource())); |
| | | plan.setItems(BeanUtils.toBean(planItemMap.get(plan.getId()), ErpPurchasePlanRespVO.Item.class, |
| | | item -> MapUtils.findAndThen(itemMap, item.getProductId(), mdmItem -> item.setProductName(mdmItem.getName())))); |
| | | plan.setProductNames(CollUtil.join(plan.getItems(), "ï¼", ErpPurchasePlanRespVO.Item::getProductName)); |
| | | MapUtils.findAndThen(supplierMap, plan.getSupplierId(), supplier -> plan.setSupplierName(supplier.getName())); |
| | | MapUtils.findAndThen(userMap, plan.getPlanUserId(), user -> plan.setPlanUserName(user.getNickname())); |
| | | MapUtils.findAndThen(deptMap, plan.getPlanDeptId(), dept -> plan.setPlanDeptName(dept.getName())); |
| | | }); |
| | | } |
| | | |
| | | private String convertDemandSourceName(Integer demandSource) { |
| | | if (ErpPurchasePlanServiceImpl.DEMAND_SOURCE_STOCK_ALERT.equals(demandSource)) { |
| | | return "åºåé¢è¦"; |
| | | } |
| | | if (ErpPurchasePlanServiceImpl.DEMAND_SOURCE_PLAN.equals(demandSource)) { |
| | | return "è¿ç»´/ç产计å"; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.plan; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY; |
| | | |
| | | @Schema(description = "管çåå° - ERP éè´è®¡åå页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class ErpPurchasePlanPageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "éè´è®¡ååå·", example = "CGJH001") |
| | | private String no; |
| | | |
| | | @Schema(description = "计ååç§°", example = "2026å¹´8æè¿ç»´å¤ä»¶è®¡å") |
| | | private String name; |
| | | |
| | | @Schema(description = "ç¶æ", example = "0") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "éæ±æ¥æºï¼1=åºåé¢è¦ï¼2=è¿ç»´/ç产计åï¼", example = "1") |
| | | private Integer demandSource; |
| | | |
| | | @Schema(description = "ç¼å¶äººç¼å·", example = "1") |
| | | private Long planUserId; |
| | | |
| | | @Schema(description = "ç¼å¶é¨é¨ç¼å·", example = "1") |
| | | private Long planDeptId; |
| | | |
| | | @Schema(description = "è®¡åæ¥æ") |
| | | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY) |
| | | private LocalDateTime[] planDate; |
| | | |
| | | @Schema(description = "产åç¼å·", example = "1") |
| | | private Long productId; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.plan; |
| | | |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Schema(description = "管çåå° - ERP éè´è®¡å Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class ErpPurchasePlanRespVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @ExcelProperty("ç¼å·") |
| | | private Long id; |
| | | |
| | | @Schema(description = "éè´è®¡ååå·", example = "CGJH001") |
| | | @ExcelProperty("计ååå·") |
| | | private String no; |
| | | |
| | | @Schema(description = "计ååç§°", example = "2026å¹´8æè¿ç»´å¤ä»¶è®¡å") |
| | | @ExcelProperty("计ååç§°") |
| | | private String name; |
| | | |
| | | @Schema(description = "ç¶æ", example = "0") |
| | | @ExcelProperty(value = "ç¶æ", converter = cn.iocoder.yudao.module.erp.convert.ErpPurchasePlanStatusConvert.class) |
| | | private Integer status; |
| | | |
| | | @Schema(description = "éæ±æ¥æºï¼1=åºåé¢è¦ï¼2=è¿ç»´/ç产计åï¼", example = "1") |
| | | private Integer demandSource; |
| | | |
| | | @Schema(description = "éæ±æ¥æºåç§°", example = "åºåé¢è¦") |
| | | private String demandSourceName; |
| | | |
| | | @Schema(description = "è®¡åæ¥æ") |
| | | @ExcelProperty("è®¡åæ¥æ") |
| | | private LocalDateTime planDate; |
| | | |
| | | @Schema(description = "ç¼å¶äººç¼å·", example = "1") |
| | | private Long planUserId; |
| | | |
| | | @Schema(description = "ç¼å¶äººå§å", example = "å¼ ä¸") |
| | | @ExcelProperty("ç¼å¶äºº") |
| | | private String planUserName; |
| | | |
| | | @Schema(description = "ç¼å¶é¨é¨ç¼å·", example = "1") |
| | | private Long planDeptId; |
| | | |
| | | @Schema(description = "ç¼å¶é¨é¨åç§°", example = "è¿ç»´é¨") |
| | | @ExcelProperty("ç¼å¶é¨é¨") |
| | | private String planDeptName; |
| | | |
| | | @Schema(description = "ä¾åºåç¼å·ï¼å¯éï¼", example = "1") |
| | | private Long supplierId; |
| | | |
| | | @Schema(description = "ä¾åºååç§°", example = "ä¾åºåA") |
| | | @ExcelProperty("ä¾åºå") |
| | | private String supplierName; |
| | | |
| | | @Schema(description = "å计æ°é", example = "100") |
| | | @ExcelProperty("å计æ°é") |
| | | private BigDecimal totalCount; |
| | | |
| | | @Schema(description = "æ¯å¦å·²çæéè´ç³è¯·", example = "false") |
| | | private Boolean generatedFlag; |
| | | |
| | | @Schema(description = "夿³¨", example = "夿³¨") |
| | | @ExcelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å建æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | @Schema(description = "计åæç»å表") |
| | | private List<Item> items; |
| | | |
| | | @Schema(description = "产ååç§°å表ï¼éå·æ¼æ¥ï¼", example = "产åAï¼äº§åB") |
| | | private String productNames; |
| | | |
| | | @Schema(description = "计åæç»é¡¹") |
| | | @Data |
| | | public static class Item { |
| | | |
| | | @Schema(description = "ç¼å·", example = "1") |
| | | private Long id; |
| | | |
| | | @Schema(description = "产åç¼å·", example = "1") |
| | | private Long productId; |
| | | |
| | | @Schema(description = "产ååç§°", example = "产åA") |
| | | private String productName; |
| | | |
| | | @Schema(description = "产ååä½ç¼å·", example = "1") |
| | | private Long productUnitId; |
| | | |
| | | @Schema(description = "产ååä½åç§°", example = "个") |
| | | private String productUnitName; |
| | | |
| | | @Schema(description = "计åéè´æ°é", example = "10") |
| | | private BigDecimal count; |
| | | |
| | | @Schema(description = "éæ±æ¥æ") |
| | | private LocalDate demandTime; |
| | | |
| | | @Schema(description = "夿³¨", example = "夿³¨") |
| | | private String remark; |
| | | |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.plan; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.Valid; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Schema(description = "管çåå° - ERP éè´è®¡åæ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | | public class ErpPurchasePlanSaveReqVO { |
| | | |
| | | @Schema(description = "ç¼å·ï¼ä¿®æ¹æ¶å¿
å¡«ï¼", example = "1") |
| | | private Long id; |
| | | |
| | | @Schema(description = "计ååç§°", requiredMode = Schema.RequiredMode.REQUIRED, example = "2026å¹´8æè¿ç»´å¤ä»¶è®¡å") |
| | | @NotEmpty(message = "计ååç§°ä¸è½ä¸ºç©º") |
| | | private String name; |
| | | |
| | | @Schema(description = "éæ±æ¥æºï¼1=åºåé¢è¦ï¼2=è¿ç»´/ç产计åï¼", example = "1") |
| | | private Integer demandSource; |
| | | |
| | | @Schema(description = "è®¡åæ¥æ", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "è®¡åæ¥æä¸è½ä¸ºç©º") |
| | | private LocalDateTime planDate; |
| | | |
| | | @Schema(description = "ä¾åºåç¼å·ï¼å¯éï¼", example = "1") |
| | | private Long supplierId; |
| | | |
| | | @Schema(description = "夿³¨", example = "夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "计åæç»å表", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotEmpty(message = "计åæç»ä¸è½ä¸ºç©º") |
| | | @Valid |
| | | private List<Item> items; |
| | | |
| | | @Schema(description = "计åæç»é¡¹") |
| | | @Data |
| | | public static class Item { |
| | | |
| | | @Schema(description = "ç¼å·ï¼ä¿®æ¹æ¶å¿
å¡«ï¼", example = "1") |
| | | private Long id; |
| | | |
| | | @Schema(description = "产åç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @NotNull(message = "产åç¼å·ä¸è½ä¸ºç©º") |
| | | private Long productId; |
| | | |
| | | @Schema(description = "产ååä½ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @NotNull(message = "产ååä½ä¸è½ä¸ºç©º") |
| | | private Long productUnitId; |
| | | |
| | | @Schema(description = "计åéè´æ°é", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") |
| | | @NotNull(message = "æ°éä¸è½ä¸ºç©º") |
| | | private BigDecimal count; |
| | | |
| | | @Schema(description = "éæ±æ¥æ") |
| | | private LocalDate demandTime; |
| | | |
| | | @Schema(description = "夿³¨", example = "夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "产ååç§°ï¼å端å±ç¤ºç¨ï¼å端忽ç¥ï¼", example = "产åA") |
| | | private String productName; |
| | | |
| | | @Schema(description = "产ååä½åç§°ï¼å端å±ç¤ºç¨ï¼å端忽ç¥ï¼", example = "个") |
| | | private String productUnitName; |
| | | |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.erp.convert; |
| | | |
| | | import cn.idev.excel.converters.Converter; |
| | | import cn.idev.excel.enums.CellDataTypeEnum; |
| | | import cn.idev.excel.metadata.GlobalConfiguration; |
| | | import cn.idev.excel.metadata.data.ReadCellData; |
| | | import cn.idev.excel.metadata.data.WriteCellData; |
| | | import cn.idev.excel.metadata.property.ExcelContentProperty; |
| | | import cn.iocoder.yudao.module.erp.enums.ErpPurchasePlanStatusEnum; |
| | | |
| | | /** |
| | | * ERP éè´è®¡åç¶æ Excel 转æ¢å¨ |
| | | * |
| | | * <p>å° Integer ç¶æç 转æ¢ä¸ºä¸æåç§°ï¼ç¨äº Excel å¯¼åº |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | public class ErpPurchasePlanStatusConvert implements Converter<Integer> { |
| | | |
| | | @Override |
| | | public Class<?> supportJavaTypeKey() { |
| | | return Integer.class; |
| | | } |
| | | |
| | | @Override |
| | | public CellDataTypeEnum supportExcelTypeKey() { |
| | | return CellDataTypeEnum.STRING; |
| | | } |
| | | |
| | | @Override |
| | | public WriteCellData<?> convertToExcelData(Integer value, ExcelContentProperty contentProperty, |
| | | GlobalConfiguration globalConfiguration) { |
| | | if (value == null) { |
| | | return new WriteCellData<>(""); |
| | | } |
| | | ErpPurchasePlanStatusEnum statusEnum = ErpPurchasePlanStatusEnum.fromStatus(value); |
| | | return new WriteCellData<>(statusEnum != null ? statusEnum.getName() : String.valueOf(value)); |
| | | } |
| | | |
| | | @Override |
| | | public Integer convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, |
| | | GlobalConfiguration globalConfiguration) { |
| | | String label = cellData.getStringValue(); |
| | | ErpPurchasePlanStatusEnum statusEnum = ErpPurchasePlanStatusEnum.fromName(label); |
| | | return statusEnum != null ? statusEnum.getStatus() : null; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.erp.dal.dataobject.purchase; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * ERP éè´è®¡å DO |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @TableName("erp_purchase_plan") |
| | | @KeySequence("erp_purchase_plan_seq") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class ErpPurchasePlanDO extends BaseDO { |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | |
| | | /** |
| | | * éè´è®¡ååå· |
| | | */ |
| | | private String no; |
| | | |
| | | /** |
| | | * 计ååç§° |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * ç¶æ |
| | | * |
| | | * 0: æªæäº¤ |
| | | * 10: 审æ¹ä¸ |
| | | * 20: å®¡æ ¸éè¿ |
| | | * 30: å®¡æ ¸ä¸éè¿ |
| | | * 40: 已忶 |
| | | */ |
| | | private Integer status; |
| | | |
| | | /** |
| | | * éæ±æ¥æº |
| | | * |
| | | * 1: åºåé¢è¦ |
| | | * 2: è¿ç»´/ç产计å |
| | | */ |
| | | private Integer demandSource; |
| | | |
| | | /** |
| | | * è®¡åæ¥æ |
| | | */ |
| | | private LocalDateTime planDate; |
| | | |
| | | /** |
| | | * ç¼å¶äººç¼å· |
| | | */ |
| | | private Long planUserId; |
| | | |
| | | /** |
| | | * ç¼å¶é¨é¨ç¼å· |
| | | */ |
| | | private Long planDeptId; |
| | | |
| | | /** |
| | | * ä¾åºåç¼å·ï¼å¯éï¼ |
| | | */ |
| | | private Long supplierId; |
| | | |
| | | /** |
| | | * å计æ°é |
| | | */ |
| | | private BigDecimal totalCount; |
| | | |
| | | /** |
| | | * æ¯å¦å·²çæéè´ç³è¯· |
| | | */ |
| | | private Boolean generatedFlag; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | /** |
| | | * BPM æµç¨å®ä¾ç¼å· |
| | | */ |
| | | private String processInstanceId; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.erp.dal.dataobject.purchase; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | |
| | | /** |
| | | * ERP éè´è®¡åæç» DO |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @TableName("erp_purchase_plan_items") |
| | | @KeySequence("erp_purchase_plan_items_seq") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class ErpPurchasePlanItemDO extends BaseDO { |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | |
| | | /** |
| | | * éè´è®¡åç¼å· |
| | | */ |
| | | private Long planId; |
| | | |
| | | /** |
| | | * 产åç¼å·ï¼MDM ç©æç¼å·ï¼ |
| | | */ |
| | | private Long productId; |
| | | |
| | | /** |
| | | * 产ååä½ç¼å· |
| | | */ |
| | | private Long productUnitId; |
| | | |
| | | /** |
| | | * 计åéè´æ°é |
| | | */ |
| | | private BigDecimal count; |
| | | |
| | | /** |
| | | * éæ±æ¥æ |
| | | */ |
| | | private LocalDate demandTime; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.erp.dal.mysql.purchase; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchasePlanItemDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ERP éè´è®¡åæç» Mapper |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @Mapper |
| | | public interface ErpPurchasePlanItemMapper extends BaseMapperX<ErpPurchasePlanItemDO> { |
| | | |
| | | default List<ErpPurchasePlanItemDO> selectListByPlanId(Long planId) { |
| | | return selectList(ErpPurchasePlanItemDO::getPlanId, planId); |
| | | } |
| | | |
| | | default List<ErpPurchasePlanItemDO> selectListByPlanIds(Collection<Long> planIds) { |
| | | return selectList(ErpPurchasePlanItemDO::getPlanId, planIds); |
| | | } |
| | | |
| | | default void deleteByPlanId(Long planId) { |
| | | delete(new LambdaQueryWrapperX<ErpPurchasePlanItemDO>().eq(ErpPurchasePlanItemDO::getPlanId, planId)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.erp.dal.mysql.purchase; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.plan.ErpPurchasePlanPageReqVO; |
| | | import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchasePlanDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ERP éè´è®¡å Mapper |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @Mapper |
| | | public interface ErpPurchasePlanMapper extends BaseMapperX<ErpPurchasePlanDO> { |
| | | |
| | | default ErpPurchasePlanDO selectByNo(String no) { |
| | | return selectOne(ErpPurchasePlanDO::getNo, no); |
| | | } |
| | | |
| | | default List<ErpPurchasePlanDO> selectPlanListByIds(Collection<Long> ids) { |
| | | return selectList(ErpPurchasePlanDO::getId, ids); |
| | | } |
| | | |
| | | default PageResult<ErpPurchasePlanDO> selectPage(ErpPurchasePlanPageReqVO pageReqVO) { |
| | | return selectPage(pageReqVO, new LambdaQueryWrapperX<ErpPurchasePlanDO>() |
| | | .likeIfPresent(ErpPurchasePlanDO::getNo, pageReqVO.getNo()) |
| | | .likeIfPresent(ErpPurchasePlanDO::getName, pageReqVO.getName()) |
| | | .eqIfPresent(ErpPurchasePlanDO::getStatus, pageReqVO.getStatus()) |
| | | .eqIfPresent(ErpPurchasePlanDO::getDemandSource, pageReqVO.getDemandSource()) |
| | | .eqIfPresent(ErpPurchasePlanDO::getPlanUserId, pageReqVO.getPlanUserId()) |
| | | .eqIfPresent(ErpPurchasePlanDO::getPlanDeptId, pageReqVO.getPlanDeptId()) |
| | | .betweenIfPresent(ErpPurchasePlanDO::getPlanDate, pageReqVO.getPlanDate()) |
| | | .orderByDesc(ErpPurchasePlanDO::getId)); |
| | | } |
| | | |
| | | } |
| | |
| | | public static final String PURCHASE_REQUEST_NO_PREFIX = "CGSQ"; |
| | | |
| | | /** |
| | | * éè´è®¡å {@link cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchasePlanDO} |
| | | */ |
| | | public static final String PURCHASE_PLAN_NO_PREFIX = "CGJH"; |
| | | |
| | | /** |
| | | * éè´æ¥ç¥¨ {@link cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchaseInvoiceDO} |
| | | */ |
| | | public static final String PURCHASE_INVOICE_NO_PREFIX = "FPD"; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.erp.enums; |
| | | |
| | | import cn.iocoder.yudao.framework.common.core.ArrayValuable; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * ERP éè´è®¡åç¶ææä¸¾ |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum ErpPurchasePlanStatusEnum implements ArrayValuable<Integer> { |
| | | |
| | | DRAFT(0, "æªæäº¤"), |
| | | PROCESS(10, "审æ¹ä¸"), |
| | | APPROVE(20, "å®¡æ ¸éè¿"), |
| | | REJECT(30, "å®¡æ ¸ä¸éè¿"), |
| | | CANCEL(40, "已忶"); |
| | | |
| | | public static final Integer[] ARRAYS = Arrays.stream(values()) |
| | | .map(ErpPurchasePlanStatusEnum::getStatus).toArray(Integer[]::new); |
| | | |
| | | public static ErpPurchasePlanStatusEnum fromStatus(Integer status) { |
| | | if (status == null) { |
| | | return null; |
| | | } |
| | | return Arrays.stream(values()).filter(item -> item.getStatus().equals(status)).findFirst().orElse(null); |
| | | } |
| | | |
| | | public static ErpPurchasePlanStatusEnum fromName(String name) { |
| | | if (name == null) { |
| | | return null; |
| | | } |
| | | return Arrays.stream(values()).filter(item -> item.getName().equals(name)).findFirst().orElse(null); |
| | | } |
| | | |
| | | /** |
| | | * ç¶æ |
| | | */ |
| | | private final Integer status; |
| | | /** |
| | | * ç¶æå |
| | | */ |
| | | private final String name; |
| | | |
| | | @Override |
| | | public Integer[] array() { |
| | | return ARRAYS; |
| | | } |
| | | |
| | | } |
| | |
| | | ErrorCode PURCHASE_REQUEST_BPM_CATEGORY_NOT_EXISTS = new ErrorCode(1_030_104_008, "éè´ç³è¯·å®¡æ¹åç±»ä¸åå¨ï¼è¯·å
å¨BPM模åå建éè´ç³è¯·å®¡æ¹æµç¨åç±»"); |
| | | ErrorCode PURCHASE_REQUEST_BPM_PROCESS_DEFINITION_NOT_EXISTS = new ErrorCode(1_030_104_009, "éè´ç³è¯·å®¡æ¹åç±»ä¸æ²¡æå¯ç¨çæµç¨æ¨¡åï¼è¯·å
å建并å叿µç¨"); |
| | | |
| | | // ========== ERP éè´è®¡åï¼1-030-104-010ï¼ ========== |
| | | ErrorCode PURCHASE_PLAN_NOT_EXISTS = new ErrorCode(1_030_104_010, "éè´è®¡åä¸åå¨"); |
| | | ErrorCode PURCHASE_PLAN_DELETE_FAIL_NOT_DRAFT = new ErrorCode(1_030_104_011, "éè´è®¡å({})䏿¯èç¨¿ç¶æï¼æ æ³å é¤"); |
| | | ErrorCode PURCHASE_PLAN_UPDATE_FAIL_NOT_DRAFT = new ErrorCode(1_030_104_012, "éè´è®¡å({})䏿¯èç¨¿ç¶æï¼æ æ³ä¿®æ¹"); |
| | | ErrorCode PURCHASE_PLAN_SUBMIT_FAIL_NOT_DRAFT = new ErrorCode(1_030_104_013, "æäº¤å¤±è´¥ï¼åªæèç¨¿ç¶æçéè´è®¡åæè½æäº¤"); |
| | | ErrorCode PURCHASE_PLAN_NO_EXISTS = new ErrorCode(1_030_104_014, "çæè®¡ååå·å¤±è´¥ï¼è¯·éæ°æäº¤"); |
| | | ErrorCode PURCHASE_PLAN_UPDATE_AUDIT_STATUS_FAIL_NOT_PROCESS = new ErrorCode(1_030_104_015, "æ´æ°å®¡æ¹ç¶æå¤±è´¥ï¼åªæå®¡æ¹ä¸çéè´è®¡åæè½æ´æ°"); |
| | | ErrorCode PURCHASE_PLAN_NOT_APPROVE = new ErrorCode(1_030_104_016, "éè´è®¡åæªå®¡æ ¸éè¿ï¼æ æ³æä½"); |
| | | ErrorCode PURCHASE_PLAN_REQUEST_EXISTS = new ErrorCode(1_030_104_017, "éè´è®¡åå·²çæéè´ç³è¯·ï¼è¯·å¿é夿ä½"); |
| | | ErrorCode PURCHASE_PLAN_BPM_CATEGORY_NOT_EXISTS = new ErrorCode(1_030_104_018, "éè´è®¡å审æ¹åç±»ä¸åå¨ï¼è¯·å
å¨BPM模åå建éè´è®¡åå®¡æ¹æµç¨åç±»"); |
| | | ErrorCode PURCHASE_PLAN_BPM_PROCESS_DEFINITION_NOT_EXISTS = new ErrorCode(1_030_104_019, "éè´è®¡å审æ¹åç±»ä¸æ²¡æå¯ç¨çæµç¨æ¨¡åï¼è¯·å
å建并å叿µç¨"); |
| | | ErrorCode PURCHASE_PLAN_ITEM_EMPTY = new ErrorCode(1_030_104_020, "éè´è®¡åæç»ä¸è½ä¸ºç©º"); |
| | | |
| | | // ========== ERP éè´æ¥ç¥¨ï¼1-030-105-000ï¼ ========== |
| | | ErrorCode PURCHASE_INVOICE_NOT_EXISTS = new ErrorCode(1_030_105_000, "æ¥ç¥¨ä¸åå¨"); |
| | | ErrorCode PURCHASE_INVOICE_NO_EXISTS = new ErrorCode(1_030_105_001, "çææ¥ç¥¨ç¼å·å¤±è´¥ï¼è¯·éæ°æäº¤"); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.erp.job.purchase; |
| | | |
| | | import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler; |
| | | import cn.iocoder.yudao.framework.tenant.core.job.TenantJob; |
| | | import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchasePlanDO; |
| | | import cn.iocoder.yudao.module.erp.service.purchase.ErpPurchasePlanService; |
| | | import jakarta.annotation.Resource; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * åºåé¢è¦èªå¨çæéè´è®¡å Job |
| | | * |
| | | * <p>宿¶æ«æå¯ç¨å®å
¨åºåçç©æï¼å½ååºåä½äºå®å
¨åºåä¸éæ¶èªå¨çæè稿éè´è®¡åï¼ |
| | | * 满足ãç»ååºåé¢è¦å¶å®éè´è®¡åãçèªå¨åè¯æ±ã |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class ErpPurchasePlanStockAlertJob implements JobHandler { |
| | | |
| | | @Resource |
| | | private ErpPurchasePlanService purchasePlanService; |
| | | |
| | | @Override |
| | | @TenantJob |
| | | public String execute(String param) { |
| | | try { |
| | | ErpPurchasePlanDO plan = purchasePlanService.generatePlanFromStockAlert("åºåé¢è¦èªå¨çæ", null); |
| | | return plan == null ? "åºåé¢è¦èªå¨çæéè´è®¡åï¼æ 缺éç©æï¼è·³è¿" |
| | | : String.format("åºåé¢è¦èªå¨çæéè´è®¡åæåï¼è®¡åç¼å·ï¼%s", plan.getId()); |
| | | } catch (Exception e) { |
| | | log.warn("[execute][åºåé¢è¦èªå¨çæéè´è®¡åè·³è¿/失败ï¼åå ï¼{}]", e.getMessage()); |
| | | return "åºåé¢è¦èªå¨çæéè´è®¡åè·³è¿ï¼" + e.getMessage(); |
| | | } |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.erp.service.purchase; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.plan.ErpPurchasePlanPageReqVO; |
| | | import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.plan.ErpPurchasePlanSaveReqVO; |
| | | import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchasePlanDO; |
| | | import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchasePlanItemDO; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * ERP éè´è®¡å Service æ¥å£ |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | public interface ErpPurchasePlanService { |
| | | |
| | | /** |
| | | * å建éè´è®¡å |
| | | * |
| | | * @param createReqVO åå»ºä¿¡æ¯ |
| | | * @return ç¼å· |
| | | */ |
| | | Long createPurchasePlan(ErpPurchasePlanSaveReqVO createReqVO); |
| | | |
| | | /** |
| | | * æ´æ°éè´è®¡å |
| | | * |
| | | * @param updateReqVO æ´æ°ä¿¡æ¯ |
| | | */ |
| | | void updatePurchasePlan(ErpPurchasePlanSaveReqVO updateReqVO); |
| | | |
| | | /** |
| | | * å é¤éè´è®¡å |
| | | * |
| | | * @param ids ç¼å·æ°ç» |
| | | */ |
| | | void deletePurchasePlan(Collection<Long> ids); |
| | | |
| | | /** |
| | | * è·å¾éè´è®¡å |
| | | * |
| | | * @param id ç¼å· |
| | | * @return éè´è®¡å |
| | | */ |
| | | ErpPurchasePlanDO getPurchasePlan(Long id); |
| | | |
| | | /** |
| | | * è·å¾éè´è®¡åæç»å表 |
| | | * |
| | | * @param planId éè´è®¡åç¼å· |
| | | * @return æç»å表 |
| | | */ |
| | | List<ErpPurchasePlanItemDO> getPurchasePlanItemListByPlanId(Long planId); |
| | | |
| | | /** |
| | | * æéè´è®¡åç¼å·éåè·å¾æç»å表 |
| | | * |
| | | * @param planIds éè´è®¡åç¼å·éå |
| | | * @return æç»å表 |
| | | */ |
| | | List<ErpPurchasePlanItemDO> getPurchasePlanItemListByPlanIds(Collection<Long> planIds); |
| | | |
| | | /** |
| | | * è·å¾éè´è®¡åå页 |
| | | * |
| | | * @param pageReqVO å页æ¥è¯¢ |
| | | * @return éè´è®¡åå页 |
| | | */ |
| | | PageResult<ErpPurchasePlanDO> getPurchasePlanPage(ErpPurchasePlanPageReqVO pageReqVO); |
| | | |
| | | /** |
| | | * æäº¤éè´è®¡åå®¡æ¹ |
| | | * |
| | | * @param id ç¼å· |
| | | * @param processDefinitionKey BPM æµç¨å®ä¹ Key |
| | | * @param userId ç¨æ·ç¼å· |
| | | */ |
| | | void submitPurchasePlan(Long id, String processDefinitionKey, Long userId); |
| | | |
| | | /** |
| | | * è·åéè´è®¡åå®¡æ¹æµç¨å表 |
| | | * |
| | | * @return æµç¨å®ä¹å表 |
| | | */ |
| | | List<Map<String, Object>> getPurchasePlanApproveProcessDefinitionList(); |
| | | |
| | | /** |
| | | * BPM 审æ¹ç»æåè°æ´æ°éè´è®¡åç¶æ |
| | | * |
| | | * @param id éè´è®¡åç¼å· |
| | | * @param bpmResult BPM 审æ¹ç»æ |
| | | */ |
| | | void updatePurchasePlanAuditStatus(Long id, Integer bpmResult); |
| | | |
| | | /** |
| | | * æ ¹æ®åºåé¢è¦èªå¨çæéè´è®¡åï¼èç¨¿ï¼ |
| | | * |
| | | * <p>éåå¯ç¨å®å
¨åºåçç©æï¼å½ååºåä½äºå®å
¨åºåä¸éæ¶ï¼ |
| | | * æç¼ºéçæè®¡åæç»ãè¿åè稿计åï¼ç±ç¼å¶äººæ ¸å¯¹åæäº¤å®¡æ¹ã |
| | | * |
| | | * @param name 计ååç§° |
| | | * @param supplierId ä¾åºåç¼å·ï¼å¯éï¼ |
| | | * @return çæçéè´è®¡å |
| | | */ |
| | | ErpPurchasePlanDO generatePlanFromStockAlert(String name, Long supplierId); |
| | | |
| | | /** |
| | | * 审æ¹éè¿åçæéè´ç³è¯· |
| | | * |
| | | * @param id éè´è®¡åç¼å· |
| | | * @return çæçéè´ç³è¯·ç¼å·å表 |
| | | */ |
| | | List<Long> generatePurchaseRequests(Long id); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.erp.service.purchase; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi; |
| | | import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; |
| | | import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionInfoDO; |
| | | import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum; |
| | | import cn.iocoder.yudao.module.bpm.service.definition.BpmCategoryService; |
| | | import cn.iocoder.yudao.module.bpm.service.definition.BpmProcessDefinitionService; |
| | | import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.plan.ErpPurchasePlanPageReqVO; |
| | | import cn.iocoder.yudao.module.erp.controller.admin.purchase.vo.plan.ErpPurchasePlanSaveReqVO; |
| | | import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchasePlanDO; |
| | | import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchasePlanItemDO; |
| | | import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchaseRequestDO; |
| | | import cn.iocoder.yudao.module.erp.dal.dataobject.purchase.ErpPurchaseRequestItemDO; |
| | | import cn.iocoder.yudao.module.erp.dal.mysql.purchase.ErpPurchasePlanItemMapper; |
| | | import cn.iocoder.yudao.module.erp.dal.mysql.purchase.ErpPurchasePlanMapper; |
| | | import cn.iocoder.yudao.module.erp.dal.mysql.purchase.ErpPurchaseRequestItemMapper; |
| | | import cn.iocoder.yudao.module.erp.dal.mysql.purchase.ErpPurchaseRequestMapper; |
| | | import cn.iocoder.yudao.module.erp.dal.redis.no.ErpNoRedisDAO; |
| | | import cn.iocoder.yudao.module.erp.enums.ErpPurchasePlanStatusEnum; |
| | | import cn.iocoder.yudao.module.erp.enums.ErpPurchaseRequestStatusEnum; |
| | | import cn.iocoder.yudao.module.mes.api.item.MesMdItemApi; |
| | | import cn.iocoder.yudao.module.mes.api.item.dto.MesMdItemSafetyStockRespDTO; |
| | | import cn.iocoder.yudao.module.mes.api.wms.MesWmStockApi; |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| | | import jakarta.annotation.Resource; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.flowable.engine.repository.ProcessDefinition; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; |
| | | import static cn.iocoder.yudao.module.erp.enums.ErrorCodeConstants.*; |
| | | |
| | | /** |
| | | * ERP éè´è®¡å Service å®ç°ç±» |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @Service |
| | | @Validated |
| | | @Slf4j |
| | | public class ErpPurchasePlanServiceImpl implements ErpPurchasePlanService { |
| | | |
| | | /** |
| | | * BPM éè´è®¡å审æ¹åç±»ç¼ç |
| | | */ |
| | | private static final String PURCHASE_PLAN_APPROVE_CATEGORY_CODE = "purchase_plan_approve"; |
| | | |
| | | /** |
| | | * éæ±æ¥æºï¼åºåé¢è¦ |
| | | */ |
| | | public static final Integer DEMAND_SOURCE_STOCK_ALERT = 1; |
| | | /** |
| | | * éæ±æ¥æºï¼è¿ç»´/ç产计å |
| | | */ |
| | | public static final Integer DEMAND_SOURCE_PLAN = 2; |
| | | |
| | | @Resource |
| | | private ErpPurchasePlanMapper purchasePlanMapper; |
| | | @Resource |
| | | private ErpPurchasePlanItemMapper purchasePlanItemMapper; |
| | | |
| | | @Resource |
| | | private ErpPurchaseRequestMapper purchaseRequestMapper; |
| | | @Resource |
| | | private ErpPurchaseRequestItemMapper purchaseRequestItemMapper; |
| | | |
| | | @Resource |
| | | private ErpNoRedisDAO noRedisDAO; |
| | | |
| | | @Resource |
| | | private BpmProcessInstanceApi processInstanceApi; |
| | | @Resource |
| | | private BpmCategoryService bpmCategoryService; |
| | | @Resource |
| | | private BpmProcessDefinitionService bpmProcessDefinitionService; |
| | | |
| | | @Resource |
| | | private AdminUserApi adminUserApi; |
| | | |
| | | @Resource |
| | | private MesMdItemApi mesMdItemApi; |
| | | @Resource |
| | | private MesWmStockApi mesWmStockApi; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long createPurchasePlan(ErpPurchasePlanSaveReqVO createReqVO) { |
| | | // 1. æ ¡éªæç» |
| | | List<ErpPurchasePlanItemDO> planItems = convertList(createReqVO.getItems(), item -> |
| | | BeanUtils.toBean(item, ErpPurchasePlanItemDO.class)); |
| | | if (CollUtil.isEmpty(planItems)) { |
| | | throw exception(PURCHASE_PLAN_ITEM_EMPTY); |
| | | } |
| | | // 2. çæè®¡ååå· |
| | | String no = noRedisDAO.generate(ErpNoRedisDAO.PURCHASE_PLAN_NO_PREFIX); |
| | | if (purchasePlanMapper.selectByNo(no) != null) { |
| | | throw exception(PURCHASE_PLAN_NO_EXISTS); |
| | | } |
| | | // 3. è·åå½åç¨æ·ä¿¡æ¯ |
| | | Long userId = Long.parseLong(getCurrentUserId()); |
| | | AdminUserRespDTO user = adminUserApi.getUser(userId); |
| | | Long deptId = user != null ? user.getDeptId() : null; |
| | | // 4. æå
¥éè´è®¡å |
| | | ErpPurchasePlanDO plan = BeanUtils.toBean(createReqVO, ErpPurchasePlanDO.class, req -> req |
| | | .setNo(no) |
| | | .setStatus(ErpPurchasePlanStatusEnum.DRAFT.getStatus()) |
| | | .setPlanUserId(userId) |
| | | .setPlanDeptId(deptId) |
| | | .setGeneratedFlag(false) |
| | | .setTotalCount(planItems.stream() |
| | | .map(ErpPurchasePlanItemDO::getCount).filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add))); |
| | | purchasePlanMapper.insert(plan); |
| | | // 5. æå
¥æç» |
| | | purchasePlanItemMapper.insertBatch(convertList(planItems, item -> item.setPlanId(plan.getId()))); |
| | | return plan.getId(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updatePurchasePlan(ErpPurchasePlanSaveReqVO updateReqVO) { |
| | | // 1.1 æ ¡éªåå¨ + èç¨¿ç¶æ |
| | | ErpPurchasePlanDO oldPlan = validatePurchasePlanCanModify(updateReqVO.getId()); |
| | | // 1.2 æ ¡éªæç» |
| | | List<ErpPurchasePlanItemDO> planItems = convertList(updateReqVO.getItems(), item -> |
| | | BeanUtils.toBean(item, ErpPurchasePlanItemDO.class)); |
| | | if (CollUtil.isEmpty(planItems)) { |
| | | throw exception(PURCHASE_PLAN_ITEM_EMPTY); |
| | | } |
| | | // 2. æ´æ°ä¸»è¡¨ |
| | | ErpPurchasePlanDO updateObj = BeanUtils.toBean(updateReqVO, ErpPurchasePlanDO.class, req -> req |
| | | .setNo(oldPlan.getNo()) |
| | | .setStatus(oldPlan.getStatus()) |
| | | .setPlanUserId(oldPlan.getPlanUserId()) |
| | | .setPlanDeptId(oldPlan.getPlanDeptId()) |
| | | .setGeneratedFlag(oldPlan.getGeneratedFlag()) |
| | | .setTotalCount(planItems.stream() |
| | | .map(ErpPurchasePlanItemDO::getCount).filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add))); |
| | | purchasePlanMapper.updateById(updateObj); |
| | | // 3. æ´æ°æç»ï¼å
å åæ |
| | | purchasePlanItemMapper.deleteByPlanId(updateReqVO.getId()); |
| | | purchasePlanItemMapper.insertBatch(convertList(planItems, item -> item.setPlanId(updateReqVO.getId()))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deletePurchasePlan(Collection<Long> ids) { |
| | | if (CollUtil.isEmpty(ids)) { |
| | | return; |
| | | } |
| | | for (Long id : ids) { |
| | | // 1. æ ¡éªåå¨ + èç¨¿ç¶æ |
| | | validatePurchasePlanCanModify(id); |
| | | // 2. å é¤æç» |
| | | purchasePlanItemMapper.deleteByPlanId(id); |
| | | // 3. å é¤ä¸»è¡¨ |
| | | purchasePlanMapper.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public ErpPurchasePlanDO getPurchasePlan(Long id) { |
| | | return purchasePlanMapper.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<ErpPurchasePlanItemDO> getPurchasePlanItemListByPlanId(Long planId) { |
| | | return purchasePlanItemMapper.selectListByPlanId(planId); |
| | | } |
| | | |
| | | @Override |
| | | public List<ErpPurchasePlanItemDO> getPurchasePlanItemListByPlanIds(Collection<Long> planIds) { |
| | | return purchasePlanItemMapper.selectListByPlanIds(planIds); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<ErpPurchasePlanDO> getPurchasePlanPage(ErpPurchasePlanPageReqVO pageReqVO) { |
| | | return purchasePlanMapper.selectPage(pageReqVO); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void submitPurchasePlan(Long id, String processDefinitionKey, Long userId) { |
| | | // 1. æ ¡éªåå¨ + èç¨¿ç¶æ |
| | | ErpPurchasePlanDO plan = validatePurchasePlanCanModify(id); |
| | | // 2. æ ¡éªæ¯å¦ææç» |
| | | List<ErpPurchasePlanItemDO> items = purchasePlanItemMapper.selectListByPlanId(id); |
| | | if (CollUtil.isEmpty(items)) { |
| | | throw exception(PURCHASE_PLAN_ITEM_EMPTY); |
| | | } |
| | | // 3. å建 BPM æµç¨å®ä¾ |
| | | String processInstanceId = processInstanceApi.createProcessInstance(userId, |
| | | new BpmProcessInstanceCreateReqDTO() |
| | | .setProcessDefinitionKey(processDefinitionKey) |
| | | .setBusinessKey(String.valueOf(id))); |
| | | // 4. æ´æ°éè´è®¡åç¶æä¸ºå®¡æ¹ä¸ |
| | | purchasePlanMapper.updateById(new ErpPurchasePlanDO() |
| | | .setId(id) |
| | | .setStatus(ErpPurchasePlanStatusEnum.PROCESS.getStatus()) |
| | | .setProcessInstanceId(processInstanceId)); |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getPurchasePlanApproveProcessDefinitionList() { |
| | | // 1. æ ¡éªåç±»åæµç¨å®ä¹æ¯å¦åå¨ |
| | | validatePurchasePlanApproveCategoryAndProcessDefinition(); |
| | | // 2. è·ååç±»ä¸çæµç¨å®ä¹ä¿¡æ¯ |
| | | List<BpmProcessDefinitionInfoDO> definitionInfoList = bpmProcessDefinitionService |
| | | .getProcessDefinitionInfoListByCategory(PURCHASE_PLAN_APPROVE_CATEGORY_CODE); |
| | | if (CollUtil.isEmpty(definitionInfoList)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | // 3. éåè·åæµç¨å®ä¹è¯¦æ
ï¼è¿æ»¤æ¿æ´»ç¶æï¼ä¿çææ°çæ¬ |
| | | Map<String, ProcessDefinition> latestVersionMap = new HashMap<>(); |
| | | for (BpmProcessDefinitionInfoDO info : definitionInfoList) { |
| | | ProcessDefinition pd = bpmProcessDefinitionService.getProcessDefinition(info.getProcessDefinitionId()); |
| | | if (pd == null || pd.isSuspended()) { |
| | | continue; |
| | | } |
| | | ProcessDefinition existing = latestVersionMap.get(pd.getKey()); |
| | | if (existing == null || pd.getVersion() > existing.getVersion()) { |
| | | latestVersionMap.put(pd.getKey(), pd); |
| | | } |
| | | } |
| | | // 4. è¿åæµç¨å®ä¹å表 |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (ProcessDefinition pd : latestVersionMap.values()) { |
| | | Map<String, Object> item = new HashMap<>(); |
| | | item.put("id", pd.getId()); |
| | | item.put("key", pd.getKey()); |
| | | item.put("name", pd.getName()); |
| | | result.add(item); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updatePurchasePlanAuditStatus(Long id, Integer bpmResult) { |
| | | // 1. æ ¡éªåå¨ |
| | | ErpPurchasePlanDO plan = validatePurchasePlanExists(id); |
| | | if (!ErpPurchasePlanStatusEnum.PROCESS.getStatus().equals(plan.getStatus())) { |
| | | log.warn("[updatePurchasePlanAuditStatus] éè´è®¡å({}) ä¸å¤äºå®¡æ¹ä¸ç¶æ", id); |
| | | return; |
| | | } |
| | | // 2. æ ¹æ®å®¡æ¹ç»ææ´æ°ç¶æ |
| | | Integer newStatus = convertBpmResultToStatus(bpmResult); |
| | | if (newStatus != null) { |
| | | purchasePlanMapper.updateById(new ErpPurchasePlanDO().setId(id).setStatus(newStatus)); |
| | | } |
| | | // 3. 审æ¹éè¿ä¸æªçæç³è¯·ï¼èªå¨çæéè´ç³è¯· |
| | | if (ErpPurchasePlanStatusEnum.APPROVE.getStatus().equals(newStatus) |
| | | && !Boolean.TRUE.equals(plan.getGeneratedFlag())) { |
| | | try { |
| | | List<Long> requestIds = doGeneratePurchaseRequests(plan); |
| | | log.info("[updatePurchasePlanAuditStatus] éè´è®¡å({}) èªå¨çæéè´ç³è¯·({})", id, requestIds); |
| | | } catch (Exception e) { |
| | | log.error("[updatePurchasePlanAuditStatus] éè´è®¡å({}) èªå¨çæéè´ç³è¯·å¤±è´¥", id, e); |
| | | // 䏿åºå¼å¸¸ï¼é¿å
å½±åç¶ææ´æ° |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ErpPurchasePlanDO generatePlanFromStockAlert(String name, Long supplierId) { |
| | | // 1. è·åå¯ç¨å®å
¨åºåçç©æ |
| | | List<MesMdItemSafetyStockRespDTO> safetyStockItems = mesMdItemApi.getSafetyStockItemList(); |
| | | if (CollUtil.isEmpty(safetyStockItems)) { |
| | | throw exception(PURCHASE_PLAN_ITEM_EMPTY); |
| | | } |
| | | // 2. 计ç®ç¼ºéï¼çæè®¡åæç» |
| | | List<ErpPurchasePlanSaveReqVO.Item> items = new ArrayList<>(); |
| | | for (MesMdItemSafetyStockRespDTO item : safetyStockItems) { |
| | | if (item.getMinStock() == null) { |
| | | continue; |
| | | } |
| | | BigDecimal stock = mesWmStockApi.getStockQuantity(item.getId()); |
| | | BigDecimal shortage = item.getMinStock().subtract(stock == null ? BigDecimal.ZERO : stock); |
| | | if (shortage.compareTo(BigDecimal.ZERO) <= 0) { |
| | | continue; |
| | | } |
| | | ErpPurchasePlanSaveReqVO.Item planItem = new ErpPurchasePlanSaveReqVO.Item(); |
| | | planItem.setProductId(item.getMdmItemId()); |
| | | planItem.setProductUnitId(item.getUnitMeasureId()); |
| | | planItem.setCount(shortage); |
| | | items.add(planItem); |
| | | } |
| | | if (CollUtil.isEmpty(items)) { |
| | | throw exception(PURCHASE_PLAN_ITEM_EMPTY); |
| | | } |
| | | // 3. å建è稿éè´è®¡å |
| | | ErpPurchasePlanSaveReqVO createReqVO = new ErpPurchasePlanSaveReqVO(); |
| | | createReqVO.setName(name != null ? name : "åºåé¢è¦éè´è®¡å"); |
| | | createReqVO.setDemandSource(DEMAND_SOURCE_STOCK_ALERT); |
| | | createReqVO.setPlanDate(LocalDateTime.now()); |
| | | createReqVO.setSupplierId(supplierId); |
| | | createReqVO.setItems(items); |
| | | Long planId = createPurchasePlan(createReqVO); |
| | | return purchasePlanMapper.selectById(planId); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public List<Long> generatePurchaseRequests(Long id) { |
| | | // 1. æ ¡éªåå¨ + å®¡æ ¸éè¿ç¶æ |
| | | ErpPurchasePlanDO plan = validatePurchasePlanExists(id); |
| | | if (!ErpPurchasePlanStatusEnum.APPROVE.getStatus().equals(plan.getStatus())) { |
| | | throw exception(PURCHASE_PLAN_NOT_APPROVE); |
| | | } |
| | | // 2. æ ¡éªæ¯å¦å·²çæç³è¯· |
| | | if (Boolean.TRUE.equals(plan.getGeneratedFlag())) { |
| | | throw exception(PURCHASE_PLAN_REQUEST_EXISTS); |
| | | } |
| | | // 3. çæéè´ç³è¯· |
| | | return doGeneratePurchaseRequests(plan); |
| | | } |
| | | |
| | | /** |
| | | * æ§è¡çæéè´ç³è¯·ï¼ä¸ä¸ªè®¡åçæä¸å¼ ç³è¯·åï¼ |
| | | * |
| | | * @param plan éè´è®¡å |
| | | * @return éè´ç³è¯·ç¼å·å表 |
| | | */ |
| | | private List<Long> doGeneratePurchaseRequests(ErpPurchasePlanDO plan) { |
| | | // 1. è·å计åæç» |
| | | List<ErpPurchasePlanItemDO> planItems = purchasePlanItemMapper.selectListByPlanId(plan.getId()); |
| | | if (CollUtil.isEmpty(planItems)) { |
| | | throw exception(PURCHASE_PLAN_ITEM_EMPTY); |
| | | } |
| | | // 2. çæç³è¯·åå· |
| | | String requestNo = noRedisDAO.generate(ErpNoRedisDAO.PURCHASE_REQUEST_NO_PREFIX); |
| | | if (purchaseRequestMapper.selectByNo(requestNo) != null) { |
| | | throw exception(PURCHASE_REQUEST_NO_EXISTS); |
| | | } |
| | | // 3. å建éè´ç³è¯· |
| | | ErpPurchaseRequestDO request = new ErpPurchaseRequestDO(); |
| | | request.setNo(requestNo); |
| | | request.setStatus(ErpPurchaseRequestStatusEnum.DRAFT.getStatus()); |
| | | request.setRequestUserId(plan.getPlanUserId()); |
| | | request.setRequestDeptId(plan.getPlanDeptId()); |
| | | request.setRequestTime(LocalDateTime.now()); |
| | | request.setSupplierId(plan.getSupplierId()); |
| | | request.setTotalCount(planItems.stream() |
| | | .map(ErpPurchasePlanItemDO::getCount).filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add)); |
| | | request.setTotalPrice(BigDecimal.ZERO); |
| | | request.setTotalProductPrice(BigDecimal.ZERO); |
| | | request.setTotalTaxPrice(BigDecimal.ZERO); |
| | | request.setRemark(plan.getRemark()); |
| | | request.setInStatus(0); |
| | | purchaseRequestMapper.insert(request); |
| | | // 4. å建éè´ç³è¯·æç» |
| | | List<ErpPurchaseRequestItemDO> requestItems = convertList(planItems, item -> { |
| | | ErpPurchaseRequestItemDO requestItem = new ErpPurchaseRequestItemDO(); |
| | | requestItem.setRequestId(request.getId()); |
| | | requestItem.setProductId(item.getProductId()); |
| | | requestItem.setProductUnitId(item.getProductUnitId()); |
| | | requestItem.setCount(item.getCount()); |
| | | requestItem.setDemandTime(item.getDemandTime()); |
| | | requestItem.setRemark(item.getRemark()); |
| | | requestItem.setInCount(BigDecimal.ZERO); |
| | | return requestItem; |
| | | }); |
| | | purchaseRequestItemMapper.insertBatch(requestItems); |
| | | // 5. åå计åå·²çææ è®° |
| | | purchasePlanMapper.updateById(new ErpPurchasePlanDO() |
| | | .setId(plan.getId()).setGeneratedFlag(true)); |
| | | return List.of(request.getId()); |
| | | } |
| | | |
| | | private Integer convertBpmResultToStatus(Integer bpmResult) { |
| | | if (BpmTaskStatusEnum.APPROVE.getStatus().equals(bpmResult)) { |
| | | return ErpPurchasePlanStatusEnum.APPROVE.getStatus(); |
| | | } |
| | | if (BpmTaskStatusEnum.REJECT.getStatus().equals(bpmResult)) { |
| | | return ErpPurchasePlanStatusEnum.REJECT.getStatus(); |
| | | } |
| | | if (BpmTaskStatusEnum.CANCEL.getStatus().equals(bpmResult)) { |
| | | return ErpPurchasePlanStatusEnum.CANCEL.getStatus(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private void validatePurchasePlanApproveCategoryAndProcessDefinition() { |
| | | List<cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmCategoryDO> categories = |
| | | bpmCategoryService.getCategoryListByCode(Collections.singletonList(PURCHASE_PLAN_APPROVE_CATEGORY_CODE)); |
| | | if (CollUtil.isEmpty(categories)) { |
| | | throw exception(PURCHASE_PLAN_BPM_CATEGORY_NOT_EXISTS); |
| | | } |
| | | List<BpmProcessDefinitionInfoDO> definitionInfoList = bpmProcessDefinitionService |
| | | .getProcessDefinitionInfoListByCategory(PURCHASE_PLAN_APPROVE_CATEGORY_CODE); |
| | | if (CollUtil.isEmpty(definitionInfoList)) { |
| | | throw exception(PURCHASE_PLAN_BPM_PROCESS_DEFINITION_NOT_EXISTS); |
| | | } |
| | | } |
| | | |
| | | private ErpPurchasePlanDO validatePurchasePlanExists(Long id) { |
| | | ErpPurchasePlanDO plan = purchasePlanMapper.selectById(id); |
| | | if (plan == null) { |
| | | throw exception(PURCHASE_PLAN_NOT_EXISTS); |
| | | } |
| | | return plan; |
| | | } |
| | | |
| | | private ErpPurchasePlanDO validatePurchasePlanCanModify(Long id) { |
| | | ErpPurchasePlanDO plan = validatePurchasePlanExists(id); |
| | | if (!ErpPurchasePlanStatusEnum.DRAFT.getStatus().equals(plan.getStatus())) { |
| | | throw exception(PURCHASE_PLAN_UPDATE_FAIL_NOT_DRAFT, plan.getNo()); |
| | | } |
| | | return plan; |
| | | } |
| | | |
| | | private String getCurrentUserId() { |
| | | return cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId().toString(); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.erp.service.purchase.listener; |
| | | |
| | | import cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEvent; |
| | | import cn.iocoder.yudao.module.erp.service.purchase.ErpPurchasePlanService; |
| | | import jakarta.annotation.Resource; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * éè´è®¡å审æ¹ç¶æçå¬å¨ |
| | | * |
| | | * çå¬ BPM æµç¨å®ä¾ç¶æåæ´äºä»¶ï¼æ´æ°éè´è®¡åç审æ¹ç¶æ |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class ErpPurchasePlanStatusListener extends cn.iocoder.yudao.module.bpm.api.event.BpmProcessInstanceStatusEventListener { |
| | | |
| | | /** |
| | | * éè´è®¡åå®¡æ¹æµç¨å®ä¹ Key |
| | | */ |
| | | private static final String PROCESS_DEFINITION_KEY = "purchase_plan_approve"; |
| | | |
| | | @Resource |
| | | private ErpPurchasePlanService purchasePlanService; |
| | | |
| | | @Override |
| | | protected String getProcessDefinitionKey() { |
| | | return PROCESS_DEFINITION_KEY; |
| | | } |
| | | |
| | | @Override |
| | | protected void onEvent(BpmProcessInstanceStatusEvent event) { |
| | | Long planId; |
| | | try { |
| | | planId = Long.parseLong(event.getBusinessKey()); |
| | | } catch (NumberFormatException e) { |
| | | log.warn("[onEvent] businessKey({}) 䏿¯ææçéè´è®¡åç¼å·", event.getBusinessKey()); |
| | | return; |
| | | } |
| | | |
| | | log.info("[onEvent] æ¶å°BPM审æ¹äºä»¶ï¼planId={}, status={}", planId, event.getStatus()); |
| | | |
| | | try { |
| | | purchasePlanService.updatePurchasePlanAuditStatus(planId, event.getStatus()); |
| | | log.info("[onEvent] éè´è®¡å({}) 审æ¹ç¶ææ´æ°å®æ", planId); |
| | | } catch (Exception e) { |
| | | log.error("[onEvent] æ´æ°éè´è®¡å审æ¹ç¶æå¤±è´¥ï¼planId={}", planId, e); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | ErrorCode EMPLOYEE_CONTRACT_END_DATE_REQUIRE_FOR_FIXED = new ErrorCode(1_030_000_013, "åºå®æéååå¿
须填åç»ææ¥æ"); |
| | | ErrorCode EMPLOYEE_CONTRACT_DATE_INVALID = new ErrorCode(1_030_000_014, "å忥æä¸åæ³ï¼å¼å§æ¥æä¸è½æäºç»ææ¥æ"); |
| | | ErrorCode EMPLOYEE_CONTRACT_DATE_OVERLAP = new ErrorCode(1_030_000_015, "该å工卿鿶鴿®µå·²å卿ªè§£é¤/æªç»æ¢çååï¼è¯·å
è§£é¤/ç»æ¢ååç¾è®¢"); |
| | | ErrorCode HRM_CERTIFICATE_NOT_EXISTS = new ErrorCode(1_030_000_016, "è¯ä¹¦èµè´¨ä¸åå¨"); |
| | | ErrorCode HRM_EMPLOYEE_NOT_EXISTS = new ErrorCode(1_030_000_017, "åå·¥ä¸åå¨"); |
| | | |
| | | // ========== 请åç³è¯· 1-030-001-000 ========== |
| | | ErrorCode LEAVE_APPLICATION_NOT_EXISTS = new ErrorCode(1_030_001_000, "请åç³è¯·ä¸åå¨"); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.hrm.controller.admin.certificate; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.certificate.vo.HrmCertificatePageReqVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.certificate.vo.HrmCertificateRespVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.certificate.vo.HrmCertificateSaveReqVO; |
| | | import cn.iocoder.yudao.module.hrm.dal.dataobject.certificate.HrmCertificateDO; |
| | | import cn.iocoder.yudao.module.hrm.dal.dataobject.employee.HrmEmployeeDO; |
| | | import cn.iocoder.yudao.module.hrm.service.certificate.HrmCertificateService; |
| | | import cn.iocoder.yudao.module.hrm.service.employee.HrmEmployeeService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| | | |
| | | @Tag(name = "管çåå° - HRM è¯ä¹¦èµè´¨") |
| | | @RestController |
| | | @RequestMapping("/hrm/certificate") |
| | | @Validated |
| | | public class HrmCertificateController { |
| | | |
| | | @Resource |
| | | private HrmCertificateService certificateService; |
| | | @Resource |
| | | private HrmEmployeeService employeeService; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "å建è¯ä¹¦èµè´¨") |
| | | @PreAuthorize("@ss.hasPermission('hrm:certificate:create')") |
| | | public CommonResult<Long> createCertificate(@Valid @RequestBody HrmCertificateSaveReqVO createReqVO) { |
| | | return success(certificateService.createCertificate(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "æ´æ°è¯ä¹¦èµè´¨") |
| | | @PreAuthorize("@ss.hasPermission('hrm:certificate:update')") |
| | | public CommonResult<Boolean> updateCertificate(@Valid @RequestBody HrmCertificateSaveReqVO updateReqVO) { |
| | | certificateService.updateCertificate(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤è¯ä¹¦èµè´¨") |
| | | @Parameter(name = "ids", description = "ç¼å·æ°ç»", required = true) |
| | | @PreAuthorize("@ss.hasPermission('hrm:certificate:delete')") |
| | | public CommonResult<Boolean> deleteCertificate(@RequestParam("ids") List<Long> ids) { |
| | | certificateService.deleteCertificate(ids); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "è·å¾è¯ä¹¦èµè´¨") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('hrm:certificate:query')") |
| | | public CommonResult<HrmCertificateRespVO> getCertificate(@RequestParam("id") Long id) { |
| | | HrmCertificateDO certificate = certificateService.getCertificate(id); |
| | | return success(certificate != null ? buildRespVO(certificate) : null); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "è·å¾è¯ä¹¦èµè´¨å页") |
| | | @PreAuthorize("@ss.hasPermission('hrm:certificate:query')") |
| | | public CommonResult<PageResult<HrmCertificateRespVO>> getCertificatePage(@Valid HrmCertificatePageReqVO pageReqVO) { |
| | | PageResult<HrmCertificateDO> pageResult = certificateService.getCertificatePage(pageReqVO); |
| | | if (CollUtil.isEmpty(pageResult.getList())) { |
| | | return success(PageResult.empty(pageResult.getTotal())); |
| | | } |
| | | Map<Long, HrmEmployeeDO> employeeMap = employeeService.getEmployeeList( |
| | | convertSet(pageResult.getList(), HrmCertificateDO::getEmployeeId)).stream() |
| | | .collect(java.util.stream.Collectors.toMap(HrmEmployeeDO::getId, e -> e, (a, b) -> a)); |
| | | return success(BeanUtils.toBean(pageResult, HrmCertificateRespVO.class, |
| | | vo -> buildRespVOItem(vo, employeeMap.get(vo.getEmployeeId())))); |
| | | } |
| | | |
| | | private HrmCertificateRespVO buildRespVO(HrmCertificateDO certificate) { |
| | | HrmCertificateRespVO vo = BeanUtils.toBean(certificate, HrmCertificateRespVO.class); |
| | | HrmEmployeeDO employee = employeeService.getEmployee(certificate.getEmployeeId()); |
| | | buildRespVOItem(vo, employee); |
| | | return vo; |
| | | } |
| | | |
| | | private void buildRespVOItem(HrmCertificateRespVO vo, HrmEmployeeDO employee) { |
| | | if (employee != null) { |
| | | vo.setEmployeeName(employee.getName()); |
| | | } |
| | | vo.setCertTypeName(convertCertTypeName(vo.getCertType())); |
| | | vo.setExpireStatus(calcExpireStatus(vo.getExpireDate())); |
| | | } |
| | | |
| | | private String convertCertTypeName(Integer certType) { |
| | | return switch (certType == null ? 0 : certType) { |
| | | case 1 -> "ç¹ç§ä½ä¸è¯ä¹¦"; |
| | | case 2 -> "ä»ä¸èµè´¨"; |
| | | case 3 -> "æè½ç级è¯ä¹¦"; |
| | | case 4 -> "å®å
¨å¹è®åæ ¼è¯"; |
| | | default -> "å
¶ä»"; |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * å°æç¶æï¼0=ææï¼1=å³å°å°æï¼30天å
ï¼ï¼2=å·²è¿æ |
| | | */ |
| | | private Integer calcExpireStatus(LocalDate expireDate) { |
| | | if (expireDate == null) { |
| | | return 0; |
| | | } |
| | | LocalDate today = LocalDate.now(); |
| | | if (expireDate.isBefore(today)) { |
| | | return 2; |
| | | } |
| | | if (expireDate.isBefore(today.plusDays(30))) { |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.hrm.controller.admin.certificate.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | @Schema(description = "管çåå° - HRM è¯ä¹¦èµè´¨å页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class HrmCertificatePageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "åå·¥ç¼å·", example = "1") |
| | | private Long employeeId; |
| | | |
| | | @Schema(description = "è¯ä¹¦ç±»åï¼1=ç¹ç§ä½ä¸è¯ä¹¦ï¼2=ä»ä¸èµè´¨ï¼3=æè½ç级è¯ä¹¦ï¼4=å®å
¨å¹è®åæ ¼è¯ï¼", example = "1") |
| | | private Integer certType; |
| | | |
| | | @Schema(description = "è¯ä¹¦åç§°", example = "é«åçµå·¥ç¹ç§ä½ä¸æä½è¯") |
| | | private String certName; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.hrm.controller.admin.certificate.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - HRM è¯ä¹¦èµè´¨ Response VO") |
| | | @Data |
| | | public class HrmCertificateRespVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | private Long id; |
| | | |
| | | @Schema(description = "åå·¥ç¼å·", example = "1") |
| | | private Long employeeId; |
| | | |
| | | @Schema(description = "åå·¥å§å", example = "å¼ ä¸") |
| | | private String employeeName; |
| | | |
| | | @Schema(description = "è¯ä¹¦ç±»å", example = "1") |
| | | private Integer certType; |
| | | |
| | | @Schema(description = "è¯ä¹¦ç±»ååç§°", example = "ç¹ç§ä½ä¸è¯ä¹¦") |
| | | private String certTypeName; |
| | | |
| | | @Schema(description = "è¯ä¹¦åç§°", example = "é«åçµå·¥ç¹ç§ä½ä¸æä½è¯") |
| | | private String certName; |
| | | |
| | | @Schema(description = "è¯ä¹¦ç¼å·", example = "T2019-0001") |
| | | private String certNo; |
| | | |
| | | @Schema(description = "åè¯æºæ", example = "å½å®¶è½æºå±") |
| | | private String issueOrg; |
| | | |
| | | @Schema(description = "åè¯æ¥æ") |
| | | private LocalDate issueDate; |
| | | |
| | | @Schema(description = "æææè³") |
| | | private LocalDate expireDate; |
| | | |
| | | @Schema(description = "å°æç¶æï¼0=ææï¼1=å³å°å°æï¼2=å·²è¿æï¼") |
| | | private Integer expireStatus; |
| | | |
| | | @Schema(description = "夿³¨", example = "夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å建æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | private LocalDateTime createTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.hrm.controller.admin.certificate.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDate; |
| | | |
| | | @Schema(description = "管çåå° - HRM è¯ä¹¦èµè´¨æ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | | public class HrmCertificateSaveReqVO { |
| | | |
| | | @Schema(description = "ç¼å·ï¼ä¿®æ¹æ¶å¿
å¡«ï¼", example = "1") |
| | | private Long id; |
| | | |
| | | @Schema(description = "åå·¥ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @NotNull(message = "åå·¥ä¸è½ä¸ºç©º") |
| | | private Long employeeId; |
| | | |
| | | @Schema(description = "è¯ä¹¦ç±»åï¼1=ç¹ç§ä½ä¸è¯ä¹¦ï¼2=ä»ä¸èµè´¨ï¼3=æè½ç级è¯ä¹¦ï¼4=å®å
¨å¹è®åæ ¼è¯ï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @NotNull(message = "è¯ä¹¦ç±»åä¸è½ä¸ºç©º") |
| | | private Integer certType; |
| | | |
| | | @Schema(description = "è¯ä¹¦åç§°", requiredMode = Schema.RequiredMode.REQUIRED, example = "é«åçµå·¥ç¹ç§ä½ä¸æä½è¯") |
| | | @NotEmpty(message = "è¯ä¹¦åç§°ä¸è½ä¸ºç©º") |
| | | private String certName; |
| | | |
| | | @Schema(description = "è¯ä¹¦ç¼å·", example = "T2019-0001") |
| | | private String certNo; |
| | | |
| | | @Schema(description = "åè¯æºæ", example = "å½å®¶è½æºå±") |
| | | private String issueOrg; |
| | | |
| | | @Schema(description = "åè¯æ¥æ") |
| | | private LocalDate issueDate; |
| | | |
| | | @Schema(description = "æææè³", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "æææè³ä¸è½ä¸ºç©º") |
| | | private LocalDate expireDate; |
| | | |
| | | @Schema(description = "夿³¨", example = "夿³¨") |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.hrm.dal.dataobject.certificate; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.time.LocalDate; |
| | | |
| | | /** |
| | | * HRM è¯ä¹¦èµè´¨ DO |
| | | * |
| | | * <p>管çå®å
¨å¹è®ãæè½å¹è®ãç¹ç§ä½ä¸è¯ä¹¦ãä»ä¸èµè´¨ï¼æ»¡è¶³çµåè¡ä¸åè§ç®¡çè¦æ± |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @TableName("hrm_certificate") |
| | | @KeySequence("hrm_certificate_seq") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class HrmCertificateDO extends BaseDO { |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | |
| | | /** |
| | | * åå·¥ç¼å· |
| | | * |
| | | * å
³è {@link cn.iocoder.yudao.module.hrm.dal.dataobject.employee.HrmEmployeeDO#getId()} |
| | | */ |
| | | private Long employeeId; |
| | | |
| | | /** |
| | | * è¯ä¹¦ç±»å |
| | | * |
| | | * 1: ç¹ç§ä½ä¸è¯ä¹¦ |
| | | * 2: ä»ä¸èµè´¨ |
| | | * 3: æè½ç级è¯ä¹¦ |
| | | * 4: å®å
¨å¹è®åæ ¼è¯ |
| | | */ |
| | | private Integer certType; |
| | | |
| | | /** |
| | | * è¯ä¹¦åç§° |
| | | */ |
| | | private String certName; |
| | | |
| | | /** |
| | | * è¯ä¹¦ç¼å· |
| | | */ |
| | | private String certNo; |
| | | |
| | | /** |
| | | * åè¯æºæ |
| | | */ |
| | | private String issueOrg; |
| | | |
| | | /** |
| | | * åè¯æ¥æ |
| | | */ |
| | | private LocalDate issueDate; |
| | | |
| | | /** |
| | | * æææè³ |
| | | */ |
| | | private LocalDate expireDate; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.hrm.dal.mysql.certificate; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.certificate.vo.HrmCertificatePageReqVO; |
| | | import cn.iocoder.yudao.module.hrm.dal.dataobject.certificate.HrmCertificateDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * HRM è¯ä¹¦èµè´¨ Mapper |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @Mapper |
| | | public interface HrmCertificateMapper extends BaseMapperX<HrmCertificateDO> { |
| | | |
| | | default PageResult<HrmCertificateDO> selectPage(HrmCertificatePageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<HrmCertificateDO>() |
| | | .eqIfPresent(HrmCertificateDO::getEmployeeId, reqVO.getEmployeeId()) |
| | | .eqIfPresent(HrmCertificateDO::getCertType, reqVO.getCertType()) |
| | | .likeIfPresent(HrmCertificateDO::getCertName, reqVO.getCertName()) |
| | | .orderByDesc(HrmCertificateDO::getId)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.hrm.service.certificate; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.certificate.vo.HrmCertificatePageReqVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.certificate.vo.HrmCertificateSaveReqVO; |
| | | import cn.iocoder.yudao.module.hrm.dal.dataobject.certificate.HrmCertificateDO; |
| | | |
| | | import java.util.Collection; |
| | | |
| | | /** |
| | | * HRM è¯ä¹¦èµè´¨ Service æ¥å£ |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | public interface HrmCertificateService { |
| | | |
| | | Long createCertificate(HrmCertificateSaveReqVO createReqVO); |
| | | |
| | | void updateCertificate(HrmCertificateSaveReqVO updateReqVO); |
| | | |
| | | void deleteCertificate(Collection<Long> ids); |
| | | |
| | | HrmCertificateDO getCertificate(Long id); |
| | | |
| | | PageResult<HrmCertificateDO> getCertificatePage(HrmCertificatePageReqVO pageReqVO); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.hrm.service.certificate; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.certificate.vo.HrmCertificatePageReqVO; |
| | | import cn.iocoder.yudao.module.hrm.controller.admin.certificate.vo.HrmCertificateSaveReqVO; |
| | | import cn.iocoder.yudao.module.hrm.dal.dataobject.certificate.HrmCertificateDO; |
| | | import cn.iocoder.yudao.module.hrm.dal.mysql.certificate.HrmCertificateMapper; |
| | | import cn.iocoder.yudao.module.hrm.service.employee.HrmEmployeeService; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.util.Collection; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.hrm.enums.ErrorCodeConstants.HRM_CERTIFICATE_NOT_EXISTS; |
| | | import static cn.iocoder.yudao.module.hrm.enums.ErrorCodeConstants.HRM_EMPLOYEE_NOT_EXISTS; |
| | | |
| | | /** |
| | | * HRM è¯ä¹¦èµè´¨ Service å®ç°ç±» |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @Service |
| | | @Validated |
| | | public class HrmCertificateServiceImpl implements HrmCertificateService { |
| | | |
| | | @Resource |
| | | private HrmCertificateMapper certificateMapper; |
| | | @Resource |
| | | private HrmEmployeeService employeeService; |
| | | |
| | | @Override |
| | | public Long createCertificate(HrmCertificateSaveReqVO createReqVO) { |
| | | validateEmployee(createReqVO.getEmployeeId()); |
| | | HrmCertificateDO certificate = BeanUtils.toBean(createReqVO, HrmCertificateDO.class); |
| | | certificateMapper.insert(certificate); |
| | | return certificate.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void updateCertificate(HrmCertificateSaveReqVO updateReqVO) { |
| | | validateCertificateExists(updateReqVO.getId()); |
| | | validateEmployee(updateReqVO.getEmployeeId()); |
| | | certificateMapper.updateById(BeanUtils.toBean(updateReqVO, HrmCertificateDO.class)); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteCertificate(Collection<Long> ids) { |
| | | if (CollUtil.isEmpty(ids)) { |
| | | return; |
| | | } |
| | | for (Long id : ids) { |
| | | validateCertificateExists(id); |
| | | certificateMapper.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public HrmCertificateDO getCertificate(Long id) { |
| | | return certificateMapper.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<HrmCertificateDO> getCertificatePage(HrmCertificatePageReqVO pageReqVO) { |
| | | return certificateMapper.selectPage(pageReqVO); |
| | | } |
| | | |
| | | private void validateEmployee(Long employeeId) { |
| | | if (employeeService.getEmployee(employeeId) == null) { |
| | | throw exception(HRM_EMPLOYEE_NOT_EXISTS); |
| | | } |
| | | } |
| | | |
| | | private void validateCertificateExists(Long id) { |
| | | if (certificateMapper.selectById(id) == null) { |
| | | throw exception(HRM_CERTIFICATE_NOT_EXISTS); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | package cn.iocoder.yudao.module.mes.api.item; |
| | | |
| | | import cn.iocoder.yudao.module.mes.api.item.dto.MesMdItemSafetyStockRespDTO; |
| | | import cn.iocoder.yudao.module.mes.api.item.dto.MesMdItemSyncReqDTO; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | |
| | | */ |
| | | Set<Long> getSyncedMdmItemIds(Collection<Long> mdmItemIds); |
| | | |
| | | /** |
| | | * è·åå¯ç¨å®å
¨åºåçç©æå表 |
| | | * |
| | | * <p>ä¾ ERP éè´è®¡åååºåé¢è¦ç¼ºé计ç®ï¼safeStockFlag=true ä¸ minStock é空ï¼ã |
| | | * |
| | | * @return å®å
¨åºåç©æå表 |
| | | */ |
| | | List<MesMdItemSafetyStockRespDTO> getSafetyStockItemList(); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.api.item.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * MES å®å
¨åºåç©æ Response DTO |
| | | * |
| | | * ä¾ ERP éè´è®¡åååºåé¢è¦ç¼ºéè®¡ç® |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @Data |
| | | public class MesMdItemSafetyStockRespDTO { |
| | | |
| | | /** |
| | | * MES ç©æç¼å· |
| | | */ |
| | | private Long id; |
| | | |
| | | /** |
| | | * MDM ç©æç¼å·ï¼ERP/MDM ä¸»æ°æ® IDï¼ |
| | | */ |
| | | private Long mdmItemId; |
| | | |
| | | /** |
| | | * ç©æç¼ç |
| | | */ |
| | | private String code; |
| | | |
| | | /** |
| | | * ç©æåç§° |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * æä½åºåéï¼å®å
¨åºåä¸éï¼ |
| | | */ |
| | | private BigDecimal minStock; |
| | | |
| | | /** |
| | | * æé«åºåé |
| | | */ |
| | | private BigDecimal maxStock; |
| | | |
| | | /** |
| | | * 计éåä½ç¼å· |
| | | */ |
| | | private Long unitMeasureId; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.api.workorder; |
| | | |
| | | /** |
| | | * MES ç产工å API æ¥å£ |
| | | * |
| | | * <p>ä¾ CRM 模åè°ç¨ï¼å®ç°ååæä»¤ãä¸åãçå®è·¨æ¨¡åèå¨ï¼æ§è¡æä»¤æ¶ç¡®è®¤ç®æ å·¥åã |
| | | * åæ¶æä»¤æ¶åæ¶ç®æ å·¥åï¼ä½¿ CRM ååæä»¤ä¸ååªæ¯è®°å½ä¸ç¶ææµè½¬ã |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | public interface MesProWorkOrderApi { |
| | | |
| | | /** |
| | | * 确认工åï¼è稿 â å·²ç¡®è®¤ï¼ |
| | | * |
| | | * <p>ç¨äºååæä»¤ãä¸åè¡¨ãæ§è¡æ¶ï¼å°æä»¤å
³èçå·¥åä»èç¨¿ç¶æä¸å为已确认ã |
| | | * |
| | | * @param id å·¥åç¼å· |
| | | */ |
| | | void confirmWorkOrder(Long id); |
| | | |
| | | /** |
| | | * åæ¶å·¥åï¼å·²ç¡®è®¤ â å·²åæ¶ï¼ |
| | | * |
| | | * <p>ç¨äºååæä»¤åæ¶æ¶ï¼åæ¥åæ¶å·²ä¸åçç®æ å·¥åã |
| | | * |
| | | * @param id å·¥åç¼å· |
| | | */ |
| | | void cancelWorkOrder(Long id); |
| | | |
| | | } |
| | |
| | | package cn.iocoder.yudao.module.mes.api.item; |
| | | |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.api.item.dto.MesMdItemSafetyStockRespDTO; |
| | | import cn.iocoder.yudao.module.mes.api.item.dto.MesMdItemSyncReqDTO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.md.item.vo.MesMdItemSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.md.item.vo.batchconfig.MesMdItemBatchConfigSaveReqVO; |
| | |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | |
| | | return itemMapper.selectMdmItemIdsByMdmItemIds(mdmItemIds); |
| | | } |
| | | |
| | | @Override |
| | | public List<MesMdItemSafetyStockRespDTO> getSafetyStockItemList() { |
| | | List<MesMdItemDO> items = itemMapper.selectList(new LambdaQueryWrapperX<MesMdItemDO>() |
| | | .eq(MesMdItemDO::getSafeStockFlag, true) |
| | | .isNotNull(MesMdItemDO::getMinStock)); |
| | | return BeanUtils.toBean(items, MesMdItemSafetyStockRespDTO.class); |
| | | } |
| | | |
| | | /** |
| | | * ä¿åæ¹æ¬¡é
ç½® |
| | | */ |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.api.workorder; |
| | | |
| | | import cn.iocoder.yudao.module.mes.service.pro.workorder.MesProWorkOrderService; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | /** |
| | | * MES ç产工å API å®ç°ç±» |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @Service |
| | | @Validated |
| | | public class MesProWorkOrderApiImpl implements MesProWorkOrderApi { |
| | | |
| | | @Resource |
| | | private MesProWorkOrderService workOrderService; |
| | | |
| | | @Override |
| | | public void confirmWorkOrder(Long id) { |
| | | workOrderService.confirmWorkOrder(id); |
| | | } |
| | | |
| | | @Override |
| | | public void cancelWorkOrder(Long id) { |
| | | workOrderService.cancelWorkOrder(id); |
| | | } |
| | | |
| | | } |
| | |
| | | @ExcelProperty("设å¤ç¼ç ") |
| | | private String code; |
| | | |
| | | @Schema(description = "æ°é设å¤IDï¼å¤é¨æ°é tbDeviceIdï¼", example = "tb_001") |
| | | @ExcelProperty("æ°é设å¤ID") |
| | | private String tbDeviceId; |
| | | |
| | | @Schema(description = "设å¤åç§°", requiredMode = Schema.RequiredMode.REQUIRED, example = "CNC å å·¥ä¸å¿") |
| | | @ExcelProperty("设å¤åç§°") |
| | | private String name; |
| | |
| | | @NotEmpty(message = "设å¤ç¼ç ä¸è½ä¸ºç©º") |
| | | private String code; |
| | | |
| | | @Schema(description = "æ°é设å¤IDï¼å¤é¨æ°é tbDeviceIdï¼", example = "tb_001") |
| | | private String tbDeviceId; |
| | | |
| | | @Schema(description = "设å¤åç§°", requiredMode = Schema.RequiredMode.REQUIRED, example = "CNC å å·¥ä¸å¿") |
| | | @NotEmpty(message = "设å¤åç§°ä¸è½ä¸ºç©º") |
| | | private String name; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.dv.statistics; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.dv.statistics.vo.MesDvOeeRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.dv.statistics.vo.MesDvStatisticsRespVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.dv.machinery.MesDvMachineryDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.dv.machinery.MesDvMachineryTypeDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.dv.maintenrecord.MesDvMaintenRecordDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.dv.repair.MesDvRepairDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.task.MesProTaskDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.dv.machinery.MesDvMachineryMapper; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.dv.machinery.MesDvMachineryTypeMapper; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.dv.maintenrecord.MesDvMaintenRecordMapper; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.dv.repair.MesDvRepairMapper; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.pro.task.MesProTaskMapper; |
| | | import cn.iocoder.yudao.module.mes.enums.dv.MesDvMachineryStatusEnum; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.Duration; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | |
| | | @Tag(name = "管çåå° - MES 设å¤ç»è®¡") |
| | | @RestController |
| | | @RequestMapping("/mes/dv/statistics") |
| | | @Validated |
| | | public class MesDvStatisticsController { |
| | | |
| | | @Resource |
| | | private MesDvMachineryMapper machineryMapper; |
| | | @Resource |
| | | private MesDvMachineryTypeMapper machineryTypeMapper; |
| | | @Resource |
| | | private MesDvRepairMapper repairMapper; |
| | | @Resource |
| | | private MesDvMaintenRecordMapper maintenRecordMapper; |
| | | @Resource |
| | | private MesProTaskMapper taskMapper; |
| | | |
| | | @GetMapping("/summary") |
| | | @Operation(summary = "设å¤ç»è®¡æ±æ»ï¼å°è´¦/ç»´ä¿®/ä¿å
»/ç±»ååå¸ï¼") |
| | | @PreAuthorize("@ss.hasPermission('mes:dv-machinery:query')") |
| | | public CommonResult<MesDvStatisticsRespVO> getSummary() { |
| | | MesDvStatisticsRespVO vo = new MesDvStatisticsRespVO(); |
| | | |
| | | // 1. 设å¤å°è´¦ç»è®¡ |
| | | Long total = machineryMapper.selectCount(); |
| | | Long producing = machineryMapper.selectCount(new LambdaQueryWrapperX<MesDvMachineryDO>() |
| | | .eq(MesDvMachineryDO::getStatus, MesDvMachineryStatusEnum.PRODUCING.getStatus())); |
| | | Long stopped = machineryMapper.selectCount(new LambdaQueryWrapperX<MesDvMachineryDO>() |
| | | .eq(MesDvMachineryDO::getStatus, MesDvMachineryStatusEnum.STOP.getStatus())); |
| | | Long maintaining = machineryMapper.selectCount(new LambdaQueryWrapperX<MesDvMachineryDO>() |
| | | .eq(MesDvMachineryDO::getStatus, MesDvMachineryStatusEnum.MAINTENANCE.getStatus())); |
| | | vo.setTotalMachinery(total); |
| | | vo.setProducingCount(producing); |
| | | vo.setStoppedCount(stopped); |
| | | vo.setMaintainingCount(maintaining); |
| | | vo.setFaultRate(total != null && total > 0 |
| | | ? (double) (stopped + maintaining) / total * 100 : 0D); |
| | | |
| | | // 2. ç»´ä¿®ç»è®¡ |
| | | vo.setTotalRepair(repairMapper.selectCount()); |
| | | vo.setFinishedRepair(repairMapper.selectCount(new LambdaQueryWrapperX<MesDvRepairDO>() |
| | | .eq(MesDvRepairDO::getStatus, cn.iocoder.yudao.module.mes.enums.dv.MesDvRepairStatusEnum.FINISHED.getStatus()))); |
| | | vo.setProcessingRepair((vo.getTotalRepair() != null ? vo.getTotalRepair() : 0L) |
| | | - (vo.getFinishedRepair() != null ? vo.getFinishedRepair() : 0L)); |
| | | |
| | | // 3. ä¿å
»ç»è®¡ |
| | | vo.setTotalMainten(maintenRecordMapper.selectCount()); |
| | | vo.setFinishedMainten(maintenRecordMapper.selectCount(new LambdaQueryWrapperX<MesDvMaintenRecordDO>() |
| | | .eq(MesDvMaintenRecordDO::getStatus, cn.iocoder.yudao.module.mes.enums.dv.MesDvMaintenRecordStatusEnum.SUBMITTED.getStatus()))); |
| | | |
| | | // 4. æè®¾å¤ç±»ååå¸ |
| | | List<MesDvMachineryDO> machineryList = machineryMapper.selectList(); |
| | | Map<Long, Long> typeCountMap = new HashMap<>(); |
| | | for (MesDvMachineryDO machinery : machineryList) { |
| | | if (machinery.getMachineryTypeId() == null) { |
| | | continue; |
| | | } |
| | | typeCountMap.merge(machinery.getMachineryTypeId(), 1L, Long::sum); |
| | | } |
| | | List<MesDvMachineryTypeDO> typeList = machineryTypeMapper.selectList(); |
| | | Map<Long, String> typeNameMap = new HashMap<>(); |
| | | for (MesDvMachineryTypeDO type : typeList) { |
| | | typeNameMap.put(type.getId(), type.getName()); |
| | | } |
| | | List<MesDvStatisticsRespVO.TypeItem> typeDistribution = new ArrayList<>(); |
| | | typeCountMap.forEach((typeId, count) -> { |
| | | MesDvStatisticsRespVO.TypeItem item = new MesDvStatisticsRespVO.TypeItem(); |
| | | item.setMachineryTypeId(typeId); |
| | | item.setMachineryTypeName(typeNameMap.get(typeId)); |
| | | item.setCount(count); |
| | | typeDistribution.add(item); |
| | | }); |
| | | vo.setTypeDistribution(typeDistribution); |
| | | return success(vo); |
| | | } |
| | | |
| | | @GetMapping("/oee") |
| | | @Operation(summary = "è®¾å¤ OEE ç»è®¡ï¼ç¨¼å¨çÃæ§è½å¼å¨çÃè¯åçï¼") |
| | | @PreAuthorize("@ss.hasPermission('mes:dv-machinery:query')") |
| | | public CommonResult<MesDvOeeRespVO> getOee( |
| | | @RequestParam(value = "startTime", required = false) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime startTime, |
| | | @RequestParam(value = "endTime", required = false) |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime) { |
| | | // 1. æ¥è¯¢ç»è®¡åºé´å
ä»»å¡ï¼æå®ææ¶é´è¿æ»¤ï¼ä¸ä¼ åºé´åç»è®¡å
¨é¨ï¼ |
| | | List<MesProTaskDO> allTasks = taskMapper.selectList(new LambdaQueryWrapperX<MesProTaskDO>() |
| | | .betweenIfPresent(MesProTaskDO::getFinishDate, new LocalDateTime[]{startTime, endTime})); |
| | | |
| | | // 2. æ´ä½ OEE |
| | | MesDvOeeRespVO vo = new MesDvOeeRespVO(); |
| | | OeeCalc overall = calcOee(allTasks); |
| | | vo.setOverallOee(overall.oee); |
| | | vo.setOverallAvailability(overall.availability); |
| | | vo.setOverallPerformance(overall.performance); |
| | | vo.setOverallQuality(overall.quality); |
| | | vo.setTaskCount((long) allTasks.size()); |
| | | |
| | | // 3. æè®¾å¤èåï¼ä»»å¡æå·¥ä½ç«åç»ï¼è®¾å¤éè¿ workstationId å
³èå·¥ä½ç« |
| | | Map<Long, List<MesProTaskDO>> tasksByWorkstation = new HashMap<>(); |
| | | for (MesProTaskDO task : allTasks) { |
| | | if (task.getWorkstationId() == null) { |
| | | continue; |
| | | } |
| | | tasksByWorkstation.computeIfAbsent(task.getWorkstationId(), k -> new ArrayList<>()).add(task); |
| | | } |
| | | List<MesDvOeeRespVO.MachineryOee> items = new ArrayList<>(); |
| | | for (MesDvMachineryDO machinery : machineryMapper.selectList()) { |
| | | if (machinery.getWorkstationId() == null) { |
| | | continue; // æªç»å®å·¥ä½ç«ï¼æ æ³å
³èä»»å¡ |
| | | } |
| | | List<MesProTaskDO> tasks = tasksByWorkstation.getOrDefault(machinery.getWorkstationId(), Collections.emptyList()); |
| | | OeeCalc calc = calcOee(tasks); |
| | | MesDvOeeRespVO.MachineryOee item = new MesDvOeeRespVO.MachineryOee(); |
| | | item.setMachineryId(machinery.getId()); |
| | | item.setMachineryCode(machinery.getCode()); |
| | | item.setMachineryName(machinery.getName()); |
| | | item.setOee(calc.oee); |
| | | item.setAvailability(calc.availability); |
| | | item.setPerformance(calc.performance); |
| | | item.setQuality(calc.quality); |
| | | item.setTaskCount((long) tasks.size()); |
| | | item.setPlannedQuantity(calc.plannedQuantity); |
| | | item.setProducedQuantity(calc.producedQuantity); |
| | | items.add(item); |
| | | } |
| | | vo.setItems(items); |
| | | return success(vo); |
| | | } |
| | | |
| | | private static OeeCalc calcOee(List<MesProTaskDO> tasks) { |
| | | double totalPlannedHours = 0, totalActualHours = 0; |
| | | BigDecimal totalPlannedQty = BigDecimal.ZERO, totalProducedQty = BigDecimal.ZERO, totalQualifyQty = BigDecimal.ZERO; |
| | | for (MesProTaskDO task : tasks) { |
| | | if (task.getDuration() != null) { |
| | | totalPlannedHours += task.getDuration() * 8D; // 1 工使¥ = 8 å°æ¶ |
| | | } |
| | | if (task.getFirstFeedbackTime() != null && task.getLastFeedbackTime() != null |
| | | && task.getLastFeedbackTime().isAfter(task.getFirstFeedbackTime())) { |
| | | totalActualHours += Duration.between(task.getFirstFeedbackTime(), task.getLastFeedbackTime()).toMinutes() / 60D; |
| | | } |
| | | if (task.getQuantity() != null) { |
| | | totalPlannedQty = totalPlannedQty.add(task.getQuantity()); |
| | | } |
| | | if (task.getProducedQuantity() != null) { |
| | | totalProducedQty = totalProducedQty.add(task.getProducedQuantity()); |
| | | } |
| | | if (task.getQualifyQuantity() != null) { |
| | | totalQualifyQty = totalQualifyQty.add(task.getQualifyQuantity()); |
| | | } |
| | | } |
| | | OeeCalc calc = new OeeCalc(); |
| | | // 稼å¨ç = å®é
æ¥å·¥æ¶é¿ / è®¡åæ¶é¿ï¼æ è®¡åæ¶é¿æ¶æ 1 å¤çï¼ |
| | | calc.availability = percent(totalPlannedHours > 0 ? Math.min(1D, totalActualHours / totalPlannedHours) : 1D); |
| | | // æ§è½å¼å¨ç = å®é
产é / 计å产é |
| | | calc.performance = totalPlannedQty.compareTo(BigDecimal.ZERO) > 0 |
| | | ? percent(Math.min(1D, totalProducedQty.divide(totalPlannedQty, 4, RoundingMode.HALF_UP).doubleValue())) : 0D; |
| | | // è¯åç = åæ ¼å / å®é
产éï¼æ äº§éæ¶æ 1 å¤çï¼ |
| | | calc.quality = totalProducedQty.compareTo(BigDecimal.ZERO) > 0 |
| | | ? percent(Math.min(1D, totalQualifyQty.divide(totalProducedQty, 4, RoundingMode.HALF_UP).doubleValue())) : 100D; |
| | | // OEE(%) = 稼å¨ç(%) à æ§è½(%) à è¯åç(%) / 10000ï¼ä¿ç两ä½å°æ° |
| | | calc.oee = Math.round(calc.availability * calc.performance * calc.quality / 10000D * 100D) / 100D; |
| | | calc.plannedQuantity = totalPlannedQty; |
| | | calc.producedQuantity = totalProducedQty; |
| | | return calc; |
| | | } |
| | | |
| | | /** æ¯ä¾(0-1) 转ç¾åæ¯ï¼ä¿ç两ä½å°æ° */ |
| | | private static double percent(double ratio) { |
| | | return Math.round(ratio * 10000D) / 100D; |
| | | } |
| | | |
| | | private static class OeeCalc { |
| | | private Double availability; |
| | | private Double performance; |
| | | private Double quality; |
| | | private Double oee; |
| | | private BigDecimal plannedQuantity; |
| | | private BigDecimal producedQuantity; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.dv.statistics.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Schema(description = "管çåå° - MES è®¾å¤ OEE ç»è®¡ Response VO") |
| | | @Data |
| | | public class MesDvOeeRespVO { |
| | | |
| | | @Schema(description = "æ´ä½ OEEï¼%ï¼") |
| | | private Double overallOee; |
| | | |
| | | @Schema(description = "æ´ä½ç¨¼å¨çï¼%ï¼") |
| | | private Double overallAvailability; |
| | | |
| | | @Schema(description = "æ´ä½æ§è½å¼å¨çï¼%ï¼") |
| | | private Double overallPerformance; |
| | | |
| | | @Schema(description = "æ´ä½è¯åçï¼%ï¼") |
| | | private Double overallQuality; |
| | | |
| | | @Schema(description = "ç»è®¡ä»»å¡æ»æ°") |
| | | private Long taskCount; |
| | | |
| | | @Schema(description = "æè®¾å¤ OEE æç»") |
| | | private List<MachineryOee> items; |
| | | |
| | | @Schema(description = "è®¾å¤ OEE æç»é¡¹") |
| | | @Data |
| | | public static class MachineryOee { |
| | | |
| | | @Schema(description = "设å¤ç¼å·") |
| | | private Long machineryId; |
| | | |
| | | @Schema(description = "设å¤ç¼ç ") |
| | | private String machineryCode; |
| | | |
| | | @Schema(description = "设å¤åç§°") |
| | | private String machineryName; |
| | | |
| | | @Schema(description = "OEEï¼%ï¼") |
| | | private Double oee; |
| | | |
| | | @Schema(description = "稼å¨çï¼%ï¼") |
| | | private Double availability; |
| | | |
| | | @Schema(description = "æ§è½å¼å¨çï¼%ï¼") |
| | | private Double performance; |
| | | |
| | | @Schema(description = "è¯åçï¼%ï¼") |
| | | private Double quality; |
| | | |
| | | @Schema(description = "å
³è任塿°") |
| | | private Long taskCount; |
| | | |
| | | @Schema(description = "计å产é") |
| | | private java.math.BigDecimal plannedQuantity; |
| | | |
| | | @Schema(description = "å®é
产é") |
| | | private java.math.BigDecimal producedQuantity; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.dv.statistics.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Schema(description = "管çåå° - MES 设å¤ç»è®¡ Response VO") |
| | | @Data |
| | | public class MesDvStatisticsRespVO { |
| | | |
| | | @Schema(description = "è®¾å¤æ»æ°") |
| | | private Long totalMachinery; |
| | | |
| | | @Schema(description = "ç产ä¸è®¾å¤æ°") |
| | | private Long producingCount; |
| | | |
| | | @Schema(description = "åæºè®¾å¤æ°") |
| | | private Long stoppedCount; |
| | | |
| | | @Schema(description = "ç»´æ¤ä¸è®¾å¤æ°") |
| | | private Long maintainingCount; |
| | | |
| | | @Schema(description = "è®¾å¤æ
éçï¼åæº+ç»´æ¤ / æ»æ° * 100ï¼%ï¼") |
| | | private Double faultRate; |
| | | |
| | | @Schema(description = "ç»´ä¿®åæ»æ°") |
| | | private Long totalRepair; |
| | | |
| | | @Schema(description = "ç»´ä¿®ä¸/å¾
éªæ¶åæ°") |
| | | private Long processingRepair; |
| | | |
| | | @Schema(description = "å·²ç¡®è®¤ç»´ä¿®åæ°") |
| | | private Long finishedRepair; |
| | | |
| | | @Schema(description = "ä¿å
»è®°å½æ»æ°") |
| | | private Long totalMainten; |
| | | |
| | | @Schema(description = "已宿ä¿å
»è®°å½æ°") |
| | | private Long finishedMainten; |
| | | |
| | | @Schema(description = "æè®¾å¤ç±»ååå¸") |
| | | private List<TypeItem> typeDistribution; |
| | | |
| | | @Schema(description = "设å¤ç±»ååå¸é¡¹") |
| | | @Data |
| | | public static class TypeItem { |
| | | |
| | | @Schema(description = "设å¤ç±»åç¼å·") |
| | | private Long machineryTypeId; |
| | | |
| | | @Schema(description = "设å¤ç±»ååç§°") |
| | | private String machineryTypeName; |
| | | |
| | | @Schema(description = "è®¾å¤æ°é") |
| | | private Long count; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.dv.telemetry; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.dv.telemetry.vo.MesDvTelemetryDeviceRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.dv.telemetry.vo.MesDvTelemetryLatestReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.dv.telemetry.vo.MesDvTelemetryPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.dv.telemetry.vo.MesDvTelemetryPullRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.dv.telemetry.vo.MesDvTelemetryRespVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.dv.telemetry.MesDvTelemetryDO; |
| | | import cn.iocoder.yudao.module.mes.service.dv.telemetry.MesDvTelemetryService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | |
| | | @Tag(name = "管çåå° - MES è®¾å¤æ°é") |
| | | @RestController |
| | | @RequestMapping("/mes/dv/telemetry") |
| | | @Validated |
| | | public class MesDvTelemetryController { |
| | | |
| | | @Resource |
| | | private MesDvTelemetryService telemetryService; |
| | | |
| | | @GetMapping("/pull") |
| | | @Operation(summary = "æåæ°éæ°æ®å¹¶å
¥åºï¼è¿ 5 åéè®¾å¤æ°æ®ï¼") |
| | | @PreAuthorize("@ss.hasPermission('mes:dv-telemetry:query')") |
| | | public CommonResult<MesDvTelemetryPullRespVO> pullTelemetry() { |
| | | return success(telemetryService.pullTelemetry()); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "å页æ¥è¯¢æ°é饿µæ°æ®") |
| | | @PreAuthorize("@ss.hasPermission('mes:dv-telemetry:query')") |
| | | public CommonResult<PageResult<MesDvTelemetryRespVO>> getTelemetryPage(@Valid MesDvTelemetryPageReqVO pageReqVO) { |
| | | PageResult<MesDvTelemetryDO> pageResult = telemetryService.getTelemetryPage(pageReqVO); |
| | | return success(BeanUtils.toBean(pageResult, MesDvTelemetryRespVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/latest") |
| | | @Operation(summary = "æ¥è¯¢åè®¾å¤ææ°é¥æµæ°æ®ï¼å®æ¶çæ§ï¼") |
| | | @PreAuthorize("@ss.hasPermission('mes:dv-telemetry:query')") |
| | | public CommonResult<List<MesDvTelemetryRespVO>> getLatestTelemetry(MesDvTelemetryLatestReqVO reqVO) { |
| | | List<MesDvTelemetryDO> list = telemetryService.getLatestTelemetry(reqVO); |
| | | return success(BeanUtils.toBean(list, MesDvTelemetryRespVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/device-list") |
| | | @Operation(summary = "æ¥è¯¢æ°é设å¤ä¸æå表") |
| | | @PreAuthorize("@ss.hasPermission('mes:dv-telemetry:query')") |
| | | public CommonResult<List<MesDvTelemetryDeviceRespVO>> getDeviceList() { |
| | | return success(telemetryService.getDeviceList()); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.dv.telemetry.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | @Schema(description = "管çåå° - MES è®¾å¤æ°é设å¤ä¸æ Response VO") |
| | | @Data |
| | | public class MesDvTelemetryDeviceRespVO { |
| | | |
| | | @Schema(description = "æ°é设å¤ID") |
| | | private String tbDeviceId; |
| | | |
| | | @Schema(description = "设å¤åç§°") |
| | | private String deviceName; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.dv.telemetry.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | @Schema(description = "管çåå° - MES è®¾å¤æ°éææ°é¥æµ Request VO") |
| | | @Data |
| | | public class MesDvTelemetryLatestReqVO { |
| | | |
| | | @Schema(description = "æ°é设å¤ID", example = "tb_001") |
| | | private String tbDeviceId; |
| | | |
| | | @Schema(description = "设å¤åç§°", example = "1å·ååå¨") |
| | | private String deviceName; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.dv.telemetry.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| | | |
| | | @Schema(description = "管çåå° - MES è®¾å¤æ°é饿µå页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class MesDvTelemetryPageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "æ°é设å¤ID", example = "tb_001") |
| | | private String tbDeviceId; |
| | | |
| | | @Schema(description = "设å¤åç§°", example = "1å·ååå¨") |
| | | private String deviceName; |
| | | |
| | | @Schema(description = "ä¿¡å·åç§°", example = "温度") |
| | | private String paramName; |
| | | |
| | | @Schema(description = "æ¯å¦å¼å¸¸") |
| | | private Boolean whetherAnomaly; |
| | | |
| | | @Schema(description = "çæ¬¡", example = "æ©ç") |
| | | private String shiftName; |
| | | |
| | | @Schema(description = "饿µæ°æ®æ¶é´") |
| | | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| | | private LocalDateTime[] telemetryDataTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.dv.telemetry.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - MES è®¾å¤æ°éæåç»æ Response VO") |
| | | @Data |
| | | public class MesDvTelemetryPullRespVO { |
| | | |
| | | @Schema(description = "æ¬æ¬¡æåæ°å¢æ°æ®æ¡æ°") |
| | | private Integer recordCount; |
| | | |
| | | @Schema(description = "æ¬æ¬¡æåæ¶åè®¾å¤æ°") |
| | | private Integer deviceCount; |
| | | |
| | | @Schema(description = "æåæ¶é´") |
| | | private LocalDateTime pullTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.dv.telemetry.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - MES è®¾å¤æ°é饿µ Response VO") |
| | | @Data |
| | | public class MesDvTelemetryRespVO { |
| | | |
| | | @Schema(description = "ç¼å·") |
| | | private Long id; |
| | | |
| | | @Schema(description = "æ°é设å¤ID") |
| | | private String tbDeviceId; |
| | | |
| | | @Schema(description = "设å¤åç§°") |
| | | private String deviceName; |
| | | |
| | | @Schema(description = "ä¿¡å·åç§°") |
| | | private String paramName; |
| | | |
| | | @Schema(description = "设å¤KEYåç§°") |
| | | private String paramKeyName; |
| | | |
| | | @Schema(description = "æ åå¼") |
| | | private String standardValue; |
| | | |
| | | @Schema(description = "ä¿¡å·å¼ï¼å®æ¶ï¼") |
| | | private String timelyValue; |
| | | |
| | | @Schema(description = "åå¼") |
| | | private String avgValue; |
| | | |
| | | @Schema(description = "æå¤§å¼") |
| | | private String maxValue; |
| | | |
| | | @Schema(description = "æå°å¼") |
| | | private String minValue; |
| | | |
| | | @Schema(description = "æ¯å¦å¼å¸¸") |
| | | private Boolean whetherAnomaly; |
| | | |
| | | @Schema(description = "饿µæ°æ®æ¶é´") |
| | | private LocalDateTime telemetryDataTime; |
| | | |
| | | @Schema(description = "åæ®å·") |
| | | private String billNo; |
| | | |
| | | @Schema(description = "çæ¬¡") |
| | | private String shiftName; |
| | | |
| | | @Schema(description = "æåæ¶é´") |
| | | private LocalDateTime pullTime; |
| | | |
| | | @Schema(description = "å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | } |
| | |
| | | @ExcelProperty("æé«åºåé") |
| | | private BigDecimal maxStock; |
| | | |
| | | @Schema(description = "çµåç©èµåç±»", example = "1") |
| | | @ExcelProperty(value = "çµåç©èµåç±»", converter = DictConvert.class) |
| | | @DictFormat(cn.iocoder.yudao.module.mes.enums.DictTypeConstants.MES_MATERIAL_CATEGORY) |
| | | private Integer materialCategory; |
| | | |
| | | @Schema(description = "æ¯å¦é«å¼ç©æ", example = "false") |
| | | @ExcelProperty("æ¯å¦é«å¼ç©æ") |
| | | private Boolean highValue; |
| | |
| | | @Schema(description = "æé«åºåé", example = "10000.0000") |
| | | private BigDecimal maxStock; |
| | | |
| | | @Schema(description = "çµåç©èµåç±»ï¼åå
¸ mes_material_categoryï¼", example = "1") |
| | | private Integer materialCategory; |
| | | |
| | | @Schema(description = "æ¯å¦é«å¼ç©æ", example = "false") |
| | | private Boolean highValue; |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.basedata; |
| | | |
| | | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.*; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata.MesPdElectricityTypeDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata.MesPdServicePackageDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata.MesPdVoltageLevelDO; |
| | | import cn.iocoder.yudao.module.mes.service.pd.basedata.MesPdDiscountPolicyService; |
| | | import cn.iocoder.yudao.module.mes.service.pd.basedata.MesPdElectricityTypeService; |
| | | import cn.iocoder.yudao.module.mes.service.pd.basedata.MesPdPriceStandardService; |
| | | import cn.iocoder.yudao.module.mes.service.pd.basedata.MesPdServicePackageService; |
| | | import cn.iocoder.yudao.module.mes.service.pd.basedata.MesPdTieredPriceService; |
| | | import cn.iocoder.yudao.module.mes.service.pd.basedata.MesPdVoltageLevelService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | |
| | | import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | |
| | | @Tag(name = "管çåå° - MES 产ååºç¡æ°æ®") |
| | | @RestController |
| | | @RequestMapping("/mes/pd") |
| | | @Validated |
| | | public class MesPdBaseDataController { |
| | | |
| | | @Resource |
| | | private MesPdElectricityTypeService electricityTypeService; |
| | | @Resource |
| | | private MesPdVoltageLevelService voltageLevelService; |
| | | @Resource |
| | | private MesPdServicePackageService servicePackageService; |
| | | @Resource |
| | | private MesPdPriceStandardService priceStandardService; |
| | | @Resource |
| | | private MesPdDiscountPolicyService discountPolicyService; |
| | | @Resource |
| | | private MesPdTieredPriceService tieredPriceService; |
| | | |
| | | // ==================== ç¨çµç±»å ==================== |
| | | |
| | | @PostMapping("/electricity-type/create") |
| | | @Operation(summary = "å建ç¨çµç±»å") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:create')") |
| | | public CommonResult<Long> createElectricityType(@Valid @RequestBody MesPdElectricityTypeSaveReqVO createReqVO) { |
| | | return success(electricityTypeService.createElectricityType(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/electricity-type/update") |
| | | @Operation(summary = "æ´æ°ç¨çµç±»å") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:update')") |
| | | public CommonResult<Boolean> updateElectricityType(@Valid @RequestBody MesPdElectricityTypeSaveReqVO updateReqVO) { |
| | | electricityTypeService.updateElectricityType(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/electricity-type/delete") |
| | | @Operation(summary = "å é¤ç¨çµç±»å") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:delete')") |
| | | public CommonResult<Boolean> deleteElectricityType(@RequestParam("id") Long id) { |
| | | electricityTypeService.deleteElectricityType(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/electricity-type/get") |
| | | @Operation(summary = "è·å¾ç¨çµç±»å") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:query')") |
| | | public CommonResult<MesPdElectricityTypeRespVO> getElectricityType(@RequestParam("id") Long id) { |
| | | return success(electricityTypeService.getElectricityType(id)); |
| | | } |
| | | |
| | | @GetMapping("/electricity-type/page") |
| | | @Operation(summary = "è·å¾ç¨çµç±»åå页") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:query')") |
| | | public CommonResult<PageResult<MesPdElectricityTypeRespVO>> getElectricityTypePage(@Valid MesPdElectricityTypePageReqVO pageReqVO) { |
| | | return success(electricityTypeService.getElectricityTypePage(pageReqVO)); |
| | | } |
| | | |
| | | @GetMapping("/electricity-type/list") |
| | | @Operation(summary = "è·å¾ç¨çµç±»åå表") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:query')") |
| | | public CommonResult<List<MesPdElectricityTypeDO>> getElectricityTypeList() { |
| | | return success(electricityTypeService.getElectricityTypeList()); |
| | | } |
| | | |
| | | @GetMapping("/electricity-type/export-excel") |
| | | @Operation(summary = "导åºç¨çµç±»å Excel") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:export')") |
| | | @ApiAccessLog(operateType = EXPORT) |
| | | public void exportElectricityTypeExcel(@Valid MesPdElectricityTypePageReqVO pageReqVO, |
| | | HttpServletResponse response) throws IOException { |
| | | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| | | ExcelUtils.write(response, "ç¨çµç±»å.xls", "æ°æ®", MesPdElectricityTypeRespVO.class, |
| | | electricityTypeService.getElectricityTypePage(pageReqVO).getList()); |
| | | } |
| | | |
| | | // ==================== çµåç级 ==================== |
| | | |
| | | @PostMapping("/voltage-level/create") |
| | | @Operation(summary = "å建çµåç级") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:create')") |
| | | public CommonResult<Long> createVoltageLevel(@Valid @RequestBody MesPdVoltageLevelSaveReqVO createReqVO) { |
| | | return success(voltageLevelService.createVoltageLevel(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/voltage-level/update") |
| | | @Operation(summary = "æ´æ°çµåç级") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:update')") |
| | | public CommonResult<Boolean> updateVoltageLevel(@Valid @RequestBody MesPdVoltageLevelSaveReqVO updateReqVO) { |
| | | voltageLevelService.updateVoltageLevel(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/voltage-level/delete") |
| | | @Operation(summary = "å é¤çµåç级") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:delete')") |
| | | public CommonResult<Boolean> deleteVoltageLevel(@RequestParam("id") Long id) { |
| | | voltageLevelService.deleteVoltageLevel(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/voltage-level/get") |
| | | @Operation(summary = "è·å¾çµåç级") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:query')") |
| | | public CommonResult<MesPdVoltageLevelRespVO> getVoltageLevel(@RequestParam("id") Long id) { |
| | | return success(voltageLevelService.getVoltageLevel(id)); |
| | | } |
| | | |
| | | @GetMapping("/voltage-level/page") |
| | | @Operation(summary = "è·å¾çµåç级å页") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:query')") |
| | | public CommonResult<PageResult<MesPdVoltageLevelRespVO>> getVoltageLevelPage(@Valid MesPdVoltageLevelPageReqVO pageReqVO) { |
| | | return success(voltageLevelService.getVoltageLevelPage(pageReqVO)); |
| | | } |
| | | |
| | | @GetMapping("/voltage-level/list") |
| | | @Operation(summary = "è·å¾çµåç级å表") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:query')") |
| | | public CommonResult<List<MesPdVoltageLevelDO>> getVoltageLevelList() { |
| | | return success(voltageLevelService.getVoltageLevelList()); |
| | | } |
| | | |
| | | @GetMapping("/voltage-level/export-excel") |
| | | @Operation(summary = "导åºçµåç级 Excel") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:export')") |
| | | @ApiAccessLog(operateType = EXPORT) |
| | | public void exportVoltageLevelExcel(@Valid MesPdVoltageLevelPageReqVO pageReqVO, |
| | | HttpServletResponse response) throws IOException { |
| | | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| | | ExcelUtils.write(response, "çµåç级.xls", "æ°æ®", MesPdVoltageLevelRespVO.class, |
| | | voltageLevelService.getVoltageLevelPage(pageReqVO).getList()); |
| | | } |
| | | |
| | | // ==================== æå¡å¥é¤ ==================== |
| | | |
| | | @PostMapping("/service-package/create") |
| | | @Operation(summary = "å建æå¡å¥é¤") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:create')") |
| | | public CommonResult<Long> createServicePackage(@Valid @RequestBody MesPdServicePackageSaveReqVO createReqVO) { |
| | | return success(servicePackageService.createServicePackage(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/service-package/update") |
| | | @Operation(summary = "æ´æ°æå¡å¥é¤") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:update')") |
| | | public CommonResult<Boolean> updateServicePackage(@Valid @RequestBody MesPdServicePackageSaveReqVO updateReqVO) { |
| | | servicePackageService.updateServicePackage(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/service-package/delete") |
| | | @Operation(summary = "å 餿å¡å¥é¤") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:delete')") |
| | | public CommonResult<Boolean> deleteServicePackage(@RequestParam("id") Long id) { |
| | | servicePackageService.deleteServicePackage(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/service-package/get") |
| | | @Operation(summary = "è·å¾æå¡å¥é¤") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:query')") |
| | | public CommonResult<MesPdServicePackageRespVO> getServicePackage(@RequestParam("id") Long id) { |
| | | return success(servicePackageService.getServicePackage(id)); |
| | | } |
| | | |
| | | @GetMapping("/service-package/page") |
| | | @Operation(summary = "è·å¾æå¡å¥é¤å页") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:query')") |
| | | public CommonResult<PageResult<MesPdServicePackageRespVO>> getServicePackagePage(@Valid MesPdServicePackagePageReqVO pageReqVO) { |
| | | return success(servicePackageService.getServicePackagePage(pageReqVO)); |
| | | } |
| | | |
| | | @GetMapping("/service-package/list") |
| | | @Operation(summary = "è·å¾æå¡å¥é¤å表") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:query')") |
| | | public CommonResult<List<MesPdServicePackageDO>> getServicePackageList() { |
| | | return success(servicePackageService.getServicePackageList()); |
| | | } |
| | | |
| | | @GetMapping("/service-package/export-excel") |
| | | @Operation(summary = "å¯¼åºæå¡å¥é¤ Excel") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:export')") |
| | | @ApiAccessLog(operateType = EXPORT) |
| | | public void exportServicePackageExcel(@Valid MesPdServicePackagePageReqVO pageReqVO, |
| | | HttpServletResponse response) throws IOException { |
| | | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| | | ExcelUtils.write(response, "æå¡å¥é¤.xls", "æ°æ®", MesPdServicePackageRespVO.class, |
| | | servicePackageService.getServicePackagePage(pageReqVO).getList()); |
| | | } |
| | | |
| | | // ==================== å®ä»·æ å ==================== |
| | | |
| | | @PostMapping("/price-standard/create") |
| | | @Operation(summary = "å建å®ä»·æ å") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:create')") |
| | | public CommonResult<Long> createPriceStandard(@Valid @RequestBody MesPdPriceStandardSaveReqVO createReqVO) { |
| | | return success(priceStandardService.createPriceStandard(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/price-standard/update") |
| | | @Operation(summary = "æ´æ°å®ä»·æ å") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:update')") |
| | | public CommonResult<Boolean> updatePriceStandard(@Valid @RequestBody MesPdPriceStandardSaveReqVO updateReqVO) { |
| | | priceStandardService.updatePriceStandard(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/price-standard/delete") |
| | | @Operation(summary = "å é¤å®ä»·æ å") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:delete')") |
| | | public CommonResult<Boolean> deletePriceStandard(@RequestParam("id") Long id) { |
| | | priceStandardService.deletePriceStandard(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/price-standard/get") |
| | | @Operation(summary = "è·å¾å®ä»·æ å") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:query')") |
| | | public CommonResult<MesPdPriceStandardRespVO> getPriceStandard(@RequestParam("id") Long id) { |
| | | return success(priceStandardService.getPriceStandard(id)); |
| | | } |
| | | |
| | | @GetMapping("/price-standard/page") |
| | | @Operation(summary = "è·å¾å®ä»·æ åå页") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:query')") |
| | | public CommonResult<PageResult<MesPdPriceStandardRespVO>> getPriceStandardPage(@Valid MesPdPriceStandardPageReqVO pageReqVO) { |
| | | return success(priceStandardService.getPriceStandardPage(pageReqVO)); |
| | | } |
| | | |
| | | @GetMapping("/price-standard/export-excel") |
| | | @Operation(summary = "导åºå®ä»·æ å Excel") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:export')") |
| | | @ApiAccessLog(operateType = EXPORT) |
| | | public void exportPriceStandardExcel(@Valid MesPdPriceStandardPageReqVO pageReqVO, |
| | | HttpServletResponse response) throws IOException { |
| | | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| | | ExcelUtils.write(response, "å®ä»·æ å.xls", "æ°æ®", MesPdPriceStandardRespVO.class, |
| | | priceStandardService.getPriceStandardPage(pageReqVO).getList()); |
| | | } |
| | | |
| | | // ==================== 伿 çç¥ ==================== |
| | | |
| | | @PostMapping("/discount-policy/create") |
| | | @Operation(summary = "åå»ºä¼æ çç¥") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:create')") |
| | | public CommonResult<Long> createDiscountPolicy(@Valid @RequestBody MesPdDiscountPolicySaveReqVO createReqVO) { |
| | | return success(discountPolicyService.createDiscountPolicy(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/discount-policy/update") |
| | | @Operation(summary = "æ´æ°ä¼æ çç¥") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:update')") |
| | | public CommonResult<Boolean> updateDiscountPolicy(@Valid @RequestBody MesPdDiscountPolicySaveReqVO updateReqVO) { |
| | | discountPolicyService.updateDiscountPolicy(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/discount-policy/delete") |
| | | @Operation(summary = "å é¤ä¼æ çç¥") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:delete')") |
| | | public CommonResult<Boolean> deleteDiscountPolicy(@RequestParam("id") Long id) { |
| | | discountPolicyService.deleteDiscountPolicy(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/discount-policy/get") |
| | | @Operation(summary = "è·å¾ä¼æ çç¥") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:query')") |
| | | public CommonResult<MesPdDiscountPolicyRespVO> getDiscountPolicy(@RequestParam("id") Long id) { |
| | | return success(discountPolicyService.getDiscountPolicy(id)); |
| | | } |
| | | |
| | | @GetMapping("/discount-policy/page") |
| | | @Operation(summary = "è·å¾ä¼æ çç¥å页") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:query')") |
| | | public CommonResult<PageResult<MesPdDiscountPolicyRespVO>> getDiscountPolicyPage(@Valid MesPdDiscountPolicyPageReqVO pageReqVO) { |
| | | return success(discountPolicyService.getDiscountPolicyPage(pageReqVO)); |
| | | } |
| | | |
| | | @GetMapping("/discount-policy/export-excel") |
| | | @Operation(summary = "导åºä¼æ çç¥ Excel") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:export')") |
| | | @ApiAccessLog(operateType = EXPORT) |
| | | public void exportDiscountPolicyExcel(@Valid MesPdDiscountPolicyPageReqVO pageReqVO, |
| | | HttpServletResponse response) throws IOException { |
| | | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| | | ExcelUtils.write(response, "伿 çç¥.xls", "æ°æ®", MesPdDiscountPolicyRespVO.class, |
| | | discountPolicyService.getDiscountPolicyPage(pageReqVO).getList()); |
| | | } |
| | | |
| | | // ==================== é¶æ¢¯çµä»· ==================== |
| | | |
| | | @PostMapping("/tiered-price/create") |
| | | @Operation(summary = "åå»ºé¶æ¢¯çµä»·") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:create')") |
| | | public CommonResult<Long> createTieredPrice(@Valid @RequestBody MesPdTieredPriceSaveReqVO createReqVO) { |
| | | return success(tieredPriceService.createTieredPrice(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/tiered-price/update") |
| | | @Operation(summary = "æ´æ°é¶æ¢¯çµä»·") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:update')") |
| | | public CommonResult<Boolean> updateTieredPrice(@Valid @RequestBody MesPdTieredPriceSaveReqVO updateReqVO) { |
| | | tieredPriceService.updateTieredPrice(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/tiered-price/delete") |
| | | @Operation(summary = "å é¤é¶æ¢¯çµä»·") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:delete')") |
| | | public CommonResult<Boolean> deleteTieredPrice(@RequestParam("id") Long id) { |
| | | tieredPriceService.deleteTieredPrice(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/tiered-price/get") |
| | | @Operation(summary = "è·å¾é¶æ¢¯çµä»·") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:query')") |
| | | public CommonResult<MesPdTieredPriceRespVO> getTieredPrice(@RequestParam("id") Long id) { |
| | | return success(tieredPriceService.getTieredPrice(id)); |
| | | } |
| | | |
| | | @GetMapping("/tiered-price/page") |
| | | @Operation(summary = "è·å¾é¶æ¢¯çµä»·å页") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:query')") |
| | | public CommonResult<PageResult<MesPdTieredPriceRespVO>> getTieredPricePage(@Valid MesPdTieredPricePageReqVO pageReqVO) { |
| | | return success(tieredPriceService.getTieredPricePage(pageReqVO)); |
| | | } |
| | | |
| | | @GetMapping("/tiered-price/export-excel") |
| | | @Operation(summary = "导åºé¶æ¢¯çµä»· Excel") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:export')") |
| | | @ApiAccessLog(operateType = EXPORT) |
| | | public void exportTieredPriceExcel(@Valid MesPdTieredPricePageReqVO pageReqVO, |
| | | HttpServletResponse response) throws IOException { |
| | | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| | | ExcelUtils.write(response, "é¶æ¢¯çµä»·.xls", "æ°æ®", MesPdTieredPriceRespVO.class, |
| | | tieredPriceService.getTieredPricePage(pageReqVO).getList()); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | @Schema(description = "管çåå° - 伿 çç¥å页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class MesPdDiscountPolicyPageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "çç¥åç§°") |
| | | private String name; |
| | | |
| | | @Schema(description = "çç¥ç±»åï¼1ææ£/2ç«åï¼", example = "1") |
| | | private Integer policyType; |
| | | |
| | | @Schema(description = "å¯ç¨ç¶æï¼1å¯ç¨/0ç¦ç¨ï¼", example = "1") |
| | | private Integer status; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - 伿 çç¥ Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class MesPdDiscountPolicyRespVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("ç¼å·") |
| | | private Long id; |
| | | |
| | | @Schema(description = "çç¥åç§°") |
| | | @ExcelProperty("çç¥åç§°") |
| | | private String name; |
| | | |
| | | @Schema(description = "çç¥ç±»åï¼1ææ£/2ç«åï¼", example = "1") |
| | | @ExcelProperty(value = "çç¥ç±»å", converter = DictConvert.class) |
| | | @DictFormat(DictTypeConstants.MES_PD_DISCOUNT_POLICY_TYPE) |
| | | private Integer policyType; |
| | | |
| | | @Schema(description = "çç¥ç±»ååç§°") |
| | | private String policyTypeName; |
| | | |
| | | @Schema(description = "çç¥å¼ï¼ææ£ï¼0-1 æ¯ä¾ï¼ç«åï¼éé¢ï¼") |
| | | @ExcelProperty("çç¥å¼") |
| | | private BigDecimal policyValue; |
| | | |
| | | @Schema(description = "éç¨å¯¹è±¡ç±»åï¼1æå¡å¥é¤/2çµåç级/3ç¨çµç±»åï¼å¯ç©º=å
¨å±ï¼") |
| | | @ExcelProperty("éç¨å¯¹è±¡ç±»å") |
| | | private Integer targetType; |
| | | |
| | | @Schema(description = "éç¨å¯¹è±¡ID") |
| | | @ExcelProperty("éç¨å¯¹è±¡ID") |
| | | private Long targetId; |
| | | |
| | | @Schema(description = "çææ¥æ") |
| | | @ExcelProperty("çææ¥æ") |
| | | private LocalDateTime startDate; |
| | | |
| | | @Schema(description = "å¤±ææ¥æ") |
| | | @ExcelProperty("å¤±ææ¥æ") |
| | | private LocalDateTime endDate; |
| | | |
| | | @Schema(description = "å¯ç¨ç¶æï¼1å¯ç¨/0ç¦ç¨ï¼", example = "1") |
| | | @ExcelProperty("å¯ç¨ç¶æ") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "å建æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - 伿 çç¥æ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | | public class MesPdDiscountPolicySaveReqVO { |
| | | |
| | | @Schema(description = "ç¼å·", example = "1024") |
| | | private Long id; |
| | | |
| | | @Schema(description = "çç¥åç§°", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotEmpty(message = "çç¥åç§°ä¸è½ä¸ºç©º") |
| | | private String name; |
| | | |
| | | @Schema(description = "çç¥ç±»åï¼1ææ£/2ç«åï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @NotNull(message = "çç¥ç±»åä¸è½ä¸ºç©º") |
| | | private Integer policyType; |
| | | |
| | | @Schema(description = "çç¥å¼ï¼ææ£ï¼0-1 æ¯ä¾ï¼ç«åï¼éé¢ï¼") |
| | | private BigDecimal policyValue; |
| | | |
| | | @Schema(description = "éç¨å¯¹è±¡ç±»åï¼1æå¡å¥é¤/2çµåç级/3ç¨çµç±»åï¼å¯ç©º=å
¨å±ï¼") |
| | | private Integer targetType; |
| | | |
| | | @Schema(description = "éç¨å¯¹è±¡ID") |
| | | private Long targetId; |
| | | |
| | | @Schema(description = "çææ¥æ") |
| | | private LocalDateTime startDate; |
| | | |
| | | @Schema(description = "å¤±ææ¥æ") |
| | | private LocalDateTime endDate; |
| | | |
| | | @Schema(description = "å¯ç¨ç¶æï¼1å¯ç¨/0ç¦ç¨ï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @NotNull(message = "å¯ç¨ç¶æä¸è½ä¸ºç©º") |
| | | private Integer status; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | @Schema(description = "管çåå° - ç¨çµç±»ååºç¡ä¿¡æ¯å页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class MesPdElectricityTypePageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "ç±»ååç§°") |
| | | private String name; |
| | | |
| | | @Schema(description = "å¯ç¨ç¶æï¼1å¯ç¨/0ç¦ç¨ï¼", example = "1") |
| | | private Integer status; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo; |
| | | |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - ç¨çµç±»ååºç¡ä¿¡æ¯ Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class MesPdElectricityTypeRespVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("ç¼å·") |
| | | private Long id; |
| | | |
| | | @Schema(description = "ç±»åç¼ç ") |
| | | @ExcelProperty("ç±»åç¼ç ") |
| | | private String code; |
| | | |
| | | @Schema(description = "ç±»ååç§°") |
| | | @ExcelProperty("ç±»ååç§°") |
| | | private String name; |
| | | |
| | | @Schema(description = "ç±»å说æ") |
| | | @ExcelProperty("ç±»å说æ") |
| | | private String description; |
| | | |
| | | @Schema(description = "æåº") |
| | | @ExcelProperty("æåº") |
| | | private Integer sort; |
| | | |
| | | @Schema(description = "å¯ç¨ç¶æï¼1å¯ç¨/0ç¦ç¨ï¼", example = "1") |
| | | @ExcelProperty("å¯ç¨ç¶æ") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "å建æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | @Schema(description = "管çåå° - ç¨çµç±»ååºç¡ä¿¡æ¯æ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | | public class MesPdElectricityTypeSaveReqVO { |
| | | |
| | | @Schema(description = "ç¼å·", example = "1024") |
| | | private Long id; |
| | | |
| | | @Schema(description = "ç±»åç¼ç ") |
| | | private String code; |
| | | |
| | | @Schema(description = "ç±»ååç§°", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotEmpty(message = "ç±»ååç§°ä¸è½ä¸ºç©º") |
| | | private String name; |
| | | |
| | | @Schema(description = "ç±»å说æ") |
| | | private String description; |
| | | |
| | | @Schema(description = "æåº") |
| | | private Integer sort; |
| | | |
| | | @Schema(description = "å¯ç¨ç¶æï¼1å¯ç¨/0ç¦ç¨ï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @NotNull(message = "å¯ç¨ç¶æä¸è½ä¸ºç©º") |
| | | private Integer status; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | @Schema(description = "管çåå° - å®ä»·æ åå页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class MesPdPriceStandardPageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "å®ä»·å¯¹è±¡ç±»åï¼1æå¡å¥é¤/2çµåç级/3ç¨çµç±»åï¼", example = "1") |
| | | private Integer objectType; |
| | | |
| | | @Schema(description = "å®ä»·å¯¹è±¡ID") |
| | | private Long objectId; |
| | | |
| | | @Schema(description = "å¯ç¨ç¶æï¼1å¯ç¨/0ç¦ç¨ï¼", example = "1") |
| | | private Integer status; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - å®ä»·æ å Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class MesPdPriceStandardRespVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("ç¼å·") |
| | | private Long id; |
| | | |
| | | @Schema(description = "å®ä»·å¯¹è±¡ç±»åï¼1æå¡å¥é¤/2çµåç级/3ç¨çµç±»åï¼", example = "1") |
| | | @ExcelProperty(value = "å®ä»·å¯¹è±¡ç±»å", converter = DictConvert.class) |
| | | @DictFormat(DictTypeConstants.MES_PD_PRICE_OBJECT_TYPE) |
| | | private Integer objectType; |
| | | |
| | | @Schema(description = "å®ä»·å¯¹è±¡ç±»ååç§°") |
| | | private String objectTypeName; |
| | | |
| | | @Schema(description = "å®ä»·å¯¹è±¡ID") |
| | | @ExcelProperty("å®ä»·å¯¹è±¡ID") |
| | | private Long objectId; |
| | | |
| | | @Schema(description = "å®ä»·å¯¹è±¡åç§°") |
| | | @ExcelProperty("å®ä»·å¯¹è±¡åç§°") |
| | | private String objectName; |
| | | |
| | | @Schema(description = "ä»·æ ¼") |
| | | @ExcelProperty("ä»·æ ¼") |
| | | private BigDecimal price; |
| | | |
| | | @Schema(description = "计价åä½") |
| | | @ExcelProperty("计价åä½") |
| | | private String unit; |
| | | |
| | | @Schema(description = "çææ¥æ") |
| | | @ExcelProperty("çææ¥æ") |
| | | private LocalDateTime effectiveDate; |
| | | |
| | | @Schema(description = "å¯ç¨ç¶æï¼1å¯ç¨/0ç¦ç¨ï¼", example = "1") |
| | | @ExcelProperty("å¯ç¨ç¶æ") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "å建æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - å®ä»·æ åæ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | | public class MesPdPriceStandardSaveReqVO { |
| | | |
| | | @Schema(description = "ç¼å·", example = "1024") |
| | | private Long id; |
| | | |
| | | @Schema(description = "å®ä»·å¯¹è±¡ç±»åï¼1æå¡å¥é¤/2çµåç级/3ç¨çµç±»åï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @NotNull(message = "å®ä»·å¯¹è±¡ç±»åä¸è½ä¸ºç©º") |
| | | private Integer objectType; |
| | | |
| | | @Schema(description = "å®ä»·å¯¹è±¡ID", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "å®ä»·å¯¹è±¡IDä¸è½ä¸ºç©º") |
| | | private Long objectId; |
| | | |
| | | @Schema(description = "å®ä»·å¯¹è±¡åç§°ï¼åä½ï¼ä¾¿äºå±ç¤ºï¼") |
| | | private String objectName; |
| | | |
| | | @Schema(description = "ä»·æ ¼") |
| | | private BigDecimal price; |
| | | |
| | | @Schema(description = "计价åä½") |
| | | private String unit; |
| | | |
| | | @Schema(description = "çææ¥æ") |
| | | private LocalDateTime effectiveDate; |
| | | |
| | | @Schema(description = "å¯ç¨ç¶æï¼1å¯ç¨/0ç¦ç¨ï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @NotNull(message = "å¯ç¨ç¶æä¸è½ä¸ºç©º") |
| | | private Integer status; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | @Schema(description = "管çåå° - æå¡å¥é¤åºç¡ä¿¡æ¯å页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class MesPdServicePackagePageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "å¥é¤åç§°") |
| | | private String name; |
| | | |
| | | @Schema(description = "å¯ç¨ç¶æï¼1å¯ç¨/0ç¦ç¨ï¼", example = "1") |
| | | private Integer status; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo; |
| | | |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - æå¡å¥é¤åºç¡ä¿¡æ¯ Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class MesPdServicePackageRespVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("ç¼å·") |
| | | private Long id; |
| | | |
| | | @Schema(description = "å¥é¤ç¼ç ") |
| | | @ExcelProperty("å¥é¤ç¼ç ") |
| | | private String code; |
| | | |
| | | @Schema(description = "å¥é¤åç§°") |
| | | @ExcelProperty("å¥é¤åç§°") |
| | | private String name; |
| | | |
| | | @Schema(description = "å¥é¤è¯´æ") |
| | | @ExcelProperty("å¥é¤è¯´æ") |
| | | private String description; |
| | | |
| | | @Schema(description = "å¥é¤ä»·æ ¼") |
| | | @ExcelProperty("å¥é¤ä»·æ ¼") |
| | | private BigDecimal price; |
| | | |
| | | @Schema(description = "çææ¥æ") |
| | | @ExcelProperty("çææ¥æ") |
| | | private LocalDateTime effectiveDate; |
| | | |
| | | @Schema(description = "å¤±ææ¥æ") |
| | | @ExcelProperty("å¤±ææ¥æ") |
| | | private LocalDateTime expireDate; |
| | | |
| | | @Schema(description = "å¯ç¨ç¶æï¼1å¯ç¨/0ç¦ç¨ï¼", example = "1") |
| | | @ExcelProperty("å¯ç¨ç¶æ") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "å建æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - æå¡å¥é¤åºç¡ä¿¡æ¯æ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | | public class MesPdServicePackageSaveReqVO { |
| | | |
| | | @Schema(description = "ç¼å·", example = "1024") |
| | | private Long id; |
| | | |
| | | @Schema(description = "å¥é¤ç¼ç ï¼ç¼ç è§å PD_PACKAGE_CODE èªå¨çæï¼") |
| | | private String code; |
| | | |
| | | @Schema(description = "å¥é¤åç§°", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotEmpty(message = "å¥é¤åç§°ä¸è½ä¸ºç©º") |
| | | private String name; |
| | | |
| | | @Schema(description = "å¥é¤è¯´æ") |
| | | private String description; |
| | | |
| | | @Schema(description = "å¥é¤ä»·æ ¼") |
| | | private BigDecimal price; |
| | | |
| | | @Schema(description = "çææ¥æ") |
| | | private LocalDateTime effectiveDate; |
| | | |
| | | @Schema(description = "å¤±ææ¥æ") |
| | | private LocalDateTime expireDate; |
| | | |
| | | @Schema(description = "å¯ç¨ç¶æï¼1å¯ç¨/0ç¦ç¨ï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @NotNull(message = "å¯ç¨ç¶æä¸è½ä¸ºç©º") |
| | | private Integer status; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | @Schema(description = "管çåå° - é¶æ¢¯çµä»·å页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class MesPdTieredPricePageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "æå¡å¥é¤IDï¼ä¸çµåç级äºéä¸ï¼") |
| | | private Long packageId; |
| | | |
| | | @Schema(description = "çµåç级IDï¼ä¸æå¡å¥é¤äºéä¸ï¼") |
| | | private Long voltageLevelId; |
| | | |
| | | @Schema(description = "å¯ç¨ç¶æï¼1å¯ç¨/0ç¦ç¨ï¼", example = "1") |
| | | private Integer status; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - é¶æ¢¯çµä»· Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class MesPdTieredPriceRespVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("ç¼å·") |
| | | private Long id; |
| | | |
| | | @Schema(description = "æå¡å¥é¤IDï¼ä¸çµåç级äºéä¸ï¼") |
| | | @ExcelProperty("æå¡å¥é¤ID") |
| | | private Long packageId; |
| | | |
| | | @Schema(description = "çµåç级IDï¼ä¸æå¡å¥é¤äºéä¸ï¼") |
| | | @ExcelProperty("çµåç级ID") |
| | | private Long voltageLevelId; |
| | | |
| | | @Schema(description = "æ¡£ä½ä¸éï¼å«ï¼kWhï¼") |
| | | @ExcelProperty("æ¡£ä½ä¸é") |
| | | private BigDecimal startValue; |
| | | |
| | | @Schema(description = "æ¡£ä½ä¸éï¼ä¸å«ï¼kWhï¼å¯ç©º=ä¸ä¸å°é¡¶ï¼") |
| | | @ExcelProperty("æ¡£ä½ä¸é") |
| | | private BigDecimal endValue; |
| | | |
| | | @Schema(description = "æ¡£ä½åä»·") |
| | | @ExcelProperty("æ¡£ä½åä»·") |
| | | private BigDecimal pricePerUnit; |
| | | |
| | | @Schema(description = "å¯ç¨ç¶æï¼1å¯ç¨/0ç¦ç¨ï¼", example = "1") |
| | | @ExcelProperty(value = "å¯ç¨ç¶æ", converter = DictConvert.class) |
| | | @DictFormat(DictTypeConstants.MES_PD_TIERED_PRICE_STATUS) |
| | | private Integer status; |
| | | |
| | | @Schema(description = "å建æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Schema(description = "管çåå° - é¶æ¢¯çµä»·æ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | | public class MesPdTieredPriceSaveReqVO { |
| | | |
| | | @Schema(description = "ç¼å·", example = "1024") |
| | | private Long id; |
| | | |
| | | @Schema(description = "æå¡å¥é¤IDï¼ä¸çµåç级äºéä¸ï¼") |
| | | private Long packageId; |
| | | |
| | | @Schema(description = "çµåç级IDï¼ä¸æå¡å¥é¤äºéä¸ï¼") |
| | | private Long voltageLevelId; |
| | | |
| | | @Schema(description = "æ¡£ä½ä¸éï¼å«ï¼kWhï¼", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "æ¡£ä½ä¸éä¸è½ä¸ºç©º") |
| | | private BigDecimal startValue; |
| | | |
| | | @Schema(description = "æ¡£ä½ä¸éï¼ä¸å«ï¼kWhï¼å¯ç©º=ä¸ä¸å°é¡¶ï¼") |
| | | private BigDecimal endValue; |
| | | |
| | | @Schema(description = "æ¡£ä½åä»·", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "æ¡£ä½åä»·ä¸è½ä¸ºç©º") |
| | | private BigDecimal pricePerUnit; |
| | | |
| | | @Schema(description = "å¯ç¨ç¶æï¼1å¯ç¨/0ç¦ç¨ï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @NotNull(message = "å¯ç¨ç¶æä¸è½ä¸ºç©º") |
| | | private Integer status; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | @Schema(description = "管çåå° - çµåç级åºç¡ä¿¡æ¯å页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class MesPdVoltageLevelPageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "ç级åç§°") |
| | | private String name; |
| | | |
| | | @Schema(description = "å¯ç¨ç¶æï¼1å¯ç¨/0ç¦ç¨ï¼", example = "1") |
| | | private Integer status; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo; |
| | | |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - çµåç级åºç¡ä¿¡æ¯ Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class MesPdVoltageLevelRespVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("ç¼å·") |
| | | private Long id; |
| | | |
| | | @Schema(description = "ç级ç¼ç ") |
| | | @ExcelProperty("ç级ç¼ç ") |
| | | private String code; |
| | | |
| | | @Schema(description = "ç级åç§°") |
| | | @ExcelProperty("ç级åç§°") |
| | | private String name; |
| | | |
| | | @Schema(description = "çµåæ°å¼ï¼kVï¼") |
| | | @ExcelProperty("çµåæ°å¼ï¼kVï¼") |
| | | private BigDecimal voltageValue; |
| | | |
| | | @Schema(description = "æåº") |
| | | @ExcelProperty("æåº") |
| | | private Integer sort; |
| | | |
| | | @Schema(description = "å¯ç¨ç¶æï¼1å¯ç¨/0ç¦ç¨ï¼", example = "1") |
| | | @ExcelProperty("å¯ç¨ç¶æ") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "å建æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Schema(description = "管çåå° - çµåç级åºç¡ä¿¡æ¯æ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | | public class MesPdVoltageLevelSaveReqVO { |
| | | |
| | | @Schema(description = "ç¼å·", example = "1024") |
| | | private Long id; |
| | | |
| | | @Schema(description = "ç级ç¼ç ") |
| | | private String code; |
| | | |
| | | @Schema(description = "ç级åç§°", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotEmpty(message = "ç级åç§°ä¸è½ä¸ºç©º") |
| | | private String name; |
| | | |
| | | @Schema(description = "çµåæ°å¼ï¼kVï¼") |
| | | private BigDecimal voltageValue; |
| | | |
| | | @Schema(description = "æåº") |
| | | private Integer sort; |
| | | |
| | | @Schema(description = "å¯ç¨ç¶æï¼1å¯ç¨/0ç¦ç¨ï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @NotNull(message = "å¯ç¨ç¶æä¸è½ä¸ºç©º") |
| | | private Integer status; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.ctc; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.module.mdm.api.item.MdmItemApi; |
| | | import cn.iocoder.yudao.module.mdm.api.item.dto.MdmItemRespDTO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.ctc.vo.*; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.ctc.ProductCtcDO; |
| | | import cn.iocoder.yudao.module.mes.service.pd.ctc.ProductCtcService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| | | |
| | | @Tag(name = "管çåå° - æ¢ä½å¯¼çº¿äº§åææ¯åæ°") |
| | | @RestController |
| | | @RequestMapping("/mes/pd/ctc") |
| | | @Validated |
| | | public class ProductCtcController { |
| | | |
| | | @Resource |
| | | private ProductCtcService ctcService; |
| | | |
| | | @Resource |
| | | private MdmItemApi mdmItemApi; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "å建æ¢ä½å¯¼çº¿äº§åææ¯åæ°") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-ctc:create')") |
| | | public CommonResult<Long> createCtc(@Valid @RequestBody ProductCtcSaveReqVO createReqVO) { |
| | | return success(ctcService.createCtc(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "æ´æ°æ¢ä½å¯¼çº¿äº§åææ¯åæ°") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-ctc:update')") |
| | | public CommonResult<Boolean> updateCtc(@Valid @RequestBody ProductCtcSaveReqVO updateReqVO) { |
| | | ctcService.updateCtc(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å 餿¢ä½å¯¼çº¿äº§åææ¯åæ°") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-ctc:delete')") |
| | | public CommonResult<Boolean> deleteCtc(@RequestParam("id") Long id) { |
| | | ctcService.deleteCtc(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "è·å¾æ¢ä½å¯¼çº¿äº§åææ¯åæ°") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-ctc:query')") |
| | | public CommonResult<ProductCtcRespVO> getCtc(@RequestParam("id") Long id) { |
| | | ProductCtcDO ctc = ctcService.getCtc(id); |
| | | if (ctc == null) { |
| | | return success(null); |
| | | } |
| | | return success(buildCtcRespVOList(Collections.singletonList(ctc)).get(0)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "è·å¾æ¢ä½å¯¼çº¿äº§åææ¯åæ°å页") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-ctc:query')") |
| | | public CommonResult<PageResult<ProductCtcRespVO>> getCtcPage(@Valid ProductCtcPageReqVO pageReqVO) { |
| | | PageResult<ProductCtcDO> pageResult = ctcService.getCtcPage(pageReqVO); |
| | | return success(new PageResult<>(buildCtcRespVOList(pageResult.getList()), pageResult.getTotal())); |
| | | } |
| | | |
| | | @GetMapping("/export-excel") |
| | | @Operation(summary = "å¯¼åºæ¢ä½å¯¼çº¿äº§åææ¯åæ° Excel") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-ctc:export')") |
| | | @ApiAccessLog(operateType = EXPORT) |
| | | public void exportCtcExcel(@Valid ProductCtcPageReqVO pageReqVO, |
| | | HttpServletResponse response) throws IOException { |
| | | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| | | List<ProductCtcDO> list = ctcService.getCtcPage(pageReqVO).getList(); |
| | | ExcelUtils.write(response, "æ¢ä½å¯¼çº¿äº§åææ¯åæ°.xls", "æ°æ®", ProductCtcRespVO.class, |
| | | buildCtcRespVOList(list)); |
| | | } |
| | | |
| | | @PostMapping("/calc-angle") |
| | | @Operation(summary = "ç»å
è§åº¦è®¡ç®ï¼å·²ç¥çº¸å¸¦å®½åº¦ï¼") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-ctc:query')") |
| | | public CommonResult<ProductCtcAngleCalcRespVO> calcAngle(@Valid @RequestBody ProductCtcAngleCalcReqVO reqVO) { |
| | | return success(ctcService.calcAngle(reqVO)); |
| | | } |
| | | |
| | | @PostMapping("/calc-resistance") |
| | | @Operation(summary = "ç´æµçµé»è®¡ç®ï¼ææ¸©åº¦æ¢ç®ï¼") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-ctc:query')") |
| | | public CommonResult<ProductCtcResistanceCalcRespVO> calcResistance(@Valid @RequestBody ProductCtcResistanceCalcReqVO reqVO) { |
| | | return success(ctcService.calcResistance(reqVO)); |
| | | } |
| | | |
| | | @PostMapping("/calc-reel") |
| | | @Operation(summary = "çå
·å®¹é计ç®ï¼æ¯çæå¤§é¿åº¦ï¼") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-ctc:query')") |
| | | public CommonResult<ProductCtcReelCalcRespVO> calcReelCapacity(@Valid @RequestBody ProductCtcReelCalcReqVO reqVO) { |
| | | return success(ctcService.calcReelCapacity(reqVO)); |
| | | } |
| | | |
| | | // ==================== æ¼æ¥ VO ==================== |
| | | |
| | | private List<ProductCtcRespVO> buildCtcRespVOList(List<ProductCtcDO> list) { |
| | | if (CollUtil.isEmpty(list)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | // æ¹éè·åç©æä¿¡æ¯ |
| | | Map<Long, MdmItemRespDTO> itemMap = mdmItemApi.getItemMap(convertSet(list, ProductCtcDO::getItemId)); |
| | | // æ¼æ¥ VO |
| | | return BeanUtils.toBean(list, ProductCtcRespVO.class, vo -> { |
| | | MapUtils.findAndThen(itemMap, vo.getItemId(), |
| | | item -> { |
| | | vo.setItemName(item.getName()); |
| | | vo.setItemCode(item.getCode()); |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.ctc.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Schema(description = "管çåå° - ç»å
è§åº¦è®¡ç® Request VO") |
| | | @Data |
| | | public class ProductCtcAngleCalcReqVO { |
| | | |
| | | @Schema(description = "导ä½å度ï¼mmï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "19.08") |
| | | @NotNull(message = "导ä½å度ä¸è½ä¸ºç©º") |
| | | private BigDecimal conductorThickness; |
| | | |
| | | @Schema(description = "导ä½å®½åº¦ï¼mmï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "12.6") |
| | | @NotNull(message = "导ä½å®½åº¦ä¸è½ä¸ºç©º") |
| | | private BigDecimal conductorWidth; |
| | | |
| | | @Schema(description = "åè§åå¾ï¼mmï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @NotNull(message = "åè§åå¾ä¸è½ä¸ºç©º") |
| | | private BigDecimal cornerRadius; |
| | | |
| | | @Schema(description = "ç»ç¼å度ï¼mmï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "0.75") |
| | | @NotNull(message = "ç»ç¼å度ä¸è½ä¸ºç©º") |
| | | private BigDecimal insulationThickness; |
| | | |
| | | @Schema(description = "纸带宽度ï¼mmï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "22") |
| | | @NotNull(message = "纸带宽度ä¸è½ä¸ºç©º") |
| | | private BigDecimal tapeWidth; |
| | | |
| | | @Schema(description = "éå 宽度ï¼mmï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") |
| | | @NotNull(message = "éå 宽度ä¸è½ä¸ºç©º") |
| | | private BigDecimal overlapWidth; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.ctc.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Schema(description = "管çåå° - ç»å
è§åº¦è®¡ç® Response VO") |
| | | @Data |
| | | public class ProductCtcAngleCalcRespVO { |
| | | |
| | | @Schema(description = "导线å¨é¿ï¼mmï¼", example = "64.64") |
| | | private BigDecimal circumference; |
| | | |
| | | @Schema(description = "ç»å
è§åº¦ï¼Â°ï¼", example = "18.02") |
| | | private BigDecimal wrappingAngle; |
| | | |
| | | @Schema(description = "ç»å
èè·ï¼mmï¼", example = "21.03") |
| | | private BigDecimal wrappingPitch; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.ctc.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | @Schema(description = "管çåå° - æ¢ä½å¯¼çº¿äº§åææ¯åæ°å页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class ProductCtcPageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "ç©æID", example = "2048") |
| | | private Long itemId; |
| | | |
| | | @Schema(description = "è®¢è´§è§æ ¼", example = "QQNB-2/120") |
| | | private String orderSpec; |
| | | |
| | | @Schema(description = "导ä½ç±»å", example = "copper") |
| | | private String conductorType; |
| | | |
| | | @Schema(description = "æ§è¡æ å代å·", example = "GB/T 7095-2008") |
| | | private String standardCode; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.ctc.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Schema(description = "管çåå° - çå
·å®¹éè®¡ç® Request VO") |
| | | @Data |
| | | public class ProductCtcReelCalcReqVO { |
| | | |
| | | @Schema(description = "çå
·å¤å¾ d1ï¼mmï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "1600") |
| | | @NotNull(message = "çå
·å¤å¾ä¸è½ä¸ºç©º") |
| | | private BigDecimal reelOuterDiameter; |
| | | |
| | | @Schema(description = "çè¯å
å¾ d2ï¼mmï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "1100") |
| | | @NotNull(message = "çè¯å
å¾ä¸è½ä¸ºç©º") |
| | | private BigDecimal reelInnerDiameter; |
| | | |
| | | @Schema(description = "ç宽 l2ï¼mmï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "500") |
| | | @NotNull(message = "ç宽ä¸è½ä¸ºç©º") |
| | | private BigDecimal reelWidth; |
| | | |
| | | @Schema(description = "CTC æå¤§é«åº¦/å度ï¼mmï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "19.08") |
| | | @NotNull(message = "CTCæå¤§é«åº¦ä¸è½ä¸ºç©º") |
| | | private BigDecimal ctcThickness; |
| | | |
| | | @Schema(description = "CTC æå¤§å®½åº¦ï¼mmï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "12.6") |
| | | @NotNull(message = "CTCæå¤§å®½åº¦ä¸è½ä¸ºç©º") |
| | | private BigDecimal ctcWidth; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.ctc.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Schema(description = "管çåå° - çå
·å®¹éè®¡ç® Response VO") |
| | | @Data |
| | | public class ProductCtcReelCalcRespVO { |
| | | |
| | | @Schema(description = "çå
·å®¹é/æ¯çé¿åº¦ï¼mï¼", example = "1670.09") |
| | | private BigDecimal capacityMeter; |
| | | |
| | | @Schema(description = "çå
·å®¹é/æ¯çé¿åº¦ï¼kmï¼", example = "1.67") |
| | | private BigDecimal capacityKm; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.ctc.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Schema(description = "管çåå° - ç´æµçµé»è®¡ç® Request VO") |
| | | @Data |
| | | public class ProductCtcResistanceCalcReqVO { |
| | | |
| | | @Schema(description = "导ä½å度ï¼mmï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "1.27") |
| | | @NotNull(message = "导ä½å度ä¸è½ä¸ºç©º") |
| | | private BigDecimal conductorThickness; |
| | | |
| | | @Schema(description = "导ä½å®½åº¦ï¼mmï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "5.7") |
| | | @NotNull(message = "导ä½å®½åº¦ä¸è½ä¸ºç©º") |
| | | private BigDecimal conductorWidth; |
| | | |
| | | @Schema(description = "è®¡ç®æ¸©åº¦ï¼âï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "75") |
| | | @NotNull(message = "è®¡ç®æ¸©åº¦ä¸è½ä¸ºç©º") |
| | | private BigDecimal temperature; |
| | | |
| | | @Schema(description = "å¯¼ä½æè´¨ï¼copper=é/aluminum=éï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "copper") |
| | | @NotNull(message = "å¯¼ä½æè´¨ä¸è½ä¸ºç©º") |
| | | private String material; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.ctc.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Schema(description = "管çåå° - ç´æµçµé»è®¡ç® Response VO") |
| | | @Data |
| | | public class ProductCtcResistanceCalcRespVO { |
| | | |
| | | @Schema(description = "æªé¢ç§¯ï¼mm²ï¼", example = "7.239") |
| | | private BigDecimal crossSection; |
| | | |
| | | @Schema(description = "20âç´æµçµé»ï¼Î©/kmï¼", example = "2.418") |
| | | private BigDecimal resistance20cKm; |
| | | |
| | | @Schema(description = "æå®æ¸©åº¦ç´æµçµé»ï¼Î©/mï¼", example = "0.002937") |
| | | private BigDecimal resistanceAtTemp; |
| | | |
| | | @Schema(description = "æå®æ¸©åº¦ç´æµçµé»ï¼Î©/kmï¼", example = "2.937") |
| | | private BigDecimal resistanceAtTempKm; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.ctc.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - æ¢ä½å¯¼çº¿äº§åææ¯åæ° Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class ProductCtcRespVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("ç¼å·") |
| | | private Long id; |
| | | |
| | | @Schema(description = "ç©æIDï¼å
³è mdm_item.idï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") |
| | | private Long itemId; |
| | | |
| | | @Schema(description = "ç©æåç§°", example = "æ¢ä½å¯¼çº¿") |
| | | private String itemName; |
| | | |
| | | @Schema(description = "ç©æç¼ç ", example = "ML0001") |
| | | private String itemCode; |
| | | |
| | | @Schema(description = "è®¢è´§è§æ ¼", example = "QQNB-2/120") |
| | | @ExcelProperty("è®¢è´§è§æ ¼") |
| | | private String orderSpec; |
| | | |
| | | @Schema(description = "è£¸å¯¼çº¿è§æ ¼", example = "1.27Ã5.7") |
| | | @ExcelProperty("è£¸å¯¼çº¿è§æ ¼") |
| | | private String bareConductorSpec; |
| | | |
| | | @Schema(description = "æ¼å
çº¿è§æ ¼", example = "0.11Ã5.7") |
| | | @ExcelProperty("æ¼å
çº¿è§æ ¼") |
| | | private String enameledSpec; |
| | | |
| | | @Schema(description = "æ¢ä½è§æ ¼", example = "19.08Ã12.6") |
| | | @ExcelProperty("æ¢ä½è§æ ¼") |
| | | private String transpositionSpec; |
| | | |
| | | @Schema(description = "导ä½ç±»åï¼é/éï¼", example = "copper") |
| | | @ExcelProperty(value = "导ä½ç±»å", converter = DictConvert.class) |
| | | @DictFormat(DictTypeConstants.PRODUCT_CONDUCTOR_TYPE) |
| | | private String conductorType; |
| | | |
| | | @Schema(description = "æªé¢ç§¯ï¼mm²ï¼", example = "120.00") |
| | | @ExcelProperty("æªé¢ç§¯") |
| | | private BigDecimal crossSection; |
| | | |
| | | @Schema(description = "å¤å¾ï¼mmï¼", example = "19.08") |
| | | @ExcelProperty("å¤å¾") |
| | | private BigDecimal outerDiameter; |
| | | |
| | | @Schema(description = "20âç´æµçµé»ï¼Î©/kmï¼", example = "0.002937") |
| | | @ExcelProperty("20âç´æµçµé»") |
| | | private BigDecimal resistance20c; |
| | | |
| | | @Schema(description = "ç»å
è§åº¦ï¼Â°ï¼", example = "18.02") |
| | | @ExcelProperty("ç»å
è§åº¦") |
| | | private BigDecimal wrappingAngle; |
| | | |
| | | @Schema(description = "ç»ç¼å度ï¼mmï¼", example = "0.75") |
| | | @ExcelProperty("ç»ç¼å度") |
| | | private BigDecimal insulationThickness; |
| | | |
| | | @Schema(description = "é¢å®çµåï¼kVï¼", example = "110") |
| | | @ExcelProperty("é¢å®çµå") |
| | | private String ratedVoltage; |
| | | |
| | | @Schema(description = "è¯éªçµåï¼kVï¼", example = "230") |
| | | @ExcelProperty("è¯éªçµå") |
| | | private String testVoltage; |
| | | |
| | | @Schema(description = "æå°å¼¯æ²åå¾ï¼mmï¼", example = "500") |
| | | @ExcelProperty("æå°å¼¯æ²åå¾") |
| | | private BigDecimal minBendingRadius; |
| | | |
| | | @Schema(description = "æ¯å
¬éééï¼kg/kmï¼", example = "1200") |
| | | @ExcelProperty("æ¯å
¬ééé") |
| | | private BigDecimal weightPerKm; |
| | | |
| | | @Schema(description = "æ§è¡æ å代å·", example = "GB/T 7095-2008") |
| | | @ExcelProperty("æ§è¡æ å") |
| | | private String standardCode; |
| | | |
| | | @Schema(description = "夿³¨", example = "æµè¯å¤æ³¨") |
| | | @ExcelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å建æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.ctc.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Schema(description = "管çåå° - æ¢ä½å¯¼çº¿äº§åææ¯åæ°æ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | | public class ProductCtcSaveReqVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "1024") |
| | | private Long id; |
| | | |
| | | @Schema(description = "ç©æIDï¼å
³è mdm_item.idï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") |
| | | @NotNull(message = "ç©æIDä¸è½ä¸ºç©º") |
| | | private Long itemId; |
| | | |
| | | @Schema(description = "è®¢è´§è§æ ¼", example = "QQNB-2/120") |
| | | private String orderSpec; |
| | | |
| | | @Schema(description = "è£¸å¯¼çº¿è§æ ¼", example = "1.27Ã5.7") |
| | | private String bareConductorSpec; |
| | | |
| | | @Schema(description = "æ¼å
çº¿è§æ ¼", example = "0.11Ã5.7") |
| | | private String enameledSpec; |
| | | |
| | | @Schema(description = "æ¢ä½è§æ ¼", example = "19.08Ã12.6") |
| | | private String transpositionSpec; |
| | | |
| | | @Schema(description = "导ä½ç±»åï¼é/éï¼", example = "copper") |
| | | private String conductorType; |
| | | |
| | | @Schema(description = "æªé¢ç§¯ï¼mm²ï¼", example = "120.00") |
| | | private BigDecimal crossSection; |
| | | |
| | | @Schema(description = "å¤å¾ï¼mmï¼", example = "19.08") |
| | | private BigDecimal outerDiameter; |
| | | |
| | | @Schema(description = "20âç´æµçµé»ï¼Î©/kmï¼", example = "0.002937") |
| | | private BigDecimal resistance20c; |
| | | |
| | | @Schema(description = "ç»å
è§åº¦ï¼Â°ï¼", example = "18.02") |
| | | private BigDecimal wrappingAngle; |
| | | |
| | | @Schema(description = "ç»ç¼å度ï¼mmï¼", example = "0.75") |
| | | private BigDecimal insulationThickness; |
| | | |
| | | @Schema(description = "é¢å®çµåï¼kVï¼", example = "110") |
| | | private String ratedVoltage; |
| | | |
| | | @Schema(description = "è¯éªçµåï¼kVï¼", example = "230") |
| | | private String testVoltage; |
| | | |
| | | @Schema(description = "æå°å¼¯æ²åå¾ï¼mmï¼", example = "500") |
| | | private BigDecimal minBendingRadius; |
| | | |
| | | @Schema(description = "æ¯å
¬éééï¼kg/kmï¼", example = "1200") |
| | | private BigDecimal weightPerKm; |
| | | |
| | | @Schema(description = "æ§è¡æ å代å·", example = "GB/T 7095-2008") |
| | | private String standardCode; |
| | | |
| | | @Schema(description = "夿³¨", example = "æµè¯å¤æ³¨") |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.price; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.price.vo.MesPdPriceCalcReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.price.vo.MesPdPriceCalcRespVO; |
| | | import cn.iocoder.yudao.module.mes.service.pd.price.MesPdPriceService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | |
| | | @Tag(name = "管çåå° - MES é¶æ¢¯çµä»·æµç®") |
| | | @RestController |
| | | @RequestMapping("/mes/pd/price") |
| | | @Validated |
| | | public class MesPdPriceController { |
| | | |
| | | @Resource |
| | | private MesPdPriceService priceService; |
| | | |
| | | @PostMapping("/calc") |
| | | @Operation(summary = "é¶æ¢¯çµä»·æµç®ï¼å档累计 + 伿 çç¥") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-basedata:query')") |
| | | public CommonResult<MesPdPriceCalcRespVO> calcPrice(@Valid @RequestBody MesPdPriceCalcReqVO calcReqVO) { |
| | | return success(priceService.calcPrice(calcReqVO)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.price.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Schema(description = "管çåå° - é¶æ¢¯çµä»·æµç®åæ¡£æç» Response VO") |
| | | @Data |
| | | public class MesPdPriceCalcDetailRespVO { |
| | | |
| | | @Schema(description = "æ¡£ä½ä¸éï¼å«ï¼kWhï¼") |
| | | private BigDecimal startValue; |
| | | |
| | | @Schema(description = "æ¡£ä½ä¸éï¼ä¸å«ï¼kWhï¼å¯ç©º=ä¸ä¸å°é¡¶ï¼") |
| | | private BigDecimal endValue; |
| | | |
| | | @Schema(description = "è½å
¥æ¬æ¡£çµéï¼kWhï¼") |
| | | private BigDecimal tierQuantity; |
| | | |
| | | @Schema(description = "æ¡£ä½åä»·") |
| | | private BigDecimal pricePerUnit; |
| | | |
| | | @Schema(description = "å°è®¡") |
| | | private BigDecimal subtotal; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.price.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Schema(description = "管çåå° - é¶æ¢¯çµä»·æµç® Request VO") |
| | | @Data |
| | | public class MesPdPriceCalcReqVO { |
| | | |
| | | @Schema(description = "æµç®ç±»åï¼1æå¡å¥é¤/2çµåç级ï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @NotNull(message = "æµç®ç±»åä¸è½ä¸ºç©º") |
| | | private Integer calcType; |
| | | |
| | | @Schema(description = "æå¡å¥é¤IDï¼calcType=1 æ¶å¿
å¡«ï¼") |
| | | private Long packageId; |
| | | |
| | | @Schema(description = "çµåç级IDï¼calcType=2 æ¶å¿
å¡«ï¼") |
| | | private Long voltageLevelId; |
| | | |
| | | @Schema(description = "ç¨çµéï¼kWhï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "500") |
| | | @NotNull(message = "ç¨çµéä¸è½ä¸ºç©º") |
| | | private BigDecimal quantity; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.price.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Schema(description = "管çåå° - é¶æ¢¯çµä»·æµç® Response VO") |
| | | @Data |
| | | public class MesPdPriceCalcRespVO { |
| | | |
| | | @Schema(description = "æå¡å¥é¤åç§°") |
| | | private String packageName; |
| | | |
| | | @Schema(description = "çµåç级åç§°") |
| | | private String voltageLevelName; |
| | | |
| | | @Schema(description = "åä»·ï¼æªä¼æ ï¼") |
| | | private BigDecimal originalPrice; |
| | | |
| | | @Schema(description = "伿 éé¢") |
| | | private BigDecimal discountAmount; |
| | | |
| | | @Schema(description = "伿 忻价") |
| | | private BigDecimal finalPrice; |
| | | |
| | | @Schema(description = "åæ¡£æç»") |
| | | private List<MesPdPriceCalcDetailRespVO> details; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.product; |
| | | |
| | | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.product.vo.MesPdProductAuditReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.product.vo.MesPdProductPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.product.vo.MesPdProductRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.product.vo.MesPdProductSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.service.pd.product.MesPdProductService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | |
| | | import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | |
| | | @Tag(name = "管çåå° - MES äº§åæ¡£æ¡") |
| | | @RestController |
| | | @RequestMapping("/mes/pd/product") |
| | | @Validated |
| | | public class MesPdProductController { |
| | | |
| | | @Resource |
| | | private MesPdProductService productService; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "åå»ºäº§åæ¡£æ¡") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-product:create')") |
| | | public CommonResult<Long> createProduct(@Valid @RequestBody MesPdProductSaveReqVO createReqVO) { |
| | | return success(productService.createProduct(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "æ´æ°äº§åæ¡£æ¡") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-product:update')") |
| | | public CommonResult<Boolean> updateProduct(@Valid @RequestBody MesPdProductSaveReqVO updateReqVO) { |
| | | productService.updateProduct(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤äº§åæ¡£æ¡") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-product:delete')") |
| | | public CommonResult<Boolean> deleteProduct(@RequestParam("id") Long id) { |
| | | productService.deleteProduct(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "è·å¾äº§åæ¡£æ¡") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-product:query')") |
| | | public CommonResult<MesPdProductRespVO> getProduct(@RequestParam("id") Long id) { |
| | | return success(productService.getProduct(id)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "è·å¾äº§åæ¡£æ¡å页") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-product:query')") |
| | | public CommonResult<PageResult<MesPdProductRespVO>> getProductPage(@Valid MesPdProductPageReqVO pageReqVO) { |
| | | return success(productService.getProductPage(pageReqVO)); |
| | | } |
| | | |
| | | @GetMapping("/export-excel") |
| | | @Operation(summary = "导åºäº§åæ¡£æ¡ Excel") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-product:export')") |
| | | @ApiAccessLog(operateType = EXPORT) |
| | | public void exportProductExcel(@Valid MesPdProductPageReqVO pageReqVO, |
| | | HttpServletResponse response) throws IOException { |
| | | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| | | PageResult<MesPdProductRespVO> pageResult = productService.getProductPage(pageReqVO); |
| | | ExcelUtils.write(response, "äº§åæ¡£æ¡.xls", "æ°æ®", MesPdProductRespVO.class, pageResult.getList()); |
| | | } |
| | | |
| | | @PutMapping("/submit") |
| | | @Operation(summary = "æäº¤å®¡æ¹ï¼æªæäº¤/驳åâ审æ¹ä¸ï¼") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-product:submit')") |
| | | public CommonResult<Boolean> submitProduct(@RequestParam("id") Long id) { |
| | | productService.submitProduct(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @PutMapping("/audit") |
| | | @Operation(summary = "审æ¹äº§åæ¡£æ¡ï¼å®¡æ¹ä¸âéè¿/驳åï¼") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-product:audit')") |
| | | public CommonResult<Boolean> auditProduct(@Valid @RequestBody MesPdProductAuditReqVO auditReqVO) { |
| | | productService.auditProduct(auditReqVO.getId(), auditReqVO.getPass(), auditReqVO.getAuditRemark()); |
| | | return success(true); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.product.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | @Schema(description = "管çåå° - äº§åæ¡£æ¡å®¡æ¹ Request VO") |
| | | @Data |
| | | public class MesPdProductAuditReqVO { |
| | | |
| | | @Schema(description = "äº§åæ¡£æ¡ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "äº§åæ¡£æ¡ç¼å·ä¸è½ä¸ºç©º") |
| | | private Long id; |
| | | |
| | | @Schema(description = "审æ¹ç»æï¼true=éè¿ / false=驳å", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "审æ¹ç»æä¸è½ä¸ºç©º") |
| | | private Boolean pass; |
| | | |
| | | @Schema(description = "å®¡æ¹æè§") |
| | | private String auditRemark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.product.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | @Schema(description = "管çåå° - äº§åæ¡£æ¡å页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class MesPdProductPageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "æ¡£æ¡ç±»å", example = "1") |
| | | private Integer archiveType; |
| | | |
| | | @Schema(description = "æ¡£æ¡åç§°", example = "çµåæ¢ä¿®æå¡") |
| | | private String name; |
| | | |
| | | @Schema(description = "审æ¹ç¶æ", example = "0") |
| | | private Integer auditStatus; |
| | | |
| | | @Schema(description = "å¯ç¨ç¶æ", example = "1") |
| | | private Integer status; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.product.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - äº§åæ¡£æ¡ Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class MesPdProductRespVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("ç¼å·") |
| | | private Long id; |
| | | |
| | | @Schema(description = "æ¡£æ¡ç±»å", example = "1") |
| | | @ExcelProperty(value = "æ¡£æ¡ç±»å", converter = DictConvert.class) |
| | | @DictFormat(DictTypeConstants.MES_PD_PRODUCT_ARCHIVE_TYPE) |
| | | private Integer archiveType; |
| | | |
| | | @Schema(description = "æ¡£æ¡ç±»ååç§°", example = "çµåæå¡") |
| | | private String archiveTypeName; |
| | | |
| | | @Schema(description = "æ¡£æ¡ç¼ç ", example = "P_20260820_0001") |
| | | @ExcelProperty("æ¡£æ¡ç¼ç ") |
| | | private String code; |
| | | |
| | | @Schema(description = "æ¡£æ¡åç§°", example = "çµåæ¢ä¿®æå¡") |
| | | @ExcelProperty("æ¡£æ¡åç§°") |
| | | private String name; |
| | | |
| | | @Schema(description = "è§æ ¼åå·", example = "24h") |
| | | @ExcelProperty("è§æ ¼åå·") |
| | | private String spec; |
| | | |
| | | @Schema(description = "åä½", example = "次") |
| | | @ExcelProperty("åä½") |
| | | private String unit; |
| | | |
| | | @Schema(description = "åºåä»·æ ¼", example = "500.00") |
| | | @ExcelProperty("åºåä»·æ ¼") |
| | | private BigDecimal price; |
| | | |
| | | @Schema(description = "审æ¹ç¶æ", example = "0") |
| | | @ExcelProperty(value = "审æ¹ç¶æ", converter = DictConvert.class) |
| | | @DictFormat(DictTypeConstants.MES_PD_PRODUCT_AUDIT_STATUS) |
| | | private Integer auditStatus; |
| | | |
| | | @Schema(description = "审æ¹ç¶æåç§°", example = "æªæäº¤") |
| | | private String auditStatusName; |
| | | |
| | | @Schema(description = "å®¡æ¹æè§") |
| | | private String auditRemark; |
| | | |
| | | @Schema(description = "å®¡æ¹æ¶é´") |
| | | private LocalDateTime auditTime; |
| | | |
| | | @Schema(description = "å¯ç¨ç¶æ", example = "1") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "夿³¨") |
| | | @ExcelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å建æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.product.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Schema(description = "管çåå° - äº§åæ¡£æ¡æ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | | public class MesPdProductSaveReqVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "1024") |
| | | private Long id; |
| | | |
| | | @Schema(description = "æ¡£æ¡ç±»åï¼1çµåæå¡/2ä¾çµäº§å/3å¢å¼è½æºäº§åï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @NotNull(message = "æ¡£æ¡ç±»åä¸è½ä¸ºç©º") |
| | | private Integer archiveType; |
| | | |
| | | @Schema(description = "æ¡£æ¡åç§°", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotEmpty(message = "æ¡£æ¡åç§°ä¸è½ä¸ºç©º") |
| | | private String name; |
| | | |
| | | @Schema(description = "è§æ ¼åå·") |
| | | private String spec; |
| | | |
| | | @Schema(description = "åä½") |
| | | private String unit; |
| | | |
| | | @Schema(description = "åºåä»·æ ¼") |
| | | private BigDecimal price; |
| | | |
| | | @Schema(description = "å¯ç¨ç¶æï¼1å¯ç¨/0ç¦ç¨ï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @NotNull(message = "å¯ç¨ç¶æä¸è½ä¸ºç©º") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "夿³¨") |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.reel; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.reel.vo.ProductCtcReelPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.reel.vo.ProductCtcReelRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.reel.vo.ProductCtcReelSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.ctc.ProductCtcDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.reel.ProductCtcReelDO; |
| | | import cn.iocoder.yudao.module.mes.service.pd.ctc.ProductCtcService; |
| | | import cn.iocoder.yudao.module.mes.service.pd.reel.ProductCtcReelService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| | | |
| | | @Tag(name = "管çåå° - æ¢ä½å¯¼çº¿çå
·è®¡ç®") |
| | | @RestController |
| | | @RequestMapping("/mes/pd/ctc-reel") |
| | | @Validated |
| | | public class ProductCtcReelController { |
| | | |
| | | @Resource |
| | | private ProductCtcReelService reelService; |
| | | |
| | | @Resource |
| | | private ProductCtcService ctcService; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "å建çå
·è®¡ç®è®°å½") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-ctc-reel:create')") |
| | | public CommonResult<Long> createReel(@Valid @RequestBody ProductCtcReelSaveReqVO createReqVO) { |
| | | return success(reelService.createReel(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "æ´æ°çå
·è®¡ç®è®°å½") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-ctc-reel:update')") |
| | | public CommonResult<Boolean> updateReel(@Valid @RequestBody ProductCtcReelSaveReqVO updateReqVO) { |
| | | reelService.updateReel(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤çå
·è®¡ç®è®°å½") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-ctc-reel:delete')") |
| | | public CommonResult<Boolean> deleteReel(@RequestParam("id") Long id) { |
| | | reelService.deleteReel(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "è·å¾çå
·è®¡ç®è®°å½") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-ctc-reel:query')") |
| | | public CommonResult<ProductCtcReelRespVO> getReel(@RequestParam("id") Long id) { |
| | | ProductCtcReelDO reel = reelService.getReel(id); |
| | | if (reel == null) { |
| | | return success(null); |
| | | } |
| | | return success(buildReelRespVOList(Collections.singletonList(reel)).get(0)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "è·å¾çå
·è®¡ç®è®°å½å页") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-ctc-reel:query')") |
| | | public CommonResult<PageResult<ProductCtcReelRespVO>> getReelPage(@Valid ProductCtcReelPageReqVO pageReqVO) { |
| | | PageResult<ProductCtcReelDO> pageResult = reelService.getReelPage(pageReqVO); |
| | | return success(new PageResult<>(buildReelRespVOList(pageResult.getList()), pageResult.getTotal())); |
| | | } |
| | | |
| | | @GetMapping("/list-by-ctc") |
| | | @Operation(summary = "è·å¾æå®æ¢ä½å¯¼çº¿äº§åççå
·è®¡ç®è®°å½å表") |
| | | @Parameter(name = "ctcId", description = "æ¢ä½å¯¼çº¿äº§åID", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-ctc-reel:query')") |
| | | public CommonResult<List<ProductCtcReelRespVO>> getReelListByCtcId(@RequestParam("ctcId") Long ctcId) { |
| | | List<ProductCtcReelDO> list = reelService.getReelListByCtcId(ctcId); |
| | | return success(buildReelRespVOList(list)); |
| | | } |
| | | |
| | | // ==================== æ¼æ¥ VO ==================== |
| | | |
| | | private List<ProductCtcReelRespVO> buildReelRespVOList(List<ProductCtcReelDO> list) { |
| | | if (CollUtil.isEmpty(list)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | // æ¹éè·åæ¢ä½å¯¼çº¿äº§åè®¢è´§è§æ ¼ |
| | | Map<Long, ProductCtcDO> ctcFullMap = loadCtcMap(convertSet(list, ProductCtcReelDO::getCtcId)); |
| | | // æ¼æ¥ VO |
| | | return BeanUtils.toBean(list, ProductCtcReelRespVO.class, vo -> { |
| | | MapUtils.findAndThen(ctcFullMap, vo.getCtcId(), |
| | | ctc -> vo.setCtcOrderSpec(ctc.getOrderSpec())); |
| | | }); |
| | | } |
| | | |
| | | private Map<Long, ProductCtcDO> loadCtcMap(java.util.Set<Long> ctcIds) { |
| | | if (CollUtil.isEmpty(ctcIds)) { |
| | | return Collections.emptyMap(); |
| | | } |
| | | java.util.List<ProductCtcDO> list = ctcIds.stream() |
| | | .map(ctcService::getCtc) |
| | | .filter(java.util.Objects::nonNull) |
| | | .toList(); |
| | | return convertMap(list, ProductCtcDO::getId); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.reel.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | @Schema(description = "管çåå° - æ¢ä½å¯¼çº¿çå
·è®¡ç®å页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class ProductCtcReelPageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "æ¢ä½å¯¼çº¿äº§åID", example = "2048") |
| | | private Long ctcId; |
| | | |
| | | @Schema(description = "çå
፱Ȍ", example = "wood") |
| | | private String reelType; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.reel.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - æ¢ä½å¯¼çº¿çå
·è®¡ç® Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class ProductCtcReelRespVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("ç¼å·") |
| | | private Long id; |
| | | |
| | | @Schema(description = "æ¢ä½å¯¼çº¿äº§åIDï¼å
³è product_ctc.idï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") |
| | | private Long ctcId; |
| | | |
| | | @Schema(description = "æ¢ä½å¯¼çº¿è®¢è´§è§æ ¼", example = "QQNB-2/120") |
| | | private String ctcOrderSpec; |
| | | |
| | | @Schema(description = "çå
·ç±»åï¼æ¨ç/éç/é¢çï¼", example = "wood") |
| | | @ExcelProperty(value = "çå
፱Ȍ", converter = DictConvert.class) |
| | | @DictFormat(DictTypeConstants.PRODUCT_REEL_TYPE) |
| | | private String reelType; |
| | | |
| | | @Schema(description = "çå
·å¤å¾ï¼mmï¼", example = "1600") |
| | | @ExcelProperty("çå
·å¤å¾") |
| | | private BigDecimal reelOuterDiameter; |
| | | |
| | | @Schema(description = "çè¯å
å¾ï¼mmï¼", example = "1100") |
| | | @ExcelProperty("çè¯å
å¾") |
| | | private BigDecimal reelInnerDiameter; |
| | | |
| | | @Schema(description = "ç宽ï¼mmï¼", example = "500") |
| | | @ExcelProperty("ç宽") |
| | | private BigDecimal reelWidth; |
| | | |
| | | @Schema(description = "æå¤§å®¹éï¼kmï¼", example = "1.67") |
| | | @ExcelProperty("æå¤§å®¹é") |
| | | private BigDecimal maxCapacity; |
| | | |
| | | @Schema(description = "æ¨èæ¯çé¿åº¦ï¼kmï¼", example = "1.50") |
| | | @ExcelProperty("æ¨èæ¯çé¿åº¦") |
| | | private BigDecimal recommendedLength; |
| | | |
| | | @Schema(description = "åéï¼kgï¼", example = "800") |
| | | @ExcelProperty("åé") |
| | | private BigDecimal netWeight; |
| | | |
| | | @Schema(description = "æ¯éï¼kgï¼", example = "1200") |
| | | @ExcelProperty("æ¯é") |
| | | private BigDecimal grossWeight; |
| | | |
| | | @Schema(description = "计ç®å
¬å¼ï¼ä¿å计ç®é»è¾ï¼", example = "((d1-60)+(d2+10))*INT(l2/(宽+1))*(d1-d2-70)/(é«+0.2)/1274") |
| | | private String calcFormula; |
| | | |
| | | @Schema(description = "夿³¨", example = "æµè¯å¤æ³¨") |
| | | @ExcelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å建æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.reel.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Schema(description = "管çåå° - æ¢ä½å¯¼çº¿çå
·è®¡ç®æ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | | public class ProductCtcReelSaveReqVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "1024") |
| | | private Long id; |
| | | |
| | | @Schema(description = "æ¢ä½å¯¼çº¿äº§åIDï¼å
³è product_ctc.idï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") |
| | | @NotNull(message = "æ¢ä½å¯¼çº¿äº§åIDä¸è½ä¸ºç©º") |
| | | private Long ctcId; |
| | | |
| | | @Schema(description = "çå
·ç±»åï¼æ¨ç/éç/é¢çï¼", example = "wood") |
| | | private String reelType; |
| | | |
| | | @Schema(description = "çå
·å¤å¾ï¼mmï¼", example = "1600") |
| | | private BigDecimal reelOuterDiameter; |
| | | |
| | | @Schema(description = "çè¯å
å¾ï¼mmï¼", example = "1100") |
| | | private BigDecimal reelInnerDiameter; |
| | | |
| | | @Schema(description = "ç宽ï¼mmï¼", example = "500") |
| | | private BigDecimal reelWidth; |
| | | |
| | | @Schema(description = "æå¤§å®¹éï¼kmï¼", example = "1.67") |
| | | private BigDecimal maxCapacity; |
| | | |
| | | @Schema(description = "æ¨èæ¯çé¿åº¦ï¼kmï¼", example = "1.50") |
| | | private BigDecimal recommendedLength; |
| | | |
| | | @Schema(description = "åéï¼kgï¼", example = "800") |
| | | private BigDecimal netWeight; |
| | | |
| | | @Schema(description = "æ¯éï¼kgï¼", example = "1200") |
| | | private BigDecimal grossWeight; |
| | | |
| | | @Schema(description = "计ç®å
¬å¼ï¼ä¿å计ç®é»è¾ï¼", example = "((d1-60)+(d2+10))*INT(l2/(宽+1))*(d1-d2-70)/(é«+0.2)/1274") |
| | | private String calcFormula; |
| | | |
| | | @Schema(description = "夿³¨", example = "æµè¯å¤æ³¨") |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.techconfirm; |
| | | |
| | | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.techconfirm.vo.ProductTechConfirmPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.techconfirm.vo.ProductTechConfirmRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.techconfirm.vo.ProductTechConfirmSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.techconfirm.ProductTechConfirmDO; |
| | | import cn.iocoder.yudao.module.mes.service.pd.techconfirm.ProductTechConfirmService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | |
| | | @Tag(name = "管çåå° - äº§åææ¯ç¡®è®¤å½") |
| | | @RestController |
| | | @RequestMapping("/mes/pd/tech-confirm") |
| | | @Validated |
| | | public class ProductTechConfirmController { |
| | | |
| | | @Resource |
| | | private ProductTechConfirmService techConfirmService; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "åå»ºäº§åææ¯ç¡®è®¤å½") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-tech-confirm:create')") |
| | | public CommonResult<Long> createTechConfirm(@Valid @RequestBody ProductTechConfirmSaveReqVO createReqVO) { |
| | | return success(techConfirmService.createTechConfirm(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "æ´æ°äº§åææ¯ç¡®è®¤å½") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-tech-confirm:update')") |
| | | public CommonResult<Boolean> updateTechConfirm(@Valid @RequestBody ProductTechConfirmSaveReqVO updateReqVO) { |
| | | techConfirmService.updateTechConfirm(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤äº§åææ¯ç¡®è®¤å½") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-tech-confirm:delete')") |
| | | public CommonResult<Boolean> deleteTechConfirm(@RequestParam("id") Long id) { |
| | | techConfirmService.deleteTechConfirm(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "è·å¾äº§åææ¯ç¡®è®¤å½") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-tech-confirm:query')") |
| | | public CommonResult<ProductTechConfirmRespVO> getTechConfirm(@RequestParam("id") Long id) { |
| | | ProductTechConfirmDO techConfirm = techConfirmService.getTechConfirm(id); |
| | | if (techConfirm == null) { |
| | | return success(null); |
| | | } |
| | | return success(BeanUtils.toBean(techConfirm, ProductTechConfirmRespVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "è·å¾äº§åææ¯ç¡®è®¤å½å页") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-tech-confirm:query')") |
| | | public CommonResult<PageResult<ProductTechConfirmRespVO>> getTechConfirmPage(@Valid ProductTechConfirmPageReqVO pageReqVO) { |
| | | PageResult<ProductTechConfirmDO> pageResult = techConfirmService.getTechConfirmPage(pageReqVO); |
| | | return success(new PageResult<>(BeanUtils.toBean(pageResult.getList(), ProductTechConfirmRespVO.class), |
| | | pageResult.getTotal())); |
| | | } |
| | | |
| | | @GetMapping("/export-excel") |
| | | @Operation(summary = "导åºäº§åææ¯ç¡®è®¤å½ Excel") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-tech-confirm:export')") |
| | | @ApiAccessLog(operateType = EXPORT) |
| | | public void exportTechConfirmExcel(@Valid ProductTechConfirmPageReqVO pageReqVO, |
| | | HttpServletResponse response) throws IOException { |
| | | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| | | List<ProductTechConfirmDO> list = techConfirmService.getTechConfirmPage(pageReqVO).getList(); |
| | | ExcelUtils.write(response, "äº§åææ¯ç¡®è®¤å½.xls", "æ°æ®", ProductTechConfirmRespVO.class, |
| | | BeanUtils.toBean(list, ProductTechConfirmRespVO.class)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.techconfirm.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | @Schema(description = "管çåå° - äº§åææ¯ç¡®è®¤å½å页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class ProductTechConfirmPageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "确认å½ç¼å·", example = "TC20260801001") |
| | | private String confirmNo; |
| | | |
| | | @Schema(description = "客æ·ID", example = "2048") |
| | | private Long customerId; |
| | | |
| | | @Schema(description = "产ååç§°", example = "æ¼å
æé线") |
| | | private String productName; |
| | | |
| | | @Schema(description = "模æ¿ç±»å", example = "general") |
| | | private String templateType; |
| | | |
| | | @Schema(description = "ç¶æ", example = "0") |
| | | private Integer status; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.techconfirm.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - äº§åææ¯ç¡®è®¤å½ Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class ProductTechConfirmRespVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("ç¼å·") |
| | | private Long id; |
| | | |
| | | @Schema(description = "确认å½ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "TC20260801001") |
| | | @ExcelProperty("确认å½ç¼å·") |
| | | private String confirmNo; |
| | | |
| | | @Schema(description = "客æ·IDï¼å
³è crm_customer.idï¼", example = "2048") |
| | | private Long customerId; |
| | | |
| | | @Schema(description = "客æ·åç§°", example = "æ±èåé¹åå卿éå
¬å¸") |
| | | @ExcelProperty("客æ·åç§°") |
| | | private String customerName; |
| | | |
| | | @Schema(description = "产ååç§°", example = "æ¼å
æé线") |
| | | @ExcelProperty("产ååç§°") |
| | | private String productName; |
| | | |
| | | @Schema(description = "è§æ ¼åå·", example = "QQNB-2/120") |
| | | @ExcelProperty("è§æ ¼åå·") |
| | | private String specification; |
| | | |
| | | @Schema(description = "ææ¯åæ°ï¼JSON æ ¼å¼ï¼", example = "{\"thickness\":\"1.27\"}") |
| | | private String techParams; |
| | | |
| | | @Schema(description = "模æ¿ç±»åï¼å¥¥å°å©/æ¥æ¬/éç¨ï¼", example = "general") |
| | | @ExcelProperty(value = "模æ¿ç±»å", converter = DictConvert.class) |
| | | @DictFormat(DictTypeConstants.PRODUCT_TECH_CONFIRM_TEMPLATE) |
| | | private String templateType; |
| | | |
| | | @Schema(description = "ç¼å¶äººID", example = "1") |
| | | private Long drafterId; |
| | | |
| | | @Schema(description = "ç¼å¶äººå§å", example = "è¡ä¸") |
| | | @ExcelProperty("ç¼å¶äºº") |
| | | private String drafterName; |
| | | |
| | | @Schema(description = "ç¼å¶æ¶é´") |
| | | @ExcelProperty("ç¼å¶æ¶é´") |
| | | private LocalDateTime draftTime; |
| | | |
| | | @Schema(description = "å®¡æ ¸äººID", example = "2") |
| | | private Long reviewerId; |
| | | |
| | | @Schema(description = "å®¡æ ¸äººå§å", example = "æå·¥") |
| | | @ExcelProperty("å®¡æ ¸äºº") |
| | | private String reviewerName; |
| | | |
| | | @Schema(description = "å®¡æ ¸æ¶é´") |
| | | @ExcelProperty("å®¡æ ¸æ¶é´") |
| | | private LocalDateTime reviewTime; |
| | | |
| | | @Schema(description = "客æ·ç¡®è®¤äºº", example = "çç»ç") |
| | | @ExcelProperty("客æ·ç¡®è®¤äºº") |
| | | private String customerConfirmUser; |
| | | |
| | | @Schema(description = "客æ·ç¡®è®¤æ¶é´") |
| | | @ExcelProperty("客æ·ç¡®è®¤æ¶é´") |
| | | private LocalDateTime customerConfirmTime; |
| | | |
| | | @Schema(description = "ç¶æï¼0=è稿ï¼1=å¾
å®¡æ ¸ï¼2=å·²å®¡æ ¸ï¼3=客æ·å·²ç¡®è®¤ï¼", example = "0") |
| | | @ExcelProperty(value = "ç¶æ", converter = DictConvert.class) |
| | | @DictFormat(DictTypeConstants.PRODUCT_TECH_CONFIRM_STATUS) |
| | | private Integer status; |
| | | |
| | | @Schema(description = "夿³¨", example = "æµè¯å¤æ³¨") |
| | | @ExcelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å建æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.techconfirm.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - äº§åææ¯ç¡®è®¤å½æ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | | public class ProductTechConfirmSaveReqVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "1024") |
| | | private Long id; |
| | | |
| | | @Schema(description = "确认å½ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "TC20260801001") |
| | | private String confirmNo; |
| | | |
| | | @Schema(description = "客æ·IDï¼å
³è crm_customer.idï¼", example = "2048") |
| | | private Long customerId; |
| | | |
| | | @Schema(description = "客æ·åç§°", example = "æ±èåé¹åå卿éå
¬å¸") |
| | | private String customerName; |
| | | |
| | | @Schema(description = "产ååç§°", example = "æ¼å
æé线") |
| | | private String productName; |
| | | |
| | | @Schema(description = "è§æ ¼åå·", example = "QQNB-2/120") |
| | | private String specification; |
| | | |
| | | @Schema(description = "ææ¯åæ°ï¼JSON æ ¼å¼ï¼", example = "{\"thickness\":\"1.27\"}") |
| | | private String techParams; |
| | | |
| | | @Schema(description = "模æ¿ç±»åï¼å¥¥å°å©/æ¥æ¬/éç¨ï¼", example = "general") |
| | | private String templateType; |
| | | |
| | | @Schema(description = "ç¼å¶äººID", example = "1") |
| | | private Long drafterId; |
| | | |
| | | @Schema(description = "ç¼å¶äººå§å", example = "è¡ä¸") |
| | | private String drafterName; |
| | | |
| | | @Schema(description = "ç¼å¶æ¶é´") |
| | | private LocalDateTime draftTime; |
| | | |
| | | @Schema(description = "å®¡æ ¸äººID", example = "2") |
| | | private Long reviewerId; |
| | | |
| | | @Schema(description = "å®¡æ ¸äººå§å", example = "æå·¥") |
| | | private String reviewerName; |
| | | |
| | | @Schema(description = "å®¡æ ¸æ¶é´") |
| | | private LocalDateTime reviewTime; |
| | | |
| | | @Schema(description = "客æ·ç¡®è®¤äºº", example = "çç»ç") |
| | | private String customerConfirmUser; |
| | | |
| | | @Schema(description = "客æ·ç¡®è®¤æ¶é´") |
| | | private LocalDateTime customerConfirmTime; |
| | | |
| | | @Schema(description = "ç¶æï¼0=è稿ï¼1=å¾
å®¡æ ¸ï¼2=å·²å®¡æ ¸ï¼3=客æ·å·²ç¡®è®¤ï¼", example = "0") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "夿³¨", example = "æµè¯å¤æ³¨") |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pro.emergencyplan; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.emergencyplan.vo.MesProEmergencyPlanPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.emergencyplan.vo.MesProEmergencyPlanRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.emergencyplan.vo.MesProEmergencyPlanSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.emergencyplan.MesProEmergencyPlanDO; |
| | | import cn.iocoder.yudao.module.mes.service.pro.emergencyplan.MesProEmergencyPlanService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | |
| | | @Tag(name = "管çåå° - MES åºæ¥å¤ç½®é¢æ¡") |
| | | @RestController |
| | | @RequestMapping("/mes/pro/emergency-plan") |
| | | @Validated |
| | | public class MesProEmergencyPlanController { |
| | | |
| | | @Resource |
| | | private MesProEmergencyPlanService planService; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "åå»ºåºæ¥å¤ç½®é¢æ¡") |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-emergency-plan:create')") |
| | | public CommonResult<Long> createPlan(@Valid @RequestBody MesProEmergencyPlanSaveReqVO createReqVO) { |
| | | return success(planService.createPlan(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "æ´æ°åºæ¥å¤ç½®é¢æ¡") |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-emergency-plan:update')") |
| | | public CommonResult<Boolean> updatePlan(@Valid @RequestBody MesProEmergencyPlanSaveReqVO updateReqVO) { |
| | | planService.updatePlan(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤åºæ¥å¤ç½®é¢æ¡") |
| | | @Parameter(name = "ids", description = "ç¼å·æ°ç»", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-emergency-plan:delete')") |
| | | public CommonResult<Boolean> deletePlan(@RequestParam("ids") List<Long> ids) { |
| | | planService.deletePlan(ids); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "è·å¾åºæ¥å¤ç½®é¢æ¡") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-emergency-plan:query')") |
| | | public CommonResult<MesProEmergencyPlanRespVO> getPlan(@RequestParam("id") Long id) { |
| | | MesProEmergencyPlanDO plan = planService.getPlan(id); |
| | | return success(plan != null ? BeanUtils.toBean(plan, MesProEmergencyPlanRespVO.class) : null); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "è·å¾åºæ¥å¤ç½®é¢æ¡å页") |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-emergency-plan:query')") |
| | | public CommonResult<PageResult<MesProEmergencyPlanRespVO>> getPlanPage(@Valid MesProEmergencyPlanPageReqVO pageReqVO) { |
| | | PageResult<MesProEmergencyPlanDO> pageResult = planService.getPlanPage(pageReqVO); |
| | | if (CollUtil.isEmpty(pageResult.getList())) { |
| | | return success(PageResult.empty(pageResult.getTotal())); |
| | | } |
| | | return success(BeanUtils.toBean(pageResult, MesProEmergencyPlanRespVO.class)); |
| | | } |
| | | |
| | | @PutMapping("/publish") |
| | | @Operation(summary = "åå¸åºæ¥å¤ç½®é¢æ¡") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-emergency-plan:update')") |
| | | public CommonResult<Boolean> publishPlan(@RequestParam("id") Long id) { |
| | | planService.publishPlan(id); |
| | | return success(true); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pro.emergencyplan.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | @Schema(description = "管çåå° - MES åºæ¥å¤ç½®é¢æ¡å页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class MesProEmergencyPlanPageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "颿¡ç¼ç ", example = "YJ20260818001") |
| | | private String code; |
| | | |
| | | @Schema(description = "颿¡åç§°", example = "åçµç«åçµå¤ç½®é¢æ¡") |
| | | private String name; |
| | | |
| | | @Schema(description = "颿¡ç±»åï¼1=åçµï¼2=è®¾å¤æ
éï¼3=ç«ç¾ï¼4=èªç¶ç¾å®³ï¼5=å
¶ä»ï¼", example = "1") |
| | | private Integer planType; |
| | | |
| | | @Schema(description = "ç¶æï¼0=è稿ï¼10=å·²åå¸ï¼", example = "0") |
| | | private Integer status; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pro.emergencyplan.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - MES åºæ¥å¤ç½®é¢æ¡ Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class MesProEmergencyPlanRespVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @ExcelProperty("ç¼å·") |
| | | private Long id; |
| | | |
| | | @Schema(description = "颿¡ç¼ç ", example = "YJ20260818001") |
| | | @ExcelProperty("颿¡ç¼ç ") |
| | | private String code; |
| | | |
| | | @Schema(description = "颿¡åç§°", example = "åçµç«åçµå¤ç½®é¢æ¡") |
| | | @ExcelProperty("颿¡åç§°") |
| | | private String name; |
| | | |
| | | @Schema(description = "颿¡ç±»å", example = "1") |
| | | @ExcelProperty(value = "颿¡ç±»å", converter = DictConvert.class) |
| | | @DictFormat(cn.iocoder.yudao.module.mes.enums.DictTypeConstants.MES_PRO_EMERGENCY_PLAN_TYPE) |
| | | private Integer planType; |
| | | |
| | | @Schema(description = "å¤ç½®å
容", example = "1. ç«å³é离æ
é...") |
| | | private String content; |
| | | |
| | | @Schema(description = "责任åä½/é¨é¨", example = "è¿ç»´é¨") |
| | | @ExcelProperty("责任åä½") |
| | | private String orgUnit; |
| | | |
| | | @Schema(description = "ç¶æï¼0=è稿ï¼10=å·²åå¸ï¼", example = "0") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "夿³¨", example = "夿³¨") |
| | | @ExcelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å建æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pro.emergencyplan.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | @Schema(description = "管çåå° - MES åºæ¥å¤ç½®é¢æ¡æ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | | public class MesProEmergencyPlanSaveReqVO { |
| | | |
| | | @Schema(description = "ç¼å·ï¼ä¿®æ¹æ¶å¿
å¡«ï¼", example = "1") |
| | | private Long id; |
| | | |
| | | @Schema(description = "颿¡åç§°", requiredMode = Schema.RequiredMode.REQUIRED, example = "åçµç«åçµå¤ç½®é¢æ¡") |
| | | @NotEmpty(message = "颿¡åç§°ä¸è½ä¸ºç©º") |
| | | private String name; |
| | | |
| | | @Schema(description = "颿¡ç±»åï¼1=åçµï¼2=è®¾å¤æ
éï¼3=ç«ç¾ï¼4=èªç¶ç¾å®³ï¼5=å
¶ä»ï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @NotNull(message = "颿¡ç±»åä¸è½ä¸ºç©º") |
| | | private Integer planType; |
| | | |
| | | @Schema(description = "å¤ç½®å
容", example = "1. ç«å³é离æ
é...") |
| | | private String content; |
| | | |
| | | @Schema(description = "责任åä½/é¨é¨", example = "è¿ç»´é¨") |
| | | private String orgUnit; |
| | | |
| | | @Schema(description = "夿³¨", example = "夿³¨") |
| | | private String remark; |
| | | |
| | | } |
| | |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.feedback.vo.MesProFeedbackQuickCreateRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.feedback.vo.MesProFeedbackRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.feedback.vo.MesProFeedbackSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.feedback.vo.MesProFeedbackSummaryRespVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.unitmeasure.MesMdUnitMeasureDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.workstation.MesMdWorkstationDO; |
| | |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | import cn.iocoder.yudao.module.mes.enums.MesBizTypeConstants; |
| | | |
| | | import java.io.IOException; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | | import java.util.stream.Stream; |
| | | |
| | |
| | | return success(trace); |
| | | } |
| | | |
| | | @GetMapping("/summary") |
| | | @Operation(summary = "ä½ä¸æææ±æ»ç»è®¡", description = "ææ¶é´èå´æ±æ»å·²æ¹åæ¥å·¥æ°é/åæ ¼æ°éï¼æå·¥åç±»åãæ¥æåç»") |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-feedback:query')") |
| | | public CommonResult<MesProFeedbackSummaryRespVO> getFeedbackSummary( |
| | | @RequestParam(value = "beginDate", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate beginDate, |
| | | @RequestParam(value = "endDate", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate endDate, |
| | | @RequestParam(value = "workOrderType", required = false) Integer workOrderType) { |
| | | return success(feedbackService.getFeedbackSummary(beginDate, endDate, workOrderType)); |
| | | } |
| | | |
| | | private List<MesProFeedbackRespVO> buildFeedbackRespVOList(List<MesProFeedbackDO> list) { |
| | | if (CollUtil.isEmpty(list)) { |
| | | return Collections.emptyList(); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pro.feedback.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | |
| | | @Schema(description = "管çåå° - MES ç产æ¥å·¥ä½ä¸æææ±æ» Response VO") |
| | | @Data |
| | | public class MesProFeedbackSummaryRespVO { |
| | | |
| | | @Schema(description = "累计æ¥å·¥æ°é") |
| | | private BigDecimal totalFeedbackQuantity; |
| | | |
| | | @Schema(description = "ç´¯è®¡åæ ¼æ°é") |
| | | private BigDecimal totalQualifiedQuantity; |
| | | |
| | | @Schema(description = "累计æ¥å·¥åæ°") |
| | | private Integer totalFeedbackCount; |
| | | |
| | | @Schema(description = "æå·¥åç±»åæ±æ»") |
| | | private List<TypeSummaryItem> byType; |
| | | |
| | | @Schema(description = "ææ¥ææ±æ»") |
| | | private List<DateSummaryItem> byDate; |
| | | |
| | | @Schema(description = "æå·¥åç±»åæ±æ»é¡¹") |
| | | @Data |
| | | public static class TypeSummaryItem { |
| | | |
| | | @Schema(description = "å·¥åç±»å") |
| | | private Integer workOrderType; |
| | | |
| | | @Schema(description = "å·¥åç±»ååç§°") |
| | | private String workOrderTypeName; |
| | | |
| | | @Schema(description = "æ¥å·¥æ°é") |
| | | private BigDecimal feedbackQuantity; |
| | | |
| | | @Schema(description = "åæ ¼æ°é") |
| | | private BigDecimal qualifiedQuantity; |
| | | |
| | | @Schema(description = "æ¥å·¥åæ°") |
| | | private Integer feedbackCount; |
| | | } |
| | | |
| | | @Schema(description = "ææ¥ææ±æ»é¡¹") |
| | | @Data |
| | | public static class DateSummaryItem { |
| | | |
| | | @Schema(description = "æ¥æ") |
| | | private LocalDate date; |
| | | |
| | | @Schema(description = "æ¥å·¥æ°é") |
| | | private BigDecimal feedbackQuantity; |
| | | |
| | | @Schema(description = "åæ ¼æ°é") |
| | | private BigDecimal qualifiedQuantity; |
| | | |
| | | @Schema(description = "æ¥å·¥åæ°") |
| | | private Integer feedbackCount; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pro.maintenanceplan; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.maintenanceplan.vo.MesProMaintenancePlanPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.maintenanceplan.vo.MesProMaintenancePlanRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.maintenanceplan.vo.MesProMaintenancePlanSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.unitmeasure.MesMdUnitMeasureDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.maintenanceplan.MesProMaintenancePlanDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.maintenanceplan.MesProMaintenancePlanItemDO; |
| | | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; |
| | | import cn.iocoder.yudao.module.mes.service.md.unitmeasure.MesMdUnitMeasureService; |
| | | import cn.iocoder.yudao.module.mes.service.pro.maintenanceplan.MesProMaintenancePlanService; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| | | |
| | | @Tag(name = "管çåå° - MES çµåä½ä¸è®¡å") |
| | | @RestController |
| | | @RequestMapping("/mes/pro/maintenance-plan") |
| | | @Validated |
| | | public class MesProMaintenancePlanController { |
| | | |
| | | @Resource |
| | | private MesProMaintenancePlanService planService; |
| | | @Resource |
| | | private MesMdItemService itemService; |
| | | @Resource |
| | | private MesMdUnitMeasureService unitMeasureService; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "å建çµåä½ä¸è®¡å") |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-maintenance-plan:create')") |
| | | public CommonResult<Long> createPlan(@Valid @RequestBody MesProMaintenancePlanSaveReqVO createReqVO) { |
| | | return success(planService.createPlan(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "æ´æ°çµåä½ä¸è®¡å") |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-maintenance-plan:update')") |
| | | public CommonResult<Boolean> updatePlan(@Valid @RequestBody MesProMaintenancePlanSaveReqVO updateReqVO) { |
| | | planService.updatePlan(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤çµåä½ä¸è®¡å") |
| | | @Parameter(name = "ids", description = "ç¼å·æ°ç»", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-maintenance-plan:delete')") |
| | | public CommonResult<Boolean> deletePlan(@RequestParam("ids") List<Long> ids) { |
| | | planService.deletePlan(ids); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "è·å¾çµåä½ä¸è®¡å") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-maintenance-plan:query')") |
| | | public CommonResult<MesProMaintenancePlanRespVO> getPlan(@RequestParam("id") Long id) { |
| | | MesProMaintenancePlanDO plan = planService.getPlan(id); |
| | | if (plan == null) { |
| | | return success(null); |
| | | } |
| | | List<MesProMaintenancePlanItemDO> planItemList = planService.getPlanItemListByPlanId(id); |
| | | return success(buildPlanRespVO(plan, planItemList)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "è·å¾çµåä½ä¸è®¡åå页") |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-maintenance-plan:query')") |
| | | public CommonResult<PageResult<MesProMaintenancePlanRespVO>> getPlanPage(@Valid MesProMaintenancePlanPageReqVO pageReqVO) { |
| | | PageResult<MesProMaintenancePlanDO> pageResult = planService.getPlanPage(pageReqVO); |
| | | if (CollUtil.isEmpty(pageResult.getList())) { |
| | | return success(PageResult.empty(pageResult.getTotal())); |
| | | } |
| | | List<MesProMaintenancePlanItemDO> planItemList = planService.getPlanItemListByPlanIds( |
| | | convertSet(pageResult.getList(), MesProMaintenancePlanDO::getId)); |
| | | Map<Long, List<MesProMaintenancePlanItemDO>> planItemMap = convertMultiMap(planItemList, MesProMaintenancePlanItemDO::getPlanId); |
| | | return success(BeanUtils.toBean(pageResult, MesProMaintenancePlanRespVO.class, |
| | | plan -> buildPlanRespVOItems(plan, planItemMap.get(plan.getId())))); |
| | | } |
| | | |
| | | @GetMapping("/export-excel") |
| | | @Operation(summary = "导åºçµåä½ä¸è®¡å Excel") |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-maintenance-plan:export')") |
| | | @ApiAccessLog(operateType = EXPORT) |
| | | public void exportPlanExcel(@Valid MesProMaintenancePlanPageReqVO pageReqVO, HttpServletResponse response) throws IOException { |
| | | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| | | List<MesProMaintenancePlanRespVO> list = planService.getPlanPage(pageReqVO).getList().stream() |
| | | .map(plan -> buildPlanRespVO(plan, planService.getPlanItemListByPlanId(plan.getId()))) |
| | | .collect(java.util.stream.Collectors.toList()); |
| | | ExcelUtils.write(response, "çµåä½ä¸è®¡å.xls", "æ°æ®", MesProMaintenancePlanRespVO.class, list); |
| | | } |
| | | |
| | | @PutMapping("/issue") |
| | | @Operation(summary = "ä¸åçµåä½ä¸è®¡å") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-maintenance-plan:update')") |
| | | public CommonResult<Boolean> issuePlan(@RequestParam("id") Long id) { |
| | | planService.issuePlan(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @PutMapping("/finish") |
| | | @Operation(summary = "宿çµåä½ä¸è®¡å") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-maintenance-plan:update')") |
| | | public CommonResult<Boolean> finishPlan(@RequestParam("id") Long id) { |
| | | planService.finishPlan(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @PostMapping("/generate-purchase-plan") |
| | | @Operation(summary = "æ ¹æ®å¤ä»¶éæ±çæéè´è®¡å") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-maintenance-plan:generate-purchase-plan')") |
| | | public CommonResult<Long> generatePurchasePlan(@RequestParam("id") Long id) { |
| | | return success(planService.generatePurchasePlan(id)); |
| | | } |
| | | |
| | | @PostMapping("/generate-work-order") |
| | | @Operation(summary = "çæè¿ç»´/åçµ/æ£ä¿®å·¥å") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pro-maintenance-plan:generate-work-order')") |
| | | public CommonResult<Long> generateWorkOrder(@RequestParam("id") Long id) { |
| | | return success(planService.generateWorkOrder(id)); |
| | | } |
| | | |
| | | private MesProMaintenancePlanRespVO buildPlanRespVO(MesProMaintenancePlanDO plan, |
| | | List<MesProMaintenancePlanItemDO> planItems) { |
| | | MesProMaintenancePlanRespVO vo = BeanUtils.toBean(plan, MesProMaintenancePlanRespVO.class); |
| | | buildPlanRespVOItems(vo, planItems); |
| | | return vo; |
| | | } |
| | | |
| | | private void buildPlanRespVOItems(MesProMaintenancePlanRespVO vo, List<MesProMaintenancePlanItemDO> planItems) { |
| | | if (CollUtil.isEmpty(planItems)) { |
| | | vo.setItems(Collections.emptyList()); |
| | | return; |
| | | } |
| | | Map<Long, MesMdItemDO> itemMap = itemService.getItemMap(convertSet(planItems, MesProMaintenancePlanItemDO::getItemId)); |
| | | Map<Long, MesMdUnitMeasureDO> unitMeasureMap = unitMeasureService.getUnitMeasureMap( |
| | | convertSet(itemMap.values(), MesMdItemDO::getUnitMeasureId)); |
| | | vo.setItems(BeanUtils.toBean(planItems, MesProMaintenancePlanRespVO.Item.class, item -> { |
| | | MapUtils.findAndThen(itemMap, item.getItemId(), mesItem -> item.setItemCode(mesItem.getCode()) |
| | | .setItemName(mesItem.getName()) |
| | | .setUnitMeasureName(unitMeasureMap.get(mesItem.getUnitMeasureId()) != null |
| | | ? unitMeasureMap.get(mesItem.getUnitMeasureId()).getName() : null)); |
| | | })); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pro.maintenanceplan.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY; |
| | | |
| | | @Schema(description = "管çåå° - MES çµåä½ä¸è®¡åå页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class MesProMaintenancePlanPageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "计åç¼ç ", example = "MP20260818001") |
| | | private String code; |
| | | |
| | | @Schema(description = "计ååç§°", example = "8æåçµè¿ç»´è®¡å") |
| | | private String name; |
| | | |
| | | @Schema(description = "计åç±»åï¼1=çµç½è¿è¡ï¼2=åçµï¼3=åçµè¿ç»´ï¼4=线路æ£ä¿®ï¼", example = "3") |
| | | private Integer planType; |
| | | |
| | | @Schema(description = "ç¶æï¼0=è稿ï¼10=å·²ä¸åï¼20=已宿ï¼30=已忶ï¼", example = "0") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "è®¡åæ¥æ") |
| | | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY) |
| | | private LocalDateTime[] planDate; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pro.maintenanceplan.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Schema(description = "管çåå° - MES çµåä½ä¸è®¡å Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class MesProMaintenancePlanRespVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @ExcelProperty("ç¼å·") |
| | | private Long id; |
| | | |
| | | @Schema(description = "计åç¼ç ", example = "MP20260818001") |
| | | @ExcelProperty("计åç¼ç ") |
| | | private String code; |
| | | |
| | | @Schema(description = "计ååç§°", example = "8æåçµè¿ç»´è®¡å") |
| | | @ExcelProperty("计ååç§°") |
| | | private String name; |
| | | |
| | | @Schema(description = "计åç±»å", example = "3") |
| | | @ExcelProperty(value = "计åç±»å", converter = DictConvert.class) |
| | | @DictFormat(cn.iocoder.yudao.module.mes.enums.DictTypeConstants.MES_PRO_MAINTENANCE_PLAN_TYPE) |
| | | private Integer planType; |
| | | |
| | | @Schema(description = "ç«ç¹", example = "220kVåä¸åçµç«") |
| | | @ExcelProperty("ç«ç¹") |
| | | private String station; |
| | | |
| | | @Schema(description = "线路", example = "åä¸-å·¥ä¸çº¿è·¯") |
| | | @ExcelProperty("线路") |
| | | private String line; |
| | | |
| | | @Schema(description = "çç»ç¼å·", example = "1") |
| | | private Long teamId; |
| | | |
| | | @Schema(description = "çç»åç§°", example = "è¿ç»´ä¸ç") |
| | | @ExcelProperty("çç»") |
| | | private String teamName; |
| | | |
| | | @Schema(description = "è®¡åæ¥æ") |
| | | @ExcelProperty("è®¡åæ¥æ") |
| | | private LocalDateTime planDate; |
| | | |
| | | @Schema(description = "ç¶æï¼0=è稿ï¼10=å·²ä¸åï¼20=已宿ï¼30=已忶ï¼", example = "0") |
| | | @ExcelProperty(value = "ç¶æ", converter = DictConvert.class) |
| | | @DictFormat(cn.iocoder.yudao.module.mes.enums.DictTypeConstants.MES_PRO_MAINTENANCE_PLAN_STATUS) |
| | | private Integer status; |
| | | |
| | | @Schema(description = "çæçå·¥åç¼å·", example = "1") |
| | | private Long workOrderId; |
| | | |
| | | @Schema(description = "çæçå·¥åç¼ç ", example = "WO-001") |
| | | @ExcelProperty("çæçå·¥å") |
| | | private String workOrderCode; |
| | | |
| | | @Schema(description = "夿³¨", example = "夿³¨") |
| | | @ExcelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å建æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | @Schema(description = "å¤ä»¶/ç©èµéæ±æç»") |
| | | private List<Item> items; |
| | | |
| | | @Schema(description = "å¤ä»¶/ç©èµéæ±æç»é¡¹") |
| | | @Data |
| | | public static class Item { |
| | | |
| | | @Schema(description = "ç¼å·", example = "1") |
| | | private Long id; |
| | | |
| | | @Schema(description = "ç©æ/å¤ä»¶ç¼å·", example = "1") |
| | | private Long itemId; |
| | | |
| | | @Schema(description = "ç©æåç§°", example = "ç»ç¼å") |
| | | private String itemName; |
| | | |
| | | @Schema(description = "ç©æç¼ç ", example = "ITEM001") |
| | | private String itemCode; |
| | | |
| | | @Schema(description = "计éåä½åç§°", example = "个") |
| | | private String unitMeasureName; |
| | | |
| | | @Schema(description = "éæ±æ°é", example = "10") |
| | | private BigDecimal quantity; |
| | | |
| | | @Schema(description = "夿³¨", example = "夿³¨") |
| | | private String remark; |
| | | |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pro.maintenanceplan.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.Valid; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Schema(description = "管çåå° - MES çµåä½ä¸è®¡åæ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | | public class MesProMaintenancePlanSaveReqVO { |
| | | |
| | | @Schema(description = "ç¼å·ï¼ä¿®æ¹æ¶å¿
å¡«ï¼", example = "1") |
| | | private Long id; |
| | | |
| | | @Schema(description = "计ååç§°", requiredMode = Schema.RequiredMode.REQUIRED, example = "8æåçµè¿ç»´è®¡å") |
| | | @NotEmpty(message = "计ååç§°ä¸è½ä¸ºç©º") |
| | | private String name; |
| | | |
| | | @Schema(description = "计åç±»åï¼1=çµç½è¿è¡ï¼2=åçµï¼3=åçµè¿ç»´ï¼4=线路æ£ä¿®ï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "3") |
| | | @NotNull(message = "计åç±»åä¸è½ä¸ºç©º") |
| | | private Integer planType; |
| | | |
| | | @Schema(description = "ç«ç¹", example = "220kVåä¸åçµç«") |
| | | private String station; |
| | | |
| | | @Schema(description = "线路", example = "åä¸-å·¥ä¸çº¿è·¯") |
| | | private String line; |
| | | |
| | | @Schema(description = "çç»ç¼å·", example = "1") |
| | | private Long teamId; |
| | | |
| | | @Schema(description = "çç»åç§°", example = "è¿ç»´ä¸ç") |
| | | private String teamName; |
| | | |
| | | @Schema(description = "è®¡åæ¥æ", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "è®¡åæ¥æä¸è½ä¸ºç©º") |
| | | private LocalDateTime planDate; |
| | | |
| | | @Schema(description = "夿³¨", example = "夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å¤ä»¶/ç©èµéæ±æç»", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotEmpty(message = "å¤ä»¶/ç©èµéæ±æç»ä¸è½ä¸ºç©º") |
| | | @Valid |
| | | private List<Item> items; |
| | | |
| | | @Schema(description = "å¤ä»¶/ç©èµéæ±æç»é¡¹") |
| | | @Data |
| | | public static class Item { |
| | | |
| | | @Schema(description = "ç¼å·ï¼ä¿®æ¹æ¶å¿
å¡«ï¼", example = "1") |
| | | private Long id; |
| | | |
| | | @Schema(description = "ç©æ/å¤ä»¶ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @NotNull(message = "ç©æ/å¤ä»¶ä¸è½ä¸ºç©º") |
| | | private Long itemId; |
| | | |
| | | @Schema(description = "éæ±æ°é", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") |
| | | @NotNull(message = "éæ±æ°éä¸è½ä¸ºç©º") |
| | | private BigDecimal quantity; |
| | | |
| | | @Schema(description = "夿³¨", example = "夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "ç©æåç§°ï¼å端å±ç¤ºç¨ï¼å端忽ç¥ï¼", example = "ç»ç¼å") |
| | | private String itemName; |
| | | |
| | | @Schema(description = "ç©æç¼ç ï¼å端å±ç¤ºç¨ï¼å端忽ç¥ï¼", example = "ITEM001") |
| | | private String itemCode; |
| | | |
| | | @Schema(description = "计éåä½åç§°ï¼å端å±ç¤ºç¨ï¼å端忽ç¥ï¼", example = "个") |
| | | private String unitMeasureName; |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | @Schema(description = "å·¥åºåç§°", requiredMode = Schema.RequiredMode.REQUIRED, example = "䏿工åº") |
| | | private String name; |
| | | |
| | | @ExcelProperty(value = "çµåå·¥èºåç±»", converter = DictConvert.class) |
| | | @DictFormat(cn.iocoder.yudao.module.mes.enums.DictTypeConstants.MES_PRO_PROCESS_TYPE) |
| | | @Schema(description = "çµåå·¥èºåç±»", example = "2") |
| | | private Integer type; |
| | | |
| | | @ExcelProperty("å·¥èºè¦æ±") |
| | | @Schema(description = "å·¥èºè¦æ±", example = "æç
§å¾çº¸å°ºå¯¸è¿è¡åå²") |
| | | private String attention; |
| | |
| | | @NotBlank(message = "å·¥åºåç§°ä¸è½ä¸ºç©º") |
| | | private String name; |
| | | |
| | | @Schema(description = "çµåå·¥èºåç±»ï¼åå
¸ mes_pro_process_typeï¼", example = "2") |
| | | private Integer type; |
| | | |
| | | @Schema(description = "å·¥èºè¦æ±", example = "æç
§å¾çº¸å°ºå¯¸è¿è¡åå²") |
| | | private String attention; |
| | | |
| | |
| | | @Schema(description = "å·¥åºåç§°", example = "注å¡") |
| | | private String processName; |
| | | |
| | | @Schema(description = "çç»ç¼å·", example = "1") |
| | | private Long teamId; |
| | | |
| | | @Schema(description = "çç»åç§°", example = "è¿ç»´ä¸ç") |
| | | private String teamName; |
| | | |
| | | @Schema(description = "产åç©æç¼å·", example = "100") |
| | | private Long itemId; |
| | | |
| | |
| | | @Schema(description = "å·¥åºç¼å·", example = "1") |
| | | private Long processId; // ç¼è¾æ¶ï¼å¯ä¸ä¼ é |
| | | |
| | | @Schema(description = "çç»ç¼å·", example = "1") |
| | | private Long teamId; |
| | | |
| | | @Schema(description = "çç»åç§°", example = "è¿ç»´ä¸ç") |
| | | private String teamName; |
| | | |
| | | @Schema(description = "产åç©æç¼å·", example = "100") |
| | | private Long itemId; // ç¼è¾æ¶ï¼å¯ä¸ä¼ é |
| | | |
| | |
| | | @ExcelProperty("客æ·åç§°") |
| | | private String clientName; |
| | | |
| | | @Schema(description = "å
³èè¥é订åï¼ERPéå®è®¢åï¼ç¼å·", example = "500") |
| | | private Long saleOrderId; |
| | | |
| | | @Schema(description = "å
³èè¥é订åï¼ERPéå®è®¢åï¼åå·", example = "SO-001") |
| | | @ExcelProperty("è¥é订åå·") |
| | | private String saleOrderNo; |
| | | |
| | | @Schema(description = "ä¾åºåç¼å·", example = "400") |
| | | private Long vendorId; |
| | | |
| | |
| | | @Schema(description = "æ¥æºåæ®ç¼å·", example = "SO-001") |
| | | private String orderSourceCode; |
| | | |
| | | @Schema(description = "产åç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") |
| | | @NotNull(message = "产åä¸è½ä¸ºç©º") |
| | | @Schema(description = "产åç¼å·ï¼è¿ç»´/åçµ/æ£ä¿®ç±»å·¥åå¯ä¸å¡«ï¼", example = "100") |
| | | private Long productId; |
| | | |
| | | @Schema(description = "ç产æ°é", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") |
| | |
| | | @Schema(description = "客æ·ç¼å·", example = "300") |
| | | private Long clientId; |
| | | |
| | | @Schema(description = "å
³èè¥é订åï¼ERPéå®è®¢åï¼ç¼å·", example = "500") |
| | | private Long saleOrderId; |
| | | |
| | | @Schema(description = "å
³èè¥é订åï¼ERPéå®è®¢åï¼åå·", example = "SO-001") |
| | | private String saleOrderNo; |
| | | |
| | | @Schema(description = "ä¾åºåç¼å·", example = "400") |
| | | private Long vendorId; |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.qc.outsourcetest; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.outsourcetest.vo.MesQcOutsourceTestPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.outsourcetest.vo.MesQcOutsourceTestRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.outsourcetest.vo.MesQcOutsourceTestSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.qc.outsourcetest.MesQcOutsourceTestDO; |
| | | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; |
| | | import cn.iocoder.yudao.module.mes.service.qc.outsourcetest.MesQcOutsourceTestService; |
| | | import cn.iocoder.yudao.module.system.api.storage.StorageAttachmentApi; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| | | |
| | | @Tag(name = "管çåå° - MES å§å¤æ£æµ/è¯éªå") |
| | | @RestController |
| | | @RequestMapping("/mes/qc/outsource-test") |
| | | @Validated |
| | | public class MesQcOutsourceTestController { |
| | | |
| | | @Resource |
| | | private MesQcOutsourceTestService testService; |
| | | @Resource |
| | | private MesMdItemService itemService; |
| | | @Resource |
| | | private StorageAttachmentApi storageAttachmentApi; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "å建å§å¤æ£æµ/è¯éªå") |
| | | @PreAuthorize("@ss.hasPermission('mes:qc-outsource-test:create')") |
| | | public CommonResult<Long> createTest(@Valid @RequestBody MesQcOutsourceTestSaveReqVO createReqVO) { |
| | | return success(testService.createTest(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "æ´æ°å§å¤æ£æµ/è¯éªå") |
| | | @PreAuthorize("@ss.hasPermission('mes:qc-outsource-test:update')") |
| | | public CommonResult<Boolean> updateTest(@Valid @RequestBody MesQcOutsourceTestSaveReqVO updateReqVO) { |
| | | testService.updateTest(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤å§å¤æ£æµ/è¯éªå") |
| | | @Parameter(name = "ids", description = "ç¼å·æ°ç»", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:qc-outsource-test:delete')") |
| | | public CommonResult<Boolean> deleteTest(@RequestParam("ids") List<Long> ids) { |
| | | testService.deleteTest(ids); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "è·å¾å§å¤æ£æµ/è¯éªå") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('mes:qc-outsource-test:query')") |
| | | public CommonResult<MesQcOutsourceTestRespVO> getTest(@RequestParam("id") Long id) { |
| | | MesQcOutsourceTestDO test = testService.getTest(id); |
| | | if (test == null) { |
| | | return success(null); |
| | | } |
| | | return success(buildRespVO(test)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "è·å¾å§å¤æ£æµ/è¯éªåå页") |
| | | @PreAuthorize("@ss.hasPermission('mes:qc-outsource-test:query')") |
| | | public CommonResult<PageResult<MesQcOutsourceTestRespVO>> getTestPage(@Valid MesQcOutsourceTestPageReqVO pageReqVO) { |
| | | PageResult<MesQcOutsourceTestDO> pageResult = testService.getTestPage(pageReqVO); |
| | | if (CollUtil.isEmpty(pageResult.getList())) { |
| | | return success(PageResult.empty(pageResult.getTotal())); |
| | | } |
| | | return success(new PageResult<>(BeanUtils.toBean(pageResult.getList(), MesQcOutsourceTestRespVO.class, |
| | | vo -> fillItemName(vo, vo.getItemId())), pageResult.getTotal())); |
| | | } |
| | | |
| | | @PutMapping("/submit") |
| | | @Operation(summary = "æäº¤å§å¤æ£æµ/è¯éªå") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:qc-outsource-test:update')") |
| | | public CommonResult<Boolean> submitTest(@RequestParam("id") Long id) { |
| | | testService.submitTest(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @PutMapping("/finish") |
| | | @Operation(summary = "宿å§å¤æ£æµ/è¯éªå") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:qc-outsource-test:update')") |
| | | public CommonResult<Boolean> finishTest(@RequestParam("id") Long id) { |
| | | testService.finishTest(id); |
| | | return success(true); |
| | | } |
| | | |
| | | private MesQcOutsourceTestRespVO buildRespVO(MesQcOutsourceTestDO test) { |
| | | MesQcOutsourceTestRespVO vo = BeanUtils.toBean(test, MesQcOutsourceTestRespVO.class); |
| | | fillItemName(vo, test.getItemId()); |
| | | // éä»¶ |
| | | vo.setAttachmentList(BeanUtils.toBean(storageAttachmentApi.listAttachments( |
| | | "mes_qc_outsource_test", test.getId()), MesQcOutsourceTestRespVO.Attachment.class)); |
| | | return vo; |
| | | } |
| | | |
| | | private void fillItemName(MesQcOutsourceTestRespVO vo, Long itemId) { |
| | | if (itemId == null) { |
| | | return; |
| | | } |
| | | Map<Long, MesMdItemDO> itemMap = itemService.getItemMap(Collections.singleton(itemId)); |
| | | MapUtils.findAndThen(itemMap, itemId, item -> vo.setItemName(item.getName())); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.qc.outsourcetest.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY; |
| | | |
| | | @Schema(description = "管çåå° - MES å§å¤æ£æµ/è¯éªåå页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class MesQcOutsourceTestPageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "åæ®ç¼ç ", example = "WT20260818001") |
| | | private String code; |
| | | |
| | | @Schema(description = "åæ®åç§°", example = "ååå¨ç¬¬ä¸æ¹æ£æµ") |
| | | private String name; |
| | | |
| | | @Schema(description = "æ£æµç±»åï¼1=ç¬¬ä¸æ¹æ£æµï¼2=å§å¤è¯éªï¼", example = "1") |
| | | private Integer testType; |
| | | |
| | | @Schema(description = "æ£æµç»æï¼1=åæ ¼ï¼2=ä¸åæ ¼ï¼", example = "1") |
| | | private Integer result; |
| | | |
| | | @Schema(description = "ç¶æï¼0=è稿ï¼10=å·²æäº¤ï¼20=已宿ï¼", example = "0") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "æ£æµæ¥æ") |
| | | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY) |
| | | private LocalDateTime[] testDate; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.qc.outsourcetest.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Schema(description = "管çåå° - MES å§å¤æ£æµ/è¯éªå Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class MesQcOutsourceTestRespVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @ExcelProperty("ç¼å·") |
| | | private Long id; |
| | | |
| | | @Schema(description = "åæ®ç¼ç ", example = "WT20260818001") |
| | | @ExcelProperty("åæ®ç¼ç ") |
| | | private String code; |
| | | |
| | | @Schema(description = "åæ®åç§°", example = "ååå¨ç¬¬ä¸æ¹æ£æµ") |
| | | @ExcelProperty("åæ®åç§°") |
| | | private String name; |
| | | |
| | | @Schema(description = "æ£æµç±»å", example = "1") |
| | | @ExcelProperty(value = "æ£æµç±»å", converter = DictConvert.class) |
| | | @DictFormat(cn.iocoder.yudao.module.mes.enums.DictTypeConstants.MES_QC_OUTSOURCE_TEST_TYPE) |
| | | private Integer testType; |
| | | |
| | | @Schema(description = "æ£æµå¯¹è±¡ï¼ç©æ/设å¤ç¼å·ï¼", example = "1") |
| | | private Long itemId; |
| | | |
| | | @Schema(description = "æ£æµå¯¹è±¡åç§°", example = "ååå¨A") |
| | | @ExcelProperty("æ£æµå¯¹è±¡") |
| | | private String itemName; |
| | | |
| | | @Schema(description = "æ£æµæºæ", example = "å½å®¶ååå¨è´¨æ£ä¸å¿") |
| | | @ExcelProperty("æ£æµæºæ") |
| | | private String testOrg; |
| | | |
| | | @Schema(description = "æ£æµæ¥æ") |
| | | @ExcelProperty("æ£æµæ¥æ") |
| | | private LocalDateTime testDate; |
| | | |
| | | @Schema(description = "æ£æµç»æ", example = "1") |
| | | @ExcelProperty(value = "æ£æµç»æ", converter = DictConvert.class) |
| | | @DictFormat(cn.iocoder.yudao.module.mes.enums.DictTypeConstants.MES_QC_OUTSOURCE_TEST_RESULT) |
| | | private Integer result; |
| | | |
| | | @Schema(description = "æ£æµæ¥åç¼å·", example = "BG-2026-0001") |
| | | @ExcelProperty("æ¥åç¼å·") |
| | | private String reportNo; |
| | | |
| | | @Schema(description = "ç¶æï¼0=è稿ï¼10=å·²æäº¤ï¼20=已宿ï¼", example = "0") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "夿³¨", example = "夿³¨") |
| | | @ExcelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å建æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | @Schema(description = "éä»¶åè¡¨ï¼æ£æµæ¥å/èµè´¨æä»¶ï¼") |
| | | private List<Attachment> attachmentList; |
| | | |
| | | @Schema(description = "é件项") |
| | | @Data |
| | | public static class Attachment { |
| | | private Long id; |
| | | private String name; |
| | | private String url; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.qc.outsourcetest.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import jakarta.validation.constraints.NotEmpty; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Schema(description = "管çåå° - MES å§å¤æ£æµ/è¯éªåæ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | | public class MesQcOutsourceTestSaveReqVO { |
| | | |
| | | @Schema(description = "ç¼å·ï¼ä¿®æ¹æ¶å¿
å¡«ï¼", example = "1") |
| | | private Long id; |
| | | |
| | | @Schema(description = "åæ®åç§°", requiredMode = Schema.RequiredMode.REQUIRED, example = "ååå¨ç¬¬ä¸æ¹æ£æµ") |
| | | @NotEmpty(message = "åæ®åç§°ä¸è½ä¸ºç©º") |
| | | private String name; |
| | | |
| | | @Schema(description = "æ£æµç±»åï¼1=ç¬¬ä¸æ¹æ£æµï¼2=å§å¤è¯éªï¼", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @NotNull(message = "æ£æµç±»åä¸è½ä¸ºç©º") |
| | | private Integer testType; |
| | | |
| | | @Schema(description = "æ£æµå¯¹è±¡ï¼ç©æ/设å¤ç¼å·ï¼", example = "1") |
| | | private Long itemId; |
| | | |
| | | @Schema(description = "æ£æµæºæ", example = "å½å®¶ååå¨è´¨æ£ä¸å¿") |
| | | private String testOrg; |
| | | |
| | | @Schema(description = "æ£æµæ¥æ", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "æ£æµæ¥æä¸è½ä¸ºç©º") |
| | | private LocalDateTime testDate; |
| | | |
| | | @Schema(description = "æ£æµç»æï¼1=åæ ¼ï¼2=ä¸åæ ¼ï¼", example = "1") |
| | | private Integer result; |
| | | |
| | | @Schema(description = "æ£æµæ¥åç¼å·", example = "BG-2026-0001") |
| | | private String reportNo; |
| | | |
| | | @Schema(description = "夿³¨", example = "夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "éä»¶ï¼æ£æµæ¥å/èµè´¨æä»¶ï¼blobId å表", example = "[1, 2, 3]") |
| | | private List<Long> blobIds; |
| | | |
| | | } |
| | |
| | | @Schema(description = "éæ±æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | private LocalDateTime requiredTime; |
| | | |
| | | @Schema(description = "åæ®ç±»åï¼1=æ£å¸¸é¢æï¼2=ç´§æ¥è¡¥æï¼", example = "1") |
| | | private Integer issueType; |
| | | |
| | | @Schema(description = "ç¶æ", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") |
| | | private Integer status; |
| | | |
| | |
| | | @Schema(description = "å·¥ä½ç« ID", example = "1") |
| | | private Long workstationId; |
| | | |
| | | @Schema(description = "åæ®ç±»åï¼1=æ£å¸¸é¢æï¼2=ç´§æ¥è¡¥æï¼", example = "1") |
| | | private Integer issueType; |
| | | |
| | | @Schema(description = "éæ±æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @NotNull(message = "éæ±æ¶é´ä¸è½ä¸ºç©º") |
| | | private LocalDateTime requiredTime; |
| | |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.stocktaking.task.vo.line.MesWmStockTakingTaskLineImportExcelVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.stocktaking.task.vo.line.MesWmStockTakingTaskLineImportRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.stocktaking.task.vo.line.MesWmStockTakingTaskLinePageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.stocktaking.task.vo.line.MesWmStockTakingTaskLineRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.stocktaking.task.vo.line.MesWmStockTakingTaskLineSaveReqVO; |
| | |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | return success(buildStockTakingTaskLineRespVOList(list)); |
| | | } |
| | | |
| | | @PostMapping("/import-excel") |
| | | @Operation(summary = "导å
¥çç¹å®çæ°é", description = "æ ç©æç¼ç + æ¹æ¬¡å· å¹é
çç¹è¡ï¼åå
¥å®çæ°é") |
| | | @Parameter(name = "file", description = "Excel æä»¶", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:wm-stock-taking-task:update')") |
| | | public CommonResult<MesWmStockTakingTaskLineImportRespVO> importStockTakingQuantity( |
| | | @RequestParam("taskId") Long taskId, |
| | | @RequestParam("file") MultipartFile file) throws IOException { |
| | | List<MesWmStockTakingTaskLineImportExcelVO> list = |
| | | ExcelUtils.read(file, MesWmStockTakingTaskLineImportExcelVO.class); |
| | | return success(stockTakingTaskLineService.importTakingQuantity(taskId, list)); |
| | | } |
| | | |
| | | @GetMapping("/get-import-template") |
| | | @Operation(summary = "ä¸è½½çç¹å¯¼å
¥æ¨¡æ¿") |
| | | @PreAuthorize("@ss.hasPermission('mes:wm-stock-taking-task:query')") |
| | | public void getImportTemplate(HttpServletResponse response) throws IOException { |
| | | ExcelUtils.write(response, "çç¹å®çæ°å¯¼å
¥æ¨¡æ¿.xls", "å®çæ°", |
| | | MesWmStockTakingTaskLineImportExcelVO.class, Collections.emptyList()); |
| | | } |
| | | |
| | | // ==================== æ¼æ¥ VO ==================== |
| | | |
| | | private List<MesWmStockTakingTaskLineRespVO> buildStockTakingTaskLineRespVOList(List<MesWmStockTakingTaskLineDO> list) { |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.wm.stocktaking.task.vo.line; |
| | | |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Builder; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * MES çç¹ä»»å¡è¡ Excel 导å
¥ VO |
| | | * |
| | | * <p>导å
¥å®çæ°éï¼æ ç©æç¼ç + æ¹æ¬¡å· å¹é
çç¹ä»»å¡è¡ |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @Data |
| | | @Builder |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class MesWmStockTakingTaskLineImportExcelVO { |
| | | |
| | | @ExcelProperty("ç©æç¼ç ") |
| | | private String itemCode; |
| | | |
| | | @ExcelProperty("æ¹æ¬¡å·") |
| | | private String batchCode; |
| | | |
| | | @ExcelProperty("å®çæ°é") |
| | | private BigDecimal takingQuantity; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.wm.stocktaking.task.vo.line; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * MES çç¹ä»»å¡è¡ Excel 导å
¥ç»æ VO |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @Schema(description = "管çåå° - MES çç¹ä»»å¡è¡å¯¼å
¥ç»æ Response VO") |
| | | @Data |
| | | public class MesWmStockTakingTaskLineImportRespVO { |
| | | |
| | | @Schema(description = "导å
¥æåæ¡æ°") |
| | | private Integer successCount; |
| | | |
| | | @Schema(description = "导å
¥å¤±è´¥æ¡æ°") |
| | | private Integer failureCount; |
| | | |
| | | @Schema(description = "失败åå ï¼ä¸å¯¼å
¥è¡é¡ºåºå¯¹åºï¼") |
| | | private List<String> failureMessages; |
| | | |
| | | } |
| | |
| | | |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | |
| | | @ExcelProperty("ä»åºåç§°") |
| | | private String name; |
| | | |
| | | @Schema(description = "ä»åºç±»å", example = "1") |
| | | @ExcelProperty(value = "ä»åºç±»å", converter = DictConvert.class) |
| | | @DictFormat(cn.iocoder.yudao.module.mes.enums.DictTypeConstants.MES_WM_WAREHOUSE_TYPE) |
| | | private Integer type; |
| | | |
| | | @Schema(description = "ä»åºå°å", example = "A åºä¸å·æ¥¼") |
| | | @ExcelProperty("ä»åºå°å") |
| | | private String address; |
| | |
| | | @NotEmpty(message = "ä»åºåç§°ä¸è½ä¸ºç©º") |
| | | private String name; |
| | | |
| | | @Schema(description = "ä»åºç±»åï¼åå
¸ mes_wm_warehouse_typeï¼", example = "1") |
| | | private Integer type; |
| | | |
| | | @Schema(description = "ä»åºå°å", example = "A åºä¸å·æ¥¼") |
| | | private String address; |
| | | |
| | |
| | | |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | |
| | | @ExcelProperty("åºä½åç§°") |
| | | private String name; |
| | | |
| | | @Schema(description = "åºåºç±»å", example = "1") |
| | | @ExcelProperty(value = "åºåºç±»å", converter = DictConvert.class) |
| | | @DictFormat(cn.iocoder.yudao.module.mes.enums.DictTypeConstants.MES_WM_WAREHOUSE_TYPE) |
| | | private Integer type; |
| | | |
| | | @Schema(description = "åºåºç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | private Long locationId; |
| | | |
| | |
| | | @NotEmpty(message = "åºä½åç§°ä¸è½ä¸ºç©º") |
| | | private String name; |
| | | |
| | | @Schema(description = "åºåºç±»åï¼åå
¸ mes_wm_warehouse_typeï¼", example = "1") |
| | | private Integer type; |
| | | |
| | | @Schema(description = "åºåºç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @NotNull(message = "åºåºä¸è½ä¸ºç©º") |
| | | private Long locationId; |
| | |
| | | */ |
| | | private String code; |
| | | /** |
| | | * æ°é设å¤IDï¼å¤é¨æ°é tbDeviceIdï¼ç¨äºå
³èæ°é饿µæ°æ®ï¼ |
| | | */ |
| | | private String tbDeviceId; |
| | | /** |
| | | * 设å¤åç§° |
| | | */ |
| | | private String name; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.dv.telemetry; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * MES è®¾å¤æ°é饿µæ°æ® DO |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @TableName("mes_dv_telemetry") |
| | | @KeySequence("mes_dv_telemetry_seq") // ç¨äº OracleãPostgreSQLãKingbaseãDB2ãH2 æ°æ®åºç主é®èªå¢ãå¦ææ¯ MySQL çæ°æ®åºï¼å¯ä¸åã |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class MesDvTelemetryDO extends BaseDO { |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | /** |
| | | * æ°é设å¤IDï¼å¤é¨ tbDeviceIdï¼ |
| | | */ |
| | | private String tbDeviceId; |
| | | /** |
| | | * 设å¤åç§° |
| | | */ |
| | | private String deviceName; |
| | | /** |
| | | * ä¿¡å·åç§° |
| | | */ |
| | | private String paramName; |
| | | /** |
| | | * 设å¤KEYåç§° |
| | | */ |
| | | private String paramKeyName; |
| | | /** |
| | | * æ åå¼ |
| | | */ |
| | | private String standardValue; |
| | | /** |
| | | * ä¿¡å·å¼ï¼å®æ¶ï¼ |
| | | */ |
| | | private String timelyValue; |
| | | /** |
| | | * åå¼ |
| | | */ |
| | | private String avgValue; |
| | | /** |
| | | * æå¤§å¼ |
| | | */ |
| | | private String maxValue; |
| | | /** |
| | | * æå°å¼ |
| | | */ |
| | | private String minValue; |
| | | /** |
| | | * æ¯å¦å¼å¸¸ |
| | | */ |
| | | private Boolean whetherAnomaly; |
| | | /** |
| | | * 饿µæ°æ®æ¶é´ |
| | | */ |
| | | private LocalDateTime telemetryDataTime; |
| | | /** |
| | | * åæ®å· |
| | | */ |
| | | private String billNo; |
| | | /** |
| | | * çæ¬¡ |
| | | * |
| | | * åå
¸ {@link cn.iocoder.yudao.module.mes.enums.DictTypeConstants#MES_CAL_SHIFT_TYPE} |
| | | */ |
| | | private String shiftName; |
| | | /** |
| | | * æåæ¶é´ï¼æ¬æ¬¡å
¥åºæ¶é´ï¼ |
| | | */ |
| | | private LocalDateTime pullTime; |
| | | |
| | | } |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.md.item; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.unitmeasure.MesMdUnitMeasureDO; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | |
| | | */ |
| | | private BigDecimal maxStock; |
| | | /** |
| | | * çµåç©èµåç±» |
| | | * |
| | | * åå
¸ {@link DictTypeConstants#MES_MATERIAL_CATEGORY} |
| | | */ |
| | | private Integer materialCategory; |
| | | /** |
| | | * æ¯å¦é«å¼ç©æ |
| | | */ |
| | | private Boolean highValue; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * MES 产å设计-伿 çç¥ DO |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @TableName("mes_pd_discount_policy") |
| | | @KeySequence("mes_pd_discount_policy_seq") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class MesPdDiscountPolicyDO extends BaseDO { |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | /** |
| | | * çç¥åç§° |
| | | */ |
| | | private String name; |
| | | /** |
| | | * çç¥ç±»åï¼1ææ£/2ç«åï¼ |
| | | * |
| | | * åå
¸ {@link DictTypeConstants#MES_PD_DISCOUNT_POLICY_TYPE} |
| | | */ |
| | | private Integer policyType; |
| | | /** |
| | | * çç¥å¼ï¼ææ£ï¼0-1 æ¯ä¾ï¼ç«åï¼éé¢ï¼ |
| | | */ |
| | | private BigDecimal policyValue; |
| | | /** |
| | | * éç¨å¯¹è±¡ç±»åï¼1æå¡å¥é¤/2çµåç级/3ç¨çµç±»åï¼å¯ç©º=å
¨å±ï¼ |
| | | */ |
| | | private Integer targetType; |
| | | /** |
| | | * éç¨å¯¹è±¡ID |
| | | */ |
| | | private Long targetId; |
| | | /** |
| | | * çææ¥æ |
| | | */ |
| | | private LocalDateTime startDate; |
| | | /** |
| | | * å¤±ææ¥æ |
| | | */ |
| | | private LocalDateTime endDate; |
| | | /** |
| | | * å¯ç¨ç¶æï¼1å¯ç¨/0ç¦ç¨ï¼ |
| | | */ |
| | | private Integer status; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | /** |
| | | * MES 产å设计-ç¨çµç±»ååºç¡ä¿¡æ¯ DO |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @TableName("mes_pd_electricity_type") |
| | | @KeySequence("mes_pd_electricity_type_seq") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class MesPdElectricityTypeDO extends BaseDO { |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | /** |
| | | * ç±»åç¼ç |
| | | */ |
| | | private String code; |
| | | /** |
| | | * ç±»ååç§° |
| | | */ |
| | | private String name; |
| | | /** |
| | | * ç±»å说æ |
| | | */ |
| | | private String description; |
| | | /** |
| | | * æåº |
| | | */ |
| | | private Integer sort; |
| | | /** |
| | | * å¯ç¨ç¶æï¼1å¯ç¨/0ç¦ç¨ï¼ |
| | | */ |
| | | private Integer status; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * MES 产å设计-å®ä»·æ å DO |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @TableName("mes_pd_price_standard") |
| | | @KeySequence("mes_pd_price_standard_seq") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class MesPdPriceStandardDO extends BaseDO { |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | /** |
| | | * å®ä»·å¯¹è±¡ç±»åï¼1æå¡å¥é¤/2çµåç级/3ç¨çµç±»åï¼ |
| | | * |
| | | * åå
¸ {@link DictTypeConstants#MES_PD_PRICE_OBJECT_TYPE} |
| | | */ |
| | | private Integer objectType; |
| | | /** |
| | | * å®ä»·å¯¹è±¡ID |
| | | */ |
| | | private Long objectId; |
| | | /** |
| | | * å®ä»·å¯¹è±¡åç§°ï¼åä½ï¼ä¾¿äºå±ç¤ºï¼ |
| | | */ |
| | | private String objectName; |
| | | /** |
| | | * ä»·æ ¼ |
| | | */ |
| | | private BigDecimal price; |
| | | /** |
| | | * 计价åä½ |
| | | */ |
| | | private String unit; |
| | | /** |
| | | * çææ¥æ |
| | | */ |
| | | private LocalDateTime effectiveDate; |
| | | /** |
| | | * å¯ç¨ç¶æï¼1å¯ç¨/0ç¦ç¨ï¼ |
| | | */ |
| | | private Integer status; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * MES 产å设计-æå¡å¥é¤åºç¡ä¿¡æ¯ DO |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @TableName("mes_pd_service_package") |
| | | @KeySequence("mes_pd_service_package_seq") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class MesPdServicePackageDO extends BaseDO { |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | /** |
| | | * å¥é¤ç¼ç ï¼ç¼ç è§å PD_PACKAGE_CODE èªå¨çæï¼ |
| | | */ |
| | | private String code; |
| | | /** |
| | | * å¥é¤åç§° |
| | | */ |
| | | private String name; |
| | | /** |
| | | * å¥é¤è¯´æ |
| | | */ |
| | | private String description; |
| | | /** |
| | | * å¥é¤ä»·æ ¼ |
| | | */ |
| | | private BigDecimal price; |
| | | /** |
| | | * çææ¥æ |
| | | */ |
| | | private LocalDateTime effectiveDate; |
| | | /** |
| | | * å¤±ææ¥æ |
| | | */ |
| | | private LocalDateTime expireDate; |
| | | /** |
| | | * å¯ç¨ç¶æï¼1å¯ç¨/0ç¦ç¨ï¼ |
| | | */ |
| | | private Integer status; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * MES 产å设计-é¶æ¢¯çµä»· DO |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @TableName("mes_pd_tiered_price") |
| | | @KeySequence("mes_pd_tiered_price_seq") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class MesPdTieredPriceDO extends BaseDO { |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | /** |
| | | * æå¡å¥é¤IDï¼ä¸çµåç级äºéä¸ï¼ |
| | | */ |
| | | private Long packageId; |
| | | /** |
| | | * çµåç级IDï¼ä¸æå¡å¥é¤äºéä¸ï¼ |
| | | */ |
| | | private Long voltageLevelId; |
| | | /** |
| | | * æ¡£ä½ä¸éï¼å«ï¼kWhï¼ |
| | | */ |
| | | private BigDecimal startValue; |
| | | /** |
| | | * æ¡£ä½ä¸éï¼ä¸å«ï¼kWhï¼å¯ç©º=ä¸ä¸å°é¡¶ï¼ |
| | | */ |
| | | private BigDecimal endValue; |
| | | /** |
| | | * æ¡£ä½åä»· |
| | | */ |
| | | private BigDecimal pricePerUnit; |
| | | /** |
| | | * å¯ç¨ç¶æï¼1å¯ç¨/0ç¦ç¨ï¼ |
| | | * |
| | | * åå
¸ {@link DictTypeConstants#MES_PD_TIERED_PRICE_STATUS} |
| | | */ |
| | | private Integer status; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * MES 产å设计-çµåç级åºç¡ä¿¡æ¯ DO |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @TableName("mes_pd_voltage_level") |
| | | @KeySequence("mes_pd_voltage_level_seq") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class MesPdVoltageLevelDO extends BaseDO { |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | /** |
| | | * ç级ç¼ç |
| | | */ |
| | | private String code; |
| | | /** |
| | | * ç级åç§° |
| | | */ |
| | | private String name; |
| | | /** |
| | | * çµåæ°å¼ï¼kVï¼ |
| | | */ |
| | | private BigDecimal voltageValue; |
| | | /** |
| | | * æåº |
| | | */ |
| | | private Integer sort; |
| | | /** |
| | | * å¯ç¨ç¶æï¼1å¯ç¨/0ç¦ç¨ï¼ |
| | | */ |
| | | private Integer status; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.pd.ctc; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * MES æ¢ä½å¯¼çº¿äº§åææ¯åæ° DO |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @TableName("product_ctc") |
| | | @KeySequence("product_ctc_seq") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class ProductCtcDO extends BaseDO { |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | /** |
| | | * ç©æIDï¼å
³è mdm_item.idï¼ |
| | | */ |
| | | private Long itemId; |
| | | /** |
| | | * è®¢è´§è§æ ¼ |
| | | */ |
| | | private String orderSpec; |
| | | /** |
| | | * è£¸å¯¼çº¿è§æ ¼ |
| | | */ |
| | | private String bareConductorSpec; |
| | | /** |
| | | * æ¼å
çº¿è§æ ¼ |
| | | */ |
| | | private String enameledSpec; |
| | | /** |
| | | * æ¢ä½è§æ ¼ |
| | | */ |
| | | private String transpositionSpec; |
| | | /** |
| | | * 导ä½ç±»åï¼é/éï¼ |
| | | * |
| | | * åå
¸ {@link DictTypeConstants#PRODUCT_CONDUCTOR_TYPE} |
| | | */ |
| | | private String conductorType; |
| | | /** |
| | | * æªé¢ç§¯ï¼mmÂ²ï¼ |
| | | */ |
| | | private BigDecimal crossSection; |
| | | /** |
| | | * å¤å¾ï¼mmï¼ |
| | | */ |
| | | private BigDecimal outerDiameter; |
| | | /** |
| | | * 20âç´æµçµé»ï¼Î©/kmï¼ |
| | | */ |
| | | private BigDecimal resistance20c; |
| | | /** |
| | | * ç»å
è§åº¦ï¼Â°ï¼ |
| | | */ |
| | | private BigDecimal wrappingAngle; |
| | | /** |
| | | * ç»ç¼å度ï¼mmï¼ |
| | | */ |
| | | private BigDecimal insulationThickness; |
| | | /** |
| | | * é¢å®çµåï¼kVï¼ |
| | | */ |
| | | private String ratedVoltage; |
| | | /** |
| | | * è¯éªçµåï¼kVï¼ |
| | | */ |
| | | private String testVoltage; |
| | | /** |
| | | * æå°å¼¯æ²åå¾ï¼mmï¼ |
| | | */ |
| | | private BigDecimal minBendingRadius; |
| | | /** |
| | | * æ¯å
¬éééï¼kg/kmï¼ |
| | | */ |
| | | private BigDecimal weightPerKm; |
| | | /** |
| | | * æ§è¡æ åä»£å· |
| | | */ |
| | | private String standardCode; |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.pd.product; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import cn.iocoder.yudao.module.mes.enums.pd.MesPdAuditStatusEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.pd.MesPdProductArchiveTypeEnum; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * MES 产å设计-äº§åæ¡£æ¡ DO |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @TableName("mes_pd_product") |
| | | @KeySequence("mes_pd_product_seq") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class MesPdProductDO extends BaseDO { |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | /** |
| | | * æ¡£æ¡ç±»åï¼1çµåæå¡/2ä¾çµäº§å/3å¢å¼è½æºäº§åï¼ |
| | | * |
| | | * åå
¸ {@link DictTypeConstants#MES_PD_PRODUCT_ARCHIVE_TYPE} |
| | | */ |
| | | private Integer archiveType; |
| | | /** |
| | | * æ¡£æ¡ç¼ç ï¼ç¼ç è§å PD_PRODUCT_CODE èªå¨çæï¼ |
| | | */ |
| | | private String code; |
| | | /** |
| | | * æ¡£æ¡åç§° |
| | | */ |
| | | private String name; |
| | | /** |
| | | * è§æ ¼åå· |
| | | */ |
| | | private String spec; |
| | | /** |
| | | * åä½ |
| | | */ |
| | | private String unit; |
| | | /** |
| | | * åºåä»·æ ¼ |
| | | */ |
| | | private BigDecimal price; |
| | | /** |
| | | * 审æ¹ç¶æï¼0æªæäº¤/10审æ¹ä¸/20å®¡æ ¸éè¿/30å®¡æ ¸ä¸éè¿ï¼ |
| | | * |
| | | * æä¸¾ {@link MesPdAuditStatusEnum} |
| | | */ |
| | | private Integer auditStatus; |
| | | /** |
| | | * å®¡æ¹æè§ |
| | | */ |
| | | private String auditRemark; |
| | | /** |
| | | * å®¡æ¹æ¶é´ |
| | | */ |
| | | private LocalDateTime auditTime; |
| | | /** |
| | | * å¯ç¨ç¶æï¼1å¯ç¨/0ç¦ç¨ï¼ |
| | | */ |
| | | private Integer status; |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.pd.reel; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * MES æ¢ä½å¯¼çº¿çå
·è®¡ç® DO |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @TableName("product_ctc_reel") |
| | | @KeySequence("product_ctc_reel_seq") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class ProductCtcReelDO extends BaseDO { |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | /** |
| | | * æ¢ä½å¯¼çº¿äº§åIDï¼å
³è product_ctc.idï¼ |
| | | */ |
| | | private Long ctcId; |
| | | /** |
| | | * çå
·ç±»åï¼æ¨ç/éç/é¢çï¼ |
| | | * |
| | | * åå
¸ {@link DictTypeConstants#PRODUCT_REEL_TYPE} |
| | | */ |
| | | private String reelType; |
| | | /** |
| | | * çå
·å¤å¾ï¼mmï¼ |
| | | */ |
| | | private BigDecimal reelOuterDiameter; |
| | | /** |
| | | * çè¯å
å¾ï¼mmï¼ |
| | | */ |
| | | private BigDecimal reelInnerDiameter; |
| | | /** |
| | | * ç宽ï¼mmï¼ |
| | | */ |
| | | private BigDecimal reelWidth; |
| | | /** |
| | | * æå¤§å®¹éï¼kmï¼ |
| | | */ |
| | | private BigDecimal maxCapacity; |
| | | /** |
| | | * æ¨èæ¯çé¿åº¦ï¼kmï¼ |
| | | */ |
| | | private BigDecimal recommendedLength; |
| | | /** |
| | | * åéï¼kgï¼ |
| | | */ |
| | | private BigDecimal netWeight; |
| | | /** |
| | | * æ¯éï¼kgï¼ |
| | | */ |
| | | private BigDecimal grossWeight; |
| | | /** |
| | | * 计ç®å
¬å¼ï¼ä¿å计ç®é»è¾ï¼ |
| | | */ |
| | | private String calcFormula; |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.pd.techconfirm; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * MES äº§åææ¯ç¡®è®¤å½ DO |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @TableName("product_tech_confirm") |
| | | @KeySequence("product_tech_confirm_seq") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class ProductTechConfirmDO extends BaseDO { |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | /** |
| | | * 确认å½ç¼å· |
| | | */ |
| | | private String confirmNo; |
| | | /** |
| | | * 客æ·IDï¼å
³è crm_customer.idï¼ |
| | | */ |
| | | private Long customerId; |
| | | /** |
| | | * 客æ·åç§° |
| | | */ |
| | | private String customerName; |
| | | /** |
| | | * 产ååç§° |
| | | */ |
| | | private String productName; |
| | | /** |
| | | * è§æ ¼åå· |
| | | */ |
| | | private String specification; |
| | | /** |
| | | * ææ¯åæ°ï¼JSON æ ¼å¼ï¼ |
| | | */ |
| | | private String techParams; |
| | | /** |
| | | * 模æ¿ç±»åï¼å¥¥å°å©/æ¥æ¬/éç¨ï¼ |
| | | * |
| | | * åå
¸ {@link DictTypeConstants#PRODUCT_TECH_CONFIRM_TEMPLATE} |
| | | */ |
| | | private String templateType; |
| | | /** |
| | | * ç¼å¶äººID |
| | | */ |
| | | private Long drafterId; |
| | | /** |
| | | * ç¼å¶äººå§å |
| | | */ |
| | | private String drafterName; |
| | | /** |
| | | * ç¼å¶æ¶é´ |
| | | */ |
| | | private LocalDateTime draftTime; |
| | | /** |
| | | * å®¡æ ¸äººID |
| | | */ |
| | | private Long reviewerId; |
| | | /** |
| | | * å®¡æ ¸äººå§å |
| | | */ |
| | | private String reviewerName; |
| | | /** |
| | | * å®¡æ ¸æ¶é´ |
| | | */ |
| | | private LocalDateTime reviewTime; |
| | | /** |
| | | * 客æ·ç¡®è®¤äºº |
| | | */ |
| | | private String customerConfirmUser; |
| | | /** |
| | | * 客æ·ç¡®è®¤æ¶é´ |
| | | */ |
| | | private LocalDateTime customerConfirmTime; |
| | | /** |
| | | * ç¶æï¼0=è稿ï¼1=å¾
å®¡æ ¸ï¼2=å·²å®¡æ ¸ï¼3=客æ·å·²ç¡®è®¤ï¼ |
| | | * |
| | | * åå
¸ {@link DictTypeConstants#PRODUCT_TECH_CONFIRM_STATUS} |
| | | */ |
| | | private Integer status; |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.pro.emergencyplan; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | /** |
| | | * MES åºæ¥å¤ç½®é¢æ¡ DO |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @TableName("mes_pro_emergency_plan") |
| | | @KeySequence("mes_pro_emergency_plan_seq") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class MesProEmergencyPlanDO extends BaseDO { |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | |
| | | /** |
| | | * 颿¡ç¼ç |
| | | */ |
| | | private String code; |
| | | |
| | | /** |
| | | * 颿¡åç§° |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * 颿¡ç±»å |
| | | * |
| | | * 1: åçµ |
| | | * 2: è®¾å¤æ
é |
| | | * 3: ç«ç¾ |
| | | * 4: èªç¶ç¾å®³ |
| | | * 5: å
¶ä» |
| | | * |
| | | * åå
¸ {@link DictTypeConstants#MES_PRO_EMERGENCY_PLAN_TYPE} |
| | | */ |
| | | private Integer planType; |
| | | |
| | | /** |
| | | * å¤ç½®å
容 |
| | | */ |
| | | private String content; |
| | | |
| | | /** |
| | | * 责任åä½/é¨é¨ |
| | | */ |
| | | private String orgUnit; |
| | | |
| | | /** |
| | | * ç¶æ |
| | | * |
| | | * 0: è稿 |
| | | * 10: å·²åå¸ |
| | | */ |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.pro.maintenanceplan; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import cn.iocoder.yudao.module.mes.enums.pro.MesProMaintenancePlanTypeEnum; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * MES çµåä½ä¸è®¡å DO |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @TableName("mes_pro_maintenance_plan") |
| | | @KeySequence("mes_pro_maintenance_plan_seq") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class MesProMaintenancePlanDO extends BaseDO { |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | |
| | | /** |
| | | * 计åç¼ç |
| | | */ |
| | | private String code; |
| | | |
| | | /** |
| | | * 计ååç§° |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * 计åç±»å |
| | | * |
| | | * åå
¸ {@link DictTypeConstants#MES_PRO_MAINTENANCE_PLAN_TYPE} |
| | | * æä¸¾ {@link MesProMaintenancePlanTypeEnum} |
| | | */ |
| | | private Integer planType; |
| | | |
| | | /** |
| | | * ç«ç¹ |
| | | */ |
| | | private String station; |
| | | |
| | | /** |
| | | * 线路 |
| | | */ |
| | | private String line; |
| | | |
| | | /** |
| | | * çç»ç¼å· |
| | | * |
| | | * å
³è {@link cn.iocoder.yudao.module.mes.dal.dataobject.cal.team.MesCalTeamDO#getId()} |
| | | */ |
| | | private Long teamId; |
| | | |
| | | /** |
| | | * çç»åç§° |
| | | */ |
| | | private String teamName; |
| | | |
| | | /** |
| | | * è®¡åæ¥æ |
| | | */ |
| | | private LocalDateTime planDate; |
| | | |
| | | /** |
| | | * ç¶æ |
| | | * |
| | | * 0: è稿 |
| | | * 10: å·²ä¸å |
| | | * 20: 已宿 |
| | | * 30: 已忶 |
| | | */ |
| | | private Integer status; |
| | | |
| | | /** |
| | | * çæçå·¥åç¼å· |
| | | * |
| | | * å
³è {@link cn.iocoder.yudao.module.mes.dal.dataobject.pro.workorder.MesProWorkOrderDO#getId()} |
| | | */ |
| | | private Long workOrderId; |
| | | |
| | | /** |
| | | * çæçå·¥åç¼ç |
| | | */ |
| | | private String workOrderCode; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.pro.maintenanceplan; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * MES çµåä½ä¸è®¡åæç»ï¼å¤ä»¶/ç©èµéæ±ï¼ DO |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @TableName("mes_pro_maintenance_plan_item") |
| | | @KeySequence("mes_pro_maintenance_plan_item_seq") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class MesProMaintenancePlanItemDO extends BaseDO { |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | |
| | | /** |
| | | * çµåä½ä¸è®¡åç¼å· |
| | | */ |
| | | private Long planId; |
| | | |
| | | /** |
| | | * ç©æ/å¤ä»¶ç¼å· |
| | | * |
| | | * å
³è {@link cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO#getId()} |
| | | */ |
| | | private Long itemId; |
| | | |
| | | /** |
| | | * éæ±æ°é |
| | | */ |
| | | private BigDecimal quantity; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | } |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.pro.process; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | |
| | | */ |
| | | private String name; |
| | | /** |
| | | * çµåå·¥èºåç±» |
| | | * |
| | | * åå
¸ {@link DictTypeConstants#MES_PRO_PROCESS_TYPE} |
| | | */ |
| | | private Integer type; |
| | | /** |
| | | * å·¥èºè¦æ± |
| | | */ |
| | | private String attention; |
| | |
| | | */ |
| | | private Long processId; |
| | | /** |
| | | * çç»ç¼å· |
| | | * |
| | | * å
³è {@link cn.iocoder.yudao.module.mes.dal.dataobject.cal.team.MesCalTeamDO#getId()} |
| | | */ |
| | | private Long teamId; |
| | | /** |
| | | * çç»åç§° |
| | | */ |
| | | private String teamName; |
| | | /** |
| | | * 产åç©æç¼å· |
| | | * |
| | | * å
³è {@link MesMdItemDO#getId()} |
| | |
| | | */ |
| | | private Long clientId; |
| | | /** |
| | | * å
³èè¥é订åï¼ERP éå®è®¢åï¼ç¼å· |
| | | * |
| | | * å
³è {@link cn.iocoder.yudao.module.erp.api.sale.dto.ErpSaleOrderRespDTO#getId()} |
| | | */ |
| | | private Long saleOrderId; |
| | | /** |
| | | * å
³èè¥é订åï¼ERP éå®è®¢åï¼åå· |
| | | */ |
| | | private String saleOrderNo; |
| | | /** |
| | | * ä¾åºåç¼å· |
| | | * |
| | | * å
³è ERP ä¾åºå {@link cn.iocoder.yudao.module.erp.api.purchase.dto.ErpSupplierRespDTO#getId()} |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.qc.outsourcetest; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * MES å§å¤æ£æµ/è¯éªå DO |
| | | * |
| | | * <p>ç¬¬ä¸æ¹çµåæ£æµãå§å¤è¯éªåæ®ç®¡çï¼çåæ£æµæ¥åä¸èµè´¨æä»¶ |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @TableName("mes_qc_outsource_test") |
| | | @KeySequence("mes_qc_outsource_test_seq") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class MesQcOutsourceTestDO extends BaseDO { |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | |
| | | /** |
| | | * åæ®ç¼ç |
| | | */ |
| | | private String code; |
| | | |
| | | /** |
| | | * åæ®åç§° |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * æ£æµç±»å |
| | | * |
| | | * 1: ç¬¬ä¸æ¹æ£æµ |
| | | * 2: å§å¤è¯éª |
| | | * |
| | | * åå
¸ {@link DictTypeConstants#MES_QC_OUTSOURCE_TEST_TYPE} |
| | | */ |
| | | private Integer testType; |
| | | |
| | | /** |
| | | * æ£æµå¯¹è±¡ï¼ç©æ/设å¤ç¼å·ï¼ |
| | | */ |
| | | private Long itemId; |
| | | |
| | | /** |
| | | * æ£æµæºæ |
| | | */ |
| | | private String testOrg; |
| | | |
| | | /** |
| | | * æ£æµæ¥æ |
| | | */ |
| | | private LocalDateTime testDate; |
| | | |
| | | /** |
| | | * æ£æµç»æ |
| | | * |
| | | * 1: åæ ¼ |
| | | * 2: ä¸åæ ¼ |
| | | * |
| | | * åå
¸ {@link DictTypeConstants#MES_QC_OUTSOURCE_TEST_RESULT} |
| | | */ |
| | | private Integer result; |
| | | |
| | | /** |
| | | * æ£æµæ¥åç¼å· |
| | | */ |
| | | private String reportNo; |
| | | |
| | | /** |
| | | * ç¶æ |
| | | * |
| | | * 0: è稿 |
| | | * 10: å·²æäº¤ |
| | | * 20: 已宿 |
| | | */ |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | } |
| | |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.task.MesProTaskDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.workorder.MesProWorkOrderDO; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmProductIssueStatusEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmProductIssueTypeEnum; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | |
| | | */ |
| | | private Long taskId; |
| | | /** |
| | | * åæ®ç±»å |
| | | * |
| | | * åå
¸ {@link DictTypeConstants#MES_WM_PRODUCT_ISSUE_TYPE} |
| | | * æä¸¾ {@link MesWmProductIssueTypeEnum} |
| | | */ |
| | | private Integer issueType; |
| | | /** |
| | | * é¢ææ¥æ |
| | | */ |
| | | private LocalDateTime issueDate; |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | |
| | | */ |
| | | private String name; |
| | | /** |
| | | * åºåºç±»å |
| | | * |
| | | * åå
¸ {@link DictTypeConstants#MES_WM_WAREHOUSE_TYPE} |
| | | */ |
| | | private Integer type; |
| | | /** |
| | | * åºåºç¼å· |
| | | * |
| | | * å
³è {@link MesWmWarehouseLocationDO#getId()} |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | |
| | | */ |
| | | private String name; |
| | | /** |
| | | * ä»åºç±»å |
| | | * |
| | | * åå
¸ {@link DictTypeConstants#MES_WM_WAREHOUSE_TYPE} |
| | | */ |
| | | private Integer type; |
| | | /** |
| | | * ä»åºå°å |
| | | */ |
| | | private String address; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.dv.telemetry; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.dv.telemetry.vo.MesDvTelemetryLatestReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.dv.telemetry.vo.MesDvTelemetryPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.dv.telemetry.MesDvTelemetryDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * MES è®¾å¤æ°é饿µæ°æ® Mapper |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @Mapper |
| | | public interface MesDvTelemetryMapper extends BaseMapperX<MesDvTelemetryDO> { |
| | | |
| | | default PageResult<MesDvTelemetryDO> selectPage(MesDvTelemetryPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<MesDvTelemetryDO>() |
| | | .eqIfPresent(MesDvTelemetryDO::getTbDeviceId, reqVO.getTbDeviceId()) |
| | | .likeIfPresent(MesDvTelemetryDO::getDeviceName, reqVO.getDeviceName()) |
| | | .likeIfPresent(MesDvTelemetryDO::getParamName, reqVO.getParamName()) |
| | | .eqIfPresent(MesDvTelemetryDO::getWhetherAnomaly, reqVO.getWhetherAnomaly()) |
| | | .eqIfPresent(MesDvTelemetryDO::getShiftName, reqVO.getShiftName()) |
| | | .betweenIfPresent(MesDvTelemetryDO::getTelemetryDataTime, reqVO.getTelemetryDataTime()) |
| | | .orderByDesc(MesDvTelemetryDO::getTelemetryDataTime) |
| | | .orderByDesc(MesDvTelemetryDO::getId)); |
| | | } |
| | | |
| | | default List<MesDvTelemetryDO> selectLatest(MesDvTelemetryLatestReqVO reqVO, int limit) { |
| | | return selectList(new LambdaQueryWrapperX<MesDvTelemetryDO>() |
| | | .eqIfPresent(MesDvTelemetryDO::getTbDeviceId, reqVO.getTbDeviceId()) |
| | | .likeIfPresent(MesDvTelemetryDO::getDeviceName, reqVO.getDeviceName()) |
| | | .orderByDesc(MesDvTelemetryDO::getTelemetryDataTime) |
| | | .orderByDesc(MesDvTelemetryDO::getId) |
| | | .last("LIMIT " + limit)); |
| | | } |
| | | |
| | | default List<MesDvTelemetryDO> selectDeviceList() { |
| | | return selectList(new LambdaQueryWrapperX<MesDvTelemetryDO>() |
| | | .select(MesDvTelemetryDO::getTbDeviceId, MesDvTelemetryDO::getDeviceName) |
| | | .groupBy(MesDvTelemetryDO::getTbDeviceId, MesDvTelemetryDO::getDeviceName) |
| | | .orderByAsc(MesDvTelemetryDO::getDeviceName)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.pd.basedata; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdDiscountPolicyPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata.MesPdDiscountPolicyDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface MesPdDiscountPolicyMapper extends BaseMapperX<MesPdDiscountPolicyDO> { |
| | | |
| | | default PageResult<MesPdDiscountPolicyDO> selectPage(MesPdDiscountPolicyPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<MesPdDiscountPolicyDO>() |
| | | .likeIfPresent(MesPdDiscountPolicyDO::getName, reqVO.getName()) |
| | | .eqIfPresent(MesPdDiscountPolicyDO::getPolicyType, reqVO.getPolicyType()) |
| | | .eqIfPresent(MesPdDiscountPolicyDO::getStatus, reqVO.getStatus()) |
| | | .orderByDesc(MesPdDiscountPolicyDO::getId)); |
| | | } |
| | | |
| | | default List<MesPdDiscountPolicyDO> selectListByTarget(Integer targetType, Long targetId) { |
| | | return selectList(new LambdaQueryWrapperX<MesPdDiscountPolicyDO>() |
| | | .eq(MesPdDiscountPolicyDO::getStatus, 1) |
| | | .and(w -> w.eq(MesPdDiscountPolicyDO::getTargetType, targetType) |
| | | .eq(MesPdDiscountPolicyDO::getTargetId, targetId) |
| | | .or() |
| | | .isNull(MesPdDiscountPolicyDO::getTargetType)) |
| | | .orderByDesc(MesPdDiscountPolicyDO::getId)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.pd.basedata; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdElectricityTypePageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata.MesPdElectricityTypeDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @Mapper |
| | | public interface MesPdElectricityTypeMapper extends BaseMapperX<MesPdElectricityTypeDO> { |
| | | |
| | | default PageResult<MesPdElectricityTypeDO> selectPage(MesPdElectricityTypePageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<MesPdElectricityTypeDO>() |
| | | .likeIfPresent(MesPdElectricityTypeDO::getName, reqVO.getName()) |
| | | .eqIfPresent(MesPdElectricityTypeDO::getStatus, reqVO.getStatus()) |
| | | .orderByAsc(MesPdElectricityTypeDO::getSort) |
| | | .orderByDesc(MesPdElectricityTypeDO::getId)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.pd.basedata; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdPriceStandardPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata.MesPdPriceStandardDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface MesPdPriceStandardMapper extends BaseMapperX<MesPdPriceStandardDO> { |
| | | |
| | | default PageResult<MesPdPriceStandardDO> selectPage(MesPdPriceStandardPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<MesPdPriceStandardDO>() |
| | | .eqIfPresent(MesPdPriceStandardDO::getObjectType, reqVO.getObjectType()) |
| | | .eqIfPresent(MesPdPriceStandardDO::getObjectId, reqVO.getObjectId()) |
| | | .eqIfPresent(MesPdPriceStandardDO::getStatus, reqVO.getStatus()) |
| | | .orderByDesc(MesPdPriceStandardDO::getId)); |
| | | } |
| | | |
| | | default List<MesPdPriceStandardDO> selectListByObjectTypeAndId(Integer objectType, Long objectId) { |
| | | return selectList(new LambdaQueryWrapperX<MesPdPriceStandardDO>() |
| | | .eq(MesPdPriceStandardDO::getObjectType, objectType) |
| | | .eq(MesPdPriceStandardDO::getObjectId, objectId)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.pd.basedata; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdServicePackagePageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata.MesPdServicePackageDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @Mapper |
| | | public interface MesPdServicePackageMapper extends BaseMapperX<MesPdServicePackageDO> { |
| | | |
| | | default PageResult<MesPdServicePackageDO> selectPage(MesPdServicePackagePageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<MesPdServicePackageDO>() |
| | | .likeIfPresent(MesPdServicePackageDO::getName, reqVO.getName()) |
| | | .eqIfPresent(MesPdServicePackageDO::getStatus, reqVO.getStatus()) |
| | | .orderByDesc(MesPdServicePackageDO::getId)); |
| | | } |
| | | |
| | | default MesPdServicePackageDO selectByCode(String code) { |
| | | return selectOne(MesPdServicePackageDO::getCode, code); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.pd.basedata; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdTieredPricePageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata.MesPdTieredPriceDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface MesPdTieredPriceMapper extends BaseMapperX<MesPdTieredPriceDO> { |
| | | |
| | | default PageResult<MesPdTieredPriceDO> selectPage(MesPdTieredPricePageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<MesPdTieredPriceDO>() |
| | | .eqIfPresent(MesPdTieredPriceDO::getPackageId, reqVO.getPackageId()) |
| | | .eqIfPresent(MesPdTieredPriceDO::getVoltageLevelId, reqVO.getVoltageLevelId()) |
| | | .eqIfPresent(MesPdTieredPriceDO::getStatus, reqVO.getStatus()) |
| | | .orderByAsc(MesPdTieredPriceDO::getStartValue) |
| | | .orderByDesc(MesPdTieredPriceDO::getId)); |
| | | } |
| | | |
| | | default List<MesPdTieredPriceDO> selectListByPackageId(Long packageId) { |
| | | return selectList(new LambdaQueryWrapperX<MesPdTieredPriceDO>() |
| | | .eq(MesPdTieredPriceDO::getPackageId, packageId) |
| | | .eq(MesPdTieredPriceDO::getStatus, 1) |
| | | .orderByAsc(MesPdTieredPriceDO::getStartValue)); |
| | | } |
| | | |
| | | default List<MesPdTieredPriceDO> selectListByVoltageLevelId(Long voltageLevelId) { |
| | | return selectList(new LambdaQueryWrapperX<MesPdTieredPriceDO>() |
| | | .eq(MesPdTieredPriceDO::getVoltageLevelId, voltageLevelId) |
| | | .eq(MesPdTieredPriceDO::getStatus, 1) |
| | | .orderByAsc(MesPdTieredPriceDO::getStartValue)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.pd.basedata; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdVoltageLevelPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata.MesPdVoltageLevelDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @Mapper |
| | | public interface MesPdVoltageLevelMapper extends BaseMapperX<MesPdVoltageLevelDO> { |
| | | |
| | | default PageResult<MesPdVoltageLevelDO> selectPage(MesPdVoltageLevelPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<MesPdVoltageLevelDO>() |
| | | .likeIfPresent(MesPdVoltageLevelDO::getName, reqVO.getName()) |
| | | .eqIfPresent(MesPdVoltageLevelDO::getStatus, reqVO.getStatus()) |
| | | .orderByAsc(MesPdVoltageLevelDO::getSort) |
| | | .orderByDesc(MesPdVoltageLevelDO::getId)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.pd.ctc; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.ctc.vo.ProductCtcPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.ctc.ProductCtcDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @Mapper |
| | | public interface ProductCtcMapper extends BaseMapperX<ProductCtcDO> { |
| | | |
| | | default PageResult<ProductCtcDO> selectPage(ProductCtcPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<ProductCtcDO>() |
| | | .eqIfPresent(ProductCtcDO::getItemId, reqVO.getItemId()) |
| | | .likeIfPresent(ProductCtcDO::getOrderSpec, reqVO.getOrderSpec()) |
| | | .eqIfPresent(ProductCtcDO::getConductorType, reqVO.getConductorType()) |
| | | .likeIfPresent(ProductCtcDO::getStandardCode, reqVO.getStandardCode()) |
| | | .orderByDesc(ProductCtcDO::getId)); |
| | | } |
| | | |
| | | default ProductCtcDO selectByItemId(Long itemId) { |
| | | return selectOne(ProductCtcDO::getItemId, itemId); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.pd.product; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.product.vo.MesPdProductPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.product.MesPdProductDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @Mapper |
| | | public interface MesPdProductMapper extends BaseMapperX<MesPdProductDO> { |
| | | |
| | | default PageResult<MesPdProductDO> selectPage(MesPdProductPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<MesPdProductDO>() |
| | | .eqIfPresent(MesPdProductDO::getArchiveType, reqVO.getArchiveType()) |
| | | .likeIfPresent(MesPdProductDO::getName, reqVO.getName()) |
| | | .eqIfPresent(MesPdProductDO::getAuditStatus, reqVO.getAuditStatus()) |
| | | .eqIfPresent(MesPdProductDO::getStatus, reqVO.getStatus()) |
| | | .orderByDesc(MesPdProductDO::getId)); |
| | | } |
| | | |
| | | default MesPdProductDO selectByCode(String code) { |
| | | return selectOne(MesPdProductDO::getCode, code); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.pd.reel; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.reel.vo.ProductCtcReelPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.reel.ProductCtcReelDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface ProductCtcReelMapper extends BaseMapperX<ProductCtcReelDO> { |
| | | |
| | | default PageResult<ProductCtcReelDO> selectPage(ProductCtcReelPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<ProductCtcReelDO>() |
| | | .eqIfPresent(ProductCtcReelDO::getCtcId, reqVO.getCtcId()) |
| | | .eqIfPresent(ProductCtcReelDO::getReelType, reqVO.getReelType()) |
| | | .orderByDesc(ProductCtcReelDO::getId)); |
| | | } |
| | | |
| | | default List<ProductCtcReelDO> selectListByCtcId(Long ctcId) { |
| | | return selectList(ProductCtcReelDO::getCtcId, ctcId); |
| | | } |
| | | |
| | | default int deleteByCtcId(Long ctcId) { |
| | | return delete(ProductCtcReelDO::getCtcId, ctcId); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.pd.techconfirm; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.techconfirm.vo.ProductTechConfirmPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.techconfirm.ProductTechConfirmDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @Mapper |
| | | public interface ProductTechConfirmMapper extends BaseMapperX<ProductTechConfirmDO> { |
| | | |
| | | default PageResult<ProductTechConfirmDO> selectPage(ProductTechConfirmPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<ProductTechConfirmDO>() |
| | | .likeIfPresent(ProductTechConfirmDO::getConfirmNo, reqVO.getConfirmNo()) |
| | | .eqIfPresent(ProductTechConfirmDO::getCustomerId, reqVO.getCustomerId()) |
| | | .likeIfPresent(ProductTechConfirmDO::getProductName, reqVO.getProductName()) |
| | | .eqIfPresent(ProductTechConfirmDO::getTemplateType, reqVO.getTemplateType()) |
| | | .eqIfPresent(ProductTechConfirmDO::getStatus, reqVO.getStatus()) |
| | | .orderByDesc(ProductTechConfirmDO::getId)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.pro.emergencyplan; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.emergencyplan.vo.MesProEmergencyPlanPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.emergencyplan.MesProEmergencyPlanDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * MES åºæ¥å¤ç½®é¢æ¡ Mapper |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @Mapper |
| | | public interface MesProEmergencyPlanMapper extends BaseMapperX<MesProEmergencyPlanDO> { |
| | | |
| | | default MesProEmergencyPlanDO selectByCode(String code) { |
| | | return selectOne(MesProEmergencyPlanDO::getCode, code); |
| | | } |
| | | |
| | | default PageResult<MesProEmergencyPlanDO> selectPage(MesProEmergencyPlanPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<MesProEmergencyPlanDO>() |
| | | .likeIfPresent(MesProEmergencyPlanDO::getCode, reqVO.getCode()) |
| | | .likeIfPresent(MesProEmergencyPlanDO::getName, reqVO.getName()) |
| | | .eqIfPresent(MesProEmergencyPlanDO::getPlanType, reqVO.getPlanType()) |
| | | .eqIfPresent(MesProEmergencyPlanDO::getStatus, reqVO.getStatus()) |
| | | .orderByDesc(MesProEmergencyPlanDO::getId)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.pro.maintenanceplan; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.maintenanceplan.MesProMaintenancePlanItemDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * MES çµåä½ä¸è®¡åæç» Mapper |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @Mapper |
| | | public interface MesProMaintenancePlanItemMapper extends BaseMapperX<MesProMaintenancePlanItemDO> { |
| | | |
| | | default List<MesProMaintenancePlanItemDO> selectListByPlanId(Long planId) { |
| | | return selectList(MesProMaintenancePlanItemDO::getPlanId, planId); |
| | | } |
| | | |
| | | default List<MesProMaintenancePlanItemDO> selectListByPlanIds(Collection<Long> planIds) { |
| | | return selectList(MesProMaintenancePlanItemDO::getPlanId, planIds); |
| | | } |
| | | |
| | | default void deleteByPlanId(Long planId) { |
| | | delete(new LambdaQueryWrapperX<MesProMaintenancePlanItemDO>() |
| | | .eq(MesProMaintenancePlanItemDO::getPlanId, planId)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.pro.maintenanceplan; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.maintenanceplan.vo.MesProMaintenancePlanPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.maintenanceplan.MesProMaintenancePlanDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * MES çµåä½ä¸è®¡å Mapper |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @Mapper |
| | | public interface MesProMaintenancePlanMapper extends BaseMapperX<MesProMaintenancePlanDO> { |
| | | |
| | | default MesProMaintenancePlanDO selectByCode(String code) { |
| | | return selectOne(MesProMaintenancePlanDO::getCode, code); |
| | | } |
| | | |
| | | default List<MesProMaintenancePlanDO> selectPlanListByIds(Collection<Long> ids) { |
| | | return selectList(MesProMaintenancePlanDO::getId, ids); |
| | | } |
| | | |
| | | default PageResult<MesProMaintenancePlanDO> selectPage(MesProMaintenancePlanPageReqVO pageReqVO) { |
| | | return selectPage(pageReqVO, new LambdaQueryWrapperX<MesProMaintenancePlanDO>() |
| | | .likeIfPresent(MesProMaintenancePlanDO::getCode, pageReqVO.getCode()) |
| | | .likeIfPresent(MesProMaintenancePlanDO::getName, pageReqVO.getName()) |
| | | .eqIfPresent(MesProMaintenancePlanDO::getPlanType, pageReqVO.getPlanType()) |
| | | .eqIfPresent(MesProMaintenancePlanDO::getStatus, pageReqVO.getStatus()) |
| | | .betweenIfPresent(MesProMaintenancePlanDO::getPlanDate, pageReqVO.getPlanDate()) |
| | | .orderByDesc(MesProMaintenancePlanDO::getId)); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.qc.outsourcetest; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.outsourcetest.vo.MesQcOutsourceTestPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.qc.outsourcetest.MesQcOutsourceTestDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * MES å§å¤æ£æµ/è¯éªå Mapper |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @Mapper |
| | | public interface MesQcOutsourceTestMapper extends BaseMapperX<MesQcOutsourceTestDO> { |
| | | |
| | | default MesQcOutsourceTestDO selectByCode(String code) { |
| | | return selectOne(MesQcOutsourceTestDO::getCode, code); |
| | | } |
| | | |
| | | default PageResult<MesQcOutsourceTestDO> selectPage(MesQcOutsourceTestPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<MesQcOutsourceTestDO>() |
| | | .likeIfPresent(MesQcOutsourceTestDO::getCode, reqVO.getCode()) |
| | | .likeIfPresent(MesQcOutsourceTestDO::getName, reqVO.getName()) |
| | | .eqIfPresent(MesQcOutsourceTestDO::getTestType, reqVO.getTestType()) |
| | | .eqIfPresent(MesQcOutsourceTestDO::getResult, reqVO.getResult()) |
| | | .eqIfPresent(MesQcOutsourceTestDO::getStatus, reqVO.getStatus()) |
| | | .betweenIfPresent(MesQcOutsourceTestDO::getTestDate, reqVO.getTestDate()) |
| | | .orderByDesc(MesQcOutsourceTestDO::getId)); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | // ========== åºç¡æ°æ® (MD) ========== |
| | | String MES_MD_ITEM_OR_PRODUCT = "mes_md_item_or_product"; // MES ç©æäº§åæ è¯ |
| | | String MES_MATERIAL_CATEGORY = "mes_material_category"; // MES çµåç©èµåç±» |
| | | String MES_PRO_MAINTENANCE_PLAN_TYPE = "mes_pro_maintenance_plan_type"; // MES çµåä½ä¸è®¡åç±»å |
| | | String MES_PRO_MAINTENANCE_PLAN_STATUS = "mes_pro_maintenance_plan_status"; // MES çµåä½ä¸è®¡åç¶æ |
| | | String MES_QC_OUTSOURCE_TEST_TYPE = "mes_qc_outsource_test_type"; // MES å§å¤æ£æµç±»å |
| | | String MES_QC_OUTSOURCE_TEST_RESULT = "mes_qc_outsource_test_result"; // MES å§å¤æ£æµç»æ |
| | | String MES_PRO_PROCESS_TYPE = "mes_pro_process_type"; // MES çµåå·¥èºåç±» |
| | | String MES_PRO_EMERGENCY_PLAN_TYPE = "mes_pro_emergency_plan_type"; // MES åºæ¥å¤ç½®é¢æ¡ç±»å |
| | | String MES_MD_AUTO_CODE_PART_TYPE = "mes_md_auto_code_part_type"; // MES åæ®µç±»å |
| | | String MES_MD_AUTO_CODE_CYCLE_METHOD = "mes_md_auto_code_cycle_method"; // MES å¾ªç¯æ¹å¼ |
| | | String MES_MD_AUTO_CODE_PADDED_METHOD = "mes_md_auto_code_padded_method"; // MES è¡¥é½æ¹å¼ |
| | |
| | | String MES_BARCODE_FORMAT = "mes_barcode_format"; // MES æ¡ç æ ¼å¼ |
| | | String MES_BARCODE_BIZ_TYPE = "mes_barcode_biz_type"; // MES æ¡ç ä¸å¡ç±»å |
| | | String MES_WM_TRANSACTION_TYPE = "mes_wm_transaction_type"; // MES åºåäºå¡ç±»å |
| | | String MES_WM_WAREHOUSE_TYPE = "mes_wm_warehouse_type"; // MES ä»åº/åºåºç±»åï¼æ®é/设å¤ä»/å¤ä»¶ä»/èæä»/å±ååä»ï¼ |
| | | String MES_WM_QUALITY_STATUS = "mes_wm_quality_status"; // MES è´¨éç¶æï¼å¾
æ£/åæ ¼/ä¸åæ ¼ï¼ |
| | | |
| | | // ========== ä»å¨å
¥åº (WM Receipt) ========== |
| | |
| | | String MES_WM_PRODUCT_SALES_STATUS = "mes_wm_product_sales_status"; // MES éå®åºåºåç¶æ |
| | | String MES_WM_OUTSOURCE_ISSUE_STATUS = "mes_wm_outsource_issue_status"; // MES å§å¤åºåºç¶æ |
| | | String MES_WM_PRODUCT_ISSUE_STATUS = "mes_wm_product_issue_status"; // MES çäº§é¢æç¶æ |
| | | String MES_WM_PRODUCT_ISSUE_TYPE = "mes_wm_product_issue_type"; // MES çäº§é¢æåæ®ç±»å |
| | | String MES_WM_RETURN_VENDOR_STATUS = "mes_wm_return_vendor_status"; // MES ä¾åºåéè´§åç¶æ |
| | | |
| | | // ========== ä»å¨ç§»åºä¸çç¹ (WM Transfer) ========== |
| | |
| | | String MES_DV_METERING_CATEGORY = "mes_dv_metering_category"; // MES 计éå¨å
·ç±»å« |
| | | String MES_DV_METERING_STATUS = "mes_dv_metering_status"; // MES 计éå¨å
·ç¶æ |
| | | String MES_DV_METERING_CHECK_RESULT = "mes_dv_metering_check_result"; // MES è®¡éæ£æµç»è®º |
| | | String MES_DV_TELEMETRY_ANOMALY = "mes_dv_telemetry_anomaly"; // MES æ°éæ¯å¦å¼å¸¸ |
| | | |
| | | // ========== æçæ¥å (CAL) ========== |
| | | String MES_CAL_HOLIDAY_TYPE = "mes_cal_holiday_type"; // MES åæç±»å |
| | |
| | | String MES_PD_ARCHIVE_STATUS = "mes_pd_archive_status"; // 彿¡£ç¶æ |
| | | String MES_PD_PROCESS_PARAM_TYPE = "mes_pd_process_param_type"; // å·¥èºåæ°ç±»å |
| | | String MES_PD_PROCESS_PARAM_TEMPLATE_TYPE = "mes_pd_process_param_template_type"; // å·¥èºåæ°æ¨¡æ¿ç±»å |
| | | |
| | | // ========== 产å设计-æ¢ä½å¯¼çº¿ (CTC) ========== |
| | | String PRODUCT_CONDUCTOR_TYPE = "product_conductor_type"; // æ¢ä½å¯¼çº¿å¯¼ä½ç±»å |
| | | String PRODUCT_REEL_TYPE = "product_reel_type"; // æ¢ä½å¯¼çº¿çå
፱Ȍ |
| | | String PRODUCT_TECH_CONFIRM_TEMPLATE = "product_tech_confirm_template"; // ææ¯ç¡®è®¤å½æ¨¡æ¿ç±»å |
| | | String PRODUCT_TECH_CONFIRM_STATUS = "product_tech_confirm_status"; // ææ¯ç¡®è®¤å½ç¶æ |
| | | |
| | | // ========== 产å设计-äº§åæ¡£æ¡ä¸åºç¡æ°æ® (PD-EXT) ========== |
| | | String MES_PD_PRODUCT_ARCHIVE_TYPE = "mes_pd_product_archive_type"; // äº§åæ¡£æ¡ç±»åï¼1çµåæå¡/2ä¾çµäº§å/3å¢å¼è½æºäº§åï¼ |
| | | String MES_PD_PRODUCT_AUDIT_STATUS = "mes_pd_product_audit_status"; // äº§åæ¡£æ¡å®¡æ¹ç¶æï¼0/10/20/30ï¼ |
| | | String MES_PD_PRODUCT_STATUS = "mes_pd_product_status"; // äº§åæ¡£æ¡å¯ç¨ç¶æ |
| | | String MES_PD_PRICE_OBJECT_TYPE = "mes_pd_price_object_type"; // å®ä»·å¯¹è±¡ç±»åï¼1æå¡å¥é¤/2çµåç级/3ç¨çµç±»åï¼ |
| | | String MES_PD_DISCOUNT_POLICY_TYPE = "mes_pd_discount_policy_type"; // 伿 çç¥ç±»åï¼1ææ£/2ç«åï¼ |
| | | String MES_PD_TIERED_PRICE_STATUS = "mes_pd_tiered_price_status"; // é¶æ¢¯çµä»·å¯ç¨ç¶æ |
| | | } |
| | |
| | | ErrorCode DV_MACHINERY_HAS_REPAIR = new ErrorCode(1_040_301_006, "设å¤å·²å
³è维修工åï¼æ æ³å é¤"); |
| | | ErrorCode DV_MACHINERY_WORKSTATION_NOT_EXISTS = new ErrorCode(1_040_301_008, "å·¥ä½ç«ç¼ç ä¸åå¨"); |
| | | |
| | | // ========== MES 设å¤ç®¡ç-è®¾å¤æ°éï¼1-040-308-000ï¼ ========== |
| | | ErrorCode DV_TELEMETRY_NOT_EXISTS = new ErrorCode(1_040_308_000, "æ°é饿µæ°æ®ä¸åå¨"); |
| | | ErrorCode DV_TELEMETRY_PULL_ERROR = new ErrorCode(1_040_308_001, "æ°éæ°æ®æå失败ï¼{}"); |
| | | ErrorCode DV_TELEMETRY_PULL_EMPTY = new ErrorCode(1_040_308_002, "æ°éæ¥å£æªè¿åæææ°æ®"); |
| | | |
| | | // ========== MES 设å¤ç®¡ç-ç¹æ£ä¿å
»é¡¹ç®ï¼1-040-304-000ï¼ ========== |
| | | ErrorCode DV_SUBJECT_NOT_EXISTS = new ErrorCode(1_040_304_000, "ç¹æ£ä¿å
»é¡¹ç®ä¸åå¨"); |
| | | ErrorCode DV_SUBJECT_CODE_DUPLICATE = new ErrorCode(1_040_304_001, "项ç®ç¼ç å·²åå¨"); |
| | |
| | | ErrorCode PRO_WORK_ORDER_PARAM_RECORD_DETAIL_NOT_IN_TEMPLATE = new ErrorCode(1_040_502_202, "åæ°æç»ä¸å±äºæé模æ¿"); |
| | | ErrorCode PRO_WORK_ORDER_PARAM_RECORD_REQUIRED_PARAM_MISSING = new ErrorCode(1_040_502_203, "å¿
å¡«åæ°ã{}ãæªå¡«å"); |
| | | ErrorCode PRO_WORK_ORDER_PARAM_RECORD_TEMPLATE_NOT_CHANGE = new ErrorCode(1_040_502_204, "ä¸å
è®¸æ´æ¢åæ°æ¨¡æ¿ï¼è¯·å é¤åéæ°å建"); |
| | | ErrorCode PRO_WORK_ORDER_SALE_ORDER_NOT_EXISTS = new ErrorCode(1_040_502_205, "å
³èçè¥é订åï¼éå®è®¢åï¼ä¸åå¨"); |
| | | |
| | | // ========== MES ç产管ç-ç产任å¡ï¼1-040-503-000ï¼ ========== |
| | | ErrorCode PRO_TASK_NOT_EXISTS = new ErrorCode(1_040_503_000, "ç产任å¡ä¸åå¨"); |
| | |
| | | ErrorCode PD_PROCESS_PARAM_TEMPLATE_NOT_EXISTS = new ErrorCode(1_040_805_000, "å·¥èºåæ°æ¨¡æ¿ä¸åå¨"); |
| | | ErrorCode PD_PROCESS_PARAM_TEMPLATE_CODE_DUPLICATE = new ErrorCode(1_040_805_001, "å·¥èºåæ°æ¨¡æ¿ç¼ç å·²åå¨"); |
| | | |
| | | // ========== MES 产å设计-æ¢ä½å¯¼çº¿ææ¯åæ°ï¼1-040-806-000ï¼ ========== |
| | | ErrorCode PD_CTC_NOT_EXISTS = new ErrorCode(1_040_806_000, "æ¢ä½å¯¼çº¿ææ¯åæ°ä¸åå¨"); |
| | | ErrorCode PD_CTC_ITEM_DUPLICATE = new ErrorCode(1_040_806_001, "è¯¥ç©æå·²å卿¢ä½å¯¼çº¿ææ¯åæ°ï¼è¯·å¿é夿·»å "); |
| | | ErrorCode PD_CTC_CALC_PARAM_INVALID = new ErrorCode(1_040_806_002, "计ç®åæ°ä¸åæ³ï¼è¯·æ£æ¥è¾å
¥"); |
| | | |
| | | // ========== MES 产å设计-çå
·è®¡ç®ï¼1-040-807-000ï¼ ========== |
| | | ErrorCode PD_CTC_REEL_NOT_EXISTS = new ErrorCode(1_040_807_000, "çå
·è®¡ç®è®°å½ä¸åå¨"); |
| | | |
| | | // ========== MES 产å设计-ææ¯ç¡®è®¤å½ï¼1-040-808-000ï¼ ========== |
| | | ErrorCode PD_TECH_CONFIRM_NOT_EXISTS = new ErrorCode(1_040_808_000, "ææ¯ç¡®è®¤å½ä¸åå¨"); |
| | | ErrorCode PD_TECH_CONFIRM_NO_DUPLICATE = new ErrorCode(1_040_808_001, "确认å½ç¼å·å·²åå¨"); |
| | | |
| | | // ========== MES 产å设计-äº§åæ¡£æ¡ä¸åºç¡æ°æ®ï¼1-040-809-000ï¼ ========== |
| | | ErrorCode PD_PRODUCT_NOT_EXISTS = new ErrorCode(1_040_809_000, "äº§åæ¡£æ¡ä¸åå¨"); |
| | | ErrorCode PD_PRODUCT_AUDIT_STATUS_INVALID = new ErrorCode(1_040_809_001, "äº§åæ¡£æ¡ç¶æä¸æ£ç¡®ï¼æ æ³æ§è¡è¯¥æä½"); |
| | | ErrorCode PD_PRODUCT_SUBMIT_DUPLICATE = new ErrorCode(1_040_809_002, "äº§åæ¡£æ¡å·²æäº¤å®¡æ¹ï¼è¯·å¿éå¤æäº¤"); |
| | | ErrorCode PD_ELECTRICITY_TYPE_NOT_EXISTS = new ErrorCode(1_040_809_100, "ç¨çµç±»åä¸åå¨"); |
| | | ErrorCode PD_VOLTAGE_LEVEL_NOT_EXISTS = new ErrorCode(1_040_809_101, "çµåç级ä¸åå¨"); |
| | | ErrorCode PD_SERVICE_PACKAGE_NOT_EXISTS = new ErrorCode(1_040_809_102, "æå¡å¥é¤ä¸åå¨"); |
| | | ErrorCode PD_PRICE_STANDARD_NOT_EXISTS = new ErrorCode(1_040_809_103, "å®ä»·æ åä¸åå¨"); |
| | | ErrorCode PD_DISCOUNT_POLICY_NOT_EXISTS = new ErrorCode(1_040_809_104, "伿 çç¥ä¸åå¨"); |
| | | ErrorCode PD_TIERED_PRICE_NOT_EXISTS = new ErrorCode(1_040_809_105, "é¶æ¢¯çµä»·ä¸åå¨"); |
| | | ErrorCode PD_PRICE_CALC_OBJECT_NOT_CONFIGURED = new ErrorCode(1_040_809_200, "é¶æ¢¯çµä»·æªé
ç½®ï¼æ æ³è®¡ç®"); |
| | | |
| | | // ========== MES ä»å¨ç©æµ-审æ¹é
ç½®ï¼1-040-900-000ï¼ ========== |
| | | ErrorCode WMS_APPROVAL_CONFIG_NOT_EXISTS = new ErrorCode(1_040_900_000, "ä»åºå®¡æ¹é
ç½®ä¸åå¨"); |
| | | ErrorCode WMS_APPROVAL_ORDER_NOT_EXISTS = new ErrorCode(1_040_900_001, "审æ¹åæ®ä¸åå¨"); |
| | |
| | | PD_DOCUMENT_AUDIT_CODE("PD_DOCUMENT_AUDIT_CODE", "èµæå®¡æ ¸åç¼ç "), |
| | | PD_ARCHIVE_CODE("PD_ARCHIVE_CODE", "彿¡£å°è´¦ç¼ç "), |
| | | PD_PROCESS_PARAM_CODE("PD_PROCESS_PARAM_CODE", "å·¥èºåæ°ç¼ç "), |
| | | PD_PROCESS_PARAM_TEMPLATE_CODE("PD_PROCESS_PARAM_TEMPLATE_CODE", "å·¥èºåæ°æ¨¡æ¿ç¼ç "); |
| | | PD_PROCESS_PARAM_TEMPLATE_CODE("PD_PROCESS_PARAM_TEMPLATE_CODE", "å·¥èºåæ°æ¨¡æ¿ç¼ç "), |
| | | PD_PRODUCT_CODE("PD_PRODUCT_CODE", "äº§åæ¡£æ¡ç¼ç "), |
| | | PD_PACKAGE_CODE("PD_PACKAGE_CODE", "æå¡å¥é¤ç¼ç "); |
| | | |
| | | /** |
| | | * è§å代ç |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.enums.pd; |
| | | |
| | | import cn.iocoder.yudao.framework.common.core.ArrayValuable; |
| | | import lombok.Getter; |
| | | import lombok.RequiredArgsConstructor; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * 产å设计-审æ¹ç¶æ |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @RequiredArgsConstructor |
| | | @Getter |
| | | public enum MesPdAuditStatusEnum implements ArrayValuable<Integer> { |
| | | |
| | | DRAFT(0, "æªæäº¤"), |
| | | PROCESS(10, "审æ¹ä¸"), |
| | | APPROVE(20, "å®¡æ ¸éè¿"), |
| | | REJECT(30, "å®¡æ ¸ä¸éè¿"); |
| | | |
| | | private final Integer status; |
| | | private final String name; |
| | | |
| | | public static final Integer[] ARRAYS = Arrays.stream(values()).map(MesPdAuditStatusEnum::getStatus).toArray(Integer[]::new); |
| | | |
| | | public static String getNameByStatus(Integer status) { |
| | | if (status == null) { |
| | | return null; |
| | | } |
| | | for (MesPdAuditStatusEnum e : values()) { |
| | | if (e.getStatus().equals(status)) { |
| | | return e.getName(); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public Integer[] array() { |
| | | return ARRAYS; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.enums.pd; |
| | | |
| | | import cn.iocoder.yudao.framework.common.core.ArrayValuable; |
| | | import lombok.Getter; |
| | | import lombok.RequiredArgsConstructor; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * 产å设计-äº§åæ¡£æ¡ç±»å |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @RequiredArgsConstructor |
| | | @Getter |
| | | public enum MesPdProductArchiveTypeEnum implements ArrayValuable<Integer> { |
| | | |
| | | ELECTRICITY_SERVICE(1, "çµåæå¡"), |
| | | POWER_SUPPLY_PRODUCT(2, "ä¾çµäº§å"), |
| | | VALUE_ADDED_ENERGY(3, "å¢å¼è½æºäº§å"); |
| | | |
| | | private final Integer type; |
| | | private final String name; |
| | | |
| | | public static final Integer[] ARRAYS = Arrays.stream(values()).map(MesPdProductArchiveTypeEnum::getType).toArray(Integer[]::new); |
| | | |
| | | public static String getNameByType(Integer type) { |
| | | if (type == null) { |
| | | return null; |
| | | } |
| | | for (MesPdProductArchiveTypeEnum e : values()) { |
| | | if (e.getType().equals(type)) { |
| | | return e.getName(); |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public Integer[] array() { |
| | | return ARRAYS; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.enums.pro; |
| | | |
| | | import cn.iocoder.yudao.framework.common.core.ArrayValuable; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * MES çµåä½ä¸è®¡åç±»åæä¸¾ |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum MesProMaintenancePlanTypeEnum implements ArrayValuable<Integer> { |
| | | |
| | | GRID_OPERATION(1, "çµç½è¿è¡"), |
| | | POWER_GENERATION(2, "åçµ"), |
| | | SUBSTATION_MAINTENANCE(3, "åçµè¿ç»´"), |
| | | LINE_MAINTENANCE(4, "线路æ£ä¿®"); |
| | | |
| | | public static final Integer[] ARRAYS = Arrays.stream(values()) |
| | | .map(MesProMaintenancePlanTypeEnum::getType).toArray(Integer[]::new); |
| | | |
| | | /** |
| | | * ç±»åå¼ |
| | | */ |
| | | private final Integer type; |
| | | /** |
| | | * ç±»åå |
| | | */ |
| | | private final String name; |
| | | |
| | | @Override |
| | | public Integer[] array() { |
| | | return ARRAYS; |
| | | } |
| | | |
| | | } |
| | |
| | | public enum MesProWorkOrderSourceTypeEnum implements ArrayValuable<Integer> { |
| | | |
| | | ORDER(1, "客æ·è®¢å"), |
| | | STORE(2, "åºåå¤è´§"); |
| | | STORE(2, "åºåå¤è´§"), |
| | | MAINTENANCE_PLAN(3, "è¿ç»´è®¡å"); |
| | | |
| | | public static final Integer[] ARRAYS = Arrays.stream(values()).map(MesProWorkOrderSourceTypeEnum::getType).toArray(Integer[]::new); |
| | | |
| | |
| | | |
| | | SELF(1, "èªè¡ç产"), |
| | | OUTSOURCE(2, "代工"), |
| | | PURCHASE(3, "éè´"); |
| | | PURCHASE(3, "éè´"), |
| | | POWER_OPERATION(4, "çµåè¿ç»´"), |
| | | POWER_GENERATION(5, "åçµ"), |
| | | POWER_MAINTENANCE(6, "æ£ä¿®"); |
| | | |
| | | public static final Integer[] ARRAYS = Arrays.stream(values()).map(MesProWorkOrderTypeEnum::getType).toArray(Integer[]::new); |
| | | |
| | |
| | | */ |
| | | private final String name; |
| | | |
| | | public static MesProWorkOrderTypeEnum valueOf(Integer type) { |
| | | if (type == null) { |
| | | return null; |
| | | } |
| | | return Arrays.stream(values()).filter(item -> item.getType().equals(type)).findFirst().orElse(null); |
| | | } |
| | | |
| | | @Override |
| | | public Integer[] array() { |
| | | return ARRAYS; |
| | |
| | | public enum MesWmMiscIssueTypeEnum implements ArrayValuable<Integer> { |
| | | |
| | | ADJUST(1, "åºåè°æ´"), |
| | | SCRAP(2, "æ¥åºåºåº"); |
| | | SCRAP(2, "æ¥åºåºåº"), |
| | | WASTE_OUT(3, "åºæ§ç©èµåºåº"), |
| | | EQUIPMENT_OUT(4, "设å¤åºåº"); |
| | | |
| | | private final Integer type; |
| | | private final String name; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.enums.wm; |
| | | |
| | | import cn.iocoder.yudao.framework.common.core.ArrayValuable; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * MES çäº§é¢æåæ®ç±»åæä¸¾ |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum MesWmProductIssueTypeEnum implements ArrayValuable<Integer> { |
| | | |
| | | NORMAL(1, "æ£å¸¸é¢æ"), |
| | | URGENT_REPLENISH(2, "ç´§æ¥è¡¥æ"); |
| | | |
| | | public static final Integer[] ARRAYS = Arrays.stream(values()) |
| | | .map(MesWmProductIssueTypeEnum::getType).toArray(Integer[]::new); |
| | | |
| | | /** |
| | | * ç±»åå¼ |
| | | */ |
| | | private final Integer type; |
| | | /** |
| | | * ç±»åå |
| | | */ |
| | | private final String name; |
| | | |
| | | @Override |
| | | public Integer[] array() { |
| | | return ARRAYS; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.framework.config; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * MES æ°éï¼è®¾å¤æ°æ®ééï¼é
ç½® |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @Component |
| | | @ConfigurationProperties(prefix = "yudao.mes.telemetry") |
| | | @Data |
| | | public class MesTelemetryProperties { |
| | | |
| | | /** |
| | | * æ°éæå¡åºç¡å°åï¼ä¸å«è·¯å¾ï¼ï¼å¦ http://192.168.0.10:8080 |
| | | */ |
| | | private String baseUrl; |
| | | |
| | | /** |
| | | * æ°éæ¥å£è·¯å¾ï¼é»è®¤è¿åè¿ 5 åéè®¾å¤æ°æ®ï¼ |
| | | */ |
| | | private String path = "/api/jxjs/mesTb/getDeviceDetails"; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.job.dv; |
| | | |
| | | import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler; |
| | | import cn.iocoder.yudao.framework.tenant.core.job.TenantJob; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.dv.telemetry.vo.MesDvTelemetryPullRespVO; |
| | | import cn.iocoder.yudao.module.mes.service.dv.telemetry.MesDvTelemetryService; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * è®¾å¤æ°éæ°æ®å®æ¶æå Job |
| | | * |
| | | * æ°éæ¥å£ä»
ä¿çè¿ 5 åéæ°æ®ï¼é宿¶æåé¿å
æ°æ®ä¸¢å¤±ãé»è®¤æ¯ 5 åéæ§è¡ä¸æ¬¡ã |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @Component |
| | | public class MesDvTelemetryPullJob implements JobHandler { |
| | | |
| | | @Resource |
| | | private MesDvTelemetryService telemetryService; |
| | | |
| | | @Override |
| | | @TenantJob |
| | | public String execute(String param) { |
| | | MesDvTelemetryPullRespVO resp = telemetryService.pullTelemetry(); |
| | | return String.format("æåæ°éæ°æ®æåï¼æ°å¢ %s æ¡ï¼æ¶åè®¾å¤ %s å°", resp.getRecordCount(), resp.getDeviceCount()); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.dv.telemetry; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.dv.telemetry.vo.MesDvTelemetryDeviceRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.dv.telemetry.vo.MesDvTelemetryLatestReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.dv.telemetry.vo.MesDvTelemetryPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.dv.telemetry.vo.MesDvTelemetryPullRespVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.dv.telemetry.MesDvTelemetryDO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * MES è®¾å¤æ°é饿µæ°æ® Service æ¥å£ |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | public interface MesDvTelemetryService { |
| | | |
| | | /** |
| | | * å页æ¥è¯¢é¥æµæ°æ® |
| | | */ |
| | | PageResult<MesDvTelemetryDO> getTelemetryPage(MesDvTelemetryPageReqVO pageReqVO); |
| | | |
| | | /** |
| | | * æ¥è¯¢åè®¾å¤ææ°é¥æµæ°æ®ï¼æè®¾å¤+ä¿¡å·å»éï¼ä¿çææ°ï¼ |
| | | */ |
| | | List<MesDvTelemetryDO> getLatestTelemetry(MesDvTelemetryLatestReqVO reqVO); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ°é设å¤ä¸æåè¡¨ï¼æ¥èªé¥æµæ°æ®å»éï¼ |
| | | */ |
| | | List<MesDvTelemetryDeviceRespVO> getDeviceList(); |
| | | |
| | | /** |
| | | * è°ç¨å¤é¨æ°éæ¥å£æåè¿ 5 åéè®¾å¤æ°æ®å¹¶å
¥åº |
| | | */ |
| | | MesDvTelemetryPullRespVO pullTelemetry(); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.dv.telemetry; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.http.HttpUtils; |
| | | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.dv.telemetry.vo.MesDvTelemetryDeviceRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.dv.telemetry.vo.MesDvTelemetryLatestReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.dv.telemetry.vo.MesDvTelemetryPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.dv.telemetry.vo.MesDvTelemetryPullRespVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.dv.telemetry.MesDvTelemetryDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.dv.telemetry.MesDvTelemetryMapper; |
| | | import cn.iocoder.yudao.module.mes.framework.config.MesTelemetryProperties; |
| | | import jakarta.annotation.Resource; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.DV_TELEMETRY_PULL_ERROR; |
| | | |
| | | /** |
| | | * MES è®¾å¤æ°é饿µæ°æ® Service å®ç°ç±» |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class MesDvTelemetryServiceImpl implements MesDvTelemetryService { |
| | | |
| | | @Resource |
| | | private MesDvTelemetryMapper telemetryMapper; |
| | | @Resource |
| | | private MesTelemetryProperties telemetryProperties; |
| | | |
| | | @Override |
| | | public PageResult<MesDvTelemetryDO> getTelemetryPage(MesDvTelemetryPageReqVO pageReqVO) { |
| | | return telemetryMapper.selectPage(pageReqVO); |
| | | } |
| | | |
| | | @Override |
| | | public List<MesDvTelemetryDO> getLatestTelemetry(MesDvTelemetryLatestReqVO reqVO) { |
| | | // åæè¿ä¸æ¹æ°æ®ï¼æè®¾å¤+ä¿¡å·å»éä¿çææ°ï¼ç¨äºå®æ¶çæ§è§å¾ |
| | | List<MesDvTelemetryDO> list = telemetryMapper.selectLatest(reqVO, 5000); |
| | | Map<String, MesDvTelemetryDO> latestMap = new LinkedHashMap<>(); |
| | | for (MesDvTelemetryDO row : list) { |
| | | String key = StrUtil.blankToDefault(row.getTbDeviceId(), "") |
| | | + ":" + StrUtil.blankToDefault(row.getParamKeyName(), ""); |
| | | latestMap.putIfAbsent(key, row); |
| | | } |
| | | return new ArrayList<>(latestMap.values()); |
| | | } |
| | | |
| | | @Override |
| | | public List<MesDvTelemetryDeviceRespVO> getDeviceList() { |
| | | List<MesDvTelemetryDeviceRespVO> result = new ArrayList<>(); |
| | | for (MesDvTelemetryDO row : telemetryMapper.selectDeviceList()) { |
| | | MesDvTelemetryDeviceRespVO vo = new MesDvTelemetryDeviceRespVO(); |
| | | vo.setTbDeviceId(row.getTbDeviceId()); |
| | | vo.setDeviceName(row.getDeviceName()); |
| | | result.add(vo); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public MesDvTelemetryPullRespVO pullTelemetry() { |
| | | // 1. æ ¡éªé
ç½® |
| | | if (StrUtil.isBlank(telemetryProperties.getBaseUrl())) { |
| | | throw exception(DV_TELEMETRY_PULL_ERROR, "æªé
ç½®æ°éæå¡å°å yudao.mes.telemetry.base-url"); |
| | | } |
| | | String url = telemetryProperties.getBaseUrl() + telemetryProperties.getPath(); |
| | | // 2. è°ç¨å¤é¨æ°éæ¥å£ |
| | | String responseText; |
| | | try { |
| | | responseText = HttpUtils.get(url, null); |
| | | } catch (Exception e) { |
| | | log.error("[pullTelemetry][è°ç¨æ°éæ¥å£å¤±è´¥ï¼url({})]", url, e); |
| | | throw exception(DV_TELEMETRY_PULL_ERROR, e.getMessage()); |
| | | } |
| | | if (StrUtil.isBlank(responseText)) { |
| | | throw exception(DV_TELEMETRY_PULL_ERROR, "æ°éæ¥å£è¿å为空"); |
| | | } |
| | | // 3. è§£æååº |
| | | Map<?, ?> response = JsonUtils.parseObject(responseText, Map.class); |
| | | if (response == null || !"200".equals(String.valueOf(response.get("code")))) { |
| | | log.error("[pullTelemetry][æ°éæ¥å£è¿åå¼å¸¸ï¼url({})ï¼ååº({})]", url, responseText); |
| | | throw exception(DV_TELEMETRY_PULL_ERROR, "æ°éæ¥å£è¿åå¼å¸¸"); |
| | | } |
| | | List<?> dataList = (List<?>) response.get("data"); |
| | | // 4. æ æ°æ®æ¶è¿åç©ºç»æï¼ä¸è§ä¸ºé误 |
| | | MesDvTelemetryPullRespVO result = new MesDvTelemetryPullRespVO(); |
| | | LocalDateTime pullTime = LocalDateTime.now(); |
| | | result.setPullTime(pullTime); |
| | | if (CollUtil.isEmpty(dataList)) { |
| | | result.setRecordCount(0); |
| | | result.setDeviceCount(0); |
| | | return result; |
| | | } |
| | | // 5. 转æ¢å¹¶æ¹éå
¥åº |
| | | List<MesDvTelemetryDO> saveList = new ArrayList<>(dataList.size()); |
| | | for (Object rowObj : dataList) { |
| | | if (!(rowObj instanceof Map)) { |
| | | continue; |
| | | } |
| | | MesDvTelemetryDO data = convert((Map<?, ?>) rowObj); |
| | | data.setPullTime(pullTime); |
| | | saveList.add(data); |
| | | } |
| | | telemetryMapper.insertBatch(saveList); |
| | | // 6. è¿åç»è®¡ |
| | | result.setRecordCount(saveList.size()); |
| | | result.setDeviceCount((int) saveList.stream() |
| | | .map(MesDvTelemetryDO::getTbDeviceId).distinct().count()); |
| | | return result; |
| | | } |
| | | |
| | | private MesDvTelemetryDO convert(Map<?, ?> row) { |
| | | MesDvTelemetryDO data = new MesDvTelemetryDO(); |
| | | data.setTbDeviceId(StrUtil.toStringOrNull(row.get("tbDeviceId"))); |
| | | data.setDeviceName(StrUtil.toStringOrNull(row.get("deviceName"))); |
| | | data.setParamName(StrUtil.toStringOrNull(row.get("paramName"))); |
| | | data.setParamKeyName(StrUtil.toStringOrNull(row.get("paramKeyName"))); |
| | | data.setStandardValue(StrUtil.toStringOrNull(row.get("standardValue"))); |
| | | data.setTimelyValue(StrUtil.toStringOrNull(row.get("timelyValue"))); |
| | | data.setAvgValue(StrUtil.toStringOrNull(row.get("avgValue"))); |
| | | data.setMaxValue(StrUtil.toStringOrNull(row.get("maxValue"))); |
| | | data.setMinValue(StrUtil.toStringOrNull(row.get("minValue"))); |
| | | data.setWhetherAnomaly(parseBoolean(row.get("whetherAnomaly"))); |
| | | data.setTelemetryDataTime(parseTime(row.get("telemetryDataTime"))); |
| | | data.setBillNo(StrUtil.toStringOrNull(row.get("billNo"))); |
| | | data.setShiftName(StrUtil.toStringOrNull(row.get("shiftName"))); |
| | | return data; |
| | | } |
| | | |
| | | private Boolean parseBoolean(Object value) { |
| | | if (value == null) { |
| | | return null; |
| | | } |
| | | String str = String.valueOf(value).trim(); |
| | | if ("1".equals(str) || "true".equalsIgnoreCase(str) || "Y".equalsIgnoreCase(str)) { |
| | | return Boolean.TRUE; |
| | | } |
| | | if ("0".equals(str) || "false".equalsIgnoreCase(str) || "N".equalsIgnoreCase(str)) { |
| | | return Boolean.FALSE; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | private LocalDateTime parseTime(Object value) { |
| | | if (value == null || StrUtil.isBlank(String.valueOf(value))) { |
| | | return null; |
| | | } |
| | | try { |
| | | return DateUtil.parse(String.valueOf(value)).toLocalDateTime(); |
| | | } catch (Exception e) { |
| | | log.warn("[parseTime][饿µæ¶é´è§£æå¤±è´¥ï¼value({})]", value); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.basedata; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdDiscountPolicyPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdDiscountPolicyRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdDiscountPolicySaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata.MesPdDiscountPolicyDO; |
| | | |
| | | /** |
| | | * MES 伿 çç¥ Service æ¥å£ |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | public interface MesPdDiscountPolicyService { |
| | | |
| | | Long createDiscountPolicy(MesPdDiscountPolicySaveReqVO createReqVO); |
| | | |
| | | void updateDiscountPolicy(MesPdDiscountPolicySaveReqVO updateReqVO); |
| | | |
| | | void deleteDiscountPolicy(Long id); |
| | | |
| | | MesPdDiscountPolicyRespVO getDiscountPolicy(Long id); |
| | | |
| | | PageResult<MesPdDiscountPolicyRespVO> getDiscountPolicyPage(MesPdDiscountPolicyPageReqVO pageReqVO); |
| | | |
| | | MesPdDiscountPolicyDO validateDiscountPolicyExists(Long id); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.basedata; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.dict.core.DictFrameworkUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdDiscountPolicyPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdDiscountPolicyRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdDiscountPolicySaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata.MesPdDiscountPolicyDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.pd.basedata.MesPdDiscountPolicyMapper; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PD_DISCOUNT_POLICY_NOT_EXISTS; |
| | | |
| | | /** |
| | | * MES 伿 çç¥ Service å®ç°ç±» |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @Service |
| | | @Validated |
| | | public class MesPdDiscountPolicyServiceImpl implements MesPdDiscountPolicyService { |
| | | |
| | | @Resource |
| | | private MesPdDiscountPolicyMapper discountPolicyMapper; |
| | | |
| | | @Override |
| | | public Long createDiscountPolicy(MesPdDiscountPolicySaveReqVO createReqVO) { |
| | | MesPdDiscountPolicyDO entity = BeanUtils.toBean(createReqVO, MesPdDiscountPolicyDO.class); |
| | | discountPolicyMapper.insert(entity); |
| | | return entity.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void updateDiscountPolicy(MesPdDiscountPolicySaveReqVO updateReqVO) { |
| | | validateDiscountPolicyExists(updateReqVO.getId()); |
| | | MesPdDiscountPolicyDO entity = BeanUtils.toBean(updateReqVO, MesPdDiscountPolicyDO.class); |
| | | discountPolicyMapper.updateById(entity); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteDiscountPolicy(Long id) { |
| | | validateDiscountPolicyExists(id); |
| | | discountPolicyMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public MesPdDiscountPolicyRespVO getDiscountPolicy(Long id) { |
| | | MesPdDiscountPolicyDO entity = discountPolicyMapper.selectById(id); |
| | | if (entity == null) { |
| | | return null; |
| | | } |
| | | MesPdDiscountPolicyRespVO respVO = BeanUtils.toBean(entity, MesPdDiscountPolicyRespVO.class); |
| | | fillDictName(respVO); |
| | | return respVO; |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<MesPdDiscountPolicyRespVO> getDiscountPolicyPage(MesPdDiscountPolicyPageReqVO pageReqVO) { |
| | | PageResult<MesPdDiscountPolicyDO> page = discountPolicyMapper.selectPage(pageReqVO); |
| | | PageResult<MesPdDiscountPolicyRespVO> result = BeanUtils.toBean(page, MesPdDiscountPolicyRespVO.class); |
| | | result.getList().forEach(this::fillDictName); |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public MesPdDiscountPolicyDO validateDiscountPolicyExists(Long id) { |
| | | MesPdDiscountPolicyDO entity = discountPolicyMapper.selectById(id); |
| | | if (entity == null) { |
| | | throw exception(PD_DISCOUNT_POLICY_NOT_EXISTS); |
| | | } |
| | | return entity; |
| | | } |
| | | |
| | | private void fillDictName(MesPdDiscountPolicyRespVO respVO) { |
| | | respVO.setPolicyTypeName(DictFrameworkUtils.parseDictDataLabel( |
| | | DictTypeConstants.MES_PD_DISCOUNT_POLICY_TYPE, respVO.getPolicyType())); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.basedata; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdElectricityTypePageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdElectricityTypeRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdElectricityTypeSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata.MesPdElectricityTypeDO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * MES ç¨çµç±»ååºç¡ä¿¡æ¯ Service æ¥å£ |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | public interface MesPdElectricityTypeService { |
| | | |
| | | Long createElectricityType(MesPdElectricityTypeSaveReqVO createReqVO); |
| | | |
| | | void updateElectricityType(MesPdElectricityTypeSaveReqVO updateReqVO); |
| | | |
| | | void deleteElectricityType(Long id); |
| | | |
| | | MesPdElectricityTypeRespVO getElectricityType(Long id); |
| | | |
| | | PageResult<MesPdElectricityTypeRespVO> getElectricityTypePage(MesPdElectricityTypePageReqVO pageReqVO); |
| | | |
| | | List<MesPdElectricityTypeDO> getElectricityTypeList(); |
| | | |
| | | MesPdElectricityTypeDO validateElectricityTypeExists(Long id); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.basedata; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdElectricityTypePageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdElectricityTypeRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdElectricityTypeSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata.MesPdElectricityTypeDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.pd.basedata.MesPdElectricityTypeMapper; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.util.List; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PD_ELECTRICITY_TYPE_NOT_EXISTS; |
| | | |
| | | /** |
| | | * MES ç¨çµç±»ååºç¡ä¿¡æ¯ Service å®ç°ç±» |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @Service |
| | | @Validated |
| | | public class MesPdElectricityTypeServiceImpl implements MesPdElectricityTypeService { |
| | | |
| | | @Resource |
| | | private MesPdElectricityTypeMapper electricityTypeMapper; |
| | | |
| | | @Override |
| | | public Long createElectricityType(MesPdElectricityTypeSaveReqVO createReqVO) { |
| | | MesPdElectricityTypeDO entity = BeanUtils.toBean(createReqVO, MesPdElectricityTypeDO.class); |
| | | electricityTypeMapper.insert(entity); |
| | | return entity.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void updateElectricityType(MesPdElectricityTypeSaveReqVO updateReqVO) { |
| | | validateElectricityTypeExists(updateReqVO.getId()); |
| | | MesPdElectricityTypeDO entity = BeanUtils.toBean(updateReqVO, MesPdElectricityTypeDO.class); |
| | | electricityTypeMapper.updateById(entity); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteElectricityType(Long id) { |
| | | validateElectricityTypeExists(id); |
| | | electricityTypeMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public MesPdElectricityTypeRespVO getElectricityType(Long id) { |
| | | MesPdElectricityTypeDO entity = electricityTypeMapper.selectById(id); |
| | | return entity == null ? null : BeanUtils.toBean(entity, MesPdElectricityTypeRespVO.class); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<MesPdElectricityTypeRespVO> getElectricityTypePage(MesPdElectricityTypePageReqVO pageReqVO) { |
| | | return BeanUtils.toBean(electricityTypeMapper.selectPage(pageReqVO), MesPdElectricityTypeRespVO.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<MesPdElectricityTypeDO> getElectricityTypeList() { |
| | | return electricityTypeMapper.selectList(); |
| | | } |
| | | |
| | | @Override |
| | | public MesPdElectricityTypeDO validateElectricityTypeExists(Long id) { |
| | | MesPdElectricityTypeDO entity = electricityTypeMapper.selectById(id); |
| | | if (entity == null) { |
| | | throw exception(PD_ELECTRICITY_TYPE_NOT_EXISTS); |
| | | } |
| | | return entity; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.basedata; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdPriceStandardPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdPriceStandardRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdPriceStandardSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata.MesPdPriceStandardDO; |
| | | |
| | | /** |
| | | * MES å®ä»·æ å Service æ¥å£ |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | public interface MesPdPriceStandardService { |
| | | |
| | | Long createPriceStandard(MesPdPriceStandardSaveReqVO createReqVO); |
| | | |
| | | void updatePriceStandard(MesPdPriceStandardSaveReqVO updateReqVO); |
| | | |
| | | void deletePriceStandard(Long id); |
| | | |
| | | MesPdPriceStandardRespVO getPriceStandard(Long id); |
| | | |
| | | PageResult<MesPdPriceStandardRespVO> getPriceStandardPage(MesPdPriceStandardPageReqVO pageReqVO); |
| | | |
| | | MesPdPriceStandardDO validatePriceStandardExists(Long id); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.basedata; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.dict.core.DictFrameworkUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdPriceStandardPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdPriceStandardRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdPriceStandardSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata.MesPdPriceStandardDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.pd.basedata.MesPdPriceStandardMapper; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PD_PRICE_STANDARD_NOT_EXISTS; |
| | | |
| | | /** |
| | | * MES å®ä»·æ å Service å®ç°ç±» |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @Service |
| | | @Validated |
| | | public class MesPdPriceStandardServiceImpl implements MesPdPriceStandardService { |
| | | |
| | | @Resource |
| | | private MesPdPriceStandardMapper priceStandardMapper; |
| | | |
| | | @Override |
| | | public Long createPriceStandard(MesPdPriceStandardSaveReqVO createReqVO) { |
| | | MesPdPriceStandardDO entity = BeanUtils.toBean(createReqVO, MesPdPriceStandardDO.class); |
| | | priceStandardMapper.insert(entity); |
| | | return entity.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void updatePriceStandard(MesPdPriceStandardSaveReqVO updateReqVO) { |
| | | validatePriceStandardExists(updateReqVO.getId()); |
| | | MesPdPriceStandardDO entity = BeanUtils.toBean(updateReqVO, MesPdPriceStandardDO.class); |
| | | priceStandardMapper.updateById(entity); |
| | | } |
| | | |
| | | @Override |
| | | public void deletePriceStandard(Long id) { |
| | | validatePriceStandardExists(id); |
| | | priceStandardMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public MesPdPriceStandardRespVO getPriceStandard(Long id) { |
| | | MesPdPriceStandardDO entity = priceStandardMapper.selectById(id); |
| | | if (entity == null) { |
| | | return null; |
| | | } |
| | | MesPdPriceStandardRespVO respVO = BeanUtils.toBean(entity, MesPdPriceStandardRespVO.class); |
| | | fillDictName(respVO); |
| | | return respVO; |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<MesPdPriceStandardRespVO> getPriceStandardPage(MesPdPriceStandardPageReqVO pageReqVO) { |
| | | PageResult<MesPdPriceStandardDO> page = priceStandardMapper.selectPage(pageReqVO); |
| | | PageResult<MesPdPriceStandardRespVO> result = BeanUtils.toBean(page, MesPdPriceStandardRespVO.class); |
| | | result.getList().forEach(this::fillDictName); |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public MesPdPriceStandardDO validatePriceStandardExists(Long id) { |
| | | MesPdPriceStandardDO entity = priceStandardMapper.selectById(id); |
| | | if (entity == null) { |
| | | throw exception(PD_PRICE_STANDARD_NOT_EXISTS); |
| | | } |
| | | return entity; |
| | | } |
| | | |
| | | private void fillDictName(MesPdPriceStandardRespVO respVO) { |
| | | respVO.setObjectTypeName(DictFrameworkUtils.parseDictDataLabel( |
| | | DictTypeConstants.MES_PD_PRICE_OBJECT_TYPE, respVO.getObjectType())); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.basedata; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdServicePackagePageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdServicePackageRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdServicePackageSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata.MesPdServicePackageDO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * MES æå¡å¥é¤åºç¡ä¿¡æ¯ Service æ¥å£ |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | public interface MesPdServicePackageService { |
| | | |
| | | Long createServicePackage(MesPdServicePackageSaveReqVO createReqVO); |
| | | |
| | | void updateServicePackage(MesPdServicePackageSaveReqVO updateReqVO); |
| | | |
| | | void deleteServicePackage(Long id); |
| | | |
| | | MesPdServicePackageRespVO getServicePackage(Long id); |
| | | |
| | | PageResult<MesPdServicePackageRespVO> getServicePackagePage(MesPdServicePackagePageReqVO pageReqVO); |
| | | |
| | | List<MesPdServicePackageDO> getServicePackageList(); |
| | | |
| | | MesPdServicePackageDO validateServicePackageExists(Long id); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.basedata; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdServicePackagePageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdServicePackageRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdServicePackageSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata.MesPdServicePackageDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.pd.basedata.MesPdServicePackageMapper; |
| | | import cn.iocoder.yudao.module.mes.enums.md.autocode.MesMdAutoCodeRuleCodeEnum; |
| | | import cn.iocoder.yudao.module.mes.service.md.autocode.MesMdAutoCodeRecordService; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.util.List; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PD_SERVICE_PACKAGE_NOT_EXISTS; |
| | | |
| | | /** |
| | | * MES æå¡å¥é¤åºç¡ä¿¡æ¯ Service å®ç°ç±» |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @Service |
| | | @Validated |
| | | public class MesPdServicePackageServiceImpl implements MesPdServicePackageService { |
| | | |
| | | @Resource |
| | | private MesPdServicePackageMapper servicePackageMapper; |
| | | |
| | | @Resource |
| | | @Lazy |
| | | private MesMdAutoCodeRecordService autoCodeRecordService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long createServicePackage(MesPdServicePackageSaveReqVO createReqVO) { |
| | | MesPdServicePackageDO entity = BeanUtils.toBean(createReqVO, MesPdServicePackageDO.class); |
| | | entity.setCode(autoCodeRecordService.generateAutoCode(MesMdAutoCodeRuleCodeEnum.PD_PACKAGE_CODE.getCode())); |
| | | servicePackageMapper.insert(entity); |
| | | return entity.getId(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateServicePackage(MesPdServicePackageSaveReqVO updateReqVO) { |
| | | MesPdServicePackageDO packageDO = validateServicePackageExists(updateReqVO.getId()); |
| | | MesPdServicePackageDO entity = BeanUtils.toBean(updateReqVO, MesPdServicePackageDO.class); |
| | | entity.setCode(packageDO.getCode()); |
| | | servicePackageMapper.updateById(entity); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteServicePackage(Long id) { |
| | | validateServicePackageExists(id); |
| | | servicePackageMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public MesPdServicePackageRespVO getServicePackage(Long id) { |
| | | MesPdServicePackageDO entity = servicePackageMapper.selectById(id); |
| | | return entity == null ? null : BeanUtils.toBean(entity, MesPdServicePackageRespVO.class); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<MesPdServicePackageRespVO> getServicePackagePage(MesPdServicePackagePageReqVO pageReqVO) { |
| | | return BeanUtils.toBean(servicePackageMapper.selectPage(pageReqVO), MesPdServicePackageRespVO.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<MesPdServicePackageDO> getServicePackageList() { |
| | | return servicePackageMapper.selectList(); |
| | | } |
| | | |
| | | @Override |
| | | public MesPdServicePackageDO validateServicePackageExists(Long id) { |
| | | MesPdServicePackageDO entity = servicePackageMapper.selectById(id); |
| | | if (entity == null) { |
| | | throw exception(PD_SERVICE_PACKAGE_NOT_EXISTS); |
| | | } |
| | | return entity; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.basedata; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdTieredPricePageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdTieredPriceRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdTieredPriceSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata.MesPdTieredPriceDO; |
| | | |
| | | /** |
| | | * MES é¶æ¢¯çµä»· Service æ¥å£ |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | public interface MesPdTieredPriceService { |
| | | |
| | | Long createTieredPrice(MesPdTieredPriceSaveReqVO createReqVO); |
| | | |
| | | void updateTieredPrice(MesPdTieredPriceSaveReqVO updateReqVO); |
| | | |
| | | void deleteTieredPrice(Long id); |
| | | |
| | | MesPdTieredPriceRespVO getTieredPrice(Long id); |
| | | |
| | | PageResult<MesPdTieredPriceRespVO> getTieredPricePage(MesPdTieredPricePageReqVO pageReqVO); |
| | | |
| | | MesPdTieredPriceDO validateTieredPriceExists(Long id); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.basedata; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdTieredPricePageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdTieredPriceRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdTieredPriceSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata.MesPdTieredPriceDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.pd.basedata.MesPdTieredPriceMapper; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PD_TIERED_PRICE_NOT_EXISTS; |
| | | |
| | | /** |
| | | * MES é¶æ¢¯çµä»· Service å®ç°ç±» |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @Service |
| | | @Validated |
| | | public class MesPdTieredPriceServiceImpl implements MesPdTieredPriceService { |
| | | |
| | | @Resource |
| | | private MesPdTieredPriceMapper tieredPriceMapper; |
| | | |
| | | @Override |
| | | public Long createTieredPrice(MesPdTieredPriceSaveReqVO createReqVO) { |
| | | MesPdTieredPriceDO entity = BeanUtils.toBean(createReqVO, MesPdTieredPriceDO.class); |
| | | tieredPriceMapper.insert(entity); |
| | | return entity.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void updateTieredPrice(MesPdTieredPriceSaveReqVO updateReqVO) { |
| | | validateTieredPriceExists(updateReqVO.getId()); |
| | | MesPdTieredPriceDO entity = BeanUtils.toBean(updateReqVO, MesPdTieredPriceDO.class); |
| | | tieredPriceMapper.updateById(entity); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteTieredPrice(Long id) { |
| | | validateTieredPriceExists(id); |
| | | tieredPriceMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public MesPdTieredPriceRespVO getTieredPrice(Long id) { |
| | | MesPdTieredPriceDO entity = tieredPriceMapper.selectById(id); |
| | | return entity == null ? null : BeanUtils.toBean(entity, MesPdTieredPriceRespVO.class); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<MesPdTieredPriceRespVO> getTieredPricePage(MesPdTieredPricePageReqVO pageReqVO) { |
| | | return BeanUtils.toBean(tieredPriceMapper.selectPage(pageReqVO), MesPdTieredPriceRespVO.class); |
| | | } |
| | | |
| | | @Override |
| | | public MesPdTieredPriceDO validateTieredPriceExists(Long id) { |
| | | MesPdTieredPriceDO entity = tieredPriceMapper.selectById(id); |
| | | if (entity == null) { |
| | | throw exception(PD_TIERED_PRICE_NOT_EXISTS); |
| | | } |
| | | return entity; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.basedata; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdVoltageLevelPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdVoltageLevelRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdVoltageLevelSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata.MesPdVoltageLevelDO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * MES çµåç级åºç¡ä¿¡æ¯ Service æ¥å£ |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | public interface MesPdVoltageLevelService { |
| | | |
| | | Long createVoltageLevel(MesPdVoltageLevelSaveReqVO createReqVO); |
| | | |
| | | void updateVoltageLevel(MesPdVoltageLevelSaveReqVO updateReqVO); |
| | | |
| | | void deleteVoltageLevel(Long id); |
| | | |
| | | MesPdVoltageLevelRespVO getVoltageLevel(Long id); |
| | | |
| | | PageResult<MesPdVoltageLevelRespVO> getVoltageLevelPage(MesPdVoltageLevelPageReqVO pageReqVO); |
| | | |
| | | List<MesPdVoltageLevelDO> getVoltageLevelList(); |
| | | |
| | | MesPdVoltageLevelDO validateVoltageLevelExists(Long id); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.basedata; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdVoltageLevelPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdVoltageLevelRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.basedata.vo.MesPdVoltageLevelSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata.MesPdVoltageLevelDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.pd.basedata.MesPdVoltageLevelMapper; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.util.List; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PD_VOLTAGE_LEVEL_NOT_EXISTS; |
| | | |
| | | /** |
| | | * MES çµåç级åºç¡ä¿¡æ¯ Service å®ç°ç±» |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @Service |
| | | @Validated |
| | | public class MesPdVoltageLevelServiceImpl implements MesPdVoltageLevelService { |
| | | |
| | | @Resource |
| | | private MesPdVoltageLevelMapper voltageLevelMapper; |
| | | |
| | | @Override |
| | | public Long createVoltageLevel(MesPdVoltageLevelSaveReqVO createReqVO) { |
| | | MesPdVoltageLevelDO entity = BeanUtils.toBean(createReqVO, MesPdVoltageLevelDO.class); |
| | | voltageLevelMapper.insert(entity); |
| | | return entity.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void updateVoltageLevel(MesPdVoltageLevelSaveReqVO updateReqVO) { |
| | | validateVoltageLevelExists(updateReqVO.getId()); |
| | | MesPdVoltageLevelDO entity = BeanUtils.toBean(updateReqVO, MesPdVoltageLevelDO.class); |
| | | voltageLevelMapper.updateById(entity); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteVoltageLevel(Long id) { |
| | | validateVoltageLevelExists(id); |
| | | voltageLevelMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public MesPdVoltageLevelRespVO getVoltageLevel(Long id) { |
| | | MesPdVoltageLevelDO entity = voltageLevelMapper.selectById(id); |
| | | return entity == null ? null : BeanUtils.toBean(entity, MesPdVoltageLevelRespVO.class); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<MesPdVoltageLevelRespVO> getVoltageLevelPage(MesPdVoltageLevelPageReqVO pageReqVO) { |
| | | return BeanUtils.toBean(voltageLevelMapper.selectPage(pageReqVO), MesPdVoltageLevelRespVO.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<MesPdVoltageLevelDO> getVoltageLevelList() { |
| | | return voltageLevelMapper.selectList(); |
| | | } |
| | | |
| | | @Override |
| | | public MesPdVoltageLevelDO validateVoltageLevelExists(Long id) { |
| | | MesPdVoltageLevelDO entity = voltageLevelMapper.selectById(id); |
| | | if (entity == null) { |
| | | throw exception(PD_VOLTAGE_LEVEL_NOT_EXISTS); |
| | | } |
| | | return entity; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.ctc; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.ctc.vo.*; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.ctc.ProductCtcDO; |
| | | |
| | | /** |
| | | * MES æ¢ä½å¯¼çº¿äº§åææ¯åæ° Service æ¥å£ |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | public interface ProductCtcService { |
| | | |
| | | Long createCtc(ProductCtcSaveReqVO createReqVO); |
| | | |
| | | void updateCtc(ProductCtcSaveReqVO updateReqVO); |
| | | |
| | | void deleteCtc(Long id); |
| | | |
| | | ProductCtcDO getCtc(Long id); |
| | | |
| | | PageResult<ProductCtcDO> getCtcPage(ProductCtcPageReqVO pageReqVO); |
| | | |
| | | /** |
| | | * ç»å
è§åº¦è®¡ç®ï¼å·²ç¥çº¸å¸¦å®½åº¦ï¼è®¡ç®æå¤å±ç»å
è§åº¦ï¼ |
| | | */ |
| | | ProductCtcAngleCalcRespVO calcAngle(ProductCtcAngleCalcReqVO reqVO); |
| | | |
| | | /** |
| | | * ç´æµçµé»è®¡ç®ï¼ææ¸©åº¦æ¢ç®ï¼ |
| | | */ |
| | | ProductCtcResistanceCalcRespVO calcResistance(ProductCtcResistanceCalcReqVO reqVO); |
| | | |
| | | /** |
| | | * çå
·å®¹é计ç®ï¼æ¯çæå¤§é¿åº¦ï¼ |
| | | */ |
| | | ProductCtcReelCalcRespVO calcReelCapacity(ProductCtcReelCalcReqVO reqVO); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.ctc; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.mdm.api.item.MdmItemApi; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.ctc.vo.*; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.ctc.ProductCtcDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.pd.ctc.ProductCtcMapper; |
| | | import cn.iocoder.yudao.module.mes.service.pd.reel.ProductCtcReelService; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PD_CTC_CALC_PARAM_INVALID; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PD_CTC_ITEM_DUPLICATE; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PD_CTC_NOT_EXISTS; |
| | | |
| | | /** |
| | | * MES æ¢ä½å¯¼çº¿äº§åææ¯åæ° Service å®ç°ç±» |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @Service |
| | | @Validated |
| | | public class ProductCtcServiceImpl implements ProductCtcService { |
| | | |
| | | @Resource |
| | | private ProductCtcMapper ctcMapper; |
| | | |
| | | @Resource |
| | | private MdmItemApi mdmItemApi; |
| | | @Resource |
| | | private ProductCtcReelService reelService; |
| | | |
| | | @Override |
| | | public Long createCtc(ProductCtcSaveReqVO createReqVO) { |
| | | // æ ¡éªç©æåå¨ |
| | | mdmItemApi.validateItemExists(createReqVO.getItemId()); |
| | | // æ ¡éªç©æå¯ä¸ |
| | | validateItemUnique(createReqVO.getItemId(), null); |
| | | // æå
¥ |
| | | ProductCtcDO ctc = BeanUtils.toBean(createReqVO, ProductCtcDO.class); |
| | | ctcMapper.insert(ctc); |
| | | return ctc.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void updateCtc(ProductCtcSaveReqVO updateReqVO) { |
| | | // æ ¡éªåå¨ |
| | | ProductCtcDO ctc = validateCtcExists(updateReqVO.getId()); |
| | | // æ ¡éªç©æåå¨ |
| | | mdmItemApi.validateItemExists(updateReqVO.getItemId()); |
| | | // æ ¡éªç©æå¯ä¸ï¼æé¤èªèº«ï¼ |
| | | validateItemUnique(updateReqVO.getItemId(), updateReqVO.getId()); |
| | | // æ´æ° |
| | | ProductCtcDO updateObj = BeanUtils.toBean(updateReqVO, ProductCtcDO.class); |
| | | ctcMapper.updateById(updateObj); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteCtc(Long id) { |
| | | // æ ¡éªåå¨ |
| | | validateCtcExists(id); |
| | | // å é¤å
³èçå
· |
| | | reelService.deleteByCtcId(id); |
| | | // å é¤ |
| | | ctcMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public ProductCtcDO getCtc(Long id) { |
| | | return ctcMapper.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<ProductCtcDO> getCtcPage(ProductCtcPageReqVO pageReqVO) { |
| | | return ctcMapper.selectPage(pageReqVO); |
| | | } |
| | | |
| | | @Override |
| | | public ProductCtcAngleCalcRespVO calcAngle(ProductCtcAngleCalcReqVO reqVO) { |
| | | double a = reqVO.getConductorThickness().doubleValue(); |
| | | double b = reqVO.getConductorWidth().doubleValue(); |
| | | double r = reqVO.getCornerRadius().doubleValue(); |
| | | double t = reqVO.getInsulationThickness().doubleValue(); |
| | | double w = reqVO.getTapeWidth().doubleValue(); |
| | | double overlap = reqVO.getOverlapWidth().doubleValue(); |
| | | // 导线å¨é¿ï¼åè§ç©å½¢ï¼å度æ¹åå«ç»ç¼ï¼å®½åº¦æ¹åä¸å« |
| | | double circumference = 2 * (a + b + 2 * t) - (8 - 2 * Math.PI) * r; |
| | | // ææçº¸å¸¦å®½åº¦ = 纸带宽度 - éå 宽度 |
| | | double effectiveWidth = w - overlap; |
| | | if (circumference <= 0 || effectiveWidth <= 0 || effectiveWidth > circumference) { |
| | | throw exception(PD_CTC_CALC_PARAM_INVALID); |
| | | } |
| | | double angle = Math.asin(effectiveWidth / circumference); |
| | | double angleDeg = Math.toDegrees(angle); |
| | | double pitch = effectiveWidth / Math.cos(angle); |
| | | ProductCtcAngleCalcRespVO respVO = new ProductCtcAngleCalcRespVO(); |
| | | respVO.setCircumference(BigDecimal.valueOf(circumference).setScale(6, RoundingMode.HALF_UP)); |
| | | respVO.setWrappingAngle(BigDecimal.valueOf(angleDeg).setScale(6, RoundingMode.HALF_UP)); |
| | | respVO.setWrappingPitch(BigDecimal.valueOf(pitch).setScale(6, RoundingMode.HALF_UP)); |
| | | return respVO; |
| | | } |
| | | |
| | | @Override |
| | | public ProductCtcResistanceCalcRespVO calcResistance(ProductCtcResistanceCalcReqVO reqVO) { |
| | | double thickness = reqVO.getConductorThickness().doubleValue(); |
| | | double width = reqVO.getConductorWidth().doubleValue(); |
| | | double temp = reqVO.getTemperature().doubleValue(); |
| | | // æè´¨åæ°ï¼é/éï¼Ï20 åä½ Î©Â·mm²/mï¼Î± åä½ 1/âï¼ |
| | | double rho20; |
| | | double alpha; |
| | | if ("aluminum".equalsIgnoreCase(reqVO.getMaterial())) { |
| | | rho20 = 0.0283; |
| | | alpha = 0.00403; |
| | | } else { |
| | | rho20 = 0.0175; |
| | | alpha = 0.00393; |
| | | } |
| | | double area = thickness * width; |
| | | if (area <= 0) { |
| | | throw exception(PD_CTC_CALC_PARAM_INVALID); |
| | | } |
| | | // R20 = Ï20 / Aï¼Î©/mï¼ |
| | | double r20 = rho20 / area; |
| | | // Rt = R20 à (1 + α à (t - 20)) |
| | | double rt = r20 * (1 + alpha * (temp - 20)); |
| | | ProductCtcResistanceCalcRespVO respVO = new ProductCtcResistanceCalcRespVO(); |
| | | respVO.setCrossSection(BigDecimal.valueOf(area).setScale(6, RoundingMode.HALF_UP)); |
| | | respVO.setResistance20cKm(BigDecimal.valueOf(r20 * 1000).setScale(6, RoundingMode.HALF_UP)); |
| | | respVO.setResistanceAtTemp(BigDecimal.valueOf(rt).setScale(6, RoundingMode.HALF_UP)); |
| | | respVO.setResistanceAtTempKm(BigDecimal.valueOf(rt * 1000).setScale(6, RoundingMode.HALF_UP)); |
| | | return respVO; |
| | | } |
| | | |
| | | @Override |
| | | public ProductCtcReelCalcRespVO calcReelCapacity(ProductCtcReelCalcReqVO reqVO) { |
| | | double d1 = reqVO.getReelOuterDiameter().doubleValue(); |
| | | double d2 = reqVO.getReelInnerDiameter().doubleValue(); |
| | | double l2 = reqVO.getReelWidth().doubleValue(); |
| | | double ct = reqVO.getCtcThickness().doubleValue(); |
| | | double cw = reqVO.getCtcWidth().doubleValue(); |
| | | if (d1 <= d2 || l2 <= 0 || ct <= 0 || cw <= 0) { |
| | | throw exception(PD_CTC_CALC_PARAM_INVALID); |
| | | } |
| | | // çå
·å®¹éå
¬å¼ï¼åç
§éæ±ææ¡£çå
·è®¡ç® sheetï¼ï¼ |
| | | // ((d1-60)+(d2+10)) à INT(l2/(CTC宽+1)) à (d1-d2-70) / (CTCé«+0.2) / 1274 |
| | | double capacityM = ((d1 - 60) + (d2 + 10)) * Math.floor(l2 / (cw + 1)) |
| | | * (d1 - d2 - 70) / (ct + 0.2) / 1274; |
| | | ProductCtcReelCalcRespVO respVO = new ProductCtcReelCalcRespVO(); |
| | | respVO.setCapacityMeter(BigDecimal.valueOf(capacityM).setScale(2, RoundingMode.HALF_UP)); |
| | | respVO.setCapacityKm(BigDecimal.valueOf(capacityM / 1000).setScale(4, RoundingMode.HALF_UP)); |
| | | return respVO; |
| | | } |
| | | |
| | | private void validateItemUnique(Long itemId, Long excludeId) { |
| | | ProductCtcDO ctc = ctcMapper.selectByItemId(itemId); |
| | | if (ctc != null && !ctc.getId().equals(excludeId)) { |
| | | throw exception(PD_CTC_ITEM_DUPLICATE); |
| | | } |
| | | } |
| | | |
| | | private ProductCtcDO validateCtcExists(Long id) { |
| | | ProductCtcDO ctc = ctcMapper.selectById(id); |
| | | if (ctc == null) { |
| | | throw exception(PD_CTC_NOT_EXISTS); |
| | | } |
| | | return ctc; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.price; |
| | | |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.price.vo.MesPdPriceCalcReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.price.vo.MesPdPriceCalcRespVO; |
| | | |
| | | /** |
| | | * MES é¶æ¢¯çµä»·æµç® Service æ¥å£ |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | public interface MesPdPriceService { |
| | | |
| | | /** |
| | | * é¶æ¢¯çµä»·æµç®ï¼æç¨çµéåæ¡£ç´¯è®¡ï¼å å 伿 çç¥ |
| | | * |
| | | * @param reqVO æµç®è¯·æ± |
| | | * @return æµç®ç»æ |
| | | */ |
| | | MesPdPriceCalcRespVO calcPrice(MesPdPriceCalcReqVO reqVO); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.price; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.price.vo.MesPdPriceCalcDetailRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.price.vo.MesPdPriceCalcReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.price.vo.MesPdPriceCalcRespVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata.MesPdDiscountPolicyDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata.MesPdServicePackageDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata.MesPdTieredPriceDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.basedata.MesPdVoltageLevelDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.pd.basedata.MesPdDiscountPolicyMapper; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.pd.basedata.MesPdTieredPriceMapper; |
| | | import cn.iocoder.yudao.module.mes.service.pd.basedata.MesPdServicePackageService; |
| | | import cn.iocoder.yudao.module.mes.service.pd.basedata.MesPdVoltageLevelService; |
| | | import jakarta.annotation.Resource; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PD_PRICE_CALC_OBJECT_NOT_CONFIGURED; |
| | | |
| | | /** |
| | | * MES é¶æ¢¯çµä»·æµç® Service å®ç°ç±» |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @Service |
| | | @Validated |
| | | @Slf4j |
| | | public class MesPdPriceServiceImpl implements MesPdPriceService { |
| | | |
| | | private static final Integer CALC_TYPE_PACKAGE = 1; |
| | | private static final Integer CALC_TYPE_VOLTAGE = 2; |
| | | |
| | | @Resource |
| | | private MesPdTieredPriceMapper tieredPriceMapper; |
| | | |
| | | @Resource |
| | | private MesPdDiscountPolicyMapper discountPolicyMapper; |
| | | |
| | | @Resource |
| | | private MesPdServicePackageService servicePackageService; |
| | | |
| | | @Resource |
| | | private MesPdVoltageLevelService voltageLevelService; |
| | | |
| | | @Override |
| | | public MesPdPriceCalcRespVO calcPrice(MesPdPriceCalcReqVO reqVO) { |
| | | // 1. å®ä½é¶æ¢¯çµä»·æ¡£ä½ |
| | | List<MesPdTieredPriceDO> tiers = getTieredPrices(reqVO); |
| | | if (CollUtil.isEmpty(tiers)) { |
| | | throw exception(PD_PRICE_CALC_OBJECT_NOT_CONFIGURED); |
| | | } |
| | | // 2. åæ¡£ç´¯è®¡è®¡ç®åä»· |
| | | BigDecimal quantity = reqVO.getQuantity(); |
| | | BigDecimal originalPrice = BigDecimal.ZERO; |
| | | List<MesPdPriceCalcDetailRespVO> details = new ArrayList<>(); |
| | | for (MesPdTieredPriceDO tier : tiers) { |
| | | BigDecimal lower = tier.getStartValue(); |
| | | BigDecimal upper = tier.getEndValue(); |
| | | if (quantity.compareTo(lower) <= 0) { |
| | | break; |
| | | } |
| | | BigDecimal upperBound = upper == null ? quantity : upper.min(quantity); |
| | | BigDecimal tierQuantity = upperBound.subtract(lower); |
| | | if (tierQuantity.signum() <= 0) { |
| | | continue; |
| | | } |
| | | BigDecimal subtotal = tier.getPricePerUnit().multiply(tierQuantity); |
| | | originalPrice = originalPrice.add(subtotal); |
| | | MesPdPriceCalcDetailRespVO detail = new MesPdPriceCalcDetailRespVO(); |
| | | detail.setStartValue(lower); |
| | | detail.setEndValue(upper); |
| | | detail.setTierQuantity(tierQuantity); |
| | | detail.setPricePerUnit(tier.getPricePerUnit()); |
| | | detail.setSubtotal(subtotal); |
| | | details.add(detail); |
| | | if (upper != null && quantity.compareTo(upper) <= 0) { |
| | | break; |
| | | } |
| | | } |
| | | // 3. å å 伿 çç¥ï¼ç®æ ä¸å± + å
¨å±ï¼åæä¼ï¼ |
| | | BigDecimal finalPrice = originalPrice; |
| | | Integer targetType = Objects.equals(CALC_TYPE_PACKAGE, reqVO.getCalcType()) ? 1 : 2; |
| | | Long targetId = Objects.equals(CALC_TYPE_PACKAGE, reqVO.getCalcType()) ? reqVO.getPackageId() : reqVO.getVoltageLevelId(); |
| | | List<MesPdDiscountPolicyDO> policies = discountPolicyMapper.selectListByTarget(targetType, targetId); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | for (MesPdDiscountPolicyDO policy : policies) { |
| | | if (policy.getStartDate() != null && now.isBefore(policy.getStartDate())) { |
| | | continue; |
| | | } |
| | | if (policy.getEndDate() != null && now.isAfter(policy.getEndDate())) { |
| | | continue; |
| | | } |
| | | if (policy.getPolicyValue() == null) { |
| | | continue; |
| | | } |
| | | BigDecimal candidate; |
| | | if (Objects.equals(policy.getPolicyType(), 1)) { // ææ£ |
| | | candidate = originalPrice.multiply(policy.getPolicyValue()); |
| | | } else { // ç«å |
| | | candidate = originalPrice.subtract(policy.getPolicyValue()).max(BigDecimal.ZERO); |
| | | } |
| | | finalPrice = finalPrice.min(candidate); |
| | | } |
| | | // 4. ç»è£
è¿å |
| | | MesPdPriceCalcRespVO respVO = new MesPdPriceCalcRespVO(); |
| | | respVO.setOriginalPrice(originalPrice); |
| | | respVO.setFinalPrice(finalPrice); |
| | | respVO.setDiscountAmount(originalPrice.subtract(finalPrice)); |
| | | respVO.setDetails(details); |
| | | if (reqVO.getPackageId() != null) { |
| | | MesPdServicePackageDO pkg = servicePackageService.validateServicePackageExists(reqVO.getPackageId()); |
| | | respVO.setPackageName(pkg.getName()); |
| | | } |
| | | if (reqVO.getVoltageLevelId() != null) { |
| | | MesPdVoltageLevelDO level = voltageLevelService.validateVoltageLevelExists(reqVO.getVoltageLevelId()); |
| | | respVO.setVoltageLevelName(level.getName()); |
| | | } |
| | | return respVO; |
| | | } |
| | | |
| | | private List<MesPdTieredPriceDO> getTieredPrices(MesPdPriceCalcReqVO reqVO) { |
| | | if (Objects.equals(CALC_TYPE_PACKAGE, reqVO.getCalcType()) && reqVO.getPackageId() != null) { |
| | | return tieredPriceMapper.selectListByPackageId(reqVO.getPackageId()); |
| | | } |
| | | if (Objects.equals(CALC_TYPE_VOLTAGE, reqVO.getCalcType()) && reqVO.getVoltageLevelId() != null) { |
| | | return tieredPriceMapper.selectListByVoltageLevelId(reqVO.getVoltageLevelId()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.product; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.product.vo.MesPdProductPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.product.vo.MesPdProductRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.product.vo.MesPdProductSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.product.MesPdProductDO; |
| | | |
| | | /** |
| | | * MES äº§åæ¡£æ¡ Service æ¥å£ |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | public interface MesPdProductService { |
| | | |
| | | Long createProduct(MesPdProductSaveReqVO createReqVO); |
| | | |
| | | void updateProduct(MesPdProductSaveReqVO updateReqVO); |
| | | |
| | | void deleteProduct(Long id); |
| | | |
| | | MesPdProductRespVO getProduct(Long id); |
| | | |
| | | PageResult<MesPdProductRespVO> getProductPage(MesPdProductPageReqVO pageReqVO); |
| | | |
| | | /** |
| | | * æäº¤å®¡æ¹ï¼æªæäº¤/驳å -> 审æ¹ä¸ï¼ |
| | | */ |
| | | void submitProduct(Long id); |
| | | |
| | | /** |
| | | * 审æ¹ï¼å®¡æ¹ä¸ -> éè¿/驳åï¼ |
| | | * |
| | | * @param id äº§åæ¡£æ¡ç¼å· |
| | | * @param pass æ¯å¦éè¿ |
| | | * @param auditRemark å®¡æ¹æè§ |
| | | */ |
| | | void auditProduct(Long id, Boolean pass, String auditRemark); |
| | | |
| | | MesPdProductDO validateProductExists(Long id); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.product; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.dict.core.DictFrameworkUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.product.vo.MesPdProductPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.product.vo.MesPdProductRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.product.vo.MesPdProductSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.product.MesPdProductDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.pd.product.MesPdProductMapper; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import cn.iocoder.yudao.module.mes.enums.md.autocode.MesMdAutoCodeRuleCodeEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.pd.MesPdAuditStatusEnum; |
| | | import cn.iocoder.yudao.module.mes.service.md.autocode.MesMdAutoCodeRecordService; |
| | | import jakarta.annotation.Resource; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PD_PRODUCT_AUDIT_STATUS_INVALID; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PD_PRODUCT_NOT_EXISTS; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PD_PRODUCT_SUBMIT_DUPLICATE; |
| | | |
| | | /** |
| | | * MES äº§åæ¡£æ¡ Service å®ç°ç±» |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @Service |
| | | @Validated |
| | | @Slf4j |
| | | public class MesPdProductServiceImpl implements MesPdProductService { |
| | | |
| | | @Resource |
| | | private MesPdProductMapper productMapper; |
| | | |
| | | @Resource |
| | | @Lazy |
| | | private MesMdAutoCodeRecordService autoCodeRecordService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long createProduct(MesPdProductSaveReqVO createReqVO) { |
| | | MesPdProductDO product = BeanUtils.toBean(createReqVO, MesPdProductDO.class); |
| | | product.setCode(autoCodeRecordService.generateAutoCode(MesMdAutoCodeRuleCodeEnum.PD_PRODUCT_CODE.getCode())); |
| | | product.setAuditStatus(MesPdAuditStatusEnum.DRAFT.getStatus()); |
| | | productMapper.insert(product); |
| | | return product.getId(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateProduct(MesPdProductSaveReqVO updateReqVO) { |
| | | MesPdProductDO product = validateProductExists(updateReqVO.getId()); |
| | | validateEditable(product); |
| | | MesPdProductDO updateObj = BeanUtils.toBean(updateReqVO, MesPdProductDO.class); |
| | | updateObj.setCode(product.getCode()); |
| | | productMapper.updateById(updateObj); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteProduct(Long id) { |
| | | MesPdProductDO product = validateProductExists(id); |
| | | validateEditable(product); |
| | | productMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public MesPdProductRespVO getProduct(Long id) { |
| | | MesPdProductDO product = productMapper.selectById(id); |
| | | return product == null ? null : convertToRespVO(product); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<MesPdProductRespVO> getProductPage(MesPdProductPageReqVO pageReqVO) { |
| | | PageResult<MesPdProductDO> page = productMapper.selectPage(pageReqVO); |
| | | PageResult<MesPdProductRespVO> result = BeanUtils.toBean(page, MesPdProductRespVO.class); |
| | | result.getList().forEach(this::fillDictName); |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void submitProduct(Long id) { |
| | | MesPdProductDO product = validateProductExists(id); |
| | | // ä»
æªæäº¤/驳åå¯æäº¤å®¡æ¹ |
| | | if (!MesPdAuditStatusEnum.DRAFT.getStatus().equals(product.getAuditStatus()) |
| | | && !MesPdAuditStatusEnum.REJECT.getStatus().equals(product.getAuditStatus())) { |
| | | throw exception(PD_PRODUCT_SUBMIT_DUPLICATE); |
| | | } |
| | | productMapper.updateById(MesPdProductDO.builder() |
| | | .id(id) |
| | | .auditStatus(MesPdAuditStatusEnum.PROCESS.getStatus()) |
| | | .auditRemark(null) |
| | | .auditTime(null) |
| | | .build()); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void auditProduct(Long id, Boolean pass, String auditRemark) { |
| | | MesPdProductDO product = validateProductExists(id); |
| | | // ä»
审æ¹ä¸å¯å®¡æ ¸ |
| | | if (!MesPdAuditStatusEnum.PROCESS.getStatus().equals(product.getAuditStatus())) { |
| | | throw exception(PD_PRODUCT_AUDIT_STATUS_INVALID); |
| | | } |
| | | productMapper.updateById(MesPdProductDO.builder() |
| | | .id(id) |
| | | .auditStatus(pass ? MesPdAuditStatusEnum.APPROVE.getStatus() : MesPdAuditStatusEnum.REJECT.getStatus()) |
| | | .auditRemark(auditRemark) |
| | | .auditTime(LocalDateTime.now()) |
| | | .build()); |
| | | } |
| | | |
| | | @Override |
| | | public MesPdProductDO validateProductExists(Long id) { |
| | | MesPdProductDO product = productMapper.selectById(id); |
| | | if (product == null) { |
| | | throw exception(PD_PRODUCT_NOT_EXISTS); |
| | | } |
| | | return product; |
| | | } |
| | | |
| | | private void validateEditable(MesPdProductDO product) { |
| | | // 审æ¹ä¸/å·²éè¿ä¸å¯ä¿®æ¹æå é¤ |
| | | if (!MesPdAuditStatusEnum.DRAFT.getStatus().equals(product.getAuditStatus()) |
| | | && !MesPdAuditStatusEnum.REJECT.getStatus().equals(product.getAuditStatus())) { |
| | | throw exception(PD_PRODUCT_AUDIT_STATUS_INVALID); |
| | | } |
| | | } |
| | | |
| | | private MesPdProductRespVO convertToRespVO(MesPdProductDO product) { |
| | | MesPdProductRespVO respVO = BeanUtils.toBean(product, MesPdProductRespVO.class); |
| | | fillDictName(respVO); |
| | | return respVO; |
| | | } |
| | | |
| | | private void fillDictName(MesPdProductRespVO respVO) { |
| | | respVO.setArchiveTypeName(DictFrameworkUtils.parseDictDataLabel( |
| | | DictTypeConstants.MES_PD_PRODUCT_ARCHIVE_TYPE, respVO.getArchiveType())); |
| | | respVO.setAuditStatusName(DictFrameworkUtils.parseDictDataLabel( |
| | | DictTypeConstants.MES_PD_PRODUCT_AUDIT_STATUS, respVO.getAuditStatus())); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.reel; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.reel.vo.ProductCtcReelPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.reel.vo.ProductCtcReelSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.reel.ProductCtcReelDO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * MES æ¢ä½å¯¼çº¿çå
·è®¡ç® Service æ¥å£ |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | public interface ProductCtcReelService { |
| | | |
| | | Long createReel(ProductCtcReelSaveReqVO createReqVO); |
| | | |
| | | void updateReel(ProductCtcReelSaveReqVO updateReqVO); |
| | | |
| | | void deleteReel(Long id); |
| | | |
| | | ProductCtcReelDO getReel(Long id); |
| | | |
| | | PageResult<ProductCtcReelDO> getReelPage(ProductCtcReelPageReqVO pageReqVO); |
| | | |
| | | List<ProductCtcReelDO> getReelListByCtcId(Long ctcId); |
| | | |
| | | void deleteByCtcId(Long ctcId); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.reel; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.reel.vo.ProductCtcReelPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.reel.vo.ProductCtcReelSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.ctc.ProductCtcDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.reel.ProductCtcReelDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.pd.reel.ProductCtcReelMapper; |
| | | import cn.iocoder.yudao.module.mes.service.pd.ctc.ProductCtcService; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.util.List; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PD_CTC_NOT_EXISTS; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PD_CTC_REEL_NOT_EXISTS; |
| | | |
| | | /** |
| | | * MES æ¢ä½å¯¼çº¿çå
·è®¡ç® Service å®ç°ç±» |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @Service |
| | | @Validated |
| | | public class ProductCtcReelServiceImpl implements ProductCtcReelService { |
| | | |
| | | @Resource |
| | | private ProductCtcReelMapper reelMapper; |
| | | |
| | | @Resource |
| | | @Lazy |
| | | private ProductCtcService ctcService; |
| | | |
| | | @Override |
| | | public Long createReel(ProductCtcReelSaveReqVO createReqVO) { |
| | | // æ ¡éªæ¢ä½å¯¼çº¿äº§ååå¨ |
| | | validateCtcExists(createReqVO.getCtcId()); |
| | | // æå
¥ |
| | | ProductCtcReelDO reel = BeanUtils.toBean(createReqVO, ProductCtcReelDO.class); |
| | | reelMapper.insert(reel); |
| | | return reel.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void updateReel(ProductCtcReelSaveReqVO updateReqVO) { |
| | | // æ ¡éªåå¨ |
| | | validateReelExists(updateReqVO.getId()); |
| | | // æ ¡éªæ¢ä½å¯¼çº¿äº§ååå¨ |
| | | validateCtcExists(updateReqVO.getCtcId()); |
| | | // æ´æ° |
| | | ProductCtcReelDO updateObj = BeanUtils.toBean(updateReqVO, ProductCtcReelDO.class); |
| | | reelMapper.updateById(updateObj); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteReel(Long id) { |
| | | // æ ¡éªåå¨ |
| | | validateReelExists(id); |
| | | // å é¤ |
| | | reelMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public ProductCtcReelDO getReel(Long id) { |
| | | return reelMapper.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<ProductCtcReelDO> getReelPage(ProductCtcReelPageReqVO pageReqVO) { |
| | | return reelMapper.selectPage(pageReqVO); |
| | | } |
| | | |
| | | @Override |
| | | public List<ProductCtcReelDO> getReelListByCtcId(Long ctcId) { |
| | | return reelMapper.selectListByCtcId(ctcId); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteByCtcId(Long ctcId) { |
| | | reelMapper.deleteByCtcId(ctcId); |
| | | } |
| | | |
| | | private void validateCtcExists(Long ctcId) { |
| | | ProductCtcDO ctc = ctcService.getCtc(ctcId); |
| | | if (ctc == null) { |
| | | throw exception(PD_CTC_NOT_EXISTS); |
| | | } |
| | | } |
| | | |
| | | private ProductCtcReelDO validateReelExists(Long id) { |
| | | ProductCtcReelDO reel = reelMapper.selectById(id); |
| | | if (reel == null) { |
| | | throw exception(PD_CTC_REEL_NOT_EXISTS); |
| | | } |
| | | return reel; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.techconfirm; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.techconfirm.vo.ProductTechConfirmPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.techconfirm.vo.ProductTechConfirmSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.techconfirm.ProductTechConfirmDO; |
| | | |
| | | /** |
| | | * MES äº§åææ¯ç¡®è®¤å½ Service æ¥å£ |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | public interface ProductTechConfirmService { |
| | | |
| | | Long createTechConfirm(ProductTechConfirmSaveReqVO createReqVO); |
| | | |
| | | void updateTechConfirm(ProductTechConfirmSaveReqVO updateReqVO); |
| | | |
| | | void deleteTechConfirm(Long id); |
| | | |
| | | ProductTechConfirmDO getTechConfirm(Long id); |
| | | |
| | | PageResult<ProductTechConfirmDO> getTechConfirmPage(ProductTechConfirmPageReqVO pageReqVO); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.techconfirm; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.techconfirm.vo.ProductTechConfirmPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.techconfirm.vo.ProductTechConfirmSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.techconfirm.ProductTechConfirmDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.pd.techconfirm.ProductTechConfirmMapper; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PD_TECH_CONFIRM_NOT_EXISTS; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PD_TECH_CONFIRM_NO_DUPLICATE; |
| | | |
| | | /** |
| | | * MES äº§åææ¯ç¡®è®¤å½ Service å®ç°ç±» |
| | | * |
| | | * @author è¶
级管çå |
| | | */ |
| | | @Service |
| | | @Validated |
| | | public class ProductTechConfirmServiceImpl implements ProductTechConfirmService { |
| | | |
| | | @Resource |
| | | private ProductTechConfirmMapper techConfirmMapper; |
| | | |
| | | @Override |
| | | public Long createTechConfirm(ProductTechConfirmSaveReqVO createReqVO) { |
| | | // æ ¡éªç¡®è®¤å½ç¼å·å¯ä¸ |
| | | validateConfirmNoUnique(createReqVO.getConfirmNo(), null); |
| | | // æå
¥ |
| | | ProductTechConfirmDO techConfirm = BeanUtils.toBean(createReqVO, ProductTechConfirmDO.class); |
| | | techConfirmMapper.insert(techConfirm); |
| | | return techConfirm.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void updateTechConfirm(ProductTechConfirmSaveReqVO updateReqVO) { |
| | | // æ ¡éªåå¨ |
| | | validateTechConfirmExists(updateReqVO.getId()); |
| | | // æ ¡éªç¡®è®¤å½ç¼å·å¯ä¸ï¼æé¤èªèº«ï¼ |
| | | validateConfirmNoUnique(updateReqVO.getConfirmNo(), updateReqVO.getId()); |
| | | // æ´æ° |
| | | ProductTechConfirmDO updateObj = BeanUtils.toBean(updateReqVO, ProductTechConfirmDO.class); |
| | | techConfirmMapper.updateById(updateObj); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteTechConfirm(Long id) { |
| | | // æ ¡éªåå¨ |
| | | validateTechConfirmExists(id); |
| | | // å é¤ |
| | | techConfirmMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public ProductTechConfirmDO getTechConfirm(Long id) { |
| | | return techConfirmMapper.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<ProductTechConfirmDO> getTechConfirmPage(ProductTechConfirmPageReqVO pageReqVO) { |
| | | return techConfirmMapper.selectPage(pageReqVO); |
| | | } |
| | | |
| | | private void validateConfirmNoUnique(String confirmNo, Long excludeId) { |
| | | if (confirmNo == null) { |
| | | return; |
| | | } |
| | | ProductTechConfirmDO techConfirm = techConfirmMapper.selectOne( |
| | | ProductTechConfirmDO::getConfirmNo, confirmNo); |
| | | if (techConfirm != null && !techConfirm.getId().equals(excludeId)) { |
| | | throw exception(PD_TECH_CONFIRM_NO_DUPLICATE); |
| | | } |
| | | } |
| | | |
| | | private ProductTechConfirmDO validateTechConfirmExists(Long id) { |
| | | ProductTechConfirmDO techConfirm = techConfirmMapper.selectById(id); |
| | | if (techConfirm == null) { |
| | | throw exception(PD_TECH_CONFIRM_NOT_EXISTS); |
| | | } |
| | | return techConfirm; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pro.emergencyplan; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.emergencyplan.vo.MesProEmergencyPlanPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.emergencyplan.vo.MesProEmergencyPlanSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.emergencyplan.MesProEmergencyPlanDO; |
| | | |
| | | import java.util.Collection; |
| | | |
| | | /** |
| | | * MES åºæ¥å¤ç½®é¢æ¡ Service æ¥å£ |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | public interface MesProEmergencyPlanService { |
| | | |
| | | Long createPlan(MesProEmergencyPlanSaveReqVO createReqVO); |
| | | |
| | | void updatePlan(MesProEmergencyPlanSaveReqVO updateReqVO); |
| | | |
| | | void deletePlan(Collection<Long> ids); |
| | | |
| | | MesProEmergencyPlanDO getPlan(Long id); |
| | | |
| | | PageResult<MesProEmergencyPlanDO> getPlanPage(MesProEmergencyPlanPageReqVO pageReqVO); |
| | | |
| | | void publishPlan(Long id); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pro.emergencyplan; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.emergencyplan.vo.MesProEmergencyPlanPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.emergencyplan.vo.MesProEmergencyPlanSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.emergencyplan.MesProEmergencyPlanDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.pro.emergencyplan.MesProEmergencyPlanMapper; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.Objects; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PRO_WORK_ORDER_NOT_EXISTS; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PRO_WORK_ORDER_NOT_PREPARE; |
| | | |
| | | /** |
| | | * MES åºæ¥å¤ç½®é¢æ¡ Service å®ç°ç±» |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @Service |
| | | @Validated |
| | | public class MesProEmergencyPlanServiceImpl implements MesProEmergencyPlanService { |
| | | |
| | | private static final Integer STATUS_DRAFT = 0; |
| | | private static final Integer STATUS_PUBLISHED = 10; |
| | | |
| | | @Resource |
| | | private MesProEmergencyPlanMapper planMapper; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long createPlan(MesProEmergencyPlanSaveReqVO createReqVO) { |
| | | String code = generateCode(); |
| | | if (planMapper.selectByCode(code) != null) { |
| | | throw exception(PRO_WORK_ORDER_NOT_EXISTS); |
| | | } |
| | | MesProEmergencyPlanDO plan = BeanUtils.toBean(createReqVO, MesProEmergencyPlanDO.class, req -> req |
| | | .setCode(code) |
| | | .setStatus(STATUS_DRAFT)); |
| | | planMapper.insert(plan); |
| | | return plan.getId(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updatePlan(MesProEmergencyPlanSaveReqVO updateReqVO) { |
| | | MesProEmergencyPlanDO oldPlan = validatePlanCanModify(updateReqVO.getId()); |
| | | MesProEmergencyPlanDO updateObj = BeanUtils.toBean(updateReqVO, MesProEmergencyPlanDO.class, req -> req |
| | | .setCode(oldPlan.getCode()) |
| | | .setStatus(oldPlan.getStatus())); |
| | | planMapper.updateById(updateObj); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deletePlan(Collection<Long> ids) { |
| | | if (CollUtil.isEmpty(ids)) { |
| | | return; |
| | | } |
| | | for (Long id : ids) { |
| | | validatePlanCanModify(id); |
| | | planMapper.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public MesProEmergencyPlanDO getPlan(Long id) { |
| | | return planMapper.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<MesProEmergencyPlanDO> getPlanPage(MesProEmergencyPlanPageReqVO pageReqVO) { |
| | | return planMapper.selectPage(pageReqVO); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void publishPlan(Long id) { |
| | | MesProEmergencyPlanDO plan = validatePlanExists(id); |
| | | if (!Objects.equals(plan.getStatus(), STATUS_DRAFT)) { |
| | | throw exception(PRO_WORK_ORDER_NOT_PREPARE); |
| | | } |
| | | planMapper.updateById(new MesProEmergencyPlanDO().setId(id).setStatus(STATUS_PUBLISHED)); |
| | | } |
| | | |
| | | private String generateCode() { |
| | | return "YJ" + DateUtil.format(java.time.LocalDateTime.now(), "yyyyMMddHHmmss") |
| | | + String.format("%03d", (int) (Math.random() * 1000)); |
| | | } |
| | | |
| | | private MesProEmergencyPlanDO validatePlanExists(Long id) { |
| | | MesProEmergencyPlanDO plan = planMapper.selectById(id); |
| | | if (plan == null) { |
| | | throw exception(PRO_WORK_ORDER_NOT_EXISTS); |
| | | } |
| | | return plan; |
| | | } |
| | | |
| | | private MesProEmergencyPlanDO validatePlanCanModify(Long id) { |
| | | MesProEmergencyPlanDO plan = validatePlanExists(id); |
| | | if (!Objects.equals(plan.getStatus(), STATUS_DRAFT)) { |
| | | throw exception(PRO_WORK_ORDER_NOT_PREPARE); |
| | | } |
| | | return plan; |
| | | } |
| | | |
| | | } |
| | |
| | | import jakarta.validation.Valid; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | |
| | | */ |
| | | MesProFeedbackBatchCreateRespVO batchCreateFeedback(@Valid MesProFeedbackBatchCreateReqVO reqVO); |
| | | |
| | | /** |
| | | * ä½ä¸æææ±æ»ç»è®¡ |
| | | * |
| | | * <p>æ±æ»æå®æ¶é´èå´å
å·²æ¹åæ¥å·¥çæ¥å·¥æ°é/åæ ¼æ°éï¼æå·¥åç±»åãæ¥æåç»ï¼ |
| | | * ç¨äºåçµãä¾çµãæ£ä¿®ççµåä½ä¸ææç»è®¡ã |
| | | * |
| | | * @param beginDate å¼å§æ¥æï¼å«ï¼å¯ç©ºï¼ |
| | | * @param endDate ç»ææ¥æï¼å«ï¼å¯ç©ºï¼ |
| | | * @param workOrderType å·¥åç±»åè¿æ»¤ï¼å¯ç©ºï¼ |
| | | * @return æ±æ»ç»æ |
| | | */ |
| | | MesProFeedbackSummaryRespVO getFeedbackSummary(LocalDate beginDate, LocalDate endDate, Integer workOrderType); |
| | | |
| | | } |
| | | |
| | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.feedback.vo.*; |
| | | import cn.iocoder.yudao.module.mes.enums.md.autocode.MesMdAutoCodeRuleCodeEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.pro.MesProFeedbackTypeEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.pro.MesProWorkOrderTypeEnum; |
| | | import cn.iocoder.yudao.module.mes.service.md.autocode.MesMdAutoCodeRecordService; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.feedback.MesProFeedbackDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.route.MesProRouteProcessDO; |
| | |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.LinkedHashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*; |
| | |
| | | return respVO; |
| | | } |
| | | |
| | | @Override |
| | | public MesProFeedbackSummaryRespVO getFeedbackSummary(LocalDate beginDate, LocalDate endDate, |
| | | Integer workOrderType) { |
| | | // 1. æ¥è¯¢æææ¥å·¥ï¼å·²æ¹åï¼å¾
æ£éª + å·²å®æï¼ |
| | | LambdaQueryWrapperX<MesProFeedbackDO> query = new LambdaQueryWrapperX<MesProFeedbackDO>() |
| | | .in(MesProFeedbackDO::getStatus, List.of( |
| | | MesProFeedbackStatusEnum.UNCHECK.getStatus(), |
| | | MesProFeedbackStatusEnum.FINISHED.getStatus())) |
| | | .betweenIfPresent(MesProFeedbackDO::getFeedbackTime, |
| | | beginDate != null ? beginDate.atStartOfDay() : null, |
| | | endDate != null ? endDate.plusDays(1).atStartOfDay() : null); |
| | | List<MesProFeedbackDO> feedbackList = feedbackMapper.selectList(query); |
| | | if (CollUtil.isEmpty(feedbackList)) { |
| | | MesProFeedbackSummaryRespVO empty = new MesProFeedbackSummaryRespVO(); |
| | | empty.setTotalFeedbackQuantity(BigDecimal.ZERO); |
| | | empty.setTotalQualifiedQuantity(BigDecimal.ZERO); |
| | | empty.setTotalFeedbackCount(0); |
| | | empty.setByType(Collections.emptyList()); |
| | | empty.setByDate(Collections.emptyList()); |
| | | return empty; |
| | | } |
| | | |
| | | // 2. å 载工åä¿¡æ¯ï¼æ å° å·¥åID -> å·¥åç±»å |
| | | Set<Long> workOrderIds = feedbackList.stream() |
| | | .map(MesProFeedbackDO::getWorkOrderId).filter(Objects::nonNull) |
| | | .collect(Collectors.toSet()); |
| | | Map<Long, MesProWorkOrderDO> workOrderMap = workOrderService.getWorkOrderMap(workOrderIds); |
| | | |
| | | // 3. è¿æ»¤å·¥åç±»å |
| | | List<MesProFeedbackDO> filteredList = feedbackList.stream() |
| | | .filter(feedback -> { |
| | | if (workOrderType == null) { |
| | | return true; |
| | | } |
| | | MesProWorkOrderDO workOrder = workOrderMap.get(feedback.getWorkOrderId()); |
| | | return workOrder != null && Objects.equals(workOrder.getType(), workOrderType); |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // 4. æ±æ» |
| | | BigDecimal totalFeedbackQuantity = BigDecimal.ZERO; |
| | | BigDecimal totalQualifiedQuantity = BigDecimal.ZERO; |
| | | int totalCount = 0; |
| | | for (MesProFeedbackDO feedback : filteredList) { |
| | | totalFeedbackQuantity = totalFeedbackQuantity.add(nullToZero(feedback.getFeedbackQuantity())); |
| | | totalQualifiedQuantity = totalQualifiedQuantity.add(nullToZero(feedback.getQualifiedQuantity())); |
| | | totalCount++; |
| | | } |
| | | |
| | | // 5. æå·¥åç±»ååç» |
| | | Map<Integer, MesProFeedbackSummaryRespVO.TypeSummaryItem> typeMap = new LinkedHashMap<>(); |
| | | // 6. ææ¥æåç» |
| | | Map<LocalDate, MesProFeedbackSummaryRespVO.DateSummaryItem> dateMap = new LinkedHashMap<>(); |
| | | for (MesProFeedbackDO feedback : filteredList) { |
| | | MesProWorkOrderDO workOrder = workOrderMap.get(feedback.getWorkOrderId()); |
| | | Integer type = workOrder != null ? workOrder.getType() : null; |
| | | if (type != null) { |
| | | MesProFeedbackSummaryRespVO.TypeSummaryItem item = typeMap.computeIfAbsent(type, key -> { |
| | | MesProFeedbackSummaryRespVO.TypeSummaryItem t = new MesProFeedbackSummaryRespVO.TypeSummaryItem(); |
| | | t.setWorkOrderType(key); |
| | | t.setWorkOrderTypeName(MesProWorkOrderTypeEnum.valueOf(key) != null |
| | | ? MesProWorkOrderTypeEnum.valueOf(key).getName() : String.valueOf(key)); |
| | | t.setFeedbackQuantity(BigDecimal.ZERO); |
| | | t.setQualifiedQuantity(BigDecimal.ZERO); |
| | | t.setFeedbackCount(0); |
| | | return t; |
| | | }); |
| | | item.setFeedbackQuantity(item.getFeedbackQuantity().add(nullToZero(feedback.getFeedbackQuantity()))); |
| | | item.setQualifiedQuantity(item.getQualifiedQuantity().add(nullToZero(feedback.getQualifiedQuantity()))); |
| | | item.setFeedbackCount(item.getFeedbackCount() + 1); |
| | | } |
| | | if (feedback.getFeedbackTime() != null) { |
| | | LocalDate date = feedback.getFeedbackTime().toLocalDate(); |
| | | MesProFeedbackSummaryRespVO.DateSummaryItem item = dateMap.computeIfAbsent(date, key -> { |
| | | MesProFeedbackSummaryRespVO.DateSummaryItem d = new MesProFeedbackSummaryRespVO.DateSummaryItem(); |
| | | d.setDate(key); |
| | | d.setFeedbackQuantity(BigDecimal.ZERO); |
| | | d.setQualifiedQuantity(BigDecimal.ZERO); |
| | | d.setFeedbackCount(0); |
| | | return d; |
| | | }); |
| | | item.setFeedbackQuantity(item.getFeedbackQuantity().add(nullToZero(feedback.getFeedbackQuantity()))); |
| | | item.setQualifiedQuantity(item.getQualifiedQuantity().add(nullToZero(feedback.getQualifiedQuantity()))); |
| | | item.setFeedbackCount(item.getFeedbackCount() + 1); |
| | | } |
| | | } |
| | | |
| | | // 7. ç»è£
ååº |
| | | MesProFeedbackSummaryRespVO respVO = new MesProFeedbackSummaryRespVO(); |
| | | respVO.setTotalFeedbackQuantity(totalFeedbackQuantity); |
| | | respVO.setTotalQualifiedQuantity(totalQualifiedQuantity); |
| | | respVO.setTotalFeedbackCount(totalCount); |
| | | respVO.setByType(new ArrayList<>(typeMap.values())); |
| | | respVO.setByDate(new ArrayList<>(dateMap.values())); |
| | | return respVO; |
| | | } |
| | | |
| | | private static BigDecimal nullToZero(BigDecimal value) { |
| | | return value == null ? BigDecimal.ZERO : value; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pro.maintenanceplan; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.maintenanceplan.vo.MesProMaintenancePlanPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.maintenanceplan.vo.MesProMaintenancePlanSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.maintenanceplan.MesProMaintenancePlanDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.maintenanceplan.MesProMaintenancePlanItemDO; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * MES çµåä½ä¸è®¡å Service æ¥å£ |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | public interface MesProMaintenancePlanService { |
| | | |
| | | /** |
| | | * å建çµåä½ä¸è®¡å |
| | | * |
| | | * @param createReqVO åå»ºä¿¡æ¯ |
| | | * @return ç¼å· |
| | | */ |
| | | Long createPlan(MesProMaintenancePlanSaveReqVO createReqVO); |
| | | |
| | | /** |
| | | * æ´æ°çµåä½ä¸è®¡å |
| | | * |
| | | * @param updateReqVO æ´æ°ä¿¡æ¯ |
| | | */ |
| | | void updatePlan(MesProMaintenancePlanSaveReqVO updateReqVO); |
| | | |
| | | /** |
| | | * å é¤çµåä½ä¸è®¡å |
| | | * |
| | | * @param ids ç¼å·æ°ç» |
| | | */ |
| | | void deletePlan(Collection<Long> ids); |
| | | |
| | | /** |
| | | * è·å¾çµåä½ä¸è®¡å |
| | | * |
| | | * @param id ç¼å· |
| | | * @return çµåä½ä¸è®¡å |
| | | */ |
| | | MesProMaintenancePlanDO getPlan(Long id); |
| | | |
| | | /** |
| | | * è·å¾çµåä½ä¸è®¡åæç»å表 |
| | | * |
| | | * @param planId 计åç¼å· |
| | | * @return æç»å表 |
| | | */ |
| | | List<MesProMaintenancePlanItemDO> getPlanItemListByPlanId(Long planId); |
| | | |
| | | /** |
| | | * æè®¡åç¼å·éåè·å¾æç»å表 |
| | | * |
| | | * @param planIds 计åç¼å·éå |
| | | * @return æç»å表 |
| | | */ |
| | | List<MesProMaintenancePlanItemDO> getPlanItemListByPlanIds(Collection<Long> planIds); |
| | | |
| | | /** |
| | | * è·å¾çµåä½ä¸è®¡åå页 |
| | | * |
| | | * @param pageReqVO å页æ¥è¯¢ |
| | | * @return åé¡µç»æ |
| | | */ |
| | | PageResult<MesProMaintenancePlanDO> getPlanPage(MesProMaintenancePlanPageReqVO pageReqVO); |
| | | |
| | | /** |
| | | * ä¸åçµåä½ä¸è®¡åï¼è稿 -> å·²ä¸åï¼ |
| | | * |
| | | * @param id ç¼å· |
| | | */ |
| | | void issuePlan(Long id); |
| | | |
| | | /** |
| | | * 宿çµåä½ä¸è®¡åï¼å·²ä¸å -> å·²å®æï¼ |
| | | * |
| | | * @param id ç¼å· |
| | | */ |
| | | void finishPlan(Long id); |
| | | |
| | | /** |
| | | * æ ¹æ®è®¡åå¤ä»¶/ç©èµéæ±çæ ERP éè´è®¡å |
| | | * |
| | | * @param id çµåä½ä¸è®¡åç¼å· |
| | | * @return éè´è®¡åç¼å· |
| | | */ |
| | | Long generatePurchasePlan(Long id); |
| | | |
| | | /** |
| | | * çæç产工åï¼è¿ç»´/åçµ/æ£ä¿®ç±»ï¼ |
| | | * |
| | | * @param id çµåä½ä¸è®¡åç¼å· |
| | | * @return å·¥åç¼å· |
| | | */ |
| | | Long generateWorkOrder(Long id); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pro.maintenanceplan; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.erp.api.purchase.ErpPurchasePlanApi; |
| | | import cn.iocoder.yudao.module.erp.api.purchase.dto.ErpPurchasePlanCreateReqDTO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.maintenanceplan.vo.MesProMaintenancePlanPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.maintenanceplan.vo.MesProMaintenancePlanSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pro.workorder.vo.MesProWorkOrderSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.cal.team.MesCalTeamDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.maintenanceplan.MesProMaintenancePlanDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.maintenanceplan.MesProMaintenancePlanItemDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.pro.maintenanceplan.MesProMaintenancePlanItemMapper; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.pro.maintenanceplan.MesProMaintenancePlanMapper; |
| | | import cn.iocoder.yudao.module.mes.enums.pro.MesProWorkOrderSourceTypeEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.pro.MesProWorkOrderTypeEnum; |
| | | import cn.iocoder.yudao.module.mes.service.cal.team.MesCalTeamService; |
| | | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; |
| | | import cn.iocoder.yudao.module.mes.service.pro.workorder.MesProWorkOrderService; |
| | | import jakarta.annotation.Resource; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*; |
| | | |
| | | /** |
| | | * MES çµåä½ä¸è®¡å Service å®ç°ç±» |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @Service |
| | | @Validated |
| | | @Slf4j |
| | | public class MesProMaintenancePlanServiceImpl implements MesProMaintenancePlanService { |
| | | |
| | | /** |
| | | * ç¶æï¼è稿 |
| | | */ |
| | | private static final Integer STATUS_DRAFT = 0; |
| | | /** |
| | | * ç¶æï¼å·²ä¸å |
| | | */ |
| | | private static final Integer STATUS_ISSUED = 10; |
| | | /** |
| | | * ç¶æï¼å·²å®æ |
| | | */ |
| | | private static final Integer STATUS_FINISHED = 20; |
| | | /** |
| | | * ç¶æï¼å·²åæ¶ |
| | | */ |
| | | private static final Integer STATUS_CANCELLED = 30; |
| | | |
| | | @Resource |
| | | private MesProMaintenancePlanMapper planMapper; |
| | | @Resource |
| | | private MesProMaintenancePlanItemMapper planItemMapper; |
| | | |
| | | @Resource |
| | | private MesCalTeamService teamService; |
| | | @Resource |
| | | private MesMdItemService itemService; |
| | | |
| | | @Resource |
| | | private ErpPurchasePlanApi erpPurchasePlanApi; |
| | | @Resource |
| | | private MesProWorkOrderService workOrderService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long createPlan(MesProMaintenancePlanSaveReqVO createReqVO) { |
| | | // 1. çæè®¡åç¼ç |
| | | String code = generatePlanCode(); |
| | | if (planMapper.selectByCode(code) != null) { |
| | | throw exception(MD_ITEM_CODE_DUPLICATE); |
| | | } |
| | | // 2. æ ¡éªçç»å¹¶åå¡« |
| | | fillTeamInfo(createReqVO); |
| | | // 3. æå
¥è®¡å |
| | | MesProMaintenancePlanDO plan = BeanUtils.toBean(createReqVO, MesProMaintenancePlanDO.class, req -> req |
| | | .setCode(code) |
| | | .setStatus(STATUS_DRAFT)); |
| | | planMapper.insert(plan); |
| | | // 4. æå
¥æç» |
| | | insertPlanItems(plan.getId(), createReqVO.getItems()); |
| | | return plan.getId(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updatePlan(MesProMaintenancePlanSaveReqVO updateReqVO) { |
| | | // 1. æ ¡éªåå¨ + èç¨¿ç¶æ |
| | | MesProMaintenancePlanDO oldPlan = validatePlanCanModify(updateReqVO.getId()); |
| | | fillTeamInfo(updateReqVO); |
| | | // 2. æ´æ°ä¸»è¡¨ |
| | | MesProMaintenancePlanDO updateObj = BeanUtils.toBean(updateReqVO, MesProMaintenancePlanDO.class, req -> req |
| | | .setCode(oldPlan.getCode()) |
| | | .setStatus(oldPlan.getStatus())); |
| | | planMapper.updateById(updateObj); |
| | | // 3. æ´æ°æç»ï¼å
å åæ |
| | | planItemMapper.deleteByPlanId(updateReqVO.getId()); |
| | | insertPlanItems(updateReqVO.getId(), updateReqVO.getItems()); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deletePlan(Collection<Long> ids) { |
| | | if (CollUtil.isEmpty(ids)) { |
| | | return; |
| | | } |
| | | for (Long id : ids) { |
| | | validatePlanCanModify(id); |
| | | planItemMapper.deleteByPlanId(id); |
| | | planMapper.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public MesProMaintenancePlanDO getPlan(Long id) { |
| | | return planMapper.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<MesProMaintenancePlanItemDO> getPlanItemListByPlanId(Long planId) { |
| | | return planItemMapper.selectListByPlanId(planId); |
| | | } |
| | | |
| | | @Override |
| | | public List<MesProMaintenancePlanItemDO> getPlanItemListByPlanIds(Collection<Long> planIds) { |
| | | return planItemMapper.selectListByPlanIds(planIds); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<MesProMaintenancePlanDO> getPlanPage(MesProMaintenancePlanPageReqVO pageReqVO) { |
| | | return planMapper.selectPage(pageReqVO); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void issuePlan(Long id) { |
| | | MesProMaintenancePlanDO plan = validatePlanExists(id); |
| | | if (!Objects.equals(plan.getStatus(), STATUS_DRAFT)) { |
| | | throw exception(PRO_WORK_ORDER_NOT_PREPARE); |
| | | } |
| | | planMapper.updateById(new MesProMaintenancePlanDO().setId(id).setStatus(STATUS_ISSUED)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void finishPlan(Long id) { |
| | | MesProMaintenancePlanDO plan = validatePlanExists(id); |
| | | if (!Objects.equals(plan.getStatus(), STATUS_ISSUED)) { |
| | | throw exception(PRO_WORK_ORDER_NOT_CONFIRMED); |
| | | } |
| | | planMapper.updateById(new MesProMaintenancePlanDO().setId(id).setStatus(STATUS_FINISHED)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long generatePurchasePlan(Long id) { |
| | | // 1. æ ¡éªè®¡ååå¨ä¸å·²ä¸å |
| | | MesProMaintenancePlanDO plan = validatePlanExists(id); |
| | | if (!Objects.equals(plan.getStatus(), STATUS_ISSUED)) { |
| | | throw exception(PRO_WORK_ORDER_NOT_CONFIRMED); |
| | | } |
| | | // 2. è·åæç» |
| | | List<MesProMaintenancePlanItemDO> planItems = planItemMapper.selectListByPlanId(id); |
| | | if (CollUtil.isEmpty(planItems)) { |
| | | throw exception(PRO_WORK_ORDER_NOT_EXISTS); |
| | | } |
| | | // 3. ç»è£
éè´è®¡å DTOï¼MES ç©æ -> MDM ç©æï¼ |
| | | Map<Long, MesMdItemDO> itemMap = itemService.getItemMap( |
| | | planItems.stream().map(MesProMaintenancePlanItemDO::getItemId).collect(Collectors.toSet())); |
| | | List<ErpPurchasePlanCreateReqDTO.Item> items = planItems.stream().map(item -> { |
| | | ErpPurchasePlanCreateReqDTO.Item dtoItem = new ErpPurchasePlanCreateReqDTO.Item(); |
| | | MesMdItemDO mesItem = itemMap.get(item.getItemId()); |
| | | dtoItem.setProductId(mesItem != null ? mesItem.getMdmItemId() : item.getItemId()); |
| | | dtoItem.setProductUnitId(mesItem != null ? mesItem.getUnitMeasureId() : null); |
| | | dtoItem.setCount(item.getQuantity()); |
| | | dtoItem.setRemark(item.getRemark()); |
| | | return dtoItem; |
| | | }).collect(Collectors.toList()); |
| | | // 4. è°ç¨ ERP çæéè´è®¡å |
| | | ErpPurchasePlanCreateReqDTO createReqDTO = new ErpPurchasePlanCreateReqDTO(); |
| | | createReqDTO.setName("ä½ä¸è®¡åéè´-" + plan.getName()); |
| | | createReqDTO.setDemandSource(2); // è¿ç»´/ç产计å |
| | | createReqDTO.setPlanDate(plan.getPlanDate()); |
| | | createReqDTO.setRemark("æ¥æºè®¡å: " + plan.getCode()); |
| | | createReqDTO.setItems(items); |
| | | return erpPurchasePlanApi.createPurchasePlan(createReqDTO); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long generateWorkOrder(Long id) { |
| | | // 1. æ ¡éªè®¡ååå¨ä¸å·²ä¸å |
| | | MesProMaintenancePlanDO plan = validatePlanExists(id); |
| | | if (!Objects.equals(plan.getStatus(), STATUS_ISSUED)) { |
| | | throw exception(PRO_WORK_ORDER_NOT_CONFIRMED); |
| | | } |
| | | // 2. å·²çæè¿å·¥ååç´æ¥è¿å |
| | | if (plan.getWorkOrderId() != null) { |
| | | return plan.getWorkOrderId(); |
| | | } |
| | | // 3. ç»è£
å·¥å |
| | | MesProWorkOrderSaveReqVO workOrderReq = new MesProWorkOrderSaveReqVO(); |
| | | workOrderReq.setName(plan.getName()); |
| | | workOrderReq.setType(convertPlanTypeToWorkOrderType(plan.getPlanType())); |
| | | workOrderReq.setOrderSourceType(MesProWorkOrderSourceTypeEnum.MAINTENANCE_PLAN.getType()); |
| | | workOrderReq.setOrderSourceCode(plan.getCode()); |
| | | workOrderReq.setQuantity(BigDecimal.ONE); |
| | | workOrderReq.setRequestDate(plan.getPlanDate() != null ? plan.getPlanDate() : java.time.LocalDateTime.now()); |
| | | workOrderReq.setRemark("æ¥èªçµåä½ä¸è®¡å: " + plan.getCode()); |
| | | Long workOrderId = workOrderService.createWorkOrder(workOrderReq); |
| | | // 4. åå计å |
| | | MesProMaintenancePlanDO updateObj = new MesProMaintenancePlanDO(); |
| | | updateObj.setId(id); |
| | | updateObj.setWorkOrderId(workOrderId); |
| | | planMapper.updateById(updateObj); |
| | | return workOrderId; |
| | | } |
| | | |
| | | /** |
| | | * 计åç±»å -> å·¥åç±»åæ å° |
| | | */ |
| | | private Integer convertPlanTypeToWorkOrderType(Integer planType) { |
| | | return switch (planType) { |
| | | case 1 -> MesProWorkOrderTypeEnum.POWER_OPERATION.getType(); // çµç½è¿è¡ -> çµåè¿ç»´ |
| | | case 2 -> MesProWorkOrderTypeEnum.POWER_GENERATION.getType(); // åçµ |
| | | case 3 -> MesProWorkOrderTypeEnum.POWER_OPERATION.getType(); // åçµè¿ç»´ -> çµåè¿ç»´ |
| | | case 4 -> MesProWorkOrderTypeEnum.POWER_MAINTENANCE.getType(); // 线路æ£ä¿® -> æ£ä¿® |
| | | default -> MesProWorkOrderTypeEnum.POWER_OPERATION.getType(); |
| | | }; |
| | | } |
| | | |
| | | private void insertPlanItems(Long planId, List<MesProMaintenancePlanSaveReqVO.Item> items) { |
| | | if (CollUtil.isEmpty(items)) { |
| | | return; |
| | | } |
| | | planItemMapper.insertBatch(items.stream().map(item -> |
| | | BeanUtils.toBean(item, MesProMaintenancePlanItemDO.class).setPlanId(planId)) |
| | | .collect(Collectors.toList())); |
| | | } |
| | | |
| | | private void fillTeamInfo(MesProMaintenancePlanSaveReqVO reqVO) { |
| | | if (reqVO.getTeamId() == null) { |
| | | return; |
| | | } |
| | | MesCalTeamDO team = teamService.validateTeamExists(reqVO.getTeamId()); |
| | | if (team != null) { |
| | | reqVO.setTeamName(team.getName()); |
| | | } |
| | | } |
| | | |
| | | private String generatePlanCode() { |
| | | return "MP" + DateUtil.format(java.time.LocalDateTime.now(), "yyyyMMddHHmmss") |
| | | + String.format("%03d", (int) (Math.random() * 1000)); |
| | | } |
| | | |
| | | private MesProMaintenancePlanDO validatePlanExists(Long id) { |
| | | MesProMaintenancePlanDO plan = planMapper.selectById(id); |
| | | if (plan == null) { |
| | | throw exception(PRO_WORK_ORDER_NOT_EXISTS); |
| | | } |
| | | return plan; |
| | | } |
| | | |
| | | private MesProMaintenancePlanDO validatePlanCanModify(Long id) { |
| | | MesProMaintenancePlanDO plan = validatePlanExists(id); |
| | | if (!Objects.equals(plan.getStatus(), STATUS_DRAFT)) { |
| | | throw exception(PRO_WORK_ORDER_NOT_PREPARE); |
| | | } |
| | | return plan; |
| | | } |
| | | |
| | | } |
| | |
| | | import cn.iocoder.yudao.module.mes.enums.md.autocode.MesMdAutoCodeRuleCodeEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.pro.MesProTaskStatusEnum; |
| | | import cn.iocoder.yudao.module.mes.service.dv.machinery.MesDvMachineryService; |
| | | import cn.iocoder.yudao.module.mes.service.cal.team.MesCalTeamService; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.cal.team.MesCalTeamDO; |
| | | import cn.iocoder.yudao.module.mes.service.md.autocode.MesMdAutoCodeRecordService; |
| | | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; |
| | | import cn.iocoder.yudao.module.mes.service.md.unitmeasure.MesMdUnitMeasureService; |
| | |
| | | @Resource |
| | | @Lazy |
| | | private MesDvMachineryService machineryService; |
| | | @Resource |
| | | private MesCalTeamService teamService; |
| | | |
| | | @Override |
| | | public Long createTask(MesProTaskSaveReqVO createReqVO) { |
| | |
| | | workstationService.validateWorkstationExists(createReqVO.getWorkstationId()); |
| | | routeService.validateRouteExists(createReqVO.getRouteId()); |
| | | processService.validateProcessExistsAndEnable(createReqVO.getProcessId()); |
| | | fillTeamInfo(createReqVO); |
| | | |
| | | // 2. èªå¨ç¡®å® itemIdï¼ä¼å
åç«¯ä¼ å
¥ â å·¥èºè·¯çº¿å·¥åºç产åºäº§å â å·¥åæå |
| | | Long itemId = createReqVO.getItemId(); |
| | |
| | | if (updateReqVO.getProcessId() != null) { |
| | | processService.validateProcessExistsAndEnable(updateReqVO.getProcessId()); |
| | | } |
| | | fillTeamInfo(updateReqVO); |
| | | MesMdItemDO item; |
| | | if (updateReqVO.getItemId() != null) { |
| | | item = itemService.validateItemExists(updateReqVO.getItemId()); |
| | |
| | | } |
| | | |
| | | /** |
| | | * æ ¡éªçç»åå¨å¹¶åå¡«çç»åç§° |
| | | */ |
| | | private void fillTeamInfo(MesProTaskSaveReqVO reqVO) { |
| | | if (reqVO.getTeamId() == null) { |
| | | return; |
| | | } |
| | | MesCalTeamDO team = teamService.validateTeamExists(reqVO.getTeamId()); |
| | | if (team != null) { |
| | | reqVO.setTeamName(team.getName()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æå»ºä»»å¡åç§°ï¼æ ¼å¼ï¼"产ååãæ°éãåä½" |
| | | */ |
| | | private String buildTaskName(MesMdItemDO item, BigDecimal quantity) { |
| | |
| | | import cn.iocoder.yudao.module.mes.service.pro.task.MesProTaskService; |
| | | import cn.iocoder.yudao.module.mes.service.wm.barcode.MesWmBarcodeService; |
| | | import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi; |
| | | import cn.iocoder.yudao.module.erp.api.sale.ErpSaleOrderApi; |
| | | import cn.iocoder.yudao.module.erp.api.sale.dto.ErpSaleOrderRespDTO; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | @Resource |
| | | private CrmCustomerApi customerApi; |
| | | |
| | | @Resource |
| | | @Lazy // é¿å
erpSaleOrderApiImpl -> ... -> mesProWorkOrderServiceImpl ç循ç¯ä¾èµ |
| | | private ErpSaleOrderApi saleOrderApi; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long createWorkOrder(MesProWorkOrderSaveReqVO createReqVO) { |
| | | // 1. æ ¡éªæ°æ® |
| | | validateWorkOrderSaveData(null, createReqVO); |
| | | // 1.1 å
³èè¥é订åä¿¡æ¯åå¡« |
| | | fillSaleOrderInfo(createReqVO); |
| | | |
| | | // 2.1 设置é»è®¤å¼ |
| | | if (createReqVO.getParentId() == null) { |
| | |
| | | workOrder.setStatus(MesProWorkOrderStatusEnum.PREPARE.getStatus()); |
| | | workOrderMapper.insert(workOrder); |
| | | |
| | | // 3. èªå¨çæ BOMï¼æ ¹æ®äº§å BOM çæå·¥å BOM |
| | | // 3. èªå¨çæ BOMï¼æ ¹æ®äº§å BOM çæå·¥å BOMï¼æ 产åçè¿ç»´/åçµ/æ£ä¿®ç±»å·¥åè·³è¿ï¼ |
| | | if (createReqVO.getProductId() != null) { |
| | | workOrderBomService.generateWorkOrderBom(workOrder.getId(), createReqVO, false); |
| | | } |
| | | |
| | | // 4. å·¥åºç±åç«¯éæ©äº§åå带å
¥ï¼ä¸åèªå¨çæ |
| | | |
| | |
| | | } |
| | | // 1.2 æ ¡éªæ°æ® |
| | | validateWorkOrderSaveData(updateReqVO.getId(), updateReqVO); |
| | | // 1.3 å
³èè¥é订åä¿¡æ¯åå¡« |
| | | fillSaleOrderInfo(updateReqVO); |
| | | |
| | | // 2. å¤æäº§åææ°éæ¯å¦åæ´ï¼å¦æåæ´åéæ°çæ BOMï¼updated=true ä¼å
æ¸
çæ§æ°æ®ï¼ |
| | | // 2. å¤æäº§åææ°éæ¯å¦åæ´ï¼å¦æåæ´åéæ°çæ BOMï¼updated=true ä¼å
æ¸
çæ§æ°æ®ï¼æ 产åçè¿ç»´ç±»å·¥åè·³è¿ï¼ |
| | | boolean productChanged = ObjUtil.notEqual(oldWorkOrder.getProductId(), updateReqVO.getProductId()); |
| | | boolean quantityChanged = oldWorkOrder.getQuantity().compareTo(updateReqVO.getQuantity()) != 0; |
| | | if (productChanged || quantityChanged) { |
| | | if ((productChanged || quantityChanged) && updateReqVO.getProductId() != null) { |
| | | workOrderBomService.generateWorkOrderBom(updateReqVO.getId(), updateReqVO, true); |
| | | } |
| | | // 2.1 å·¥åºç±å端管çï¼äº§ååæ´æ¶å端ä¼éæ°è·åå·¥èºè·¯çº¿å·¥åº |
| | |
| | | private void validateWorkOrderSaveData(Long id, MesProWorkOrderSaveReqVO reqVO) { |
| | | // 1. æ ¡éªç¼ç å¯ä¸ |
| | | validateWorkOrderCodeUnique(id, reqVO.getCode()); |
| | | // 2. æ ¡éªäº§ååå¨ |
| | | // 2. 产åéç©ºæ¶æ ¡éªäº§ååå¨ï¼è¿ç»´/åçµ/æ£ä¿®ç±»å·¥å坿 产åï¼ |
| | | if (reqVO.getProductId() != null) { |
| | | itemService.validateItemExists(reqVO.getProductId()); |
| | | // 3. æ ¡éªæ¹æ¬¡é
ç½®ï¼å¦æäº§åæ clientFlag=trueï¼å clientId å¿
å¡«ï¼ |
| | | MesMdItemBatchConfigDO batchConfig = itemBatchConfigService.getItemBatchConfigByItemId(reqVO.getProductId()); |
| | | if (batchConfig != null && Boolean.TRUE.equals(batchConfig.getClientFlag()) && reqVO.getClientId() == null) { |
| | | throw exception(MD_CLIENT_NOT_EXISTS); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å
³èè¥é订åï¼ERP éå®è®¢åï¼ï¼æ ¡éªå卿§å¹¶åå¡«åå·ãå®¢æ· |
| | | */ |
| | | private void fillSaleOrderInfo(MesProWorkOrderSaveReqVO reqVO) { |
| | | if (reqVO.getSaleOrderId() == null) { |
| | | return; |
| | | } |
| | | ErpSaleOrderRespDTO saleOrder = saleOrderApi.getSaleOrder(reqVO.getSaleOrderId()).getCheckedData(); |
| | | if (saleOrder == null) { |
| | | throw exception(PRO_WORK_ORDER_SALE_ORDER_NOT_EXISTS); |
| | | } |
| | | reqVO.setSaleOrderNo(saleOrder.getNo()); |
| | | if (reqVO.getClientId() == null && saleOrder.getCustomerId() != null) { |
| | | reqVO.setClientId(saleOrder.getCustomerId()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void updateProducedQuantity(Long id, BigDecimal incrQuantityProduced) { |
| | | // æ ¡éªå·¥ååå¨ |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.qc.outsourcetest; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.outsourcetest.vo.MesQcOutsourceTestPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.outsourcetest.vo.MesQcOutsourceTestSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.qc.outsourcetest.MesQcOutsourceTestDO; |
| | | |
| | | import java.util.Collection; |
| | | |
| | | /** |
| | | * MES å§å¤æ£æµ/è¯éªå Service æ¥å£ |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | public interface MesQcOutsourceTestService { |
| | | |
| | | /** |
| | | * å建å§å¤æ£æµ/è¯éªå |
| | | * |
| | | * @param createReqVO åå»ºä¿¡æ¯ |
| | | * @return ç¼å· |
| | | */ |
| | | Long createTest(MesQcOutsourceTestSaveReqVO createReqVO); |
| | | |
| | | /** |
| | | * æ´æ°å§å¤æ£æµ/è¯éªå |
| | | * |
| | | * @param updateReqVO æ´æ°ä¿¡æ¯ |
| | | */ |
| | | void updateTest(MesQcOutsourceTestSaveReqVO updateReqVO); |
| | | |
| | | /** |
| | | * å é¤å§å¤æ£æµ/è¯éªå |
| | | * |
| | | * @param ids ç¼å·æ°ç» |
| | | */ |
| | | void deleteTest(Collection<Long> ids); |
| | | |
| | | /** |
| | | * è·å¾å§å¤æ£æµ/è¯éªå |
| | | * |
| | | * @param id ç¼å· |
| | | * @return å§å¤æ£æµ/è¯éªå |
| | | */ |
| | | MesQcOutsourceTestDO getTest(Long id); |
| | | |
| | | /** |
| | | * è·å¾å§å¤æ£æµ/è¯éªåå页 |
| | | * |
| | | * @param pageReqVO å页æ¥è¯¢ |
| | | * @return åé¡µç»æ |
| | | */ |
| | | PageResult<MesQcOutsourceTestDO> getTestPage(MesQcOutsourceTestPageReqVO pageReqVO); |
| | | |
| | | /** |
| | | * æäº¤å§å¤æ£æµ/è¯éªåï¼è稿 -> å·²æäº¤ï¼ |
| | | * |
| | | * @param id ç¼å· |
| | | */ |
| | | void submitTest(Long id); |
| | | |
| | | /** |
| | | * 宿å§å¤æ£æµ/è¯éªåï¼å·²æäº¤ -> å·²å®æï¼ |
| | | * |
| | | * @param id ç¼å· |
| | | */ |
| | | void finishTest(Long id); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.qc.outsourcetest; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.outsourcetest.vo.MesQcOutsourceTestPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.qc.outsourcetest.vo.MesQcOutsourceTestSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.qc.outsourcetest.MesQcOutsourceTestDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.qc.outsourcetest.MesQcOutsourceTestMapper; |
| | | import cn.iocoder.yudao.module.system.api.storage.StorageAttachmentApi; |
| | | import jakarta.annotation.Resource; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.Objects; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*; |
| | | |
| | | /** |
| | | * MES å§å¤æ£æµ/è¯éªå Service å®ç°ç±» |
| | | * |
| | | * @author xiaoyi |
| | | */ |
| | | @Service |
| | | @Validated |
| | | @Slf4j |
| | | public class MesQcOutsourceTestServiceImpl implements MesQcOutsourceTestService { |
| | | |
| | | /** |
| | | * éä»¶å
³èä¸å¡ç±»å |
| | | */ |
| | | private static final String ATTACHMENT_BIZ_TYPE = "file"; |
| | | /** |
| | | * éä»¶å
³èä¸å¡è®°å½ç±»å |
| | | */ |
| | | private static final String ATTACHMENT_RECORD_TYPE = "mes_qc_outsource_test"; |
| | | |
| | | /** |
| | | * ç¶æï¼è稿 |
| | | */ |
| | | private static final Integer STATUS_DRAFT = 0; |
| | | /** |
| | | * ç¶æï¼å·²æäº¤ |
| | | */ |
| | | private static final Integer STATUS_SUBMITTED = 10; |
| | | /** |
| | | * ç¶æï¼å·²å®æ |
| | | */ |
| | | private static final Integer STATUS_FINISHED = 20; |
| | | |
| | | @Resource |
| | | private MesQcOutsourceTestMapper testMapper; |
| | | @Resource |
| | | private StorageAttachmentApi storageAttachmentApi; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long createTest(MesQcOutsourceTestSaveReqVO createReqVO) { |
| | | // 1. çæåå· |
| | | String code = generateCode(); |
| | | if (testMapper.selectByCode(code) != null) { |
| | | throw exception(PRO_WORK_ORDER_CODE_DUPLICATE); |
| | | } |
| | | // 2. æå
¥ |
| | | MesQcOutsourceTestDO test = BeanUtils.toBean(createReqVO, MesQcOutsourceTestDO.class, req -> req |
| | | .setCode(code) |
| | | .setStatus(STATUS_DRAFT)); |
| | | testMapper.insert(test); |
| | | // 3. ç»å®éä»¶ |
| | | storageAttachmentApi.bindAttachments(ATTACHMENT_BIZ_TYPE, ATTACHMENT_RECORD_TYPE, |
| | | test.getId(), createReqVO.getBlobIds()); |
| | | return test.getId(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateTest(MesQcOutsourceTestSaveReqVO updateReqVO) { |
| | | // 1. æ ¡éªåå¨ + è稿 |
| | | MesQcOutsourceTestDO oldTest = validateTestCanModify(updateReqVO.getId()); |
| | | // 2. æ´æ° |
| | | MesQcOutsourceTestDO updateObj = BeanUtils.toBean(updateReqVO, MesQcOutsourceTestDO.class, req -> req |
| | | .setCode(oldTest.getCode()) |
| | | .setStatus(oldTest.getStatus())); |
| | | testMapper.updateById(updateObj); |
| | | // 3. éæ°ç»å®éä»¶ |
| | | storageAttachmentApi.bindAttachments(ATTACHMENT_BIZ_TYPE, ATTACHMENT_RECORD_TYPE, |
| | | updateReqVO.getId(), updateReqVO.getBlobIds()); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteTest(Collection<Long> ids) { |
| | | if (CollUtil.isEmpty(ids)) { |
| | | return; |
| | | } |
| | | for (Long id : ids) { |
| | | validateTestCanModify(id); |
| | | testMapper.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public MesQcOutsourceTestDO getTest(Long id) { |
| | | return testMapper.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<MesQcOutsourceTestDO> getTestPage(MesQcOutsourceTestPageReqVO pageReqVO) { |
| | | return testMapper.selectPage(pageReqVO); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void submitTest(Long id) { |
| | | MesQcOutsourceTestDO test = validateTestExists(id); |
| | | if (!Objects.equals(test.getStatus(), STATUS_DRAFT)) { |
| | | throw exception(PRO_WORK_ORDER_NOT_PREPARE); |
| | | } |
| | | testMapper.updateById(new MesQcOutsourceTestDO().setId(id).setStatus(STATUS_SUBMITTED)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void finishTest(Long id) { |
| | | MesQcOutsourceTestDO test = validateTestExists(id); |
| | | if (!Objects.equals(test.getStatus(), STATUS_SUBMITTED)) { |
| | | throw exception(PRO_WORK_ORDER_NOT_CONFIRMED); |
| | | } |
| | | testMapper.updateById(new MesQcOutsourceTestDO().setId(id).setStatus(STATUS_FINISHED)); |
| | | } |
| | | |
| | | private String generateCode() { |
| | | return "WT" + DateUtil.format(java.time.LocalDateTime.now(), "yyyyMMddHHmmss") |
| | | + String.format("%03d", (int) (Math.random() * 1000)); |
| | | } |
| | | |
| | | private MesQcOutsourceTestDO validateTestExists(Long id) { |
| | | MesQcOutsourceTestDO test = testMapper.selectById(id); |
| | | if (test == null) { |
| | | throw exception(PRO_WORK_ORDER_NOT_EXISTS); |
| | | } |
| | | return test; |
| | | } |
| | | |
| | | private MesQcOutsourceTestDO validateTestCanModify(Long id) { |
| | | MesQcOutsourceTestDO test = validateTestExists(id); |
| | | if (!Objects.equals(test.getStatus(), STATUS_DRAFT)) { |
| | | throw exception(PRO_WORK_ORDER_NOT_PREPARE); |
| | | } |
| | | return test; |
| | | } |
| | | |
| | | } |
| | |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.wm.productissue.MesWmProductIssueMapper; |
| | | import cn.iocoder.yudao.module.mes.enums.MesBizTypeConstants; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmProductIssueStatusEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmProductIssueTypeEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmStockReserveBizTypeEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmTransactionTypeEnum; |
| | | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; |
| | |
| | | // 3. æå
¥ä¸»è¡¨ |
| | | MesWmProductIssueDO issue = BeanUtils.toBean(createReqVO, MesWmProductIssueDO.class); |
| | | issue.setStatus(MesWmProductIssueStatusEnum.PREPARE.getStatus()); |
| | | if (issue.getIssueType() == null) { |
| | | issue.setIssueType(MesWmProductIssueTypeEnum.NORMAL.getType()); |
| | | } |
| | | issueMapper.insert(issue); |
| | | return issue.getId(); |
| | | } |
| | |
| | | package cn.iocoder.yudao.module.mes.service.wm.stocktaking.task; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.stocktaking.task.vo.line.MesWmStockTakingTaskLineImportExcelVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.stocktaking.task.vo.line.MesWmStockTakingTaskLineImportRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.stocktaking.task.vo.line.MesWmStockTakingTaskLinePageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.stocktaking.task.vo.line.MesWmStockTakingTaskLineSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.stocktaking.task.vo.result.MesWmStockTakingTaskResultSaveReqVO; |
| | |
| | | */ |
| | | void updateStockTakingTaskLineTakingQuantity(Long id, BigDecimal takingQuantity); |
| | | |
| | | /** |
| | | * Excel 导å
¥å®çæ°é |
| | | * |
| | | * <p>æ ç©æç¼ç + æ¹æ¬¡å· å¹é
çç¹ä»»å¡è¡ï¼åå
¥å®çæ°éã |
| | | * |
| | | * @param taskId çç¹ä»»å¡ç¼å· |
| | | * @param list 导å
¥æ°æ® |
| | | * @return 导å
¥ç»æ |
| | | */ |
| | | MesWmStockTakingTaskLineImportRespVO importTakingQuantity(Long taskId, |
| | | List<MesWmStockTakingTaskLineImportExcelVO> list); |
| | | |
| | | } |
| | |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.materialstock.vo.MesWmMaterialStockListReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.stocktaking.task.vo.line.MesWmStockTakingTaskLinePageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.stocktaking.task.vo.line.MesWmStockTakingTaskLineSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.stocktaking.task.vo.line.MesWmStockTakingTaskLineImportExcelVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.stocktaking.task.vo.line.MesWmStockTakingTaskLineImportRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.wm.stocktaking.task.vo.result.MesWmStockTakingTaskResultSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.materialstock.MesWmMaterialStockDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.stocktaking.plan.MesWmStockTakingPlanParamDO; |
| | |
| | | private MesWmMaterialStockService materialStockService; |
| | | @Resource |
| | | private MesWmStockTakingTaskService stockTakingTaskService; |
| | | @Resource |
| | | private cn.iocoder.yudao.module.mdm.api.item.MdmItemApi mdmItemApi; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | return param != null ? param.getValueId() : null; |
| | | } |
| | | |
| | | @Override |
| | | public MesWmStockTakingTaskLineImportRespVO importTakingQuantity(Long taskId, |
| | | List<MesWmStockTakingTaskLineImportExcelVO> list) { |
| | | MesWmStockTakingTaskLineImportRespVO respVO = new MesWmStockTakingTaskLineImportRespVO(); |
| | | respVO.setSuccessCount(0); |
| | | respVO.setFailureCount(0); |
| | | respVO.setFailureMessages(new java.util.ArrayList<>()); |
| | | if (CollUtil.isEmpty(list)) { |
| | | return respVO; |
| | | } |
| | | // 1. è·åçç¹ä»»å¡è¡ |
| | | List<MesWmStockTakingTaskLineDO> lines = stockTakingTaskLineMapper.selectListByTaskId(taskId); |
| | | if (CollUtil.isEmpty(lines)) { |
| | | throw exception(cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.WM_STOCK_TAKING_TASK_LINE_NOT_EXISTS); |
| | | } |
| | | // 2. æå»º ç©æç¼ç -> ç©æID æ å° |
| | | java.util.Set<Long> itemIds = lines.stream().map(MesWmStockTakingTaskLineDO::getItemId) |
| | | .filter(Objects::nonNull).collect(java.util.stream.Collectors.toSet()); |
| | | java.util.Map<Long, cn.iocoder.yudao.module.mdm.api.item.dto.MdmItemRespDTO> itemMap = |
| | | mdmItemApi.getItemMap(itemIds); |
| | | java.util.Map<String, Long> codeToItemIdMap = new java.util.HashMap<>(); |
| | | itemMap.values().forEach(item -> { |
| | | if (item.getCode() != null) { |
| | | codeToItemIdMap.put(item.getCode(), item.getId()); |
| | | } |
| | | }); |
| | | // 3. éè¡å¹é
å¹¶åå
¥å®çæ°é |
| | | for (MesWmStockTakingTaskLineImportExcelVO row : list) { |
| | | Long itemId = codeToItemIdMap.get(row.getItemCode()); |
| | | if (itemId == null) { |
| | | respVO.setFailureCount(respVO.getFailureCount() + 1); |
| | | respVO.getFailureMessages().add("ç©æç¼ç ä¸åå¨: " + row.getItemCode()); |
| | | continue; |
| | | } |
| | | MesWmStockTakingTaskLineDO matched = lines.stream() |
| | | .filter(line -> Objects.equals(line.getItemId(), itemId) |
| | | && Objects.equals(line.getBatchCode(), row.getBatchCode())) |
| | | .findFirst().orElse(null); |
| | | if (matched == null) { |
| | | respVO.setFailureCount(respVO.getFailureCount() + 1); |
| | | respVO.getFailureMessages().add("æªæ¾å°å¯¹åºçç¹è¡: ç©æ=" + row.getItemCode() + " æ¹æ¬¡=" + row.getBatchCode()); |
| | | continue; |
| | | } |
| | | if (row.getTakingQuantity() == null) { |
| | | respVO.setFailureCount(respVO.getFailureCount() + 1); |
| | | respVO.getFailureMessages().add("å®çæ°é为空: ç©æ=" + row.getItemCode()); |
| | | continue; |
| | | } |
| | | updateStockTakingTaskLineTakingQuantity(matched.getId(), row.getTakingQuantity()); |
| | | respVO.setSuccessCount(respVO.getSuccessCount() + 1); |
| | | } |
| | | return respVO; |
| | | } |
| | | |
| | | } |
| | |
| | | host: localhost # å°å |
| | | port: 6379 # ç«¯å£ |
| | | database: 0 # æ°æ®åºç´¢å¼ |
| | | # password: # å¯ç ï¼å»ºè®®ç产ç¯å¢å¼å¯ |
| | | password: 123456 |
| | | |
| | | --- #################### 宿¶ä»»å¡ç¸å
³é
ç½® #################### |
| | | |
| | |
| | | compress: true # æ¯å¦å缩å¾ç |
| | | need-compress-size: 10MB # 触åå缩çæä»¶å¤§å°éå¼ |
| | | compress-quality: 0.5 # å缩质é(0.0-1.0) |
| | | |
| | | # MES æ°éï¼è®¾å¤æ°æ®ééï¼é
ç½®ï¼å¤é¨æ°éæå¡å°åæå®é
é¨ç½²å¡«å |
| | | yudao: |
| | | mes: |
| | | telemetry: |
| | | base-url: http://106.227.91.252:3100 # æ°éæå¡å°å |
| | | path: /api/jxjs/mesTb/getDeviceDetails |