lamphua преди 9 месеца
родител
ревизия
b38ec047f5

+ 22
- 17
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcCarApprovalController.java Целия файл

@@ -1,17 +1,15 @@
1 1
 package com.ruoyi.web.controller.oa;
2 2
 
3 3
 import java.math.BigDecimal;
4
-import java.util.Date;
5
-import java.util.List;
6
-import java.util.Objects;
4
+import java.util.*;
7 5
 import javax.servlet.http.HttpServletResponse;
8 6
 
9 7
 import com.alibaba.fastjson2.JSONObject;
10
-import com.ruoyi.common.utils.DateUtils;
11 8
 import com.ruoyi.oa.domain.*;
12 9
 import com.ruoyi.oa.service.ICmcCarService;
13 10
 import com.ruoyi.oa.service.ICmcProjectService;
14 11
 import com.ruoyi.system.service.ISysUserService;
12
+import org.apache.commons.collections.CollectionUtils;
15 13
 import org.springframework.beans.factory.annotation.Autowired;
16 14
 import org.springframework.web.bind.annotation.*;
17 15
 import com.ruoyi.common.annotation.Log;
@@ -168,26 +166,20 @@ public class CmcCarApprovalController extends BaseController
168 166
             cmcCarApproval.setDispatcher(getLoginUser().getUserId());
169 167
             cmcCarApproval.setDispatchComment(formDataJson.getString("dispatchComment"));
170 168
             cmcCarApproval.setDispatchTime(new Date());
171
-        }
172
-        if (formDataJson.getJSONArray("cars").size() > 0 && formDataJson.getJSONArray("drivers").size() > 0) {
173
-            cmcCarApproval.setDispatcher(getLoginUser().getUserId());
174
-            cmcCarApproval.setKilometers(formDataJson.getString("kilometers"));
175 169
             cmcCarApproval.setReturnDate(formDataJson.getDate("returnDate"));
170
+            cmcCarApproval.setKilometers(formDataJson.getString("kilometers"));
171
+        }
172
+        if (formDataJson.getJSONArray("cars").size() > 0) {
176 173
             String carString = formDataJson.getString("cars").substring(1, formDataJson.getString("cars").length() - 1);
177 174
             cmcCarApproval.setCars(carString);
178
-            cmcCarApproval.setDrivers(formDataJson.getString("drivers").substring(1, formDataJson.getString("drivers").length() - 1));
179 175
             if (formDataJson.getString("projectId") != null && !formDataJson.getString("projectId").equals("")) {
180 176
                 CmcProject cmcProject = new CmcProject();
181 177
                 cmcProject.setProjectId(formDataJson.getString("projectId"));
182 178
                 CmcProject project = cmcProjectService.selectCmcProjectByProjectId(cmcProject.getProjectId());
183
-                if (project.getDrivers() != null && !project.getDrivers().equals(cmcCarApproval.getDrivers()))
184
-                    project.setDrivers(project.getDrivers() + "," + cmcCarApproval.getDrivers());
185
-                if (project.getDrivers() == null)
186
-                    project.setDrivers(cmcCarApproval.getDrivers());
187
-                if (project.getCars() != null && !project.getCars().equals(carString))
188
-                    project.setCars(project.getCars() + "," + carString);
189
-                if (project.getCars() == null)
190
-                    project.setCars(carString);
179
+                String[] projectCars = project.getCars().split(",");
180
+                String[] cars = carString.split(",");
181
+                Collection union = CollectionUtils.union(Arrays.asList(projectCars), Arrays.asList(cars));
182
+                project.setCars(String.join(",",union));
191 183
                 cmcProjectService.updateCmcProject(project);
192 184
             }
193 185
             String[] cars = carString.split(",");
@@ -199,6 +191,19 @@ public class CmcCarApprovalController extends BaseController
199 191
             }
200 192
             cmcCarApproval.setEstimateCost(estimateCost);
201 193
         }
