18792927508 2 лет назад
Родитель
Сommit
9bb23badc0

+ 1
- 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/wisdomarbitrate/CaseApplicationController.java Просмотреть файл

393
      * @param caseId
393
      * @param caseId
394
      * @return
394
      * @return
395
      */
395
      */
396
+    @Anonymous
396
     @GetMapping("/reserveConferenceList")
397
     @GetMapping("/reserveConferenceList")
397
     public AjaxResult reserveConferenceList(  @RequestParam("caseId") Long caseId) {
398
     public AjaxResult reserveConferenceList(  @RequestParam("caseId") Long caseId) {
398
 
399
 

+ 12
- 4
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/ReservedConference.java Просмотреть файл

1
 package com.ruoyi.wisdomarbitrate.domain;
1
 package com.ruoyi.wisdomarbitrate.domain;
2
 
2
 
3
+import com.fasterxml.jackson.annotation.JsonFormat;
3
 import lombok.Data;
4
 import lombok.Data;
4
 
5
 
6
+import java.util.Date;
7
+
5
 /**
8
 /**
6
  * @author wangqiong
9
  * @author wangqiong
7
  * @description 预定会议
10
  * @description 预定会议
13
     /**
16
     /**
14
      * id
17
      * id
15
      */
18
      */
16
-    private String id;
19
+    private Long id;
17
     /**
20
     /**
18
      * 案件id
21
      * 案件id
19
      */
22
      */
25
     /**
28
     /**
26
      * 预定会议开始时间
29
      * 预定会议开始时间
27
      */
30
      */
28
-    private String scheduleStartTime;
31
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
32
+    private Date scheduleStartTime;
29
     /**
33
     /**
30
      * 预定会议结束时间
34
      * 预定会议结束时间
31
      */
35
      */
32
-    private String scheduleEndTime;
36
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
37
+    private Date scheduleEndTime;
38
+
39
+    public ReservedConference() {
40
+    }
33
 
41
 
34
-    public ReservedConference( Long caseId, String roomId, String scheduleStartTime, String scheduleEndTime) {
42
+    public ReservedConference(Long caseId, String roomId, Date scheduleStartTime, Date scheduleEndTime) {
35
         this.caseId = caseId;
43
         this.caseId = caseId;
36
         this.roomId = roomId;
44
         this.roomId = roomId;
37
         this.scheduleStartTime = scheduleStartTime;
45
         this.scheduleStartTime = scheduleStartTime;

+ 6
- 8
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/ReservedConferenceVO.java Просмотреть файл

1
 package com.ruoyi.wisdomarbitrate.domain.vo;
1
 package com.ruoyi.wisdomarbitrate.domain.vo;
2
 
2
 
3
+import com.fasterxml.jackson.annotation.JsonFormat;
3
 import lombok.Data;
4
 import lombok.Data;
4
 
5
 
5
 import javax.validation.constraints.NotEmpty;
6
 import javax.validation.constraints.NotEmpty;
6
 import javax.validation.constraints.NotNull;
7
 import javax.validation.constraints.NotNull;
8
+import java.util.Date;
7
 
9
 
8
 /**
10
 /**
9
  * @author wangqiong
11
  * @author wangqiong
22
      */
24
      */
23
     @NotEmpty(message = "房主id不能为空")
25
     @NotEmpty(message = "房主id不能为空")
24
     private String roomId;
26
     private String roomId;
25
-    /**
26
-     * 会议开始时间
27
-     */
28
     @NotNull(message = "会议开始时间不能为空")
27
     @NotNull(message = "会议开始时间不能为空")
29
-    private Integer scheduleStartTime;
30
-    /**
31
-     * 会议结束时间
32
-     */
28
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
29
+    private Date scheduleStartTime;
33
     @NotNull(message = "会议结束时间不能为空")
30
     @NotNull(message = "会议结束时间不能为空")
34
-    private Integer scheduleEndTime;
31
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
32
+    private Date scheduleEndTime;
35
     @NotNull(message = "案件id不能为空")
33
     @NotNull(message = "案件id不能为空")
36
     private Long caseId;
34
     private Long caseId;
37
 }
35
 }

+ 6
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/domain/vo/SendRoomNoMessageVO.java Просмотреть файл

1
 package com.ruoyi.wisdomarbitrate.domain.vo;
1
 package com.ruoyi.wisdomarbitrate.domain.vo;
2
 
2
 
3
+import com.fasterxml.jackson.annotation.JsonFormat;
3
 import lombok.Data;
4
 import lombok.Data;
4
 
5
 
5
 import javax.validation.constraints.NotEmpty;
6
 import javax.validation.constraints.NotEmpty;
6
 import javax.validation.constraints.NotNull;
7
 import javax.validation.constraints.NotNull;
7
 import java.io.Serializable;
8
 import java.io.Serializable;
9
+import java.util.Date;
8
 
10
 
9
 /**
11
 /**
10
  * @author wangqiong
12
  * @author wangqiong
18
     private Long id;
20
     private Long id;
19
     @NotEmpty(message = "房间号不能为空")
21
     @NotEmpty(message = "房间号不能为空")
20
     private String roomNo;
22
     private String roomNo;
21
-
23
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
24
+    private Date scheduleStartTime;
25
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
26
+    private Date scheduleEndTime;
22
 
27
 
23
 
28
 
24
 }
29
 }

+ 4
- 1
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/mapper/ReservedConferenceMapper.java Просмотреть файл

1
 package com.ruoyi.wisdomarbitrate.mapper;
1
 package com.ruoyi.wisdomarbitrate.mapper;
2
 
2
 
3
 import com.ruoyi.wisdomarbitrate.domain.ReservedConference;
3
 import com.ruoyi.wisdomarbitrate.domain.ReservedConference;
4
-import org.springframework.data.repository.query.Param;
4
+import org.apache.ibatis.annotations.Param;
5
 import org.springframework.stereotype.Repository;
5
 import org.springframework.stereotype.Repository;
6
 
6
 
7
 
7
 
34
      * @param roomId
34
      * @param roomId
35
      */
35
      */
36
     void deleteByRoomId(@Param("roomId")String roomId);
36
     void deleteByRoomId(@Param("roomId")String roomId);
37
+
38
+
39
+    void batchDeleteByIds(@Param("ids") List<Long> ids);
37
 }
40
 }

