Bläddra i källkod

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

wangqiong123 2 år sedan
förälder
incheckning
9a59fac610

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

7
 import com.ruoyi.common.core.page.TableDataInfo;
7
 import com.ruoyi.common.core.page.TableDataInfo;
8
 import com.ruoyi.common.enums.BusinessType;
8
 import com.ruoyi.common.enums.BusinessType;
9
 import com.ruoyi.common.exception.EsignDemoException;
9
 import com.ruoyi.common.exception.EsignDemoException;
10
+import com.ruoyi.common.utils.WxAppletNotifyUtils;
10
 import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
11
 import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
11
 import com.ruoyi.wisdomarbitrate.domain.SealSignRecord;
12
 import com.ruoyi.wisdomarbitrate.domain.SealSignRecord;
12
 import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO;
13
 import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO;
232
         String result = caseApplicationService.sendRoomNoMessage(messageVO);
233
         String result = caseApplicationService.sendRoomNoMessage(messageVO);
233
         return success(result);
234
         return success(result);
234
     }
235
     }
236
+    /**
237
+     * 获取UrlScheme
238
+     */
239
+    @Anonymous
240
+    @PostMapping("/getUrlScheme")
241
+    public AjaxResult getUrlScheme() {
242
+        String schemeUrl = WxAppletNotifyUtils.jumpAppletSchemeUrl();
243
+        return success(schemeUrl);
244
+    }
235
 
245
 
236
 }
246
 }

+ 72
- 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/WxAppletNotifyUtils.java Visa fil

1
+package com.ruoyi.common.utils;
2
+
3
+/**
4
+ * @author wangqiong
5
+ * @description
6
+ * @date 2023-10-13 10:16
7
+ */
8
+import cn.hutool.core.util.StrUtil;
9
+import cn.hutool.http.HttpUtil;
10
+import cn.hutool.json.JSONObject;
11
+import cn.hutool.json.JSONUtil;
12
+import lombok.RequiredArgsConstructor;
13
+import org.springframework.stereotype.Component;
14
+
15
+
16
+/**
17
+ * @Author: Tenk
18
+ */
19
+@RequiredArgsConstructor
20
+@Component
21
+public class WxAppletNotifyUtils {
22
+
23
+    /**
24
+     * scheme 跳转微信小程序,需中转H5
25
+
26
+     */
27
+    public static String jumpAppletSchemeUrl(){
28
+
29
+         String  token= getAccessToken();
30
+
31
+        //接口地址
32
+        String url = "https://api.weixin.qq.com/wxa/generatescheme?access_token="+token;
33
+        JSONObject body = JSONUtil.createObj();
34
+        JSONObject jumpWxa = JSONUtil.createObj();
35
+        jumpWxa.putOpt("path","pages/login");
36
+        jumpWxa.putOpt("query","");
37
+        jumpWxa.putOpt("env_version","release");
38
+        body.putOpt("jump_wxa",jumpWxa);
39
+        //链接过期类型:0时间戳 1间隔天数
40
+        body.putOpt("expire_type",1);
41
+        body.putOpt("is_expire",true);
42
+        //指定失效天数,最多30
43
+        body.putOpt("expire_interval",30);
44
+        String post = HttpUtil.post(url,body.toJSONString(2));
45
+        JSONObject result = JSONUtil.parseObj(post);
46
+        if(result!=null){
47
+            result.getStr("openlink");
48
+        }
49
+        return null;
50
+    }
51
+
52
+
53
+    //凭证调用
54
+    public static String getAccessToken(){
55
+        String token;
56
+        //小程序APPID
57
+        String appid="wx91cb8459dca561b4";//自行获取
58
+        //小程序secret
59
+        String secret="190aaa3bda96a65d25318fbb0e133fc6";//自己去公众号后台获取
60
+        String httpUrl="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential";
61
+
62
+        httpUrl= httpUrl+"&appid="+appid+"&secret="+secret;
63
+        //get请求
64
+        String result = HttpUtil.get(httpUrl);
65
+        //解析结果
66
+        JSONObject jsonObject = JSONUtil.parseObj(result);
67
+        //get AccessToken
68
+        token=jsonObject.get("access_token",String.class,false);
69
+        return token;
70
+    }
71
+
72
+}

+ 33
- 19
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java Visa fil

4
 import cn.hutool.core.collection.CollectionUtil;
4
 import cn.hutool.core.collection.CollectionUtil;
5
 import cn.hutool.core.util.StrUtil;
5
 import cn.hutool.core.util.StrUtil;
6
 
6
 
7
+
8
+import com.alibaba.fastjson.JSONArray;
9
+import com.alibaba.fastjson.JSONObject;
7
 import com.google.gson.Gson;