194
+        if (formDataJson.getJSONArray("drivers").size() > 0) {
195
+            cmcCarApproval.setDrivers(formDataJson.getString("drivers").substring(1, formDataJson.getString("drivers").length() - 1));
196
+            if (formDataJson.getString("projectId") != null && !formDataJson.getString("projectId").equals("")) {
197
+                CmcProject cmcProject = new CmcProject();
198
+                cmcProject.setProjectId(formDataJson.getString("projectId"));
199
+                CmcProject project = cmcProjectService.selectCmcProjectByProjectId(cmcProject.getProjectId());
200
+                String[] projectDrivers = project.getDrivers().split(",");
201
+                String[] drivers = formDataJson.getString("drivers").substring(1, formDataJson.getString("drivers").length() - 1).split(",");
202
+                Collection union = CollectionUtils.union(Arrays.asList(projectDrivers), Arrays.asList(drivers));
203
+                project.setDrivers(String.join(",",union));
204
+                cmcProjectService.updateCmcProject(project);
205
+            }
206
+        }
202 207
         cmcCarApprovalService.updateCmcCarApproval(cmcCarApproval);
203 208
         return AjaxResult.success("修改用车审批表成功");
204 209
     }

+ 8
- 5
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcDeviceApprovalController.java Целия файл

@@ -1,6 +1,8 @@
1 1
 package com.ruoyi.web.controller.oa;
2 2
 
3 3
 import java.math.BigDecimal;
4
+import java.util.Arrays;
5
+import java.util.Collection;
4 6
 import java.util.Date;
5 7
 import java.util.List;
6 8
 import javax.servlet.http.HttpServletResponse;
@@ -10,6 +12,7 @@ import com.ruoyi.common.utils.DateUtils;
10 12
 import com.ruoyi.oa.domain.*;
11 13
 import com.ruoyi.oa.service.ICmcDeviceService;
12 14
 import com.ruoyi.oa.service.ICmcProjectService;
15
+import org.apache.commons.collections.CollectionUtils;
13 16
 import org.springframework.beans.factory.annotation.Autowired;
14 17
 import org.springframework.web.bind.annotation.*;
15 18
 import com.ruoyi.common.annotation.Log;
@@ -140,17 +143,17 @@ public class CmcDeviceApprovalController extends BaseController
140 143
             cmcDeviceApproval.setDispatchComment(formDataJson.getString("dispatchComment"));
141 144
             cmcDeviceApproval.setDispatchTime(new Date());
142 145
         }
