Pārlūkot izejas kodu

fix:解决由于上周无服务指标数据导致的本周无数据

Joburgess 4 gadi atpakaļ
vecāks
revīzija
07b968dd9b

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentExtracurricularExercisesSituationDao.java

@@ -108,10 +108,10 @@ public interface StudentExtracurricularExercisesSituationDao extends BaseDAO<Lon
      * @describe 统计指定星期的服务记录数量
      * @author Joburgess
      * @date 2020/12/25 0025
-     * @param sunday:
+     * @param monday:
      * @return int
      */
-    int countWeekServiceNum(@Param("sunday") String sunday);
+    int countWeekServiceNum(@Param("monday") String monday);
 
     /**
      * @describe 获取指定周指定学员的服务指标

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServeServiceImpl.java

@@ -299,8 +299,9 @@ public class StudentServeServiceImpl implements StudentServeService {
     public void exercisesSituationStatistics2(String monday, List<Integer> studentIds) {
         LocalDate nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
 
+        int preWeekServiceNum = studentExtracurricularExercisesSituationDao.countWeekServiceNum(nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue()).plusDays(-7).toString());
         int lastWeekTodayUpdateNum = studentExtracurricularExercisesSituationDao.findLastWeekTodayUpdateNum(nowDate.plusDays(-nowDate.getDayOfWeek().getValue()).toString());
-        if(lastWeekTodayUpdateNum<=0){
+        if(preWeekServiceNum>0 && lastWeekTodayUpdateNum<=0){
             nowDate = nowDate.plusDays(-nowDate.getDayOfWeek().getValue());
         }
 

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/StudentExtracurricularExercisesSituationMapper.xml

@@ -471,7 +471,7 @@
 	</select>
 
 	<select id="countWeekServiceNum" resultType="int">
-		SELECT COUNT(id_) FROM student_extracurricular_exercises_situation_ WHERE monday_=#{sunday}
+		SELECT COUNT(id_) FROM student_extracurricular_exercises_situation_ WHERE monday_=#{monday}
 	</select>
 
 	<select id="findWeekServiceWithStudents" resultMap="StudentExtracurricularExercisesSituation">