From 9bc3f59d8f09cfe536f1758e7a6ed4471e9223a6 Mon Sep 17 00:00:00 2001
From: 赵士淞 <zhaoss@yhzhg.cn>
Date: Mon, 24 Apr 2023 09:41:27 +0000
Subject: [PATCH] 我发起的

---
 eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/business/service/impl/BusinessExpenseServiceFlowableImpl.java |   44 ++++++++++++++++------
 eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/business/rest/BusinessExpenseFlowableController.java          |   19 ++++++---
 eladmin-web-master/src/views/business/expenseFlowable/approve.vue                                                             |    2 
 eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/business/service/BusinessExpenseFlowableService.java          |   13 ++++--
 eladmin-web-master/src/views/business/expenseFlowable/report.vue                                                              |    2 
 5 files changed, 55 insertions(+), 25 deletions(-)

diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/business/rest/BusinessExpenseFlowableController.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/business/rest/BusinessExpenseFlowableController.java
index d0e8243..f8f70c2 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/business/rest/BusinessExpenseFlowableController.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/business/rest/BusinessExpenseFlowableController.java
@@ -21,7 +21,6 @@
 import me.zhengjie.annotation.Log;
 import me.zhengjie.modules.business.service.BusinessExpenseFlowableService;
 import me.zhengjie.modules.business.service.dto.BusinessExpenseDto;
-import me.zhengjie.modules.business.service.dto.BusinessExpenseQueryCriteria;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -41,12 +40,20 @@
 
     private final BusinessExpenseFlowableService businessExpenseFlowableService;
 
-    @GetMapping
-    @Log("查询营业费用(Flowable)")
-    @ApiOperation("查询营业费用(Flowable)")
+    @GetMapping(value = "/report")
+    @Log("查询我发起的营业费用(Flowable)")
+    @ApiOperation("查询我发起的营业费用(Flowable)")
     @PreAuthorize("@el.check('businessExpense:list')")
