|
@@ -0,0 +1,140 @@
|
|
|
+package com.ym.mec.web.controller;
|
|
|
+
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
+import com.microsvc.toolkit.common.response.paging.QueryInfo;
|
|
|
+import com.ym.mec.biz.dal.entity.StudentCoursewarePlayRecord;
|
|
|
+import com.ym.mec.biz.dal.enums.ExportEnum;
|
|
|
+import com.ym.mec.biz.dal.wrapper.StudentCoursewarePlayRecordWrapper;
|
|
|
+import com.ym.mec.biz.service.ExportService;
|
|
|
+import com.ym.mec.biz.service.OrganizationService;
|
|
|
+import com.ym.mec.biz.service.StudentCoursewarePlayRecordService;
|
|
|
+import com.ym.mec.common.controller.BaseController;
|
|
|
+import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
+import com.ym.mec.common.page.PageInfo;
|
|
|
+import com.ym.mec.common.page.PageUtil;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.beanutils.BeanUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@Validated
|
|
|
+@RestController
|
|
|
+@RequestMapping("${app-config.url.web:}/studentCoursewarePlayRecord")
|
|
|
+@Api(tags = "学生课件播放统计记录")
|
|
|
+public class StudentCoursewarePlayRecordController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private StudentCoursewarePlayRecordService studentCoursewarePlayRecordService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExportService exportService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private OrganizationService organizationService;
|
|
|
+
|
|
|
+ @ApiOperation(value = "详情", notes = "学生课件播放统计记录-根据详情ID查询单条, 传入id")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('studentCoursewarePlayRecord/detail')")
|
|
|
+// @GetMapping("/detail/{id}")
|
|
|
+ public HttpResponseResult<StudentCoursewarePlayRecord> detail(@PathVariable("id") Long id) {
|
|
|
+
|
|
|
+ StudentCoursewarePlayRecord wrapper = studentCoursewarePlayRecordService.detail(id);
|
|
|
+
|
|
|
+ return succeed(wrapper);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询分页", notes = "学生课件播放统计记录- 传入 StudentCoursewarePlayRecordWrapper.StudentCoursewarePlayRecordQuery")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('studentCoursewarePlayRecord/page')")
|
|
|
+// @PostMapping("/page")
|
|
|
+ public HttpResponseResult<PageInfo<StudentCoursewarePlayRecord>> page(@RequestBody StudentCoursewarePlayRecordWrapper.StudentCoursewarePlayRecordQuery query) {
|
|
|
+
|
|
|
+ IPage<StudentCoursewarePlayRecord> pages = studentCoursewarePlayRecordService.selectPage(QueryInfo.getPage(query), query);
|
|
|
+
|
|
|
+ return succeed(PageUtil.pageInfo(pages));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "新增", notes = "学生课件播放统计记录- 传入 StudentCoursewarePlayRecordWrapper.StudentCoursewarePlayRecord")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('studentCoursewarePlayRecord/save')")
|
|
|
+// @PostMapping("/save")
|
|
|
+ public HttpResponseResult<JSONObject> add(@Validated @RequestBody StudentCoursewarePlayRecordWrapper.StudentCoursewarePlayRecord studentCoursewarePlayRecord) {
|
|
|
+ return succeed();
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "修改", notes = "学生课件播放统计记录- 传入 StudentCoursewarePlayRecordWrapper.StudentCoursewarePlayRecord")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('studentCoursewarePlayRecord/update')")
|
|
|
+// @PostMapping("/update")
|
|
|
+ public HttpResponseResult<JSONObject> update(@Validated @RequestBody StudentCoursewarePlayRecord studentCoursewarePlayRecord) {
|
|
|
+
|
|
|
+ // 更新数据
|
|
|
+ studentCoursewarePlayRecordService.updateById(studentCoursewarePlayRecord);
|
|
|
+
|
|
|
+ return succeed();
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "删除", notes = "学生课件播放统计记录- 传入id")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('studentCoursewarePlayRecord/remove')")
|
|
|
+// @PostMapping("/remove")
|
|
|
+ public HttpResponseResult<Boolean> remove(@RequestParam Long id) {
|
|
|
+
|
|
|
+ return succeed(studentCoursewarePlayRecordService.removeById(id));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 练习统计
|
|
|
+ */
|
|
|
+ @PostMapping("/statList")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('studentCoursewarePlayRecord/statList')")
|
|
|
+ public HttpResponseResult<List<StudentCoursewarePlayRecordWrapper.StatQueryData>> statList(@RequestBody StudentCoursewarePlayRecordWrapper.StatQuery statQuery) {
|
|
|
+ statQuery.setOrganizationId(organizationService.getEmployeeOrgan(statQuery.getOrganizationId()));
|
|
|
+ return succeed(studentCoursewarePlayRecordService.statList(statQuery));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 练习统计导出
|
|
|
+ */
|
|
|
+ @PostMapping("/exportStatList")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('studentCoursewarePlayRecord/exportStatList')")
|
|
|
+ public HttpResponseResult exportStatList(@RequestBody StudentCoursewarePlayRecordWrapper.StatQuery statQuery) {
|
|
|
+ statQuery.setOrganizationId(organizationService.getEmployeeOrgan(statQuery.getOrganizationId()));
|
|
|
+ return exportService.getExportManageFuncMap().get(ExportEnum.VIDEO_PLAY_STAT).apply(JSON.parseObject(JSON.toJSONString(statQuery), Map.class));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 练习详情统计
|
|
|
+ */
|
|
|
+ @PostMapping("/statDetailPage")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('studentCoursewarePlayRecord/statDetailPage')")
|
|
|
+ public HttpResponseResult<PageInfo<StudentCoursewarePlayRecordWrapper.StatQueryData>> statDetailPage(@RequestBody StudentCoursewarePlayRecordWrapper.StatQuery statQuery) {
|
|
|
+ return succeed(PageUtil.pageInfo(studentCoursewarePlayRecordService.statDetailPage(statQuery)));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 练习统计详情导出
|
|
|
+ */
|
|
|
+ @PostMapping("/exportStatDetailPage")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('studentCoursewarePlayRecord/exportStatDetailPage')")
|
|
|
+ public HttpResponseResult exportStatDetailPage(@RequestBody StudentCoursewarePlayRecordWrapper.StatQuery statQuery) {
|
|
|
+ statQuery.setPage(1);
|
|
|
+ statQuery.setRows(9999);
|
|
|
+ return exportService.getExportManageFuncMap().get(ExportEnum.VIDEO_PLAY_DETAIL_STAT).apply(JSON.parseObject(JSON.toJSONString(statQuery), Map.class));
|
|
|
+ }
|
|
|
+}
|