+ 67
- 20
ruoyi-system/src/main/java/com/ruoyi/wisdomarbitrate/service/impl/CaseApplicationServiceImpl.java Просмотреть файл

33
 import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
33
 import com.ruoyi.wisdomarbitrate.service.ICaseApplicationService;
34
 import com.ruoyi.wisdomarbitrate.utils.SignAward;
34
 import com.ruoyi.wisdomarbitrate.utils.SignAward;
35
 import com.ruoyi.wisdomarbitrate.utils.UnZipFileUtils;
35
 import com.ruoyi.wisdomarbitrate.utils.UnZipFileUtils;
36
+import com.tencentcloudapi.common.Credential;
37
+import com.tencentcloudapi.common.exception.TencentCloudSDKException;
38
+import com.tencentcloudapi.common.profile.ClientProfile;
39
+import com.tencentcloudapi.common.profile.HttpProfile;
40
+import com.tencentcloudapi.trtc.v20190722.TrtcClient;
41
+import com.tencentcloudapi.trtc.v20190722.models.DismissRoomByStrRoomIdRequest;
42
+import com.tencentcloudapi.trtc.v20190722.models.DismissRoomByStrRoomIdResponse;
36
 import com.tencentyun.TLSSigAPIv2;
43
 import com.tencentyun.TLSSigAPIv2;
37
 import org.apache.http.HttpEntity;
44
 import org.apache.http.HttpEntity;
38
 import org.apache.http.client.methods.CloseableHttpResponse;
45
 import org.apache.http.client.methods.CloseableHttpResponse;
1878
         String returnResult = "短信发送成功";
1885
         String returnResult = "短信发送成功";
1879
         //todo 需要申请模板,申请人,被申请人发送短信通知
1886
         //todo 需要申请模板,申请人,被申请人发送短信通知
1880
         SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
1887
         SmsUtils.SendSmsRequest request = new SmsUtils.SendSmsRequest();
