Pārlūkot izejas kodu

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

wangqiong123 2 gadus atpakaļ
vecāks
revīzija
df98af33ba

+ 5
- 3
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java Parādīt failu

@@ -13,7 +13,7 @@ public class CaseApplication  extends BaseEntity {
13 13
     /** ID */
14 14
     private Long id;
15 15
     /** 案件编号 */
16
-    @Excel(name = "案件编号")
16
+//    @Excel(name = "案件编号")
17 17
     private String caseNum;
18 18
     /** 案件标的 */
19 19
     @Excel(name = "案件标的")
@@ -58,8 +58,7 @@ public class CaseApplication  extends BaseEntity {
58 58
     /** 开庭日期 */
59 59
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
60 60
     private Date hearDate;
61
-    /** 申请人仲裁诉求 */
62
-    private String arbitratClaims;
61
+
63 62
     /** 借款开始日期 */
64 63
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
65 64
     @Excel(name = "借款开始日期")
@@ -80,6 +79,9 @@ public class CaseApplication  extends BaseEntity {
80 79
     /** 申请人主张违约金 */
81 80
     @Excel(name = "申请人主张违约金")
82 81
     private BigDecimal claimLiquidDamag;
82
+    /** 申请人仲裁诉求 */
83
+    @Excel(name = "申请人仲裁诉求")
84
+    private String arbitratClaims;
83 85
     /** 仲裁应缴费用 */
84 86
     private BigDecimal feePayable;
85 87
 

+ 9
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/CaseApplicationMapper.java Parādīt failu

@@ -2,6 +2,7 @@ package com.ruoyi.wisdomarbitrate.mapper;
2 2
 
3 3
 import com.ruoyi.wisdomarbitrate.domain.CaseAffiliate;
4 4
 import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
5
+import org.apache.ibatis.annotations.Param;
5 6
 
6 7
 import java.util.List;
7 8
 
@@ -22,4 +23,12 @@ public interface CaseApplicationMapper {
22 23
     CaseApplication selectCaseApplication(CaseApplication caseApplication);
23 24
 
24 25
     CaseApplication selectCaseApplicationConfirm(CaseApplication caseApplication);
26
+
27
+    /**
28
+     * 查询最大编号
29
+     * @param caseNum
30
+     * @param length
31
+     * @return
32
+     */
33
+    Integer selectCaseNumLike(@Param("caseNum") String caseNum, @Param("length") int length);
25 34
 }

+ 83
- 34
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java Parādīt failu

@@ -1,5 +1,6 @@
1 1
 package com.ruoyi.wisdomarbitrate.service.impl;
2 2
 
3
+
3 4
 import com.ruoyi.common.constant.CaseApplicationConstants;
4 5
 import com.ruoyi.common.exception.ServiceException;
5 6
 import com.ruoyi.common.utils.DateUtils;
@@ -12,16 +13,11 @@ import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
12 13
 import org.springframework.beans.factory.annotation.Autowired;
13 14
 import org.springframework.stereotype.Service;
14 15
 import org.springframework.transaction.annotation.Transactional;
15
-
16
-import java.lang.reflect.Field;
17 16
 import java.math.BigDecimal;
18 17
 import java.text.SimpleDateFormat;
19 18
 import java.util.*;
20 19
 import java.util.stream.Collectors;
21 20
 
22
-import static com.ruoyi.common.core.domain.AjaxResult.error;
23
-import static java.util.stream.Collectors.collectingAndThen;
24
-import static java.util.stream.Collectors.toCollection;
25 21
 
26 22
 @Service
27 23
 public class CaseApplicationServiceImpl implements ICaseApplicationService {
@@ -58,7 +54,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
58 54
         BigDecimal feeRate = new BigDecimal(0.01);
59 55
         BigDecimal feePayable  = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2,BigDecimal.ROUND_HALF_UP);
60 56
         caseApplication.setFeePayable(feePayable);
61
-
57
+        // 获取自动编码
62 58
         String caseNum = generateCaseNum();
63 59
         caseApplication.setCaseNum(caseNum);
64 60
 
@@ -83,15 +79,21 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
83 79
         return rows;
84 80
     }
85 81
 
82
+    /**
83
+     * 获取自动编码
84
+     * @return
85
+     */
86
+
86 87
     private String generateCaseNum() {
87
-        String currentday = DateUtils.dateTime();
88
-        String caseNum = "zc"+ currentday;
89
-        //查询出当天的案件编号的最大值 ,如等于1
90
-        Integer caseNumMax = 1;
91
-        if(caseNumMax!=null){
92
-            //根据查询到的caseNumMax拼接一个案件编号
88
+        // 自动编码格式 zc+yyyyMMdd+001
89
+        String currentDay = DateUtils.dateTime();
90
+        String caseNum = "zc"+ currentDay;
91
+        //查询出当天的案件编号的最大值
92
+            Integer maxCaseNum =  caseApplicationMapper.selectCaseNumLike(caseNum,caseNum.length());
93
+        if(null == maxCaseNum){
94
+            caseNum = caseNum + "001";
93 95
         }else {
94
-            caseNum += "001";
96
+            caseNum = caseNum + String.format("%03d", maxCaseNum);
95 97
         }
96 98
         return caseNum;
97 99
 
@@ -105,13 +107,28 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
105 107
     @Override
106 108
     @Transactional
107 109
     public int editCaseApplication(CaseApplication caseApplication) {
110
+        //根据仲裁费用计费规则计算应缴费用
111
+        //暂时设置计费比率为0.01
112
+        BigDecimal feeRate = new BigDecimal(0.01);
113
+        BigDecimal feePayable  = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2,BigDecimal.ROUND_HALF_UP);
114
+        caseApplication.setFeePayable(feePayable);
115
+
108 116
         int rows = caseApplicationMapper.updataCaseApplication(caseApplication);
109 117
         List<CaseAffiliate> caseAffiliates = caseApplication.getCaseAffiliates();
110 118
         if(caseAffiliates!=null&&caseAffiliates.size()>0){
111 119
             for (CaseAffiliate caseAffiliate : caseAffiliates){
120
+                caseAffiliate.setCaseAppliId(caseApplication.getId());
112 121
                 caseAffiliateMapper.updataCaseAffiliate(caseAffiliate);
113 122
             }
114 123
         }
124
+        List<CaseAttach> caseAttachList = caseApplication.getCaseAttachList();
125
+        if(caseAttachList!=null&&caseAttachList.size()>0){
126
+            for (CaseAttach caseAttach : caseAttachList){
127
+                caseAttach.setCaseAppliId(caseApplication.getId());
128
+                caseAttachMapper.updateCaseAttach(caseAttach);
129
+            }
130
+
131
+        }
115 132
 
116 133
         return rows;
117 134
     }
@@ -191,38 +208,47 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
191 208
     @Override
192 209
     @Transactional
193 210
     public String importCaseApplication(List<CaseApplication> caseApplicationList,  String operName) {
194
-        StringBuilder successMsg = new StringBuilder();
195 211
         StringBuilder failureMsg = new StringBuilder();
212
+        StringBuilder successMsg = new StringBuilder();
196 213
         int successNum = 0;
197 214
         int failureNum = 0;
198 215
         if(caseApplicationList!=null&&caseApplicationList.size()>0){
199 216
             List<CaseApplication> caseApplicationListinsert = new ArrayList<>();
200 217
             for (int i = 0; i < caseApplicationList.size(); i++){
201 218
                 CaseApplication caseApplication = caseApplicationList.get(i);
219
+                //根据仲裁费用计费规则计算应缴费用
220
+                //暂时设置计费比率为0.01
221
+                BigDecimal feeRate = new BigDecimal(0.01);
222
+                BigDecimal feePayable  = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2,BigDecimal.ROUND_HALF_UP);
223
+                caseApplication.setFeePayable(feePayable);
224
+
202 225
                 //赋值CaseApplication的案件关联人信息
203 226
                 List<CaseAffiliate> caseAffiliatesnew  = new ArrayList<>();
204 227
                 assignmentCaseAffiliates(caseApplication,caseAffiliatesnew);
205 228
 
206
-                int caseApplicationCount = selectCaseApplicationCount(caseApplication);
207
-                if(caseApplicationCount>0){
208
-                    failureNum++;
209
-                    failureMsg.append("<br/>" + failureNum + "、立案编号 " + caseApplication.getCaseNum() + " 已存在");
210
-                }else {
211
-                    caseApplicationListinsert.add(caseApplication);
212
-                }
229
+//                int caseApplicationCount = selectCaseApplicationCount(caseApplication);
230
+//                if(caseApplicationCount>0){
231
+//                    failureNum++;
232
+//                    failureMsg.append("<br/>" + failureNum + "、立案编号 " + caseApplication.getCaseNum() + " 已存在");
233
+//                }else {
234
+//                    caseApplicationListinsert.add(caseApplication);
235
+//                }
236
+                caseApplicationListinsert.add(caseApplication);
213 237
             }
238
+
214 239
             if(caseApplicationListinsert!=null&&caseApplicationListinsert.size()>0){
215
-                List<CaseApplication> caseApplicationListinsertDiffer = caseApplicationListinsert.stream().collect(
216
-                        collectingAndThen(
217
-                                toCollection(() -> new TreeSet<>(Comparator.comparing(CaseApplication::getCaseNum))),
218
-                                ArrayList::new));
240
+//                List<CaseApplication> caseApplicationListinsertDiffer = caseApplicationListinsert.stream().collect(
241
+//                        collectingAndThen(
242
+//                                toCollection(() -> new TreeSet<>(Comparator.comparing(CaseApplication::getCaseNum))),
243
+//                                ArrayList::new));
219 244
 
220 245
 
221 246
                 //对不重复的立案对象集合的立案对象重新组装对应的案件关联人信息
222
-                if(caseApplicationListinsertDiffer!=null&&caseApplicationListinsertDiffer.size()>0){
223
-                    List<CaseApplication> caseApplicationNewList = new ArrayList<>();
224
-                    for (int i = 0; i < caseApplicationListinsertDiffer.size(); i++){
225
-                        CaseApplication caseApplicationinsertDiffer = caseApplicationListinsertDiffer.get(i);
247
+//                if(caseApplicationListinsertDiffer!=null&&caseApplicationListinsertDiffer.size()>0){
248
+                    List<CaseApplication> caseApplicationNewList = null;
249
+                    for (int i = 0; i < caseApplicationListinsert.size(); i++){
250
+                        caseApplicationNewList = new ArrayList<>();
251
+                        CaseApplication caseApplicationinsertDiffer = caseApplicationListinsert.get(i);
226 252
                         List<CaseAffiliate> caseAffiliatesnew =  new ArrayList<>();
227 253
                         CaseApplication caseApplicationNew = new CaseApplication();
228 254
                         copyCaseApplication(caseApplicationinsertDiffer,caseApplicationNew);
@@ -244,6 +270,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
244 270
                             CaseApplication caseApplicationItera = caseApplicationNewList.get(k);
245 271
                             // 新增立案信息
246 272
                             caseApplicationItera.setCaseStatus(CaseApplicationConstants.CASE_APPLICATION);
273
+                            // 设置自动编码
274
+                            caseApplicationItera.setCaseNum(generateCaseNum());
247 275
                             int rows = caseApplicationMapper.insertCaseApplication(caseApplicationItera);
248 276
                             List<CaseAffiliate> caseAffiliates = caseApplicationItera.getCaseAffiliates();
249 277
                             if(caseAffiliates!=null&&caseAffiliates.size()>0){
@@ -256,7 +284,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
256 284
                             successMsg.append("<br/>" + successNum + "、立案编号 " + caseApplicationItera.getCaseNum() + " 导入成功");
257 285
                         }
258 286
 
259
-                    }
287
+//                    }
260 288
 
261 289
                 }
262 290
 
@@ -265,8 +293,13 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
265 293
         }else {
266 294
             throw new ServiceException("导入立案申请数据不能为空!");
267 295
         }
296
+        // 编号存在不导入
297
+        if(StringUtils.isNotEmpty(failureMsg)){
298
+            return failureMsg.append(successMsg).toString();
299
+        }else {
268 300
 
269
-        return  successMsg.toString();
301
+            return successMsg.toString();
302
+        }
270 303
     }
271 304
 
272 305
     @Override
@@ -362,7 +395,22 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
362 395
     @Override
363 396
     public CaseApplication selectCaseApplicationConfirm(CaseApplication caseApplication) {
364 397
         CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplicationConfirm(caseApplication);
398
+        CaseAffiliate caseAffiliate = new CaseAffiliate();
399
+        caseAffiliate.setCaseAppliId(caseApplication.getId());
400
+        List<CaseAffiliate> caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
401
+        if(caseAffiliatListeselect!=null){
402
+            StringBuffer applicantName = new StringBuffer();
403
+            for (int i = 0; i < caseAffiliatListeselect.size(); i++){
404
+                CaseAffiliate caseAffiliateselect = caseAffiliatListeselect.get(i);
405
+                int identityType = caseAffiliateselect.getIdentityType();
406
+                if(identityType==1){
407
+                    applicantName.append(caseAffiliateselect.getName()).append(",");;
408
+                }
409
+            }
410
+            caseApplicationselect.setApplicantName(applicantName.toString());
365 411
 
412
+
413
+        }
366 414
         return caseApplicationselect;
367 415
     }
368 416
 
@@ -374,7 +422,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
374 422
 
375 423
         //发送短信通知
376 424
         SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
377
-        request.setTemplateId("1931000");
425
+        request.setTemplateId("1947342");
378 426
 
379 427
         CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
380 428
         String caseNum = caseApplicationselect.getCaseNum();
@@ -398,7 +446,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
398 446
                     Arbitrator arbitratorselect = arbitratorList.get(i);
399 447
                     //给仲裁员发送短信通知
400 448
                     request.setPhone(arbitratorselect.getTelephone());
401
-                    // 1931000 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。
449
+                    // 1947342 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。
402 450
                     String name = arbitratorselect.getArbitratorName();
403 451
                     request.setTemplateParamSet(new String[]{name, caseNum, hearDatestr});
404 452
                     SmsUtils.sendSms(request);
@@ -415,7 +463,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
415 463
                 int identityType = caseAffiliateselect.getIdentityType();
416 464
                 //给申请人、被申请人发送短信通知
417 465
                 request.setPhone(caseAffiliateselect.getContactTelphone());
418
-                // 1931000 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。
466
+                // 1947342 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。
419 467
                 String name = caseAffiliateselect.getName();
420 468
                 request.setTemplateParamSet(new String[]{name, caseNum, hearDatestr});
421 469
                 SmsUtils.sendSms(request);
@@ -478,6 +526,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
478 526
         caseApplicationNew.setClaimInterestOwed(caseApplicationinsertDiffer.getClaimInterestOwed());
479 527
         caseApplicationNew.setClaimPrinciOwed(caseApplicationinsertDiffer.getClaimPrinciOwed());
480 528
         caseApplicationNew.setClaimLiquidDamag(caseApplicationinsertDiffer.getClaimLiquidDamag());
529
+        caseApplicationNew.setFeePayable(caseApplicationinsertDiffer.getFeePayable());
481 530
     }
482 531
 
483 532
 

+ 1
- 0
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseAffiliateMapper.xml Parādīt failu

@@ -49,6 +49,7 @@
49 49
     <update id="updataCaseAffiliate" parameterType="CaseAffiliate">
50 50
         update case_affiliate
51 51
         set
52
+        case_appli_id=#{caseAppliId},
52 53
         identity_type= #{identityType},
53 54
         name = #{name},
54 55
         identity_num = #{identityNum},

+ 5
- 4
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml Parādīt failu

@@ -71,7 +71,7 @@
71 71
                 </foreach>
72 72
             </if>
73 73
         </where>
74
-        order by c.create_time desc
74
+        order by c.create_time desc,c.case_num desc
75 75
     </select>
76 76
 
77 77
     <select id="selectCaseApplicationCount" parameterType="CaseApplication" resultType="int">
@@ -237,9 +237,10 @@
237 237
             AND c.id = #{id}
238 238
 
239 239
     </select>
240
-
241
-
242
-
240
+    <select id="selectCaseNumLike" resultType="java.lang.Integer">
241
+        select max(substring(case_num, #{length}+1,12)+1) as maxCaseNum
242
+        from case_application where case_num like CONCAT(#{caseNum},'%') ;
243
+    </select>
243 244
 
244 245
 
245 246
 </mapper>