合并冲突解决

This commit is contained in:
hejinbo
2023-11-10 18:20:04 +08:00
9 changed files with 137 additions and 41 deletions
@@ -1,7 +1,10 @@
package com.ruoyi.wisdomarbitrate.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
/**
* @author wangqiong
* @description 预定会议
@@ -13,7 +16,7 @@ public class ReservedConference {
/**
* id
*/
private String id;
private Long 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.roomId = roomId;
this.scheduleStartTime = scheduleStartTime;
@@ -1,9 +1,11 @@
package com.ruoyi.wisdomarbitrate.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* @author wangqiong
@@ -22,16 +24,12 @@ public class ReservedConferenceVO {
*/
@NotEmpty(message = "房主id不能为空")
private String roomId;
/**
* 会议开始时间
*/
@NotNull(message = "会议开始时间不能为空")
private Integer scheduleStartTime;
/**
* 会议结束时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date scheduleStartTime;
@NotNull(message = "会议结束时间不能为空")
private Integer scheduleEndTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date scheduleEndTime;
@NotNull(message = "案件id不能为空")
private Long caseId;
}
@@ -1,10 +1,12 @@
package com.ruoyi.wisdomarbitrate.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
/**
* @author wangqiong
@@ -18,7 +20,10 @@ public class SendRoomNoMessageVO implements Serializable {
private Long id;
@NotEmpty(message = "房间号不能为空")
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;
import com.ruoyi.wisdomarbitrate.domain.ReservedConference;
import org.springframework.data.repository.query.Param;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@@ -34,4 +34,7 @@ public interface ReservedConferenceMapper {
* @param roomId
*/
void deleteByRoomId(@Param("roomId")String roomId);
void batchDeleteByIds(@Param("ids") List<Long> ids);
}
@@ -103,4 +103,11 @@ public interface ICaseApplicationService {
* @return
*/
void destroyRoomBack(String body, HttpServletRequest request);
/**
* 根据案件id查询已预约的会议
* @param caseId
* @return
*/
List<ReservedConference> reserveConferenceList(Long caseId);
}
@@ -20,19 +20,26 @@ import com.ruoyi.common.utils.*;
import com.ruoyi.common.utils.file.SaaSAPIFileUtils;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.system.domain.SysUserRole;
import com.ruoyi.system.mapper.SysDeptMapper;
import com.ruoyi.system.mapper.SysRoleMapper;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.mapper.SysUserRoleMapper;
import com.ruoyi.wisdomarbitrate.domain.vo.ReservedConferenceVO;
import com.ruoyi.wisdomarbitrate.domain.vo.ToDoCount;
import com.ruoyi.wisdomarbitrate.utils.CaseLogUtils;
import com.ruoyi.system.mapper.SysDeptMapper;
import com.ruoyi.wisdomarbitrate.domain.*;
import com.ruoyi.wisdomarbitrate.domain.vo.SendRoomNoMessageVO;
import com.ruoyi.wisdomarbitrate.mapper.*;
import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
import com.ruoyi.wisdomarbitrate.utils.SignAward;
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 org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
@@ -1898,11 +1905,34 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
String returnResult = "短信发送成功";
//todo 需要申请模板,申请人,被申请人发送短信通知
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) {
request.setPhone(caseAffiliate.getContactTelphone());
request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplicationselect.getCaseNum(), messageVO.getRoomNo() + caseAffiliate.getUserId()});
// 1952136 普通短信 尊敬的{1}用户,您的{2}仲裁案件,开庭审理房间号为{3},请在浏览器打开https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 请知晓,如非本人操作,请忽略本短信。
String userId = (null==caseAffiliate.getUserId()?"" : caseAffiliate.getUserId());
if(messageVO.getScheduleStartTime()==null) {
// 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);
//保存短信发送记录
SmsSendRecord smsSendRecord = new SmsSendRecord();
@@ -1910,7 +1940,13 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
smsSendRecord.setCaseNum(caseApplicationselect.getCaseNum());
smsSendRecord.setPhone(request.getPhone());
smsSendRecord.setSendTime(new Date());
String content = "尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplicationselect.getCaseNum() + "仲裁案件,开庭审理房间号为" + messageVO.getRoomNo() + caseAffiliate.getUserId() + ",请在微信内打开https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 请知晓,如非本人操作,请忽略本短信。";
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);
String userName;
@@ -2499,8 +2535,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
if (StrUtil.isEmpty(userSign)) {
return AjaxResult.error("生成userSign失败");
}
Integer scheduleStartTime = reservedConferenceVO.getScheduleStartTime();
Integer scheduleEndTime = reservedConferenceVO.getScheduleEndTime();
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";
@@ -2511,8 +2547,11 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
JSONObject roomParams = new JSONObject();
bodyParams.put("ownerId", reservedConferenceVO.getOwnerId());
bodyParams.put("roomId", reservedConferenceVO.getRoomId());
bodyParams.put("scheduleStartTime", scheduleStartTime);
bodyParams.put("scheduleEndTime", scheduleEndTime);
bodyParams.put("scheduleStartTime", startTime);
bodyParams.put("scheduleEndTime", endTime);
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());
@@ -2530,15 +2569,10 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
case 0:
// todo 不需要绑定,以后删 绑定房间号和案件id
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(),
startFormat, endFormat);
reservedConferenceVO.getScheduleStartTime(), reservedConferenceVO.getScheduleEndTime());
reservedConferenceMapper.insert(conference);
return AjaxResult.success("预约会议成功");
@@ -2549,7 +2583,7 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
case 84005:
return AjaxResult.error("房间号已被占用");
default:
return AjaxResult.error("预约会议失败");
return AjaxResult.error(resJson.getString("errorMessage"));
}
} else {
@@ -2565,6 +2599,8 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
*/
@Override
public void destroyRoomBack(String body, HttpServletRequest request) {
// todo 测试回调
reservedConferenceMapper.insert(new ReservedConference(999888L,body,null,null));
JSONObject jsonObject = (JSONObject) JSON.parse(body);
// 事件类型
Integer eventType = jsonObject.getInteger("EventType");
@@ -2579,7 +2615,35 @@ public class CaseApplicationServiceImpl implements ICaseApplicationService {
}
/**
* 根据案件id查询已预约的会议
* @param caseId
* @return
*/
@Override
@Transactional
public List<ReservedConference> reserveConferenceList(Long caseId) {
List<ReservedConference> reservedConferences = 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;
}
}