1881
-        request.setTemplateId("1952136");
1888
+        String startFormat="";
1889
+        String  endFormat="";
1890
+        // 创建房间短信通知
1891
+        if (messageVO.getScheduleStartTime() == null) {
1892
+            request.setTemplateId("1983692");
1893
+        } else {
1894
+            String format = "yyyy/MM/dd HH:mm:ss"; // 目标格式
1895
+            Date startDate =messageVO.getScheduleStartTime();
1896
+            Date endDate = messageVO.getScheduleEndTime();
1897
+            SimpleDateFormat sdf = new SimpleDateFormat(format);
1898
+            startFormat = sdf.format(startDate);
1899
+            endFormat = sdf.format(endDate);
1900
+            // 预约会议短信模板
1901
+            request.setTemplateId("1983711");
1902
+        }
1903
+
1882
         for (CaseAffiliate caseAffiliate : caseAffiliates) {
1904
         for (CaseAffiliate caseAffiliate : caseAffiliates) {
1883
             request.setPhone(caseAffiliate.getContactTelphone());
1905
             request.setPhone(caseAffiliate.getContactTelphone());
1884
             String userId = (null==caseAffiliate.getUserId()?"" : caseAffiliate.getUserId());
1906
             String userId = (null==caseAffiliate.getUserId()?"" : caseAffiliate.getUserId());
1885
-            request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplicationselect.getCaseNum(), messageVO.getRoomNo()+userId});
1886
-            // 1952136 普通短信 尊敬的{1}用户,您的{2}仲裁案件,开庭审理房间号为{3},请在浏览器打开https://miniapp-3gpama6l759911ef-1321289474.tcloudbaseapp.com/jump-mp.html 请知晓,如非本人操作,请忽略本短信。
1907
+            if(messageVO.getScheduleStartTime()==null) {
1908
+                // 1983692	开庭审理创建会议通知  尊敬的{1}用户,您的{2}仲裁案件,开庭审理房间号为{3},请点击https://txroom.xayunmei.com/#/home, 请知晓,如非本人操作,请忽略本短信。
1909
+                request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplicationselect.getCaseNum(), messageVO.getRoomNo() + userId});
1910
+            }else {
1911
+                //  1983711 开庭审理预约会议短信通知  尊敬的{1}用户,您的{2}仲裁案件,开庭审理房间号为{3},会议时间为{4},请点击https://txroom.xayunmei.com/#/home, 请知晓,如非本人操作,请忽略本短信。
1912
+                request.setTemplateParamSet(new String[]{caseAffiliate.getName(), caseApplicationselect.getCaseNum(), messageVO.getRoomNo() + userId,startFormat+"-"+endFormat});
1913
+            }
1887
             Boolean aBoolean = SmsUtils.sendSms(request);
1914
             Boolean aBoolean = SmsUtils.sendSms(request);
1888
             //保存短信发送记录
1915
             //保存短信发送记录
1889
             SmsSendRecord smsSendRecord = new SmsSendRecord();
1916
             SmsSendRecord smsSendRecord = new SmsSendRecord();
1891
             smsSendRecord.setCaseNum(caseApplicationselect.getCaseNum());
1918
             smsSendRecord.setCaseNum(caseApplicationselect.getCaseNum());
1892
             smsSendRecord.setPhone(request.getPhone());
1919
             smsSendRecord.setPhone(request.getPhone());
1893
             smsSendRecord.setSendTime(new Date());
1920
             smsSendRecord.setSendTime(new Date());
1894
-            String content = "尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplicationselect.getCaseNum() + "仲裁案件,开庭审理房间号为" + messageVO.getRoomNo()+userId + ",https://txroom.xayunmei.com/#/home, 请知晓,如非本人操作,请忽略本短信。";
1921
+            String content="";
1922
+            if(messageVO.getScheduleStartTime()==null) {
1923
+                 content = "尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplicationselect.getCaseNum() + "仲裁案件,开庭审理房间号为" + messageVO.getRoomNo() + userId + ",请点击https://txroom.xayunmei.com/#/home, 请知晓,如非本人操作,请忽略本短信。";
1924
+            }else {
1925
+                content = "尊敬的" + caseAffiliate.getName() + "用户,您的" + caseApplicationselect.getCaseNum() + "仲裁案件,开庭审理房间号为" + messageVO.getRoomNo() + userId +"会议时间为"+startFormat+"-"+endFormat+ ",请点击https://txroom.xayunmei.com/#/home, 请知晓,如非本人操作,请忽略本短信。";
1926
+
1927
+            }
1895
             smsSendRecord.setSendContent(content);
1928
             smsSendRecord.setSendContent(content);
1896
 
1929
 
1897
             String userName;
1930
             String userName;
2477
         if (StrUtil.isEmpty(userSign)) {
2510
         if (StrUtil.isEmpty(userSign)) {
2478
             return AjaxResult.error("生成userSign失败");
2511
             return AjaxResult.error("生成userSign失败");
2479
         }
2512
         }
