Преглед изворни кода

Merge branch 'qtz5' of SH-Arbitrate/Arbitrate-Backend into dev

qtz пре 2 година
родитељ
комит
16d6d1c29d

+ 54
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/ArbitrateApplicationController.java Прегледај датотеку

@@ -0,0 +1,54 @@
1
+package com.ruoyi.web.controller.wisdomarbitrate;
2
+
3
+import cn.hutool.json.JSONUtil;
4
+import com.ruoyi.common.annotation.Anonymous;
5
+import com.ruoyi.common.core.controller.BaseController;
6
+import com.ruoyi.common.core.domain.AjaxResult;
7
+import com.ruoyi.common.utils.CheckSignatuerUtils;
8
+import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
9
+import com.ruoyi.wisdomarbitrate.domain.vo.CaseApplicationVO;
10
+import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
11
+import org.springframework.beans.BeanUtils;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.validation.annotation.Validated;
14
+import org.springframework.web.bind.annotation.PostMapping;
15
+import org.springframework.web.bind.annotation.RequestBody;
16
+import org.springframework.web.bind.annotation.RequestMapping;
17
+import org.springframework.web.bind.annotation.RestController;
18
+
19
+@RestController
20
+@RequestMapping("/callArbitrateCaseApplication")
21
+public class ArbitrateApplicationController extends BaseController {
22
+    @Autowired
23
+    private ICaseApplicationService caseApplicationService;
24
+
25
+
26
+    /**
27
+     * 新增立案数据
28
+     */
29
+    @Anonymous
30
+    @PostMapping("/generateCaseApplication")
31
+    public AjaxResult generateCaseApplication(@Validated @RequestBody CaseApplicationVO caseApplicationVO) throws Exception {
32
+        String paramsbody = JSONUtil.toJsonStr(caseApplicationVO);
33
+        boolean checkResult= CheckSignatuerUtils.checkSignuter(paramsbody);
34
+        if(checkResult){
35
+            CaseApplication caseApplication = new CaseApplication();
36
+            BeanUtils.copyProperties(caseApplicationVO,caseApplication);
37
+            caseApplication.setCreateBy(getUsername());
38
+            return toAjax(caseApplicationService.insertcaseApplication1(caseApplication));
39
+        }else {
40
+            return AjaxResult.error("签名验证失败");
41
+        }
42
+
43
+    }
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+}

+ 0
- 8
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java Прегледај датотеку

@@ -2,20 +2,15 @@ package com.ruoyi.web.controller.wisdomarbitrate;
2 2
 
3 3
 import cn.hutool.core.collection.CollectionUtil;
4 4
 import cn.hutool.core.util.StrUtil;
5
-import com.alipay.api.internal.util.file.IOUtils;
6 5
 import com.ruoyi.common.annotation.Anonymous;
7 6
 import com.ruoyi.common.annotation.Log;
8
-import com.ruoyi.common.constant.FileTransformation;
9 7
 import com.ruoyi.common.core.controller.BaseController;
10 8
 import com.ruoyi.common.core.domain.AjaxResult;
11 9
 import com.ruoyi.common.core.page.TableDataInfo;
12 10
 import com.ruoyi.common.enums.BusinessType;
13 11
 import com.ruoyi.common.exception.EsignDemoException;
14
-import com.ruoyi.common.exception.ServiceException;
15 12
 import com.ruoyi.common.utils.StringUtils;
16 13
 import com.ruoyi.common.utils.WxAppletNotifyUtils;
17
-import com.ruoyi.util.FileUtil;
18
-import com.ruoyi.wisdomarbitrate.StringIdsReq;
19 14
 import com.ruoyi.wisdomarbitrate.domain.*;
20 15
 import com.ruoyi.wisdomarbitrate.domain.vo.ReservedConferenceVO;
21 16
 import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO;
@@ -23,14 +18,11 @@ import com.ruoyi.wisdomarbitrate.domain.vo.ToDoCount;
23 18
 import com.ruoyi.wisdomarbitrate.service.IAdjudicationService;
24 19
 import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
25 20
 import org.springframework.beans.factory.annotation.Autowired;
26
-import org.springframework.security.access.prepost.PreAuthorize;
27 21
 import org.springframework.validation.annotation.Validated;
