he2802 1 سال پیش
والد
کامیت
a47119d8e6

+ 31 - 6
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/CertificateTpServiceImpl.java

@@ -365,7 +365,11 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
                 sex = "女";
             }
             vo.setSex(sex);
-            vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
+            Integer totalHour = 0;
+            for(CourseChapterVo chapterVo : chapterList){
+                totalHour+=chapterVo.getSectionNum();
+            }
+            vo.setClassHours(totalHour+"");
             vo.setDateY(nowDate.substring(0, 4));
             vo.setDateM(nowDate.substring(5, 7));
             vo.setDateD(nowDate.substring(8, 10));
@@ -395,7 +399,11 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
                 sex = "女";
             }
             vo.setSex(sex);
-            vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
+            Integer totalHour = 0;
+            for(CourseChapterVo chapterVo : chapterList){
+                totalHour+=chapterVo.getSectionNum();
+            }
+            vo.setClassHours(totalHour+"");
             vo.setDateY(nowDate.substring(0, 4));
             vo.setDateM(nowDate.substring(5, 7));
             vo.setDateD(nowDate.substring(8, 10));
@@ -425,7 +433,11 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
                 sex = "女";
             }
             vo.setSex(sex);
-            vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
+            Integer totalHour = 0;
+            for(CourseChapterVo chapterVo : chapterList){
+                totalHour+=chapterVo.getSectionNum();
+            }
+            vo.setClassHours(totalHour+"");
             vo.setDateY(nowDate.substring(0, 4));
             vo.setDateM(nowDate.substring(5, 7));
             vo.setDateD(nowDate.substring(8, 10));
@@ -455,7 +467,11 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
                 sex = "女";
             }
             vo.setSex(sex);
-            vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
+            Integer totalHour = 0;
+            for(CourseChapterVo chapterVo : chapterList){
+                totalHour+=chapterVo.getSectionNum();
+            }
+            vo.setClassHours(totalHour+"");
             vo.setDateY(nowDate.substring(0, 4));
             vo.setDateM(nowDate.substring(5, 7));
             vo.setDateD(nowDate.substring(8, 10));
@@ -485,7 +501,11 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
                 sex = "女";
             }
             vo.setSex(sex);
-            vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
+            Integer totalHour = 0;
+            for(CourseChapterVo chapterVo : chapterList){
+                totalHour+=chapterVo.getSectionNum();
+            }
+            vo.setClassHours(totalHour+"");
             vo.setDateY(nowDate.substring(0, 4));
             vo.setDateM(nowDate.substring(5, 7));
             vo.setDateD(nowDate.substring(8, 10));
@@ -515,7 +535,12 @@ public class CertificateTpServiceImpl extends ServiceImpl<CertificateTpMapper, C
                 sex = "女";
             }
             vo.setSex(sex);
-            vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
+            Integer totalHour = 0;
+            for(CourseChapterVo chapterVo : chapterList){
+                totalHour+=chapterVo.getSectionNum();
+            }
+            vo.setClassHours(totalHour+"");
+    //        vo.setClassHours(goodsVo.getClassHours().setScale( 0, BigDecimal.ROUND_HALF_UP )+"");
             vo.setDateY(nowDate.substring(0, 4));
             vo.setDateM(nowDate.substring(5, 7));
             vo.setDateD(nowDate.substring(8, 10));

+ 5 - 2
zhongzheng-system/src/main/resources/mapper/modules/grade/ClassGradeUserMapper.xml

@@ -254,6 +254,7 @@
         <result property="chapterId" column="chapter_id"/>
         <result property="name" column="name"/>
         <result property="commonSign" column="common_sign"/>
+        <result property="sectionNum" column="section_num"/>
     </resultMap>
 
     <select id="selectUser" parameterType="com.zhongzheng.modules.grade.bo.ClassGradeUserQueryBo"
@@ -1550,7 +1551,8 @@
         cc.chapter_id,
         cc.`name`,
         m.sort,
-        cm.common_sign
+        cm.common_sign,
+        (SELECT count(*) from course_chapter_section ccs WHERE ccs.chapter_id = cc.chapter_id) section_num
         FROM
         course_module_chapter p
         LEFT JOIN course_chapter cc ON p.chapter_id = cc.chapter_id
@@ -1567,7 +1569,8 @@
         cc.chapter_id,
         cc.`name`,
         m.sort,
-         0 as common_sign
+         0 as common_sign,
+        (SELECT count(*) from course_chapter_section ccs WHERE ccs.chapter_id = cc.chapter_id) section_num
         FROM
         course_menu m
         LEFT JOIN course_chapter cc ON m.menu_id = cc.chapter_id