Explorar el Código

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

wangqiong123 hace 2 años
padre
commit
9a59fac610

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

@@ -7,6 +7,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
7 7
 import com.ruoyi.common.core.page.TableDataInfo;
8 8
 import com.ruoyi.common.enums.BusinessType;
9 9
 import com.ruoyi.common.exception.EsignDemoException;
10
+import com.ruoyi.common.utils.WxAppletNotifyUtils;
10 11
 import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
11 12
 import com.ruoyi.wisdomarbitrate.domain.SealSignRecord;
12 13
 import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO;
@@ -232,5 +233,14 @@ public class CaseApplicationController extends BaseController {
232 233
         String result = caseApplicationService.sendRoomNoMessage(messageVO);
233 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 Ver fichero

@@ -0,0 +1,72 @@
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 Ver fichero

@@ -4,14 +4,22 @@ package com.ruoyi.wisdomarbitrate.service.impl;
4 4
 import cn.hutool.core.collection.CollectionUtil;
5 5
 import cn.hutool.core.util.StrUtil;
6 6
 
7
+
8
+import com.alibaba.fastjson.JSONArray;
9
+import com.alibaba.fastjson.JSONObject;
7 10
 import com.google.gson.Gson;
11
+import com.google.gson.JsonArray;
8 12
 import com.google.gson.JsonObject;
9 13
 import com.ruoyi.common.annotation.DataScope;
10 14
 import com.ruoyi.common.constant.CaseApplicationConstants;
11 15
 import com.ruoyi.common.core.domain.entity.EsignHttpResponse;
12 16
 import com.ruoyi.common.core.domain.entity.SysDept;
17
+
18
+
19
+import com.ruoyi.common.core.domain.entity.SysUser;
13 20
 import com.ruoyi.common.exception.EsignDemoException;
14 21
 import com.ruoyi.common.exception.ServiceException;
22
+import com.ruoyi.system.mapper.SysUserMapper;
15 23
 import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
16 24
 import com.ruoyi.common.utils.DateUtils;
17 25
 import com.ruoyi.common.utils.SmsUtils;
@@ -26,6 +34,8 @@ import com.ruoyi.wisdomarbitrate.utils.SignAward;
26 34
 import org.springframework.beans.factory.annotation.Autowired;
27 35
 import org.springframework.stereotype.Service;
28 36
 import org.springframework.transaction.annotation.Transactional;
37
+
38
+import java.io.File;
29 39
 import java.math.BigDecimal;
30 40
 import java.text.SimpleDateFormat;
31 41
 import java.util.*;
@@ -52,7 +62,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
52 62
     private CaseAttachMapper caseAttachMapper;
53 63
     @Autowired
54 64
     private SysDeptMapper sysDeptMapper;
55
-
65
+    @Autowired
66
+    private ICaseApplicationService caseApplicationService;
67
+    @Autowired
68
+    private SysUserMapper sysUserMapper;
56 69
     @Autowired
57 70
     private SealSignRecordMapper sealSignRecordMapper;
58 71
     // 手机号正则
@@ -95,7 +108,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
95 108
                 caseAffiliate.setCaseAppliId(caseApplication.getId());
96 109
                 if(caseAffiliate.getIdentityType()==1&&StrUtil.isNotEmpty(caseAffiliate.getName())) {
97 110
                     // 将组织机构id设为申请人名称
98
-                    if (deptMap.containsKey(caseApplication.getName())) {
111
+                    if (deptMap.containsKey(caseAffiliate.getName())) {
99 112
                         caseAffiliate.setName(String.valueOf(deptMap.get(caseAffiliate.getName())));
100 113
                     } else {
101 114
                         // 如果不存在则新增
@@ -178,7 +191,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
178 191
                 caseAffiliate.setCaseAppliId(caseApplication.getId());
179 192
                 if(caseAffiliate.getIdentityType()==1&&StrUtil.isNotEmpty(caseAffiliate.getName())) {
180 193
                     // 将组织机构id设为申请人名称
181
-                    if (deptMap.containsKey(caseApplication.getName())) {
194
+                    if (deptMap.containsKey(caseAffiliate.getName())) {
182 195
                         caseAffiliate.setName(String.valueOf(deptMap.get(caseAffiliate.getName())));
183 196
                     } else {
184 197
                         // 如果不存在则新增
@@ -662,6 +675,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
662 675
             rows = caseApplicationMapper.submitCaseApplication(caseApplication);
663 676
         }else {
664 677
             List<Arbitrator> arbitrators = caseApplication.getArbitrators();
678
+            // 仲裁员信息
665 679
             if(arbitrators!=null&&arbitrators.size()>0){
666 680
                 List<Long> ids = arbitrators.stream().map(Arbitrator::getId).collect(Collectors.toList());
667 681
                 List<String> arbitratorNames = arbitrators.stream().map(Arbitrator::getArbitratorName).collect(Collectors.toList());
@@ -849,27 +863,27 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
849 863
         String hearDatestr = dateFormat.format(hearDate);
850 864
 
851 865
         String arbitratorId = caseApplicationselect.getArbitratorId();
852
-        List<Arbitrator> arbitratorList = new ArrayList<>();
866
+//        List<Arbitrator> arbitratorList = new ArrayList<>();
853 867
         if(StringUtils.isNotEmpty(arbitratorId)){
854 868
             String[] idStrList  = arbitratorId.split(",");
855 869
             List<Long> idList = new ArrayList<>();
856 870
             for(int i = 0;i < idStrList.length;i ++ ){
857 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 889
         CaseAffiliate caseAffiliate = new CaseAffiliate();
@@ -891,7 +905,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
891 905
                     if(StrUtil.isNotEmpty(caseAffiliateselect.getName())&&deptMap.containsKey(caseAffiliateselect.getName())){
892 906
                         caseAffiliateselect.setName(deptMap.get(caseAffiliateselect.getName()));
893 907
                     }
894
-                    caseAffiliateselect.setName(caseAffiliateselect.getName());;
908
+
895 909
                 }
896 910
                 //给申请人、被申请人发送短信通知
897 911
                 request.setPhone(caseAffiliateselect.getContactTelphone());