From f20736282b29912b46cca4fd32be35099645b683 Mon Sep 17 00:00:00 2001 From: 18792927508 <1322446236@qq.com> Date: Fri, 13 Oct 2023 14:35:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E4=BB=A3=E7=A0=81=E5=8F=8A?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E5=B0=8F=E7=A8=8B=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CaseApplicationController.java | 10 +++ .../common/utils/WxAppletNotifyUtils.java | 72 +++++++++++++++++++ .../impl/CaseApplicationServiceImpl.java | 52 +++++++++----- 3 files changed, 115 insertions(+), 19 deletions(-) create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/utils/WxAppletNotifyUtils.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java index f121306..5bc1f92 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java @@ -7,6 +7,7 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.exception.EsignDemoException; +import com.ruoyi.common.utils.WxAppletNotifyUtils; import com.ruoyi.wisdomarbitrate.domain.CaseApplication; import com.ruoyi.wisdomarbitrate.domain.SealSignRecord; import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO; @@ -232,5 +233,14 @@ public class CaseApplicationController extends BaseController { String result = caseApplicationService.sendRoomNoMessage(messageVO); return success(result); } + /** + * 获取UrlScheme + */ + @Anonymous + @PostMapping("/getUrlScheme") + public AjaxResult getUrlScheme() { + String schemeUrl = WxAppletNotifyUtils.jumpAppletSchemeUrl(); + return success(schemeUrl); + } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/WxAppletNotifyUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/WxAppletNotifyUtils.java new file mode 100644 index 0000000..9e906c6 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/WxAppletNotifyUtils.java @@ -0,0 +1,72 @@ +package com.ruoyi.common.utils; + +/** + * @author wangqiong + * @description + * @date 2023-10-13 10:16 + */ +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + + +/** + * @Author: Tenk + */ +@RequiredArgsConstructor +@Component +public class WxAppletNotifyUtils { + + /** + * scheme 跳转微信小程序,需中转H5 + + */ + public static String jumpAppletSchemeUrl(){ + + String token= getAccessToken(); + + //接口地址 + String url = "https://api.weixin.qq.com/wxa/generatescheme?access_token="+token; + JSONObject body = JSONUtil.createObj(); + JSONObject jumpWxa = JSONUtil.createObj(); + jumpWxa.putOpt("path","pages/login"); + jumpWxa.putOpt("query",""); + jumpWxa.putOpt("env_version","release"); + body.putOpt("jump_wxa",jumpWxa); + //链接过期类型:0时间戳 1间隔天数 + body.putOpt("expire_type",1); + body.putOpt("is_expire",true); + //指定失效天数,最多30 + body.putOpt("expire_interval",30); + String post = HttpUtil.post(url,body.toJSONString(2)); + JSONObject result = JSONUtil.parseObj(post); + if(result!=null){ + result.getStr("openlink"); + } + return null; + } + + + //凭证调用 + public static String getAccessToken(){ + String token; + //小程序APPID + String appid="wx91cb8459dca561b4";//自行获取 + //小程序secret + String secret="190aaa3bda96a65d25318fbb0e133fc6";//自己去公众号后台获取 + String httpUrl="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential"; + + httpUrl= httpUrl+"&appid="+appid+"&secret="+secret; + //get请求 + String result = HttpUtil.get(httpUrl); + //解析结果 + JSONObject jsonObject = JSONUtil.parseObj(result); + //get AccessToken + token=jsonObject.get("access_token",String.class,false); + return token; + } + +} \ No newline at end of file diff --git a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java index 9723a15..82555fe 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java @@ -4,14 +4,22 @@ package com.ruoyi.wisdomarbitrate.service.impl; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.StrUtil; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.google.gson.Gson; +import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.constant.CaseApplicationConstants; import com.ruoyi.common.core.domain.entity.EsignHttpResponse; import com.ruoyi.common.core.domain.entity.SysDept; + + +import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.exception.EsignDemoException; import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.SmsUtils; @@ -26,6 +34,8 @@ import com.ruoyi.wisdomarbitrate.utils.SignAward; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; + +import java.io.File; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.*; @@ -52,7 +62,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { private CaseAttachMapper caseAttachMapper; @Autowired private SysDeptMapper sysDeptMapper; - + @Autowired + private ICaseApplicationService caseApplicationService; + @Autowired + private SysUserMapper sysUserMapper; @Autowired private SealSignRecordMapper sealSignRecordMapper; // 手机号正则 @@ -95,7 +108,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseAffiliate.setCaseAppliId(caseApplication.getId()); if(caseAffiliate.getIdentityType()==1&&StrUtil.isNotEmpty(caseAffiliate.getName())) { // 将组织机构id设为申请人名称 - if (deptMap.containsKey(caseApplication.getName())) { + if (deptMap.containsKey(caseAffiliate.getName())) { caseAffiliate.setName(String.valueOf(deptMap.get(caseAffiliate.getName()))); } else { // 如果不存在则新增 @@ -178,7 +191,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { caseAffiliate.setCaseAppliId(caseApplication.getId()); if(caseAffiliate.getIdentityType()==1&&StrUtil.isNotEmpty(caseAffiliate.getName())) { // 将组织机构id设为申请人名称 - if (deptMap.containsKey(caseApplication.getName())) { + if (deptMap.containsKey(caseAffiliate.getName())) { caseAffiliate.setName(String.valueOf(deptMap.get(caseAffiliate.getName()))); } else { // 如果不存在则新增 @@ -662,6 +675,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { rows = caseApplicationMapper.submitCaseApplication(caseApplication); }else { List arbitrators = caseApplication.getArbitrators(); + // 仲裁员信息 if(arbitrators!=null&&arbitrators.size()>0){ List ids = arbitrators.stream().map(Arbitrator::getId).collect(Collectors.toList()); List arbitratorNames = arbitrators.stream().map(Arbitrator::getArbitratorName).collect(Collectors.toList()); @@ -849,27 +863,27 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { String hearDatestr = dateFormat.format(hearDate); String arbitratorId = caseApplicationselect.getArbitratorId(); - List arbitratorList = new ArrayList<>(); +// List arbitratorList = new ArrayList<>(); if(StringUtils.isNotEmpty(arbitratorId)){ String[] idStrList = arbitratorId.split(","); List idList = new ArrayList<>(); for(int i = 0;i < idStrList.length;i ++ ){ idList.add(Long.parseLong(idStrList[i])); } - Arbitrator arbitrator = new Arbitrator(); - arbitrator.setIdList(idList); - arbitratorList = arbitratorMapper.selectArbitratorList(arbitrator); - if(arbitratorList!=null) { - for (int i = 0; i < arbitratorList.size(); i++) { - Arbitrator arbitratorselect = arbitratorList.get(i); - //给仲裁员发送短信通知 - request.setPhone(arbitratorselect.getTelephone()); - // 1947342 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。 - String name = arbitratorselect.getArbitratorName(); - request.setTemplateParamSet(new String[]{name, caseNum, hearDatestr}); - SmsUtils.sendSms(request); - } - } + // 查询仲裁员电话号 + List userList= sysUserMapper.selectUserListByIds(idList); + if(CollectionUtil.isNotEmpty(userList)) { + for (SysUser user : userList) { + //给仲裁员发送短信通知 + request.setPhone(user.getPhonenumber()); + // 1947342 普通短信 开庭日期通知 尊敬的{1}用户,您的{2}仲裁案件,开庭日期已确定为{3},请知晓,如非本人操作,请忽略本短信。 + String name = user.getNickName(); + request.setTemplateParamSet(new String[]{name, caseNum, hearDatestr}); + SmsUtils.sendSms(request); + + } + } + } CaseAffiliate caseAffiliate = new CaseAffiliate(); @@ -891,7 +905,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService { if(StrUtil.isNotEmpty(caseAffiliateselect.getName())&&deptMap.containsKey(caseAffiliateselect.getName())){ caseAffiliateselect.setName(deptMap.get(caseAffiliateselect.getName())); } - caseAffiliateselect.setName(caseAffiliateselect.getName());; + } //给申请人、被申请人发送短信通知 request.setPhone(caseAffiliateselect.getContactTelphone()); -- 2.54.0