143
-        if (formDataJson.getJSONArray("modifyDevices").size() > 0) {
146
+        if (formDataJson.getJSONArray("modifyDevices").size() > 0 && formDataJson.getString("managerComment") == null) {
144 147
             String deviceString = formDataJson.getString("modifyDevices").substring(1, formDataJson.getString("modifyDevices").length() - 1);
145 148
             cmcDeviceApproval.setModifyDevices(deviceString);
146 149
             if (!formDataJson.getString("projectId").equals("")) {
147 150
                 CmcProject cmcProject = new CmcProject();
148 151
                 cmcProject.setProjectId(formDataJson.getString("projectId"));
149 152
                 CmcProject project = cmcProjectService.selectCmcProjectByProjectId(cmcProject.getProjectId());
150
-                if (project.getDevices() != null && !project.getDevices().equals(cmcDeviceApproval.getModifyDevices()))
151
-                    project.setDevices(project.getDevices() + "," + cmcDeviceApproval.getModifyDevices());
152
-                if (project.getDevices() == null)
153
-                    project.setDevices(cmcDeviceApproval.getModifyDevices());
153
+                String[] projectDevices = project.getDevices().split(",");
154
+                String[] devices = formDataJson.getString("devices").substring(1, formDataJson.getString("devices").length() - 1).split(",");
155
+                Collection union = CollectionUtils.union(Arrays.asList(projectDevices), Arrays.asList(devices));
156
+                project.setDevices(String.join(",",union));
154 157
                 cmcProjectService.updateCmcProject(project);
155 158
             }
156 159
             String[] devices = deviceString.split(",");

+ 16
- 13
oa-back/ruoyi-flowable/src/main/java/com/ruoyi/flowable/service/impl/FlowTaskServiceImpl.java Целия файл

@@ -735,19 +735,22 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
735 735
             runtimeService.createChangeActivityStateBuilder()
736 736
                     .processInstanceId(task.getProcessInstanceId())
737 737
                     .moveActivityIdsToSingleActivityId(currentIds, lastHistoricTaskDefinitionKey).changeState();
738
-//            String currentTaskId = taskService.createTaskQuery().processInstanceId(task.getProcessInstanceId()).singleResult().getId();
739
-//            List<HistoricTaskInstance> htiTargetList = historyService.createHistoricTaskInstanceQuery()
740
-//                    .processInstanceId(task.getProcessInstanceId())
741
-//                    .taskDefinitionKey(lastHistoricTaskDefinitionKey)
742
-//                    .list();
743
-//            String taskAssignee = "";
744
-//            for (HistoricTaskInstance hti: htiTargetList) {
745
-//                if (!hti.getId().equals(currentTaskId)) {
746
-//                    taskAssignee = hti.getAssignee();
747
-//                    break;
748
-//                }
749
-//            }
750
-//            taskService.setAssignee(currentTaskId, taskAssignee);
738
+            List<Task> taskQuery = taskService.createTaskQuery().processInstanceId(task.getProcessInstanceId()).list();
739
+            String currentTaskId = "";
740
+            if (taskQuery.size() == 1)
741
+                currentTaskId = taskService.createTaskQuery().processInstanceId(task.getProcessInstanceId()).singleResult().getId();
742
+            List<HistoricTaskInstance> htiTargetList = historyService.createHistoricTaskInstanceQuery()
743
+                    .processInstanceId(task.getProcessInstanceId())
744
+                    .taskDefinitionKey(lastHistoricTaskDefinitionKey)
745
+                    .list();
746
+            String taskAssignee = "";
747
+            for (HistoricTaskInstance hti: htiTargetList) {
748
+                if (!hti.getId().equals(currentTaskId)) {
749
+                    taskAssignee = hti.getAssignee();
750
+                    break;
751
+                }
752
+            }
753
+            taskService.setAssignee(currentTaskId, taskAssignee);
751 754
         } catch (FlowableObjectNotFoundException e) {
752 755
             throw new CustomException("未找到流程实例,流程可能已发生变化");
753 756
         } catch (FlowableException e) {

+ 9
- 0
oa-ui/src/api/flowable/todo.js Целия файл

@@ -28,6 +28,15 @@ export function delegate(data) {
28 28
   })
29 29
 }
30 30
 
31
+// 转办任务
32
+export function assignTask(data) {
33
+  return request({
34
+    url: '/flowable/task/assignTask',
35
+    method: 'post',
36
+    data: data
37
+  })
38
+}
39
+
31 40
 // 退回任务