10
 import com.google.gson.Gson;
11
+import com.google.gson.JsonArray;
8
 import com.google.gson.JsonObject;
12
 import com.google.gson.JsonObject;
9
 import com.ruoyi.common.annotation.DataScope;
13
 import com.ruoyi.common.annotation.DataScope;
10
 import com.ruoyi.common.constant.CaseApplicationConstants;
14
 import com.ruoyi.common.constant.CaseApplicationConstants;
11
 import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
15
 import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
12
 import com.ruoyi.common.core.domain.entity.SysDept;
16
 import com.ruoyi.common.core.domain.entity.SysDept;
17
+
18
+
19
+import com.ruoyi.common.core.domain.entity.SysUser;
13
 import com.ruoyi.common.exception.EsignDemoException;
20
 import com.ruoyi.common.exception.EsignDemoException;
14
 import com.ruoyi.common.exception.ServiceException;
21
 import com.ruoyi.common.exception.ServiceException;
22
+import com.ruoyi.system.mapper.SysUserMapper;
15
 import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
23
 import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
16
 import com.ruoyi.common.utils.DateUtils;
24
 import com.ruoyi.common.utils.DateUtils;
17
 import com.ruoyi.common.utils.SmsUtils;
25
 import com.ruoyi.common.utils.SmsUtils;
26
 import org.springframework.beans.factory.annotation.Autowired;
34
 import org.springframework.beans.factory.annotation.Autowired;
27
 import org.springframework.stereotype.Service;
35
 import org.springframework.stereotype.Service;
28
 import org.springframework.transaction.annotation.Transactional;
36
 import org.springframework.transaction.annotation.Transactional;
37
+
38
+import java.io.File;
29
 import java.math.BigDecimal;
39
 import java.math.BigDecimal;
30
 import java.text.SimpleDateFormat;
40
 import java.text.SimpleDateFormat;
31
 import java.util.*;
41
 import java.util.*;
52
     private CaseAttachMapper caseAttachMapper;
62
     private CaseAttachMapper caseAttachMapper;
53
     @Autowired
63
     @Autowired
54
     private SysDeptMapper sysDeptMapper;
64
     private SysDeptMapper sysDeptMapper;
55
-
65
+    @Autowired
66
+    private ICaseApplicationService caseApplicationService;
67
+    @Autowired
68
+    private SysUserMapper sysUserMapper;
56
     @Autowired
69
     @Autowired
57
     private SealSignRecordMapper sealSignRecordMapper;
70
     private SealSignRecordMapper sealSignRecordMapper;
58
     // 手机号正则
71
     // 手机号正则
95
                 caseAffiliate.setCaseAppliId(caseApplication.getId());
108
                 caseAffiliate.setCaseAppliId(caseApplication.getId());