2480
-        Integer scheduleStartTime = reservedConferenceVO.getScheduleStartTime();
2481
-        Integer scheduleEndTime = reservedConferenceVO.getScheduleEndTime();
2513
+        Date startTime = reservedConferenceVO.getScheduleStartTime();
2514
+        Date endTime = reservedConferenceVO.getScheduleEndTime();
2482
         Random rand = new Random();
2515
         Random rand = new Random();
2483
         int random = rand.nextInt(214748365);
2516
         int random = rand.nextInt(214748365);
2484
         String url="https://roomkit.trtc.tencent-cloud.com/room_api/v1/roomctl/create?usersig=" + userSign + "&identifier=" + administrator + "&sdkappid=" + sdkAppId + "&random=" +random + "&contenttype=json";
2517
         String url="https://roomkit.trtc.tencent-cloud.com/room_api/v1/roomctl/create?usersig=" + userSign + "&identifier=" + administrator + "&sdkappid=" + sdkAppId + "&random=" +random + "&contenttype=json";
2489
         JSONObject roomParams = new JSONObject();
2522
         JSONObject roomParams = new JSONObject();
2490
         bodyParams.put("ownerId", reservedConferenceVO.getOwnerId());
2523
         bodyParams.put("ownerId", reservedConferenceVO.getOwnerId());
2491
         bodyParams.put("roomId", reservedConferenceVO.getRoomId());
2524
         bodyParams.put("roomId", reservedConferenceVO.getRoomId());
2492
-        bodyParams.put("scheduleStartTime", scheduleStartTime);
2493
-        bodyParams.put("scheduleEndTime",scheduleEndTime);
2525
+        bodyParams.put("scheduleStartTime",startTime.getTime()/1000 );
2526
+        bodyParams.put("scheduleEndTime",endTime.getTime()/1000);
2494
         roomParams.put("roomType", 1);
2527
         roomParams.put("roomType", 1);
2495
         bodyParams.put("roomInfo", roomParams);
2528
         bodyParams.put("roomInfo", roomParams);
2496
         StringEntity postingString = new StringEntity(bodyParams.toString());
2529
         StringEntity postingString = new StringEntity(bodyParams.toString());
2508
                 case 0:
2541
                 case 0:
2509
                     // todo  不需要绑定,以后删        绑定房间号和案件id
2542
                     // todo  不需要绑定,以后删        绑定房间号和案件id
2510
                     caseApplicationMapper.bindCaseId(reservedConferenceVO.getCaseId(), reservedConferenceVO.getRoomId());
2543
                     caseApplicationMapper.bindCaseId(reservedConferenceVO.getCaseId(), reservedConferenceVO.getRoomId());
2511
-                    String format = "yyyy-MM-dd HH:mm:ss"; // 目标格式
2512
-                    Date startDate = new Date(scheduleStartTime);
2513
-                    Date endDate = new Date(scheduleEndTime);
2514
-                    SimpleDateFormat sdf = new SimpleDateFormat(format);
2515
-                    String startFormat = sdf.format(startDate);
2516
-                    String endFormat = sdf.format(endDate);
2544
+
2517
                     // 新增预约会议表
2545
                     // 新增预约会议表
2518
                     ReservedConference conference = new ReservedConference(reservedConferenceVO.getCaseId(), reservedConferenceVO.getRoomId(),
2546
                     ReservedConference conference = new ReservedConference(reservedConferenceVO.getCaseId(), reservedConferenceVO.getRoomId(),
2519
-                            startFormat, endFormat);
2547
+                            reservedConferenceVO.getScheduleStartTime(), reservedConferenceVO.getScheduleEndTime());
2520
                     reservedConferenceMapper.insert(conference);
2548
                     reservedConferenceMapper.insert(conference);
2521
                     return AjaxResult.success("预约会议成功");
2549
                     return AjaxResult.success("预约会议成功");
2522
 
2550
 
2527
                 case 84005:
2555
                 case 84005:
2528
                     return AjaxResult.error("房间号已被占用");
2556
                     return AjaxResult.error("房间号已被占用");
2529
                 default:
2557
                 default:
2530
-                    return AjaxResult.error("预约会议失败");
2558
+                    return AjaxResult.error(resJson.getString("errorMessage"));
2531
             }
2559
             }
2532
 
