This commit is contained in:
qitz
2023-10-30 20:07:00 +08:00
13 changed files with 550 additions and 94 deletions
@@ -9,6 +9,10 @@ import java.util.List;
public class CaseApplication extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 查询案件时区分是否待办案件,0待办案件,1已办案件
*/
private String selectCaseStatus;
/** ID */
private Long id;
@@ -26,6 +30,14 @@ public class CaseApplication extends BaseEntity {
/** 仲裁方式 */
private Integer arbitratMethod;
public String getSelectCaseStatus() {
return selectCaseStatus;
}
public void setSelectCaseStatus(String selectCaseStatus) {
this.selectCaseStatus = selectCaseStatus;
}
public Integer getArbitratMethod() {
return arbitratMethod;
}
@@ -355,6 +367,10 @@ public class CaseApplication extends BaseEntity {
* 用户id
*/
private String userId;
/**
* 登录用户用户名
*/
private String loginUserName;
private List<Long> deptIds;
/**
* 部门长状态
@@ -365,6 +381,14 @@ public class CaseApplication extends BaseEntity {
*/
private Integer financeStatus;
public String getLoginUserName() {
return loginUserName;
}
public void setLoginUserName(String loginUserName) {
this.loginUserName = loginUserName;
}
public Integer getFinanceStatus() {
return financeStatus;
}
@@ -84,4 +84,24 @@ public interface CaseApplicationMapper {
*/
int batchDeletecaseApplication(@Param("ids") List<Long> ids);
/**
* 绑定房间号
* @param caseId
* @param roomId
*/
void bindCaseId(@Param("caseId")Long caseId,@Param("roomId") String roomId);
/**
* 根据房间号查询案件id
* @param roomId
* @return
*/
Long selectCaseIdByRoomId(@Param("roomId")String roomId);
/**
* 查询已办案件
* @param caseApplication
* @return
*/
List<CaseApplication> selectHandledCase(CaseApplication caseApplication);
}
@@ -0,0 +1,20 @@
package com.ruoyi.wisdomarbitrate.service;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.wisdomarbitrate.domain.IdentityAuthentication;
import com.ruoyi.wisdomarbitrate.domain.vo.WeChatUserVO;
import javax.servlet.http.HttpServletRequest;
/**
* 视频录制
*/
public interface VideoService {
void videoRollBack(String body, HttpServletRequest request) ;
AjaxResult bindCaseId(Long caseId, String roomId);
AjaxResult videoList(Long caseId);
}
@@ -74,7 +74,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
//生成编码
String equipmentNo = getNewEquipmentNo();
datas.put("num",equipmentNo);
datas.put("num", equipmentNo);
//获取仲裁记录表里的相关信息
ArbitrateRecord arbitrateRecord = new ArbitrateRecord();
arbitrateRecord.setCaseAppliId(id);
@@ -102,9 +102,13 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
datas.put("resAddress", affiliate.getResidenAffili());
datas.put("resSex", affiliate.getResponSex());
Date responBirth = affiliate.getResponBirth();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String responBirthStr = sdf.format(responBirth);
datas.put("resDateOfBirth",responBirthStr);
if (responBirth != null) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String responBirthStr = sdf.format(responBirth);
datas.put("resDateOfBirth", responBirthStr);
}
datas.put("resContactAddress", affiliate.getContactAddress());
nameAgentList.add(affiliate.getNameAgent());
}
@@ -117,15 +121,15 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
datas.put("submissionDate", createTimeStr);
Date registerDate = caseApplication1.getRegisterDate();
String registerDateStr = sdf.format(registerDate);
datas.put("acceptDate",registerDateStr);
datas.put("acceptDate", registerDateStr);
//反请求
Integer adjudicaCounter = caseApplication1.getAdjudicaCounter();
String counterclaim = "在《2022年版仲裁规则》第十八条第(一)项规定的期限内,被申请人向秘书处提交了" +
"《仲裁反请求申请书》及证据材料。仲裁委依据《2022年版仲裁规则》第十八条的规定受理了该仲裁反请求案申请。" +
"仲裁反请求案件受理后,秘书处向被申请人发送了仲裁反请求通知书及附件,向申请人发送了仲裁反请求通知书及附件、仲裁反请求申请书及附件。";
if (adjudicaCounter == null){
if (adjudicaCounter == null) {
datas.put("counterclaim", null);
}else if (adjudicaCounter == 1){
} else if (adjudicaCounter == 1) {
datas.put("counterclaim", counterclaim);
} else {
datas.put("counterclaim", null);
@@ -133,10 +137,10 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
//财产保全
Integer properPreser = caseApplication1.getProperPreser();
String preservation = "本案受理后,申请人向仲裁委提交了财产保全申请,仲裁委根据《中华人民共和国仲裁法》" +
"第二十八条之规定,将该申请提交至XXX市XXX区法院。";
"第二十八条之规定,将该申请提交至法院。";
if (properPreser == null) {
datas.put("preservation", null);
} else if(properPreser == 1) {
} else if (properPreser == 1) {
datas.put("preservation", preservation);
} else {
datas.put("preservation", null);
@@ -145,10 +149,9 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
Integer objectiJuris = caseApplication1.getObjectiJuris();
String jurisdictionalObjection = "本案受理后,被申请人向仲裁委提交了《XX管辖异议申请书》,认为XXXXXX" +
",仲裁委经审理,当庭驳回了被申请人的管辖异议申请,并告知被申请人具体的事实和理由将在裁决书中一并列明。";
if (objectiJuris == null){
if (objectiJuris == null) {
datas.put("jurisdictionalObjection", null);
}
else if (objectiJuris == 1) {
} else if (objectiJuris == 1) {
datas.put("jurisdictionalObjection", jurisdictionalObjection);
} else {
datas.put("jurisdictionalObjection", null);
@@ -157,24 +160,26 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
datas.put("arbitratorName", arbitratorName);
Integer arbitratMethod = caseApplication1.getArbitratMethod();
Date hearDate = caseApplication1.getHearDate();
String hearDateStr = sdf.format(hearDate);
//线上开庭时
if (arbitratMethod == 1) {
String onLine1 = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于";
String onLine2 = "通过仲裁委智慧仲裁平台开庭审理了本案。";
datas.put("onLine1", onLine1);
datas.put("hearDate", hearDateStr);
datas.put("onLine2", onLine2);
} else {
//书面仲裁时
String written1 = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于";
String written2 = "在仲裁委所在地开庭审理了本案。";
datas.put("written1", written1);
datas.put("hearDate1", hearDateStr);
datas.put("written2", written2);
if (hearDate!=null){
String hearDateStr = sdf.format(hearDate);
//线上开庭时
if (arbitratMethod == 1) {
String onLine1 = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于";
String onLine2 = "通过仲裁委智慧仲裁平台开庭审理了本案。";
datas.put("onLine1", onLine1);
datas.put("hearDate", hearDateStr);
datas.put("onLine2", onLine2);
} else {
//书面仲裁时
String written1 = "仲裁庭审阅了申请人提交的仲裁申请书、证据材料后,于";
String written2 = "在仲裁委所在地开庭审理了本案。";
datas.put("written1", written1);
datas.put("hearDate1", hearDateStr);
datas.put("written2", written2);
}
}
Integer isAbsence = caseApplication1.getIsAbsence();
if (isAbsence==null){
if (isAbsence == null) {
datas.put("absent1", null);
datas.put("absent2", null);
datas.put("absent3", null);
@@ -190,8 +195,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
datas.put("appAgentName1", null);
datas.put("appAgentName2", null);
datas.put("resAgentName", null);
}
else if (isAbsence == 1) {
} else if (isAbsence == 1) {
//缺席审理
String absent1 = "申请人的特别授权委托代理人";
String absent2 = "出席了庭审。被申请人经依法送达开庭通知,无正当理由未出席庭审,故仲裁庭依据" +
@@ -298,7 +302,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
}
return AjaxResult.success("裁决书已生成");
} catch (IOException e) {
return AjaxResult.error(e+"请检查文件路径是否有误");
return AjaxResult.error(e + "请检查文件路径是否有误");
}
}
@@ -444,9 +448,9 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
}
@Override
public AjaxResult caseFile( List<Long> ids) {
public AjaxResult caseFile(List<Long> ids) {
try {
for (Long id :ids) {
for (Long id : ids) {
CaseApplication caseApplication = new CaseApplication();
caseApplication.setId(id);
//更改案件状态(暂时)
@@ -604,7 +608,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
CaseApplication caseApplication1 = caseApplicationMapper.selectCaseApplication(caseApplication);
//生成编码
String equipmentNo = getNewEquipmentNo();
datas.put("num",equipmentNo);
datas.put("num", equipmentNo);
//获取仲裁记录相关信息
ArbitrateRecord arbitrateRecord1 = caseApplication.getArbitrateRecord();
@@ -631,10 +635,10 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
datas.put("resAddress", affiliate.getResidenAffili());
datas.put("resSex", affiliate.getResponSex());
Date responBirth = affiliate.getResponBirth();
if(responBirth!=null){
if (responBirth != null) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String responBirthStr = sdf.format(responBirth);
datas.put("resDateOfBirth",responBirthStr);
datas.put("resDateOfBirth", responBirthStr);
}
datas.put("resContactAddress", affiliate.getContactAddress());
nameAgentList.add(affiliate.getNameAgent());
@@ -648,15 +652,15 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
datas.put("submissionDate", createTimeStr);
Date registerDate = caseApplication1.getRegisterDate();
String registerDateStr = sdf.format(registerDate);
datas.put("acceptDate",registerDateStr);
datas.put("acceptDate", registerDateStr);
//反请求
Integer adjudicaCounter = caseApplication1.getAdjudicaCounter();
String counterclaim = "在《2022年版仲裁规则》第十八条第(一)项规定的期限内,被申请人向秘书处提交了" +
"《仲裁反请求申请书》及证据材料。仲裁委依据《2022年版仲裁规则》第十八条的规定受理了该仲裁反请求案申请。" +
"仲裁反请求案件受理后,秘书处向被申请人发送了仲裁反请求通知书及附件,向申请人发送了仲裁反请求通知书及附件、仲裁反请求申请书及附件。";
if (adjudicaCounter == null){
if (adjudicaCounter == null) {
datas.put("counterclaim", null);
}else if (adjudicaCounter == 1){
} else if (adjudicaCounter == 1) {
datas.put("counterclaim", counterclaim);
} else {
datas.put("counterclaim", null);
@@ -667,7 +671,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
"第二十八条之规定,将该申请提交至XXX市XXX区法院。";
if (properPreser == null) {
datas.put("preservation", null);
} else if(properPreser == 1) {
} else if (properPreser == 1) {
datas.put("preservation", preservation);
} else {
datas.put("preservation", null);
@@ -676,10 +680,9 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
Integer objectiJuris = caseApplication1.getObjectiJuris();
String jurisdictionalObjection = "本案受理后,被申请人向仲裁委提交了《XX管辖异议申请书》,认为XXXXXX" +
",仲裁委经审理,当庭驳回了被申请人的管辖异议申请,并告知被申请人具体的事实和理由将在裁决书中一并列明。";
if (objectiJuris == null){
if (objectiJuris == null) {
datas.put("jurisdictionalObjection", null);
}
else if (objectiJuris == 1) {
} else if (objectiJuris == 1) {
datas.put("jurisdictionalObjection", jurisdictionalObjection);
} else {
datas.put("jurisdictionalObjection", null);
@@ -689,7 +692,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
Integer arbitratMethod = caseApplication1.getArbitratMethod();
Date hearDate = caseApplication1.getHearDate();
String hearDateStr = "";
if(hearDate!=null){
if (hearDate != null) {
hearDateStr = sdf.format(hearDate);
}
//线上开庭时
@@ -708,7 +711,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
datas.put("written2", written2);
}
Integer isAbsence = caseApplication1.getIsAbsence();
if (isAbsence==null){
if (isAbsence == null) {
datas.put("absent1", null);
datas.put("absent2", null);
datas.put("absent3", null);
@@ -724,8 +727,7 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
datas.put("appAgentName1", null);
datas.put("appAgentName2", null);
datas.put("resAgentName", null);
}
else if (isAbsence == 1) {
} else if (isAbsence == 1) {
//缺席审理
String absent1 = "申请人的特别授权委托代理人";
String absent2 = "出席了庭审。被申请人经依法送达开庭通知,无正当理由未出席庭审,故仲裁庭依据" +
@@ -837,8 +839,8 @@ public class AdjudicationServiceImpl implements IAdjudicationService {
String annexPath = "/uploadPath" + annexName.substring(startIndex);
caseAttach.setAnnexPath(annexPath);
int startIndexnew = annexName.lastIndexOf("/");
if(startIndexnew!=-1){
String annexNamenew = annexName.substring(startIndexnew+1);
if (startIndexnew != -1) {
String annexNamenew = annexName.substring(startIndexnew + 1);
caseAttach.setAnnexName(annexNamenew);
}
@@ -114,50 +114,56 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
Long userId = user.getUserId();
// 查询登录人身份证号
SysUser sysUser = sysUserMapper.selectUserById(userId);
List<SysRole> roles = sysUser.getRoles();
// 没有角色不能查看案件列表
if(CollectionUtil.isEmpty(roles)){
throw new ServiceException("该用户没有角色权限");
}
startPage();
for (SysRole role : roles) {
// 超级管理员和仲裁委(部门长)案件,可查看所有案件 √
if(role.getRoleName().equals("超级管理员")
){
return caseApplicationMapper.selectAdminCaseApplicationList(caseApplication);
// 已办案件
if(caseApplication.getSelectCaseStatus().equals("1")){
caseApplication.setLoginUserName(sysUser.getUserName());
return caseApplicationMapper.selectHandledCase(caseApplication);
}else { // 待办案件
List<SysRole> roles = sysUser.getRoles();
// 没有角色不能查看案件列表
if (CollectionUtil.isEmpty(roles)) {
throw new ServiceException("该用户没有角色权限");
}
if(role.getRoleName().equals("仲裁委")
||role.getRoleName().equals("部门长")){
List<Integer> caseStatusList=new ArrayList<>();
caseStatusList.add(CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL);
caseStatusList.add(CaseApplicationConstants.SIGN_ARBITRATION);
caseStatusList.add(CaseApplicationConstants.ARBITRATED_SEAL);
caseApplication.setDeptHeadStatus(caseStatusList);
startPage();
for (SysRole role : roles) {
// 超级管理员和仲裁委(部门长)案件,可查看所有案件 √
if (role.getRoleName().equals("超级管理员")
) {
return caseApplicationMapper.selectAdminCaseApplicationList(caseApplication);
}
if (role.getRoleName().equals("仲裁委")
|| role.getRoleName().equals("部门长")) {
List<Integer> caseStatusList = new ArrayList<>();
caseStatusList.add(CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL);
caseStatusList.add(CaseApplicationConstants.SIGN_ARBITRATION);
caseStatusList.add(CaseApplicationConstants.ARBITRATED_SEAL);
caseApplication.setDeptHeadStatus(caseStatusList);
}
if (role.getRoleName().equals("仲裁员")) {
caseApplication.setUserId(String.valueOf(userId));
}
if (role.getRoleName().equals("财务")) {
caseApplication.setFinanceStatus(CaseApplicationConstants.PENDING_PAYMENT_CONFIRM);
}
if (role.getRoleName().equals("法律顾问")) {
// 查询角色有关的用户部门
List<Long> deptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId());
caseApplication.setDeptIds(deptIds);
}
if (StrUtil.isEmpty(caseApplication.getNameId()) && role.getRoleName().equals("申请人")) {
// 查询角色有关的用户部门
caseApplication.setNameId(String.valueOf(sysUser.getDeptId()));
}
if (role.getRoleName().equals("被申请人")) {
//
caseApplication.setIdCard(String.valueOf(sysUser.getIdCard()));
}
}
if(role.getRoleName().equals("仲裁员")){
caseApplication.setUserId(String.valueOf(userId));
}
if(role.getRoleName().equals("财务")){
caseApplication.setFinanceStatus(CaseApplicationConstants.PENDING_PAYMENT_CONFIRM);
}
if(role.getRoleName().equals("法律顾问")){
// 查询角色有关的用户部门
List<Long> deptIds = sysDeptMapper.selectUserDeptListByRoleId(role.getRoleId());
caseApplication.setDeptIds(deptIds);
}
if(StrUtil.isEmpty(caseApplication.getNameId())&&role.getRoleName().equals("申请人")){
// 查询角色有关的用户部门
caseApplication.setNameId(String.valueOf(sysUser.getDeptId()));
}
if(role.getRoleName().equals("被申请人")){
//
caseApplication.setIdCard(String.valueOf(sysUser.getIdCard()));
}
}
// 根据条件查询申请人,被申请人,仲裁员,法律顾问案件
return caseApplicationMapper.selectCaseApplicationList(caseApplication);
// 根据条件查询申请人,被申请人,仲裁员,法律顾问案件
return caseApplicationMapper.selectCaseApplicationList(caseApplication);
}
}
@Override
@@ -192,7 +192,8 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService {
if (caseApplication1 != null) {
int caseStatus = caseApplication1.getCaseStatus();
caseApplication1.setObjectionAddEviden(caseEvidenceDTO.getObjectionAddEviden());
caseApplication1.setOpenCourtHear(caseEvidenceDTO.getOpenCourtHear());
//默认书面审理
caseApplication1.setOpenCourtHear(0);
caseApplication1.setPendingAppointArbotrar(caseEvidenceDTO.getPendingAppointArbotrar());
caseApplication1.setAdjudicaCounter(caseEvidenceDTO.getAdjudicaCounter());
caseApplication1.setObjectiJuris(caseEvidenceDTO.getObjectiJuris());
@@ -208,7 +209,10 @@ public class CaseEvidenceServiceImpl implements ICaseEvidenceService {
//修改案件状态
caseApplication1.setCaseStatus(CaseApplicationConstants.CONFIRMDED_PENDING_TRIAL_SUBMMIT);
//选择仲裁方式
if (caseEvidenceDTO.getOpenCourtHear() == 1) { //开庭审理
if (caseEvidenceDTO.getOpenCourtHear() == null){
//没选默认书面审理
caseApplication1.setArbitratMethod(2); //书面审理
}else if (caseEvidenceDTO.getOpenCourtHear() == 1){
caseApplication1.setArbitratMethod(1);
} else {
caseApplication1.setArbitratMethod(2); //书面审理
@@ -0,0 +1,253 @@
package com.ruoyi.wisdomarbitrate.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.SmsUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.wisdomarbitrate.domain.CaseApplication;
import com.ruoyi.wisdomarbitrate.domain.CaseAttach;
import com.ruoyi.wisdomarbitrate.domain.IdentityAuthentication;
import com.ruoyi.wisdomarbitrate.domain.vo.WeChatUserVO;
import com.ruoyi.wisdomarbitrate.mapper.CaseApplicationMapper;
import com.ruoyi.wisdomarbitrate.mapper.CaseAttachMapper;
import com.ruoyi.wisdomarbitrate.mapper.IdentityAuthenticationMapper;
import com.ruoyi.wisdomarbitrate.mapper.WeChatUserMapper;
import com.ruoyi.wisdomarbitrate.service.VideoService;
import com.ruoyi.wisdomarbitrate.service.WeChatUserService;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;
import com.tencentcloudapi.vod.v20180717.VodClient;
import com.tencentcloudapi.vod.v20180717.models.DescribeMediaInfosRequest;
import com.tencentcloudapi.vod.v20180717.models.DescribeMediaInfosResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ResourceUtils;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.nio.file.Paths;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import static com.ruoyi.common.utils.file.FileUploadUtils.getAbsoluteFile;
import static com.ruoyi.common.utils.file.FileUploadUtils.getPathFileName;
/**
* @author wangqiong
* @description 视频录制
* @date 2023-10-26 11:45
*/
@Service
@Slf4j
public class VideoServiceImpl implements VideoService {
@Autowired
private CaseApplicationMapper caseApplicationMapper;
@Autowired
private CaseAttachMapper caseAttachMapper;
/**
* 功能:第三方回调sign校验
* 参数:
* key:控制台配置的密钥key
* body:腾讯云回调返回的body体
* sign:腾讯云回调返回的签名值sign
* 返回值:
* Status:OK 表示校验通过,FAIL 表示校验失败,具体原因参考Info
* Info:成功/失败信息
* @param body
* @param request
* @throws Exception
*/
@Override
public void videoRollBack(String body, HttpServletRequest request) {
String key = "key";
String sdkAppId = request.getHeader("SdkAppId");
String sign = request.getHeader("Sign");
// String resultSign = getResultSign(key,body);
// log.info("resultSign:"+resultSign);
// if (resultSign.equals(sign)) {
JSONObject jsonObject = (JSONObject) JSON.parse(body);
Integer eventType = jsonObject.getInteger("EventType"); // 事件类型
String eventInfo = jsonObject.getString("EventInfo"); // 事件信息
JSONObject jsonObject1 = (JSONObject) JSON.parse(eventInfo);
String roomId = jsonObject1.getString("RoomId");
String taskId = jsonObject1.getString("TaskId"); // 任务ID
String payload = jsonObject1.getString("Payload"); // 根据不同事件类型定义不同
JSONObject jsonObject2 = (JSONObject) JSON.parse(payload);
String tencentVod = jsonObject2.getString("TencentVod"); // 点播平台信息
JSONObject jsonObject3 = (JSONObject) JSON.parse(tencentVod);
// 录制视频上传成功
if (eventType == 311) {
// 点播平台的唯一 ID
String fileId = jsonObject3.getString("FileId");
// 点播平台的播放地址
String videoUrl = jsonObject3.getString("VideoUrl");
// 主辅流标识,main 代表主流(摄像头),aux 代表辅流(屏幕分享),mix 代表混流录制
String mediaId = jsonObject3.getString("MediaId");
// 建立相关的数据库用来存储音视频录制地址并和相关的业务ID绑定,用于后续下载
try {
downloadImage(fileId,videoUrl,roomId);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
@Override
public AjaxResult bindCaseId(Long caseId, String roomId) {
caseApplicationMapper .bindCaseId(caseId,roomId);
return AjaxResult.success();
}
@Override
public AjaxResult videoList(Long caseId) {
CaseApplication caseApplication = new CaseApplication();
caseApplication.setId(caseId);
caseApplication.setAnnexType(9);
List<CaseAttach> caseAttachList = caseAttachMapper.queryCaseAttachList(caseApplication);
if(CollectionUtil.isEmpty(caseAttachList)){
return AjaxResult.success();
}
for (CaseAttach caseAttach : caseAttachList) {
String annexName = caseAttach.getAnnexName();
String prefix = "/profile";
int startIndex = annexName.indexOf(prefix);
startIndex += prefix.length();
String annexPath = "/uploadPath" + annexName.substring(startIndex);
caseAttach.setAnnexPath(annexPath);
int startIndexnew = annexName.lastIndexOf("/");
if (startIndexnew != -1) {
String annexNamenew = annexName.substring(startIndexnew + 1);
caseAttach.setAnnexName(annexNamenew);
}
}
return AjaxResult.success(caseAttachList);
}
/**
* 查询出音视频集合,并下载,在将云点播上面的音视频删除
* @param fileIds 点播平台唯一ID集合
* @throws Exception
*/
private void downloadVideo(String [] fileIds) throws Exception {
try{
//创建文件对象
Properties properties = new Properties();
//加载文件获取数据 文件带后缀
properties.load(Thread.currentThread().getContextClassLoader().getResourceAsStream
("application.properties"));
//根据key来获取value
String secretId = properties.getProperty("secretid");
String secretKey = properties.getProperty("secretkey");
// 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey,此处还需注意密钥对的保密
// 代码泄露可能会导致 SecretId 和 SecretKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考,建议采用更安全的方式来使用密钥,请参见:https://cloud.tencent.com/document/product/1278/85305
// 密钥可前往官网控制台 https://console.cloud.tencent.com/cam/capi 进行获取
Credential cred = new Credential(secretId, secretKey);
// 实例化一个http选项,可选的,没有特殊需求可以跳过
HttpProfile httpProfile = new HttpProfile();
httpProfile.setEndpoint("vod.tencentcloudapi.com");
// 实例化一个client选项,可选的,没有特殊需求可以跳过
ClientProfile clientProfile = new ClientProfile();
clientProfile.setHttpProfile(httpProfile);
// 实例化要请求产品的client对象,clientProfile是可选的
VodClient client = new VodClient(cred, "ap-beijing", clientProfile);
// 实例化一个请求对象,每个接口都会对应一个request对象
DescribeMediaInfosRequest req = new DescribeMediaInfosRequest();
req.setFileIds(fileIds);
String[] basicInfos = {"basicInfo"};
req.setFilters(basicInfos);
// 返回的resp是一个DescribeMediaInfosResponse的实例,与请求对象对应
DescribeMediaInfosResponse resp = client.DescribeMediaInfos(req);
// 输出json格式的字符串回包
log.info(DescribeMediaInfosResponse.toJsonString(resp));
String json = DescribeMediaInfosResponse.toJsonString(resp);
JSONObject jsonObject = (JSONObject) JSON.parse(json);
JSONArray jsonArray = jsonObject.getJSONArray("MediaInfoSet"); // 媒体文件信息列表。
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject1 = jsonArray.getJSONObject(i);
String fileId = jsonObject1.getString("FileId"); // 点播平台的唯一 ID
String basicInfo = jsonObject1.getString("BasicInfo"); // 基础信息
JSONObject jsonObject2 = (JSONObject) JSON.parse(basicInfo);
String mediaUrl = jsonObject2.getString("MediaUrl"); // 文件地址
String downPath = downloadImage(null,null,mediaUrl); // 下载音视频(返回本地下载地址)
// 将未下载的音视频列表查询出来,进行下载到服务器上面,并更新数据库数据
log.info(downPath); // 本地地址
}
log.info("下载音视频成功");
} catch (TencentCloudSDKException e) {
log.info(e.toString());
} catch (IOException e) {
e.printStackTrace();
}
log.info("腾讯云测试成功");
}
/**
* 将视频下载到本地
* @param fileUrl 视频路径
* @return
*/
@Transactional
public String downloadImage(String fileId,String fileUrl,String roomId) throws IOException {
String staticAndMksDir = null;
if (fileUrl != null) {
//下载时文件名称
String fileName = fileUrl.substring(fileUrl.lastIndexOf("/"));
fileName = fileName.replace("/", "");
fileName=fileId+fileName;
String absPath = getAbsoluteFile(RuoYiConfig.getVideoUploadPath(), fileName).getAbsolutePath();
staticAndMksDir = Paths.get(absPath).toFile().toString();
HttpUtil.downloadFile(fileUrl, staticAndMksDir );
Long caseId= caseApplicationMapper.selectCaseIdByRoomId(roomId);
String annexName = getPathFileName(RuoYiConfig.getVideoUploadPath(), fileName);
// 存入数据库
CaseAttach caseAttach = CaseAttach.builder().caseAppliId(caseId)
.annexName(annexName)
.annexPath(RuoYiConfig.getVideoUploadPath())
.annexType(9)
.build();
caseAttachMapper.save(caseAttach);
return annexName;
}
return "";
}
/**
* @param key 回调秘钥
* @param body 入参
* @return 签名 Sign 计算公式中 key 为计算签名 Sign 用的加密密钥。
* @throws Exception
*/
private static String getResultSign(String key, String body) throws Exception {
Mac hmacSha256 = Mac.getInstance("HmacSHA256");
SecretKeySpec secret_key = new SecretKeySpec(key.getBytes(), "HmacSHA256");
hmacSha256.init(secret_key);
return Base64.getEncoder().encodeToString(hmacSha256.doFinal(body.getBytes()));
}
}
@@ -130,7 +130,6 @@ public class WeChatUserServiceImpl implements WeChatUserService {
// 根据身份证查询系统用户表中是否存在该用户,存在则同步已认证的信息,不存在则新增
SysUser sysUser=sysUserMapper.selectUserByIdCard(ientityAuthentication.getIdentityNo());
if(sysUser!=null){
sysUser.setIdCard(ientityAuthentication.getIdentityNo());
sysUser.setNickName(ientityAuthentication.getName());
@@ -147,7 +146,7 @@ public class WeChatUserServiceImpl implements WeChatUserService {
sysUser.setUserName(ientityAuthentication.getUserName());
sysUser.setPhonenumber(ientityAuthentication.getPhone());
sysUser.setEmail(ientityAuthentication.getEmail());
sysUser.setCreateBy(ientityAuthentication.getPhone());
sysUser.setCreateBy(ientityAuthentication.getUserName());
sysUser.setPassword(SecurityUtils.encryptPassword(ientityAuthentication.getPassWord()));
int row = sysUserMapper.insertUser(sysUser);
if(row<1) {