This commit is contained in:
18792927508
2023-11-23 18:47:16 +08:00
parent d282515d64
commit 217dda4225
13 changed files with 205 additions and 230 deletions
@@ -17,6 +17,10 @@ public class ReservedConference {
* id
*/
private Long id;
/**
* 用户id
*/
private Long userId;
/**
* 案件id
*/
@@ -24,7 +28,7 @@ public class ReservedConference {
/**
* 房间号
*/
private String roomId;
private long roomId;
/**
* 预定会议开始时间
*/
@@ -35,19 +39,17 @@ public class ReservedConference {
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date scheduleEndTime;
/**
* 会议类型,0-创建会议,1-预约会议
*/
private Integer roomType;
public ReservedConference() {
}
public ReservedConference(Long caseId, String roomId, Date scheduleStartTime, Date scheduleEndTime,Integer roomType) {
public ReservedConference(Long caseId, Long userId, long roomId, Date scheduleStartTime, Date scheduleEndTime) {
this.caseId = caseId;
this.userId = userId;
this.roomId = roomId;
this.scheduleStartTime = scheduleStartTime;
this.scheduleEndTime = scheduleEndTime;
this.roomType = roomType;
}
}
@@ -15,18 +15,18 @@ import java.util.Date;
@Data
public class ReservedConferenceVO {
/**
* 房主id
* 用户id
*/
@NotEmpty(message = "房主id不能为空")
private String ownerId;
/**
* 房间号id
*/
private String roomId;
private Long roomId;
@NotNull(message = "会议开始时间不能为空")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date scheduleStartTime;
@NotNull(message = "会议结束时间不能为空")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date scheduleEndTime;
@NotNull(message = "案件id不能为空")
@@ -109,7 +109,7 @@ public interface CaseApplicationMapper {
* 查询最大房间号
* @return
*/
Integer selectMaxRoomId();
Long selectMaxRoomId();
/**
* 修改案件版本号
@@ -101,7 +101,7 @@ public interface ICaseApplicationService {
* 腾讯云销毁房间回调
* @return
*/
String createRoomId(Long caseId);
long createRoomId(Long caseId);
/**
* 根据案件id查询已预约的会议
@@ -111,4 +111,5 @@ public interface ICaseApplicationService {
List<ReservedConference> reserveConferenceList(Long caseId);
AjaxResult deleteRoom( String roomId);
}
@@ -23,7 +23,14 @@ public interface VideoService {
* @param roomId
* @return
*/
AjaxResult openCloudRecording(long caseId,String roomId);
AjaxResult openCloudRecording(long caseId,long roomId);
AjaxResult closeDeleteCloudRecording(String taskId);
/**
* 解散房间
* @param roomId
* @return
*/
AjaxResult dissolveRoom( Long roomId);
}
@@ -85,9 +85,10 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
}else {
vo.setUpdateSubmitStatus(UpdateSubmitStatus.REVOKE.getCode());
// 修改日志表提交状态
caseApplicationLogMapper.updateStatus(vo);
}
// 修改日志表提交状态
caseApplicationLogMapper.updateStatus(vo);
return AjaxResult.success();
}
@@ -117,7 +118,6 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
caseApplicationLogMapper.updateStatus(vo);
// 根据caseLogId查询相关人员表
List<CaseAffiliate> affiliateLogList = caseAffiliateLogMapper.selectCaseAffiliate(caseApplicationLog.getCaseLogId());
caseApplicationLog.setId(caseApplicationLog.getCaseAppliId());
// 更新案件主表
caseApplicationMapper.updataCaseApplication(caseApplicationLog);
@@ -142,9 +142,7 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
return AjaxResult.success();
} else if (Objects.equals(vo.getUpdateSubmitStatus(), UpdateSubmitStatus.REVOKE.getCode())) {
// 如果版本号为1,则直接返回
if(vo.getVersion() <= 1){
return AjaxResult.success();
}
// 审核修改撤销状态
if (Objects.equals(vo.getIsAgree(), YesOrNoEnum.YES.getCode())) {
agreeRevoke(vo);
@@ -219,8 +217,11 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
compareCaseVO.setBeforeCase(beforeCase);
compareCaseVO.setAfterCase(afterCase);
// 对比两个版本修改的字段
String[] columns = {"caseLogId","caseSubjectAmount", "caseName"};
String[] affiliateColumns = {"identityNum", "workAddress"};
String[] columns = {"caseSubjectAmount","loanStartDate", "loanEndDate","contractNumber","claimInterestOwed","claimLiquidDamag",
"claimPrinciOwed","arbitratClaims","properPreser","requestRule"};
String[] affiliateColumns = {"name", "identityNum","contactTelphone","contactAdress","workTelphone","workAddress",
"nameAgent", "identityNumAgent","contactTelphoneAgent","contactAddressAgent","residenAffili","compLegalPerson",
"compLegalperPost","responSex","responBirth"};
StringBuilder changeColumn = new StringBuilder();
for (String column : columns) {
String beforeValue = ObjectFieldUtils.getValue(beforeCase, column);
@@ -312,9 +313,15 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
* @param vo
*/
private void agreeRevoke(UpdateSubmitVO vo) {
CaseApplication caseApplicationLog;
// 查询日志记录表上个版本未被拒绝数据
CaseApplication caseApplicationLog = caseApplicationLogMapper.selectByCaseIdAndVersion(vo.getCaseId(), vo.getVersion()-1);
if (caseApplicationLog == null) {
if(vo.getVersion()<=1){
caseApplicationLog = caseApplicationLogMapper.selectByCaseIdAndVersion(vo.getCaseId(), vo.getVersion() );
}else {
caseApplicationLog = caseApplicationLogMapper.selectByCaseIdAndVersion(vo.getCaseId(), vo.getVersion() - 1);
}
if (caseApplicationLog == null) {
return;
}
// 将日志表改版本的状态改为拒绝
@@ -322,7 +329,7 @@ public class CaseApplicationLogServiceImpl implements CaseApplicationLogService
caseApplicationLogMapper.updateStatus(vo);
// 根据caseLogId查询相关人员表
List<CaseAffiliate> affiliateLogList = caseAffiliateLogMapper.selectCaseAffiliate(caseApplicationLog.getCaseLogId());
caseApplicationLog.setId(caseApplicationLog.getCaseAppliId());
// 更新案件主表
caseApplicationMapper.updataCaseApplication(caseApplicationLog);
@@ -188,7 +188,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
caseApplication.setDeptIds(deptIds);
}
if ("申请人".equals(role.getRoleName())) {
caseApplication.setIsOtherRole(1);
// caseApplication.setIsOtherRole(1);
// 查询有关的用户部门
caseApplication.setApplicationOrganId(String.valueOf(sysUser.getDeptId()));
}
@@ -264,7 +264,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
caseApplication.setDeptIds(deptIds);
}
if ("申请人".equals(role.getRoleName())) {
caseApplication.setIsOtherRole(1);
// caseApplication.setIsOtherRole(1);
// 查询角色有关的用户部门
caseApplication.setApplicationOrganId(String.valueOf(sysUser.getDeptId()));
}
@@ -1014,7 +1014,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
caseApplicationMapper.updataCaseApplication(caseApplication);
// 修改记录表状态为同意提交修改的内容
caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.AGREE.getCode());
caseApplication.setUpdateSubmitStatus(0);
}else {
// 修改记录表状态为已提交修改的内容
caseApplication.setUpdateSubmitStatus(UpdateSubmitStatus.COMMITTED.getCode());
@@ -1235,18 +1235,9 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
@Override
public CaseApplication selectCaseApplication(CaseApplication caseApplication) {
CaseApplication caseApplicationselect=new CaseApplication();
if(caseApplication.getVersion()!=null) {
caseApplicationselect=caseApplicationLogMapper.selectByCaseIdAndVersion(caseApplication.getId(),caseApplication.getVersion());
}
else {
caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
}
caseApplicationselect.setId(caseApplication.getId());
CaseApplication caseApplicationselect = caseApplicationMapper.selectCaseApplication(caseApplication);
CaseAffiliate caseAffiliate = new CaseAffiliate();
caseAffiliate.setCaseAppliId(caseApplication.getId());
ArbitrateRecord arbitrateRecord = new ArbitrateRecord();
arbitrateRecord.setCaseAppliId(caseApplication.getId());
@@ -1275,16 +1266,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
}
}
caseApplicationselect.setCaseAttachList(caseAttachList);
List<CaseAffiliate> caseAffiliatListeselect;
if(caseApplication.getVersion()!=null) {
caseAffiliatListeselect = caseAffiliateLogMapper.selectCaseAffiliate(caseApplicationselect.getCaseLogId());
}else {
CaseAffiliate caseAffiliate = new CaseAffiliate();
caseAffiliate.setCaseAppliId(caseApplication.getId());
caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
}
List<CaseAffiliate> caseAffiliatListeselect = caseAffiliateMapper.selectCaseAffiliate(caseAffiliate);
if (caseAffiliatListeselect != null) {
// 查询组织机构
List<SysDept> sysDepts = sysDeptMapper.selectDeptList(new SysDept());
@@ -1307,6 +1290,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
;
} else if (identityType == 2) {
respondentName.append(caseAffiliateselect.getName()).append(",");
;
}
}
caseApplicationselect.setApplicantName(applicantName.toString());
@@ -2708,70 +2692,14 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
*/
@Transactional
@Override
public AjaxResult reservedConference(ReservedConferenceVO reservedConferenceVO) throws Exception {
// 创建房间必须拿administrator生成usersig,否则调用腾讯云接口报7004,生成administrator的userSig
String administrator = "administrator";
String userSign = generateUserSign(administrator);
if (StrUtil.isEmpty(userSign)) {
return AjaxResult.error("生成userSign失败");
}
// 生成房间号id
String roomId = generateRoomId();
// String roomId = reservedConferenceVO.getRoomId();
Date startTime = reservedConferenceVO.getScheduleStartTime();
Date endTime = reservedConferenceVO.getScheduleEndTime();
Random rand = new Random();
int random = rand.nextInt(214748365);
String url = "https://roomkit.trtc.tencent-cloud.com/room_api/v1/roomctl/create?usersig=" + userSign + "&identifier=" + administrator + "&sdkappid=" + sdkAppId + "&random=" + random + "&contenttype=json";
HttpPost post = new HttpPost(url);
String result = "";
//添加参数
JSONObject bodyParams = new JSONObject();
JSONObject roomParams = new JSONObject();
bodyParams.put("ownerId", reservedConferenceVO.getOwnerId());
bodyParams.put("roomId", roomId);
bodyParams.put("scheduleStartTime", startTime);
bodyParams.put("scheduleEndTime", endTime);
public AjaxResult reservedConference(ReservedConferenceVO reservedConferenceVO) {
bodyParams.put("scheduleStartTime", startTime.getTime() / 1000);
bodyParams.put("scheduleEndTime", endTime.getTime() / 1000);
roomParams.put("roomType", 1);
bodyParams.put("roomInfo", roomParams);
StringEntity postingString = new StringEntity(bodyParams.toString());
post.setEntity(postingString);
CloseableHttpClient client = HttpClients.createDefault();
//启动执行请求,并获得返回值
CloseableHttpResponse response = client.execute(post);
//得到返回的entity对象
HttpEntity entity = response.getEntity();
//把实体对象转换为string
result = EntityUtils.toString(entity, "UTF-8");
if (StrUtil.isNotEmpty(result)) {
JSONObject resJson = JSONObject.parseObject(result);
switch ((int) resJson.get("errorCode")) {
case 0:
// todo 不需要绑定,以后删 绑定房间号和案件id
caseApplicationMapper.bindCaseId(reservedConferenceVO.getCaseId(), roomId);
// 新增预约会议表
ReservedConference conference = new ReservedConference(reservedConferenceVO.getCaseId(),SecurityUtils.getUserId(), reservedConferenceVO.getRoomId(),
reservedConferenceVO.getScheduleStartTime(), reservedConferenceVO.getScheduleEndTime());
// 新增预约会议表
ReservedConference conference = new ReservedConference(reservedConferenceVO.getCaseId(), roomId,
reservedConferenceVO.getScheduleStartTime(), reservedConferenceVO.getScheduleEndTime(),1);
reservedConferenceMapper.insert(conference);
return success("预约会议成功");
case 42002:
return AjaxResult.error("预定会议无效");
case 42003:
return AjaxResult.error("预定会议必须是会议场景");
case 84005:
return AjaxResult.error("房间号已被占用");
default:
return AjaxResult.error(resJson.getString("errorMessage"));
}
} else {
return AjaxResult.error("预约会议失败");
}
reservedConferenceMapper.insert(conference);
return success("预约会议成功");
}
@@ -2780,14 +2708,14 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
*/
@Transactional
@Override
public String createRoomId(Long caseId) {
String roomId = generateRoomId();
public long createRoomId(Long caseId) {
long roomId = generateRoomId();
// 新增预约会议表
ReservedConference conference = new ReservedConference(caseId, roomId,
null, null,0);
reservedConferenceMapper.insert(conference);
// ReservedConference conference = new ReservedConference(caseId, roomId,
// null, null,0);
// reservedConferenceMapper.insert(conference);
// 绑定案件与房间号
caseApplicationMapper.bindCaseId(caseId, roomId);
caseApplicationMapper.bindCaseId(caseId, String.valueOf(roomId));
return roomId;
}
@@ -2796,14 +2724,14 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
*
* @return
*/
public String generateRoomId() {
public Long generateRoomId() {
// 查询最大房间号
Integer maxRoomId = caseApplicationMapper.selectMaxRoomId();
Long maxRoomId = caseApplicationMapper.selectMaxRoomId();
if (null == maxRoomId || maxRoomId >999999) {
return "000001";
if (null == maxRoomId || maxRoomId >4294967294L) {
return 1L;
} else {
return String.format("%06d", maxRoomId);
return maxRoomId+1;
}
}
@@ -171,7 +171,7 @@ public class VideoServiceImpl implements VideoService {
* @return
*/
@Override
public AjaxResult openCloudRecording(long caseId,String roomId) {
public AjaxResult openCloudRecording(long caseId,long roomId) {
try {
String userId="recorder_"+roomId;
@@ -189,7 +189,7 @@ public class VideoServiceImpl implements VideoService {
// 实例化一个请求对象,每个接口都会对应一个request对象
CreateCloudRecordingRequest req = new CreateCloudRecordingRequest();
req.setSdkAppId(sdkAppId); // SdkAppId – TRTC的[SdkAppId](https://cloud.tencent.com/document/product/647/46351#sdkappid),和录制的房间所对应的SdkAppId相同
req.setRoomId(roomId); // RoomId – TRTC的[RoomId](https://cloud.tencent.com/document/product/647/46351#roomid),录制的TRTC房间所对应的RoomId
req.setRoomId(String.valueOf(roomId)); // RoomId – TRTC的[RoomId](https://cloud.tencent.com/document/product/647/46351#roomid),录制的TRTC房间所对应的RoomId
req.setRoomIdType(1L);
/**
* 录制机器人用于进入TRTC房间拉流的[UserId](https://cloud.tencent.com/document/product/647/46351#userid),
@@ -266,6 +266,29 @@ public class VideoServiceImpl implements VideoService {
}
@Override
public AjaxResult dissolveRoom( Long roomId) {
Credential cred = new Credential(secretId, secretKey);
// 实例化一个http选项,可选的,没有特殊需求可以跳过
HttpProfile httpProfile = new HttpProfile();
httpProfile.setEndpoint("trtc.tencentcloudapi.com");
// 实例化一个client选项,可选的,没有特殊需求可以跳过
ClientProfile clientProfile = new ClientProfile();
clientProfile.setHttpProfile(httpProfile);
// 实例化要请求产品的client对象,clientProfile是可选的
TrtcClient client = new TrtcClient(cred, "ap-beijing", clientProfile);
DismissRoomRequest req = new DismissRoomRequest();
req.setSdkAppId(sdkAppId);
req.setRoomId(roomId);
try {
DismissRoomResponse resp = client.DismissRoom(req);
return AjaxResult.success((JSONObject) JSON.toJSON(resp));
} catch (TencentCloudSDKException e) {
return AjaxResult.error("解散房间失败");
}
}
/**
* 查询出音视频集合,并下载,在将云点播上面的音视频删除