28 22
 import org.springframework.web.bind.annotation.*;
29 23
 import com.ruoyi.common.utils.poi.ExcelUtil;
30 24
 import org.springframework.web.multipart.MultipartFile;
31 25
 
32
-import javax.servlet.ServletException;
33
-import javax.servlet.http.HttpServletRequest;
34 26
 import javax.servlet.http.HttpServletResponse;
35 27
 import java.io.*;
36 28
 import java.net.URL;

+ 65
- 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/CheckSignatuerUtils.java Прегледај датотеку

@@ -0,0 +1,65 @@
1
+package com.ruoyi.common.utils;
2
+
3
+import cn.hutool.core.io.IoUtil;
4
+import cn.hutool.crypto.digest.HMac;
5
+import cn.hutool.crypto.digest.HmacAlgorithm;
6
+import org.springframework.web.context.request.RequestContextHolder;
7
+import org.springframework.web.context.request.ServletRequestAttributes;
8
+
9
+import javax.servlet.http.HttpServletRequest;
10
+import java.io.IOException;
11
+import java.nio.charset.StandardCharsets;
12
+
13
+public class CheckSignatuerUtils {
14
+
15
+    public static String getSign(String paramsbody, String accessSec, long timestamp) {
16
+        String paramsStr = getParamsStr(paramsbody,  timestamp);
17
+        return generateSign(paramsStr, accessSec);
18
+    }
19
+
20
+    public static String getParamsStr(String paramsbody,long timestamp) {
21
+        StringBuilder strbuild = new StringBuilder();
22
+        if (StringUtils.isNotBlank(paramsbody)) {
23
+            strbuild.append(paramsbody).append('#');
24
+        }
25
+        strbuild.append("#timestamp=").append(timestamp);
26
+        return strbuild.toString();
27
+    }
28
+
29
+    public static String generateSign(String paramsStr, String accessSec) {
30
+        HMac hMac = new HMac(HmacAlgorithm.HmacSHA256, accessSec.getBytes(StandardCharsets.UTF_8));
31
+        return hMac.digestHex(paramsStr);
32
+    }
33
+
34
+    public static boolean checkSignuter(String paramsbody) throws Exception {
35
+        HttpServletRequest reqParam = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest();
36
+        String timestampstr = reqParam.getHeader("timestampstr");
37
+        String signstr = reqParam.getHeader("signstr");
38
+        String accessSec = "mCFMA6ffe938v79m";
39
+//        String bodyParams = getRequestBodyStr(reqParam);
40
+        String newSignuter = getSign(paramsbody, accessSec,Long.parseLong(timestampstr));
41
+        if (StringUtils.equals(signstr, newSignuter)) {
42
+            return true;
43
+        }else {
44
+            return false;
45
+        }
46
+
47
+    }
48
+
49
+//    private static String getRequestBodyStr(HttpServletRequest request) throws IOException {
50
+//        String body = null;
51
+//        if (request instanceof BodyReaderRequestWrapper) {
52
+//            body = IoUtil.readUtf8(request.getInputStream());
53
+//        }
54
+//        return body;
55
+//    }
56
+
57
+
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+}

+ 419
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/CaseApplicationVO.java Прегледај датотеку