96
                 if(caseAffiliate.getIdentityType()==1&&StrUtil.isNotEmpty(caseAffiliate.getName())) {
109
                 if(caseAffiliate.getIdentityType()==1&&StrUtil.isNotEmpty(caseAffiliate.getName())) {
97
                     // 将组织机构id设为申请人名称
110
                     // 将组织机构id设为申请人名称
98
-                    if (deptMap.containsKey(caseApplication.getName())) {
111
+                    if (deptMap.containsKey(caseAffiliate.getName())) {
99
                         caseAffiliate.setName(String.valueOf(deptMap.get(caseAffiliate.getName())));
112
                         caseAffiliate.setName(String.valueOf(deptMap.get(caseAffiliate.getName())));
100
                     } else {
113
                     } else {
101
                         // 如果不存在则新增
114
                         // 如果不存在则新增
178
                 caseAffiliate.setCaseAppliId(caseApplication.getId());
191
                 caseAffiliate.setCaseAppliId(caseApplication.getId());
179
                 if(caseAffiliate.getIdentityType()==1&&StrUtil.isNotEmpty(caseAffiliate.getName())) {
192
                 if(caseAffiliate.getIdentityType()==1&&StrUtil.isNotEmpty(caseAffiliate.getName())) {
180
                     // 将组织机构id设为申请人名称
193
                     // 将组织机构id设为申请人名称
181
-                    if (deptMap.containsKey(caseApplication.getName())) {
194
+                    if (deptMap.containsKey(caseAffiliate.getName())) {
182
                         caseAffiliate.setName(String.valueOf(deptMap.get(caseAffiliate.getName())));
195
                         caseAffiliate.setName(String.valueOf(deptMap.get(caseAffiliate.getName())));
183
                     } else {
196
                     } else {
184
                         // 如果不存在则新增
197
                         // 如果不存在则新增
662
             rows = caseApplicationMapper.submitCaseApplication(caseApplication);
675
             rows = caseApplicationMapper.submitCaseApplication(caseApplication);
663
         }else {
676
         }else {
664
             List<Arbitrator> arbitrators = caseApplication.getArbitrators();
677
             List<Arbitrator> arbitrators = caseApplication.getArbitrators();
678
+            // 仲裁员信息
665
             if(arbitrators!=null&&arbitrators.size()>0){
679
             if(arbitrators!=null&&arbitrators.size()>0){
666
                 List<Long> ids = arbitrators.stream().map(Arbitrator::getId).collect(Collectors.toList());
680
                 List<Long> ids = arbitrators.stream().map(Arbitrator::getId).collect(Collectors.toList());
667
                 List<String> arbitratorNames = arbitrators.stream().map(Arbitrator::getArbitratorName).collect(Collectors.toList());
681
                 List<String> arbitratorNames = arbitrators.stream().map(Arbitrator::getArbitratorName).collect(Collectors.toList());
849
         String hearDatestr = dateFormat.format(hearDate);
863
         String hearDatestr = dateFormat.format(hearDate);
850
 
864
 
851
         String arbitratorId = caseApplicationselect.getArbitratorId();
865
         String arbitratorId = caseApplicationselect.getArbitratorId();
852
-        List<Arbitrator> arbitratorList = new ArrayList<>();
866
+//        List<Arbitrator> arbitratorList = new ArrayList<>();
853
         if(StringUtils.isNotEmpty(arbitratorId)){
867
         if(StringUtils.isNotEmpty(arbitratorId)){
854
             String[] idStrList  = arbitratorId.split(",");
868
             String[] idStrList  = arbitratorId.split(",");
855
             List<Long> idList = new ArrayList<>();
869
             List<Long> idList = new ArrayList<>();
856
             for(int i = 0;i < idStrList.length;i ++ ){
870
             for(int i = 0;i < idStrList.length;i ++ ){
857
                 idList.add(Long.parseLong(idStrList[i]));
871
                 idList.add(Long.parseLong(idStrList[i]));
858
             }
872
             }
859
-            Arbitrator arbitrator = new Arbitrator();
860
-            arbitrator.setIdList(idList);
861
-            arbitratorList = arbitratorMapper.selectArbitratorList(arbitrator);
862
-            if(arbitratorList!=null) {
863
-                for (int i = 0; i < arbitratorList.size(); i++) {
864
-                    Arbitrator arbitratorselect = arbitratorList.get(i);
865
-                    //给仲裁员发送短信通知
866
-                    request.setPhone(arbitratorselect.getTelephone());
867
-                    // 1947342 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。
868
-                    String name = arbitratorselect.getArbitratorName();
869
-                    request.setTemplateParamSet(new String[]{name, caseNum, hearDatestr});
870
-                    SmsUtils.sendSms(request);
871
-                }
872
-            }
873
+                    // 查询仲裁员电话号
874
+                 List<SysUser> userList=   sysUserMapper.selectUserListByIds(idList);
875
+                 if(CollectionUtil.isNotEmpty(userList)) {
876
+                     for (SysUser user : userList) {
877
+                     //给仲裁员发送短信通知
878
+                     request.setPhone(user.getPhonenumber());
879
+                     // 1947342 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。
880
+                     String name = user.getNickName();
881
+                     request.setTemplateParamSet(new String[]{name, caseNum, hearDatestr});
882
+                     SmsUtils.sendSms(request);
883
+
884
+                     }
885
+                 }
886
+
873
         }
887
         }
874
 
888
 
875
         CaseAffiliate caseAffiliate = new CaseAffiliate();
889
         CaseAffiliate caseAffiliate = new CaseAffiliate();
891
                     if(StrUtil.isNotEmpty(caseAffiliateselect.getName())&&deptMap.containsKey(caseAffiliateselect.getName())){
905
                     if(StrUtil.isNotEmpty(caseAffiliateselect.getName())&&deptMap.containsKey(caseAffiliateselect.getName())){
892
                         caseAffiliateselect.setName(deptMap.get(caseAffiliateselect.getName()));
906
                         caseAffiliateselect.setName(deptMap.get(caseAffiliateselect.getName()));
893
                     }
907
                     }
894
-                    caseAffiliateselect.setName(caseAffiliateselect.getName());;
908
+
895
                 }
909
                 }
896
                 //给申请人、被申请人发送短信通知
910
                 //给申请人、被申请人发送短信通知
897
                 request.setPhone(caseAffiliateselect.getContactTelphone());
911
                 request.setPhone(caseAffiliateselect.getContactTelphone());