chenshudong пре 5 месеци
родитељ
комит
06b75a90fd
28 измењених фајлова са 1378 додато и 1240 уклоњено
  1. 44 56
      airport-admin/src/main/java/com/sundot/airport/web/controller/approval/ApprovalController.java
  2. 45 46
      airport-admin/src/main/java/com/sundot/airport/web/controller/approval/CheckApprovalController.java
  3. 49 26
      airport-admin/src/main/java/com/sundot/airport/web/controller/approval/dto/ApprovalDTO.java
  4. 21 12
      airport-admin/src/main/java/com/sundot/airport/web/controller/approval/dto/PersonalCheckDTO.java
  5. 5 4
      airport-admin/src/main/java/com/sundot/airport/web/controller/approval/dto/RejectDTO.java
  6. 21 12
      airport-admin/src/main/java/com/sundot/airport/web/controller/approval/dto/SectionCheckDTO.java
  7. 25 14
      airport-admin/src/main/java/com/sundot/airport/web/controller/approval/dto/SeizureReportDTO.java
  8. 17 18
      airport-system/src/main/java/com/sundot/airport/system/mapper/approval/ApprovalCcMapper.java
  9. 13 14
      airport-system/src/main/java/com/sundot/airport/system/mapper/approval/ApprovalHistoryMapper.java
  10. 18 19
      airport-system/src/main/java/com/sundot/airport/system/mapper/approval/ApprovalInstanceMapper.java
  11. 17 18
      airport-system/src/main/java/com/sundot/airport/system/mapper/approval/ApprovalNodeDefinitionMapper.java
  12. 18 19
      airport-system/src/main/java/com/sundot/airport/system/mapper/approval/ApprovalTaskMapper.java
  13. 10 11
      airport-system/src/main/java/com/sundot/airport/system/mapper/approval/ApprovalWorkflowDefinitionMapper.java
  14. 5 1
      airport-system/src/main/java/com/sundot/airport/system/service/approval/BusinessApprovalHandler.java
  15. 72 71
      airport-system/src/main/java/com/sundot/airport/system/service/approval/IApprovalEngineService.java
  16. 19 20
      airport-system/src/main/java/com/sundot/airport/system/service/approval/IApprovalUserService.java
  17. 11 11
      airport-system/src/main/java/com/sundot/airport/system/service/approval/IApprovalWorkflowService.java
  18. 49 49
      airport-system/src/main/java/com/sundot/airport/system/service/approval/ICheckApprovalService.java
  19. 164 191
      airport-system/src/main/java/com/sundot/airport/system/service/approval/impl/ApprovalEngineServiceImpl.java
  20. 89 109
      airport-system/src/main/java/com/sundot/airport/system/service/approval/impl/ApprovalUserServiceImpl.java
  21. 19 27
      airport-system/src/main/java/com/sundot/airport/system/service/approval/impl/ApprovalWorkflowServiceImpl.java
  22. 117 117
      airport-system/src/main/java/com/sundot/airport/system/service/approval/impl/CheckApprovalServiceImpl.java
  23. 102 73
      airport-system/src/main/resources/mapper/approval/ApprovalCcMapper.xml
  24. 49 36
      airport-system/src/main/resources/mapper/approval/ApprovalHistoryMapper.xml
  25. 114 92
      airport-system/src/main/resources/mapper/approval/ApprovalInstanceMapper.xml
  26. 65 44
      airport-system/src/main/resources/mapper/approval/ApprovalNodeDefinitionMapper.xml
  27. 135 85
      airport-system/src/main/resources/mapper/approval/ApprovalTaskMapper.xml
  28. 65 45
      airport-system/src/main/resources/mapper/approval/ApprovalWorkflowDefinitionMapper.xml

+ 44 - 56
airport-admin/src/main/java/com/sundot/airport/web/controller/approval/ApprovalController.java

@@ -27,14 +27,13 @@ import com.sundot.airport.common.core.page.TableDataInfo;
27 27
 
28 28
 /**
29 29
  * 审批流程Controller
30
- * 
30
+ *
31 31
  * @author simon lin
32 32
  * @date 2025-09-06
33 33
  */
34 34
 @RestController
35 35
 @RequestMapping("/system/approval")
36
-public class ApprovalController extends BaseController
37
-{
36
+public class ApprovalController extends BaseController {
38 37
     @Autowired
39 38
     private IApprovalEngineService approvalEngineService;
40 39
 
@@ -44,8 +43,7 @@ public class ApprovalController extends BaseController
44 43
     @PreAuthorize("@ss.hasPermi('system:approval:start')")
45 44
     @Log(title = "启动审批流程", businessType = BusinessType.INSERT)
46 45
     @PostMapping("/start")
47
-    public AjaxResult startProcess(@RequestBody Map<String, Object> params)
48
-    {
46
+    public AjaxResult startProcess(@RequestBody Map<String, Object> params) {
49 47
         String workflowCode = (String) params.get("workflowCode");
50 48
         String businessType = (String) params.get("businessType");
51 49
         Long businessId = Long.valueOf(params.get("businessId").toString());
@@ -54,11 +52,11 @@ public class ApprovalController extends BaseController
54 52
         String submitterName = SecurityUtils.getUsername();
55 53
         Map<String, Object> formData = (Map<String, Object>) params.get("formData");
56 54
         Map<String, Object> businessData = (Map<String, Object>) params.get("businessData");
57
-        
55
+
58 56
         ApprovalInstance instance = approvalEngineService.startProcess(
59
-            workflowCode, businessType, businessId, title, 
60
-            submitterId, submitterName, formData, businessData);
61
-            
57
+                workflowCode, businessType, businessId, title,
58
+                submitterId, submitterName, formData, businessData);
59
+
62 60
         return AjaxResult.success("流程启动成功", instance);
63 61
     }
64 62
 
@@ -68,14 +66,13 @@ public class ApprovalController extends BaseController
68 66
     @PreAuthorize("@ss.hasPermi('system:approval:start')")
69 67
     @Log(title = "启动个人级别审批流程", businessType = BusinessType.INSERT)
70 68
     @PostMapping("/start/personal")
71
-    public AjaxResult startPersonalLevelProcess(@RequestBody Map<String, Object> params)
72
-    {
69
+    public AjaxResult startPersonalLevelProcess(@RequestBody Map<String, Object> params) {
73 70
         String businessType = (String) params.get("businessType");
74 71
         Long businessId = Long.valueOf(params.get("businessId").toString());
75 72
         String title = (String) params.get("title");
76 73
         Long submitterId = SecurityUtils.getUserId();
77 74
         String submitterName = SecurityUtils.getUsername();
78
-        
75
+
79 76
         // 新的个人级别检查流程参数
80 77
         Long sectionLeaderId = null;
81 78
         Object sectionLeaderIdObj = params.get("sectionLeaderId");
@@ -86,18 +83,18 @@ public class ApprovalController extends BaseController
86 83
                 sectionLeaderId = Long.parseLong((String) sectionLeaderIdObj);
87 84
             }
88 85
         }
89
-        
86
+
90 87
         if (sectionLeaderId == null) {
91 88
             return AjaxResult.error("sectionLeaderId参数不能为空");
92 89
         }
93
-        
90
+
94 91
         Map<String, Object> formData = (Map<String, Object>) params.get("formData");
95 92
         Map<String, Object> businessData = (Map<String, Object>) params.get("businessData");
96
-        
93
+
97 94
         ApprovalInstance instance = approvalEngineService.startPersonalLevelProcess(
98
-            businessType, businessId, title, submitterId, submitterName, 
99
-            sectionLeaderId, formData, businessData);
100
-            
95
+                businessType, businessId, title, submitterId, submitterName,
96
+                sectionLeaderId, formData, businessData);
97
+
101 98
         return AjaxResult.success("个人级别流程启动成功", instance);
102 99
     }
103 100
 
@@ -107,14 +104,13 @@ public class ApprovalController extends BaseController
107 104
     @PreAuthorize("@ss.hasPermi('system:approval:start')")
108 105
     @Log(title = "启动科级审批流程", businessType = BusinessType.INSERT)
109 106
     @PostMapping("/start/section")
110
-    public AjaxResult startSectionLevelProcess(@RequestBody Map<String, Object> params)
111
-    {
107
+    public AjaxResult startSectionLevelProcess(@RequestBody Map<String, Object> params) {
112 108
         String businessType = (String) params.get("businessType");
113 109
         Long businessId = Long.valueOf(params.get("businessId").toString());
114 110
         String title = (String) params.get("title");
115 111
         Long submitterId = SecurityUtils.getUserId();
116 112
         String submitterName = SecurityUtils.getUsername();
117
-        
113
+
118 114
         // 新的科级审批流程参数
119 115
         Long sectionLeaderId = null;
120 116
         Object sectionLeaderIdObj = params.get("sectionLeaderId");
@@ -125,17 +121,17 @@ public class ApprovalController extends BaseController
125 121
                 sectionLeaderId = Long.parseLong((String) sectionLeaderIdObj);
126 122
             }
127 123
         }
128
-        
124
+
129 125
         if (sectionLeaderId == null) {
130 126
             return AjaxResult.error("sectionLeaderId参数不能为空");
131 127
         }
132
-        
128
+
133 129
         Map<String, Object> formData = (Map<String, Object>) params.get("formData");
134 130
         Map<String, Object> businessData = (Map<String, Object>) params.get("businessData");
135
-        
131
+
136 132
         ApprovalInstance instance = approvalEngineService.startSectionLevelProcess(
137
-            businessType, businessId, title, submitterId, submitterName, sectionLeaderId, formData, businessData);
138
-            
133
+                businessType, businessId, title, submitterId, submitterName, sectionLeaderId, formData, businessData);
134
+
139 135
         return AjaxResult.success("科级审批流程启动成功", instance);
140 136
     }
141 137
 
@@ -145,8 +141,7 @@ public class ApprovalController extends BaseController
145 141
     @PreAuthorize("@ss.hasPermi('system:approval:start')")
146 142
     @Log(title = "启动班组级审批流程", businessType = BusinessType.INSERT)
147 143
     @PostMapping("/start/group")
148
-    public AjaxResult startGroupLevelProcess(@RequestBody Map<String, Object> params)
149
-    {
144
+    public AjaxResult startGroupLevelProcess(@RequestBody Map<String, Object> params) {
150 145
         String businessType = (String) params.get("businessType");
151 146
         Long businessId = Long.valueOf(params.get("businessId").toString());
152 147
         String title = (String) params.get("title");
@@ -154,10 +149,10 @@ public class ApprovalController extends BaseController
154 149
         String submitterName = SecurityUtils.getUsername();
155 150
         Map<String, Object> formData = (Map<String, Object>) params.get("formData");
156 151
         Map<String, Object> businessData = (Map<String, Object>) params.get("businessData");
157
-        
152
+
158 153
         ApprovalInstance instance = approvalEngineService.startGroupLevelProcess(
159
-            businessType, businessId, title, submitterId, submitterName, formData, businessData);
160
-            
154
+                businessType, businessId, title, submitterId, submitterName, formData, businessData);
155
+
161 156
         return AjaxResult.success("班组级审批流程启动成功", instance);
162 157
     }
163 158
 
@@ -167,8 +162,7 @@ public class ApprovalController extends BaseController
167 162
     @PreAuthorize("@ss.hasPermi('system:approval:start')")
168 163
     @Log(title = "启动查获上报审批流程", businessType = BusinessType.INSERT)
169 164
     @PostMapping("/start/seizure")
170
-    public AjaxResult startSeizureReportProcess(@RequestBody Map<String, Object> params)
171
-    {
165
+    public AjaxResult startSeizureReportProcess(@RequestBody Map<String, Object> params) {
172 166
         String businessType = (String) params.get("businessType");
173 167
         Long businessId = Long.valueOf(params.get("businessId").toString());
174 168
         String title = (String) params.get("title");
@@ -177,11 +171,11 @@ public class ApprovalController extends BaseController
177 171
         String submitterRole = (String) params.get("submitterRole");
178 172
         Map<String, Object> formData = (Map<String, Object>) params.get("formData");
179 173
         Map<String, Object> businessData = (Map<String, Object>) params.get("businessData");
180
-        
174
+
181 175
         ApprovalInstance instance = approvalEngineService.startSeizureReportProcess(
182
-            businessType, businessId, title, submitterId, submitterName, 
183
-            submitterRole, formData, businessData);
184
-            
176
+                businessType, businessId, title, submitterId, submitterName,
177
+                submitterRole, formData, businessData);
178
+
185 179
         return AjaxResult.success("查获上报审批流程启动成功", instance);
186 180
     }
187 181
 
@@ -191,13 +185,12 @@ public class ApprovalController extends BaseController
191 185
     @PreAuthorize("@ss.hasPermi('system:approval:approve')")
192 186
     @Log(title = "审批任务", businessType = BusinessType.UPDATE)
193 187
     @PutMapping("/approve/{taskId}")
