Commit c58316da by 邓敏

Merge branch 'websocker'

2 parents b3033f79 f1aff5ff
......@@ -84,4 +84,25 @@ public class CompanyDictController {
return ResponseData.generateCreatedResponse(0,companyDictService.memberSummary(getCompanyMembersDTO));
}
@PostMapping(value = "getCompanyDataOverview")
@ApiOperation("数据统计")
@LoginRequired
public ResponseVO getCompanyDataOverview() {
return ResponseData.generateCreatedResponse(0, companyDictService.getCompanyDataOverview());
}
@PostMapping(value = "getCDNBandwidthStatDetails")
@ApiOperation("带宽使用情况")
@LoginRequired
public ResponseVO getCDNBandwidthStatDetails() {
return ResponseData.generateCreatedResponse(0, companyDictService.getCDNBandwidthStatDetails());
}
@PostMapping(value = "getCDNFluxStatDetails")
@ApiOperation("流量使用情况")
@LoginRequired
public ResponseVO getCDNFluxStatDetails() {
return ResponseData.generateCreatedResponse(0, companyDictService.getCDNFluxStatDetails());
}
}
......@@ -6,8 +6,10 @@ import com.subsidy.model.ClassDictDO;
import com.subsidy.model.MemberDO;
import com.subsidy.model.VodDictDO;
import com.subsidy.vo.classdict.ClassAndCompanyInfoVO;
import com.subsidy.vo.classdict.ClassSettingsVO;
import com.subsidy.vo.classdict.GetAllClassesVO;
import com.subsidy.vo.classdict.GetClassBaseInfoVO;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
......@@ -55,4 +57,6 @@ public interface ClassDictMapper extends BaseMapper<ClassDictDO> {
ClassAndCompanyInfoVO getClassAndCompanyInfoVO(Long classId);
Integer getClassCount();
List<ClassSettingsVO> getClassSettings(@Param("userId") Long userId);
}
......@@ -364,6 +364,7 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
* 根据今天时间查询七天前的数据
* 先从缓存中获取数据,如果缓存中没有数据,从远程请求中获取, 避免频繁请求
* 缓存28800秒(8小时)失效,重新远程请求更新数据
* 返回数据单位:bps, 转换成Mbps, 1Mbps = 1000000bps
*/
List<CDNStatDetailsVO> data = new ArrayList<>();
if(EhCacheUtil.getEhCache(VodConstant.CDN_STAT_DETAILS_CACHE_NAME, VodConstant.BANDWIDTH_CACHE_KEY) != null) {
......@@ -392,6 +393,7 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
* 根据今天时间查询七天前的数据
* 先从缓存中获取数据,如果缓存中没有数据,从远程请求中获取,避免频繁请求
* 缓存28800秒(8小时)失效,重新远程请求更新数据
* 返回数据单位:B, 转换成GB
*/
List<CDNStatDetailsVO> data = new ArrayList<>();
if(EhCacheUtil.getEhCache(VodConstant.CDN_STAT_DETAILS_CACHE_NAME, VodConstant.FLUX_CACHE_KEY) != null) {
......
......@@ -3,11 +3,14 @@ package com.subsidy.util.websocket;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.subsidy.common.ResponseData;
import com.subsidy.mapper.ClassDictMapper;
import com.subsidy.mapper.OprMemDictMapper;
import com.subsidy.model.OprMemDictDO;
import com.subsidy.util.DateFormatUtil;
import com.subsidy.vo.classdict.ClassSettingsVO;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.CloseStatus;
......@@ -40,6 +43,9 @@ public class WebSocketUtil implements WebSocketHandler {
@Autowired
private OprMemDictMapper oprMemDictMapper;
@Autowired
private ClassDictMapper classDictMapper;
private int heartbeatMin = 1; // 断连最小心跳次数
private int heartbeatMax = 3; // 断连最大心跳次数
private int reconnectionSeconds = 60; //每次断连间隔重新连接秒
......@@ -93,6 +99,11 @@ public class WebSocketUtil implements WebSocketHandler {
}
webSocketMap.put(id, session);
List<ClassSettingsVO> list = classDictMapper.getClassSettings(id);
if(CollectionUtils.isNotEmpty(list)) {
webSocketMap.get(id).sendMessage(new TextMessage(JSONObject.toJSONString(ResponseData.generateCreatedResponse(0, list))));
}
String httpSessionId = session.getId();
String host = session.getUri().getHost();
String query = session.getUri().getQuery();
......
package com.subsidy.vo.classdict;
import lombok.Data;
@Data
public class ClassSettingsVO {
/**
* 是否按照顺序播放
*/
private Integer isOrder;
/**
* 是否允许快进
*/
private Integer isFastPlay;
/**
* 测试规则
*/
private Integer testRule;
/**
* 学习上限时长
*/
private Integer limitHour;
/**
* 首次进入班级时人脸验证
*/
private Integer imageClassCheck;
/**
* 测试前人脸识别验证
*/
private Integer imageTestCheck;
/**
* 活跃度检测开启/关闭
*/
private Integer activityDetection;
/**
* 活跃度检测方式
*/
private Integer activityDetectionMethod;
/**
* 首次播放允许拖曳
*/
private Integer firstDragAllowed;
/**
* 首次播放允许倍速
*/
private Integer firstSpeedAllowed;
/**
* 课时抓拍
*/
private Integer playSnap;
/**
*
*/
private Integer ipAddressRecord;
/**
*
*/
private Integer deviceNoRecord;
}
......@@ -181,4 +181,20 @@
AND t1.delete_date IS NULL
AND t2.delete_date IS NULL
</select>
<select id="getClassSettings" resultType="com.subsidy.vo.classdict.ClassSettingsVO">
SELECT
t1.*,
t3.ip_address_record,
t3.device_no_record
FROM
class_dict t1
LEFT JOIN class_member_mapping t2 ON t2.class_id = t1.id
LEFT JOIN company_dict t3 ON t3.id = t1.company_id
WHERE
t2.member_id = #{userId}
AND t1.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
</select>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!