From 74fb2d60439296e209c43b2eb994a299694e786a Mon Sep 17 00:00:00 2001
From: 赵士淞 <zhaoss@yhzhg.cn>
Date: Mon, 24 Apr 2023 03:50:14 +0000
Subject: [PATCH] 营业费用(工作流)

---
 eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/business/rabbit/BusinessExpenseRabbit.java |   27 +++++++++++++++++++++++++++
 eladmin-master/eladmin-system/src/main/resources/config/application-prod.yml                               |    8 ++++++++
 eladmin-master/eladmin-system/pom.xml                                                                      |    6 ++++++
 eladmin-master/eladmin-system/src/main/resources/config/application-dev.yml                                |    8 ++++++++
 eladmin-web-master/src/views/business/expenseFlowable/report.vue                                           |    8 ++++++++
 5 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/eladmin-master/eladmin-system/pom.xml b/eladmin-master/eladmin-system/pom.xml
index 2dd55f1..91ec216 100644
--- a/eladmin-master/eladmin-system/pom.xml
+++ b/eladmin-master/eladmin-system/pom.xml
@@ -96,6 +96,12 @@
             <artifactId>yauaa</artifactId>
             <version>5.23</version>
         </dependency>
+
+        <!-- 消息队列 -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-amqp</artifactId>
+        </dependency>
     </dependencies>
 
     <!-- 打包 -->
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/business/rabbit/BusinessExpenseRabbit.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/business/rabbit/BusinessExpenseRabbit.java
new file mode 100644
index 0000000..3c18e11
--- /dev/null
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/business/rabbit/BusinessExpenseRabbit.java
@@ -0,0 +1,27 @@
+package me.zhengjie.modules.business.rabbit;
+
+import com.alibaba.fastjson.JSON;
+import me.zhengjie.modules.business.service.BusinessExpenseService;
+import me.zhengjie.modules.business.service.dto.BusinessExpenseDto;
+import org.springframework.amqp.rabbit.annotation.RabbitHandler;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+@Component
+@RabbitListener(queues = "business.businessExpenseApply")
+public class BusinessExpenseRabbit {
+
+    @Autowired
+    private BusinessExpenseService businessExpenseService;
+
+    @RabbitHandler
+    public void process(Map<String, Object> message) {
+        // Map 转 实体类
+        BusinessExpenseDto businessExpenseDto = JSON.parseObject(JSON.toJSONString(message), BusinessExpenseDto.class);
+        // 新增
+        businessExpenseService.create(businessExpenseDto);
+    }
+}
diff --git a/eladmin-master/eladmin-system/src/main/resources/config/application-dev.yml b/eladmin-master/eladmin-system/src/main/resources/config/application-dev.yml
index 727493e..1031bec 100644
--- a/eladmin-master/eladmin-system/src/main/resources/config/application-dev.yml
+++ b/eladmin-master/eladmin-system/src/main/resources/config/application-dev.yml
@@ -48,6 +48,14 @@
         wall:
           config:
             multi-statement-allow: true
+  # 配置消息队列
+  rabbitmq:
+    host: 114.116.101.63
+    port: 31444
+    username: admin
+    password: 7658757a@
+    # 虚拟host 可以不设置,使用server默认host
+    virtual-host: /
 
 # 登录相关配置
 login:
diff --git a/eladmin-master/eladmin-system/src/main/resources/config/application-prod.yml b/eladmin-master/eladmin-system/src/main/resources/config/application-prod.yml
index fbdd98e..2239ecf 100644
--- a/eladmin-master/eladmin-system/src/main/resources/config/application-prod.yml
+++ b/eladmin-master/eladmin-system/src/main/resources/config/application-prod.yml
@@ -50,6 +50,14 @@
         wall:
           config:
             multi-statement-allow: true
+  # 配置消息队列
+  rabbitmq:
+    host: 114.116.101.63
+    port: 31444
+    username: admin
+    password: 7658757a@
+    # 虚拟host 可以不设置,使用server默认host
+    virtual-host: /
 
 # 登录相关配置
 login:
diff --git a/eladmin-web-master/src/views/business/expenseFlowable/report.vue b/eladmin-web-master/src/views/business/expenseFlowable/report.vue
index 89ff43e..cf91ebe 100644
--- a/eladmin-web-master/src/views/business/expenseFlowable/report.vue
+++ b/eladmin-web-master/src/views/business/expenseFlowable/report.vue
@@ -231,6 +231,14 @@
       'baseApi'
     ])
   },
+  created() {
+    this.crud.optShow = {
+      add: true,
+      edit: false,
+      del: false,
+      download: false
+    }
+  },
   methods: {
     // 钩子:在获取表格数据之前执行,false 则代表不获取数据
     [CRUD.HOOK.beforeRefresh]() {

--
Gitblit v1.9.3