-    public ResponseEntity<Object> queryBusinessExpense(BusinessExpenseQueryCriteria criteria) throws Exception {
-        return new ResponseEntity<>(businessExpenseFlowableService.queryAll(criteria),HttpStatus.OK);
+    public ResponseEntity<Object> reportBusinessExpense() throws Exception {
+        return new ResponseEntity<>(businessExpenseFlowableService.report(),HttpStatus.OK);
+    }
+
+    @GetMapping(value = "/approve")
+    @Log("查询待审批的营业费用(Flowable)")
+    @ApiOperation("查询待审批的营业费用(Flowable)")
+    @PreAuthorize("@el.check('businessExpense:list')")
+    public ResponseEntity<Object> approveBusinessExpense() throws Exception {
+        return new ResponseEntity<>(businessExpenseFlowableService.approve(),HttpStatus.OK);
     }
 
     @PostMapping
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/business/service/BusinessExpenseFlowableService.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/business/service/BusinessExpenseFlowableService.java
index 4b267a2..97bdd2e 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/business/service/BusinessExpenseFlowableService.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/business/service/BusinessExpenseFlowableService.java
@@ -16,9 +16,7 @@
 package me.zhengjie.modules.business.service;
 
 import me.zhengjie.modules.business.service.dto.BusinessExpenseDto;
-import me.zhengjie.modules.business.service.dto.BusinessExpenseQueryCriteria;
 
-import java.util.List;
 import java.util.Map;
 
 /**
@@ -30,11 +28,16 @@
 public interface BusinessExpenseFlowableService {
 
     /**
-     * 查询所有数据不分页
-     * @param criteria 条件参数
+     * 我发起的
      * @return List<BusinessExpenseDto>
      */
-    Map<String, Object> queryAll(BusinessExpenseQueryCriteria criteria) throws Exception;
+    Map<String, Object> report() throws Exception;
+
+    /**
+     * 待审批的
+     * @return List<BusinessExpenseDto>
+     */
+    Map<String, Object> approve() throws Exception;
 
     /**
      * 创建
diff --git a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/business/service/impl/BusinessExpenseServiceFlowableImpl.java b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/business/service/impl/BusinessExpenseServiceFlowableImpl.java
index 63d6be9..e5e0a94 100644
--- a/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/business/service/impl/BusinessExpenseServiceFlowableImpl.java
+++ b/eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/business/service/impl/BusinessExpenseServiceFlowableImpl.java
@@ -16,26 +16,21 @@
 package me.zhengjie.modules.business.service.impl;
 
 import com.alibaba.fastjson.JSONArray;
-import com.fasterxml.jackson.databind.ObjectMapper;
 import lombok.RequiredArgsConstructor;
 import me.zhengjie.modules.api.Api;
 import me.zhengjie.modules.business.service.BusinessExpenseFlowableService;
 import me.zhengjie.modules.business.service.BusinessPlanService;
 import me.zhengjie.modules.business.service.dto.BusinessExpenseDto;
-import me.zhengjie.modules.business.service.dto.BusinessExpenseQueryCriteria;
 import me.zhengjie.modules.business.service.dto.BusinessExpenseReimbursementDto;
 import me.zhengjie.modules.business.service.dto.BusinessPlanDto;
 import me.zhengjie.modules.project.service.ProjectService;
 import me.zhengjie.modules.project.service.dto.ProjectDto;
-import me.zhengjie.utils.HttpUtil;
 import me.zhengjie.utils.ObjectUtil;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.ResponseEntity;
+import me.zhengjie.utils.SecurityUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -55,17 +50,39 @@
     private final ProjectService projectService;
 
     /**
-     * 查询
-     * @param criteria 条件参数
+     * 我发起的
      * @return
      */
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public Map<String, Object> queryAll(BusinessExpenseQueryCriteria criteria) throws Exception {
+    public Map<String, Object> report() throws Exception {
+        // 发起通信
+        Object returnObject = api.post("http://localhost:8888/api/common/report?key=" + "businessExpenseApply" + "&userId=" + SecurityUtils.getCurrentUserId(), new HashMap<>());
+        // 查询处理
+        return queryHandle(returnObject);
+    }
+
+    /**
+     * 待审批的
+     * @return
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Map<String, Object> approve() throws Exception {
+        // 发起通信
+        Object returnObject = api.post("http://localhost:8888/api/common/approve?key=" + "businessExpenseApply", new HashMap<>());
+        // 查询处理
+        return queryHandle(returnObject);
+    }
+
+    /**
+     * 查询处理
+     * @param returnObject
+     * @return
+     */
+    private Map<String, Object> queryHandle(Object returnObject) {
         // 返回结果
         Map<String, Object> returnMap = new HashMap<>();
-        // 发起通信
-        Object returnObject = api.post("http://localhost:8888/api/common/query?key=" + "businessExpenseApply", ObjectUtil.toObjectMap(criteria));
         // 通信结果转DTO
         List<BusinessExpenseDto> businessExpenseDtoList = ((JSONArray) returnObject).toJavaList(BusinessExpenseDto.class);
         // 循环DTO
@@ -100,8 +117,11 @@
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void create(BusinessExpenseDto resources) throws Exception {
+        // 参数
+        Map<String, Object> params = ObjectUtil.toObjectMap(resources);
+        params.put("approver", 1);
         // 发起通信
-        api.post("http://localhost:8888/api/common/run?key=" + "businessExpenseApply", ObjectUtil.toObjectMap(resources));
+        api.post("http://localhost:8888/api/common/run?key=" + "businessExpenseApply" + "&userId=" + SecurityUtils.getCurrentUserId(), params);
     }
 
     /**
diff --git a/eladmin-web-master/src/views/business/expenseFlowable/approve.vue b/eladmin-web-master/src/views/business/expenseFlowable/approve.vue
index 1b84c41..0ec3521 100644
--- a/eladmin-web-master/src/views/business/expenseFlowable/approve.vue
+++ b/eladmin-web-master/src/views/business/expenseFlowable/approve.vue
@@ -98,7 +98,7 @@
   mixins: [presenter(), header(), crud()],
   dicts: [constant.EXPENSE_TYPE],
   cruds() {
-    return CRUD({ title: '营业费用审批', url: 'api/businessExpenseFlowable', idField: 'id', sort: 'id,desc', crudMethod: { ...crudBusinessExpenseFlowable }})
+    return CRUD({ title: '营业费用审批', url: 'api/businessExpenseFlowable/approve', idField: 'id', sort: 'id,desc', crudMethod: { ...crudBusinessExpenseFlowable }})
   },
   data() {
     return {
diff --git a/eladmin-web-master/src/views/business/expenseFlowable/report.vue b/eladmin-web-master/src/views/business/expenseFlowable/report.vue
index cf91ebe..74d2629 100644
--- a/eladmin-web-master/src/views/business/expenseFlowable/report.vue
+++ b/eladmin-web-master/src/views/business/expenseFlowable/report.vue
@@ -175,7 +175,7 @@
   mixins: [presenter(), header(), form(defaultForm), crud()],
   dicts: [constant.EXPENSE_TYPE],
   cruds() {
-    return CRUD({ title: '营业费用', url: 'api/businessExpenseFlowable', idField: 'id', sort: 'id,desc', crudMethod: { ...crudBusinessExpenseFlowable }})
+    return CRUD({ title: '营业费用', url: 'api/businessExpenseFlowable/report', idField: 'id', sort: 'id,desc', crudMethod: { ...crudBusinessExpenseFlowable }})
   },
   data() {
     return {

--
Gitblit v1.9.3