2560
 
2533
         } else {
2561
         } else {
2542
      */
2570
      */
2543
     @Override
2571
     @Override
2544
     public void destroyRoomBack(String body, HttpServletRequest request) {
2572
     public void destroyRoomBack(String body, HttpServletRequest request) {
2573
+        // todo 测试回调
2574
+        reservedConferenceMapper.insert(new ReservedConference(999888L,body,null,null));
2545
         JSONObject jsonObject = (JSONObject) JSON.parse(body);
2575
         JSONObject jsonObject = (JSONObject) JSON.parse(body);
2546
         // 事件类型
2576
         // 事件类型
2547
         Integer eventType = jsonObject.getInteger("EventType");
2577
         Integer eventType = jsonObject.getInteger("EventType");
2562
      * @return
2592
      * @return
2563
      */
2593
      */
2564
     @Override
2594
     @Override
2595
+    @Transactional
2565
     public List<ReservedConference> reserveConferenceList(Long caseId) {
2596
     public List<ReservedConference> reserveConferenceList(Long caseId) {
2566
-
2567
-        return reservedConferenceMapper.selectListByCaseId(caseId);
2597
+        List<ReservedConference> reservedConferences = reservedConferenceMapper.selectListByCaseId(caseId);
2598
+        List<ReservedConference> result = new ArrayList<>();
2599
+        // 判断当前时间是否大于结束时间,如果大于,则把该房间删掉
2600
+        if (CollectionUtil.isNotEmpty(reservedConferences)) {
2601
+            List<Long> ids = new ArrayList<>();
2602
+            for (ReservedConference reservedConference : reservedConferences) {
2603
+                Date endTime = reservedConference.getScheduleEndTime();
2604
+                Date now = new Date();
2605
+                if (now.after(endTime)) {
2606
+                    ids.add(reservedConference.getId());
2607
+                } else {
2608
+                    result.add(reservedConference);
2609
+                }
2610
+            }
2611
+            if (CollectionUtil.isNotEmpty(ids)) {
2612
+                // 根据id批量删除
2613
+                reservedConferenceMapper.batchDeleteByIds(ids);
2614
+            }
2615
+        }
2616
+        return result;
2568
     }
2617
     }
2569
-
2570
-
2571
 }
2618
 }
2572
 
2619
 
2573
 
2620
 

+ 9
- 9
ruoyi-system/src/main/resources/mapper/wisdomarbitrate/ReservedConferenceMapper.xml Просмотреть файл

3
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
3
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
4
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5
 <mapper namespace="com.ruoyi.wisdomarbitrate.mapper.ReservedConferenceMapper">
5
 <mapper namespace="com.ruoyi.wisdomarbitrate.mapper.ReservedConferenceMapper">
6
-    <resultMap type="com.ruoyi.wisdomarbitrate.domain.ReservedConference" id="BaseResult">
7
-        <id     property="id"       column="id"      />
8
-        <result property="caseId"     column="case_id"    />
9
-        <result property="roomId"     column="room_id"    />
10
-        <result property="scheduleStartTime"        column="schedule_start_time"        />
11
-        <result property="scheduleEndTime"  column="schedule_end_time"  />
12
 
6
 
13
-    </resultMap>
14
     <insert id="insert">
7
     <insert id="insert">
15
         insert into reserved_conference(
8
         insert into reserved_conference(
16
         case_id,
9
         case_id,
27
     <delete id="deleteByRoomId">
20
     <delete id="deleteByRoomId">
28
         delete from reserved_conference where room_id=#{roomId}
21
         delete from reserved_conference where room_id=#{roomId}
29
     </delete>
22
     </delete>
30
-    <select id="selectListByCaseId" resultMap="BaseResult">
31
-        select * from reserved_conference where case_id=#{caseId}
23
+    <delete id="batchDeleteByIds">
24
+        delete from reserved_conference where id in
25
+        <foreach collection="ids" item="item" open="(" separator="," close=")">
26
+            #{item}
27
+        </foreach>
28
+    </delete>
29
+    <select id="selectListByCaseId" resultType="com.ruoyi.wisdomarbitrate.domain.ReservedConference">
30
+        select id, case_id caseId,room_id roomId,schedule_start_time scheduleStartTime,schedule_end_time scheduleEndTime
31
+        from reserved_conference where case_id=#{caseId}
32
     </select>
32
     </select>
33
 
33
 
34
 
34