dzx 8 місяців тому
батько
коміт
44f820d023

+ 3 - 3
src/main/java/com/xjrsoft/module/job/EnrollmentStatisticsInfoTask.java

@@ -47,12 +47,13 @@ public class EnrollmentStatisticsInfoTask {
 
     void doExecute() {
         LocalDate now = LocalDate.now();
+        String dataDate = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
         EnrollmentStatisticsInfoDto dto = new EnrollmentStatisticsInfoDto();
 //        dto.setDay(now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
         dto.setYear(now.getYear() + "");
         EnrollmentStatisticsInfoVo info = pbCseFeeobjupdateService.getEnrollmentStatisticsInfo(dto);
         if(info != null){
-
+            enrollmentStatisticsInfoMapper.deleteDataByDate(dataDate);
             EnrollmentStatisticsInfo infoData = new EnrollmentStatisticsInfo();
             infoData.setEnabledMark(EnabledMark.ENABLED.getCode());
             infoData.setDeleteMark(DeleteMark.NODELETE.getCode());
@@ -60,10 +61,10 @@ public class EnrollmentStatisticsInfoTask {
             infoData.setCreateUserId(1000000000000000000L);
             infoData.setDataJson(JsonUtil.toJsonString(info));
             infoData.setDataType(1);
+            infoData.setDataDay(now);
             enrollmentStatisticsInfoMapper.insert(infoData);
         }
 
-        String dataDate = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
         EnrollmentStatisticsGraduationInfoDto graduationInfoDto = new EnrollmentStatisticsGraduationInfoDto();
         graduationInfoDto.setDay(dataDate);
         EnrollmentStatisticsGraduationInfoVo graduationInfo = pbCseFeeobjupdateService.getEnrollmentStatisticsGraduationInfo(graduationInfoDto);
@@ -82,7 +83,6 @@ public class EnrollmentStatisticsInfoTask {
             enrollmentStatisticsInfoMapper.insert(infoData);
         }
 
-
         LocalDate thisSaturday = now.with(TemporalAdjusters.nextOrSame(DayOfWeek.SATURDAY));
         LocalDate thisMonday = now.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
         LocalDate lastSunday = thisMonday.minusDays(1);

+ 3 - 0
src/main/java/com/xjrsoft/module/student/mapper/EnrollmentStatisticsInfoMapper.java

@@ -16,6 +16,9 @@ import org.apache.ibatis.annotations.Param;
 @Mapper
 public interface EnrollmentStatisticsInfoMapper extends MPJBaseMapper<EnrollmentStatisticsInfo> {
 
+    @Delete("delete from enrollment_statistics_info where delete_mark = 0 and data_day = #{dataDay} and data_type = 1")
+    Boolean deleteDataByDate(@Param("dataDay") String dataDay);
+
     @Delete("delete from enrollment_statistics_info where delete_mark = 0 and data_day = #{dataDay} and data_type = 2")
     Boolean deleteGraduationDataByDate(@Param("dataDay") String dataDay);
 

+ 3 - 2
src/test/java/com/xjrsoft/module/job/EnrollmentStatisticsInfoTaskTest.java

@@ -47,12 +47,13 @@ class EnrollmentStatisticsInfoTaskTest {
 
     void doExecute() {
         LocalDate now = LocalDate.now();
+        String dataDate = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
         EnrollmentStatisticsInfoDto dto = new EnrollmentStatisticsInfoDto();
 //        dto.setDay(now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
         dto.setYear(now.getYear() + "");
         EnrollmentStatisticsInfoVo info = pbCseFeeobjupdateService.getEnrollmentStatisticsInfo(dto);
         if(info != null){
-
+            enrollmentStatisticsInfoMapper.deleteDataByDate(dataDate);
             EnrollmentStatisticsInfo infoData = new EnrollmentStatisticsInfo();
             infoData.setEnabledMark(EnabledMark.ENABLED.getCode());
             infoData.setDeleteMark(DeleteMark.NODELETE.getCode());
@@ -60,10 +61,10 @@ class EnrollmentStatisticsInfoTaskTest {
             infoData.setCreateUserId(1000000000000000000L);
             infoData.setDataJson(JsonUtil.toJsonString(info));
             infoData.setDataType(1);
+            infoData.setDataDay(now);
             enrollmentStatisticsInfoMapper.insert(infoData);
         }
 
-        String dataDate = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
         EnrollmentStatisticsGraduationInfoDto graduationInfoDto = new EnrollmentStatisticsGraduationInfoDto();
         graduationInfoDto.setDay(dataDate);
         EnrollmentStatisticsGraduationInfoVo graduationInfo = pbCseFeeobjupdateService.getEnrollmentStatisticsGraduationInfo(graduationInfoDto);