合并代码及跳转小程序

This commit is contained in:
18792927508
2023-10-13 14:35:24 +08:00
parent 08a6e72cc2
commit f20736282b
3 changed files with 115 additions and 19 deletions
@@ -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);
}
}
@@ -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;
}
}
@@ -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<Arbitrator> arbitrators = caseApplication.getArbitrators();
// 仲裁员信息
if(arbitrators!=null&&arbitrators.size()>0){
List<Long> ids = arbitrators.stream().map(Arbitrator::getId).collect(Collectors.toList());
List<String> 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<Arbitrator> arbitratorList = new ArrayList<>();
// List<Arbitrator> arbitratorList = new ArrayList<>();
if(StringUtils.isNotEmpty(arbitratorId)){
String[] idStrList = arbitratorId.split(",");
List<Long> 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<SysUser> 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());