Parcourir la source

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

wangqiong123 il y a 2 ans
Parent
révision
35ca824390

+ 10
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java Voir le fichier

@@ -8,6 +8,7 @@ import com.ruoyi.common.enums.BusinessType;
8 8
 import com.ruoyi.common.utils.SecurityUtils;
9 9
 import com.ruoyi.common.utils.StringUtils;
10 10
 import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
11
+import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO;
11 12
 import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
12 13
 import org.apache.commons.lang3.ArrayUtils;
13 14
 import org.springframework.beans.factory.annotation.Autowired;
@@ -218,5 +219,14 @@ public class CaseApplicationController  extends BaseController {
218 219
 
219 220
 
220 221
 
222
+    /**
223
+     * 确认缴费查询立案信息
224
+     */
225
+    @PostMapping("/sendRoomNoMessage")
226
+    public AjaxResult sendRoomNoMessage(@Validated @RequestBody SendRoomNoMessageVO messageVO)
227
+    {
228
+        String result = caseApplicationService.sendRoomNoMessage(messageVO);
229
+        return success(result);
230
+    }
221 231
 
222 232
 }

+ 2
- 2
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/CaseApplication.java Voir le fichier

@@ -332,10 +332,10 @@ public class CaseApplication  extends BaseEntity {
332 332
      * 申请人主体信息
333 333
      */
334 334
     /** 姓名 */
335
-    @Excel(name = "申请人主体信息-申请人姓名",width = 26)
335
+    @Excel(name = "申请人主体信息-申请人(机构)",width = 26)
336 336
     private String name;
337 337
     /** 身份证号 */
338
-    @Excel(name = "申请人主体信息-身份证号",width = 26)
338
+    @Excel(name = "申请人主体信息-代码",width = 26)
339 339
     private String identityNum;
340 340
 
341 341
     /** 联系电话 */

+ 0
- 29
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/CaseLogVO.java Voir le fichier

@@ -1,29 +0,0 @@
1
-package com.ruoyi.wisdomarbitrate.domain.vo;
2
-
3
-import lombok.Data;
4
-
5
-import java.util.Date;
6
-
7
-/**
8
- * @description 案件操作日志实体
9
- * @Author wangqiong
10
- * @Date 2023/10/09 15:18
11
- * @Version V1.0
12
- **/
13
-@Data
14
-public class CaseLogVO {
15
-    /**日志id*/
16
-    private String logId;
17
-    /**操作人id*/
18
-    private String operatorId;
19
-    /**操作人名称*/
20
-    private String operatorName;
21
-    /**操作人ip*/
22
-    private String ip;
23
-    /**操作时间*/
24
-    private Date operateTime;
25
-    /**操作明细*/
26
-    private String operateDetail;
27
-    /**操作类型*/
28
-    private String operateType;
29
-}

+ 23
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/SendRoomNoMessageVO.java Voir le fichier

@@ -0,0 +1,23 @@
1
+package com.ruoyi.wisdomarbitrate.domain.vo;
2
+
3
+import lombok.Data;
4
+
5
+import javax.validation.constraints.NotEmpty;
6
+import java.io.Serializable;
7
+
8
+/**
9
+ * @author wangqiong
10
+ * @description 发送房间号短信入参类
11
+ * @date 2023-10-10 15:20
12
+ */
13
+@Data
14
+public class SendRoomNoMessageVO implements Serializable {
15
+    private static final long serialVersionUID = 1L;
16
+    @NotEmpty(message = "案件id不能为空")
17
+    private Long id;
18
+    @NotEmpty(message = "房间号不能为空")
19
+    private String roomNo;
20
+
21
+
22
+
23
+}

+ 9
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/ArbitratorMapper.java Voir le fichier

@@ -1,10 +1,19 @@
1 1
 package com.ruoyi.wisdomarbitrate.mapper;
2 2
 
3 3
 import com.ruoyi.wisdomarbitrate.domain.Arbitrator;
4
+import org.apache.ibatis.annotations.Param;
4 5
 
5 6
 import java.util.List;
6 7
 
7 8
 public interface ArbitratorMapper {
8 9
     List<Arbitrator> selectArbitratorList(Arbitrator arbitrator);
9 10
 
11
+    /**
12
+     * 根据案件id和身份类型查询案件关联人
13
+     * @param caseAppliId
14
+     * @param identityType
15
+     * @return
16
+     */
17
+    Arbitrator selectArbitratorById(@Param("caseAppliId") Long caseAppliId,@Param("identityType") Integer identityType);
18
+
10 19
 }

+ 3
- 0
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/ICaseApplicationService.java Voir le fichier

@@ -1,6 +1,7 @@
1 1
 package com.ruoyi.wisdomarbitrate.service;
2 2
 
3 3
 import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
4
+import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO;
4 5
 
5 6
 import java.util.List;
6 7
 
@@ -37,4 +38,6 @@ public interface ICaseApplicationService {
37 38
     int submitCaseApplicationCheck(CaseApplication caseApplication);
38 39
 
39 40
     CaseApplication selectCaseApplicationConfirm(CaseApplication caseApplication);
41
+
42
+    String sendRoomNoMessage(SendRoomNoMessageVO messageVO);
40 43
 }

+ 109
- 7
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java Voir le fichier

@@ -1,13 +1,18 @@
1 1
 package com.ruoyi.wisdomarbitrate.service.impl;
2 2
 
3 3
 
4
+import cn.hutool.core.collection.CollectionUtil;
5
+import com.ruoyi.common.annotation.DataScope;
4 6
 import com.ruoyi.common.constant.CaseApplicationConstants;
7
+import com.ruoyi.common.core.domain.entity.SysDept;
5 8
 import com.ruoyi.common.exception.ServiceException;
6 9
 import com.ruoyi.common.utils.DateUtils;
7 10
 import com.ruoyi.common.utils.SmsUtils;
8 11
 import com.ruoyi.common.utils.StringUtils;
9 12
 import com.ruoyi.common.utils.bean.BeanUtils;
13
+import com.ruoyi.system.mapper.SysDeptMapper;
10 14
 import com.ruoyi.wisdomarbitrate.domain.*;
15
+import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO;
11 16
 import com.ruoyi.wisdomarbitrate.mapper.*;
12 17
 import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
13 18
 import org.springframework.beans.factory.annotation.Autowired;
@@ -18,6 +23,8 @@ import java.text.SimpleDateFormat;
18 23
 import java.util.*;
19 24
 import java.util.stream.Collectors;
20 25
 
26
+import static com.ruoyi.common.utils.SecurityUtils.getUsername;
27
+
21 28
 
22 29
 @Service
23 30
 public class CaseApplicationServiceImpl implements ICaseApplicationService {
@@ -34,6 +41,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
34 41
 
35 42
     @Autowired
36 43
     private CaseAttachMapper caseAttachMapper;
44
+    @Autowired
45
+    private SysDeptMapper sysDeptMapper;
37 46
 
38 47
 
39 48
 
@@ -52,7 +61,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
52 61
         //根据仲裁费用计费规则计算应缴费用
53 62
         //暂时设置计费比率为0.01
54 63
         BigDecimal feeRate = new BigDecimal(0.01);
55
-        BigDecimal feePayable  = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2,BigDecimal.ROUND_HALF_UP);
64
+        BigDecimal feePayable = caseApplication.getCaseSubjectAmount().multiply(feeRate).setScale(2, BigDecimal.ROUND_HALF_UP);
56 65
         caseApplication.setFeePayable(feePayable);
57 66
         // 获取自动编码
58 67
         String caseNum = generateCaseNum();
@@ -60,16 +69,43 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
60 69
 
61 70
         int rows = caseApplicationMapper.insertCaseApplication(caseApplication);
62 71
         List<CaseAffiliate> caseAffiliates = caseApplication.getCaseAffiliates();
63
-        if(caseAffiliates!=null&&caseAffiliates.size()>0){
64
-            for (CaseAffiliate caseAffiliate : caseAffiliates){
72
+
73
+        if (caseAffiliates != null && caseAffiliates.size() > 0) {
74
+            // 查询所有的组织机构,组装成map
75
+            List<SysDept> deptList = sysDeptMapper.selectDeptList(new SysDept());
76
+            if (CollectionUtil.isEmpty(deptList)) {
77
+                deptList = new ArrayList<>();
78
+            }
79
+            Map<String, Long> deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId));
80
+
81
+            for (CaseAffiliate caseAffiliate : caseAffiliates) {
65 82
                 caseAffiliate.setCaseAppliId(caseApplication.getId());
83
+                // 将组织机构id设为申请人名称
84
+                if (deptMap.containsKey(caseApplication.getName())) {
85
+                    caseAffiliate.setName(String.valueOf(deptMap.get(caseApplication.getName())));
86
+                } else {
87
+                    // 如果不存在则新增
88
+                    SysDept dept = new SysDept();
89
+                    dept.setParentId(0L);
90
+                    dept.setDeptName(caseApplication.getName());
91
+                    dept.setAncestors("0");
92
+                    dept.setOrderNum(1);
93
+                    dept.setStatus("0");
94
+                    dept.setDelFlag("0");
95
+                    dept.setCreateBy(getUsername());
96
+                    dept.setUpdateBy(getUsername());
97
+                    sysDeptMapper.insertDept(dept);
98
+                    caseAffiliate.setName(String.valueOf(dept.getDeptId()));
99
+
100
+                }
66 101
             }
102
+
67 103
             caseAffiliateMapper.batchCaseAffiliate(caseAffiliates);
68 104
         }
69 105
 
70 106
         List<CaseAttach> caseAttachList = caseApplication.getCaseAttachList();
71
-        if(caseAttachList!=null&&caseAttachList.size()>0){
72
-            for (CaseAttach caseAttach : caseAttachList){
107
+        if (caseAttachList != null && caseAttachList.size() > 0) {
108
+            for (CaseAttach caseAttach : caseAttachList) {
73 109
                 caseAttach.setCaseAppliId(caseApplication.getId());
74 110
                 caseAttachMapper.updateCaseAttach(caseAttach);
75 111
             }
@@ -213,6 +249,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
213 249
         int successNum = 0;
214 250
         int failureNum = 0;
215 251
         if(caseApplicationList!=null&&caseApplicationList.size()>0){
252
+            // 1,查询所有的组织机构,组装成map
253
+            List<SysDept> deptList = sysDeptMapper.selectDeptList(new SysDept());
216 254
             List<CaseApplication> caseApplicationListinsert = new ArrayList<>();
217 255
             for (int i = 0; i < caseApplicationList.size(); i++){
218 256
                 CaseApplication caseApplication = caseApplicationList.get(i);
@@ -224,7 +262,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
224 262
 
225 263
                 //赋值CaseApplication的案件关联人信息
226 264
                 List<CaseAffiliate> caseAffiliatesnew  = new ArrayList<>();
227
-                assignmentCaseAffiliates(caseApplication,caseAffiliatesnew);
265
+                // 组装案件关联人信息
266
+                assignmentCaseAffiliates(caseApplication,caseAffiliatesnew,deptList);
228 267
 
229 268
 //                int caseApplicationCount = selectCaseApplicationCount(caseApplication);
230 269
 //                if(caseApplicationCount>0){
@@ -415,6 +454,32 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
415 454
         return caseApplicationselect;
416 455
     }
417 456
 
457
+    /**
458
+     * 给被申请人发送房间号短信
459
+     * @param messageVO
460
+     * @return
461
+     */
462
+    @Override
463
+    public String sendRoomNoMessage(SendRoomNoMessageVO messageVO) {
464
+        Arbitrator arbitrator = arbitratorMapper.selectArbitratorById(messageVO.getId(), 2);
465
+        if(null==arbitrator){
466
+            return "被申请人不存在";
467
+        }
468
+        CaseApplication caseApplication = new CaseApplication();
469
+        caseApplication.setId(messageVO.getId());
470
+        CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
471
+
472
+        //发送短信通知
473
+        SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
474
+        request.setTemplateId("1948332");
475
+        // 1948332 普通短信 开庭审理房间号通知 尊敬的{1}用户,您的{2}仲裁案件,开庭审理房间号为{3},请知晓,如非本人操作,请忽略本短信。
476
+        request.setPhone(arbitrator.getTelephone());
477
+        request.setTemplateParamSet(new String[]{arbitrator.getArbitratorName(), caseApplicationselect.getCaseNum(), messageVO.getRoomNo()});
478
+
479
+
480
+        return "短信发送成功";
481
+    }
482
+
418 483
     @Override
419 484
     @Transactional
420 485
     public int pendTralSure(CaseApplication caseApplication) {
@@ -509,12 +574,15 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
509 574
 
510 575
 
511 576
 
512
-    private void assignmentCaseAffiliates(CaseApplication caseApplication, List<CaseAffiliate> caseAffiliatesnew) {
577
+    private void assignmentCaseAffiliates(CaseApplication caseApplication, List<CaseAffiliate> caseAffiliatesnew,List<SysDept> deptList) {
578
+       // 申请人信息
513 579
         CaseAffiliate caseAffiliate = new CaseAffiliate();
514 580
 
515 581
 //        BeanUtils.copyBeanProp(caseApplication,caseAffiliate);
516 582
         BeanUtils.copyBeanProp(caseAffiliate,caseApplication);
517 583
         caseAffiliate.setIdentityType(1);
584
+        // 申请人(机构),需要判断部门中是否存在,不存在则新增,当身份类型为1的时候,查询时需要根据名称查询组织机构
585
+        setApplicantOrganization(caseAffiliate,caseApplication,deptList);
518 586
         caseAffiliatesnew.add(caseAffiliate);
519 587
 
520 588
         // 组装被申请人信息
@@ -522,6 +590,40 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
522 590
         caseApplication.setCaseAffiliates(caseAffiliatesnew);
523 591
     }
524 592
 
593
+    /**
594
+     * 设置申请人的组织机构
595
+     * @param caseAffiliate
596
+     * @param caseApplication
597
+     */
598
+    @DataScope(deptAlias = "d")
599
+    private void setApplicantOrganization(CaseAffiliate caseAffiliate, CaseApplication caseApplication,  List<SysDept> deptList ) {
600
+
601
+        if(CollectionUtil.isNotEmpty(deptList)){
602
+            Map<String, Long> deptMap = deptList.stream().collect(Collectors.toMap(SysDept::getDeptName, SysDept::getDeptId));
603
+            // 将组织机构id设为申请人名称
604
+            if(deptMap.containsKey(caseApplication.getName())){
605
+                caseAffiliate.setName(String.valueOf(deptMap.get(caseApplication.getName())));
606
+            }else {
607
+               // 如果不存在则新增
608
+                SysDept dept = new SysDept();
609
+                dept.setParentId(0L);
610
+                dept.setDeptName(caseApplication.getName());
611
+                dept.setAncestors("0");
612
+                dept.setOrderNum(1);
613
+                dept.setStatus("0");
614
+                dept.setDelFlag("0");
615
+                dept.setCreateBy(getUsername());
616
+                dept.setUpdateBy(getUsername());
617
+                sysDeptMapper.insertDept(dept);
618
+                caseAffiliate.setName(String.valueOf(dept.getDeptId()));
619
+
620
+            }
621
+        }
622
+
623
+
624
+
625
+    }
626
+
525 627
     /**
526 628
      * 组装被申请人信息
527 629
      * @param caseApplication

+ 2
- 2
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml Voir le fichier

@@ -87,7 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
87 87
 		where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
88 88
 	</select>
89 89
     
90
-    <insert id="insertDept" parameterType="SysDept">
90
+    <insert id="insertDept" parameterType="SysDept" useGeneratedKeys="true" keyColumn="dept_id" keyProperty="deptId">
91 91
  		insert into sys_dept(
92 92
  			<if test="deptId != null and deptId != 0">dept_id,</if>
93 93
  			<if test="parentId != null and parentId != 0">parent_id,</if>
@@ -112,7 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
112 112
  			<if test="status != null">#{status},</if>
113 113
  			<if test="createBy != null and createBy != ''">#{createBy},</if>
114 114
  			sysdate()
115
- 		)
115
+ 		);
116 116
 	</insert>
117 117
 	
118 118
 	<update id="updateDept" parameterType="SysDept">

+ 13
- 14
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/ArbitratorMapper.xml Voir le fichier

@@ -36,22 +36,21 @@
36 36
 
37 37
         </where>
38 38
     </select>
39
+    <select id="selectArbitratorById" resultMap="ArbitratorResult">
40
+        select a.id ,a.arbitrator_name ,a.title ,a.career ,a.professi_classifi ,
41
+        a.education ,a.area ,a.telephone ,a.current_case_num ,a.closed_case_num
42
+        from arbitrator a
43
+        <where>
44
+            <if test="caseAppliId != null and caseAppliId != ''">
45
+                AND ca.ase_appliId=#{caseAppliId}
46
+            </if>
39 47
 
48
+            <if test="identityType != null and identityType != ''">
49
+                a.identity_type=#{identityType}
50
+            </if>
40 51
 
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
-
53
-
54
-
52
+        </where>
53
+    </select>
55 54
 
56 55
 
57 56
 </mapper>

+ 6
- 1
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml Voir le fichier

@@ -55,8 +55,10 @@
55 55
         c.hear_date ,c.arbitrat_claims ,
56 56
         c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag ,c.fee_payable ,
57 57
         c.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time ,
58
-        c.update_by ,c.update_time , c.arbitrator_name
58
+        c.update_by ,c.update_time , c.arbitrator_name,d.dept_name as name
59 59
         from case_application c
60
+        LEFT JOIN case_affiliate ca ON ca.case_appli_id = c.id and ca.identity_type=1
61
+        LEFT JOIN sys_dept d ON ca.NAME = d.dept_id
60 62
         <where>
61 63
             <if test="caseStatus != null">
62 64
                 AND c.case_status = #{caseStatus}
@@ -64,6 +66,9 @@
64 66
             <if test="caseNum != null and caseNum != ''">
65 67
                 AND c.case_num = #{caseNum}
66 68
             </if>
69
+            <if test="name != null and name != ''">
70
+                AND d.dept_name like CONCAT( '%',#{name},'%')  AND ca.identity_type=1 and ca.name=d.dept_id
71
+            </if>
67 72
             <if test="caseStatusList != null and caseStatusList.size() > 0">
68 73
                 and c.case_status in
69 74
                 <foreach item="caseStatus" collection="caseStatusList" open="(" separator="," close=")">