会议相关

This commit is contained in:
18792927508
2023-11-10 15:09:25 +08:00
parent e671ed8e2a
commit 9bb23badc0
7 changed files with 105 additions and 43 deletions
@@ -393,6 +393,7 @@ public class CaseApplicationController extends BaseController {
* @param caseId * @param caseId
* @return * @return
*/ */
@Anonymous
@GetMapping("/reserveConferenceList") @GetMapping("/reserveConferenceList")
public AjaxResult reserveConferenceList( @RequestParam("caseId") Long caseId) { public AjaxResult reserveConferenceList( @RequestParam("caseId") Long caseId) {
@@ -1,7 +1,10 @@
package com.ruoyi.wisdomarbitrate.domain; package com.ruoyi.wisdomarbitrate.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import java.util.Date;
/** /**
* @author wangqiong * @author wangqiong
* @description 预定会议 * @description 预定会议
@@ -13,7 +16,7 @@ public class ReservedConference {
/** /**
* id * id
*/ */
private String id; private Long id;
/** /**
* 案件id * 案件id
*/ */
@@ -25,13 +28,18 @@ public class ReservedConference {
/** /**
* 预定会议开始时间 * 预定会议开始时间
*/ */
private String scheduleStartTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date scheduleStartTime;
/** /**
* 预定会议结束时间 * 预定会议结束时间
*/ */
private String scheduleEndTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date scheduleEndTime;
public ReservedConference( Long caseId, String roomId, String scheduleStartTime, String scheduleEndTime) { public ReservedConference() {
}
public ReservedConference(Long caseId, String roomId, Date scheduleStartTime, Date scheduleEndTime) {
this.caseId = caseId; this.caseId = caseId;
this.roomId = roomId; this.roomId = roomId;
this.scheduleStartTime = scheduleStartTime; this.scheduleStartTime = scheduleStartTime;
@@ -1,9 +1,11 @@
package com.ruoyi.wisdomarbitrate.domain.vo; package com.ruoyi.wisdomarbitrate.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.Date;
/** /**
* @author wangqiong * @author wangqiong
@@ -22,16 +24,12 @@ public class ReservedConferenceVO {
*/ */
@NotEmpty(message = "房主id不能为空") @NotEmpty(message = "房主id不能为空")
private String roomId; private String roomId;
/**
* 会议开始时间
*/
@NotNull(message = "会议开始时间不能为空") @NotNull(message = "会议开始时间不能为空")
private Integer scheduleStartTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
/** private Date scheduleStartTime;
* 会议结束时间
*/
@NotNull(message = "会议结束时间不能为空") @NotNull(message = "会议结束时间不能为空")
private Integer scheduleEndTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date scheduleEndTime;
@NotNull(message = "案件id不能为空") @NotNull(message = "案件id不能为空")
private Long caseId; private Long caseId;
} }
@@ -1,10 +1,12 @@
package com.ruoyi.wisdomarbitrate.domain.vo; package com.ruoyi.wisdomarbitrate.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date;
/** /**
* @author wangqiong * @author wangqiong
@@ -18,7 +20,10 @@ public class SendRoomNoMessageVO implements Serializable {
private Long id; private Long id;
@NotEmpty(message = "房间号不能为空") @NotEmpty(message = "房间号不能为空")
private String roomNo; private String roomNo;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date scheduleStartTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date scheduleEndTime;
} }
@@ -1,7 +1,7 @@
package com.ruoyi.wisdomarbitrate.mapper; package com.ruoyi.wisdomarbitrate.mapper;
import com.ruoyi.wisdomarbitrate.domain.ReservedConference; import com.ruoyi.wisdomarbitrate.domain.ReservedConference;
import org.springframework.data.repository.query.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@@ -34,4 +34,7 @@ public interface ReservedConferenceMapper {
* @param roomId * @param roomId
*/ */
void deleteByRoomId(@Param("roomId")String roomId); void deleteByRoomId(@Param("roomId")String roomId);
void batchDeleteByIds(@Param("ids") List<Long> ids);
} }
@@ -33,6 +33,13 @@ import com.ruoyi.wisdomarbitrate.mapper.*;
import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService; import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
import com.ruoyi.wisdomarbitrate.utils.SignAward; import com.ruoyi.wisdomarbitrate.utils.SignAward;
import com.ruoyi.wisdomarbitrate.utils.UnZipFileUtils; import com.ruoyi.wisdomarbitrate.utils.UnZipFileUtils;
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.trtc.v20190722.TrtcClient;
import com.tencentcloudapi.trtc.v20190722.models.DismissRoomByStrRoomIdRequest;
import com.tencentcloudapi.trtc.v20190722.models.DismissRoomByStrRoomIdResponse;
import com.tencentyun.TLSSigAPIv2; import com.tencentyun.TLSSigAPIv2;
import org.apache.http.HttpEntity; import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.CloseableHttpResponse;
@@ -1878,12 +1885,32 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
String returnResult = "短信发送成功"; String returnResult = "短信发送成功";
//todo 需要申请模板,申请人,被申请人发送短信通知 //todo 需要申请模板,申请人,被申请人发送短信通知
SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest(); SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
request.setTemplateId("1952136"); String startFormat="";
String endFormat="";
// 创建房间短信通知
if (messageVO.getScheduleStartTime() == null) {
request.setTemplateId("1983692");
} else {
String format = "yyyy/MM/dd HH:mm:ss"; // 目标格式
Date startDate =messageVO.getScheduleStartTime();
Date endDate = messageVO.getScheduleEndTime();
SimpleDateFormat sdf = new SimpleDateFormat(format);
startFormat = sdf.format(startDate);
endFormat = sdf.format(endDate);
// 预约会议短信模板
request.setTemplateId("1983711");
}
for (CaseAffiliate caseAffiliate : caseAffiliates) { for (CaseAffiliate caseAffiliate : caseAffiliates) {
request.setPhone(caseAffiliate.getContactTelphone()); request.setPhone(caseAffiliate.getContactTelphone());
String userId = (null==caseAffiliate.getUserId()?"" : caseAffiliate.getUserId()); String userId = (null==caseAffiliate.getUserId()?"" : caseAffiliate.getUserId());
request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplicationselect.getCaseNum(), messageVO.getRoomNo()+userId}); if(messageVO.getScheduleStartTime()==null) {
// 1952136 普通短信 尊敬的{1}用户,您的{2}仲裁案件,开庭审理房间号为{3},请在浏览器打开https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 请知晓,如非本人操作,请忽略本短信。 // 1983692 开庭审理创建会议通知 尊敬的{1}用户,您的{2}仲裁案件,开庭审理房间号为{3},请点击https://txroom.xayunmei.com/#/home, 请知晓,如非本人操作,请忽略本短信。
request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplicationselect.getCaseNum(), messageVO.getRoomNo() + userId});
}else {
// 1983711 开庭审理预约会议短信通知 尊敬的{1}用户,您的{2}仲裁案件,开庭审理房间号为{3},会议时间为{4},请点击https://txroom.xayunmei.com/#/home, 请知晓,如非本人操作,请忽略本短信。
request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplicationselect.getCaseNum(), messageVO.getRoomNo() + userId,startFormat+"-"+endFormat});
}
Boolean aBoolean = SmsUtils.sendSms(request); Boolean aBoolean = SmsUtils.sendSms(request);
//保存短信发送记录 //保存短信发送记录
SmsSendRecord smsSendRecord = new SmsSendRecord(); SmsSendRecord smsSendRecord = new SmsSendRecord();
@@ -1891,7 +1918,13 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
smsSendRecord.setCaseNum(caseApplicationselect.getCaseNum()); smsSendRecord.setCaseNum(caseApplicationselect.getCaseNum());
smsSendRecord.setPhone(request.getPhone()); smsSendRecord.setPhone(request.getPhone());
smsSendRecord.setSendTime(new Date()); smsSendRecord.setSendTime(new Date());
String content = "尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplicationselect.getCaseNum() + "仲裁案件,开庭审理房间号为" + messageVO.getRoomNo()+userId + ",https://txroom.xayunmei.com/#/home, 请知晓,如非本人操作,请忽略本短信。"; String content="";
if(messageVO.getScheduleStartTime()==null) {
content = "尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplicationselect.getCaseNum() + "仲裁案件,开庭审理房间号为" + messageVO.getRoomNo() + userId + ",请点击https://txroom.xayunmei.com/#/home, 请知晓,如非本人操作,请忽略本短信。";
}else {
content = "尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplicationselect.getCaseNum() + "仲裁案件,开庭审理房间号为" + messageVO.getRoomNo() + userId +"会议时间为"+startFormat+"-"+endFormat+ ",请点击https://txroom.xayunmei.com/#/home, 请知晓,如非本人操作,请忽略本短信。";
}
smsSendRecord.setSendContent(content); smsSendRecord.setSendContent(content);
String userName; String userName;
@@ -2477,8 +2510,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
if (StrUtil.isEmpty(userSign)) { if (StrUtil.isEmpty(userSign)) {
return AjaxResult.error("生成userSign失败"); return AjaxResult.error("生成userSign失败");
} }
Integer scheduleStartTime = reservedConferenceVO.getScheduleStartTime(); Date startTime = reservedConferenceVO.getScheduleStartTime();
Integer scheduleEndTime = reservedConferenceVO.getScheduleEndTime(); Date endTime = reservedConferenceVO.getScheduleEndTime();
Random rand = new Random(); Random rand = new Random();
int random = rand.nextInt(214748365); 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"; String url="https://roomkit.trtc.tencent-cloud.com/room_api/v1/roomctl/create?usersig=" + userSign + "&identifier=" + administrator + "&sdkappid=" + sdkAppId + "&random=" +random + "&contenttype=json";
@@ -2489,8 +2522,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
JSONObject roomParams = new JSONObject(); JSONObject roomParams = new JSONObject();
bodyParams.put("ownerId", reservedConferenceVO.getOwnerId()); bodyParams.put("ownerId", reservedConferenceVO.getOwnerId());
bodyParams.put("roomId", reservedConferenceVO.getRoomId()); bodyParams.put("roomId", reservedConferenceVO.getRoomId());
bodyParams.put("scheduleStartTime", scheduleStartTime); bodyParams.put("scheduleStartTime",startTime.getTime()/1000 );
bodyParams.put("scheduleEndTime",scheduleEndTime); bodyParams.put("scheduleEndTime",endTime.getTime()/1000);
roomParams.put("roomType", 1); roomParams.put("roomType", 1);
bodyParams.put("roomInfo", roomParams); bodyParams.put("roomInfo", roomParams);
StringEntity postingString = new StringEntity(bodyParams.toString()); StringEntity postingString = new StringEntity(bodyParams.toString());
@@ -2508,15 +2541,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
case 0: case 0:
// todo 不需要绑定,以后删 绑定房间号和案件id // todo 不需要绑定,以后删 绑定房间号和案件id
caseApplicationMapper.bindCaseId(reservedConferenceVO.getCaseId(), reservedConferenceVO.getRoomId()); caseApplicationMapper.bindCaseId(reservedConferenceVO.getCaseId(), reservedConferenceVO.getRoomId());
String format = "yyyy-MM-dd HH:mm:ss"; // 目标格式
Date startDate = new Date(scheduleStartTime);
Date endDate = new Date(scheduleEndTime);
SimpleDateFormat sdf = new SimpleDateFormat(format);
String startFormat = sdf.format(startDate);
String endFormat = sdf.format(endDate);
// 新增预约会议表 // 新增预约会议表
ReservedConference conference = new ReservedConference(reservedConferenceVO.getCaseId(), reservedConferenceVO.getRoomId(), ReservedConference conference = new ReservedConference(reservedConferenceVO.getCaseId(), reservedConferenceVO.getRoomId(),
startFormat, endFormat); reservedConferenceVO.getScheduleStartTime(), reservedConferenceVO.getScheduleEndTime());
reservedConferenceMapper.insert(conference); reservedConferenceMapper.insert(conference);
return AjaxResult.success("预约会议成功"); return AjaxResult.success("预约会议成功");
@@ -2527,7 +2555,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
case 84005: case 84005:
return AjaxResult.error("房间号已被占用"); return AjaxResult.error("房间号已被占用");
default: default:
return AjaxResult.error("预约会议失败"); return AjaxResult.error(resJson.getString("errorMessage"));
} }
} else { } else {
@@ -2542,6 +2570,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
*/ */
@Override @Override
public void destroyRoomBack(String body, HttpServletRequest request) { public void destroyRoomBack(String body, HttpServletRequest request) {
// todo 测试回调
reservedConferenceMapper.insert(new ReservedConference(999888L,body,null,null));
JSONObject jsonObject = (JSONObject) JSON.parse(body); JSONObject jsonObject = (JSONObject) JSON.parse(body);
// 事件类型 // 事件类型
Integer eventType = jsonObject.getInteger("EventType"); Integer eventType = jsonObject.getInteger("EventType");
@@ -2562,12 +2592,29 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
* @return * @return
*/ */
@Override @Override
@Transactional
public List<ReservedConference> reserveConferenceList(Long caseId) { public List<ReservedConference> reserveConferenceList(Long caseId) {
List<ReservedConference> reservedConferences = reservedConferenceMapper.selectListByCaseId(caseId);
return reservedConferenceMapper.selectListByCaseId(caseId); List<ReservedConference> result = new ArrayList<>();
// 判断当前时间是否大于结束时间,如果大于,则把该房间删掉
if (CollectionUtil.isNotEmpty(reservedConferences)) {
List<Long> ids = new ArrayList<>();
for (ReservedConference reservedConference : reservedConferences) {
Date endTime = reservedConference.getScheduleEndTime();
Date now = new Date();
if (now.after(endTime)) {
ids.add(reservedConference.getId());
} else {
result.add(reservedConference);
}
}
if (CollectionUtil.isNotEmpty(ids)) {
// 根据id批量删除
reservedConferenceMapper.batchDeleteByIds(ids);
}
}
return result;
} }
} }
@@ -3,14 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.wisdomarbitrate.mapper.ReservedConferenceMapper"> <mapper namespace="com.ruoyi.wisdomarbitrate.mapper.ReservedConferenceMapper">
<resultMap type="com.ruoyi.wisdomarbitrate.domain.ReservedConference" id="BaseResult">
<id property="id" column="id" />
<result property="caseId" column="case_id" />
<result property="roomId" column="room_id" />
<result property="scheduleStartTime" column="schedule_start_time" />
<result property="scheduleEndTime" column="schedule_end_time" />
</resultMap>
<insert id="insert"> <insert id="insert">
insert into reserved_conference( insert into reserved_conference(
case_id, case_id,
@@ -27,8 +20,15 @@
<delete id="deleteByRoomId"> <delete id="deleteByRoomId">
delete from reserved_conference where room_id=#{roomId} delete from reserved_conference where room_id=#{roomId}
</delete> </delete>
<select id="selectListByCaseId" resultMap="BaseResult"> <delete id="batchDeleteByIds">
select * from reserved_conference where case_id=#{caseId} delete from reserved_conference where id in
<foreach collection="ids" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<select id="selectListByCaseId" resultType="com.ruoyi.wisdomarbitrate.domain.ReservedConference">
select id, case_id caseId,room_id roomId,schedule_start_time scheduleStartTime,schedule_end_time scheduleEndTime
from reserved_conference where case_id=#{caseId}
</select> </select>