194
-    public AjaxResult approveTask(@PathVariable("taskId") Long taskId, @RequestBody Map<String, Object> params)
195
-    {
188
+    public AjaxResult approveTask(@PathVariable("taskId") Long taskId, @RequestBody Map<String, Object> params) {
196 189
         Long operatorId = SecurityUtils.getUserId();
197 190
         String operatorName = SecurityUtils.getUsername();
198 191
         String comment = (String) params.get("comment");
199 192
         Map<String, Object> formData = (Map<String, Object>) params.get("formData");
200
-        
193
+
201 194
         boolean result = approvalEngineService.approveTask(taskId, operatorId, operatorName, comment, formData);
202 195
         return result ? AjaxResult.success("审批成功") : AjaxResult.error("审批失败");
203 196
     }
@@ -208,12 +201,11 @@ public class ApprovalController extends BaseController
208 201
     @PreAuthorize("@ss.hasPermi('system:approval:reject')")
209 202
     @Log(title = "驳回任务", businessType = BusinessType.UPDATE)
210 203
     @PutMapping("/reject/{taskId}")
211
-    public AjaxResult rejectTask(@PathVariable("taskId") Long taskId, @RequestBody Map<String, Object> params)
212
-    {
204
+    public AjaxResult rejectTask(@PathVariable("taskId") Long taskId, @RequestBody Map<String, Object> params) {
213 205
         Long operatorId = SecurityUtils.getUserId();
214 206
         String operatorName = SecurityUtils.getUsername();
215 207
         String comment = (String) params.get("comment");
216
-        
208
+
217 209
         boolean result = approvalEngineService.rejectTask(taskId, operatorId, operatorName, comment);
218 210
         return result ? AjaxResult.success("驳回成功") : AjaxResult.error("驳回失败");
219 211
     }
@@ -224,12 +216,11 @@ public class ApprovalController extends BaseController
224 216
     @PreAuthorize("@ss.hasPermi('system:approval:cancel')")
225 217
     @Log(title = "取消审批流程", businessType = BusinessType.UPDATE)
226 218
     @PutMapping("/cancel/{instanceId}")
227
-    public AjaxResult cancelProcess(@PathVariable("instanceId") Long instanceId, @RequestBody Map<String, Object> params)
228
-    {
219
+    public AjaxResult cancelProcess(@PathVariable("instanceId") Long instanceId, @RequestBody Map<String, Object> params) {
229 220
         Long operatorId = SecurityUtils.getUserId();
230 221
         String operatorName = SecurityUtils.getUsername();
231 222
         String comment = (String) params.get("comment");
232
-        
223
+
233 224
         boolean result = approvalEngineService.cancelProcess(instanceId, operatorId, operatorName, comment);
234 225
         return result ? AjaxResult.success("取消成功") : AjaxResult.error("取消失败");
235 226
     }
@@ -239,8 +230,7 @@ public class ApprovalController extends BaseController
239 230
      */
240 231
     @PreAuthorize("@ss.hasPermi('system:approval:query')")
241 232
     @GetMapping("/tasks/pending")
242
-    public TableDataInfo getPendingTasks()
243
-    {
233
+    public TableDataInfo getPendingTasks() {
244 234
         Long userId = SecurityUtils.getUserId();
245 235
         List<ApprovalTask> list = approvalEngineService.getUserPendingTasks(userId);
246 236
         return getDataTable(list);
@@ -251,8 +241,7 @@ public class ApprovalController extends BaseController
251 241
      */
252 242
     @PreAuthorize("@ss.hasPermi('system:approval:query')")
253 243
     @GetMapping("/tasks/completed")
254
-    public TableDataInfo getCompletedTasks()
255
-    {
244
+    public TableDataInfo getCompletedTasks() {
256 245
         Long userId = SecurityUtils.getUserId();
257 246
         List<ApprovalTask> list = approvalEngineService.getUserCompletedTasks(userId);
258 247
         return getDataTable(list);
@@ -263,8 +252,7 @@ public class ApprovalController extends BaseController
263 252
      */
264 253
     @PreAuthorize("@ss.hasPermi('system:approval:query')")
265 254
     @GetMapping("/instances/submitted")
266
-    public TableDataInfo getSubmittedInstances(String status)
267
-    {
255
+    public TableDataInfo getSubmittedInstances(String status) {
268 256
         Long userId = SecurityUtils.getUserId();
269 257
         List<ApprovalInstance> list = approvalEngineService.getUserSubmittedInstances(userId, status);
270 258
         return getDataTable(list);
@@ -274,8 +262,7 @@ public class ApprovalController extends BaseController
274 262
      * 根据业务类型和级别获取流程代码
275 263
      */
276 264
     @GetMapping("/workflow/code")
277
-    public AjaxResult getWorkflowCode(String businessType, String level, String submitterRole)
278
-    {
265
+    public AjaxResult getWorkflowCode(String businessType, String level, String submitterRole) {
279 266
         String workflowCode = approvalEngineService.getWorkflowCodeByBusinessAndLevel(businessType, level, submitterRole);
280 267
         return AjaxResult.success(workflowCode);
281 268
     }
@@ -284,8 +271,7 @@ public class ApprovalController extends BaseController
284 271
      * 统计用户待办任务数量
285 272
      */
286 273
     @GetMapping("/tasks/pending/count")
287
-    public AjaxResult getPendingTasksCount()
288
-    {
274
+    public AjaxResult getPendingTasksCount() {
289 275
         Long userId = SecurityUtils.getUserId();
290 276
         List<ApprovalTask> tasks = approvalEngineService.getUserPendingTasks(userId);
291 277
         return AjaxResult.success(tasks.size());
@@ -293,6 +279,7 @@ public class ApprovalController extends BaseController
293 279
 
294 280
     /**
295 281
      * 批量审批任务(同意)
282
+     *
296 283
      * @param ids 任务ID列表
297 284
      */
298 285
     @PreAuthorize("@ss.hasPermi('system:approval:approve')")
@@ -308,6 +295,7 @@ public class ApprovalController extends BaseController
308 295
 
309 296
     /**
310 297
      * 批量驳回任务
298
+     *
311 299
      * @param ids 任务ID列表
312 300
      */
313 301
     @PreAuthorize("@ss.hasPermi('system:approval:reject')")

+ 45 - 46
airport-admin/src/main/java/com/sundot/airport/web/controller/approval/CheckApprovalController.java

@@ -25,20 +25,19 @@ import com.sundot.airport.system.domain.approval.dto.ApprovalCcDetailDTO;
25 25
 
26 26
 /**
27 27
  * 安检审批流程Controller
28
- * 
28
+ *
29 29
  * @author simon lin
30 30
  * @date 2025-09-06
31 31
  */
32 32
 @RestController
33 33
 @RequestMapping("/system/check")
34
-public class CheckApprovalController extends BaseController
35
-{
34
+public class CheckApprovalController extends BaseController {
36 35
     @Autowired
37 36
     private IApprovalEngineService approvalEngineService;
38
-    
37
+
39 38
     @Autowired
40 39
     private IApprovalUserService approvalUserService;
41
-    
40
+
42 41
     @Autowired
43 42
     private ICheckApprovalService checkApprovalService;
44 43
 
@@ -51,13 +50,13 @@ public class CheckApprovalController extends BaseController
51 50
     public AjaxResult submitPersonalCheck(@RequestBody Map<String, Object> requestData) {
52 51
         // 获取备注参数
53 52
         String remark = (String) requestData.get("remark");
54
-        
53
+
55 54
         try {
56 55
             ApprovalInstance instance = checkApprovalService.submitPersonalCheck(
57
-                requestData, 
58
-                SecurityUtils.getUserId(), 
59
-                SecurityUtils.getUsername(), 
60
-                remark
56
+                    requestData,
57
+                    SecurityUtils.getUserId(),
58
+                    SecurityUtils.getUsername(),
59
+                    remark
61 60
             );
62 61
             return AjaxResult.success("个人级别检查流程启动成功", instance);
63 62
         } catch (Exception e) {
@@ -75,13 +74,13 @@ public class CheckApprovalController extends BaseController
75 74
     public AjaxResult submitSectionCheck(@RequestBody Map<String, Object> requestData) {
76 75
         // 获取备注参数
77 76
         String remark = (String) requestData.get("remark");
78
-        
77
+
79 78
         try {
80 79
             ApprovalInstance instance = checkApprovalService.submitSectionCheck(
81
-                requestData, 
82
-                SecurityUtils.getUserId(), 
83
-                SecurityUtils.getUsername(), 
84
-                remark
80
+                    requestData,
81
+                    SecurityUtils.getUserId(),
82
+                    SecurityUtils.getUsername(),
83
+                    remark
85 84
             );
86 85
             return AjaxResult.success("科级检查流程启动成功", instance);
87 86
         } catch (Exception e) {
@@ -99,13 +98,13 @@ public class CheckApprovalController extends BaseController
99 98
     public AjaxResult submitGroupCheck(@RequestBody Map<String, Object> requestData) {
100 99
         // 获取备注参数
101 100
         String remark = (String) requestData.get("remark");
102
-        
101
+
103 102
         try {
104 103
             ApprovalInstance instance = checkApprovalService.submitGroupCheck(
105
-                requestData, 
106
-                SecurityUtils.getUserId(), 
107
-                SecurityUtils.getUsername(), 
108
-                remark
104
+                    requestData,
105
+                    SecurityUtils.getUserId(),
106
+                    SecurityUtils.getUsername(),
107
+                    remark
109 108
             );
110 109
             return AjaxResult.success("班组级检查流程启动成功", instance);
111 110
         } catch (Exception e) {
@@ -123,13 +122,13 @@ public class CheckApprovalController extends BaseController
123 122
     public AjaxResult submitSeizureReport(@RequestBody Map<String, Object> requestData) {
124 123
         // 获取备注参数
125 124
         String remark = (String) requestData.get("remark");
126
-        
125
+
127 126
         try {
128 127
             ApprovalInstance instance = checkApprovalService.submitSeizureReport(
129
-                requestData, 
130
-                SecurityUtils.getUserId(), 
131
-                SecurityUtils.getUsername(), 
132
-                remark
128
+                    requestData,
129
+                    SecurityUtils.getUserId(),
130
+                    SecurityUtils.getUsername(),
131
+                    remark
133 132
             );
134 133
             return AjaxResult.success("查获上报流程启动成功", instance);
135 134
         } catch (Exception e) {
@@ -147,11 +146,11 @@ public class CheckApprovalController extends BaseController
147 146
     public AjaxResult approveTask(@PathVariable Long taskId, @Valid @RequestBody ApprovalDTO approvalData) {
148 147
         try {
149 148
             ApprovalTask task = checkApprovalService.approveTask(
150
-                taskId, 
151
-                approvalData.getComment(), 
152
-                approvalData.getFormData(), 
153
-                SecurityUtils.getUserId(), 
154
-                SecurityUtils.getUsername()
149
+                    taskId,
150
+                    approvalData.getComment(),
151
+                    approvalData.getFormData(),
152
+                    SecurityUtils.getUserId(),
153
+                    SecurityUtils.getUsername()
155 154
             );
156 155
             return AjaxResult.success("任务审批成功", task);
157 156
         } catch (Exception e) {
@@ -169,10 +168,10 @@ public class CheckApprovalController extends BaseController
169 168
     public AjaxResult rejectTask(@PathVariable Long taskId, @Valid @RequestBody RejectDTO rejectData) {
170 169
         try {
171 170
             ApprovalTask task = checkApprovalService.rejectTask(
172
-                taskId, 
173
-                rejectData.getRejectReason(), 
174
-                SecurityUtils.getUserId(), 
175
-                SecurityUtils.getUsername()
171
+                    taskId,
172
+                    rejectData.getRejectReason(),
173
+                    SecurityUtils.getUserId(),
174
+                    SecurityUtils.getUsername()
176 175
             );
177 176
             return AjaxResult.success("任务驳回成功", task);
178 177
         } catch (Exception e) {
@@ -251,8 +250,8 @@ public class CheckApprovalController extends BaseController
251 250
      */
252 251
     @PreAuthorize("@ss.hasPermi('system:approval:query')")
253 252
     @GetMapping("/approval/workflow-code")
254
-    public AjaxResult getWorkflowCode(@RequestParam String businessType, 
255
-                                     @RequestParam(required = false) String submitterRole) {
253
+    public AjaxResult getWorkflowCode(@RequestParam String businessType,
254
+                                      @RequestParam(required = false) String submitterRole) {
256 255
         try {
257 256
             // 暂时返回空值,需要实现该方法
258 257
             String workflowCode = null;
@@ -293,7 +292,7 @@ public class CheckApprovalController extends BaseController
293 292
             return getDataTable(null);
294 293
         }
295 294
     }
296
-    
295
+
297 296
     /**
298 297
      * 14. 根据实例ID获取审批历史
299 298
      */
@@ -301,15 +300,15 @@ public class CheckApprovalController extends BaseController
301 300
     @GetMapping("/approval/history/instance/{instanceId}")
302 301
     public TableDataInfo getApprovalHistoryByInstanceId(@PathVariable Long instanceId) {
303 302
         try {
304
-            List<com.sundot.airport.system.domain.approval.ApprovalHistory> list = 
305
-                checkApprovalService.getApprovalHistoryByInstanceId(instanceId);
303
+            List<com.sundot.airport.system.domain.approval.ApprovalHistory> list =
304
+                    checkApprovalService.getApprovalHistoryByInstanceId(instanceId);
306 305
             return getDataTable(list);
307 306
         } catch (Exception e) {
308 307
             logger.error("根据实例ID获取审批历史失败", e);
309 308
             return getDataTable(null);
310 309
         }
311 310
     }
312
-    
311
+
313 312
     /**
314 313
      * 15. 根据任务ID获取审批历史
315 314
      */
@@ -317,15 +316,15 @@ public class CheckApprovalController extends BaseController
317 316
     @GetMapping("/approval/history/task/{taskId}")
318 317
     public TableDataInfo getApprovalHistoryByTaskId(@PathVariable Long taskId) {
319 318
         try {
320
-            List<com.sundot.airport.system.domain.approval.ApprovalHistory> list = 
321
-                checkApprovalService.getApprovalHistoryByTaskId(taskId);
319
+            List<com.sundot.airport.system.domain.approval.ApprovalHistory> list =
320
+                    checkApprovalService.getApprovalHistoryByTaskId(taskId);
322 321
             return getDataTable(list);
323 322
         } catch (Exception e) {
324 323
             logger.error("根据任务ID获取审批历史失败", e);
325 324
             return getDataTable(null);
326 325
         }
327 326
     }
328
-    
327
+
329 328
     /**
330 329
      * 16. 获取用户的审批历史记录
331 330
      */
@@ -333,15 +332,15 @@ public class CheckApprovalController extends BaseController
333 332
     @GetMapping("/approval/history/user")
334 333
     public TableDataInfo getUserApprovalHistory(@RequestParam(required = false) String action) {
335 334
         try {
336
-            List<com.sundot.airport.system.domain.approval.ApprovalHistory> list = 
337
-                checkApprovalService.getUserApprovalHistory(SecurityUtils.getUserId(), action);
335
+            List<com.sundot.airport.system.domain.approval.ApprovalHistory> list =
336
+                    checkApprovalService.getUserApprovalHistory(SecurityUtils.getUserId(), action);
338 337
             return getDataTable(list);
339 338
         } catch (Exception e) {
340 339
             logger.error("获取用户审批历史失败", e);
341 340
             return getDataTable(null);
342 341
         }
343 342
     }
344
-    
343
+
345 344
     /**
346 345
      * 17. 批量更新抄送消息已读状态
347 346
      */

+ 49 - 26
airport-admin/src/main/java/com/sundot/airport/web/controller/approval/dto/ApprovalDTO.java

@@ -6,47 +6,70 @@ import java.util.Map;
6 6
 
7 7
 /**
8 8
  * 审批DTO
9
- * 
9
+ *
10 10
  * @author simon lin
11 11
  * @date 2025-09-06
12 12
  */
13
-public class ApprovalDTO
14
-{
15
-    /** 审批意见 */
13
+public class ApprovalDTO {
14
+    /**
15
+     * 审批意见
16
+     */
16 17
     @NotBlank(message = "审批意见不能为空")
17 18
     private String comment;
18
-    
19
-    /** 节点类型 */
19
+
20
+    /**
21
+     * 节点类型
22
+     */
20 23
     private String nodeType;
21
-    
22
-    /** 目标班组ID */
24
+
25
+    /**
26
+     * 目标班组ID
27
+     */
23 28
     private Long targetGroupId;
24
-    
25
-    /** 整改要求 */
29
+
30
+    /**
31
+     * 整改要求
32
+     */
26 33
     private String rectificationRequirement;
27
-    
28
-    /** 整改详情 */
34
+
35
+    /**
36
+     * 整改详情
37
+     */
29 38
     private String rectificationDetail;
30
-    
31
-    /** 整改时间 */
39
+
40
+    /**
41
+     * 整改时间
42
+     */
32 43
     private Date rectificationTime;
33
-    
34
-    /** 整改结果 */
44
+
45
+    /**
46
+     * 整改结果
47
+     */
35 48
     private String rectificationResult;
36
-    
37
-    /** 复查结果 */
49
+
50
+    /**
51
+     * 复查结果
52
+     */
38 53
     private String reviewResult;
39
-    
40
-    /** 复查意见 */
54
+
55
+    /**
56
+     * 复查意见
57
+     */
41 58
     private String reviewComment;
42
-    
43
-    /** 最终决定 */
59
+
60
+    /**
61
+     * 最终决定
62
+     */
44 63
     private String finalDecision;
45
-    
46
-    /** 复查时间 */
64
+
65
+    /**
66
+     * 复查时间
67
+     */
47 68
     private Date reviewTime;
48
-    
49
-    /** 表单数据 */
69
+
70
+    /**
71
+     * 表单数据
72
+     */
50 73
     private Map<String, Object> formData;
51 74
 
52 75
     public String getComment() {

+ 21 - 12
airport-admin/src/main/java/com/sundot/airport/web/controller/approval/dto/PersonalCheckDTO.java

@@ -6,27 +6,36 @@ import java.util.List;
6 6
 
7 7
 /**
8 8
  * 个人级别检查DTO
9
- * 
9
+ *
10 10
  * @author simon lin
11 11
  * @date 2025-09-06
12 12
  */
13
-public class PersonalCheckDTO
14
-{
15
-    /** 业务ID */
13
+public class PersonalCheckDTO {
14
+    /**
15
+     * 业务ID
16
+     */
16 17
     @NotNull(message = "业务ID不能为空")
17 18
     private Long id;
18
-    
19
-    /** 检查描述 */
19
+
20
+    /**
21
+     * 检查描述
22
+     */
20 23
     @NotBlank(message = "检查描述不能为空")
21 24
     private String description;
22
-    
23
-    /** 检查类型 */
25
+
26
+    /**
27
+     * 检查类型
28
+     */
24 29
     private String checkType;
25
-    
26
-    /** 检查位置 */
30
+
31
+    /**
32
+     * 检查位置
33
+     */
27 34
     private String location;
28
-    
29
-    /** 目标用户ID列表 */
35
+
36
+    /**
37
+     * 目标用户ID列表
38
+     */
30 39
     @NotNull(message = "目标用户ID列表不能为空")
31 40
     private Long[] targetUserIds;
32 41
 

+ 5 - 4
airport-admin/src/main/java/com/sundot/airport/web/controller/approval/dto/RejectDTO.java

@@ -4,13 +4,14 @@ import javax.validation.constraints.NotBlank;
4 4
 
5 5
 /**
6 6
  * 驳回DTO
7
- * 
7
+ *
8 8
  * @author simon lin
9 9
  * @date 2025-09-06
10 10
  */
11
-public class RejectDTO
12
-{
13
-    /** 驳回理由 */
11
+public class RejectDTO {
12
+    /**
13
+     * 驳回理由
14
+     */
14 15
     @NotBlank(message = "驳回理由不能为空")
15 16
     private String rejectReason;
16 17
 

+ 21 - 12
airport-admin/src/main/java/com/sundot/airport/web/controller/approval/dto/SectionCheckDTO.java

@@ -5,27 +5,36 @@ import javax.validation.constraints.NotNull;
5 5
 
6 6
 /**
7 7
  * 科级检查DTO
8
- * 
8
+ *
9 9
  * @author simon lin
10 10
  * @date 2025-09-06
11 11
  */
12
-public class SectionCheckDTO
13
-{
14
-    /** 业务ID */
12
+public class SectionCheckDTO {
13
+    /**
14
+     * 业务ID
15
+     */
15 16
     @NotNull(message = "业务ID不能为空")
16 17
     private Long id;
17
-    
18
-    /** 检查描述 */
18
+
19
+    /**
20
+     * 检查描述
21
+     */
19 22
     @NotBlank(message = "检查描述不能为空")
20 23
     private String description;
21
-    
22
-    /** 检查类型 */
24
+
25
+    /**
26
+     * 检查类型
27
+     */
23 28
     private String checkType;
24
-    
25
-    /** 严重程度 */
29
+
30
+    /**
31
+     * 严重程度
32
+     */
26 33
     private String severity;
27
-    
28
-    /** 目标部门ID */
34
+
35
+    /**
36
+     * 目标部门ID
37
+     */
29 38
     private Long targetDeptId;
30 39
 
31 40
     public Long getId() {

+ 25 - 14
airport-admin/src/main/java/com/sundot/airport/web/controller/approval/dto/SeizureReportDTO.java

@@ -6,30 +6,41 @@ import java.util.Date;
6 6
 
7 7
 /**
8 8
  * 查获上报DTO
9
- * 
9
+ *
10 10
  * @author simon lin
11 11
  * @date 2025-09-06
12 12
  */
13
-public class SeizureReportDTO
14
-{
15
-    /** 业务ID */
13
+public class SeizureReportDTO {
14
+    /**
15
+     * 业务ID
16
+     */
16 17
     @NotNull(message = "业务ID不能为空")
17 18
     private Long id;
18
-    
19
-    /** 物品类型 */
19
+
20
+    /**
21
+     * 物品类型
22
+     */
20 23
     @NotBlank(message = "物品类型不能为空")
21 24
     private String itemType;
22
-    
23
-    /** 数量 */
25
+
26
+    /**
27
+     * 数量
28
+     */
24 29
     private Integer quantity;
25
-    
26
-    /** 位置 */
30
+
31
+    /**
32
+     * 位置
33
+     */
27 34
     private String location;
28
-    
29
-    /** 查获时间 */
35
+
36
+    /**
37
+     * 查获时间
38
+     */
30 39
     private Date seizureTime;
31
-    
32
-    /** 旅客信息 */
40
+
41
+    /**
42
+     * 旅客信息
43
+     */
33 44
     private String passengerInfo;
34 45
 
35 46
     public Long getId() {

+ 17 - 18
airport-system/src/main/java/com/sundot/airport/system/mapper/approval/ApprovalCcMapper.java

@@ -10,16 +10,15 @@ import org.apache.ibatis.annotations.Param;
10 10
 
11 11
 /**
12 12
  * 审批抄送Mapper接口
13
- * 
13
+ *
14 14
  * @author simon lin
15 15
  * @date 2025-09-06
16 16
  */
17 17
 @Mapper
18
-public interface ApprovalCcMapper extends BaseMapper<ApprovalCc>
19
-{
18
+public interface ApprovalCcMapper extends BaseMapper<ApprovalCc> {
20 19
     /**
21 20
      * 查询审批抄送
22
-     * 
21
+     *
23 22
      * @param id 审批抄送主键
24 23
      * @return 审批抄送
25 24
      */
@@ -27,7 +26,7 @@ public interface ApprovalCcMapper extends BaseMapper<ApprovalCc>
27 26
 
28 27
     /**
29 28
      * 根据实例ID查询审批抄送列表
30
-     * 
29
+     *
31 30
      * @param instanceId 实例ID
32 31
      * @return 审批抄送列表
33 32
      */
@@ -35,16 +34,16 @@ public interface ApprovalCcMapper extends BaseMapper<ApprovalCc>
35 34
 
36 35
     /**
37 36
      * 根据抄送用户ID查询审批抄送列表
38
-     * 
37
+     *
39 38
      * @param ccUserId 抄送用户ID
40
-     * @param isRead 是否已读
39
+     * @param isRead   是否已读
41 40
      * @return 审批抄送列表
42 41
      */
43 42
     List<ApprovalCc> selectApprovalCcByCcUser(@Param("ccUserId") Long ccUserId, @Param("isRead") String isRead);
44 43
 
45 44
     /**
46 45
      * 查询审批抄送列表
47
-     * 
46
+     *
48 47
      * @param approvalCc 审批抄送
49 48
      * @return 审批抄送集合
50 49
      */
@@ -52,7 +51,7 @@ public interface ApprovalCcMapper extends BaseMapper<ApprovalCc>
52 51
 
53 52
     /**
54 53
      * 新增审批抄送
55
-     * 
54
+     *
56 55
      * @param approvalCc 审批抄送
57 56
      * @return 结果
58 57
      */
@@ -60,7 +59,7 @@ public interface ApprovalCcMapper extends BaseMapper<ApprovalCc>
60 59
 
61 60
     /**
62 61
      * 修改审批抄送
63
-     * 
62
+     *
64 63
      * @param approvalCc 审批抄送
65 64
      * @return 结果
66 65
      */
@@ -68,7 +67,7 @@ public interface ApprovalCcMapper extends BaseMapper<ApprovalCc>
68 67
 
69 68
     /**
70 69
      * 删除审批抄送
71
-     * 
70
+     *
72 71
      * @param id 审批抄送主键
73 72
      * @return 结果
74 73
      */
@@ -76,7 +75,7 @@ public interface ApprovalCcMapper extends BaseMapper<ApprovalCc>
76 75
 
77 76
     /**
78 77
      * 批量删除审批抄送
79
-     * 
78
+     *
80 79
      * @param ids 需要删除的数据主键集合
81 80
      * @return 结果
82 81
      */
@@ -84,7 +83,7 @@ public interface ApprovalCcMapper extends BaseMapper<ApprovalCc>
84 83
 
85 84
     /**
86 85
      * 根据实例ID删除审批抄送
87
-     * 
86
+     *
88 87
      * @param instanceId 实例ID
89 88
      * @return 结果
90 89
      */
@@ -92,16 +91,16 @@ public interface ApprovalCcMapper extends BaseMapper<ApprovalCc>
92 91
 
93 92
     /**
94 93
      * 统计用户抄送消息数量
95
-     * 
94
+     *
96 95
      * @param ccUserId 抄送用户ID
97
-     * @param isRead 是否已读
96
+     * @param isRead   是否已读
98 97
      * @return 抄送消息数量
99 98
      */
100 99
     int countCcMessagesByCcUser(@Param("ccUserId") Long ccUserId, @Param("isRead") String isRead);
101 100
 
102 101
     /**
103 102
      * 获取用户抄送详情列表(关联实例和历史)
104
-     * 
103
+     *
105 104
      * @param ccUserId 抄送用户ID
106 105
      * @return 抄送详情列表
107 106
      */
@@ -109,7 +108,7 @@ public interface ApprovalCcMapper extends BaseMapper<ApprovalCc>
109 108
 
110 109
     /**
111 110
      * 直接获取用户抄送详情DTO列表(支持分页)
112
-     * 
111
+     *
113 112
      * @param ccUserId 抄送用户ID
114 113
      * @return 抄送详情DTO列表
115 114
      */
@@ -117,7 +116,7 @@ public interface ApprovalCcMapper extends BaseMapper<ApprovalCc>
117 116
 
118 117
     /**
119 118
      * 批量更新审批抄送已读状态
120
-     * 
119
+     *
121 120
      * @param ids 需要更新的ID列表
122 121
      * @return 结果
123 122
      */

+ 13 - 14
airport-system/src/main/java/com/sundot/airport/system/mapper/approval/ApprovalHistoryMapper.java

@@ -9,16 +9,15 @@ import org.apache.ibatis.annotations.Param;
9 9
 
10 10
 /**
11 11
  * 审批历史Mapper接口
12
- * 
12
+ *
13 13
  * @author simon lin
14 14
  * @date 2025-09-06
15 15
  */
16 16
 @Mapper
17
-public interface ApprovalHistoryMapper extends BaseMapper<ApprovalHistory>
18
-{
17
+public interface ApprovalHistoryMapper extends BaseMapper<ApprovalHistory> {
19 18
     /**
20 19
      * 查询审批历史
21
-     * 
20
+     *
22 21
      * @param id 审批历史主键
23 22
      * @return 审批历史
24 23
      */
@@ -26,7 +25,7 @@ public interface ApprovalHistoryMapper extends BaseMapper<ApprovalHistory>
26 25
 
27 26
     /**
28 27
      * 根据实例ID查询审批历史列表
29
-     * 
28
+     *
30 29
      * @param instanceId 实例ID
31 30
      * @return 审批历史列表
32 31
      */
@@ -34,7 +33,7 @@ public interface ApprovalHistoryMapper extends BaseMapper<ApprovalHistory>
34 33
 
35 34
     /**
36 35
      * 根据任务ID查询审批历史列表
37
-     * 
36
+     *
38 37
      * @param taskId 任务ID
39 38
      * @return 审批历史列表
40 39
      */
@@ -42,16 +41,16 @@ public interface ApprovalHistoryMapper extends BaseMapper<ApprovalHistory>
42 41
 
43 42
     /**
44 43
      * 根据操作人ID查询审批历史列表
45
-     * 
44
+     *
46 45
      * @param operatorId 操作人ID
47
-     * @param action 操作类型
46
+     * @param action     操作类型
48 47
      * @return 审批历史列表
49 48
      */
50 49
     List<ApprovalHistory> selectApprovalHistoryByOperator(@Param("operatorId") Long operatorId, @Param("action") String action);
51 50
 
52 51
     /**
53 52
      * 查询审批历史列表
54
-     * 
53
+     *
55 54
      * @param approvalHistory 审批历史
56 55
      * @return 审批历史集合
57 56
      */
@@ -59,7 +58,7 @@ public interface ApprovalHistoryMapper extends BaseMapper<ApprovalHistory>
59 58
 
60 59
     /**
61 60
      * 新增审批历史
62
-     * 
61
+     *
63 62
      * @param approvalHistory 审批历史
64 63
      * @return 结果
65 64
      */
@@ -67,7 +66,7 @@ public interface ApprovalHistoryMapper extends BaseMapper<ApprovalHistory>
67 66
 
68 67
     /**
69 68
      * 修改审批历史
70
-     * 
69
+     *
71 70
      * @param approvalHistory 审批历史
72 71
      * @return 结果
73 72
      */
@@ -75,7 +74,7 @@ public interface ApprovalHistoryMapper extends BaseMapper<ApprovalHistory>
75 74
 
76 75
     /**
77 76
      * 删除审批历史
78
-     * 
77
+     *
79 78
      * @param id 审批历史主键
80 79
      * @return 结果
81 80
      */
@@ -83,7 +82,7 @@ public interface ApprovalHistoryMapper extends BaseMapper<ApprovalHistory>
83 82
 
84 83
     /**
85 84
      * 批量删除审批历史
86
-     * 
85
+     *
87 86
      * @param ids 需要删除的数据主键集合
88 87
      * @return 结果
89 88
      */
@@ -91,7 +90,7 @@ public interface ApprovalHistoryMapper extends BaseMapper<ApprovalHistory>
91 90
 
92 91
     /**
93 92
      * 根据实例ID删除审批历史
94
-     * 
93
+     *
95 94
      * @param instanceId 实例ID
96 95
      * @return 结果
97 96
      */

+ 18 - 19
airport-system/src/main/java/com/sundot/airport/system/mapper/approval/ApprovalInstanceMapper.java

@@ -11,16 +11,15 @@ import org.apache.ibatis.annotations.Param;
11 11
 
12 12
 /**
13 13
  * 审批实例Mapper接口
14
- * 
14
+ *
15 15
  * @author simon lin
16 16
  * @date 2025-09-06
17 17
  */
18 18
 @Mapper
19
-public interface ApprovalInstanceMapper extends BaseMapper<ApprovalInstance>
20
-{
19
+public interface ApprovalInstanceMapper extends BaseMapper<ApprovalInstance> {
21 20
     /**
22 21
      * 查询审批实例
23
-     * 
22
+     *
24 23
      * @param id 审批实例主键
25 24
      * @return 审批实例
26 25
      */
@@ -28,7 +27,7 @@ public interface ApprovalInstanceMapper extends BaseMapper<ApprovalInstance>
28 27
 
29 28
     /**
30 29
      * 根据实例编号查询审批实例
31
-     * 
30
+     *
32 31
      * @param instanceNo 实例编号
33 32
      * @return 审批实例
34 33
      */
@@ -36,25 +35,25 @@ public interface ApprovalInstanceMapper extends BaseMapper<ApprovalInstance>
36 35
 
37 36
     /**
38 37
      * 根据业务类型和业务ID查询审批实例
39
-     * 
38
+     *
40 39
      * @param businessType 业务类型
41
-     * @param businessId 业务ID
40
+     * @param businessId   业务ID
42 41
      * @return 审批实例列表
43 42
      */
44 43
     List<ApprovalInstance> selectApprovalInstanceByBusiness(@Param("businessType") String businessType, @Param("businessId") Long businessId);
45 44
 
46 45
     /**
47 46
      * 根据提交人ID查询审批实例列表
48
-     * 
47
+     *
49 48
      * @param submitterId 提交人ID
50
-     * @param status 实例状态
49
+     * @param status      实例状态
51 50
      * @return 审批实例列表
52 51
      */
53 52
     List<ApprovalInstance> selectApprovalInstanceBySubmitter(@Param("submitterId") Long submitterId, @Param("status") String status);
54 53
 
55 54
     /**
56 55
      * 查询审批实例列表
57
-     * 
56
+     *
58 57
      * @param approvalInstance 审批实例
59 58
      * @return 审批实例集合
60 59
      */
@@ -64,9 +63,9 @@ public interface ApprovalInstanceMapper extends BaseMapper<ApprovalInstance>
64 63
      * 根据工作流ID列表、时间范围和用户ID列表查询审批实例列表
65 64
      *
66 65
      * @param workflowIds 工作流ID列表
67
-     * @param beginTime 开始时间
68
-     * @param endTime 结束时间
69
-     * @param userIds 用户ID列表
66
+     * @param beginTime   开始时间
67
+     * @param endTime     结束时间
68
+     * @param userIds     用户ID列表
70 69
      * @return 审批实例集合
71 70
      */
72 71
     List<ApprovalInstance> selectApprovalInstancesByWorkflowIdsAndTimeRangeAndUsers(
@@ -77,7 +76,7 @@ public interface ApprovalInstanceMapper extends BaseMapper<ApprovalInstance>
77 76
 
78 77
     /**
79 78
      * 查询审批实例详情(包含关联数据)
80
-     * 
79
+     *
81 80
      * @param id 审批实例主键
82 81
      * @return 审批实例
83 82
      */
@@ -85,7 +84,7 @@ public interface ApprovalInstanceMapper extends BaseMapper<ApprovalInstance>
85 84
 
86 85
     /**
87 86
      * 新增审批实例
88
-     * 
87
+     *
89 88
      * @param approvalInstance 审批实例
90 89
      * @return 结果
91 90
      */
@@ -93,7 +92,7 @@ public interface ApprovalInstanceMapper extends BaseMapper<ApprovalInstance>
93 92
 
94 93
     /**
95 94
      * 修改审批实例
96
-     * 
95
+     *
97 96
      * @param approvalInstance 审批实例
98 97
      * @return 结果
99 98
      */
@@ -101,7 +100,7 @@ public interface ApprovalInstanceMapper extends BaseMapper<ApprovalInstance>
101 100
 
102 101
     /**
103 102
      * 删除审批实例
104
-     * 
103
+     *
105 104
      * @param id 审批实例主键
106 105
      * @return 结果
107 106
      */
@@ -109,7 +108,7 @@ public interface ApprovalInstanceMapper extends BaseMapper<ApprovalInstance>
109 108
 
110 109
     /**
111 110
      * 批量删除审批实例
112
-     * 
111
+     *
113 112
      * @param ids 需要删除的数据主键集合
114 113
      * @return 结果
115 114
      */
@@ -117,7 +116,7 @@ public interface ApprovalInstanceMapper extends BaseMapper<ApprovalInstance>
117 116
 
118 117
     /**
119 118
      * 生成实例编号
120
-     * 
119
+     *
121 120
      * @return 实例编号
122 121
      */
123 122
     String generateInstanceNo();

+ 17 - 18
airport-system/src/main/java/com/sundot/airport/system/mapper/approval/ApprovalNodeDefinitionMapper.java

@@ -9,16 +9,15 @@ import org.apache.ibatis.annotations.Param;
9 9
 
10 10
 /**
11 11
  * 审批节点定义Mapper接口
12
- * 
12
+ *
13 13
  * @author simon lin
14 14
  * @date 2025-09-06
15 15
  */
16 16
 @Mapper
17
-public interface ApprovalNodeDefinitionMapper extends BaseMapper<ApprovalNodeDefinition>
18
-{
17
+public interface ApprovalNodeDefinitionMapper extends BaseMapper<ApprovalNodeDefinition> {
19 18
     /**
20 19
      * 查询审批节点定义
21
-     * 
20
+     *
22 21
      * @param id 审批节点定义主键
23 22
      * @return 审批节点定义
24 23
      */
@@ -26,7 +25,7 @@ public interface ApprovalNodeDefinitionMapper extends BaseMapper<ApprovalNodeDef
26 25
 
27 26
     /**
28 27
      * 根据流程ID查询审批节点定义列表
29
-     * 
28
+     *
30 29
      * @param workflowId 流程定义ID
31 30
      * @return 审批节点定义列表
32 31
      */
@@ -34,16 +33,16 @@ public interface ApprovalNodeDefinitionMapper extends BaseMapper<ApprovalNodeDef
34 33
 
35 34
     /**
36 35
      * 根据流程ID和节点代码查询审批节点定义
37
-     * 
36
+     *
38 37
      * @param workflowId 流程定义ID
39
-     * @param nodeCode 节点代码
38
+     * @param nodeCode   节点代码
40 39
      * @return 审批节点定义
41 40
      */
42 41
     ApprovalNodeDefinition selectApprovalNodeDefinitionByWorkflowAndCode(@Param("workflowId") Long workflowId, @Param("nodeCode") String nodeCode);
43 42
 
44 43
     /**
45 44
      * 根据流程ID查询第一个节点
46
-     * 
45
+     *
47 46
      * @param workflowId 流程定义ID
48 47
      * @return 审批节点定义
49 48
      */
@@ -51,8 +50,8 @@ public interface ApprovalNodeDefinitionMapper extends BaseMapper<ApprovalNodeDef
51 50
 
52 51
     /**
53 52
      * 根据流程ID和当前节点顺序查询下一个节点
54
-     * 
55
-     * @param workflowId 流程定义ID
53
+     *
54
+     * @param workflowId   流程定义ID
56 55
      * @param currentOrder 当前节点顺序
57 56
      * @return 审批节点定义
58 57
      */
@@ -60,8 +59,8 @@ public interface ApprovalNodeDefinitionMapper extends BaseMapper<ApprovalNodeDef
60 59
 
61 60
     /**
62 61
      * 根据流程ID和当前节点顺序查询上一个节点
63
-     * 
64
-     * @param workflowId 流程定义ID
62
+     *
63
+     * @param workflowId   流程定义ID
65 64
      * @param currentOrder 当前节点顺序
66 65
      * @return 审批节点定义
67 66
      */
@@ -69,7 +68,7 @@ public interface ApprovalNodeDefinitionMapper extends BaseMapper<ApprovalNodeDef
69 68
 
70 69
     /**
71 70
      * 查询审批节点定义列表
72
-     * 
71
+     *
73 72
      * @param approvalNodeDefinition 审批节点定义
74 73
      * @return 审批节点定义集合
75 74
      */
@@ -77,7 +76,7 @@ public interface ApprovalNodeDefinitionMapper extends BaseMapper<ApprovalNodeDef
77 76
 
78 77
     /**
79 78
      * 新增审批节点定义
80
-     * 
79
+     *
81 80
      * @param approvalNodeDefinition 审批节点定义
82 81
      * @return 结果
83 82
      */
@@ -85,7 +84,7 @@ public interface ApprovalNodeDefinitionMapper extends BaseMapper<ApprovalNodeDef
85 84
 
86 85
     /**
87 86
      * 修改审批节点定义
88
-     * 
87
+     *
89 88
      * @param approvalNodeDefinition 审批节点定义
90 89
      * @return 结果
91 90
      */
@@ -93,7 +92,7 @@ public interface ApprovalNodeDefinitionMapper extends BaseMapper<ApprovalNodeDef
93 92
 
94 93
     /**
95 94
      * 删除审批节点定义
96
-     * 
95
+     *
97 96
      * @param id 审批节点定义主键
98 97
      * @return 结果
99 98
      */
@@ -101,7 +100,7 @@ public interface ApprovalNodeDefinitionMapper extends BaseMapper<ApprovalNodeDef
101 100
 
102 101
     /**
103 102
      * 批量删除审批节点定义
104
-     * 
103
+     *
105 104
      * @param ids 需要删除的数据主键集合
106 105
      * @return 结果
107 106
      */
@@ -109,7 +108,7 @@ public interface ApprovalNodeDefinitionMapper extends BaseMapper<ApprovalNodeDef
109 108
 
110 109
     /**
111 110
      * 根据流程ID删除审批节点定义
112
-     * 
111
+     *
113 112
      * @param workflowId 流程定义ID
114 113
      * @return 结果
115 114
      */

+ 18 - 19
airport-system/src/main/java/com/sundot/airport/system/mapper/approval/ApprovalTaskMapper.java

@@ -9,16 +9,15 @@ import org.apache.ibatis.annotations.Param;
9 9
 
10 10
 /**
11 11
  * 审批任务Mapper接口
12
- * 
12
+ *
13 13
  * @author simon lin
14 14
  * @date 2025-09-06
15 15
  */
16 16
 @Mapper
17
-public interface ApprovalTaskMapper extends BaseMapper<ApprovalTask>
18
-{
17
+public interface ApprovalTaskMapper extends BaseMapper<ApprovalTask> {
19 18
     /**
20 19
      * 查询审批任务
21
-     * 
20
+     *
22 21
      * @param id 审批任务主键
23 22
      * @return 审批任务
24 23
      */
@@ -26,7 +25,7 @@ public interface ApprovalTaskMapper extends BaseMapper<ApprovalTask>
26 25
 
27 26
     /**
28 27
      * 根据任务编号查询审批任务
29
-     * 
28
+     *
30 29
      * @param taskNo 任务编号
31 30
      * @return 审批任务
32 31
      */
@@ -34,7 +33,7 @@ public interface ApprovalTaskMapper extends BaseMapper<ApprovalTask>
34 33
 
35 34
     /**
36 35
      * 根据实例ID查询审批任务列表
37
-     * 
36
+     *
38 37
      * @param instanceId 实例ID
39 38
      * @return 审批任务列表
40 39
      */
@@ -42,25 +41,25 @@ public interface ApprovalTaskMapper extends BaseMapper<ApprovalTask>
42 41
 
43 42
     /**
44 43
      * 根据处理人ID查询待办任务列表
45
-     * 
44
+     *
46 45
      * @param assigneeId 处理人ID
47
-     * @param status 任务状态
46
+     * @param status     任务状态
48 47
      * @return 审批任务列表
49 48
      */
50 49
     List<ApprovalTask> selectApprovalTaskByAssignee(@Param("assigneeId") Long assigneeId, @Param("status") String status);
51 50
 
52 51
     /**
53 52
      * 根据实例ID和节点ID查询审批任务
54
-     * 
53
+     *
55 54
      * @param instanceId 实例ID
56
-     * @param nodeId 节点ID
55
+     * @param nodeId     节点ID
57 56
      * @return 审批任务
58 57
      */
59 58
     ApprovalTask selectApprovalTaskByInstanceAndNode(@Param("instanceId") Long instanceId, @Param("nodeId") Long nodeId);
60 59
 
61 60
     /**
62 61
      * 查询审批任务列表
63
-     * 
62
+     *
64 63
      * @param approvalTask 审批任务
65 64
      * @return 审批任务集合
66 65
      */
@@ -68,7 +67,7 @@ public interface ApprovalTaskMapper extends BaseMapper<ApprovalTask>
68 67
 
69 68
     /**
70 69
      * 查询审批任务详情(包含关联数据)
71
-     * 
70
+     *
72 71
      * @param id 审批任务主键
73 72
      * @return 审批任务
74 73
      */
@@ -76,7 +75,7 @@ public interface ApprovalTaskMapper extends BaseMapper<ApprovalTask>
76 75
 
77 76
     /**
78 77
      * 新增审批任务
79
-     * 
78
+     *
80 79
      * @param approvalTask 审批任务
81 80
      * @return 结果
82 81
      */
@@ -84,7 +83,7 @@ public interface ApprovalTaskMapper extends BaseMapper<ApprovalTask>
84 83
 
85 84
     /**
86 85
      * 修改审批任务
87
-     * 
86
+     *
88 87
      * @param approvalTask 审批任务
89 88
      * @return 结果
90 89
      */
@@ -92,7 +91,7 @@ public interface ApprovalTaskMapper extends BaseMapper<ApprovalTask>
92 91
 
93 92
     /**
94 93
      * 删除审批任务
95
-     * 
94
+     *
96 95
      * @param id 审批任务主键
97 96
      * @return 结果
98 97
      */
@@ -100,7 +99,7 @@ public interface ApprovalTaskMapper extends BaseMapper<ApprovalTask>
100 99
 
101 100
     /**
102 101
      * 批量删除审批任务
103
-     * 
102
+     *
104 103
      * @param ids 需要删除的数据主键集合
105 104
      * @return 结果
106 105
      */
@@ -108,7 +107,7 @@ public interface ApprovalTaskMapper extends BaseMapper<ApprovalTask>
108 107
 
109 108
     /**
110 109
      * 根据实例ID删除审批任务
111
-     * 
110
+     *
112 111
      * @param instanceId 实例ID
113 112
      * @return 结果
114 113
      */
@@ -116,14 +115,14 @@ public interface ApprovalTaskMapper extends BaseMapper<ApprovalTask>
116 115
 
117 116
     /**
118 117
      * 生成任务编号
119
-     * 
118
+     *
120 119
      * @return 任务编号
121 120
      */
122 121
     String generateTaskNo();
123 122
 
124 123
     /**
125 124
      * 统计用户待办任务数量
126
-     * 
125
+     *
127 126
      * @param assigneeId 处理人ID
128 127
      * @return 待办任务数量
129 128
      */

+ 10 - 11
airport-system/src/main/java/com/sundot/airport/system/mapper/approval/ApprovalWorkflowDefinitionMapper.java

@@ -9,16 +9,15 @@ import org.apache.ibatis.annotations.Param;
9 9
 
10 10
 /**
11 11
  * 审批流程定义Mapper接口
12
- * 
12
+ *
13 13
  * @author simon lin
14 14
  * @date 2025-09-06
15 15
  */
16 16
 @Mapper
17
-public interface ApprovalWorkflowDefinitionMapper extends BaseMapper<ApprovalWorkflowDefinition>
18
-{
17
+public interface ApprovalWorkflowDefinitionMapper extends BaseMapper<ApprovalWorkflowDefinition> {
19 18
     /**
20 19
      * 查询审批流程定义
21
-     * 
20
+     *
22 21
      * @param id 审批流程定义主键
23 22
      * @return 审批流程定义
24 23
      */
@@ -26,7 +25,7 @@ public interface ApprovalWorkflowDefinitionMapper extends BaseMapper<ApprovalWor
26 25
 
27 26
     /**
28 27
      * 根据流程代码查询审批流程定义
29
-     * 
28
+     *
30 29
      * @param workflowCode 流程代码
31 30
      * @return 审批流程定义
32 31
      */
@@ -34,7 +33,7 @@ public interface ApprovalWorkflowDefinitionMapper extends BaseMapper<ApprovalWor
34 33
 
35 34
     /**
36 35
      * 根据流程类型查询审批流程定义列表
37
-     * 
36
+     *
38 37
      * @param workflowType 流程类型
39 38
      * @return 审批流程定义列表
40 39
      */
@@ -42,7 +41,7 @@ public interface ApprovalWorkflowDefinitionMapper extends BaseMapper<ApprovalWor
42 41
 
43 42
     /**
44 43
      * 查询审批流程定义列表
45
-     * 
44
+     *
46 45
      * @param approvalWorkflowDefinition 审批流程定义
47 46
      * @return 审批流程定义集合
48 47
      */
@@ -50,7 +49,7 @@ public interface ApprovalWorkflowDefinitionMapper extends BaseMapper<ApprovalWor
50 49
 
51 50
     /**
52 51
      * 新增审批流程定义
53
-     * 
52
+     *
54 53
      * @param approvalWorkflowDefinition 审批流程定义
55 54
      * @return 结果
56 55
      */
@@ -58,7 +57,7 @@ public interface ApprovalWorkflowDefinitionMapper extends BaseMapper<ApprovalWor
58 57
 
59 58
     /**
60 59
      * 修改审批流程定义
61
-     * 
60
+     *
62 61
      * @param approvalWorkflowDefinition 审批流程定义
63 62
      * @return 结果
64 63
      */
@@ -66,7 +65,7 @@ public interface ApprovalWorkflowDefinitionMapper extends BaseMapper<ApprovalWor
66 65
 
67 66
     /**
68 67
      * 删除审批流程定义
69
-     * 
68
+     *
70 69
      * @param id 审批流程定义主键
71 70
      * @return 结果
72 71
      */
@@ -74,7 +73,7 @@ public interface ApprovalWorkflowDefinitionMapper extends BaseMapper<ApprovalWor
74 73
 
75 74
     /**
76 75
      * 批量删除审批流程定义
77
-     * 
76
+     *
78 77
      * @param ids 需要删除的数据主键集合
79 78
      * @return 结果
80 79
      */

+ 5 - 1
airport-system/src/main/java/com/sundot/airport/system/service/approval/BusinessApprovalHandler.java

@@ -9,6 +9,7 @@ import com.sundot.airport.system.domain.approval.ApprovalInstance;
9 9
 public interface BusinessApprovalHandler {
10 10
     /**
11 11
      * 判断是否支持处理指定的业务类型
12
+     *
12 13
      * @param businessType 业务类型
13 14
      * @return true-支持,false-不支持
14 15
      */
@@ -16,18 +17,21 @@ public interface BusinessApprovalHandler {
16 17
 
17 18
     /**
18 19
      * 处理审批通过的业务逻辑
20
+     *
19 21
      * @param instance 审批实例
20 22
      */
21 23
     void handleApproved(ApprovalInstance instance);
22 24
 
23 25
     /**
24 26
      * 处理审批驳回的业务逻辑
27
+     *
25 28
      * @param instance 审批实例
26 29
      */
27 30
     void handleRejected(ApprovalInstance instance);
28 31
 
29 32
     /**
30
-     *  处理审批流程取消
33
+     * 处理审批流程取消
34
+     *
31 35
      * @param instance
32 36
      */
33 37
     void handleCancelled(ApprovalInstance instance);

+ 72 - 71
airport-system/src/main/java/com/sundot/airport/system/service/approval/IApprovalEngineService.java

@@ -8,66 +8,65 @@ import com.sundot.airport.system.domain.approval.ApprovalTask;
8 8
 
9 9
 /**
10 10
  * 审批流程引擎Service接口
11
- * 
11
+ *
12 12
  * @author simon lin
13 13
  * @date 2025-09-06
14 14
  */
15
-public interface IApprovalEngineService
16
-{
15
+public interface IApprovalEngineService {
17 16
     /**
18 17
      * 启动审批流程
19
-     * 
20
-     * @param workflowCode 流程代码
21
-     * @param businessType 业务类型
22
-     * @param businessId 业务ID
23
-     * @param title 审批标题
24
-     * @param submitterId 提交人ID
18
+     *
19
+     * @param workflowCode  流程代码
20
+     * @param businessType  业务类型
21
+     * @param businessId    业务ID
22
+     * @param title         审批标题
23
+     * @param submitterId   提交人ID
25 24
      * @param submitterName 提交人姓名
26
-     * @param formData 表单数据
27
-     * @param businessData 业务数据
25
+     * @param formData      表单数据
26
+     * @param businessData  业务数据
28 27
      * @return 审批实例
29 28
      */
30
-    ApprovalInstance startProcess(String workflowCode, String businessType, Long businessId, 
31
-                                String title, Long submitterId, String submitterName, 
32
-                                Map<String, Object> formData, Map<String, Object> businessData);
29
+    ApprovalInstance startProcess(String workflowCode, String businessType, Long businessId,
30
+                                  String title, Long submitterId, String submitterName,
31
+                                  Map<String, Object> formData, Map<String, Object> businessData);
33 32
 
34 33
     /**
35 34
      * 审批任务(同意)
36
-     * 
37
-     * @param taskId 任务ID
38
-     * @param operatorId 操作人ID
35
+     *
36
+     * @param taskId       任务ID
37
+     * @param operatorId   操作人ID
39 38
      * @param operatorName 操作人姓名
40
-     * @param comment 审批意见
41
-     * @param formData 表单数据
39
+     * @param comment      审批意见
40
+     * @param formData     表单数据
42 41
      * @return 结果
43 42
      */
44 43
     boolean approveTask(Long taskId, Long operatorId, String operatorName, String comment, Map<String, Object> formData);
45 44
 
46 45
     /**
47 46
      * 驳回任务
48
-     * 
49
-     * @param taskId 任务ID
50
-     * @param operatorId 操作人ID
47
+     *
48
+     * @param taskId       任务ID
49
+     * @param operatorId   操作人ID
51 50
      * @param operatorName 操作人姓名
52
-     * @param comment 驳回理由
51
+     * @param comment      驳回理由
53 52
      * @return 结果
54 53
      */
55 54
     boolean rejectTask(Long taskId, Long operatorId, String operatorName, String comment);
56 55
 
57 56
     /**
58 57
      * 取消审批流程
59
-     * 
60
-     * @param instanceId 实例ID
61
-     * @param operatorId 操作人ID
58
+     *
59
+     * @param instanceId   实例ID
60
+     * @param operatorId   操作人ID
62 61
      * @param operatorName 操作人姓名
63
-     * @param comment 取消理由
62
+     * @param comment      取消理由
64 63
      * @return 结果
65 64
      */
66 65
     boolean cancelProcess(Long instanceId, Long operatorId, String operatorName, String comment);
67 66
 
68 67
     /**
69 68
      * 获取用户待办任务列表
70
-     * 
69
+     *
71 70
      * @param userId 用户ID
72 71
      * @return 待办任务列表
73 72
      */
@@ -75,7 +74,7 @@ public interface IApprovalEngineService
75 74
 
76 75
     /**
77 76
      * 获取用户已办任务列表
78
-     * 
77
+     *
79 78
      * @param userId 用户ID
80 79
      * @return 已办任务列表
81 80
      */
@@ -83,7 +82,7 @@ public interface IApprovalEngineService
83 82
 
84 83
     /**
85 84
      * 获取用户发起的审批实例列表
86
-     * 
85
+     *
87 86
      * @param userId 用户ID
88 87
      * @param status 状态
89 88
      * @return 审批实例列表
@@ -92,9 +91,9 @@ public interface IApprovalEngineService
92 91
 
93 92
     /**
94 93
      * 根据业务类型和级别获取对应的流程代码
95
-     * 
96
-     * @param businessType 业务类型
97
-     * @param level 级别
94
+     *
95
+     * @param businessType  业务类型
96
+     * @param level         级别
98 97
      * @param submitterRole 提交人角色
99 98
      * @return 流程代码
100 99
      */
@@ -102,70 +101,71 @@ public interface IApprovalEngineService
102 101
 
103 102
     /**
104 103
      * 个人级别审批流程(发送通知确认)
105
-     * 
106
-     * @param businessType 业务类型
107
-     * @param businessId 业务ID
108
-     * @param title 标题
109
-     * @param submitterId 提交人ID
104
+     *
105
+     * @param businessType  业务类型
106
+     * @param businessId    业务ID
107
+     * @param title         标题
108
+     * @param submitterId   提交人ID
110 109
      * @param submitterName 提交人姓名
111 110
      * @param targetUserIds 目标用户ID列表
112
-     * @param formData 表单数据
113
-     * @param businessData 业务数据
111
+     * @param formData      表单数据
112
+     * @param businessData  业务数据
114 113
      * @return 审批实例
115 114
      */
116 115
     ApprovalInstance startPersonalLevelProcess(String businessType, Long businessId, String title,
117
-                                             Long submitterId, String submitterName, Long sectionLeaderId,
118
-                                             Map<String, Object> formData, Map<String, Object> businessData);
116
+                                               Long submitterId, String submitterName, Long sectionLeaderId,
117
+                                               Map<String, Object> formData, Map<String, Object> businessData);
119 118
 
120 119
     /**
121 120
      * 科级审批流程
122
-     * 
123
-     * @param businessType 业务类型
124
-     * @param businessId 业务ID
125
-     * @param title 标题
126
-     * @param submitterId 提交人ID
127
-     * @param submitterName 提交人姓名
121
+     *
122
+     * @param businessType    业务类型
123
+     * @param businessId      业务ID
124
+     * @param title           标题
125
+     * @param submitterId     提交人ID
126
+     * @param submitterName   提交人姓名
128 127
      * @param sectionLeaderId 科长ID
129
-     * @param formData 表单数据
130
-     * @param businessData 业务数据
128
+     * @param formData        表单数据
129
+     * @param businessData    业务数据
131 130
      * @return 审批实例
132 131
      */
133 132
     ApprovalInstance startSectionLevelProcess(String businessType, Long businessId, String title,
134
-                                            Long submitterId, String submitterName, Long sectionLeaderId,
135
-                                            Map<String, Object> formData, Map<String, Object> businessData);
133
+                                              Long submitterId, String submitterName, Long sectionLeaderId,
134
+                                              Map<String, Object> formData, Map<String, Object> businessData);
136 135
 
137 136
     /**
138 137
      * 班组级审批流程
139
-     * 
140
-     * @param businessType 业务类型
141
-     * @param businessId 业务ID
142
-     * @param title 标题
143
-     * @param submitterId 提交人ID
138
+     *
139
+     * @param businessType  业务类型
140
+     * @param businessId    业务ID
141
+     * @param title         标题
142
+     * @param submitterId   提交人ID
144 143
      * @param submitterName 提交人姓名
145
-     * @param formData 表单数据
146
-     * @param businessData 业务数据
144
+     * @param formData      表单数据
145
+     * @param businessData  业务数据
147 146
      * @return 审批实例
148 147
      */
149 148
     ApprovalInstance startGroupLevelProcess(String businessType, Long businessId, String title,
150
-                                          Long submitterId, String submitterName,
151
-                                          Map<String, Object> formData, Map<String, Object> businessData);
149
+                                            Long submitterId, String submitterName,
150
+                                            Map<String, Object> formData, Map<String, Object> businessData);
152 151
 
153 152
     /**
154 153
      * 查获上报审批流程
155
-     * 
156
-     * @param businessType 业务类型
157
-     * @param businessId 业务ID
158
-     * @param title 标题
159
-     * @param submitterId 提交人ID
154
+     *
155
+     * @param businessType  业务类型
156
+     * @param businessId    业务ID
157
+     * @param title         标题
158
+     * @param submitterId   提交人ID
160 159
      * @param submitterName 提交人姓名
161 160
      * @param submitterRole 提交人角色
162
-     * @param formData 表单数据
163
-     * @param businessData 业务数据
161
+     * @param formData      表单数据
162
+     * @param businessData  业务数据
164 163
      * @return 审批实例
165 164
      */
166 165
     ApprovalInstance startSeizureReportProcess(String businessType, Long businessId, String title,
167
-                                             Long submitterId, String submitterName, String submitterRole,
168
-                                             Map<String, Object> formData, Map<String, Object> businessData);
166
+                                               Long submitterId, String submitterName, String submitterRole,
167
+                                               Map<String, Object> formData, Map<String, Object> businessData);
168
+
169 169
     /**
170 170
      * 批量审批任务(同意)
171 171
      *
@@ -175,7 +175,8 @@ public interface IApprovalEngineService
175 175
     boolean approveTaskList(List<Long> ids);
176 176
 
177 177
     /**
178
-     *  批量审批任务(驳回)
178
+     * 批量审批任务(驳回)
179
+     *
179 180
      * @param ids 任务ID列表
180 181
      * @return 批量结果
181 182
      */

+ 19 - 20
airport-system/src/main/java/com/sundot/airport/system/service/approval/IApprovalUserService.java

@@ -4,25 +4,24 @@ import java.util.List;
4 4
 
5 5
 /**
6 6
  * 审批流程用户服务接口
7
- * 
7
+ *
8 8
  * @author simon lin
9 9
  * @date 2025-09-06
10 10
  */
11
-public interface IApprovalUserService
12
-{
11
+public interface IApprovalUserService {
13 12
     /**
14 13
      * 根据审批人类型获取审批人ID列表
15
-     * 
16
-     * @param approverType 审批人类型
14
+     *
15
+     * @param approverType  审批人类型
17 16
      * @param approverValue 审批人值
18
-     * @param businessData 业务数据(可用于动态获取审批人)
17
+     * @param businessData  业务数据(可用于动态获取审批人)
19 18
      * @return 审批人ID列表
20 19
      */
21 20
     List<Long> getApproverIds(String approverType, String approverValue, Object businessData);
22 21
 
23 22
     /**
24 23
      * 根据部门ID获取部门负责人(科长)
25
-     * 
24
+     *
26 25
      * @param deptId 部门ID
27 26
      * @return 部门负责人用户ID列表
28 27
      */
@@ -30,7 +29,7 @@ public interface IApprovalUserService
30 29
 
31 30
     /**
32 31
      * 根据用户ID获取所属部门的科长
33
-     * 
32
+     *
34 33
      * @param userId 用户ID
35 34
      * @return 科长用户ID列表
36 35
      */
@@ -38,7 +37,7 @@ public interface IApprovalUserService
38 37
 
39 38
     /**
40 39
      * 根据用户ID获取所属班组的班组长
41
-     * 
40
+     *
42 41
      * @param userId 用户ID
43 42
      * @return 班组长用户ID列表
44 43
      */
@@ -46,7 +45,7 @@ public interface IApprovalUserService
46 45
 
47 46
     /**
48 47
      * 根据角色标识获取用户ID列表
49
-     * 
48
+     *
50 49
      * @param roleKey 角色标识
51 50
      * @return 用户ID列表
52 51
      */
@@ -54,7 +53,7 @@ public interface IApprovalUserService
54 53
 
55 54
     /**
56 55
      * 根据部门ID获取部门下所有用户ID列表
57
-     * 
56
+     *
58 57
      * @param deptId 部门ID
59 58
      * @return 用户ID列表
60 59
      */
@@ -62,7 +61,7 @@ public interface IApprovalUserService
62 61
 
63 62
     /**
64 63
      * 判断用户是否为班组长角色
65
-     * 
64
+     *
66 65
      * @param userId 用户ID
67 66
      * @return 是否为班组长
68 67
      */
@@ -70,7 +69,7 @@ public interface IApprovalUserService
70 69
 
71 70
     /**
72 71
      * 判断用户是否为科长角色
73
-     * 
72
+     *
74 73
      * @param userId 用户ID
75 74
      * @return 是否为科长
76 75
      */
@@ -78,32 +77,32 @@ public interface IApprovalUserService
78 77
 
79 78
     /**
80 79
      * 根据业务数据动态获取整改班组
81
-     * 
80
+     *
82 81
      * @param businessData 业务数据
83 82
      * @return 班组ID
84 83
      */
85 84
     Long getTargetGroupIdFromBusinessData(Object businessData);
86
-    
85
+
87 86
     /**
88 87
      * 根据任务ID获取原始操作者(创建者或更新者)的用户ID
89
-     * 
88
+     *
90 89
      * @param taskId 任务ID
91 90
      * @return 原始操作者的用户ID,如果找不到返回null
92 91
      */
93 92
     Long getOriginalOperatorByTaskId(Long taskId);
94
-    
93
+
95 94
     /**
96 95
      * 根据任务ID获取任务的创建者或更新者用户ID(用于驳回回流)
97
-     * 
96
+     *
98 97
      * @param taskId 任务ID
99 98
      * @return 任务创建者或更新者的用户ID,如果找不到返回null
100 99
      */
101 100
     Long getTaskCreatorOrUpdaterByTaskId(Long taskId);
102
-    
101
+
103 102
     /**
104 103
      * 根据用户ID查找其直接上级(违禁品审批用)
105 104
      * 如果用户是安检员,找其班组长;如果是班组长,找其科长
106
-     * 
105
+     *
107 106
      * @param userId 用户ID
108 107
      * @return 直接上级的用户ID列表
109 108
      */

+ 11 - 11
airport-system/src/main/java/com/sundot/airport/system/service/approval/IApprovalWorkflowService.java

@@ -1,19 +1,19 @@
1 1
 package com.sundot.airport.system.service.approval;
2 2
 
3 3
 import java.util.List;
4
+
4 5
 import com.sundot.airport.system.domain.approval.ApprovalWorkflowDefinition;
5 6
 
6 7
 /**
7 8
  * 审批流程定义Service接口
8
- * 
9
+ *
9 10
  * @author simon lin
10 11
  * @date 2025-09-06
11 12
  */
12
-public interface IApprovalWorkflowService
13
-{
13
+public interface IApprovalWorkflowService {
14 14
     /**
15 15
      * 查询审批流程定义
16
-     * 
16
+     *
17 17
      * @param id 审批流程定义主键
18 18
      * @return 审批流程定义
19 19
      */
@@ -21,7 +21,7 @@ public interface IApprovalWorkflowService
21 21
 
22 22
     /**
23 23
      * 根据流程代码查询审批流程定义
24
-     * 
24
+     *
25 25
      * @param workflowCode 流程代码
26 26
      * @return 审批流程定义
27 27
      */
@@ -29,7 +29,7 @@ public interface IApprovalWorkflowService
29 29
 
30 30
     /**
31 31
      * 根据流程类型查询审批流程定义列表
32
-     * 
32
+     *
33 33
      * @param workflowType 流程类型
34 34
      * @return 审批流程定义列表
35 35
      */
@@ -37,7 +37,7 @@ public interface IApprovalWorkflowService
37 37
 
38 38
     /**
39 39
      * 查询审批流程定义列表
40
-     * 
40
+     *
41 41
      * @param approvalWorkflowDefinition 审批流程定义
42 42
      * @return 审批流程定义集合
43 43
      */
@@ -45,7 +45,7 @@ public interface IApprovalWorkflowService
45 45
 
46 46
     /**
47 47
      * 新增审批流程定义
48
-     * 
48
+     *
49 49
      * @param approvalWorkflowDefinition 审批流程定义
50 50
      * @return 结果
51 51
      */
@@ -53,7 +53,7 @@ public interface IApprovalWorkflowService
53 53
 
54 54
     /**
55 55
      * 修改审批流程定义
56
-     * 
56
+     *
57 57
      * @param approvalWorkflowDefinition 审批流程定义
58 58
      * @return 结果
59 59
      */
@@ -61,7 +61,7 @@ public interface IApprovalWorkflowService
61 61
 
62 62
     /**
63 63
      * 批量删除审批流程定义
64
-     * 
64
+     *
65 65
      * @param ids 需要删除的审批流程定义主键集合
66 66
      * @return 结果
67 67
      */
@@ -69,7 +69,7 @@ public interface IApprovalWorkflowService
69 69
 
70 70
     /**
71 71
      * 删除审批流程定义信息
72
-     * 
72
+     *
73 73
      * @param id 审批流程定义主键
74 74
      * @return 结果
75 75
      */

+ 49 - 49
airport-system/src/main/java/com/sundot/airport/system/service/approval/ICheckApprovalService.java

@@ -8,161 +8,161 @@ import java.util.Map;
8 8
 
9 9
 /**
10 10
  * 审批检查服务接口
11
- * 
11
+ *
12 12
  * @author airport-system
13 13
  */
14 14
 public interface ICheckApprovalService {
15
-    
15
+
16 16
     /**
17 17
      * 启动个人级别检查审批流程
18
-     * 
18
+     *
19 19
      * @param requestData 请求数据,包含checkType、location、targetUserIds、formData等
20
-     * @param userId 当前用户ID
21
-     * @param username 当前用户名
22
-     * @param remark 备注
20
+     * @param userId      当前用户ID
21
+     * @param username    当前用户名
22
+     * @param remark      备注
23 23
      * @return ApprovalInstance 审批实例
24 24
      * @throws Exception 启动流程失败时抛出异常
25 25
      */
26 26
     ApprovalInstance submitPersonalCheck(Map<String, Object> requestData, Long userId, String username, String remark) throws Exception;
27
-    
27
+
28 28
     /**
29 29
      * 启动科级检查审批流程
30
-     * 
30
+     *
31 31
      * @param requestData 请求数据,包含checkType、severity、targetDeptId、sectionLeaderId、formData等
32
-     * @param userId 当前用户ID
33
-     * @param username 当前用户名
34
-     * @param remark 备注
32
+     * @param userId      当前用户ID
33
+     * @param username    当前用户名
34
+     * @param remark      备注
35 35
      * @return ApprovalInstance 审批实例
36 36
      * @throws Exception 启动流程失败时抛出异常
37 37
      */
38 38
     ApprovalInstance submitSectionCheck(Map<String, Object> requestData, Long userId, String username, String remark) throws Exception;
39
-    
39
+
40 40
     /**
41 41
      * 启动班组级检查审批流程
42
-     * 
42
+     *
43 43
      * @param requestData 请求数据,包含checkType、severity、groupLeaderId、formData等
44
-     * @param userId 当前用户ID
45
-     * @param username 当前用户名
46
-     * @param remark 备注
44
+     * @param userId      当前用户ID
45
+     * @param username    当前用户名
46
+     * @param remark      备注
47 47
      * @return ApprovalInstance 审批实例
48 48
      * @throws Exception 启动流程失败时抛出异常
49 49
      */
50 50
     ApprovalInstance submitGroupCheck(Map<String, Object> requestData, Long userId, String username, String remark) throws Exception;
51
-    
51
+
52 52
     /**
53 53
      * 启动查获上报审批流程
54
-     * 
54
+     *
55 55
      * @param requestData 请求数据,包含seizureTime、passengerInfo、formData等
56
-     * @param userId 当前用户ID
57
-     * @param username 当前用户名
58
-     * @param remark 备注
56
+     * @param userId      当前用户ID
57
+     * @param username    当前用户名
58
+     * @param remark      备注
59 59
      * @return ApprovalInstance 审批实例
60 60
      * @throws Exception 启动流程失败时抛出异常
61 61
      */
62 62
     ApprovalInstance submitSeizureReport(Map<String, Object> requestData, Long userId, String username, String remark) throws Exception;
63
-    
63
+
64 64
     /**
65 65
      * 审批任务(同意)
66
-     * 
67
-     * @param taskId 任务ID
68
-     * @param comment 审批意见
66
+     *
67
+     * @param taskId   任务ID
68
+     * @param comment  审批意见
69 69
      * @param formData 表单数据(科长节点需要选择班组等)
70
-     * @param userId 当前用户ID
70
+     * @param userId   当前用户ID
71 71
      * @param username 当前用户名
72 72
      * @return ApprovalTask 处理后的任务
73 73
      * @throws Exception 审批失败时抛出异常
74 74
      */
75 75
     ApprovalTask approveTask(Long taskId, String comment, Map<String, Object> formData, Long userId, String username) throws Exception;
76
-    
76
+
77 77
     /**
78 78
      * 审批任务(驳回)
79
-     * 
80
-     * @param taskId 任务ID
81
-     * @param comment 驳回原因
82
-     * @param userId 当前用户ID
79
+     *
80
+     * @param taskId   任务ID
81
+     * @param comment  驳回原因
82
+     * @param userId   当前用户ID
83 83
      * @param username 当前用户名
84 84
      * @return ApprovalTask 处理后的任务
85 85
      * @throws Exception 驳回失败时抛出异常
86 86
      */
87 87
     ApprovalTask rejectTask(Long taskId, String comment, Long userId, String username) throws Exception;
88
-    
88
+
89 89
     /**
90 90
      * 获取用户待办任务列表
91
-     * 
91
+     *
92 92
      * @param userId 用户ID
93 93
      * @return List<ApprovalTask> 待办任务列表
94 94
      * @throws Exception 查询失败时抛出异常
95 95
      */
96 96
     List<ApprovalTask> getPendingTasks(Long userId) throws Exception;
97
-    
97
+
98 98
     /**
99 99
      * 获取用户已办任务列表
100
-     * 
100
+     *
101 101
      * @param userId 用户ID
102 102
      * @return List<ApprovalTask> 已办任务列表
103 103
      * @throws Exception 查询失败时抛出异常
104 104
      */
105 105
     List<ApprovalTask> getCompletedTasks(Long userId) throws Exception;
106
-    
106
+
107 107
     /**
108 108
      * 获取用户发起的审批实例列表
109
-     * 
109
+     *
110 110
      * @param userId 用户ID
111 111
      * @param status 状态筛选(可为空)
112 112
      * @return List<ApprovalInstance> 审批实例列表
113 113
      * @throws Exception 查询失败时抛出异常
114 114
      */
115 115
     List<ApprovalInstance> getSubmittedInstances(Long userId, String status) throws Exception;
116
-    
116
+
117 117
     /**
118 118
      * 获取用户待办任务数量
119
-     * 
119
+     *
120 120
      * @param userId 用户ID
121 121
      * @return Long 待办任务数量
122 122
      * @throws Exception 查询失败时抛出异常
123 123
      */
124 124
     Long getPendingTaskCount(Long userId) throws Exception;
125
-    
125
+
126 126
     /**
127 127
      * 获取用户抄送列表详情
128
-     * 
128
+     *
129 129
      * @param userId 用户ID
130 130
      * @return List 抄送详情列表
131 131
      * @throws Exception 查询失败时抛出异常
132 132
      */
133 133
     List<com.sundot.airport.system.domain.approval.dto.ApprovalCcDetailDTO> getCcDetailsByUserId(Long userId) throws Exception;
134
-    
134
+
135 135
     /**
136 136
      * 根据实例ID获取审批历史
137
-     * 
137
+     *
138 138
      * @param instanceId 审批实例ID
139 139
      * @return List<ApprovalHistory> 审批历史列表
140 140
      * @throws Exception 查询失败时抛出异常
141 141
      */
142 142
     List<com.sundot.airport.system.domain.approval.ApprovalHistory> getApprovalHistoryByInstanceId(Long instanceId) throws Exception;
143
-    
143
+
144 144
     /**
145 145
      * 根据任务ID获取审批历史
146
-     * 
146
+     *
147 147
      * @param taskId 任务ID
148 148
      * @return List<ApprovalHistory> 审批历史列表
149 149
      * @throws Exception 查询失败时抛出异常
150 150
      */
151 151
     List<com.sundot.airport.system.domain.approval.ApprovalHistory> getApprovalHistoryByTaskId(Long taskId) throws Exception;
152
-    
152
+
153 153
     /**
154 154
      * 获取用户的审批历史记录
155
-     * 
155
+     *
156 156
      * @param userId 用户ID
157 157
      * @param action 操作类型(可为空,如:SUBMIT, APPROVE, REJECT, CANCEL)
158 158
      * @return List<ApprovalHistory> 审批历史列表
159 159
      * @throws Exception 查询失败时抛出异常
160 160
      */
161 161
     List<com.sundot.airport.system.domain.approval.ApprovalHistory> getUserApprovalHistory(Long userId, String action) throws Exception;
162
-    
162
+
163 163
     /**
164 164
      * 批量更新审批抄送已读状态
165
-     * 
165
+     *
166 166
      * @param ids 需要更新的ID列表
167 167
      * @return 影响行数
168 168
      * @throws Exception 更新失败时抛出异常

+ 164 - 191
airport-system/src/main/java/com/sundot/airport/system/service/approval/impl/ApprovalEngineServiceImpl.java

@@ -29,42 +29,41 @@ import com.sundot.airport.system.mapper.SysUserMapper;
29 29
 
30 30
 /**
31 31
  * 审批流程引擎Service业务层处理
32
- * 
32
+ *
33 33
  * @author simon lin
34 34
  * @date 2025-09-06
35 35
  */
36 36
 @Service
37
-public class ApprovalEngineServiceImpl implements IApprovalEngineService
38
-{
37
+public class ApprovalEngineServiceImpl implements IApprovalEngineService {
39 38
     private static final Logger logger = LoggerFactory.getLogger(ApprovalEngineServiceImpl.class);
40
-    
39
+
41 40
     @Autowired
42 41
     private ApprovalWorkflowDefinitionMapper workflowDefinitionMapper;
43
-    
42
+
44 43
     @Autowired
45 44
     private ApprovalNodeDefinitionMapper nodeDefinitionMapper;
46
-    
45
+
47 46
     @Autowired
48 47
     private ApprovalInstanceMapper instanceMapper;
49
-    
48
+
50 49
     @Autowired
51 50
     private ApprovalTaskMapper taskMapper;
52
-    
51
+
53 52
     @Autowired
54 53
     private ApprovalHistoryMapper historyMapper;
55
-    
54
+
56 55
     @Autowired
57 56
     private ApprovalCcMapper ccMapper;
58
-    
57
+
59 58
     @Autowired
60 59
     private SysUserMapper sysUserMapper;
61
-    
60
+
62 61
     @Autowired
63 62
     private IApprovalUserService approvalUserService;
64 63
 
65 64
     @Autowired(required = false)
66 65
     private List<BusinessApprovalHandler> businessHandlers;
67
-    
66
+
68 67
     private ObjectMapper objectMapper = new ObjectMapper();
69 68
 
70 69
     /**
@@ -72,10 +71,9 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
72 71
      */
73 72
     @Override
74 73
     @Transactional
75
-    public ApprovalInstance startProcess(String workflowCode, String businessType, Long businessId, 
76
-                                       String title, Long submitterId, String submitterName, 
77
-                                       Map<String, Object> formData, Map<String, Object> businessData)
78
-    {
74
+    public ApprovalInstance startProcess(String workflowCode, String businessType, Long businessId,
75
+                                         String title, Long submitterId, String submitterName,
76
+                                         Map<String, Object> formData, Map<String, Object> businessData) {
79 77
         // 1. 查询流程定义
80 78
         ApprovalWorkflowDefinition workflow = workflowDefinitionMapper.selectApprovalWorkflowDefinitionByCode(workflowCode);
81 79
         if (workflow == null) {
@@ -94,17 +92,17 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
94 92
         instance.setSubmitTime(DateUtils.getNowDate());
95 93
         instance.setStatus("RUNNING");
96 94
         instance.setUrgentLevel("NORMAL");
97
-        
95
+
98 96
         try {
99 97
             instance.setFormData(formData != null ? objectMapper.writeValueAsString(formData) : null);
100 98
             instance.setBusinessData(businessData != null ? objectMapper.writeValueAsString(businessData) : null);
101 99
         } catch (Exception e) {
102 100
             throw new RuntimeException("表单数据序列化失败", e);
103 101
         }
104
-        
102
+
105 103
         instance.setCreateBy(SecurityUtils.getUsername());
106 104
         instance.setCreateTime(DateUtils.getNowDate());
107
-        
105
+
108 106
         instanceMapper.insertApprovalInstance(instance);
109 107
 
110 108
         // 3. 获取第一个节点
@@ -112,7 +110,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
112 110
         if (firstNode != null) {
113 111
             instance.setCurrentNodeId(firstNode.getId());
114 112
             instanceMapper.updateApprovalInstance(instance);
115
-            
113
+
116 114
             // 4. 创建第一个任务(如果不是开始节点)
117 115
             if (!"START".equals(firstNode.getNodeType())) {
118 116
                 createTasksForNode(instance, firstNode, formData, null);
@@ -135,8 +133,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
135 133
      */
136 134
     @Override
137 135
     @Transactional
138
-    public boolean approveTask(Long taskId, Long operatorId, String operatorName, String comment, Map<String, Object> formData)
139
-    {
136
+    public boolean approveTask(Long taskId, Long operatorId, String operatorName, String comment, Map<String, Object> formData) {
140 137
         // 1. 查询任务
141 138
         ApprovalTask task = taskMapper.selectApprovalTaskById(taskId);
142 139
         if (task == null || !"PENDING".equals(task.getStatus())) {
@@ -167,7 +164,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
167 164
 
168 165
         // 5. 记录历史
169 166
         recordHistory(instance.getId(), task.getId(), currentNode.getId(), currentNode.getNodeName(),
170
-                     "APPROVE", operatorId, operatorName, comment, formData);
167
+                "APPROVE", operatorId, operatorName, comment, formData);
171 168
 
172 169
         // 6. 流转到下一节点(传递当前任务引用)
173 170
         moveToNextNode(instance, currentNode, operatorId, operatorName, comment, formData, task);
@@ -180,8 +177,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
180 177
      */
181 178
     @Override
182 179
     @Transactional
183
-    public boolean rejectTask(Long taskId, Long operatorId, String operatorName, String comment)
184
-    {
180
+    public boolean rejectTask(Long taskId, Long operatorId, String operatorName, String comment) {
185 181
         // 1. 查询任务
186 182
         ApprovalTask task = taskMapper.selectApprovalTaskById(taskId);
187 183
         if (task == null || !"PENDING".equals(task.getStatus())) {
@@ -226,7 +222,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
226 222
 
227 223
         // 6. 记录历史
228 224
         recordHistory(instance.getId(), task.getId(), currentNode.getId(), currentNode.getNodeName(),
229
-                     "REJECT", operatorId, operatorName, comment, null);
225
+                "REJECT", operatorId, operatorName, comment, null);
230 226
 
231 227
         // 执行业务处理逻辑
232 228
         executeBusinessLogic(instance, "REJECTED");
@@ -241,7 +237,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
241 237
     public boolean approveTaskList(List<Long> ids) {
242 238
         //获取当前登陆人
243 239
         SysUser user = sysUserMapper.selectUserById(SecurityUtils.getUserId());
244
-        
240
+
245 241
         boolean allSuccess = true;
246 242
         for (Long taskId : ids) {
247 243
             try {
@@ -277,8 +273,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
277 273
      */
278 274
     @Override
279 275
     @Transactional
280
-    public boolean cancelProcess(Long instanceId, Long operatorId, String operatorName, String comment)
281
-    {
276
+    public boolean cancelProcess(Long instanceId, Long operatorId, String operatorName, String comment) {
282 277
         // 1. 查询实例
283 278
         ApprovalInstance instance = instanceMapper.selectApprovalInstanceById(instanceId);
284 279
         if (instance == null || !"RUNNING".equals(instance.getStatus())) {
@@ -295,7 +290,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
295 290
         // 3. 取消所有待办任务
296 291
         List<ApprovalTask> pendingTasks = taskMapper.selectApprovalTaskByInstanceId(instanceId)
297 292
                 .stream().filter(task -> "PENDING".equals(task.getStatus())).collect(Collectors.toList());
298
-        
293
+
299 294
         for (ApprovalTask task : pendingTasks) {
300 295
             task.setStatus("CANCELLED");
301 296
             task.setCompleteTime(DateUtils.getNowDate());
@@ -315,8 +310,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
315 310
      * 获取用户待办任务列表
316 311
      */
317 312
     @Override
318
-    public List<ApprovalTask> getUserPendingTasks(Long userId)
319
-    {
313
+    public List<ApprovalTask> getUserPendingTasks(Long userId) {
320 314
         return taskMapper.selectApprovalTaskByAssignee(userId, "PENDING");
321 315
     }
322 316
 
@@ -324,8 +318,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
324 318
      * 获取用户已办任务列表
325 319
      */
326 320
     @Override
327
-    public List<ApprovalTask> getUserCompletedTasks(Long userId)
328
-    {
321
+    public List<ApprovalTask> getUserCompletedTasks(Long userId) {
329 322
         return taskMapper.selectApprovalTaskByAssignee(userId, null)
330 323
                 .stream().filter(task -> !"PENDING".equals(task.getStatus())).collect(Collectors.toList());
331 324
     }
@@ -334,8 +327,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
334 327
      * 获取用户发起的审批实例列表
335 328
      */
336 329
     @Override
337
-    public List<ApprovalInstance> getUserSubmittedInstances(Long userId, String status)
338
-    {
330
+    public List<ApprovalInstance> getUserSubmittedInstances(Long userId, String status) {
339 331
         return instanceMapper.selectApprovalInstanceBySubmitter(userId, status);
340 332
     }
341 333
 
@@ -343,8 +335,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
343 335
      * 根据业务类型和级别获取对应的流程代码
344 336
      */
345 337
     @Override
346
-    public String getWorkflowCodeByBusinessAndLevel(String businessType, String level, String submitterRole)
347
-    {
338
+    public String getWorkflowCodeByBusinessAndLevel(String businessType, String level, String submitterRole) {
348 339
         if ("SEIZURE_REPORT".equals(businessType)) {
349 340
             if ("SEIZURE_REPORT_LEADER".equals(submitterRole)) {
350 341
                 return "SEIZURE_REPORT_LEADER";
@@ -352,7 +343,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
352 343
                 return "SEIZURE_REPORT_STAFF";
353 344
             }
354 345
         }
355
-        
346
+
356 347
         switch (level) {
357 348
             case "PERSONAL":
358 349
                 return "PERSONAL_LEVEL";
@@ -371,22 +362,21 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
371 362
     @Override
372 363
     @Transactional
373 364
     public ApprovalInstance startPersonalLevelProcess(String businessType, Long businessId, String title,
374
-                                                    Long submitterId, String submitterName, Long sectionLeaderId,
375
-                                                    Map<String, Object> formData, Map<String, Object> businessData)
376
-    {
365
+                                                      Long submitterId, String submitterName, Long sectionLeaderId,
366
+                                                      Map<String, Object> formData, Map<String, Object> businessData) {
377 367
         // 新的个人级别流程:组长发起 → 科长审批 → 问题人整改 → 发起人审批 → 完成
378
-        ApprovalInstance instance = startProcess("PERSONAL_LEVEL", businessType, businessId, title, 
379
-                                                submitterId, submitterName, formData, businessData);
380
-        
368
+        ApprovalInstance instance = startProcess("PERSONAL_LEVEL", businessType, businessId, title,
369
+                submitterId, submitterName, formData, businessData);
370
+
381 371
         // 获取第一个审批节点(科长审批节点)
382 372
         ApprovalNodeDefinition firstApprovalNode = nodeDefinitionMapper.selectNextNodeByOrder(
383 373
                 instance.getWorkflowId(), 1); // 获取排序为2的节点(科长审批)
384
-        
374
+
385 375
         if (firstApprovalNode != null) {
386 376
             // 更新实例当前节点为科长审批节点
387 377
             instance.setCurrentNodeId(firstApprovalNode.getId());
388 378
             instanceMapper.updateApprovalInstance(instance);
389
-            
379
+
390 380
             // 创建科长审批任务
391 381
             SysUser sectionLeader = sysUserMapper.selectUserById(sectionLeaderId);
392 382
             if (sectionLeader != null) {
@@ -397,7 +387,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
397 387
         } else {
398 388
             throw new RuntimeException("无法找到科长审批节点");
399 389
         }
400
-        
390
+
401 391
         return instance;
402 392
     }
403 393
 
@@ -407,9 +397,8 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
407 397
     @Override
408 398
     @Transactional
409 399
     public ApprovalInstance startSectionLevelProcess(String businessType, Long businessId, String title,
410
-                                                   Long submitterId, String submitterName, Long sectionLeaderId,
411
-                                                   Map<String, Object> formData, Map<String, Object> businessData)
412
-    {
400
+                                                     Long submitterId, String submitterName, Long sectionLeaderId,
401
+                                                     Map<String, Object> formData, Map<String, Object> businessData) {
413 402
         ApprovalWorkflowDefinition workflow = workflowDefinitionMapper.selectApprovalWorkflowDefinitionByCode("SECTION_LEVEL");
414 403
         if (workflow == null) {
415 404
             throw new RuntimeException("流程定义不存在: SECTION_LEVEL");
@@ -425,29 +414,29 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
425 414
         instance.setSubmitterName(submitterName);
426 415
         instance.setSubmitTime(DateUtils.getNowDate());
427 416
         instance.setStatus("RUNNING");
428
-        
417
+
429 418
         try {
430 419
             instance.setFormData(formData != null ? objectMapper.writeValueAsString(formData) : null);
431 420
         } catch (Exception e) {
432 421
             throw new RuntimeException("表单数据序列化失败", e);
433 422
         }
434
-        
423
+
435 424
         // 扩展业务数据,添加科长ID和发起人ID用于后续流程
436 425
         if (businessData == null) {
437 426
             businessData = new HashMap<>();
438 427
         }
439 428
         businessData.put("sectionLeaderId", sectionLeaderId);
440 429
         businessData.put("initiatorId", submitterId);
441
-        
430
+
442 431
         try {
443 432
             instance.setBusinessData(objectMapper.writeValueAsString(businessData));
444 433
         } catch (Exception e) {
445 434
             throw new RuntimeException("业务数据序列化失败", e);
446 435
         }
447
-        
436
+
448 437
         instance.setCreateBy(SecurityUtils.getUsername());
449 438
         instance.setCreateTime(DateUtils.getNowDate());
450
-        
439
+
451 440
         instanceMapper.insertApprovalInstance(instance);
452 441
 
453 442
         // 获取第一个节点
@@ -455,7 +444,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
455 444
         if (firstNode != null) {
456 445
             instance.setCurrentNodeId(firstNode.getId());
457 446
             instanceMapper.updateApprovalInstance(instance);
458
-            
447
+
459 448
             // 如果是开始节点,直接流转到下一个节点(科长审批)
460 449
             if ("START".equals(firstNode.getNodeType())) {
461 450
                 moveToNextNode(instance, firstNode, submitterId, submitterName, "提交", formData, null);
@@ -474,11 +463,10 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
474 463
     @Override
475 464
     @Transactional
476 465
     public ApprovalInstance startGroupLevelProcess(String businessType, Long businessId, String title,
477
-                                                 Long submitterId, String submitterName,
478
-                                                 Map<String, Object> formData, Map<String, Object> businessData)
479
-    {
480
-        return startProcess("GROUP_LEVEL", businessType, businessId, title, 
481
-                          submitterId, submitterName, formData, businessData);
466
+                                                   Long submitterId, String submitterName,
467
+                                                   Map<String, Object> formData, Map<String, Object> businessData) {
468
+        return startProcess("GROUP_LEVEL", businessType, businessId, title,
469
+                submitterId, submitterName, formData, businessData);
482 470
     }
483 471
 
484 472
     /**
@@ -487,19 +475,17 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
487 475
     @Override
488 476
     @Transactional
489 477
     public ApprovalInstance startSeizureReportProcess(String businessType, Long businessId, String title,
490
-                                                     Long submitterId, String submitterName, String submitterRole,
491
-                                                     Map<String, Object> formData, Map<String, Object> businessData)
492
-    {
478
+                                                      Long submitterId, String submitterName, String submitterRole,
479
+                                                      Map<String, Object> formData, Map<String, Object> businessData) {
493 480
         String workflowCode = getWorkflowCodeByBusinessAndLevel(businessType, null, submitterRole);
494
-        return startProcess(workflowCode, businessType, businessId, title, 
495
-                          submitterId, submitterName, formData, businessData);
481
+        return startProcess(workflowCode, businessType, businessId, title,
482
+                submitterId, submitterName, formData, businessData);
496 483
     }
497 484
 
498 485
     /**
499 486
      * 为节点创建任务
500 487
      */
501
-    private void createTasksForNode(ApprovalInstance instance, ApprovalNodeDefinition node, Map<String, Object> formData, String remark)
502
-    {
488
+    private void createTasksForNode(ApprovalInstance instance, ApprovalNodeDefinition node, Map<String, Object> formData, String remark) {
503 489
         // 根据审批人类型获取审批人列表
504 490
         List<Long> assigneeIds = getAssigneeIds(node, instance);
505 491
 
@@ -543,12 +529,11 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
543 529
             }
544 530
         }
545 531
     }
546
-    
532
+
547 533
     /**
548 534
      * 为节点创建任务(支持动态分配)
549 535
      */
550
-    private void createTasksForNodeWithDynamicAssignment(ApprovalInstance instance, ApprovalNodeDefinition node, Map<String, Object> formData, String remark)
551
-    {
536
+    private void createTasksForNodeWithDynamicAssignment(ApprovalInstance instance, ApprovalNodeDefinition node, Map<String, Object> formData, String remark) {
552 537
         // 使用带表单数据的获取审批人方法
553 538
         List<Long> assigneeIds = getAssigneeIds(node, instance, formData);
554 539
 
@@ -596,8 +581,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
596 581
     /**
597 582
      * 创建通知任务
598 583
      */
599
-    private void createNotificationTask(ApprovalInstance instance, Long userId, String userName, String taskName)
600
-    {
584
+    private void createNotificationTask(ApprovalInstance instance, Long userId, String userName, String taskName) {
601 585
         ApprovalTask task = new ApprovalTask();
602 586
         task.setTaskNo(taskMapper.generateTaskNo());
603 587
         task.setInstanceId(instance.getId());
@@ -607,17 +591,17 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
607 591
         task.setAssigneeName(userName);
608 592
         task.setAssignTime(DateUtils.getNowDate());
609 593
         task.setStatus("PENDING");
610
-        
594
+
611 595
         // 设置备注(通知任务的默认备注)
612 596
         task.setRemark("系统自动分配的通知任务");
613
-        
597
+
614 598
         // 通知任务可以不设置formData,或者使用实例的formData
615 599
         task.setFormData(instance.getFormData());
616
-        
600
+
617 601
         task.setTimeoutTime(DateUtils.addHours(DateUtils.getNowDate(), 24)); // 24小时超时
618 602
         task.setCreateBy(SecurityUtils.getUsername());
619 603
         task.setCreateTime(DateUtils.getNowDate());
620
-        
604
+
621 605
         taskMapper.insertApprovalTask(task);
622 606
     }
623 607
 
@@ -639,7 +623,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
639 623
         task.setTimeoutTime(DateUtils.addHours(DateUtils.getNowDate(), 48)); // 48小时超时
640 624
         task.setCreateBy(SecurityUtils.getUsername());
641 625
         task.setCreateTime(DateUtils.getNowDate());
642
-        
626
+
643 627
         taskMapper.insertApprovalTask(task);
644 628
     }
645 629
 
@@ -661,27 +645,26 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
661 645
         task.setTimeoutTime(DateUtils.addHours(DateUtils.getNowDate(), 48)); // 48小时超时
662 646
         task.setCreateBy(SecurityUtils.getUsername());
663 647
         task.setCreateTime(DateUtils.getNowDate());
664
-        
648
+
665 649
         taskMapper.insertApprovalTask(task);
666 650
     }
667 651
 
668 652
     /**
669 653
      * 流转到下一节点
670 654
      */
671
-    private void moveToNextNode(ApprovalInstance instance, ApprovalNodeDefinition currentNode, 
672
-                               Long operatorId, String operatorName, String comment, Map<String, Object> formData, ApprovalTask currentTask)
673
-    {
655
+    private void moveToNextNode(ApprovalInstance instance, ApprovalNodeDefinition currentNode,
656
+                                Long operatorId, String operatorName, String comment, Map<String, Object> formData, ApprovalTask currentTask) {
674 657
         // 查找下一个节点
675 658
         ApprovalNodeDefinition nextNode = nodeDefinitionMapper.selectNextNodeByOrder(
676 659
                 instance.getWorkflowId(), currentNode.getSortOrder());
677
-        
660
+
678 661
         if (nextNode != null) {
679 662
             // 更新实例当前节点
680 663
             instance.setCurrentNodeId(nextNode.getId());
681 664
             instance.setUpdateBy(SecurityUtils.getUsername());
682 665
             instance.setUpdateTime(DateUtils.getNowDate());
683 666
             instanceMapper.updateApprovalInstance(instance);
684
-            
667
+
685 668
             if ("END".equals(nextNode.getNodeType())) {
686 669
                 // 结束节点,完成流程
687 670
                 completeProcess(instance, operatorId, operatorName);
@@ -696,14 +679,13 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
696 679
                 }
697 680
                 // 检查下一节点是否需要动态分配
698 681
                 else if (isSeizureReportWorkflow(instance) && ("GROUP_LEADER".equals(nextNode.getApproverType()) || "SECTION_LEADER".equals(nextNode.getApproverType()))) {
699
-                    Long submitterId=instance.getSubmitterId();
700
-                    if("SECTION_LEADER".equals(nextNode.getApproverType()) && ObjectUtil.isNotEmpty(currentTask) && ObjectUtil.isNotEmpty(currentTask.getAssigneeId())){
701
-                        submitterId=currentTask.getAssigneeId();
682
+                    Long submitterId = instance.getSubmitterId();
683
+                    if ("SECTION_LEADER".equals(nextNode.getApproverType()) && ObjectUtil.isNotEmpty(currentTask) && ObjectUtil.isNotEmpty(currentTask.getAssigneeId())) {
684
+                        submitterId = currentTask.getAssigneeId();
702 685
                     }
703 686
                     // 违禁品审批流程:根据提交人角色分配给其直接上级
704
-                    createTasksForNodeWithDirectSuperior(instance, nextNode, formData, null,submitterId);
705
-                }
706
-                else if ("GROUP_LEADER".equals(nextNode.getApproverType()) && formData != null && formData.containsKey("targetGroupId")) {
687
+                    createTasksForNodeWithDirectSuperior(instance, nextNode, formData, null, submitterId);
688
+                } else if ("GROUP_LEADER".equals(nextNode.getApproverType()) && formData != null && formData.containsKey("targetGroupId")) {
707 689
                     // 科长审批后,分配给指定班组的班组长
708 690
                     createTasksForNodeWithDynamicAssignment(instance, nextNode, formData, null);
709 691
                 } else if ("GROUP_LEADER".equals(nextNode.getApproverType()) && instance.getBusinessData() != null) {
@@ -716,8 +698,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
716 698
                 } else if ("DEPT_SECTION_LEADER".equals(nextNode.getApproverType())) {
717 699
                     // 科长复查完成后,分配给指定部门(如质检科)的科长
718 700
                     createTasksForNodeWithDeptSectionLeader(instance, nextNode, formData, null);
719
-                }
720
-                 else {
701
+                } else {
721 702
                     // 使用默认分配逻辑
722 703
                     createTasksForNode(instance, nextNode, formData, null);
723 704
                 }
@@ -731,20 +712,22 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
731 712
     /**
732 713
      * 完成流程
733 714
      */
734
-    private void completeProcess(ApprovalInstance instance, Long operatorId, String operatorName)
735
-    {
715
+    private void completeProcess(ApprovalInstance instance, Long operatorId, String operatorName) {
736 716
         instance.setStatus("COMPLETED");
737 717
         instance.setCompletionTime(DateUtils.getNowDate());
738 718
         instance.setCurrentNodeId(null);
739 719
         instance.setUpdateBy(SecurityUtils.getUsername());
740 720
         instance.setUpdateTime(DateUtils.getNowDate());
741 721
         instanceMapper.updateApprovalInstance(instance);
742
-        
722
+
743 723
         // 记录完成历史
744 724
         recordHistory(instance.getId(), null, null, null, "COMPLETE", operatorId, operatorName, "流程完成", null);
745 725
 
746 726
         // 创建抄送记录
747
-         if(!"SEIZURE_REPORT".equals(instance.getBusinessType())){ createCcRecords(instance);} ;
727
+        if (!"SEIZURE_REPORT".equals(instance.getBusinessType())) {
728
+            createCcRecords(instance);
729
+        }
730
+        ;
748 731
 
749 732
         // 执行业务处理逻辑
750 733
         executeBusinessLogic(instance, "APPROVED");
@@ -752,7 +735,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
752 735
 
753 736
     /**
754 737
      * 添加业务处理方法
755
-      */
738
+     */
756 739
     private void executeBusinessLogic(ApprovalInstance instance, String action) {
757 740
         if (businessHandlers == null || businessHandlers.isEmpty()) {
758 741
             return;
@@ -782,8 +765,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
782 765
      * 记录历史
783 766
      */
784 767
     private void recordHistory(Long instanceId, Long taskId, Long nodeId, String nodeName, String action,
785
-                             Long operatorId, String operatorName, String comment, Map<String, Object> formData)
786
-    {
768
+                               Long operatorId, String operatorName, String comment, Map<String, Object> formData) {
787 769
         // 通过operatorId查询用户真实姓名
788 770
         String realOperatorName = operatorName;
789 771
         if (operatorId != null) {
@@ -792,7 +774,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
792 774
                 realOperatorName = operator.getNickName();
793 775
             }
794 776
         }
795
-        
777
+
796 778
         ApprovalHistory history = new ApprovalHistory();
797 779
         history.setInstanceId(instanceId);
798 780
         history.setTaskId(taskId);
@@ -803,33 +785,31 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
803 785
         history.setOperatorName(realOperatorName);
804 786
         history.setOperationTime(DateUtils.getNowDate());
805 787
         history.setComment(comment);
806
-        
788
+
807 789
         try {
808 790
             history.setFormData(formData != null ? objectMapper.writeValueAsString(formData) : null);
809 791
         } catch (Exception e) {
810 792
             // 忽略序列化错误
811 793
         }
812
-        
794
+
813 795
         history.setCreateBy(SecurityUtils.getUsername());
814 796
         history.setCreateTime(DateUtils.getNowDate());
815
-        
797
+
816 798
         historyMapper.insertApprovalHistory(history);
817 799
     }
818 800
 
819 801
     /**
820 802
      * 根据节点配置获取审批人ID列表
821 803
      */
822
-    private List<Long> getAssigneeIds(ApprovalNodeDefinition node, ApprovalInstance instance)
823
-    {
804
+    private List<Long> getAssigneeIds(ApprovalNodeDefinition node, ApprovalInstance instance) {
824 805
         String businessData = instance.getBusinessData();
825 806
         return approvalUserService.getApproverIds(node.getApproverType(), node.getApproverValue(), businessData);
826 807
     }
827
-    
808
+
828 809
     /**
829 810
      * 根据节点配置和表单数据获取审批人ID列表(用于流转时的动态分配)
830 811
      */
831
-    private List<Long> getAssigneeIds(ApprovalNodeDefinition node, ApprovalInstance instance, Map<String, Object> formData)
832
-    {
812
+    private List<Long> getAssigneeIds(ApprovalNodeDefinition node, ApprovalInstance instance, Map<String, Object> formData) {
833 813
         // 优先使用表单数据(包含targetGroupId等动态信息)
834 814
         String dynamicData = null;
835 815
         if (formData != null) {
@@ -839,29 +819,28 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
839 819
                 // 忽略序列化错误,使用业务数据
840 820
             }
841 821
         }
842
-        
822
+
843 823
         // 如果没有表单数据或序列化失败,使用原始业务数据
844 824
         String businessData = dynamicData != null ? dynamicData : instance.getBusinessData();
845 825
         return approvalUserService.getApproverIds(node.getApproverType(), node.getApproverValue(), businessData);
846 826
     }
847
-    
827
+
848 828
     /**
849 829
      * 为节点创建任务(回流给原始操作者)
850 830
      */
851
-    private void createTasksForNodeWithOriginalOperator(ApprovalInstance instance, ApprovalNodeDefinition node, 
852
-                                                       Map<String, Object> formData, ApprovalTask currentTask, String remark)
853
-    {
831
+    private void createTasksForNodeWithOriginalOperator(ApprovalInstance instance, ApprovalNodeDefinition node,
832
+                                                        Map<String, Object> formData, ApprovalTask currentTask, String remark) {
854 833
         // 创建包含当前taskId的业务数据
855 834
         Map<String, Object> businessDataWithTaskId = new HashMap<>();
856 835
         if (currentTask != null) {
857 836
             businessDataWithTaskId.put("taskId", currentTask.getId());
858 837
         }
859
-        
838
+
860 839
         // 使用包含taskId的业务数据获取原始操作者
861 840
         try {
862 841
             String businessDataStr = objectMapper.writeValueAsString(businessDataWithTaskId);
863 842
             List<Long> assigneeIds = approvalUserService.getApproverIds(node.getApproverType(), node.getApproverValue(), businessDataStr);
864
-            
843
+
865 844
             for (Long assigneeId : assigneeIds) {
866 845
                 SysUser user = sysUserMapper.selectUserById(assigneeId);
867 846
                 if (user != null) {
@@ -905,35 +884,33 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
905 884
             throw new RuntimeException("创建原始操作者任务失败", e);
906 885
         }
907 886
     }
908
-    
887
+
909 888
     /**
910 889
      * 获取当前实例的活跃任务
911 890
      */
912
-    private ApprovalTask getCurrentTask(ApprovalInstance instance)
913
-    {
891
+    private ApprovalTask getCurrentTask(ApprovalInstance instance) {
914 892
         if (instance.getCurrentNodeId() != null) {
915 893
             List<ApprovalTask> tasks = taskMapper.selectApprovalTaskByInstanceId(instance.getId());
916 894
             return tasks.stream()
917
-                   .filter(task -> task.getNodeId().equals(instance.getCurrentNodeId()) && "PENDING".equals(task.getStatus()))
918
-                   .findFirst()
919
-                   .orElse(null);
895
+                    .filter(task -> task.getNodeId().equals(instance.getCurrentNodeId()) && "PENDING".equals(task.getStatus()))
896
+                    .findFirst()
897
+                    .orElse(null);
920 898
         }
921 899
         return null;
922 900
     }
923
-    
901
+
924 902
     /**
925 903
      * 为指定部门科长节点创建任务(质检科长审批)
926 904
      */
927
-    private void createTasksForNodeWithDeptSectionLeader(ApprovalInstance instance, ApprovalNodeDefinition node, Map<String, Object> formData, String remark)
928
-    {
905
+    private void createTasksForNodeWithDeptSectionLeader(ApprovalInstance instance, ApprovalNodeDefinition node, Map<String, Object> formData, String remark) {
929 906
         // 创建包含质检科ID的业务数据
930 907
         Map<String, Object> businessDataWithDeptId = new HashMap<>();
931 908
         businessDataWithDeptId.put("deptId", 289); // 质检科ID
932
-        
909
+
933 910
         try {
934 911
             String businessDataStr = objectMapper.writeValueAsString(businessDataWithDeptId);
935 912
             List<Long> assigneeIds = approvalUserService.getApproverIds(node.getApproverType(), node.getApproverValue(), businessDataStr);
936
-            
913
+
937 914
             for (Long assigneeId : assigneeIds) {
938 915
                 SysUser user = sysUserMapper.selectUserById(assigneeId);
939 916
                 if (user != null) {
@@ -977,22 +954,21 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
977 954
             throw new RuntimeException("创建质检科长任务失败", e);
978 955
         }
979 956
     }
980
-    
957
+
981 958
     /**
982 959
      * 创建驳回回流任务
983 960
      */
984
-    private void createBackflowTask(ApprovalInstance instance, ApprovalNodeDefinition currentNode, 
985
-                                   Long originalUserId, String rejectComment, String rejectOperatorName)
986
-    {
961
+    private void createBackflowTask(ApprovalInstance instance, ApprovalNodeDefinition currentNode,
962
+                                    Long originalUserId, String rejectComment, String rejectOperatorName) {
987 963
         SysUser originalUser = sysUserMapper.selectUserById(originalUserId);
988 964
         if (originalUser != null) {
989 965
             // 查找上一个节点
990 966
             ApprovalNodeDefinition previousNode = nodeDefinitionMapper.selectPreviousNodeByOrder(
991
-                instance.getWorkflowId(), currentNode.getSortOrder());
992
-            
967
+                    instance.getWorkflowId(), currentNode.getSortOrder());
968
+
993 969
             // 如果没有上一个节点,则使用当前节点(兼容处理)
994 970
             ApprovalNodeDefinition targetNode = previousNode != null ? previousNode : currentNode;
995
-            
971
+
996 972
             ApprovalTask backflowTask = new ApprovalTask();
997 973
             backflowTask.setTaskNo(taskMapper.generateTaskNo());
998 974
             backflowTask.setInstanceId(instance.getId());
@@ -1002,37 +978,36 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
1002 978
             backflowTask.setAssigneeName(originalUser.getNickName());
1003 979
             backflowTask.setAssignTime(DateUtils.getNowDate());
1004 980
             backflowTask.setStatus("PENDING");
1005
-            
981
+
1006 982
             // 在任务备注中记录驳回信息
1007 983
             backflowTask.setRemark("任务被" + rejectOperatorName + "驳回,驳回原因:" + rejectComment);
1008
-            
984
+
1009 985
             // 驳回回流任务使用实例的formData
1010 986
             backflowTask.setFormData(instance.getFormData());
1011
-            
987
+
1012 988
             // 设置超时时间(默认48小时)
1013 989
             backflowTask.setTimeoutTime(DateUtils.addHours(DateUtils.getNowDate(), 48));
1014
-            
990
+
1015 991
             backflowTask.setCreateBy(SecurityUtils.getUsername());
1016 992
             backflowTask.setCreateTime(DateUtils.getNowDate());
1017
-            
993
+
1018 994
             taskMapper.insertApprovalTask(backflowTask);
1019
-            
995
+
1020 996
             // 记录回流历史
1021 997
 //            recordHistory(instance.getId(), backflowTask.getId(), targetNode.getId(), targetNode.getNodeName(),
1022 998
 //                         "BACKFLOW", originalUserId, originalUser.getNickName(),
1023 999
 //                         "驳回回流,需要重新处理。驳回原因:" + rejectComment, null);
1024 1000
         }
1025 1001
     }
1026
-    
1002
+
1027 1003
     /**
1028 1004
      * 根据业务数据为班组长节点创建任务(班组级流程)
1029 1005
      */
1030
-    private void createTasksForNodeWithBusinessData(ApprovalInstance instance, ApprovalNodeDefinition node, Map<String, Object> formData, String remark)
1031
-    {
1006
+    private void createTasksForNodeWithBusinessData(ApprovalInstance instance, ApprovalNodeDefinition node, Map<String, Object> formData, String remark) {
1032 1007
         try {
1033 1008
             // 使用实例的业务数据来获取班组长
1034 1009
             List<Long> assigneeIds = approvalUserService.getApproverIds(node.getApproverType(), node.getApproverValue(), instance.getBusinessData());
1035
-            
1010
+
1036 1011
             for (Long assigneeId : assigneeIds) {
1037 1012
                 SysUser user = sysUserMapper.selectUserById(assigneeId);
1038 1013
                 if (user != null) {
@@ -1076,12 +1051,11 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
1076 1051
             throw new RuntimeException("创建班组长任务失败", e);
1077 1052
         }
1078 1053
     }
1079
-    
1054
+
1080 1055
     /**
1081 1056
      * 判断是否为违禁品审批流程
1082 1057
      */
1083
-    private boolean isSeizureReportWorkflow(ApprovalInstance instance)
1084
-    {
1058
+    private boolean isSeizureReportWorkflow(ApprovalInstance instance) {
1085 1059
         return "SEIZURE_REPORT".equals(instance.getBusinessType());
1086 1060
     }
1087 1061
 
@@ -1104,7 +1078,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
1104 1078
      */
1105 1079
     private void handlePersonalCheckNodeAssignment(ApprovalInstance instance, ApprovalNodeDefinition nextNode, Map<String, Object> formData) {
1106 1080
         String nodeCode = nextNode.getNodeCode();
1107
-        
1081
+
1108 1082
         switch (nodeCode) {
1109 1083
             case "PROBLEM_USER_RECTIFY":
1110 1084
                 // 科长审批后 → 问题人整改
@@ -1126,7 +1100,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
1126 1100
      */
1127 1101
     private void handleSectionCheckNodeAssignment(ApprovalInstance instance, ApprovalNodeDefinition nextNode, Map<String, Object> formData) {
1128 1102
         String nodeCode = nextNode.getNodeCode();
1129
-        
1103
+
1130 1104
         switch (nodeCode) {
1131 1105
             case "GROUP_LEADER_RECTIFY":
1132 1106
                 // 检查是否需要流转至班组长(基于科长审批时的选择)
@@ -1235,15 +1209,15 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
1235 1209
         }
1236 1210
         return null;
1237 1211
     }
1238
-    
1212
+
1239 1213
     /**
1240 1214
      * 自动取消同一节点的其他待办任务
1241 1215
      *
1242
-     * @param instanceId 流程实例ID
1243
-     * @param nodeId 审批节点ID
1216
+     * @param instanceId    流程实例ID
1217
+     * @param nodeId        审批节点ID
1244 1218
      * @param currentTaskId 当前已处理的任务ID(不取消此任务)
1245
-     * @param operatorId 操作人ID
1246
-     * @param operatorName 操作人姓名
1219
+     * @param operatorId    操作人ID
1220
+     * @param operatorName  操作人姓名
1247 1221
      */
1248 1222
     private void cancelOtherPendingTasksInSameNode(Long instanceId, Long nodeId, Long currentTaskId, Long operatorId, String operatorName) {
1249 1223
         try {
@@ -1251,10 +1225,10 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
1251 1225
             List<ApprovalTask> allTasks = taskMapper.selectApprovalTaskByInstanceId(instanceId);
1252 1226
 
1253 1227
             List<ApprovalTask> pendingTasks = allTasks.stream()
1254
-                .filter(t -> t.getNodeId().equals(nodeId))
1255
-                .filter(t -> "PENDING".equals(t.getStatus()))
1256
-                .filter(t -> !t.getId().equals(currentTaskId))  // 排除当前任务
1257
-                .collect(Collectors.toList());
1228
+                    .filter(t -> t.getNodeId().equals(nodeId))
1229
+                    .filter(t -> "PENDING".equals(t.getStatus()))
1230
+                    .filter(t -> !t.getId().equals(currentTaskId))  // 排除当前任务
1231
+                    .collect(Collectors.toList());
1258 1232
 
1259 1233
             if (pendingTasks.isEmpty()) {
1260 1234
                 return;
@@ -1272,15 +1246,15 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
1272 1246
 
1273 1247
                 // 3. 记录取消历史
1274 1248
                 recordHistory(
1275
-                    instanceId,
1276
-                    taskToCancel.getId(),
1277
-                    nodeId,
1278
-                    taskToCancel.getTaskName(),
1279
-                    "AUTO_CANCEL",
1280
-                    operatorId,
1281
-                    operatorName,
1282
-                    "同节点任务已由其他审批人处理,自动取消",
1283
-                    null
1249
+                        instanceId,
1250
+                        taskToCancel.getId(),
1251
+                        nodeId,
1252
+                        taskToCancel.getTaskName(),
1253
+                        "AUTO_CANCEL",
1254
+                        operatorId,
1255
+                        operatorName,
1256
+                        "同节点任务已由其他审批人处理,自动取消",
1257
+                        null
1284 1258
                 );
1285 1259
             }
1286 1260
 
@@ -1296,17 +1270,16 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
1296 1270
     /**
1297 1271
      * 为违禁品审批节点创建任务(根据提交人角色分配给其直接上级)
1298 1272
      */
1299
-    private void createTasksForNodeWithDirectSuperior(ApprovalInstance instance, ApprovalNodeDefinition node, Map<String, Object> formData, String remark,Long submitterId)
1300
-    {
1273
+    private void createTasksForNodeWithDirectSuperior(ApprovalInstance instance, ApprovalNodeDefinition node, Map<String, Object> formData, String remark, Long submitterId) {
1301 1274
         try {
1302
-            
1275
+
1303 1276
             // 根据提交人查找其直接上级
1304 1277
             List<Long> assigneeIds = approvalUserService.getDirectSuperiorIds(submitterId);
1305
-            
1278
+
1306 1279
             if (assigneeIds.isEmpty()) {
1307 1280
                 throw new RuntimeException("未找到提交人的直接上级,无法分配审批任务");
1308 1281
             }
1309
-            
1282
+
1310 1283
             for (Long assigneeId : assigneeIds) {
1311 1284
                 SysUser user = sysUserMapper.selectUserById(assigneeId);
1312 1285
                 if (user != null) {
@@ -1319,7 +1292,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
1319 1292
                     task.setAssigneeName(user.getNickName());
1320 1293
                     task.setAssignTime(DateUtils.getNowDate());
1321 1294
                     task.setStatus("PENDING");
1322
-                    
1295
+
1323 1296
                     // 设置表单数据 - 如果formData为空,使用当前实例的formData
1324 1297
                     try {
1325 1298
                         if (formData != null) {
@@ -1331,15 +1304,15 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
1331 1304
                         // 序列化失败时使用实例的formData
1332 1305
                         task.setFormData(instance.getFormData());
1333 1306
                     }
1334
-                    
1307
+
1335 1308
                     // 设置超时时间
1336 1309
                     if (node.getTimeoutHours() != null && node.getTimeoutHours() > 0) {
1337 1310
                         task.setTimeoutTime(DateUtils.addHours(DateUtils.getNowDate(), node.getTimeoutHours()));
1338 1311
                     }
1339
-                    
1312
+
1340 1313
                     task.setCreateBy(SecurityUtils.getUsername());
1341 1314
                     task.setCreateTime(DateUtils.getNowDate());
1342
-                    
1315
+
1343 1316
                     taskMapper.insertApprovalTask(task);
1344 1317
                 }
1345 1318
             }
@@ -1347,7 +1320,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
1347 1320
             throw new RuntimeException("创建违禁品审批任务失败:" + e.getMessage(), e);
1348 1321
         }
1349 1322
     }
1350
-    
1323
+
1351 1324
     /**
1352 1325
      * 创建抄送记录
1353 1326
      * 抄送对象包括:发起人、groupLeaderId(如果存在)、质检科所有人员
@@ -1356,7 +1329,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
1356 1329
         try {
1357 1330
             // 收集抄送用户ID,使用Set避免重复
1358 1331
             java.util.Set<Long> ccUserIds = new java.util.HashSet<>();
1359
-            
1332
+
1360 1333
             // 根据业务类型决定抄送对象
1361 1334
             if ("PERSONAL_CHECK".equals(instance.getBusinessType())) {
1362 1335
                 // 个人级别检查:抄送质检科、组长发起人、审批科长
@@ -1365,7 +1338,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
1365 1338
                 // 其他流程:原有逻辑
1366 1339
                 createDefaultCcRecords(instance, ccUserIds);
1367 1340
             }
1368
-            
1341
+
1369 1342
             // 创建抄送记录
1370 1343
             Date ccTime = DateUtils.getNowDate();
1371 1344
             for (Long ccUserId : ccUserIds) {
@@ -1379,11 +1352,11 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
1379 1352
                     cc.setIsRead("0"); // 未读
1380 1353
                     cc.setCreateBy(SecurityUtils.getUsername());
1381 1354
                     cc.setCreateTime(ccTime);
1382
-                    
1355
+
1383 1356
                     ccMapper.insertApprovalCc(cc);
1384 1357
                 }
1385 1358
             }
1386
-            
1359
+
1387 1360
         } catch (Exception e) {
1388 1361
             // 记录错误但不中断流程
1389 1362
             e.printStackTrace();
@@ -1396,13 +1369,13 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
1396 1369
     private void createPersonalCheckCcRecords(ApprovalInstance instance, java.util.Set<Long> ccUserIds) {
1397 1370
         // 1. 添加发起人(组长)
1398 1371
         ccUserIds.add(instance.getSubmitterId());
1399
-        
1372
+
1400 1373
         // 2. 添加质检科所有人员
1401 1374
         List<SysUser> qualityUsers = sysUserMapper.selectUsersByRoleName("质检科");
1402 1375
         for (SysUser user : qualityUsers) {
1403 1376
             ccUserIds.add(user.getUserId());
1404 1377
         }
1405
-        
1378
+
1406 1379
         // 3. 从business_data中提取sectionLeaderId(审批科长)
1407 1380
         if (StringUtils.isNotEmpty(instance.getBusinessData())) {
1408 1381
             Long sectionLeaderId = extractSectionLeaderIdFromBusinessData(instance.getBusinessData());
@@ -1418,7 +1391,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
1418 1391
     private void createDefaultCcRecords(ApprovalInstance instance, java.util.Set<Long> ccUserIds) {
1419 1392
         // 1. 添加发起人
1420 1393
         ccUserIds.add(instance.getSubmitterId());
1421
-        
1394
+
1422 1395
         // 2. 从business_data中提取groupLeaderId
1423 1396
         if (StringUtils.isNotEmpty(instance.getBusinessData())) {
1424 1397
             Long groupLeaderId = extractGroupLeaderIdFromBusinessData(instance.getBusinessData());
@@ -1426,7 +1399,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
1426 1399
                 ccUserIds.add(groupLeaderId);
1427 1400
             }
1428 1401
         }
1429
-        
1402
+
1430 1403
         // 3. 添加质检科所有人员
1431 1404
         List<SysUser> qualityUsers = sysUserMapper.selectUsersByRoleName("质检科");
1432 1405
         for (SysUser user : qualityUsers) {
@@ -1451,7 +1424,7 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
1451 1424
         }
1452 1425
         return null;
1453 1426
     }
1454
-    
1427
+
1455 1428
     /**
1456 1429
      * 从业务数据JSON中提取groupLeaderId
1457 1430
      */
@@ -1510,13 +1483,13 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
1510 1483
         try {
1511 1484
             Object groupLeaderIdObj = formData.get("groupLeaderId");
1512 1485
             Long groupLeaderId = null;
1513
-            
1486
+
1514 1487
             if (groupLeaderIdObj instanceof Number) {
1515 1488
                 groupLeaderId = ((Number) groupLeaderIdObj).longValue();
1516 1489
             } else if (groupLeaderIdObj instanceof String) {
1517 1490
                 groupLeaderId = Long.parseLong((String) groupLeaderIdObj);
1518 1491
             }
1519
-            
1492
+
1520 1493
             if (groupLeaderId != null) {
1521 1494
                 SysUser groupLeader = sysUserMapper.selectUserById(groupLeaderId);
1522 1495
                 if (groupLeader != null) {
@@ -1582,19 +1555,19 @@ public class ApprovalEngineServiceImpl implements IApprovalEngineService
1582 1555
             // 查找发起人审批节点
1583 1556
             List<ApprovalNodeDefinition> nodes = nodeDefinitionMapper.selectApprovalNodeDefinitionByWorkflowId(instance.getWorkflowId());
1584 1557
             ApprovalNodeDefinition initiatorNode = null;
1585
-            
1558
+
1586 1559
             for (ApprovalNodeDefinition node : nodes) {
1587 1560
                 if ("INITIATOR_FINAL_REVIEW".equals(node.getNodeCode())) {
1588 1561
                     initiatorNode = node;
1589 1562
                     break;
1590 1563
                 }
1591 1564
             }
1592
-            
1565
+
1593 1566
             if (initiatorNode != null) {
1594 1567
                 // 更新实例当前节点
1595 1568
                 instance.setCurrentNodeId(initiatorNode.getId());
1596 1569
                 instanceMapper.updateApprovalInstance(instance);
1597
-                
1570
+
1598 1571
                 // 创建发起人审批任务
1599 1572
                 createTaskForInitiatorFinalReview(instance, initiatorNode, formData);
1600 1573
             } else {

+ 89 - 109
airport-system/src/main/java/com/sundot/airport/system/service/approval/impl/ApprovalUserServiceImpl.java

@@ -20,25 +20,24 @@ import com.sundot.airport.system.service.approval.IApprovalUserService;
20 20
 
21 21
 /**
22 22
  * 审批流程用户服务实现
23
- * 
23
+ *
24 24
  * @author simon lin
25 25
  * @date 2025-09-06
26 26
  */
27 27
 @Service
28
-public class ApprovalUserServiceImpl implements IApprovalUserService
29
-{
28
+public class ApprovalUserServiceImpl implements IApprovalUserService {
30 29
     @Autowired
31 30
     private SysUserMapper userMapper;
32
-    
31
+
33 32
     @Autowired
34 33
     private SysDeptMapper deptMapper;
35
-    
34
+
36 35
     @Autowired
37 36
     private SysRoleMapper roleMapper;
38
-    
37
+
39 38
     @Autowired
40 39
     private ApprovalTaskMapper taskMapper;
41
-    
40
+
42 41
     @Autowired
43 42
     private ApprovalInstanceMapper instanceMapper;
44 43
 
@@ -46,8 +45,7 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
46 45
      * 根据审批人类型获取审批人ID列表
47 46
      */
48 47
     @Override
49
-    public List<Long> getApproverIds(String approverType, String approverValue, Object businessData)
50
-    {
48
+    public List<Long> getApproverIds(String approverType, String approverValue, Object businessData) {
51 49
         switch (approverType) {
52 50
             case "USER":
53 51
                 // 指定用户,approverValue为用户ID,多个用逗号分隔
@@ -64,11 +62,11 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
64 62
                     return userIds;
65 63
                 }
66 64
                 break;
67
-                
65
+
68 66
             case "ROLE":
69 67
                 // 角色,approverValue为角色标识
70 68
                 return getUserIdsByRoleKey(approverValue);
71
-                
69
+
72 70
             case "DEPT":
73 71
                 // 部门,approverValue为部门ID
74 72
                 if (approverValue != null) {
@@ -80,27 +78,27 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
80 78
                     }
81 79
                 }
82 80
                 break;
83
-                
81
+
84 82
             case "GROUP_LEADER":
85 83
                 // 班组长,根据业务数据动态获取
86 84
                 return getGroupLeaderIdsByBusinessData(businessData);
87
-                
85
+
88 86
             case "SECTION_LEADER":
89 87
                 // 科长,根据业务数据动态获取
90 88
                 return getSectionLeaderIdsByBusinessData(businessData);
91
-                
89
+
92 90
             case "ORIGINAL_OPERATOR":
93 91
                 // 原始操作者,根据业务数据中的taskId获取
94 92
                 return getOriginalOperatorIdsByBusinessData(businessData);
95
-                
93
+
96 94
             case "DEPT_SECTION_LEADER":
97 95
                 // 指定部门的科长,根据业务数据中的deptId获取
98 96
                 return getDeptSectionLeaderIdsByBusinessData(businessData);
99
-                
97
+
100 98
             default:
101 99
                 break;
102 100
         }
103
-        
101
+
104 102
         return new ArrayList<>();
105 103
     }
106 104
 
@@ -109,30 +107,29 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
109 107
      * 如果传入的是班组ID,会自动查找其父部门的科长
110 108
      */
111 109
     @Override
112
-    public List<Long> getDeptLeaderIds(Long deptId)
113
-    {
110
+    public List<Long> getDeptLeaderIds(Long deptId) {
114 111
         List<Long> leaderIds = new ArrayList<>();
115
-        
112
+
116 113
         if (deptId == null) {
117 114
             return leaderIds;
118 115
         }
119
-        
116
+
120 117
         // 获取传入的部门信息
121 118
         SysDept dept = deptMapper.selectDeptById(deptId);
122 119
         if (dept == null) {
123 120
             return leaderIds;
124 121
         }
125
-        
122
+
126 123
         // 确定要查找科长的科室ID
127 124
         Long sectionDeptId = deptId;
128
-        
125
+
129 126
         // 如果当前部门有父部门,说明这是班组,需要找父部门(科室)的科长
130 127
         if (dept.getParentId() != null && dept.getParentId() != 100) {
131 128
             sectionDeptId = dept.getParentId();
132 129
             // 重新获取科室部门信息
133 130
             dept = deptMapper.selectDeptById(sectionDeptId);
134 131
         }
135
-        
132
+
136 133
         if (dept != null) {
137 134
             // 方法1: 根据部门负责人姓名查找用户
138 135
             if (dept.getLeader() != null && !dept.getLeader().isEmpty()) {
@@ -141,11 +138,11 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
141 138
                     leaderIds.add(leader.getUserId());
142 139
                 }
143 140
             }
144
-            
141
+
145 142
             // 方法2: 根据角色查找科长(在该科室下的科长)
146 143
             List<Long> sectionLeaderIds = getUserIdsByRoleKey("kezhang");
147 144
             List<SysUser> sectionUsers = userMapper.selectUsersByDeptId(sectionDeptId);
148
-            
145
+
149 146
             for (SysUser user : sectionUsers) {
150 147
                 if (sectionLeaderIds.contains(user.getUserId())) {
151 148
                     if (!leaderIds.contains(user.getUserId())) {
@@ -154,7 +151,7 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
154 151
                 }
155 152
             }
156 153
         }
157
-        
154
+
158 155
         return leaderIds;
159 156
     }
160 157
 
@@ -162,8 +159,7 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
162 159
      * 根据用户ID获取所属部门的科长
163 160
      */
164 161
     @Override
165
-    public List<Long> getSectionLeaderIdsByUserId(Long userId)
166
-    {
162
+    public List<Long> getSectionLeaderIdsByUserId(Long userId) {
167 163
         SysUser user = userMapper.selectUserById(userId);
168 164
         if (user != null && user.getDeptId() != null) {
169 165
             return getDeptLeaderIds(user.getDeptId());
@@ -175,15 +171,14 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
175 171
      * 根据用户ID获取所属班组的班组长
176 172
      */
177 173
     @Override
178
-    public List<Long> getGroupLeaderIdsByUserId(Long userId)
179
-    {
174
+    public List<Long> getGroupLeaderIdsByUserId(Long userId) {
180 175
         List<Long> groupLeaderIds = new ArrayList<>();
181
-        
176
+
182 177
         SysUser user = userMapper.selectUserById(userId);
183 178
         if (user != null && user.getDeptId() != null) {
184 179
             // 获取班组长角色的用户
185 180
             List<Long> groupLeaderRoleIds = getUserIdsByRoleKey("banzuzhang");
186
-            
181
+
187 182
             // 获取同部门的班组长
188 183
             List<SysUser> deptUsers = userMapper.selectUsersByDeptId(user.getDeptId());
189 184
             for (SysUser deptUser : deptUsers) {
@@ -192,7 +187,7 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
192 187
                 }
193 188
             }
194 189
         }
195
-        
190
+
196 191
         return groupLeaderIds;
197 192
     }
198 193
 
@@ -200,45 +195,42 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
200 195
      * 根据角色标识获取用户ID列表
201 196
      */
202 197
     @Override
203
-    public List<Long> getUserIdsByRoleKey(String roleKey)
204
-    {
198
+    public List<Long> getUserIdsByRoleKey(String roleKey) {
205 199
         if (roleKey == null) {
206 200
             return new ArrayList<>();
207 201
         }
208
-        
202
+
209 203
         List<SysUser> users = userMapper.selectUsersByRoleKey(roleKey);
210 204
         return users.stream()
211
-                   .map(SysUser::getUserId)
212
-                   .collect(Collectors.toList());
205
+                .map(SysUser::getUserId)
206
+                .collect(Collectors.toList());
213 207
     }
214 208
 
215 209
     /**
216 210
      * 根据部门ID获取部门下所有用户ID列表
217 211
      */
218 212
     @Override
219
-    public List<Long> getUserIdsByDeptId(Long deptId)
220
-    {
213
+    public List<Long> getUserIdsByDeptId(Long deptId) {
221 214
         if (deptId == null) {
222 215
             return new ArrayList<>();
223 216
         }
224
-        
217
+
225 218
         List<SysUser> users = userMapper.selectUsersByDeptId(deptId);
226 219
         return users.stream()
227
-                   .filter(user -> "0".equals(user.getStatus()) && "0".equals(user.getDelFlag()))
228
-                   .map(SysUser::getUserId)
229
-                   .collect(Collectors.toList());
220
+                .filter(user -> "0".equals(user.getStatus()) && "0".equals(user.getDelFlag()))
221
+                .map(SysUser::getUserId)
222
+                .collect(Collectors.toList());
230 223
     }
231 224
 
232 225
     /**
233 226
      * 判断用户是否为班组长角色
234 227
      */
235 228
     @Override
236
-    public boolean isGroupLeader(Long userId)
237
-    {
229
+    public boolean isGroupLeader(Long userId) {
238 230
         if (userId == null) {
239 231
             return false;
240 232
         }
241
-        
233
+
242 234
         List<Long> groupLeaderIds = getUserIdsByRoleKey("banzuzhang");
243 235
         return groupLeaderIds.contains(userId);
244 236
     }
@@ -247,12 +239,11 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
247 239
      * 判断用户是否为科长角色
248 240
      */
249 241
     @Override
250
-    public boolean isSectionLeader(Long userId)
251
-    {
242
+    public boolean isSectionLeader(Long userId) {
252 243
         if (userId == null) {
253 244
             return false;
254 245
         }
255
-        
246
+
256 247
         List<Long> sectionLeaderIds = getUserIdsByRoleKey("kezhang");
257 248
         return sectionLeaderIds.contains(userId);
258 249
     }
@@ -261,8 +252,7 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
261 252
      * 根据业务数据动态获取整改班组
262 253
      */
263 254
     @Override
264
-    public Long getTargetGroupIdFromBusinessData(Object businessData)
265
-    {
255
+    public Long getTargetGroupIdFromBusinessData(Object businessData) {
266 256
         if (businessData instanceof String) {
267 257
             try {
268 258
                 String businessDataStr = (String) businessData;
@@ -280,15 +270,14 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
280 270
                 return null;
281 271
             }
282 272
         }
283
-        
273
+
284 274
         return null;
285 275
     }
286 276
 
287 277
     /**
288 278
      * 根据业务数据获取班组长ID列表
289 279
      */
290
-    private List<Long> getGroupLeaderIdsByBusinessData(Object businessData)
291
-    {
280
+    private List<Long> getGroupLeaderIdsByBusinessData(Object businessData) {
292 281
         // 优先检查是否有直接指定的groupLeaderId
293 282
         Long groupLeaderId = getGroupLeaderIdFromBusinessData(businessData);
294 283
         if (groupLeaderId != null) {
@@ -296,22 +285,22 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
296 285
             result.add(groupLeaderId);
297 286
             return result;
298 287
         }
299
-        
288
+
300 289
         Long targetId = null;
301
-        
290
+
302 291
         // 尝试从业务数据中获取targetGroupId或targetDeptId
303 292
         targetId = getTargetGroupIdFromBusinessData(businessData);
304 293
         if (targetId == null) {
305 294
             targetId = getTargetDeptIdFromBusinessData(businessData);
306 295
         }
307
-        
296
+
308 297
         if (targetId != null) {
309 298
             // 获取班组长角色的用户
310 299
             List<Long> groupLeaderRoleIds = getUserIdsByRoleKey("banzuzhang");
311
-            
300
+
312 301
             // 获取目标部门/班组的所有用户
313 302
             List<SysUser> groupUsers = userMapper.selectUsersByDeptId(targetId);
314
-            
303
+
315 304
             // 找到交集:既在目标部门/班组,又是班组长角色的用户
316 305
             List<Long> groupLeaderIds = new ArrayList<>();
317 306
             for (SysUser user : groupUsers) {
@@ -319,10 +308,10 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
319 308
                     groupLeaderIds.add(user.getUserId());
320 309
                 }
321 310
             }
322
-            
311
+
323 312
             return groupLeaderIds;
324 313
         }
325
-        
314
+
326 315
         // 如果无法从业务数据中获取,返回空列表
327 316
         return new ArrayList<>();
328 317
     }
@@ -330,8 +319,7 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
330 319
     /**
331 320
      * 根据业务数据获取科长ID列表
332 321
      */
333
-    private List<Long> getSectionLeaderIdsByBusinessData(Object businessData)
334
-    {
322
+    private List<Long> getSectionLeaderIdsByBusinessData(Object businessData) {
335 323
         // 优先检查是否有直接指定的sectionLeaderId
336 324
         Long sectionLeaderId = getSectionLeaderIdFromBusinessData(businessData);
337 325
         if (sectionLeaderId != null) {
@@ -339,14 +327,14 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
339 327
             result.add(sectionLeaderId);
340 328
             return result;
341 329
         }
342
-        
330
+
343 331
         // 如果没有直接指定的sectionLeaderId,则根据业务数据获取目标部门ID
344 332
         Long targetDeptId = getTargetDeptIdFromBusinessData(businessData);
345
-        
333
+
346 334
         if (targetDeptId != null) {
347 335
             return getDeptLeaderIds(targetDeptId);
348 336
         }
349
-        
337
+
350 338
         // 如果无法从业务数据中获取,返回空列表
351 339
         return new ArrayList<>();
352 340
     }
@@ -354,8 +342,7 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
354 342
     /**
355 343
      * 根据业务数据获取直接指定的班组长ID
356 344
      */
357
-    private Long getGroupLeaderIdFromBusinessData(Object businessData)
358
-    {
345
+    private Long getGroupLeaderIdFromBusinessData(Object businessData) {
359 346
         if (businessData instanceof String) {
360 347
             try {
361 348
                 String businessDataStr = (String) businessData;
@@ -374,12 +361,11 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
374 361
         }
375 362
         return null;
376 363
     }
377
-    
364
+
378 365
     /**
379 366
      * 根据业务数据获取直接指定的科长ID
380 367
      */
381
-    private Long getSectionLeaderIdFromBusinessData(Object businessData)
382
-    {
368
+    private Long getSectionLeaderIdFromBusinessData(Object businessData) {
383 369
         if (businessData instanceof String) {
384 370
             try {
385 371
                 String businessDataStr = (String) businessData;
@@ -398,12 +384,11 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
398 384
         }
399 385
         return null;
400 386
     }
401
-    
387
+
402 388
     /**
403 389
      * 根据业务数据获取目标部门ID
404 390
      */
405
-    private Long getTargetDeptIdFromBusinessData(Object businessData)
406
-    {
391
+    private Long getTargetDeptIdFromBusinessData(Object businessData) {
407 392
         if (businessData instanceof String) {
408 393
             try {
409 394
                 String businessDataStr = (String) businessData;
@@ -421,17 +406,16 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
421 406
                 return null;
422 407
             }
423 408
         }
424
-        
409
+
425 410
         return null;
426 411
     }
427
-    
412
+
428 413
     /**
429 414
      * 根据业务数据获取原始操作者ID列表(用于班组长整改完成后回流)
430 415
      */
431
-    private List<Long> getOriginalOperatorIdsByBusinessData(Object businessData)
432
-    {
416
+    private List<Long> getOriginalOperatorIdsByBusinessData(Object businessData) {
433 417
         List<Long> operatorIds = new ArrayList<>();
434
-        
418
+
435 419
         if (businessData instanceof String) {
436 420
             try {
437 421
                 String businessDataStr = (String) businessData;
@@ -452,17 +436,16 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
452 436
                 // 解析失败,返回空列表
453 437
             }
454 438
         }
455
-        
439
+
456 440
         return operatorIds;
457 441
     }
458
-    
442
+
459 443
     /**
460 444
      * 根据业务数据获取指定部门的科长ID列表
461 445
      */
462
-    private List<Long> getDeptSectionLeaderIdsByBusinessData(Object businessData)
463
-    {
446
+    private List<Long> getDeptSectionLeaderIdsByBusinessData(Object businessData) {
464 447
         List<Long> sectionLeaderIds = new ArrayList<>();
465
-        
448
+
466 449
         if (businessData instanceof String) {
467 450
             try {
468 451
                 String businessDataStr = (String) businessData;
@@ -473,11 +456,11 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
473 456
                     java.util.regex.Matcher matcher = pattern.matcher(businessDataStr);
474 457
                     if (matcher.find()) {
475 458
                         Long deptId = Long.valueOf(matcher.group(1));
476
-                        
459
+
477 460
                         // 获取指定部门下具有科长角色的用户
478 461
                         List<Long> kezhangRoleIds = getUserIdsByRoleKey("kezhang");
479 462
                         List<SysUser> deptUsers = userMapper.selectUsersByDeptId(deptId);
480
-                        
463
+
481 464
                         // 找到交集:既在指定部门,又是科长角色的用户
482 465
                         for (SysUser user : deptUsers) {
483 466
                             if (kezhangRoleIds.contains(user.getUserId())) {
@@ -490,29 +473,28 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
490 473
                 // 解析失败,返回空列表
491 474
             }
492 475
         }
493
-        
476
+
494 477
         return sectionLeaderIds;
495 478
     }
496
-    
479
+
497 480
     /**
498 481
      * 根据任务ID获取原始操作者(创建者或更新者)的用户ID
499 482
      */
500 483
     @Override
501
-    public Long getOriginalOperatorByTaskId(Long taskId)
502
-    {
484
+    public Long getOriginalOperatorByTaskId(Long taskId) {
503 485
         if (taskId == null) {
504 486
             return null;
505 487
         }
506
-        
488
+
507 489
         // 查找当前任务
508 490
         ApprovalTask currentTask = taskMapper.selectApprovalTaskById(taskId);
509 491
         if (currentTask == null) {
510 492
             return null;
511 493
         }
512
-        
494
+
513 495
         // 获取同一实例的所有历史任务,按创建时间排序
514 496
         List<ApprovalTask> instanceTasks = taskMapper.selectApprovalTaskByInstanceId(currentTask.getInstanceId());
515
-        
497
+
516 498
         // 查找最早的科长审批任务(SECTION_LEADER节点)
517 499
         for (ApprovalTask task : instanceTasks) {
518 500
             if (task.getCreateBy() != null) {
@@ -523,7 +505,7 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
523 505
                 }
524 506
             }
525 507
         }
526
-        
508
+
527 509
         // 如果找不到科长任务,查找实例的提交者(通常提交后会有科长审批)
528 510
         if (currentTask.getInstanceId() != null) {
529 511
             ApprovalInstance instance = instanceMapper.selectApprovalInstanceById(currentTask.getInstanceId());
@@ -532,26 +514,25 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
532 514
                 return getSectionLeaderIdsByUserId(instance.getSubmitterId()).stream().findFirst().orElse(null);
533 515
             }
534 516
         }
535
-        
517
+
536 518
         return null;
537 519
     }
538
-    
520
+
539 521
     /**
540 522
      * 根据任务ID获取任务的创建者或更新者用户ID(用于驳回回流)
541 523
      */
542 524
     @Override
543
-    public Long getTaskCreatorOrUpdaterByTaskId(Long taskId)
544
-    {
525
+    public Long getTaskCreatorOrUpdaterByTaskId(Long taskId) {
545 526
         if (taskId == null) {
546 527
             return null;
547 528
         }
548
-        
529
+
549 530
         // 查找当前任务
550 531
         ApprovalTask currentTask = taskMapper.selectApprovalTaskById(taskId);
551 532
         if (currentTask == null) {
552 533
             return null;
553 534
         }
554
-        
535
+
555 536
         // 如果没有更新者,查找create_by(创建者)
556 537
         if (currentTask.getCreateBy() != null && !currentTask.getCreateBy().isEmpty()) {
557 538
             SysUser user = userMapper.selectUserByUserName(currentTask.getCreateBy());
@@ -559,23 +540,22 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
559 540
                 return user.getUserId();
560 541
             }
561 542
         }
562
-        
543
+
563 544
         return null;
564 545
     }
565
-    
546
+
566 547
     /**
567 548
      * 根据用户ID查找其直接上级(违禁品审批用)
568 549
      * 如果用户是安检员,找其班组长;如果是班组长,找其科长
569 550
      */
570 551
     @Override
571
-    public List<Long> getDirectSuperiorIds(Long userId)
572
-    {
552
+    public List<Long> getDirectSuperiorIds(Long userId) {
573 553
         List<Long> superiorIds = new ArrayList<>();
574
-        
554
+
575 555
         if (userId == null) {
576 556
             return superiorIds;
577 557
         }
578
-        
558
+
579 559
         // 判断用户角色
580 560
         if (isGroupLeader(userId)) {
581 561
             // 如果是班组长,找其科长
@@ -586,7 +566,7 @@ public class ApprovalUserServiceImpl implements IApprovalUserService
586 566
             List<Long> groupLeaderIds = getGroupLeaderIdsByUserId(userId);
587 567
             superiorIds.addAll(groupLeaderIds);
588 568
         }
589
-        
569
+
590 570
         return superiorIds;
591 571
     }
592 572
 }

+ 19 - 27
airport-system/src/main/java/com/sundot/airport/system/service/approval/impl/ApprovalWorkflowServiceImpl.java

@@ -1,6 +1,7 @@
1 1
 package com.sundot.airport.system.service.approval.impl;
2 2
 
3 3
 import java.util.List;
4
+
4 5
 import org.springframework.beans.factory.annotation.Autowired;
5 6
 import org.springframework.stereotype.Service;
6 7
 import com.sundot.airport.system.mapper.approval.ApprovalWorkflowDefinitionMapper;
@@ -9,109 +10,100 @@ import com.sundot.airport.system.service.approval.IApprovalWorkflowService;
9 10
 
10 11
 /**
11 12
  * 审批流程定义Service业务层处理
12
- * 
13
+ *
13 14
  * @author simon lin
14 15
  * @date 2025-09-06
15 16
  */
16 17
 @Service
17
-public class ApprovalWorkflowServiceImpl implements IApprovalWorkflowService
18
-{
18
+public class ApprovalWorkflowServiceImpl implements IApprovalWorkflowService {
19 19
     @Autowired
20 20
     private ApprovalWorkflowDefinitionMapper approvalWorkflowDefinitionMapper;
21 21
 
22 22
     /**
23 23
      * 查询审批流程定义
24
-     * 
24
+     *
25 25
      * @param id 审批流程定义主键
26 26
      * @return 审批流程定义
27 27
      */
28 28
     @Override
29
-    public ApprovalWorkflowDefinition selectApprovalWorkflowDefinitionById(Long id)
30
-    {
29
+    public ApprovalWorkflowDefinition selectApprovalWorkflowDefinitionById(Long id) {
31 30
         return approvalWorkflowDefinitionMapper.selectApprovalWorkflowDefinitionById(id);
32 31
     }
33 32
 
34 33
     /**
35 34
      * 根据流程代码查询审批流程定义
36
-     * 
35
+     *
37 36
      * @param workflowCode 流程代码
38 37
      * @return 审批流程定义
39 38
      */
40 39
     @Override
41
-    public ApprovalWorkflowDefinition selectApprovalWorkflowDefinitionByCode(String workflowCode)
42
-    {
40
+    public ApprovalWorkflowDefinition selectApprovalWorkflowDefinitionByCode(String workflowCode) {
43 41
         return approvalWorkflowDefinitionMapper.selectApprovalWorkflowDefinitionByCode(workflowCode);
44 42
     }
45 43
 
46 44
     /**
47 45
      * 根据流程类型查询审批流程定义列表
48
-     * 
46
+     *
49 47
      * @param workflowType 流程类型
50 48
      * @return 审批流程定义列表
51 49
      */
52 50
     @Override
53
-    public List<ApprovalWorkflowDefinition> selectApprovalWorkflowDefinitionByType(String workflowType)
54
-    {
51
+    public List<ApprovalWorkflowDefinition> selectApprovalWorkflowDefinitionByType(String workflowType) {
55 52
         return approvalWorkflowDefinitionMapper.selectApprovalWorkflowDefinitionByType(workflowType);
56 53
     }
57 54
 
58 55
     /**
59 56
      * 查询审批流程定义列表
60
-     * 
57
+     *
61 58
      * @param approvalWorkflowDefinition 审批流程定义
62 59
      * @return 审批流程定义
63 60
      */
64 61
     @Override
65
-    public List<ApprovalWorkflowDefinition> selectApprovalWorkflowDefinitionList(ApprovalWorkflowDefinition approvalWorkflowDefinition)
66
-    {
62
+    public List<ApprovalWorkflowDefinition> selectApprovalWorkflowDefinitionList(ApprovalWorkflowDefinition approvalWorkflowDefinition) {
67 63
         return approvalWorkflowDefinitionMapper.selectApprovalWorkflowDefinitionList(approvalWorkflowDefinition);
68 64
     }
69 65
 
70 66
     /**
71 67
      * 新增审批流程定义
72
-     * 
68
+     *
73 69
      * @param approvalWorkflowDefinition 审批流程定义
74 70
      * @return 结果
75 71
      */
76 72
     @Override
77
-    public int insertApprovalWorkflowDefinition(ApprovalWorkflowDefinition approvalWorkflowDefinition)
78
-    {
73
+    public int insertApprovalWorkflowDefinition(ApprovalWorkflowDefinition approvalWorkflowDefinition) {
79 74
         return approvalWorkflowDefinitionMapper.insertApprovalWorkflowDefinition(approvalWorkflowDefinition);
80 75
     }
81 76
 
82 77
     /**
83 78
      * 修改审批流程定义
84
-     * 
79
+     *
85 80
      * @param approvalWorkflowDefinition 审批流程定义
86 81
      * @return 结果
87 82
      */
88 83
     @Override
89
-    public int updateApprovalWorkflowDefinition(ApprovalWorkflowDefinition approvalWorkflowDefinition)
90
-    {
84
+    public int updateApprovalWorkflowDefinition(ApprovalWorkflowDefinition approvalWorkflowDefinition) {
91 85
         return approvalWorkflowDefinitionMapper.updateApprovalWorkflowDefinition(approvalWorkflowDefinition);
92 86
     }
93 87
 
94 88
     /**
95 89
      * 批量删除审批流程定义
96
-     * 
90
+     *
97 91
      * @param ids 需要删除的审批流程定义主键
98 92
      * @return 结果
99 93
      */
100 94
     @Override
101
-    public int deleteApprovalWorkflowDefinitionByIds(Long[] ids)
102
-    {
95
+    public int deleteApprovalWorkflowDefinitionByIds(Long[] ids) {
103 96
         return approvalWorkflowDefinitionMapper.deleteApprovalWorkflowDefinitionByIds(ids);
104 97
     }
105 98
 
106 99
     /**
107 100
      * 删除审批流程定义信息
108
-     * 
101
+     *
109 102
      * @param id 审批流程定义主键
110 103
      * @return 结果
111 104
      */
112 105
     @Override
113
-    public int deleteApprovalWorkflowDefinitionById(Long id)
114
-    {
106
+    public int deleteApprovalWorkflowDefinitionById(Long id) {
115 107
         return approvalWorkflowDefinitionMapper.deleteApprovalWorkflowDefinitionById(id);
116 108
     }
117 109
 }

+ 117 - 117
airport-system/src/main/java/com/sundot/airport/system/service/approval/impl/CheckApprovalServiceImpl.java

@@ -25,40 +25,40 @@ import java.util.Map;
25 25
 
26 26
 /**
27 27
  * 审批检查服务实现类
28
- * 
28
+ *
29 29
  * @author Simon Lin
30 30
  */
31 31
 @Service
32 32
 public class CheckApprovalServiceImpl implements ICheckApprovalService {
33
-    
33
+
34 34
     private static final Logger logger = LoggerFactory.getLogger(CheckApprovalServiceImpl.class);
35
-    
35
+
36 36
     @Autowired
37 37
     private IApprovalEngineService approvalEngineService;
38
-    
38
+
39 39
     @Autowired
40 40
     private ApprovalTaskMapper approvalTaskMapper;
41
-    
41
+
42 42
     @Autowired
43 43
     private ApprovalCcMapper approvalCcMapper;
44
-    
44
+
45 45
     @Autowired
46 46
     private ApprovalHistoryMapper approvalHistoryMapper;
47
-    
47
+
48 48
     @Autowired
49 49
     private ApprovalInstanceMapper approvalInstanceMapper;
50
-    
50
+
51 51
     @Override
52 52
     public ApprovalInstance submitPersonalCheck(Map<String, Object> requestData, Long userId, String username, String remark) throws Exception {
53 53
         // 提取系统控制参数
54 54
         String checkType = (String) requestData.get("checkType");
55 55
         String location = (String) requestData.get("location");
56
-        
56
+
57 57
         // 新的参数:问题人ID和审批科长ID
58 58
         Object problemUserIdObj = requestData.get("problemUserId");
59 59
         Object sectionLeaderIdObj = requestData.get("sectionLeaderId");
60 60
         Object businessIdObj = requestData.get("businessId");
61
-        
61
+
62 62
         if (businessIdObj == null) {
63 63
             throw new Exception("businessId参数不能为空");
64 64
         }
@@ -76,27 +76,27 @@ public class CheckApprovalServiceImpl implements ICheckApprovalService {
76 76
         } else if (businessIdObj instanceof String) {
77 77
             businessId = Long.parseLong((String) businessIdObj);
78 78
         }
79
-        
79
+
80 80
         Long problemUserId = null;
81 81
         if (problemUserIdObj instanceof Number) {
82 82
             problemUserId = ((Number) problemUserIdObj).longValue();
83 83
         } else if (problemUserIdObj instanceof String) {
84 84
             problemUserId = Long.parseLong((String) problemUserIdObj);
85 85
         }
86
-        
86
+
87 87
         Long sectionLeaderId = null;
88 88
         if (sectionLeaderIdObj instanceof Number) {
89 89
             sectionLeaderId = ((Number) sectionLeaderIdObj).longValue();
90 90
         } else if (sectionLeaderIdObj instanceof String) {
91 91
             sectionLeaderId = Long.parseLong((String) sectionLeaderIdObj);
92 92
         }
93
-        
93
+
94 94
         // 提取用户表单数据
95 95
         Map<String, Object> userFormData = (Map<String, Object>) requestData.get("formData");
96 96
         if (userFormData == null) {
97 97
             userFormData = new HashMap<>();
98 98
         }
99
-        
99
+
100 100
         Map<String, Object> params = new HashMap<>();
101 101
         params.put("businessType", "PERSONAL_CHECK");
102 102
         params.put("businessId", businessId);
@@ -105,11 +105,11 @@ public class CheckApprovalServiceImpl implements ICheckApprovalService {
105 105
         params.put("location", location);
106 106
         params.put("problemUserId", problemUserId);
107 107
         params.put("sectionLeaderId", sectionLeaderId);
108
-        
108
+
109 109
         // 组装最终的表单数据(保留用户填写的所有字段)
110 110
         Map<String, Object> formData = new HashMap<>(userFormData);
111 111
         params.put("formData", formData);
112
-        
112
+
113 113
         // 业务数据(用于系统控制)
114 114
         Map<String, Object> businessData = new HashMap<>();
115 115
         businessData.put("checkType", checkType);
@@ -118,19 +118,19 @@ public class CheckApprovalServiceImpl implements ICheckApprovalService {
118 118
         businessData.put("sectionLeaderId", sectionLeaderId);
119 119
         businessData.put("initiatorId", userId); // 发起人ID,用于最后的审批环节
120 120
         params.put("businessData", businessData);
121
-        
121
+
122 122
         return approvalEngineService.startPersonalLevelProcess(
123
-            (String) params.get("businessType"),
124
-            (Long) params.get("businessId"),
125
-            (String) params.get("title"),
126
-            userId,
127
-            username,
128
-            sectionLeaderId, // 第一个审批节点分配给科长
129
-            formData,
130
-            businessData
123
+                (String) params.get("businessType"),
124
+                (Long) params.get("businessId"),
125
+                (String) params.get("title"),
126
+                userId,
127
+                username,
128
+                sectionLeaderId, // 第一个审批节点分配给科长
129
+                formData,
130
+                businessData
131 131
         );
132 132
     }
133
-    
133
+
134 134
     @Override
135 135
     public ApprovalInstance submitSectionCheck(Map<String, Object> requestData, Long userId, String username, String remark) throws Exception {
136 136
         // 提取系统控制参数
@@ -139,24 +139,24 @@ public class CheckApprovalServiceImpl implements ICheckApprovalService {
139 139
         Object targetDeptIdObj = requestData.get("targetDeptId");
140 140
         Object sectionLeaderIdObj = requestData.get("sectionLeaderId");
141 141
         Object businessIdObj = requestData.get("businessId");
142
-        
142
+
143 143
         if (businessIdObj == null) {
144 144
             throw new Exception("businessId参数不能为空");
145 145
         }
146
-        
146
+
147 147
         Long businessId = null;
148 148
         if (businessIdObj instanceof Number) {
149 149
             businessId = ((Number) businessIdObj).longValue();
150 150
         } else if (businessIdObj instanceof String) {
151 151
             businessId = Long.parseLong((String) businessIdObj);
152 152
         }
153
-        
153
+
154 154
         // 提取用户表单数据
155 155
         Map<String, Object> userFormData = (Map<String, Object>) requestData.get("formData");
156 156
         if (userFormData == null) {
157 157
             userFormData = new HashMap<>();
158 158
         }
159
-        
159
+
160 160
         Long targetDeptId = null;
161 161
         if (targetDeptIdObj != null) {
162 162
             if (targetDeptIdObj instanceof Number) {
@@ -165,7 +165,7 @@ public class CheckApprovalServiceImpl implements ICheckApprovalService {
165 165
                 targetDeptId = Long.parseLong((String) targetDeptIdObj);
166 166
             }
167 167
         }
168
-        
168
+
169 169
         Long sectionLeaderId = null;
170 170
         if (sectionLeaderIdObj != null) {
171 171
             if (sectionLeaderIdObj instanceof Number) {
@@ -174,14 +174,14 @@ public class CheckApprovalServiceImpl implements ICheckApprovalService {
174 174
                 sectionLeaderId = Long.parseLong((String) sectionLeaderIdObj);
175 175
             }
176 176
         }
177
-        
177
+
178 178
         if (sectionLeaderId == null) {
179 179
             throw new Exception("sectionLeaderId参数不能为空");
180 180
         }
181
-        
181
+
182 182
         // 生成业务ID
183 183
         //Long businessId = System.currentTimeMillis();
184
-        
184
+
185 185
         Map<String, Object> params = new HashMap<>();
186 186
         params.put("businessType", "SECTION_CHECK");
187 187
         params.put("businessId", businessId);
@@ -189,11 +189,11 @@ public class CheckApprovalServiceImpl implements ICheckApprovalService {
189 189
         params.put("checkType", checkType);
190 190
         params.put("severity", severity);
191 191
         params.put("targetDeptId", targetDeptId);
192
-        
192
+
193 193
         // 组装最终的表单数据
194 194
         Map<String, Object> formData = new HashMap<>(userFormData);
195 195
         params.put("formData", formData);
196
-        
196
+
197 197
         // 业务数据
198 198
         Map<String, Object> businessData = new HashMap<>();
199 199
         businessData.put("checkType", checkType);
@@ -203,19 +203,19 @@ public class CheckApprovalServiceImpl implements ICheckApprovalService {
203 203
         }
204 204
         businessData.put("sectionLeaderId", sectionLeaderId);
205 205
         params.put("businessData", businessData);
206
-        
206
+
207 207
         return approvalEngineService.startSectionLevelProcess(
208
-            (String) params.get("businessType"),
209
-            (Long) params.get("businessId"),
210
-            (String) params.get("title"),
211
-            userId,
212
-            username,
213
-            sectionLeaderId,
214
-            formData,
215
-            businessData
208
+                (String) params.get("businessType"),
209
+                (Long) params.get("businessId"),
210
+                (String) params.get("title"),
211
+                userId,
212
+                username,
213
+                sectionLeaderId,
214
+                formData,
215
+                businessData
216 216
         );
217 217
     }
218
-    
218
+
219 219
     @Override
220 220
     public ApprovalInstance submitGroupCheck(Map<String, Object> requestData, Long userId, String username, String remark) throws Exception {
221 221
         // 提取系统控制参数
@@ -223,24 +223,24 @@ public class CheckApprovalServiceImpl implements ICheckApprovalService {
223 223
         String severity = (String) requestData.get("severity");
224 224
         Object groupLeaderIdObj = requestData.get("groupLeaderId");
225 225
         Object businessIdObj = requestData.get("businessId");
226
-        
226
+
227 227
         if (businessIdObj == null) {
228 228
             throw new Exception("businessId参数不能为空");
229 229
         }
230
-        
230
+
231 231
         Long businessId = null;
232 232
         if (businessIdObj instanceof Number) {
233 233
             businessId = ((Number) businessIdObj).longValue();
234 234
         } else if (businessIdObj instanceof String) {
235 235
             businessId = Long.parseLong((String) businessIdObj);
236 236
         }
237
-        
237
+
238 238
         // 提取用户表单数据
239 239
         Map<String, Object> userFormData = (Map<String, Object>) requestData.get("formData");
240 240
         if (userFormData == null) {
241 241
             userFormData = new HashMap<>();
242 242
         }
243
-        
243
+
244 244
         Long groupLeaderId = null;
245 245
         if (groupLeaderIdObj != null) {
246 246
             if (groupLeaderIdObj instanceof Number) {
@@ -249,14 +249,14 @@ public class CheckApprovalServiceImpl implements ICheckApprovalService {
249 249
                 groupLeaderId = Long.parseLong((String) groupLeaderIdObj);
250 250
             }
251 251
         }
252
-        
252
+
253 253
         if (groupLeaderId == null) {
254 254
             throw new Exception("groupLeaderId参数不能为空");
255 255
         }
256
-        
256
+
257 257
         // 生成业务ID
258 258
         //Long businessId = System.currentTimeMillis();
259
-        
259
+
260 260
         Map<String, Object> params = new HashMap<>();
261 261
         params.put("businessType", "GROUP_CHECK");
262 262
         params.put("businessId", businessId);
@@ -264,29 +264,29 @@ public class CheckApprovalServiceImpl implements ICheckApprovalService {
264 264
         params.put("checkType", checkType);
265 265
         params.put("severity", severity);
266 266
         params.put("groupLeaderId", groupLeaderId);
267
-        
267
+
268 268
         // 组装表单数据
269 269
         Map<String, Object> formData = new HashMap<>(userFormData);
270 270
         params.put("formData", formData);
271
-        
271
+
272 272
         // 业务数据
273 273
         Map<String, Object> businessData = new HashMap<>();
274 274
         businessData.put("checkType", checkType);
275 275
         businessData.put("severity", severity);
276 276
         businessData.put("groupLeaderId", groupLeaderId);
277 277
         params.put("businessData", businessData);
278
-        
278
+
279 279
         return approvalEngineService.startGroupLevelProcess(
280
-            (String) params.get("businessType"),
281
-            (Long) params.get("businessId"),
282
-            (String) params.get("title"),
283
-            userId,
284
-            username,
285
-            formData,
286
-            businessData
280
+                (String) params.get("businessType"),
281
+                (Long) params.get("businessId"),
282
+                (String) params.get("title"),
283
+                userId,
284
+                username,
285
+                formData,
286
+                businessData
287 287
         );
288 288
     }
289
-    
289
+
290 290
     @Override
291 291
     public ApprovalInstance submitSeizureReport(Map<String, Object> requestData, Long userId, String username, String remark) throws Exception {
292 292
         // 提取系统控制参数
@@ -294,24 +294,24 @@ public class CheckApprovalServiceImpl implements ICheckApprovalService {
294 294
         String passengerInfo = (String) requestData.get("passengerInfo");
295 295
         String submitterRole = (String) requestData.get("submitterRole");
296 296
         Object businessIdObj = requestData.get("businessId");
297
-        
297
+
298 298
         if (businessIdObj == null) {
299 299
             throw new Exception("businessId参数不能为空");
300 300
         }
301
-        
301
+
302 302
         Long businessId = null;
303 303
         if (businessIdObj instanceof Number) {
304 304
             businessId = ((Number) businessIdObj).longValue();
305 305
         } else if (businessIdObj instanceof String) {
306 306
             businessId = Long.parseLong((String) businessIdObj);
307 307
         }
308
-        
308
+
309 309
         // 提取用户表单数据
310 310
         Map<String, Object> userFormData = (Map<String, Object>) requestData.get("formData");
311 311
         if (userFormData == null) {
312 312
             userFormData = new HashMap<>();
313 313
         }
314
-        
314
+
315 315
         // 处理查获时间
316 316
         Date seizureTime = null;
317 317
         if (seizureTimeObj != null) {
@@ -326,20 +326,20 @@ public class CheckApprovalServiceImpl implements ICheckApprovalService {
326 326
                 }
327 327
             }
328 328
         }
329
-        
329
+
330 330
         // 生成业务ID
331 331
         //Long businessId = System.currentTimeMillis();
332
-        
332
+
333 333
         Map<String, Object> params = new HashMap<>();
334 334
         params.put("businessType", "SEIZURE_REPORT");
335 335
         params.put("businessId", businessId);
336 336
         params.put("title", "查获物品上报");
337 337
         params.put("submitterRole", submitterRole);
338
-        
338
+
339 339
         // 组装表单数据
340 340
         Map<String, Object> formData = new HashMap<>(userFormData);
341 341
         params.put("formData", formData);
342
-        
342
+
343 343
         // 业务数据
344 344
         Map<String, Object> businessData = new HashMap<>();
345 345
         if (seizureTime != null) {
@@ -349,28 +349,28 @@ public class CheckApprovalServiceImpl implements ICheckApprovalService {
349 349
             businessData.put("passengerInfo", passengerInfo);
350 350
         }
351 351
         params.put("businessData", businessData);
352
-        
352
+
353 353
         return approvalEngineService.startSeizureReportProcess(
354
-            (String) params.get("businessType"),
355
-            (Long) params.get("businessId"),
356
-            (String) params.get("title"),
357
-            userId,
358
-            username,
359
-            submitterRole,
360
-            formData,
361
-            businessData
354
+                (String) params.get("businessType"),
355
+                (Long) params.get("businessId"),
356
+                (String) params.get("title"),
357
+                userId,
358
+                username,
359
+                submitterRole,
360
+                formData,
361
+                businessData
362 362
         );
363 363
     }
364
-    
364
+
365 365
     @Override
366 366
     public ApprovalTask approveTask(Long taskId, String comment, Map<String, Object> formData, Long userId, String username) throws Exception {
367 367
         if (formData == null) {
368 368
             formData = new HashMap<>();
369 369
         }
370
-        
370
+
371 371
         Map<String, Object> params = new HashMap<>();
372 372
         params.put("comment", comment);
373
-        
373
+
374 374
         boolean success = approvalEngineService.approveTask(taskId, userId, username, comment, formData);
375 375
         if (success) {
376 376
             // 获取更新后的任务信息
@@ -379,7 +379,7 @@ public class CheckApprovalServiceImpl implements ICheckApprovalService {
379 379
             throw new Exception("审批任务失败");
380 380
         }
381 381
     }
382
-    
382
+
383 383
     @Override
384 384
     public ApprovalTask rejectTask(Long taskId, String comment, Long userId, String username) throws Exception {
385 385
         boolean success = approvalEngineService.rejectTask(taskId, userId, username, comment);
@@ -390,47 +390,47 @@ public class CheckApprovalServiceImpl implements ICheckApprovalService {
390 390
             throw new Exception("驳回任务失败");
391 391
         }
392 392
     }
393
-    
393
+
394 394
     @Override
395 395
     public List<ApprovalTask> getPendingTasks(Long userId) throws Exception {
396 396
         return approvalEngineService.getUserPendingTasks(userId);
397 397
     }
398
-    
398
+
399 399
     @Override
400 400
     public List<ApprovalTask> getCompletedTasks(Long userId) throws Exception {
401 401
         return approvalEngineService.getUserCompletedTasks(userId);
402 402
     }
403
-    
403
+
404 404
     @Override
405 405
     public List<ApprovalInstance> getSubmittedInstances(Long userId, String status) throws Exception {
406 406
         return approvalEngineService.getUserSubmittedInstances(userId, status);
407 407
     }
408
-    
408
+
409 409
     @Override
410 410
     public Long getPendingTaskCount(Long userId) throws Exception {
411 411
         List<ApprovalTask> tasks = approvalEngineService.getUserPendingTasks(userId);
412 412
         return (long) tasks.size();
413 413
     }
414
-    
414
+
415 415
     @Override
416 416
     public List<com.sundot.airport.system.domain.approval.dto.ApprovalCcDetailDTO> getCcDetailsByUserId(Long userId) throws Exception {
417 417
         // 1. 获取用户抄送记录(关联实例信息) - 这个查询会被PageHelper拦截进行分页
418 418
         List<ApprovalCc> ccList = approvalCcMapper.selectCcDetailsByUserId(userId);
419
-        
419
+
420 420
         // 2. 转换为DTO并获取历史记录
421 421
         List<com.sundot.airport.system.domain.approval.dto.ApprovalCcDetailDTO> resultList = new ArrayList<>();
422
-        
422
+
423 423
         for (ApprovalCc cc : ccList) {
424
-            com.sundot.airport.system.domain.approval.dto.ApprovalCcDetailDTO dto = 
425
-                new com.sundot.airport.system.domain.approval.dto.ApprovalCcDetailDTO();
426
-            
424
+            com.sundot.airport.system.domain.approval.dto.ApprovalCcDetailDTO dto =
425
+                    new com.sundot.airport.system.domain.approval.dto.ApprovalCcDetailDTO();
426
+
427 427
             // 设置抄送信息
428 428
             dto.setCcId(cc.getId());
429 429
             dto.setInstanceId(cc.getInstanceId());
430 430
             dto.setCcTime(cc.getCcTime());
431 431
             dto.setIsRead(cc.getIsRead());
432 432
             dto.setReadTime(cc.getReadTime());
433
-            
433
+
434 434
             // 设置实例信息
435 435
             if (cc.getInstance() != null) {
436 436
                 dto.setTitle(cc.getInstance().getTitle());
@@ -439,47 +439,47 @@ public class CheckApprovalServiceImpl implements ICheckApprovalService {
439 439
                 dto.setBusinessType(cc.getInstance().getBusinessType());
440 440
                 dto.setFormData(cc.getInstance().getFormData());
441 441
             }
442
-            
442
+
443 443
             // 获取历史记录
444 444
             List<ApprovalHistory> historyList = approvalHistoryMapper.selectApprovalHistoryByInstanceId(cc.getInstanceId());
445
-            List<com.sundot.airport.system.domain.approval.dto.ApprovalCcDetailDTO.ApprovalHistoryDetailDTO> historyDetailList = 
446
-                new ArrayList<>();
447
-            
445
+            List<com.sundot.airport.system.domain.approval.dto.ApprovalCcDetailDTO.ApprovalHistoryDetailDTO> historyDetailList =
446
+                    new ArrayList<>();
447
+
448 448
             for (ApprovalHistory history : historyList) {
449
-                com.sundot.airport.system.domain.approval.dto.ApprovalCcDetailDTO.ApprovalHistoryDetailDTO historyDto = 
450
-                    new com.sundot.airport.system.domain.approval.dto.ApprovalCcDetailDTO.ApprovalHistoryDetailDTO();
451
-                
449
+                com.sundot.airport.system.domain.approval.dto.ApprovalCcDetailDTO.ApprovalHistoryDetailDTO historyDto =
450
+                        new com.sundot.airport.system.domain.approval.dto.ApprovalCcDetailDTO.ApprovalHistoryDetailDTO();
451
+
452 452
                 historyDto.setNodeName(history.getNodeName());
453 453
                 historyDto.setOperatorName(history.getOperatorName());
454 454
                 historyDto.setOperationTime(history.getOperationTime());
455 455
                 historyDto.setComment(history.getComment());
456
-                
456
+
457 457
                 historyDetailList.add(historyDto);
458 458
             }
459
-            
459
+
460 460
             dto.setHistoryList(historyDetailList);
461 461
             resultList.add(dto);
462 462
         }
463
-        
463
+
464 464
         // 3. 创建一个新的具有分页信息的列表,用于让PageInfo获取正确的分页信息
465 465
         // 我们需要将ccList的分页信息传递给resultList
466 466
         if (ccList instanceof com.github.pagehelper.Page) {
467 467
             com.github.pagehelper.Page<ApprovalCc> pagedCcList = (com.github.pagehelper.Page<ApprovalCc>) ccList;
468
-            com.github.pagehelper.Page<com.sundot.airport.system.domain.approval.dto.ApprovalCcDetailDTO> pagedResultList = 
469
-                new com.github.pagehelper.Page<>(pagedCcList.getPageNum(), pagedCcList.getPageSize());
468
+            com.github.pagehelper.Page<com.sundot.airport.system.domain.approval.dto.ApprovalCcDetailDTO> pagedResultList =
469
+                    new com.github.pagehelper.Page<>(pagedCcList.getPageNum(), pagedCcList.getPageSize());
470 470
             pagedResultList.setTotal(pagedCcList.getTotal());
471 471
             pagedResultList.addAll(resultList);
472 472
             return pagedResultList;
473 473
         }
474
-        
474
+
475 475
         return resultList;
476 476
     }
477
-    
477
+
478 478
     @Override
479 479
     public List<ApprovalHistory> getApprovalHistoryByInstanceId(Long instanceId) throws Exception {
480 480
         try {
481 481
             List<ApprovalHistory> historyList = approvalHistoryMapper.selectApprovalHistoryByInstanceId(instanceId);
482
-            
482
+
483 483
             // 检查审批实例是否完成
484 484
             ApprovalInstance instance = approvalInstanceMapper.selectApprovalInstanceById(instanceId);
485 485
             if (instance != null && !"COMPLETED".equals(instance.getStatus()) && !"REJECTED".equals(instance.getStatus()) && !"CANCELLED".equals(instance.getStatus())) {
@@ -488,7 +488,7 @@ public class CheckApprovalServiceImpl implements ICheckApprovalService {
488 488
                 pendingTask.setInstanceId(instanceId);
489 489
                 pendingTask.setStatus("PENDING");
490 490
                 List<ApprovalTask> pendingTasks = approvalTaskMapper.selectApprovalTaskList(pendingTask);
491
-                
491
+
492 492
                 if (!pendingTasks.isEmpty()) {
493 493
                     // 将待办任务转换为审批历史记录格式并添加到列表末尾
494 494
                     ApprovalTask task = pendingTasks.get(0); // 通常只有一个当前待办任务
@@ -503,17 +503,17 @@ public class CheckApprovalServiceImpl implements ICheckApprovalService {
503 503
                     pendingHistory.setOperationTime(task.getAssignTime());
504 504
                     pendingHistory.setComment("待处理");
505 505
                     pendingHistory.setFormData(task.getFormData());
506
-                    
506
+
507 507
                     historyList.add(pendingHistory);
508 508
                 }
509 509
             }
510
-            
510
+
511 511
             return historyList;
512 512
         } catch (Exception e) {
513 513
             throw new Exception("根据实例ID查询审批历史失败:" + e.getMessage(), e);
514 514
         }
515 515
     }
516
-    
516
+
517 517
     @Override
518 518
     public List<ApprovalHistory> getApprovalHistoryByTaskId(Long taskId) throws Exception {
519 519
         try {
@@ -522,7 +522,7 @@ public class CheckApprovalServiceImpl implements ICheckApprovalService {
522 522
             throw new Exception("根据任务ID查询审批历史失败:" + e.getMessage(), e);
523 523
         }
524 524
     }
525
-    
525
+
526 526
     @Override
527 527
     public List<ApprovalHistory> getUserApprovalHistory(Long userId, String action) throws Exception {
528 528
         try {
@@ -531,7 +531,7 @@ public class CheckApprovalServiceImpl implements ICheckApprovalService {
531 531
             throw new Exception("查询用户审批历史失败:" + e.getMessage(), e);
532 532
         }
533 533
     }
534
-    
534
+
535 535
     @Override
536 536
     public int batchUpdateCcReadStatus(List<Long> ids) throws Exception {
537 537
         try {

+ 102 - 73
airport-system/src/main/resources/mapper/approval/ApprovalCcMapper.xml

@@ -1,95 +1,108 @@
1 1
 <?xml version="1.0" encoding="UTF-8" ?>
2 2
 <!DOCTYPE mapper
3
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 5
 <mapper namespace="com.sundot.airport.system.mapper.approval.ApprovalCcMapper">
6
-    
6
+
7 7
     <resultMap type="ApprovalCc" id="ApprovalCcResult">
8
-        <id     property="id"           column="id"             />
9
-        <result property="instanceId"   column="instance_id"    />
10
-        <result property="ccUserId"     column="cc_user_id"     />
11
-        <result property="ccUserName"   column="cc_user_name"   />
12
-        <result property="ccTime"       column="cc_time"        />
13
-        <result property="isRead"       column="is_read"        />
14
-        <result property="readTime"     column="read_time"      />
15
-        <result property="createBy"     column="create_by"      />
16
-        <result property="createTime"   column="create_time"    />
17
-        <result property="remark"       column="remark"         />
8
+        <id property="id" column="id"/>
9
+        <result property="instanceId" column="instance_id"/>
10
+        <result property="ccUserId" column="cc_user_id"/>
11
+        <result property="ccUserName" column="cc_user_name"/>
12
+        <result property="ccTime" column="cc_time"/>
13
+        <result property="isRead" column="is_read"/>
14
+        <result property="readTime" column="read_time"/>
15
+        <result property="createBy" column="create_by"/>
16
+        <result property="createTime" column="create_time"/>
17
+        <result property="remark" column="remark"/>
18 18
     </resultMap>
19
-    
19
+
20 20
     <resultMap id="InstanceResult" type="ApprovalInstance">
21
-        <id     property="id"               column="instance_id"        />
22
-        <result property="instanceNo"       column="instance_no"        />
23
-        <result property="title"            column="title"              />
24
-        <result property="businessType"     column="business_type"      />
25
-        <result property="status"           column="status"             />
26
-        <result property="submitTime"       column="submit_time"        />
27
-        <result property="completionTime"   column="completion_time"    />
21
+        <id property="id" column="instance_id"/>
22
+        <result property="instanceNo" column="instance_no"/>
23
+        <result property="title" column="title"/>
24
+        <result property="businessType" column="business_type"/>
25
+        <result property="status" column="status"/>
26
+        <result property="submitTime" column="submit_time"/>
27
+        <result property="completionTime" column="completion_time"/>
28 28
     </resultMap>
29 29
 
30 30
     <resultMap id="ApprovalCcWithInstanceResult" type="ApprovalCc">
31
-        <id     property="id"           column="id"             />
32
-        <result property="instanceId"   column="instance_id"    />
33
-        <result property="ccUserId"     column="cc_user_id"     />
34
-        <result property="ccUserName"   column="cc_user_name"   />
35
-        <result property="ccTime"       column="cc_time"        />
36
-        <result property="isRead"       column="is_read"        />
37
-        <result property="readTime"     column="read_time"      />
38
-        <result property="createBy"     column="create_by"      />
39
-        <result property="createTime"   column="create_time"    />
40
-        <result property="remark"       column="remark"         />
31
+        <id property="id" column="id"/>
32
+        <result property="instanceId" column="instance_id"/>
33
+        <result property="ccUserId" column="cc_user_id"/>
34
+        <result property="ccUserName" column="cc_user_name"/>
35
+        <result property="ccTime" column="cc_time"/>
36
+        <result property="isRead" column="is_read"/>
37
+        <result property="readTime" column="read_time"/>
38
+        <result property="createBy" column="create_by"/>
39
+        <result property="createTime" column="create_time"/>
40
+        <result property="remark" column="remark"/>
41 41
         <association property="instance" javaType="ApprovalInstance">
42
-            <id     property="id"               column="ai_id"              />
43
-            <result property="instanceNo"       column="ai_instance_no"     />
44
-            <result property="title"            column="ai_title"           />
45
-            <result property="businessId"       column="ai_business_id"     />
46
-            <result property="businessType"     column="ai_business_type"   />
47
-            <result property="status"           column="ai_status"          />
48
-            <result property="submitTime"       column="ai_submit_time"     />
49
-            <result property="completionTime"   column="ai_completion_time" />
50
-            <result property="formData"         column="ai_form_data"       />
42
+            <id property="id" column="ai_id"/>
43
+            <result property="instanceNo" column="ai_instance_no"/>
44
+            <result property="title" column="ai_title"/>
45
+            <result property="businessId" column="ai_business_id"/>
46
+            <result property="businessType" column="ai_business_type"/>
47
+            <result property="status" column="ai_status"/>
48
+            <result property="submitTime" column="ai_submit_time"/>
49
+            <result property="completionTime" column="ai_completion_time"/>
50
+            <result property="formData" column="ai_form_data"/>
51 51
         </association>
52 52
     </resultMap>
53 53
 
54 54
     <sql id="selectApprovalCcVo">
55
-        select id, instance_id, cc_user_id, cc_user_name, cc_time, is_read, read_time, create_by, create_time, remark from approval_cc
55
+        select id,
56
+               instance_id,
57
+               cc_user_id,
58
+               cc_user_name,
59
+               cc_time,
60
+               is_read,
61
+               read_time,
62
+               create_by,
63
+               create_time,
64
+               remark
65
+        from approval_cc
56 66
     </sql>
57 67
 
58 68
     <select id="selectApprovalCcList" parameterType="ApprovalCc" resultMap="ApprovalCcResult">
59 69
         <include refid="selectApprovalCcVo"/>
60
-        <where>  
61
-            <if test="instanceId != null "> and instance_id = #{instanceId}</if>
62
-            <if test="ccUserId != null "> and cc_user_id = #{ccUserId}</if>
63
-            <if test="ccUserName != null  and ccUserName != ''"> and cc_user_name like concat('%', #{ccUserName}, '%')</if>
64
-            <if test="isRead != null  and isRead != ''"> and is_read = #{isRead}</if>
65
-            <if test="params.beginCcTime != null and params.beginCcTime != '' and params.endCcTime != null and params.endCcTime != ''"> and cc_time between #{params.beginCcTime} and #{params.endCcTime}</if>
70
+        <where>
71
+            <if test="instanceId != null ">and instance_id = #{instanceId}</if>
72
+            <if test="ccUserId != null ">and cc_user_id = #{ccUserId}</if>
73
+            <if test="ccUserName != null  and ccUserName != ''">and cc_user_name like concat('%', #{ccUserName}, '%')
74
+            </if>
75
+            <if test="isRead != null  and isRead != ''">and is_read = #{isRead}</if>
76
+            <if test="params.beginCcTime != null and params.beginCcTime != '' and params.endCcTime != null and params.endCcTime != ''">
77
+                and cc_time between #{params.beginCcTime} and #{params.endCcTime}
78
+            </if>
66 79
         </where>
67 80
     </select>
68
-    
81
+
69 82
     <select id="selectApprovalCcById" parameterType="Long" resultMap="ApprovalCcResult">
70 83
         <include refid="selectApprovalCcVo"/>
71 84
         where id = #{id}
72 85
     </select>
73
-    
86
+
74 87
     <select id="selectApprovalCcByInstanceId" parameterType="Long" resultMap="ApprovalCcResult">
75 88
         <include refid="selectApprovalCcVo"/>
76 89
         where instance_id = #{instanceId}
77 90
         order by cc_time desc
78 91
     </select>
79
-    
92
+
80 93
     <select id="selectApprovalCcByCcUser" resultMap="ApprovalCcResult">
81 94
         <include refid="selectApprovalCcVo"/>
82 95
         where cc_user_id = #{ccUserId}
83
-        <if test="isRead != null and isRead != ''"> and is_read = #{isRead}</if>
96
+        <if test="isRead != null and isRead != ''">and is_read = #{isRead}</if>
84 97
         order by cc_time desc
85 98
     </select>
86
-    
99
+
87 100
     <select id="countCcMessagesByCcUser" resultType="int">
88 101
         select count(*) from approval_cc
89 102
         where cc_user_id = #{ccUserId}
90
-        <if test="isRead != null and isRead != ''"> and is_read = #{isRead}</if>
103
+        <if test="isRead != null and isRead != ''">and is_read = #{isRead}</if>
91 104
     </select>
92
-        
105
+
93 106
     <insert id="insertApprovalCc" parameterType="ApprovalCc" useGeneratedKeys="true" keyProperty="id">
94 107
         insert into approval_cc
95 108
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -102,7 +115,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
102 115
             <if test="createBy != null">create_by,</if>
103 116
             <if test="createTime != null">create_time,</if>
104 117
             <if test="remark != null">remark,</if>
105
-         </trim>
118
+        </trim>
106 119
         <trim prefix="values (" suffix=")" suffixOverrides=",">
107 120
             <if test="instanceId != null">#{instanceId},</if>
108 121
             <if test="ccUserId != null">#{ccUserId},</if>
@@ -113,7 +126,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
113 126
             <if test="createBy != null">#{createBy},</if>
114 127
             <if test="createTime != null">#{createTime},</if>
115 128
             <if test="remark != null">#{remark},</if>
116
-         </trim>
129
+        </trim>
117 130
     </insert>
118 131
 
119 132
     <update id="updateApprovalCc" parameterType="ApprovalCc">
@@ -133,38 +146,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
133 146
     </update>
134 147
 
135 148
     <delete id="deleteApprovalCcById" parameterType="Long">
136
-        delete from approval_cc where id = #{id}
149
+        delete
150
+        from approval_cc
151
+        where id = #{id}
137 152
     </delete>
138 153
 
139 154
     <delete id="deleteApprovalCcByIds" parameterType="String">
140
-        delete from approval_cc where id in 
155
+        delete from approval_cc where id in
141 156
         <foreach item="id" collection="array" open="(" separator="," close=")">
142 157
             #{id}
143 158
         </foreach>
144 159
     </delete>
145
-    
160
+
146 161
     <delete id="deleteApprovalCcByInstanceId" parameterType="Long">
147
-        delete from approval_cc where instance_id = #{instanceId}
162
+        delete
163
+        from approval_cc
164
+        where instance_id = #{instanceId}
148 165
     </delete>
149
-    
166
+
150 167
     <select id="selectCcDetailsByUserId" parameterType="Long" resultMap="ApprovalCcWithInstanceResult">
151
-        select 
152
-            ac.id, ac.instance_id, ac.cc_user_id, ac.cc_user_name, ac.cc_time, 
153
-            ac.is_read, ac.read_time, ac.create_by, ac.create_time, ac.remark,
154
-            ai.id as ai_id, ai.instance_no as ai_instance_no, ai.title as ai_title,
155
-            ai.business_id as ai_business_id, ai.business_type as ai_business_type, 
156
-            ai.status as ai_status, ai.submit_time as ai_submit_time, ai.completion_time as ai_completion_time,
157
-            ai.form_data as ai_form_data
168
+        select ac.id,
169
+               ac.instance_id,
170
+               ac.cc_user_id,
171
+               ac.cc_user_name,
172
+               ac.cc_time,
173
+               ac.is_read,
174
+               ac.read_time,
175
+               ac.create_by,
176
+               ac.create_time,
177
+               ac.remark,
178
+               ai.id              as ai_id,
179
+               ai.instance_no     as ai_instance_no,
180
+               ai.title           as ai_title,
181
+               ai.business_id     as ai_business_id,
182
+               ai.business_type   as ai_business_type,
183
+               ai.status          as ai_status,
184
+               ai.submit_time     as ai_submit_time,
185
+               ai.completion_time as ai_completion_time,
186
+               ai.form_data       as ai_form_data
158 187
         from approval_cc ac
159
-        left join approval_instance ai on ac.instance_id = ai.id
188
+                 left join approval_instance ai on ac.instance_id = ai.id
160 189
         where ac.cc_user_id = #{ccUserId}
161 190
         order by ac.cc_time desc
162 191
     </select>
163
-    
192
+
164 193
     <update id="batchUpdateReadStatus" parameterType="list">
165
-        update approval_cc 
166
-        set is_read = '1', read_time = sysdate() 
167
-        where id in 
194
+        update approval_cc
195
+        set is_read = '1', read_time = sysdate()
196
+        where id in
168 197
         <foreach collection="list" item="id" open="(" separator="," close=")">
169 198
             #{id}
170 199
         </foreach>

+ 49 - 36
airport-system/src/main/resources/mapper/approval/ApprovalHistoryMapper.xml

@@ -1,47 +1,56 @@
1 1
 <?xml version="1.0" encoding="UTF-8" ?>
2 2
 <!DOCTYPE mapper
3
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 5
 <mapper namespace="com.sundot.airport.system.mapper.approval.ApprovalHistoryMapper">
6
-    
6
+
7 7
     <resultMap type="ApprovalHistory" id="ApprovalHistoryResult">
8
-        <result property="id"    column="id"    />
9
-        <result property="instanceId"    column="instance_id"    />
10
-        <result property="taskId"    column="task_id"    />
11
-        <result property="nodeId"    column="node_id"    />
12
-        <result property="nodeName"    column="node_name"    />
13
-        <result property="operatorId"    column="operator_id"    />
14
-        <result property="operatorName"    column="operator_name"    />
15
-        <result property="action"    column="action"    />
16
-        <result property="comment"    column="comment"    />
17
-        <result property="formData"    column="form_data"    />
18
-        <result property="operationTime"    column="operation_time"    />
19
-        <result property="createBy"    column="create_by"    />
20
-        <result property="createTime"    column="create_time"    />
21
-        <result property="remark"    column="remark"    />
8
+        <result property="id" column="id"/>
9
+        <result property="instanceId" column="instance_id"/>
10
+        <result property="taskId" column="task_id"/>
11
+        <result property="nodeId" column="node_id"/>
12
+        <result property="nodeName" column="node_name"/>
13
+        <result property="operatorId" column="operator_id"/>
14
+        <result property="operatorName" column="operator_name"/>
15
+        <result property="action" column="action"/>
16
+        <result property="comment" column="comment"/>
17
+        <result property="formData" column="form_data"/>
18
+        <result property="operationTime" column="operation_time"/>
19
+        <result property="createBy" column="create_by"/>
20
+        <result property="createTime" column="create_time"/>
21
+        <result property="remark" column="remark"/>
22 22
     </resultMap>
23 23
 
24 24
     <sql id="selectApprovalHistoryVo">
25
-        select id, instance_id, task_id, node_id, node_name, operator_id, operator_name, action, comment, form_data, operation_time, create_by, create_time, remark from approval_history
25
+        select id,
26
+               instance_id,
27
+               task_id,
28
+               node_id,
29
+               node_name,
30
+               operator_id,
31
+               operator_name, action, comment, form_data, operation_time, create_by, create_time, remark
32
+        from approval_history
26 33
     </sql>
27 34
 
28 35
     <select id="selectApprovalHistoryList" parameterType="ApprovalHistory" resultMap="ApprovalHistoryResult">
29 36
         <include refid="selectApprovalHistoryVo"/>
30
-        <where>  
31
-            <if test="instanceId != null "> and instance_id = #{instanceId}</if>
32
-            <if test="taskId != null "> and task_id = #{taskId}</if>
33
-            <if test="nodeId != null "> and node_id = #{nodeId}</if>
34
-            <if test="nodeName != null  and nodeName != ''"> and node_name like concat('%', #{nodeName}, '%')</if>
35
-            <if test="operatorId != null "> and operator_id = #{operatorId}</if>
36
-            <if test="operatorName != null  and operatorName != ''"> and operator_name like concat('%', #{operatorName}, '%')</if>
37
-            <if test="action != null  and action != ''"> and action = #{action}</if>
38
-            <if test="comment != null  and comment != ''"> and comment like concat('%', #{comment}, '%')</if>
39
-            <if test="formData != null  and formData != ''"> and form_data = #{formData}</if>
40
-            <if test="operationTime != null "> and operation_time = #{operationTime}</if>
37
+        <where>
38
+            <if test="instanceId != null ">and instance_id = #{instanceId}</if>
39
+            <if test="taskId != null ">and task_id = #{taskId}</if>
40
+            <if test="nodeId != null ">and node_id = #{nodeId}</if>
41
+            <if test="nodeName != null  and nodeName != ''">and node_name like concat('%', #{nodeName}, '%')</if>
42
+            <if test="operatorId != null ">and operator_id = #{operatorId}</if>
43
+            <if test="operatorName != null  and operatorName != ''">and operator_name like concat('%', #{operatorName},
44
+                '%')
45
+            </if>
46
+            <if test="action != null  and action != ''">and action = #{action}</if>
47
+            <if test="comment != null  and comment != ''">and comment like concat('%', #{comment}, '%')</if>
48
+            <if test="formData != null  and formData != ''">and form_data = #{formData}</if>
49
+            <if test="operationTime != null ">and operation_time = #{operationTime}</if>
41 50
         </where>
42 51
         order by id asc
43 52
     </select>
44
-    
53
+
45 54
     <select id="selectApprovalHistoryById" parameterType="Long" resultMap="ApprovalHistoryResult">
46 55
         <include refid="selectApprovalHistoryVo"/>
47 56
         where id = #{id}
@@ -67,7 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
67 76
         </if>
68 77
         order by id asc
69 78
     </select>
70
-        
79
+
71 80
     <insert id="insertApprovalHistory" parameterType="ApprovalHistory" useGeneratedKeys="true" keyProperty="id">
72 81
         insert into approval_history
73 82
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -84,7 +93,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
84 93
             <if test="createBy != null">create_by,</if>
85 94
             <if test="createTime != null">create_time,</if>
86 95
             <if test="remark != null">remark,</if>
87
-         </trim>
96
+        </trim>
88 97
         <trim prefix="values (" suffix=")" suffixOverrides=",">
89 98
             <if test="instanceId != null">#{instanceId},</if>
90 99
             <if test="taskId != null">#{taskId},</if>
@@ -99,7 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
99 108
             <if test="createBy != null">#{createBy},</if>
100 109
             <if test="createTime != null">#{createTime},</if>
101 110
             <if test="remark != null">#{remark},</if>
102
-         </trim>
111
+        </trim>
103 112
     </insert>
104 113
 
105 114
     <update id="updateApprovalHistory" parameterType="ApprovalHistory">
@@ -123,18 +132,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
123 132
     </update>
124 133
 
125 134
     <delete id="deleteApprovalHistoryById" parameterType="Long">
126
-        delete from approval_history where id = #{id}
135
+        delete
136
+        from approval_history
137
+        where id = #{id}
127 138
     </delete>
128 139
 
129 140
     <delete id="deleteApprovalHistoryByIds" parameterType="String">
130
-        delete from approval_history where id in 
141
+        delete from approval_history where id in
131 142
         <foreach item="id" collection="array" open="(" separator="," close=")">
132 143
             #{id}
133 144
         </foreach>
134 145
     </delete>
135 146
 
136 147
     <delete id="deleteApprovalHistoryByInstanceId" parameterType="Long">
137
-        delete from approval_history where instance_id = #{instanceId}
148
+        delete
149
+        from approval_history
150
+        where instance_id = #{instanceId}
138 151
     </delete>
139 152
 
140 153
 </mapper>

+ 114 - 92
airport-system/src/main/resources/mapper/approval/ApprovalInstanceMapper.xml

@@ -1,88 +1,108 @@
1 1
 <?xml version="1.0" encoding="UTF-8" ?>
2 2
 <!DOCTYPE mapper
3
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 5
 <mapper namespace="com.sundot.airport.system.mapper.approval.ApprovalInstanceMapper">
6
-    
6
+
7 7
     <resultMap type="ApprovalInstance" id="ApprovalInstanceResult">
8
-        <id     property="id"               column="id"                 />
9
-        <result property="instanceNo"       column="instance_no"        />
10
-        <result property="workflowId"       column="workflow_id"        />
11
-        <result property="title"            column="title"              />
12
-        <result property="businessType"     column="business_type"      />
13
-        <result property="businessId"       column="business_id"        />
14
-        <result property="businessData"     column="business_data"      />
15
-        <result property="submitterId"      column="submitter_id"       />
16
-        <result property="submitterName"    column="submitter_name"     />
17
-        <result property="submitTime"       column="submit_time"        />
18
-        <result property="currentNodeId"    column="current_node_id"    />
19
-        <result property="status"           column="status"             />
20
-        <result property="completionTime"   column="completion_time"    />
21
-        <result property="urgentLevel"      column="urgent_level"       />
22
-        <result property="formData"         column="form_data"          />
23
-        <result property="createBy"         column="create_by"          />
24
-        <result property="createTime"       column="create_time"        />
25
-        <result property="updateBy"         column="update_by"          />
26
-        <result property="updateTime"       column="update_time"        />
27
-        <result property="remark"           column="remark"             />
28
-        <association property="workflowDefinition" javaType="ApprovalWorkflowDefinition" resultMap="WorkflowResult" />
29
-        <association property="currentNode" javaType="ApprovalNodeDefinition" resultMap="NodeResult" />
30
-        <collection property="tasks"        javaType="java.util.List"   resultMap="TaskResult" />
31
-        <collection property="histories"    javaType="java.util.List"   resultMap="HistoryResult" />
8
+        <id property="id" column="id"/>
9
+        <result property="instanceNo" column="instance_no"/>
10
+        <result property="workflowId" column="workflow_id"/>
11
+        <result property="title" column="title"/>
12
+        <result property="businessType" column="business_type"/>
13
+        <result property="businessId" column="business_id"/>
14
+        <result property="businessData" column="business_data"/>
15
+        <result property="submitterId" column="submitter_id"/>
16
+        <result property="submitterName" column="submitter_name"/>
17
+        <result property="submitTime" column="submit_time"/>
18
+        <result property="currentNodeId" column="current_node_id"/>
19
+        <result property="status" column="status"/>
20
+        <result property="completionTime" column="completion_time"/>
21
+        <result property="urgentLevel" column="urgent_level"/>
22
+        <result property="formData" column="form_data"/>
23
+        <result property="createBy" column="create_by"/>
24
+        <result property="createTime" column="create_time"/>
25
+        <result property="updateBy" column="update_by"/>
26
+        <result property="updateTime" column="update_time"/>
27
+        <result property="remark" column="remark"/>
28
+        <association property="workflowDefinition" javaType="ApprovalWorkflowDefinition" resultMap="WorkflowResult"/>
29
+        <association property="currentNode" javaType="ApprovalNodeDefinition" resultMap="NodeResult"/>
30
+        <collection property="tasks" javaType="java.util.List" resultMap="TaskResult"/>
31
+        <collection property="histories" javaType="java.util.List" resultMap="HistoryResult"/>
32 32
     </resultMap>
33
-    
33
+
34 34
     <resultMap id="WorkflowResult" type="ApprovalWorkflowDefinition">
35
-        <id     property="id"               column="workflow_id"        />
36
-        <result property="workflowCode"     column="workflow_code"      />
37
-        <result property="workflowName"     column="workflow_name"      />
38
-        <result property="workflowType"     column="workflow_type"      />
39
-        <result property="description"      column="workflow_description" />
35
+        <id property="id" column="workflow_id"/>
36
+        <result property="workflowCode" column="workflow_code"/>
37
+        <result property="workflowName" column="workflow_name"/>
38
+        <result property="workflowType" column="workflow_type"/>
39
+        <result property="description" column="workflow_description"/>
40 40
     </resultMap>
41
-    
41
+
42 42
     <resultMap id="NodeResult" type="ApprovalNodeDefinition">
43
-        <id     property="id"               column="current_node_id"    />
44
-        <result property="nodeCode"         column="current_node_code"  />
45
-        <result property="nodeName"         column="current_node_name"  />
46
-        <result property="nodeType"         column="current_node_type"  />
43
+        <id property="id" column="current_node_id"/>
44
+        <result property="nodeCode" column="current_node_code"/>
45
+        <result property="nodeName" column="current_node_name"/>
46
+        <result property="nodeType" column="current_node_type"/>
47 47
     </resultMap>
48
-    
48
+
49 49
     <resultMap id="TaskResult" type="ApprovalTask">
50
-        <id     property="id"               column="task_id"            />
51
-        <result property="taskNo"           column="task_no"            />
52
-        <result property="taskName"         column="task_name"          />
53
-        <result property="assigneeId"       column="assignee_id"        />
54
-        <result property="assigneeName"     column="assignee_name"      />
55
-        <result property="status"           column="task_status"        />
50
+        <id property="id" column="task_id"/>
51
+        <result property="taskNo" column="task_no"/>
52
+        <result property="taskName" column="task_name"/>
53
+        <result property="assigneeId" column="assignee_id"/>
54
+        <result property="assigneeName" column="assignee_name"/>
55
+        <result property="status" column="task_status"/>
56 56
     </resultMap>
57
-    
57
+
58 58
     <resultMap id="HistoryResult" type="ApprovalHistory">
59
-        <id     property="id"               column="history_id"         />
60
-        <result property="action"           column="action"             />
61
-        <result property="operatorId"       column="operator_id"        />
62
-        <result property="operatorName"     column="operator_name"      />
63
-        <result property="operationTime"    column="operation_time"     />
64
-        <result property="comment"          column="history_comment"    />
59
+        <id property="id" column="history_id"/>
60
+        <result property="action" column="action"/>
61
+        <result property="operatorId" column="operator_id"/>
62
+        <result property="operatorName" column="operator_name"/>
63
+        <result property="operationTime" column="operation_time"/>
64
+        <result property="comment" column="history_comment"/>
65 65
     </resultMap>
66 66
 
67 67
     <sql id="selectApprovalInstanceVo">
68
-        select id, instance_no, workflow_id, title, business_type, business_id, business_data, 
69
-               submitter_id, submitter_name, submit_time, current_node_id, status, completion_time, 
70
-               urgent_level, form_data, create_by, create_time, update_by, update_time, remark 
68
+        select id,
69
+               instance_no,
70
+               workflow_id,
71
+               title,
72
+               business_type,
73
+               business_id,
74
+               business_data,
75
+               submitter_id,
76
+               submitter_name,
77
+               submit_time,
78
+               current_node_id,
79
+               status,
80
+               completion_time,
81
+               urgent_level,
82
+               form_data,
83
+               create_by,
84
+               create_time,
85
+               update_by,
86
+               update_time,
87
+               remark
71 88
         from approval_instance
72 89
     </sql>
73 90
 
74 91
     <select id="selectApprovalInstanceList" parameterType="ApprovalInstance" resultMap="ApprovalInstanceResult">
75 92
         <include refid="selectApprovalInstanceVo"/>
76
-        <where>  
77
-            <if test="instanceNo != null  and instanceNo != ''"> and instance_no like concat('%', #{instanceNo}, '%')</if>
78
-            <if test="workflowId != null "> and workflow_id = #{workflowId}</if>
79
-            <if test="title != null  and title != ''"> and title like concat('%', #{title}, '%')</if>
80
-            <if test="businessType != null  and businessType != ''"> and business_type = #{businessType}</if>
81
-            <if test="businessId != null "> and business_id = #{businessId}</if>
82
-            <if test="submitterId != null "> and submitter_id = #{submitterId}</if>
83
-            <if test="submitterName != null  and submitterName != ''"> and submitter_name like concat('%', #{submitterName}, '%')</if>
84
-            <if test="status != null  and status != ''"> and status = #{status}</if>
85
-            <if test="urgentLevel != null  and urgentLevel != ''"> and urgent_level = #{urgentLevel}</if>
93
+        <where>
94
+            <if test="instanceNo != null  and instanceNo != ''">and instance_no like concat('%', #{instanceNo}, '%')
95
+            </if>
96
+            <if test="workflowId != null ">and workflow_id = #{workflowId}</if>
97
+            <if test="title != null  and title != ''">and title like concat('%', #{title}, '%')</if>
98
+            <if test="businessType != null  and businessType != ''">and business_type = #{businessType}</if>
99
+            <if test="businessId != null ">and business_id = #{businessId}</if>
100
+            <if test="submitterId != null ">and submitter_id = #{submitterId}</if>
101
+            <if test="submitterName != null  and submitterName != ''">and submitter_name like concat('%',
102
+                #{submitterName}, '%')
103
+            </if>
104
+            <if test="status != null  and status != ''">and status = #{status}</if>
105
+            <if test="urgentLevel != null  and urgentLevel != ''">and urgent_level = #{urgentLevel}</if>
86 106
             <if test="params != null and params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
87 107
                 and date_format(submit_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
88 108
             </if>
@@ -92,9 +112,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
92 112
         </where>
93 113
         order by submit_time desc
94 114
     </select>
95
-    
115
+
96 116
     <!-- 根据工作流ID列表、时间范围和用户ID列表查询审批实例 -->
97
-    <select id="selectApprovalInstancesByWorkflowIdsAndTimeRangeAndUsers" parameterType="map" resultMap="ApprovalInstanceResult">
117
+    <select id="selectApprovalInstancesByWorkflowIdsAndTimeRangeAndUsers" parameterType="map"
118
+            resultMap="ApprovalInstanceResult">
98 119
         <include refid="selectApprovalInstanceVo"/>
99 120
         <where>
100 121
             <if test="workflowIds != null and workflowIds.size() > 0">
@@ -118,55 +139,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
118 139
         </where>
119 140
         order by submit_time desc
120 141
     </select>
121
-    
142
+
122 143
     <!-- 查询部门及其子部门下的所有用户ID -->
123 144
     <select id="selectUserIdsByDeptAndSubDepts" parameterType="long" resultType="long">
124
-        select user_id 
125
-        from sys_user 
126
-        where dept_id in (
127
-            select dept_id
128
-            from sys_dept
129
-            where dept_id = #{deptId} 
130
-               or parent_id = #{deptId} 
131
-               or ancestors like concat('%,', #{deptId}, ',%') 
132
-               or ancestors like concat(#{deptId}, ',%')
133
-               or ancestors like concat('%,', #{deptId})
134
-               or ancestors = #{deptId}
135
-        ) and del_flag = '0'
145
+        select user_id
146
+        from sys_user
147
+        where dept_id in (select dept_id
148
+                          from sys_dept
149
+                          where dept_id = #{deptId}
150
+                             or parent_id = #{deptId}
151
+                             or ancestors like concat('%,', #{deptId}, ',%')
152
+                             or ancestors like concat(#{deptId}, ',%')
153
+                             or ancestors like concat('%,', #{deptId})
154
+                             or ancestors = #{deptId})
155
+          and del_flag = '0'
136 156
     </select>
137
-    
157
+
138 158
     <select id="selectApprovalInstanceById" parameterType="Long" resultMap="ApprovalInstanceResult">
139 159
         <include refid="selectApprovalInstanceVo"/>
140 160
         where id = #{id}
141 161
     </select>
142
-    
162
+
143 163
     <select id="selectApprovalInstanceByNo" parameterType="String" resultMap="ApprovalInstanceResult">
144 164
         <include refid="selectApprovalInstanceVo"/>
145 165
         where instance_no = #{instanceNo}
146 166
     </select>
147
-    
167
+
148 168
     <select id="selectApprovalInstanceByBusiness" resultMap="ApprovalInstanceResult">
149 169
         <include refid="selectApprovalInstanceVo"/>
150 170
         where business_type = #{businessType} and business_id = #{businessId}
151 171
         order by submit_time desc
152 172
     </select>
153
-    
173
+
154 174
     <select id="selectApprovalInstanceBySubmitter" resultMap="ApprovalInstanceResult">
155 175
         <include refid="selectApprovalInstanceVo"/>
156 176
         where submitter_id = #{submitterId}
157
-        <if test="status != null and status != ''"> and status = #{status}</if>
177
+        <if test="status != null and status != ''">and status = #{status}</if>
158 178
         order by submit_time desc
159 179
     </select>
160
-    
180
+
161 181
     <select id="selectApprovalInstanceDetail" parameterType="Long" resultMap="ApprovalInstanceResult">
162 182
         <include refid="selectApprovalInstanceVo"/>
163 183
         where id = #{id}
164 184
     </select>
165
-    
185
+
166 186
     <select id="generateInstanceNo" resultType="String">
167 187
         SELECT CONCAT('INST', DATE_FORMAT(NOW(), '%Y%m%d%H%i%s'), LPAD(FLOOR(RAND() * 1000), 3, '0')) AS new_instance_no
168 188
     </select>
169
-        
189
+
170 190
     <insert id="insertApprovalInstance" parameterType="ApprovalInstance" useGeneratedKeys="true" keyProperty="id">
171 191
         insert into approval_instance
172 192
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -189,7 +209,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
189 209
             <if test="updateBy != null">update_by,</if>
190 210
             <if test="updateTime != null">update_time,</if>
191 211
             <if test="remark != null">remark,</if>
192
-         </trim>
212
+        </trim>
193 213
         <trim prefix="values (" suffix=")" suffixOverrides=",">
194 214
             <if test="instanceNo != null and instanceNo != ''">#{instanceNo},</if>
195 215
             <if test="workflowId != null">#{workflowId},</if>
@@ -210,7 +230,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
210 230
             <if test="updateBy != null">#{updateBy},</if>
211 231
             <if test="updateTime != null">#{updateTime},</if>
212 232
             <if test="remark != null">#{remark},</if>
213
-         </trim>
233
+        </trim>
214 234
     </insert>
215 235
 
216 236
     <update id="updateApprovalInstance" parameterType="ApprovalInstance">
@@ -240,11 +260,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
240 260
     </update>
241 261
 
242 262
     <delete id="deleteApprovalInstanceById" parameterType="Long">
243
-        delete from approval_instance where id = #{id}
263
+        delete
264
+        from approval_instance
265
+        where id = #{id}
244 266
     </delete>
245 267
 
246 268
     <delete id="deleteApprovalInstanceByIds" parameterType="String">
247
-        delete from approval_instance where id in 
269
+        delete from approval_instance where id in
248 270
         <foreach item="id" collection="array" open="(" separator="," close=")">
249 271
             #{id}
250 272
         </foreach>

+ 65 - 44
airport-system/src/main/resources/mapper/approval/ApprovalNodeDefinitionMapper.xml

@@ -1,83 +1,100 @@
1 1
 <?xml version="1.0" encoding="UTF-8" ?>
2 2
 <!DOCTYPE mapper
3
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 5
 <mapper namespace="com.sundot.airport.system.mapper.approval.ApprovalNodeDefinitionMapper">
6
-    
6
+
7 7
     <resultMap type="ApprovalNodeDefinition" id="ApprovalNodeDefinitionResult">
8
-        <id     property="id"               column="id"                 />
9
-        <result property="workflowId"       column="workflow_id"        />
10
-        <result property="nodeCode"         column="node_code"          />
11
-        <result property="nodeName"         column="node_name"          />
12
-        <result property="nodeType"         column="node_type"          />
13
-        <result property="sortOrder"        column="sort_order"         />
14
-        <result property="approverType"     column="approver_type"      />
15
-        <result property="approverValue"    column="approver_value"     />
16
-        <result property="canReject"        column="can_reject"         />
17
-        <result property="isRequired"       column="is_required"        />
18
-        <result property="timeoutHours"     column="timeout_hours"      />
19
-        <result property="status"           column="status"             />
20
-        <result property="createBy"         column="create_by"          />
21
-        <result property="createTime"       column="create_time"        />
22
-        <result property="updateBy"         column="update_by"          />
23
-        <result property="updateTime"       column="update_time"        />
24
-        <result property="remark"           column="remark"             />
8
+        <id property="id" column="id"/>
9
+        <result property="workflowId" column="workflow_id"/>
10
+        <result property="nodeCode" column="node_code"/>
11
+        <result property="nodeName" column="node_name"/>
12
+        <result property="nodeType" column="node_type"/>
13
+        <result property="sortOrder" column="sort_order"/>
14
+        <result property="approverType" column="approver_type"/>
15
+        <result property="approverValue" column="approver_value"/>
16
+        <result property="canReject" column="can_reject"/>
17
+        <result property="isRequired" column="is_required"/>
18
+        <result property="timeoutHours" column="timeout_hours"/>
19
+        <result property="status" column="status"/>
20
+        <result property="createBy" column="create_by"/>
21
+        <result property="createTime" column="create_time"/>
22
+        <result property="updateBy" column="update_by"/>
23
+        <result property="updateTime" column="update_time"/>
24
+        <result property="remark" column="remark"/>
25 25
     </resultMap>
26 26
 
27 27
     <sql id="selectApprovalNodeDefinitionVo">
28
-        select id, workflow_id, node_code, node_name, node_type, sort_order, approver_type, approver_value, 
29
-               can_reject, is_required, timeout_hours, status, create_by, create_time, update_by, update_time, remark 
28
+        select id,
29
+               workflow_id,
30
+               node_code,
31
+               node_name,
32
+               node_type,
33
+               sort_order,
34
+               approver_type,
35
+               approver_value,
36
+               can_reject,
37
+               is_required,
38
+               timeout_hours,
39
+               status,
40
+               create_by,
41
+               create_time,
42
+               update_by,
43
+               update_time,
44
+               remark
30 45
         from approval_node_definition
31 46
     </sql>
32 47
 
33
-    <select id="selectApprovalNodeDefinitionList" parameterType="ApprovalNodeDefinition" resultMap="ApprovalNodeDefinitionResult">
48
+    <select id="selectApprovalNodeDefinitionList" parameterType="ApprovalNodeDefinition"
49
+            resultMap="ApprovalNodeDefinitionResult">
34 50
         <include refid="selectApprovalNodeDefinitionVo"/>
35
-        <where>  
36
-            <if test="workflowId != null "> and workflow_id = #{workflowId}</if>
37
-            <if test="nodeCode != null  and nodeCode != ''"> and node_code like concat('%', #{nodeCode}, '%')</if>
38
-            <if test="nodeName != null  and nodeName != ''"> and node_name like concat('%', #{nodeName}, '%')</if>
39
-            <if test="nodeType != null  and nodeType != ''"> and node_type = #{nodeType}</if>
40
-            <if test="approverType != null  and approverType != ''"> and approver_type = #{approverType}</if>
41
-            <if test="status != null  and status != ''"> and status = #{status}</if>
51
+        <where>
52
+            <if test="workflowId != null ">and workflow_id = #{workflowId}</if>
53
+            <if test="nodeCode != null  and nodeCode != ''">and node_code like concat('%', #{nodeCode}, '%')</if>
54
+            <if test="nodeName != null  and nodeName != ''">and node_name like concat('%', #{nodeName}, '%')</if>
55
+            <if test="nodeType != null  and nodeType != ''">and node_type = #{nodeType}</if>
56
+            <if test="approverType != null  and approverType != ''">and approver_type = #{approverType}</if>
57
+            <if test="status != null  and status != ''">and status = #{status}</if>
42 58
         </where>
43 59
         order by workflow_id, sort_order
44 60
     </select>
45
-    
61
+
46 62
     <select id="selectApprovalNodeDefinitionById" parameterType="Long" resultMap="ApprovalNodeDefinitionResult">
47 63
         <include refid="selectApprovalNodeDefinitionVo"/>
48 64
         where id = #{id}
49 65
     </select>
50
-    
66
+
51 67
     <select id="selectApprovalNodeDefinitionByWorkflowId" parameterType="Long" resultMap="ApprovalNodeDefinitionResult">
52 68
         <include refid="selectApprovalNodeDefinitionVo"/>
53 69
         where workflow_id = #{workflowId} and status = '0'
54 70
         order by sort_order
55 71
     </select>
56
-    
72
+
57 73
     <select id="selectApprovalNodeDefinitionByWorkflowAndCode" resultMap="ApprovalNodeDefinitionResult">
58 74
         <include refid="selectApprovalNodeDefinitionVo"/>
59 75
         where workflow_id = #{workflowId} and node_code = #{nodeCode} and status = '0'
60 76
     </select>
61
-    
77
+
62 78
     <select id="selectFirstNodeByWorkflowId" parameterType="Long" resultMap="ApprovalNodeDefinitionResult">
63 79
         <include refid="selectApprovalNodeDefinitionVo"/>
64 80
         where workflow_id = #{workflowId} and status = '0'
65 81
         order by sort_order limit 1
66 82
     </select>
67
-    
83
+
68 84
     <select id="selectNextNodeByOrder" resultMap="ApprovalNodeDefinitionResult">
69 85
         <include refid="selectApprovalNodeDefinitionVo"/>
70 86
         where workflow_id = #{workflowId} and sort_order > #{currentOrder} and status = '0'
71 87
         order by sort_order limit 1
72 88
     </select>
73
-    
89
+
74 90
     <select id="selectPreviousNodeByOrder" resultMap="ApprovalNodeDefinitionResult">
75 91
         <include refid="selectApprovalNodeDefinitionVo"/>
76 92
         where workflow_id = #{workflowId} and sort_order &lt; #{currentOrder} and status = '0'
77 93
         order by sort_order desc limit 1
78 94
     </select>
79
-        
80
-    <insert id="insertApprovalNodeDefinition" parameterType="ApprovalNodeDefinition" useGeneratedKeys="true" keyProperty="id">
95
+
96
+    <insert id="insertApprovalNodeDefinition" parameterType="ApprovalNodeDefinition" useGeneratedKeys="true"
97
+            keyProperty="id">
81 98
         insert into approval_node_definition
82 99
         <trim prefix="(" suffix=")" suffixOverrides=",">
83 100
             <if test="workflowId != null">workflow_id,</if>
@@ -96,7 +113,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
96 113
             <if test="updateBy != null">update_by,</if>
97 114
             <if test="updateTime != null">update_time,</if>
98 115
             <if test="remark != null">remark,</if>
99
-         </trim>
116
+        </trim>
100 117
         <trim prefix="values (" suffix=")" suffixOverrides=",">
101 118
             <if test="workflowId != null">#{workflowId},</if>
102 119
             <if test="nodeCode != null and nodeCode != ''">#{nodeCode},</if>
@@ -114,7 +131,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
114 131
             <if test="updateBy != null">#{updateBy},</if>
115 132
             <if test="updateTime != null">#{updateTime},</if>
116 133
             <if test="remark != null">#{remark},</if>
117
-         </trim>
134
+        </trim>
118 135
     </insert>
119 136
 
120 137
     <update id="updateApprovalNodeDefinition" parameterType="ApprovalNodeDefinition">
@@ -141,17 +158,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
141 158
     </update>
142 159
 
143 160
     <delete id="deleteApprovalNodeDefinitionById" parameterType="Long">
144
-        delete from approval_node_definition where id = #{id}
161
+        delete
162
+        from approval_node_definition
163
+        where id = #{id}
145 164
     </delete>
146 165
 
147 166
     <delete id="deleteApprovalNodeDefinitionByIds" parameterType="String">
148
-        delete from approval_node_definition where id in 
167
+        delete from approval_node_definition where id in
149 168
         <foreach item="id" collection="array" open="(" separator="," close=")">
150 169
             #{id}
151 170
         </foreach>
152 171
     </delete>
153
-    
172
+
154 173
     <delete id="deleteApprovalNodeDefinitionByWorkflowId" parameterType="Long">
155
-        delete from approval_node_definition where workflow_id = #{workflowId}
174
+        delete
175
+        from approval_node_definition
176
+        where workflow_id = #{workflowId}
156 177
     </delete>
157 178
 </mapper>

+ 135 - 85
airport-system/src/main/resources/mapper/approval/ApprovalTaskMapper.xml

@@ -1,71 +1,89 @@
1 1
 <?xml version="1.0" encoding="UTF-8" ?>
2 2
 <!DOCTYPE mapper
3
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 5
 <mapper namespace="com.sundot.airport.system.mapper.approval.ApprovalTaskMapper">
6
-    
6
+
7 7
     <resultMap type="ApprovalTask" id="ApprovalTaskResult">
8
-        <id     property="id"               column="id"                 />
9
-        <result property="taskNo"           column="task_no"            />
10
-        <result property="instanceId"       column="instance_id"        />
11
-        <result property="nodeId"           column="node_id"            />
12
-        <result property="taskName"         column="task_name"          />
13
-        <result property="assigneeId"       column="assignee_id"        />
14
-        <result property="assigneeName"     column="assignee_name"      />
15
-        <result property="assignTime"       column="assign_time"        />
16
-        <result property="status"           column="status"             />
17
-        <result property="completeTime"     column="complete_time"      />
18
-        <result property="comment"          column="comment"            />
19
-        <result property="formData"         column="form_data"          />
20
-        <result property="timeoutTime"      column="timeout_time"       />
21
-        <result property="isTimeout"        column="is_timeout"         />
22
-        <result property="createBy"         column="create_by"          />
23
-        <result property="createTime"       column="create_time"        />
24
-        <result property="updateBy"         column="update_by"          />
25
-        <result property="updateTime"       column="update_time"        />
26
-        <result property="remark"           column="remark"             />
27
-        <association property="instance"    javaType="ApprovalInstance" resultMap="InstanceResult" />
28
-        <association property="nodeDefinition" javaType="ApprovalNodeDefinition" resultMap="NodeResult" />
8
+        <id property="id" column="id"/>
9
+        <result property="taskNo" column="task_no"/>
10
+        <result property="instanceId" column="instance_id"/>
11
+        <result property="nodeId" column="node_id"/>
12
+        <result property="taskName" column="task_name"/>
13
+        <result property="assigneeId" column="assignee_id"/>
14
+        <result property="assigneeName" column="assignee_name"/>
15
+        <result property="assignTime" column="assign_time"/>
16
+        <result property="status" column="status"/>
17
+        <result property="completeTime" column="complete_time"/>
18
+        <result property="comment" column="comment"/>
19
+        <result property="formData" column="form_data"/>
20
+        <result property="timeoutTime" column="timeout_time"/>
21
+        <result property="isTimeout" column="is_timeout"/>
22
+        <result property="createBy" column="create_by"/>
23
+        <result property="createTime" column="create_time"/>
24
+        <result property="updateBy" column="update_by"/>
25
+        <result property="updateTime" column="update_time"/>
26
+        <result property="remark" column="remark"/>
27
+        <association property="instance" javaType="ApprovalInstance" resultMap="InstanceResult"/>
28
+        <association property="nodeDefinition" javaType="ApprovalNodeDefinition" resultMap="NodeResult"/>
29 29
     </resultMap>
30
-    
30
+
31 31
     <resultMap id="InstanceResult" type="ApprovalInstance">
32
-        <id     property="id"               column="instance_id"        />
33
-        <result property="instanceNo"       column="instance_no"        />
34
-        <result property="title"            column="instance_title"     />
35
-        <result property="businessType"     column="business_type"      />
36
-        <result property="businessId"       column="business_id"        />
37
-        <result property="submitterId"      column="submitter_id"       />
38
-        <result property="submitterName"    column="submitter_name"     />
39
-        <result property="submitTime"       column="submit_time"        />
40
-        <result property="urgentLevel"      column="urgent_level"       />
32
+        <id property="id" column="instance_id"/>
33
+        <result property="instanceNo" column="instance_no"/>
34
+        <result property="title" column="instance_title"/>
35
+        <result property="businessType" column="business_type"/>
36
+        <result property="businessId" column="business_id"/>
37
+        <result property="submitterId" column="submitter_id"/>
38
+        <result property="submitterName" column="submitter_name"/>
39
+        <result property="submitTime" column="submit_time"/>
40
+        <result property="urgentLevel" column="urgent_level"/>
41 41
     </resultMap>
42
-    
42
+
43 43
     <resultMap id="NodeResult" type="ApprovalNodeDefinition">
44
-        <id     property="id"               column="node_id"            />
45
-        <result property="nodeCode"         column="node_code"          />
46
-        <result property="nodeName"         column="node_name"          />
47
-        <result property="nodeType"         column="node_type"          />
48
-        <result property="canReject"        column="can_reject"         />
44
+        <id property="id" column="node_id"/>
45
+        <result property="nodeCode" column="node_code"/>
46
+        <result property="nodeName" column="node_name"/>
47
+        <result property="nodeType" column="node_type"/>
48
+        <result property="canReject" column="can_reject"/>
49 49
     </resultMap>
50 50
 
51 51
     <sql id="selectApprovalTaskVo">
52
-        select id, task_no, instance_id, node_id, task_name, assignee_id, assignee_name, assign_time, 
53
-               status, complete_time, comment, form_data, timeout_time, is_timeout, create_by, create_time, 
54
-               update_by, update_time, remark 
52
+        select id,
53
+               task_no,
54
+               instance_id,
55
+               node_id,
56
+               task_name,
57
+               assignee_id,
58
+               assignee_name,
59
+               assign_time,
60
+               status,
61
+               complete_time,
62
+               comment,
63
+               form_data,
64
+               timeout_time,
65
+               is_timeout,
66
+               create_by,
67
+               create_time,
68
+               update_by,
69
+               update_time,
70
+               remark
55 71
         from approval_task
56 72
     </sql>
57 73
 
58 74
     <select id="selectApprovalTaskList" parameterType="ApprovalTask" resultMap="ApprovalTaskResult">
59 75
         <include refid="selectApprovalTaskVo"/>
60
-        <where>  
61
-            <if test="taskNo != null  and taskNo != ''"> and task_no like concat('%', #{taskNo}, '%')</if>
62
-            <if test="instanceId != null "> and instance_id = #{instanceId}</if>
63
-            <if test="nodeId != null "> and node_id = #{nodeId}</if>
64
-            <if test="taskName != null  and taskName != ''"> and task_name like concat('%', #{taskName}, '%')</if>
65
-            <if test="assigneeId != null "> and assignee_id = #{assigneeId}</if>
66
-            <if test="assigneeName != null  and assigneeName != ''"> and assignee_name like concat('%', #{assigneeName}, '%')</if>
67
-            <if test="status != null  and status != ''"> and status = #{status}</if>
68
-            <if test="isTimeout != null  and isTimeout != ''"> and is_timeout = #{isTimeout}</if>
76
+        <where>
77
+            <if test="taskNo != null  and taskNo != ''">and task_no like concat('%', #{taskNo}, '%')</if>
78
+            <if test="instanceId != null ">and instance_id = #{instanceId}</if>
79
+            <if test="nodeId != null ">and node_id = #{nodeId}</if>
80
+            <if test="taskName != null  and taskName != ''">and task_name like concat('%', #{taskName}, '%')</if>
81
+            <if test="assigneeId != null ">and assignee_id = #{assigneeId}</if>
82
+            <if test="assigneeName != null  and assigneeName != ''">and assignee_name like concat('%', #{assigneeName},
83
+                '%')
84
+            </if>
85
+            <if test="status != null  and status != ''">and status = #{status}</if>
86
+            <if test="isTimeout != null  and isTimeout != ''">and is_timeout = #{isTimeout}</if>
69 87
             <if test="params != null and params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
70 88
                 and date_format(assign_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
71 89
             </if>
@@ -75,67 +93,95 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
75 93
         </where>
76 94
         order by assign_time desc
77 95
     </select>
78
-    
96
+
79 97
     <select id="selectApprovalTaskById" parameterType="Long" resultMap="ApprovalTaskResult">
80 98
         <include refid="selectApprovalTaskVo"/>
81 99
         where id = #{id}
82 100
     </select>
83
-    
101
+
84 102
     <select id="selectApprovalTaskByNo" parameterType="String" resultMap="ApprovalTaskResult">
85 103
         <include refid="selectApprovalTaskVo"/>
86 104
         where task_no = #{taskNo}
87 105
     </select>
88
-    
106
+
89 107
     <select id="selectApprovalTaskByInstanceId" parameterType="Long" resultMap="ApprovalTaskResult">
90 108
         <include refid="selectApprovalTaskVo"/>
91 109
         where instance_id = #{instanceId}
92 110
         order by assign_time
93 111
     </select>
94
-    
112
+
95 113
     <select id="selectApprovalTaskByAssignee" resultMap="ApprovalTaskResult">
96
-        select 
97
-            at.id, at.task_no, at.instance_id, at.node_id, at.task_name, at.assignee_id, at.assignee_name, 
98
-            at.assign_time, at.status, at.complete_time, at.comment, at.form_data, at.timeout_time, at.is_timeout, 
99
-            at.create_by, at.create_time, at.update_by, at.update_time, at.remark,
100
-            ai.instance_no, ai.title as instance_title, ai.business_type, ai.business_id, ai.submitter_id, 
101
-            ai.submitter_name, ai.submit_time, ai.urgent_level,
102
-            and1.node_code, and1.node_name, and1.node_type, and1.can_reject
114
+        select
115
+        at.id, at.task_no, at.instance_id, at.node_id, at.task_name, at.assignee_id, at.assignee_name,
116
+        at.assign_time, at.status, at.complete_time, at.comment, at.form_data, at.timeout_time, at.is_timeout,
117
+        at.create_by, at.create_time, at.update_by, at.update_time, at.remark,
118
+        ai.instance_no, ai.title as instance_title, ai.business_type, ai.business_id, ai.submitter_id,
119
+        ai.submitter_name, ai.submit_time, ai.urgent_level,
120
+        and1.node_code, and1.node_name, and1.node_type, and1.can_reject
103 121
         from approval_task at
104 122
         left join approval_instance ai on at.instance_id = ai.id
105 123
         left join approval_node_definition and1 on at.node_id = and1.id
106 124
         where at.assignee_id = #{assigneeId}
107
-        <if test="status != null and status != ''"> and at.status = #{status}</if>
125
+        <if test="status != null and status != ''">and at.status = #{status}</if>
108 126
         order by at.assign_time desc
109 127
     </select>
110
-    
128
+
111 129
     <select id="selectApprovalTaskByInstanceAndNode" resultMap="ApprovalTaskResult">
112 130
         <include refid="selectApprovalTaskVo"/>
113 131
         where instance_id = #{instanceId} and node_id = #{nodeId}
114 132
         limit 1
115 133
     </select>
116
-    
134
+
117 135
     <select id="selectApprovalTaskDetail" parameterType="Long" resultMap="ApprovalTaskResult">
118
-        select 
119
-            at.id, at.task_no, at.instance_id, at.node_id, at.task_name, at.assignee_id, at.assignee_name, 
120
-            at.assign_time, at.status, at.complete_time, at.comment, at.form_data, at.timeout_time, at.is_timeout, 
121
-            at.create_by, at.create_time, at.update_by, at.update_time, at.remark,
122
-            ai.instance_no, ai.title as instance_title, ai.business_type, ai.business_id, ai.submitter_id, 
123
-            ai.submitter_name, ai.submit_time, ai.urgent_level,
124
-            and1.node_code, and1.node_name, and1.node_type, and1.can_reject
136
+        select at.id,
137
+               at.task_no,
138
+               at.instance_id,
139
+               at.node_id,
140
+               at.task_name,
141
+               at.assignee_id,
142
+               at.assignee_name,
143
+               at.assign_time,
144
+               at.status,
145
+               at.complete_time,
146
+               at.comment,
147
+               at.form_data,
148
+               at.timeout_time,
149
+               at.is_timeout,
150
+               at.create_by,
151
+               at.create_time,
152
+               at.update_by,
153
+               at.update_time,
154
+               at.remark,
155
+               ai.instance_no,
156
+               ai.title as instance_title,
157
+               ai.business_type,
158
+               ai.business_id,
159
+               ai.submitter_id,
160
+               ai.submitter_name,
161
+               ai.submit_time,
162
+               ai.urgent_level,
163
+               and1.node_code,
164
+               and1.node_name,
165
+               and1.node_type,
166
+               and1.can_reject
125 167
         from approval_task at
126
-        left join approval_instance ai on at.instance_id = ai.id
127
-        left join approval_node_definition and1 on at.node_id = and1.id
168
+        left join approval_instance ai
169
+        on at.instance_id = ai.id
170
+            left join approval_node_definition and1 on at.node_id = and1.id
128 171
         where at.id = #{id}
129 172
     </select>
130
-    
173
+
131 174
     <select id="generateTaskNo" resultType="String">
132 175
         SELECT CONCAT('TASK', DATE_FORMAT(NOW(), '%Y%m%d%H%i%s'), LPAD(FLOOR(RAND() * 1000), 3, '0')) AS new_task_no
133 176
     </select>
134
-    
177
+
135 178
     <select id="countPendingTasksByAssignee" parameterType="Long" resultType="int">
136
-        select count(1) from approval_task where assignee_id = #{assigneeId} and status = 'PENDING'
179
+        select count(1)
180
+        from approval_task
181
+        where assignee_id = #{assigneeId}
182
+          and status = 'PENDING'
137 183
     </select>
138
-        
184
+
139 185
     <insert id="insertApprovalTask" parameterType="ApprovalTask" useGeneratedKeys="true" keyProperty="id">
140 186
         insert into approval_task
141 187
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -157,7 +203,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
157 203
             <if test="updateBy != null">update_by,</if>
158 204
             <if test="updateTime != null">update_time,</if>
159 205
             <if test="remark != null">remark,</if>
160
-         </trim>
206
+        </trim>
161 207
         <trim prefix="values (" suffix=")" suffixOverrides=",">
162 208
             <if test="taskNo != null and taskNo != ''">#{taskNo},</if>
163 209
             <if test="instanceId != null">#{instanceId},</if>
@@ -177,7 +223,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
177 223
             <if test="updateBy != null">#{updateBy},</if>
178 224
             <if test="updateTime != null">#{updateTime},</if>
179 225
             <if test="remark != null">#{remark},</if>
180
-         </trim>
226
+        </trim>
181 227
     </insert>
182 228
 
183 229
     <update id="updateApprovalTask" parameterType="ApprovalTask">
@@ -206,17 +252,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
206 252
     </update>
207 253
 
208 254
     <delete id="deleteApprovalTaskById" parameterType="Long">
209
-        delete from approval_task where id = #{id}
255
+        delete
256
+        from approval_task
257
+        where id = #{id}
210 258
     </delete>
211 259
 
212 260
     <delete id="deleteApprovalTaskByIds" parameterType="String">
213
-        delete from approval_task where id in 
261
+        delete from approval_task where id in
214 262
         <foreach item="id" collection="array" open="(" separator="," close=")">
215 263
             #{id}
216 264
         </foreach>
217 265
     </delete>
218
-    
266
+
219 267
     <delete id="deleteApprovalTaskByInstanceId" parameterType="Long">
220
-        delete from approval_task where instance_id = #{instanceId}
268
+        delete
269
+        from approval_task
270
+        where instance_id = #{instanceId}
221 271
     </delete>
222 272
 </mapper>

+ 65 - 45
airport-system/src/main/resources/mapper/approval/ApprovalWorkflowDefinitionMapper.xml

@@ -1,71 +1,89 @@
1 1
 <?xml version="1.0" encoding="UTF-8" ?>
2 2
 <!DOCTYPE mapper
3
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 5
 <mapper namespace="com.sundot.airport.system.mapper.approval.ApprovalWorkflowDefinitionMapper">
6
-    
6
+
7 7
     <resultMap type="ApprovalWorkflowDefinition" id="ApprovalWorkflowDefinitionResult">
8
-        <id     property="id"               column="id"                 />
9
-        <result property="workflowCode"     column="workflow_code"      />
10
-        <result property="workflowName"     column="workflow_name"      />
11
-        <result property="workflowType"     column="workflow_type"      />
12
-        <result property="description"      column="description"        />
13
-        <result property="status"           column="status"             />
14
-        <result property="createBy"         column="create_by"          />
15
-        <result property="createTime"       column="create_time"        />
16
-        <result property="updateBy"         column="update_by"          />
17
-        <result property="updateTime"       column="update_time"        />
18
-        <result property="remark"           column="remark"             />
19
-        <collection property="nodes"        javaType="java.util.List"   resultMap="NodeResult" />
8
+        <id property="id" column="id"/>
9
+        <result property="workflowCode" column="workflow_code"/>
10
+        <result property="workflowName" column="workflow_name"/>
11
+        <result property="workflowType" column="workflow_type"/>
12
+        <result property="description" column="description"/>
13
+        <result property="status" column="status"/>
14
+        <result property="createBy" column="create_by"/>
15
+        <result property="createTime" column="create_time"/>
16
+        <result property="updateBy" column="update_by"/>
17
+        <result property="updateTime" column="update_time"/>
18
+        <result property="remark" column="remark"/>
19
+        <collection property="nodes" javaType="java.util.List" resultMap="NodeResult"/>
20 20
     </resultMap>
21
-    
21
+
22 22
     <resultMap id="NodeResult" type="ApprovalNodeDefinition">
23
-        <id     property="id"               column="node_id"            />
24
-        <result property="workflowId"       column="workflow_id"        />
25
-        <result property="nodeCode"         column="node_code"          />
26
-        <result property="nodeName"         column="node_name"          />
27
-        <result property="nodeType"         column="node_type"          />
28
-        <result property="sortOrder"        column="sort_order"         />
29
-        <result property="approverType"     column="approver_type"      />
30
-        <result property="approverValue"    column="approver_value"     />
31
-        <result property="canReject"        column="can_reject"         />
32
-        <result property="isRequired"       column="is_required"        />
33
-        <result property="timeoutHours"     column="timeout_hours"      />
34
-        <result property="status"           column="node_status"        />
23
+        <id property="id" column="node_id"/>
24
+        <result property="workflowId" column="workflow_id"/>
25
+        <result property="nodeCode" column="node_code"/>
26
+        <result property="nodeName" column="node_name"/>
27
+        <result property="nodeType" column="node_type"/>
28
+        <result property="sortOrder" column="sort_order"/>
29
+        <result property="approverType" column="approver_type"/>
30
+        <result property="approverValue" column="approver_value"/>
31
+        <result property="canReject" column="can_reject"/>
32
+        <result property="isRequired" column="is_required"/>
33
+        <result property="timeoutHours" column="timeout_hours"/>
34
+        <result property="status" column="node_status"/>
35 35
     </resultMap>
36 36
 
37 37
     <sql id="selectApprovalWorkflowDefinitionVo">
38
-        select id, workflow_code, workflow_name, workflow_type, description, status, create_by, create_time, update_by, update_time, remark from approval_workflow_definition
38
+        select id,
39
+               workflow_code,
40
+               workflow_name,
41
+               workflow_type,
42
+               description,
43
+               status,
44
+               create_by,
45
+               create_time,
46
+               update_by,
47
+               update_time,
48
+               remark
49
+        from approval_workflow_definition
39 50
     </sql>
40 51
 
41
-    <select id="selectApprovalWorkflowDefinitionList" parameterType="ApprovalWorkflowDefinition" resultMap="ApprovalWorkflowDefinitionResult">
52
+    <select id="selectApprovalWorkflowDefinitionList" parameterType="ApprovalWorkflowDefinition"
53
+            resultMap="ApprovalWorkflowDefinitionResult">
42 54
         <include refid="selectApprovalWorkflowDefinitionVo"/>
43
-        <where>  
44
-            <if test="workflowCode != null  and workflowCode != ''"> and workflow_code like concat('%', #{workflowCode}, '%')</if>
45
-            <if test="workflowName != null  and workflowName != ''"> and workflow_name like concat('%', #{workflowName}, '%')</if>
46
-            <if test="workflowType != null  and workflowType != ''"> and workflow_type = #{workflowType}</if>
47
-            <if test="status != null  and status != ''"> and status = #{status}</if>
55
+        <where>
56
+            <if test="workflowCode != null  and workflowCode != ''">and workflow_code like concat('%', #{workflowCode},
57
+                '%')
58
+            </if>
59
+            <if test="workflowName != null  and workflowName != ''">and workflow_name like concat('%', #{workflowName},
60
+                '%')
61
+            </if>
62
+            <if test="workflowType != null  and workflowType != ''">and workflow_type = #{workflowType}</if>
63
+            <if test="status != null  and status != ''">and status = #{status}</if>
48 64
         </where>
49 65
         order by create_time desc
50 66
     </select>
51
-    
67
+
52 68
     <select id="selectApprovalWorkflowDefinitionById" parameterType="Long" resultMap="ApprovalWorkflowDefinitionResult">
53 69
         <include refid="selectApprovalWorkflowDefinitionVo"/>
54 70
         where id = #{id}
55 71
     </select>
56
-    
57
-    <select id="selectApprovalWorkflowDefinitionByCode" parameterType="String" resultMap="ApprovalWorkflowDefinitionResult">
72
+
73
+    <select id="selectApprovalWorkflowDefinitionByCode" parameterType="String"
74
+            resultMap="ApprovalWorkflowDefinitionResult">
58 75
         <include refid="selectApprovalWorkflowDefinitionVo"/>
59 76
         where workflow_code = #{workflowCode} and status = '0'
60 77
     </select>
61
-    
78
+
62 79
     <select id="selectApprovalWorkflowDefinitionByType" parameterType="String" resultType="ApprovalWorkflowDefinition">
63 80
         <include refid="selectApprovalWorkflowDefinitionVo"/>
64 81
         where workflow_type = #{workflowType} and status = '0'
65 82
         order by create_time desc
66 83
     </select>
67
-        
68
-    <insert id="insertApprovalWorkflowDefinition" parameterType="ApprovalWorkflowDefinition" useGeneratedKeys="true" keyProperty="id">
84
+
85
+    <insert id="insertApprovalWorkflowDefinition" parameterType="ApprovalWorkflowDefinition" useGeneratedKeys="true"
86
+            keyProperty="id">
69 87
         insert into approval_workflow_definition
70 88
         <trim prefix="(" suffix=")" suffixOverrides=",">
71 89
             <if test="workflowCode != null and workflowCode != ''">workflow_code,</if>
@@ -78,7 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
78 96
             <if test="updateBy != null">update_by,</if>
79 97
             <if test="updateTime != null">update_time,</if>
80 98
             <if test="remark != null">remark,</if>
81
-         </trim>
99
+        </trim>
82 100
         <trim prefix="values (" suffix=")" suffixOverrides=",">
83 101
             <if test="workflowCode != null and workflowCode != ''">#{workflowCode},</if>
84 102
             <if test="workflowName != null and workflowName != ''">#{workflowName},</if>
@@ -90,7 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
90 108
             <if test="updateBy != null">#{updateBy},</if>
91 109
             <if test="updateTime != null">#{updateTime},</if>
92 110
             <if test="remark != null">#{remark},</if>
93
-         </trim>
111
+        </trim>
94 112
     </insert>
95 113
 
96 114
     <update id="updateApprovalWorkflowDefinition" parameterType="ApprovalWorkflowDefinition">
@@ -111,11 +129,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
111 129
     </update>
112 130
 
113 131
     <delete id="deleteApprovalWorkflowDefinitionById" parameterType="Long">
114
-        delete from approval_workflow_definition where id = #{id}
132
+        delete
133
+        from approval_workflow_definition
134
+        where id = #{id}
115 135
     </delete>
116 136
 
117 137
     <delete id="deleteApprovalWorkflowDefinitionByIds" parameterType="String">
118
-        delete from approval_workflow_definition where id in 
138
+        delete from approval_workflow_definition where id in
119 139
         <foreach item="id" collection="array" open="(" separator="," close=")">
120 140
             #{id}
121 141
         </foreach>