Browse Source

案件导入修改

18792927508 2 years ago
parent
commit
62f1e3111d

+ 10
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java View File

8
 import com.ruoyi.common.utils.SecurityUtils;
8
 import com.ruoyi.common.utils.SecurityUtils;
9
 import com.ruoyi.common.utils.StringUtils;
9
 import com.ruoyi.common.utils.StringUtils;
10
 import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
10
 import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
11
+import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO;
11
 import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
12
 import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
12
 import org.apache.commons.lang3.ArrayUtils;
13
 import org.apache.commons.lang3.ArrayUtils;
13
 import org.springframework.beans.factory.annotation.Autowired;
14
 import org.springframework.beans.factory.annotation.Autowired;
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 View File

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

+ 0
- 29
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/CaseLogVO.java View File

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 View File

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 View File

1
 package com.ruoyi.wisdomarbitrate.mapper;
1
 package com.ruoyi.wisdomarbitrate.mapper;
2
 
2
 
3
 import com.ruoyi.wisdomarbitrate.domain.Arbitrator;
3
 import com.ruoyi.wisdomarbitrate.domain.Arbitrator;
4
+import org.apache.ibatis.annotations.Param;
4
 
5
 
5
 import java.util.List;
6
 import java.util.List;
6
 
7
 
7
 public interface ArbitratorMapper {
8
 public interface ArbitratorMapper {
8
     List<Arbitrator> selectArbitratorList(Arbitrator arbitrator);
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 View File

1
 package com.ruoyi.wisdomarbitrate.service;
1
 package com.ruoyi.wisdomarbitrate.service;
2
 
2
 
3
 import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
3
 import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
4
+import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO;
4
 
5
 
5
 import java.util.List;
6
 import java.util.List;
6
 
7
 
37
     int submitCaseApplicationCheck(CaseApplication caseApplication);
38
     int submitCaseApplicationCheck(CaseApplication caseApplication);
38
 
39
 
39
     CaseApplication selectCaseApplicationConfirm(CaseApplication caseApplication);
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 View File

1
 package com.ruoyi.wisdomarbitrate.service.impl;
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
 import com.ruoyi.common.constant.CaseApplicationConstants;
6
 import com.ruoyi.common.constant.CaseApplicationConstants;
7
+import com.ruoyi.common.core.domain.entity.SysDept;
5
 import com.ruoyi.common.exception.ServiceException;
8
 import com.ruoyi.common.exception.ServiceException;
6
 import com.ruoyi.common.utils.DateUtils;
9
 import com.ruoyi.common.utils.DateUtils;
7
 import com.ruoyi.common.utils.SmsUtils;
10
 import com.ruoyi.common.utils.SmsUtils;
8
 import com.ruoyi.common.utils.StringUtils;
11
 import com.ruoyi.common.utils.StringUtils;
9
 import com.ruoyi.common.utils.bean.BeanUtils;
12
 import com.ruoyi.common.utils.bean.BeanUtils;
13
+import com.ruoyi.system.mapper.SysDeptMapper;
10
 import com.ruoyi.wisdomarbitrate.domain.*;
14
 import com.ruoyi.wisdomarbitrate.domain.*;
15
+import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO;
11
 import com.ruoyi.wisdomarbitrate.mapper.*;
16
 import com.ruoyi.wisdomarbitrate.mapper.*;
12
 import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
17
 import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
13
 import org.springframework.beans.factory.annotation.Autowired;
18
 import org.springframework.beans.factory.annotation.Autowired;
18
 import java.util.*;
23
 import java.util.*;
19
 import java.util.stream.Collectors;
24
 import java.util.stream.Collectors;
20
 
25
 
26
+import static com.ruoyi.common.utils.SecurityUtils.getUsername;
27
+
21
 
28
 
22
 @Service
29
 @Service
23
 public class CaseApplicationServiceImpl implements ICaseApplicationService {
30
 public class CaseApplicationServiceImpl implements ICaseApplicationService {
34
 
41
 
35
     @Autowired
42
     @Autowired
36
     private CaseAttachMapper caseAttachMapper;
43
     private CaseAttachMapper caseAttachMapper;
44
+    @Autowired
45
+    private SysDeptMapper sysDeptMapper;
37
 
46
 
38
 
47
 
39
 
48
 
52
         //根据仲裁费用计费规则计算应缴费用
61
         //根据仲裁费用计费规则计算应缴费用
53
         //暂时设置计费比率为0.01
62
         //暂时设置计费比率为0.01
54
         BigDecimal feeRate = new BigDecimal(0.01);
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
         caseApplication.setFeePayable(feePayable);
65
         caseApplication.setFeePayable(feePayable);
57
         // 获取自动编码
66
         // 获取自动编码
58
         String caseNum = generateCaseNum();
67
         String caseNum = generateCaseNum();
60
 
69
 
61
         int rows = caseApplicationMapper.insertCaseApplication(caseApplication);
70
         int rows = caseApplicationMapper.insertCaseApplication(caseApplication);
62
         List<CaseAffiliate> caseAffiliates = caseApplication.getCaseAffiliates();
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
                 caseAffiliate.setCaseAppliId(caseApplication.getId());
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
             caseAffiliateMapper.batchCaseAffiliate(caseAffiliates);
103
             caseAffiliateMapper.batchCaseAffiliate(caseAffiliates);
68
         }
104
         }
69
 
105
 
70
         List<CaseAttach> caseAttachList = caseApplication.getCaseAttachList();
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
                 caseAttach.setCaseAppliId(caseApplication.getId());
109
                 caseAttach.setCaseAppliId(caseApplication.getId());
74
                 caseAttachMapper.updateCaseAttach(caseAttach);
110
                 caseAttachMapper.updateCaseAttach(caseAttach);
75
             }
111
             }
