|
@@ -103,6 +103,25 @@ public class OkcVideoProServiceImpl implements IOkcVideoProService
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+ public List<double[]> getRcCurve(String id) {
|
|
|
+ List<double[]> res = new ArrayList<>();
|
|
|
+ OkcVideoPro pro = okcVideoProMapper.selectOkcVideoProById(id);
|
|
|
+ if (ObjectUtils.isNotEmpty(pro)) {
|
|
|
+ OkcVideoRec recQuery = new OkcVideoRec();
|
|
|
+ recQuery.setVideoId(pro.getId());
|
|
|
+ List<OkcVideoRec> recList = okcVideoRecMapper.selectOkcVideoRecList(recQuery);
|
|
|
+ if (CollectionUtils.isEmpty(recList)) {
|
|
|
+ throw new ServiceException("暂无数据!");
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ res = RCUtils.getRcCharts(recList);
|
|
|
+ } catch(Exception e) {
|
|
|
+ throw new ServiceException("暂无数据!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
public List<Arc> getArc(String id) {
|
|
|
List<Arc> res = new ArrayList<>();
|
|
|
OkcVideoPro pro = okcVideoProMapper.selectOkcVideoProById(id);
|
|
@@ -859,16 +878,16 @@ public class OkcVideoProServiceImpl implements IOkcVideoProService
|
|
|
*/
|
|
|
public Map<String, String> createChRt(OkcVideoPro okcVideoPro, List<OkcVideoRec> recList, ChartsStatus chartsStatus) {
|
|
|
Map<String, String> res = new LinkedHashMap<>();
|
|
|
- List<String> teacherCon = BehavierType.getTeacherCon();
|
|
|
- List<String> mediaCon = MediaType.getTalkMedia();
|
|
|
- long allCount = recList.size();
|
|
|
- long teacherCount = recList.stream().filter(r -> teacherCon.contains(r.getBehavior())).count();
|
|
|
- long talkCount = recList.stream().filter(r -> mediaCon.contains(r.getMedia())).count();
|
|
|
- DecimalFormat df = new DecimalFormat("0.0");
|
|
|
- String x = String.valueOf(df.format((float) teacherCount / allCount));
|
|
|
- String y = String.valueOf(df.format((float) talkCount / allCount));
|
|
|
- Map<String,String> dataMap = new LinkedHashMap<>();
|
|
|
- dataMap.put(y, x);
|
|
|
+// List<String> teacherCon = BehavierType.getTeacherCon();
|
|
|
+// List<String> mediaCon = MediaType.getTalkMedia();
|
|
|
+// long allCount = recList.size();
|
|
|
+// long teacherCount = recList.stream().filter(r -> teacherCon.contains(r.getBehavior())).count();
|
|
|
+// long talkCount = recList.stream().filter(r -> mediaCon.contains(r.getMedia())).count();
|
|
|
+// DecimalFormat df = new DecimalFormat("0.0");
|
|
|
+// String x = String.valueOf(df.format((float) teacherCount / allCount));
|
|
|
+// String y = String.valueOf(df.format((float) talkCount / allCount));
|
|
|
+ Map<String,String> dataMap = getRtch(recList);
|
|
|
+// dataMap.put(y, x);
|
|
|
String filePath = RuoYiConfig.getProfile() + File.separator + okcVideoPro.getId() + File.separator +
|
|
|
chartsStatus.getFileName();
|
|
|
String title = chartsStatus.getTitle();
|
|
@@ -879,6 +898,55 @@ public class OkcVideoProServiceImpl implements IOkcVideoProService
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+ private Map<String, String> getRtch(List<OkcVideoRec> recList) {
|
|
|
+ Map<String, String> res = new LinkedHashMap<>();
|
|
|
+ List<Integer> stList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < recList.size(); i++) {
|
|
|
+ int num = RCEnum.getCodeByKey(recList.get(i).getBehavior());
|
|
|
+ // ST-2按照3s来切割
|
|
|
+ double keeptime = (new Double(recList.get(i).getEndTime()) - new Double(recList.get(i).getStartTime()));
|
|
|
+ int count = (int) (keeptime / 3);
|
|
|
+ if (num < 10)
|
|
|
+ {
|
|
|
+ for (int j = 0; j < count; j++)
|
|
|
+ {
|
|
|
+ stList.add(1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ for (int j = 0; j < count; j++)
|
|
|
+ {
|
|
|
+ stList.add(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ double T_num = 0;
|
|
|
+ double g_num = 0;
|
|
|
+ int last_num = -1;
|
|
|
+ for (int i = 0; i < stList.size(); i++)
|
|
|
+ {
|
|
|
+ if (stList.get(i) == 1)
|
|
|
+ {
|
|
|
+ T_num++;
|
|
|
+ }
|
|
|
+ if (stList.get(i) != last_num)
|
|
|
+ {
|
|
|
+ g_num++;
|
|
|
+ }
|
|
|
+ last_num = stList.get(i);
|
|
|
+ }
|
|
|
+ double rt = 0;
|
|
|
+ double ch = 0;
|
|
|
+ if (stList.size() != 0)
|
|
|
+ {
|
|
|
+ rt = T_num / stList.size();
|
|
|
+ ch = (g_num - 1) / stList.size();
|
|
|
+ }
|
|
|
+ res.put(String.valueOf(rt), String.valueOf(ch));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
private void mkdirs(String filePath) {
|
|
|
File desc = new File(filePath);
|
|
|
if (!desc.exists()) {
|