32 41
 export function returnTask(data) {
33 42
   return request({

+ 51
- 7
oa-ui/src/views/flowable/task/todo/index.vue Целия файл

@@ -38,30 +38,43 @@
38 38
       <el-table-column label="流程发起人" align="center">
39 39
         <template slot-scope="scope">
40 40
           <label>{{ scope.row.startUserName }} <el-tag type="info" size="mini">{{ scope.row.startDeptName
41
-              }}</el-tag></label>
41
+          }}</el-tag></label>
42 42
         </template>
43 43
       </el-table-column>
44 44
       <el-table-column label="接收时间" align="center" prop="createTime" width="180" />
45 45
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
46 46
         <template slot-scope="scope">
47
-          <el-button size="mini" type="text" icon="el-icon-edit-outline" @click="handleProcess(scope.row)">处理
48
-          </el-button>
47
+          <el-button size="mini" type="text" icon="el-icon-edit-outline" @click="handleProcess(scope.row)">处理</el-button>
48
+          <el-button size="mini" type="text" icon="el-icon-share" @click="handleAssign(scope.row)">转办</el-button>
49 49
         </template>
50 50
       </el-table-column>
51 51
     </el-table>
52 52
 
53 53
     <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
54 54
       @pagination="getList" />
55
+    <!--选择流程接收人-->
56
+    <el-dialog :title="taskTitle" :visible.sync="taskOpen" width="65%" append-to-body>
57
+      <flow-user v-if="checkSendUser" :checkType="checkType" @handleUserSelect="handleUserSelect" />
58
+      <span slot="footer" class="dialog-footer">
59
+        <el-button @click="taskOpen = false">取 消</el-button>
60
+        <el-button type="primary" @click="submitTask">提 交</el-button>
61
+      </span>
62
+    </el-dialog>
55 63
   </div>
56 64
 </template>
57 65
 
58 66
 <script>
59
-import { todoList, complete, returnList, returnTask, rejectTask, getDeployment, delDeployment, exportDeployment } from "@/api/flowable/todo";
67
+import { todoList, complete, returnList, returnTask, rejectTask, assignTask, getDeployment, delDeployment, exportDeployment } from "@/api/flowable/todo";
60 68
 import { getProcessVariables } from "@/api/flowable/definition"
61 69
 import { getProject, addProject, delProject } from "@/api/oa/project/project";
70
+import FlowUser from '@/components/flow/User'
71
+import FlowRole from '@/components/flow/Role'
62 72
 export default {
63 73
   name: "Deploy",
64
-  components: {},
74
+  components: {
75
+    FlowUser,
76
+    FlowRole,
77
+  },
65 78
   data() {
66 79
     return {
67 80
       // 遮罩层
@@ -94,6 +107,12 @@ export default {
94 107
       // 表单校验
95 108
       rules: {},
96 109
       dataShow: true,
110
+      taskTitle: null,
111
+      taskOpen: false,
112
+      checkSendUser: false, // 是否展示人员选择模块
113
+      checkType: '', // 选择类型
114
+      checkValues: null, // 选中任务接收人员数据
115
+      taskId: ''
97 116
     };
98 117
   },
99 118
   created() {
@@ -114,10 +133,10 @@ export default {
114 133
         if (res.data) {
115 134
           getProject(res.data.formId).then(result => {
116 135
             if (res.data) {
117
-              let name = result.data.projectNumber +'-' + result.data.projectName
136
+              let name = result.data.projectNumber + '-' + result.data.projectName
118 137
               this.todoList.map(item => {
119 138
                 if (item.taskId == row.taskId) {
120
-                 this.$set(item,'project',name)
139
+                  this.$set(item, 'project', name)
121 140
                 }
122 141
               })
123 142
             }
@@ -125,6 +144,31 @@ export default {
125 144
         }
126 145
       })
127 146
     },
147
+    handleAssign(row) {
148
+      this.taskOpen = true;
149
+      this.taskTitle = "选择任务接收";
150
+      this.checkSendUser = true;
151
+      this.checkType = "single";
152
+      this.taskId = row.taskId;
153
+    },
154
+    /** 提交流程 */
155
+    submitTask() {
156
+      if (!this.checkValues && this.checkSendUser) {
157
+        this.$modal.msgError("请选择任务接收!");
158
+        return;
159
+      }
160
+      assignTask({ taskId: this.taskId, assignee: this.checkValues }).then(res => {
161
+        this.$modal.msgSuccess(res.msg);
162
+        this.taskOpen = false;
163
+        this.getList();
164
+      })
165
+    },
166
+    // 用户信息选中数据
167
+    handleUserSelect(selection) {
168
+      if (selection) {
169
+        this.checkValues = selection.userId;
170
+      }
171
+    },
128 172
     // 跳转到处理页面
129 173
     handleProcess(row) {
130 174
       let path = this.getRoutePath(row);

Loading…
Отказ
Запис