213
         int successNum = 0;
249
         int successNum = 0;
214
         int failureNum = 0;
250
         int failureNum = 0;
215
         if(caseApplicationList!=null&&caseApplicationList.size()>0){
251
         if(caseApplicationList!=null&&caseApplicationList.size()>0){
252
+            // 1,查询所有的组织机构,组装成map
253
+            List<SysDept> deptList = sysDeptMapper.selectDeptList(new SysDept());
216
             List<CaseApplication> caseApplicationListinsert = new ArrayList<>();
254
             List<CaseApplication> caseApplicationListinsert = new ArrayList<>();
217
             for (int i = 0; i < caseApplicationList.size(); i++){
255
             for (int i = 0; i < caseApplicationList.size(); i++){
218
                 CaseApplication caseApplication = caseApplicationList.get(i);
256
                 CaseApplication caseApplication = caseApplicationList.get(i);
224
 
262
 
225
                 //赋值CaseApplication的案件关联人信息
263
                 //赋值CaseApplication的案件关联人信息
226
                 List<CaseAffiliate> caseAffiliatesnew  = new ArrayList<>();
264
                 List<CaseAffiliate> caseAffiliatesnew  = new ArrayList<>();
227
-                assignmentCaseAffiliates(caseApplication,caseAffiliatesnew);
265
+                // 组装案件关联人信息
266
+                assignmentCaseAffiliates(caseApplication,caseAffiliatesnew,deptList);
228
 
267
 
229
 //                int caseApplicationCount = selectCaseApplicationCount(caseApplication);
268
 //                int caseApplicationCount = selectCaseApplicationCount(caseApplication);
230
 //                if(caseApplicationCount>0){
269
 //                if(caseApplicationCount>0){
415
         return caseApplicationselect;
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
     @Override
483
     @Override
419
     @Transactional
484
     @Transactional
420
     public int pendTralSure(CaseApplication caseApplication) {
485
     public int pendTralSure(CaseApplication caseApplication) {
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
         CaseAffiliate caseAffiliate = new CaseAffiliate();
579
         CaseAffiliate caseAffiliate = new CaseAffiliate();
514
 
580
 
515
 //        BeanUtils.copyBeanProp(caseApplication,caseAffiliate);
581
 //        BeanUtils.copyBeanProp(caseApplication,caseAffiliate);
516
         BeanUtils.copyBeanProp(caseAffiliate,caseApplication);
582
         BeanUtils.copyBeanProp(caseAffiliate,caseApplication);
517
         caseAffiliate.setIdentityType(1);
583
         caseAffiliate.setIdentityType(1);
584
+        // 申请人(机构),需要判断部门中是否存在,不存在则新增,当身份类型为1的时候,查询时需要根据名称查询组织机构
585
+        setApplicantOrganization(caseAffiliate,caseApplication,deptList);
518
         caseAffiliatesnew.add(caseAffiliate);
586
         caseAffiliatesnew.add(caseAffiliate);
519
 
587
 
520
         // 组装被申请人信息
588
         // 组装被申请人信息
522
         caseApplication.setCaseAffiliates(caseAffiliatesnew);
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
      * @param caseApplication
629
      * @param caseApplication

+ 2
- 2
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml View File

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

+ 13
- 14
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/ArbitratorMapper.xml View File

36
 
36
 
37
         </where>
37
         </where>
38
     </select>
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
 </mapper>
56
 </mapper>

+ 6
- 1
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/CaseApplicationMapper.xml View File

55
         c.hear_date ,c.arbitrat_claims ,
55
         c.hear_date ,c.arbitrat_claims ,
56
         c.loan_start_date ,c.loan_end_date ,c.claim_princi_owed ,c.claim_interest_owed ,c.claim_liquid_damag ,c.fee_payable ,
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
         c.begin_video_date ,c.online_video_person ,c.contract_number ,c.create_by ,c.create_time ,
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
         from case_application c
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
         <where>
62
         <where>
61
             <if test="caseStatus != null">
63
             <if test="caseStatus != null">
62
                 AND c.case_status = #{caseStatus}
64
                 AND c.case_status = #{caseStatus}
64
             <if test="caseNum != null and caseNum != ''">
66
             <if test="caseNum != null and caseNum != ''">
65
                 AND c.case_num = #{caseNum}
67
                 AND c.case_num = #{caseNum}
66
             </if>
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
             <if test="caseStatusList != null and caseStatusList.size() > 0">
72
             <if test="caseStatusList != null and caseStatusList.size() > 0">
68
                 and c.case_status in
73
                 and c.case_status in
69
                 <foreach item="caseStatus" collection="caseStatusList" open="(" separator="," close=")">
74
                 <foreach item="caseStatus" collection="caseStatusList" open="(" separator="," close=")">