@@ -0,0 +1,419 @@
1
+package com.ruoyi.wisdomarbitrate.domain.vo;
2
+
3
+import com.fasterxml.jackson.annotation.JsonFormat;
4
+import com.ruoyi.common.annotation.Excel;
5
+import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate;
6
+import com.ruoyi.wisdomarbitrate.domain.CaseAttach;
7
+import lombok.Data;
8
+
9
+import java.math.BigDecimal;
10
+import java.util.Date;
11
+import java.util.List;
12
+
13
+@Data
14
+public class CaseApplicationVO {
15
+    private static final long serialVersionUID = 1L;
16
+    /**
17
+     * 查询案件时区分是否待办案件,0待办案件,1已办案件
18
+     */
19
+    private String selectCaseStatus;
20
+
21
+    /** ID */
22
+    private Long id;
23
+    /** 案件名称 */
24
+    @Excel(name = "案件名称")
25
+    private String caseName;
26
+    /** 案件编号 */
27
+//    @Excel(name = "案件编号")
28
+    private String caseNum;
29
+    /** 案件标的 */
30
+    @Excel(name = "案件标的")
31
+    private BigDecimal caseSubjectAmount;
32
+    /**
33
+     * 模板id
34
+     */
35
+    private Long templateId;
36
+
37
+
38
+
39
+    /** 立案日期 */
40
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
41
+    private Date registerDate;
42
+    /** 仲裁方式 */
43
+    private Integer arbitratMethod;
44
+    /**
45
+     * 是否导入,0手动录入,1导入,默认0
46
+     */
47
+    private Integer importFlag;
48
+    /** 仲裁方式名称 */
49
+    private String arbitratMethodName;
50
+
51
+    /** 案件状态 */
52
+    private Integer caseStatus;
53
+    private String caseStatusstr;
54
+
55
+    /** 申请人是否书面审理 */
56
+    private Integer applicantIsWrittenHear;
57
+
58
+    /** 被申请人是否书面审理 */
59
+    private Integer respondentIsWrittenHear;
60
+    /** 开庭方式是否一致 */
61
+    private Integer arbitraMethodIssame;
62
+    /** 仲裁方式说明 */
63
+    private String arbitratMethodIllustrate;
64
+
65
+
66
+    /** 案件申请表ID */
67
+    private Long caseAppliId;
68
+
69
+    /** 开庭日期 */
70
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
71
+    private Date hearDate;
72
+
73
+    /** 借款开始日期 */
74
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
75
+    @Excel(name = "借款开始日期")
76
+    private Date loanStartDate;
77
+    /** 借款结束日期 */
78
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
79
+    @Excel(name = "借款结束日期")
80
+    private Date loanEndDate;
81
+    /** 合同编号 */
82
+    @Excel(name = "合同编号")
83
+    private String contractNumber;
84
+    /** 申请人主张欠本金 */
85
+    @Excel(name = "申请人主张欠本金")
86
+    private BigDecimal claimPrinciOwed;
87
+    /** 申请人主张欠利息 */
88
+    @Excel(name = "申请人主张欠利息")
89
+    private BigDecimal claimInterestOwed;
90
+    /** 申请人主张违约金 */
91
+    @Excel(name = "申请人主张违约金")
92
+    private BigDecimal claimLiquidDamag;
93
+    /** 申请人请求仲裁庭裁决 */
94
+    @Excel(name = "申请人请求仲裁庭裁决",width = 36)
95
+    private String requestRule;
96
+
97
+    /** 是否财产保全申请 */
98
+    @Excel(name = "是否财产保全申请",width = 26,combo= {"是","否"},readConverterExp = "0=否,1=是")
99
+    private Integer properPreser;
100
+    /** 申请人仲裁请求及事实和理由 */
101
+    @Excel(name = "申请人仲裁请求及事实和理由",width = 36)
102
+    private String arbitratClaims;
103
+    /** 仲裁应缴费用 */
104
+    private BigDecimal feePayable;
105
+
106
+    /** 开始在线视频时间 */
107
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
108
+    private Date beginVideoDate;
109
+    /** 在线视频人员 */
110
+    private String onlineVideoPerson;
111
+
112
+    /** 仲裁员id */
113
+    private String arbitratorId;
114
+    /** 仲裁员名称 */
115
+    private String arbitratorName;
116
+
117
+    /** 案件描述 */
118
+    private String caseDescribe;
119
+    /** 裁决书URL */
120
+    private String  filearbitraUrl;
121
+
122
+    /** 是否同意组庭 */
123
+    private Integer isAgreePendTral;
124
+
125
+    /** 是否有异议需要举证 */
126
+    private Integer objectionAddEviden;
127
+    /** 是否需要开庭审理 */
128
+    private Integer openCourtHear;
129
+
130
+    /** 是否仲裁反请求 */
131
+    private Integer adjudicaCounter;
132
+    /**
133
+     * 仲裁反请求原因
134
+     */
135
+    private String adjudicaCounterReason;
136
+
137
+    /** 被申请人是否缺席 */
138
+    private Integer isAbsence;
139
+    /** 是否管辖异议申请 */
140
+    private Integer objectiJuris;
141
+    /** 被申请人质证意见 */
142
+    private String responCrossOpin;
143
+    /** 被申请人的答辩意见 */
144
+    private String responDefenOpini;
145
+    /** 申请人是否缺席 */
146
+    private Integer appliIsAbsen;
147
+
148
+    /** 申请人质证意见 */
149
+    private String applicaCrossOpin;
150
+
151
+    /** 支付状态 */
152
+    private Integer paymentStatus;
153
+
154
+    /** 支付状态描述 */
155
+    private String paymentStatusName;
156
+    /**
157
+     * 支付方式code,0线上支付,1线下支付
158
+     */
159
+    private Integer payTypeCode;
160
+    /**
161
+     * 支付方式name,0线上支付,1线下支付
162
+     */
163
+    private String payTypeName;
164
+
165
+
166
+
167
+    // 导入校验失败信息
168
+    private StringBuilder errorMsg;
169
+    /**
170
+     * 是否锁定,0-否,1-是
171
+     */
172
+    private Integer lockStatus;
173
+    /** 案件状态名称 */
174
+    private String caseStatusName;
175
+    /** 是否同意审核 */
176
+    private Integer agreeOrNotCheck;
177
+    /** 申请人名称 */
178
+    private String applicantName;
179
+    /** 被申请人名称 */
180
+    private String respondentName;
181
+    /**
182
+     * 用户身份证号
183
+     */
184
+    private String idCard;
185
+    /**
186
+     * 用户id
187
+     */
188
+    private String userId;
189
+    /**
190
+     * 登录用户用户名
191
+     */
192
+    private String loginUserName;
193
+    private List<Long> deptIds;
194
+    /**
195
+     * 部门长状态
196
+     */
197
+    private List<Integer> deptHeadStatus;
198
+    /**
199
+     * 代理人角色有关部门
200
+     */
201
+    private List<Long> agentDeptIds;
202
+    /**
203
+     * 财务状态
204
+     */
205
+    private Integer financeStatus;
206
+    /**
207
+     * 是否是被申请人,仲裁员,部门长,财务,代理人,0-否,1-是
208
+     */
209
+    private Integer isOtherRole;
210
+    /**
211
+     * 案件日志id
212
+     */
213
+    private Long caseLogId;
214
+    /** 仲裁结果 */
215
+    private String caseResult;
216
+
217
+    /** 案件关联人信息 */
218
+    private List<CaseAffiliate> caseAffiliates;
219
+
220
+
221
+
222
+    private List<Integer> caseStatusList;
223
+
224
+    private List<Integer> annexTypeList;
225
+
226
+    private Integer annexType;
227
+    /**
228
+     * 案件附件列表
229
+     */
230
+    private List<CaseAttach> caseAttachList;
231
+
232
+
233
+
234
+
235
+    /**
236
+     * 申请人主体信息
237
+     */
238
+    /** 姓名 */
239
+    @Excel(name = "申请人主体信息-申请人(机构)",width = 26)
240
+    private String name;
241
+    /** 身份证号 */
242
+    @Excel(name = "申请人主体信息-代码",width = 26)
243
+    private String identityNum;
244
+    /** 申请人主体信息-法定代表人 */
245
+    @Excel(name = "申请人主体信息-法定代表人",width = 26)
246
+    private String compLegalPerson;
247
+    /** 申请人主体信息-法定代表人 */
248
+    @Excel(name = "申请人主体信息-法定代表人职位",width = 26)
249
+    private String compLegalperPost;
250
+    /**
251
+     * 申请人主体信息-申请人(机构)id
252
+     */
253
+    private String nameId;
254
+
255
+    /** 联系电话 */
256
+    @Excel(name = "申请人主体信息-联系电话",width = 26)
257
+    private String contactTelphone;
258
+    /** 联系地址 */
259
+    @Excel(name = "申请人主体信息-联系地址",width = 26)
260
+    private String contactAddress;
261
+    /** 单位电话 */
262
+    @Excel(name = "申请人主体信息-单位电话",width = 26)
263
+    private String workTelphone;
264
+    /** 单位地址 */
265
+    @Excel(name = "申请人主体信息-单位地址",width = 26)
266
+    private String workAddress;
267
+
268
+    /** 申请人住所 */
269
+    @Excel(name = "申请人主体信息-住所",width = 26)
270
+    private String residenAffiliAppli;
271
+
272
+    /** 申请人邮箱 */
273
+    @Excel(name = "申请人主体信息-邮箱",width = 26)
274
+    private String email;
275
+    /** 代理人姓名 */
276
+    @Excel(name = "申请人主体信息-代理人姓名",width = 26)
277
+    private String nameAgent;
278
+    /** 身份证号 */
279
+    @Excel(name = "申请人主体信息-代理人身份证号",width = 26)
280
+    private String identityNumAgent;
281
+
282
+    /** 联系电话 */
283
+    @Excel(name = "申请人主体信息-代理人联系电话",width = 26)
284
+    private String contactTelphoneAgent;
285
+    /** 联系地址 */
286
+    @Excel(name = "申请人主体信息-代理人联系地址",width = 26)
287
+    private String contactAddressAgent;
288
+    /** 申请人代理人职称 */
289
+    @Excel(name = "申请人主体信息-代理人职称",width = 26)
290
+    private String appliAgentTitle;
291
+    /**
292
+     * 被申请人主体信息
293
+     */
294
+    /** 姓名 */
295
+    @Excel(name = "被申请人主体信息-申请人姓名",width = 26)
296
+    private String debtorName;
297
+    /** 身份证号 */
298
+    @Excel(name = "被申请人主体信息-身份证号",width = 26)
299
+    private String debtorIdentityNum;
300
+    /** 被申请人主体信息-性别 */
301
+    @Excel(name = "被申请人主体信息-性别",width = 26,combo= {"男","女"},readConverterExp = "0=男,1=女")
302
+    private String responSex;
303
+    /** 被申请人主体信息-出生年月日 */
304
+    @Excel(name = "被申请人主体信息-出生年月日",width = 26)
305
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
306
+    private Date responBirth;
307
+    /** 联系电话 */
308
+    @Excel(name = "被申请人主体信息-联系电话",width = 26)
309
+    private String debtorContactTelphone;
310
+    /** 联系地址 */
311
+    @Excel(name = "被申请人主体信息-联系地址",width = 26)
312
+    private String debtorContactAddress;
313
+    /** 被申请人住所 */
314
+    @Excel(name = "被申请人主体信息-住所",width = 26)
315
+    private String residenAffiliRespon;
316
+    /** 单位电话 */
317
+    @Excel(name = "被申请人主体信息-单位电话",width = 26)
318
+    private String debtorWorkTelphone;
319
+    /** 单位地址 */
320
+    @Excel(name = "被申请人主体信息-单位地址",width = 26)
321
+    private String debtorWorkAddress;
322
+    /** 邮箱 */
323
+    @Excel(name = "被申请人主体信息-邮箱",width = 26)
324
+    private String debtorEmail;
325
+
326
+    /** 代理人姓名 */
327
+    @Excel(name = "被申请人主体信息-代理人姓名",width = 26)
328
+    private String debtorNameAgent;
329
+    /** 身份证号 */
330
+    @Excel(name = "被申请人主体信息-代理人身份证号",width = 26)
331
+    private String debtorIdentityNumAgent;
332
+    /** 联系电话 */
333
+    @Excel(name = "被申请人主体信息-代理人联系电话",width = 26)
334
+    private String debtorContactTelphoneAgent;
335
+    /** 联系地址 */
336
+    @Excel(name = "被申请人主体信息-代理人联系地址",width = 26)
337
+    private String debtorContactAddressAgent;
338
+    /**
339
+     * 申请机构id
340
+     */
341
+    private String applicationOrganId;
342
+    /**
343
+     * 版本号
344
+     */
345
+    private Integer version;
346
+    /**
347
+     * 修改案件的提交状态,0-未提交,1-已提交,2-同意,3-拒绝,4-撤销
348
+     */
349
+    private Integer updateSubmitStatus;
350
+    /** 合同名称 */
351
+    private String contractName;
352
+    /**
353
+     * 事实和理由
354
+     */
355
+    private String facts;
356
+    /**
357
+     * 合同甲方
358
+     */
359
+    private String partyA;
360
+    /**
361
+     * 利率
362
+     */
363
+    private String interestRate;
364
+    /**
365
+     * 待还金额
366
+     */
367
+    private String outstandingMoney;
368
+    /**
369
+     * 调解达成协议内容
370
+     */
371
+    private String mediationAgreement;
372
+    /**
373
+     * 金融消费纠纷基本情况
374
+     */
375
+    private String disputes;
376
+    /**
377
+     * 贷款类型
378
+     */
379
+    private String loanType;
380
+    /**
381
+     * 贷款期限
382
+     */
383
+    private String loanTerm;
384
+    /**
385
+     * 本案争议焦点
386
+     */
387
+    private String caseFocus;
388
+    /**
389
+     * 本案事实
390
+     */
391
+    private String caseFacts;
392
+    /**
393
+     * 被申请人对上述材料的质证意见
394
+     */
395
+    private String respondentOpinion;
396
+    /**
397
+     * 申请人对上述材料的质证意见
398
+     */
399
+    private String applicantOpinion;
400
+    /**
401
+     * 批号
402
+     */
403
+    private Integer batchNumber;
404
+
405
+    /**
406
+     * 待办状态,0待办,1已办
407
+     */
408
+    private Integer pendingStatus;
409
+    /** e签宝流程id */
410
+    private String signFlowId;
411
+
412
+
413
+
414
+
415
+
416
+
417
+
418
+
419
+}

