Просмотр исходного кода

卡导出,学习按时间统计

jinxia.mo 2 недель назад
Родитель
Сommit
d082a95dcc

+ 4 - 3
back-ui/src/views/dz/cards/index.vue

@@ -109,7 +109,7 @@
       <el-row :gutter="20">
         <el-col :span="6">
           <el-form-item label="使用状态" prop="status">
-            <ie-select v-model="queryParams.status" :options="CARD_STATUS" class="w-[180px]!" clearable />
+            <ie-select v-model="queryParams.status" :options="status" class="w-[180px]!" clearable />
           </el-form-item>
         </el-col>
         <el-col :span="6">
@@ -239,11 +239,12 @@ const {
 const {
   exam_type,
   card_distribute_status,
+  status,
   card_time_status,
   card_settlement_status,
   card_pay_status,
   card_type,
-} = proxy.useDict("exam_type", "card_distribute_status", "card_time_status", "card_settlement_status", "card_pay_status", "card_type");
+} = proxy.useDict("exam_type", "card_distribute_status", "status", "card_time_status", "card_settlement_status", "card_pay_status", "card_type");
 const cascaderProps = {
   label: "areaName",
   value: "areaId",
@@ -442,4 +443,4 @@ onMounted(() => {
   handleQuery();
 })
 </script>
-<style lang="scss" scoped></style>
+<style lang="scss" scoped></style>

+ 18 - 1
back-ui/src/views/learn/student/statisticStudyRecord.vue

@@ -100,6 +100,17 @@
                   style="width: 240px"
                 />
               </el-form-item>
+              <el-form-item label="学习时间" prop="studyTimeRange">
+                <el-date-picker
+                  v-model="queryParams.studyTimeRange"
+                  type="daterange"
+                  range-separator="至"
+                  start-placeholder="开始日期"
+                  end-placeholder="结束日期"
+                  value-format="YYYY-MM-DD"
+                  style="width: 240px"
+                />
+              </el-form-item>
               <el-form-item>
                 <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
                 <el-button icon="Refresh" @click="resetQuery">重置</el-button>
@@ -216,7 +227,8 @@ const queryParams = reactive({
   campusClassId: null,
   agentId: null,
   nickName: null,
-  cardNo: null
+  cardNo: null,
+  studyTimeRange: null
 })
 
 /** 查询统计列表 */
@@ -248,6 +260,10 @@ function getList() {
   if (queryParams.cardNo) {
     params.cardNo = queryParams.cardNo
   }
+  if (queryParams.studyTimeRange && queryParams.studyTimeRange.length === 2) {
+    params.studyTimeBegin = queryParams.studyTimeRange[0]
+    params.studyTimeEnd = queryParams.studyTimeRange[1]
+  }
   
   statisticStudyRecord(params).then(response => {
     console.log('统计接口响应:', response)
@@ -279,6 +295,7 @@ function resetQuery() {
   queryParams.agentId = null
   queryParams.nickName = null
   queryParams.cardNo = null
+  queryParams.studyTimeRange = null
   handleQuery()
 }
 

+ 1 - 1
ie-admin/src/main/java/com/ruoyi/web/domain/DzCardExport.java

@@ -39,7 +39,7 @@ public class DzCardExport {
     private Integer type;
     @Excel(name = "分配状态", readConverterExp = "0=未分配,1=已分配")
     private Integer distributeStatus;
-    @Excel(name = "使用状态", readConverterExp = "0=未开卡,1=已开卡,2=已激活")
+    @Excel(name = "使用状态", readConverterExp = "0=未激活,10=待开卡,20=开通卡,30=已激活")
     private Integer status;
     @Excel(name = "过期状态", readConverterExp = "9=已过期,10=已关卡,11=已失效")
     private Integer timeStatus;

+ 22 - 0
ie-system/src/main/java/com/ruoyi/learn/dto/StudyRecordStatisticsDTO.java

@@ -39,6 +39,12 @@ public class StudyRecordStatisticsDTO implements Serializable
     /** 卡号 */
     private String cardNo;
 
+    /** 学习时间开始 */
+    private String studyTimeBegin;
+
+    /** 学习时间结束 */
+    private String studyTimeEnd;
+
     /** 学生ID */
     private Long studentId;
 
@@ -178,6 +184,22 @@ public class StudyRecordStatisticsDTO implements Serializable
         this.cardNo = cardNo;
     }
 
+    public String getStudyTimeBegin() {
+        return studyTimeBegin;
+    }
+
+    public void setStudyTimeBegin(String studyTimeBegin) {
+        this.studyTimeBegin = studyTimeBegin;
+    }
+
+    public String getStudyTimeEnd() {
+        return studyTimeEnd;
+    }
+
+    public void setStudyTimeEnd(String studyTimeEnd) {
+        this.studyTimeEnd = studyTimeEnd;
+    }
+
     public Long getStudentId()
     {
         return studentId;

+ 13 - 0
ie-system/src/main/resources/mapper/learn/LearnStudentMapper.xml

@@ -128,6 +128,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             JOIN `learn_examinee` le ON le.student_id = u.user_id AND le.state >= 4
             JOIN `learn_answer` a ON a.`examinee_id` = le.`examinee_id` AND a.`state` > 0
             WHERE 1=1
+            <if test="studyTimeBegin != null and studyTimeBegin != ''">
+                AND (date(a.create_time) &gt;= date(#{studyTimeBegin}) OR date(le.end_time) &gt;= date(#{studyTimeBegin}))
+            </if>
+            <if test="studyTimeEnd != null and studyTimeEnd != ''">
+                AND (date(a.create_time) &lt;= date(#{studyTimeEnd}) OR date(le.end_time) &lt;= date(#{studyTimeEnd}))
+            </if>
             GROUP BY a.student_id
         ),
         T2 AS (
@@ -138,6 +144,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 ROUND(SUM(vw.duration * vw.percent / 100.0)) AS value
             FROM `b_customer_video_watches` vw
             JOIN `learn_student` ls ON vw.customerCode = ls.student_id
+            WHERE 1=1
+            <if test="studyTimeBegin != null and studyTimeBegin != ''">
+                AND date(vw.time) &gt;= date(#{studyTimeBegin})
+            </if>
+            <if test="studyTimeEnd != null and studyTimeEnd != ''">
+                AND date(vw.time) &lt;= date(#{studyTimeEnd})
+            </if>
             GROUP BY ls.student_id
         ),
         AllStudents AS (