+ 2
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseApplicationService.java Прегледај датотеку

@@ -21,6 +21,8 @@ public interface ICaseApplicationService {
21 21
 
22 22
     int insertcaseApplication(CaseApplication caseApplication);
23 23
 
24
+    int insertcaseApplication1(CaseApplication caseApplication);
25
+
24 26
     int selectCaseApplicationCount(CaseApplication caseApplication);
25 27
 
26 28
     AjaxResult editCaseApplication(CaseApplication caseApplication);

+ 115
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java Прегледај датотеку

@@ -1113,6 +1113,121 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
1113 1113
         return rows;
1114 1114
     }
1115 1115
 
1116
+    /**
1117
+     * 新增案件
1118
+     *
1119
+     * @param caseApplication
1120
+     * @return
1121
+     */
1122
+    @Override
1123
+    @Transactional
1124
+    public int insertcaseApplication1(CaseApplication caseApplication)  {
1125
+        caseApplication.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION);
1126
+        //根据仲裁费用计费规则计算应缴费用
1127
+        //暂时设置计费比率为0.01
1128
+        BigDecimal feeRate = new BigDecimal(0.01);
1129
+        BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2, BigDecimal.ROUND_HALF_UP);
1130
+        caseApplication.setFeePayable(feePayable);
1131
+        // 获取自动编码
1132
+        String caseNum = generateCaseNum();
1133
+        caseApplication.setCaseNum(caseNum);
1134
+
1135
+        caseApplication.setCreateBy(getUsername());
1136
+        caseApplication.setVersion(1);
1137
+        caseApplication.setId(IdWorkerUtil.getId());
1138
+        // 新增立案信息
1139
+        int rows = caseApplicationMapper.insertCaseApplication(caseApplication);
1140
+        if (rows == 0) {
1141
+            return rows;
1142
+        }
1143
+        List<CaseAffiliate> caseAffiliates = caseApplication.getCaseAffiliates();
1144
+        Map<String, Long> deptMap = new HashMap<>();
1145
+        // 判断申请机构
1146
+        if (caseAffiliates != null && caseAffiliates.size() > 0) {
1147
+            // 查询所有的组织机构,组装成map
1148
+            List<SysDept> deptList = sysDeptMapper.selectDeptList(new SysDept());
1149
+            if (CollectionUtil.isEmpty(deptList)) {
1150
+                deptList = new ArrayList<>();
1151
+            }
1152
+            deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId, (oldV, newV) -> newV));
1153
+            // 查询申请人角色id
1154
+            Long roleId = roleMapper.selectRoleIdByName("申请人");
1155
+            for (CaseAffiliate caseAffiliate : caseAffiliates) {
1156
+                caseAffiliate.setCaseAppliId(caseApplication.getId());
1157
+                //     caseAffiliate.setCaseAppliLogId(caseApplication.getId());
1158
+                if (caseAffiliate.getIdentityType() == 1 && StrUtil.isNotEmpty(caseAffiliate.getName())) {
1159
+                    // 将组织机构id设为申请人名称
1160
+                    if (deptMap.containsKey(caseAffiliate.getName())) {
1161
+                        caseAffiliate.setApplicationOrganId(String.valueOf(deptMap.get(caseAffiliate.getName())));
1162
+                        caseAffiliate.setApplicationOrganName(caseAffiliate.getName());
1163
+                    } else {
1164
+                        // 如果不存在则新增
1165
+                        SysDept dept = new SysDept();
1166
+                        dept.setParentId(0L);
1167
+                        dept.setDeptName(caseAffiliate.getName());
1168
+                        dept.setAncestors("0");
1169
+                        dept.setOrderNum(1);
1170
+                        dept.setStatus("0");
1171
+                        dept.setDelFlag("0");
1172
+                        dept.setCreateBy(getUsername());
1173
+                        dept.setUpdateBy(getUsername());
1174
+                        sysDeptMapper.insertDept(dept);
1175
+                        deptMap.put(dept.getDeptName(), dept.getDeptId());
1176
+                        caseAffiliate.setApplicationOrganId(String.valueOf(dept.getDeptId()));
1177
+                        caseAffiliate.setApplicationOrganName(caseAffiliate.getName());
1178
+
1179
+                    }
1180
+                    // 组装申请代理人信息
1181
+                    String agentInfoFlag = buildAgentInfo(caseAffiliate, roleId);
1182
+                    if (StrUtil.isNotEmpty(agentInfoFlag)) {
1183
+                        throw new ServiceException(agentInfoFlag);
1184
+                    }
1185
+                }
1186
+            }
1187
+            // 新增案件关联人
1188
+            caseAffiliateMapper.batchCaseAffiliate(caseAffiliates);
1189
+        }
1190
+
1191
+        List<CaseAttach> caseAttachList = caseApplication.getCaseAttachList();
1192
+        if (caseAttachList != null && caseAttachList.size() > 0  ) {
1193
+            for (CaseAttach caseAttach : caseAttachList) {
1194
+                caseAttach.setCaseAppliId(caseApplication.getId());
1195
+            }
1196
+            caseAttachMapper.batchSave(caseAttachList);
1197
+        }
1198
+        // 新增日志
1199
+        insertCaseLog(caseApplication.getId(), CaseApplicationConstants.CASE_APPLICATION, "");
1200
+
1201
+        // 新增案件日志表
1202
+        caseApplication.setCaseAppliId(caseApplication.getId());
1203
+        caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.UNCOMMITTED.getCode());
1204
+        caseApplication.setCaseLogId(IdWorkerUtil.getId());
1205
+        int insertRow = caseApplicationLogMapper.insert(caseApplication);
1206
+        // 插入案件相关人员表日志
1207
+        if (insertRow != 0 && CollectionUtil.isNotEmpty(caseAffiliates)) {
1208
+            caseAffiliates.forEach(caseAffiliate -> caseAffiliate.setCaseAppliLogId(caseApplication.getCaseLogId()));
1209
+
1210
+            caseAffiliateLogMapper.batchCaseAffiliate(caseAffiliates);
1211
+        }
1212
+        // 插入附件表日志
1213
+        if (CollectionUtil.isNotEmpty(caseAttachList)) {
1214
+            List<CaseAttach> filterList = caseAttachList.stream().filter(c -> c.getAnnexType().equals(2)).collect(Collectors.toList());
1215
+            // 插入日志附件表
1216
+            if (CollectionUtil.isNotEmpty(filterList)) {
1217
+                for (CaseAttach caseAttach : filterList) {
1218
+                    // 查询附件表
1219
+                    CaseAttach attach = caseAttachMapper.queryAnnexById(caseAttach.getAnnexId());
1220
+                    attach.setCaseAppliLogId(caseApplication.getCaseLogId());
1221
+                    caseAttachLogMapper.save(attach);
1222
+                }
1223
+            }
1224
+
1225
+        }
1226
+
1227
+        return rows;
1228
+    }
1229
+
1230
+
1116 1231
     /**
1117 1232
      * 获取自动编码
1118 1233
      *