Explorar el Código

招生统计触发逻辑调整

dzx hace 7 meses
padre
commit
d6265b2bba

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

@@ -6,7 +6,7 @@ import com.xjrsoft.module.student.dto.EnrollmentStatisticsCalendarInfoDto;
 import com.xjrsoft.module.student.dto.EnrollmentStatisticsGraduationInfoDto;
 import com.xjrsoft.module.student.dto.EnrollmentStatisticsInfoDto;
 import com.xjrsoft.module.student.entity.EnrollmentStatisticsInfo;
-import com.xjrsoft.module.student.mapper.EnrollmentStatisticsInfoMapper;
+import com.xjrsoft.module.student.service.IEnrollmentStatisticsInfoService;
 import com.xjrsoft.module.student.service.IPbCseFeeobjupdateService;
 import com.xjrsoft.module.student.vo.EnrollmentStatisticsCalendarInfoVo;
 import com.xjrsoft.module.student.vo.EnrollmentStatisticsGraduationInfoVo;
@@ -39,15 +39,15 @@ public class EnrollmentStatisticsInfoTask {
     private IPbCseFeeobjupdateService pbCseFeeobjupdateService;
 
     @Autowired
-    private EnrollmentStatisticsInfoMapper enrollmentStatisticsInfoMapper;
+    private IEnrollmentStatisticsInfoService enrollmentStatisticsInfoService;
 
-    @Async
-    @Scheduled(cron = "00 0/20 * * * ?")
-    public void execute() {
-        doExecute();
-    }
+//    @Async
+//    @Scheduled(cron = "00 0/20 * * * ?")
+//    public void execute() {
+//        doExecute(pbCseFeeobjupdateService, enrollmentStatisticsInfoService);
+//    }
 
-    void doExecute() {
+    public void doExecute(IPbCseFeeobjupdateService pbCseFeeobjupdateService, IEnrollmentStatisticsInfoService enrollmentStatisticsInfoService) {
         LocalDate now = LocalDate.now();
         String dataDate = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
         EnrollmentStatisticsInfoDto dto = new EnrollmentStatisticsInfoDto();
@@ -55,7 +55,7 @@ public class EnrollmentStatisticsInfoTask {
         dto.setYear(now.getYear() + "");
         EnrollmentStatisticsInfoVo info = pbCseFeeobjupdateService.getEnrollmentStatisticsInfo(dto);
         if(info != null){
-            enrollmentStatisticsInfoMapper.deleteDataByDate(dataDate);
+            enrollmentStatisticsInfoService.deleteDataByDate(dataDate);
             EnrollmentStatisticsInfo infoData = new EnrollmentStatisticsInfo();
             infoData.setEnabledMark(EnabledMark.ENABLED.getCode());
             infoData.setDeleteMark(DeleteMark.NODELETE.getCode());
@@ -64,7 +64,7 @@ public class EnrollmentStatisticsInfoTask {
             infoData.setDataJson(JsonUtil.toJsonString(info));
             infoData.setDataType(1);
             infoData.setDataDay(now);
-            enrollmentStatisticsInfoMapper.insert(infoData);
+            enrollmentStatisticsInfoService.save(infoData);
         }
 
         EnrollmentStatisticsGraduationInfoDto graduationInfoDto = new EnrollmentStatisticsGraduationInfoDto();
@@ -72,7 +72,7 @@ public class EnrollmentStatisticsInfoTask {
         EnrollmentStatisticsGraduationInfoVo graduationInfo = pbCseFeeobjupdateService.getEnrollmentStatisticsGraduationInfo(graduationInfoDto);
 
         if(graduationInfo != null){
-            enrollmentStatisticsInfoMapper.deleteGraduationDataByDate(dataDate);
+            enrollmentStatisticsInfoService.deleteGraduationDataByDate(dataDate);
 
             EnrollmentStatisticsInfo infoData = new EnrollmentStatisticsInfo();
             infoData.setEnabledMark(EnabledMark.ENABLED.getCode());
@@ -82,7 +82,7 @@ public class EnrollmentStatisticsInfoTask {
             infoData.setDataJson(JsonUtil.toJsonString(graduationInfo));
             infoData.setDataType(2);
             infoData.setDataDay(now);
-            enrollmentStatisticsInfoMapper.insert(infoData);
+            enrollmentStatisticsInfoService.save(infoData);
         }
 
         LocalDate thisSaturday = now.with(TemporalAdjusters.nextOrSame(DayOfWeek.SATURDAY));
@@ -98,7 +98,7 @@ public class EnrollmentStatisticsInfoTask {
         EnrollmentStatisticsCalendarInfoVo calendarInfoVo = pbCseFeeobjupdateService.getEnrollmentStatisticsCalendarInfo(calendarInfoDto);
 
         if(calendarInfoVo != null){
-            enrollmentStatisticsInfoMapper.deleteCalendarDataByDate(lastSundayStr, thisSaturdayStr);
+            enrollmentStatisticsInfoService.deleteCalendarDataByDate(lastSundayStr, thisSaturdayStr);
 
             EnrollmentStatisticsInfo infoData = new EnrollmentStatisticsInfo();
             infoData.setEnabledMark(EnabledMark.ENABLED.getCode());
@@ -110,7 +110,7 @@ public class EnrollmentStatisticsInfoTask {
             infoData.setDataStartDay(lastSunday);
             infoData.setDataEndDay(thisSaturday);
             infoData.setDataDay(now);
-            enrollmentStatisticsInfoMapper.insert(infoData);
+            enrollmentStatisticsInfoService.save(infoData);
         }
     }
 }

+ 13 - 0
src/main/java/com/xjrsoft/module/student/controller/PbCseFeeobjupdateController.java

@@ -17,8 +17,10 @@ import com.xjrsoft.common.utils.TreeUtil;
 import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.module.base.entity.BaseGrade;
 import com.xjrsoft.module.base.service.IBaseGradeService;
+import com.xjrsoft.module.job.EnrollmentStatisticsInfoTask;
 import com.xjrsoft.module.student.dto.*;
 import com.xjrsoft.module.student.entity.PbCseFeeobjupdate;
+import com.xjrsoft.module.student.service.IEnrollmentStatisticsInfoService;
 import com.xjrsoft.module.student.service.IPbCseFeeobjupdateService;
 import com.xjrsoft.module.student.vo.*;
 import io.swagger.annotations.Api;
@@ -51,6 +53,8 @@ public class PbCseFeeobjupdateController {
 
     private final IBaseGradeService baseGradeService;
 
+    private final IEnrollmentStatisticsInfoService enrollmentStatisticsInfoService;
+
     @GetMapping(value = "/grade-enrolltype-tree")
     @ApiOperation(value = "年级招生类型树")
     @XjrLog(value = "年级招生类型树")
@@ -185,4 +189,13 @@ public class PbCseFeeobjupdateController {
         EasyExcel.write(bot, PbCseFeeobjupdatePageVo.class).automaticMergeHead(false).excelType(ExcelTypeEnum.XLSX).sheet().doWrite(customerList);
         return RT.fileStream(bot.toByteArray(), "PbCseFeeobjupdate" + ExcelTypeEnum.XLSX.getValue());
     }
+
+    @GetMapping("/enrollment-statistics-start")
+    @ApiOperation(value = "触发招生统计")
+    @XjrLog(value = "触发招生统计")
+    public RT<Boolean> exportData() {
+        EnrollmentStatisticsInfoTask statisticsInfoTask = new EnrollmentStatisticsInfoTask();
+        statisticsInfoTask.doExecute(pbCseFeeobjupdateService, enrollmentStatisticsInfoService);
+        return RT.ok(true);
+    }
 }

+ 23 - 0
src/main/java/com/xjrsoft/module/student/service/IEnrollmentStatisticsInfoService.java

@@ -0,0 +1,23 @@
+package com.xjrsoft.module.student.service;
+
+import com.github.yulichang.base.MPJBaseService;
+import com.xjrsoft.module.student.entity.EnrollmentPlan;
+import com.xjrsoft.module.student.entity.EnrollmentStatisticsInfo;
+import org.apache.ibatis.annotations.Delete;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * @title: 招生计划维护
+ * @Author phoenix
+ * @Date: 2024-06-13
+ * @Version 1.0
+ */
+
+public interface IEnrollmentStatisticsInfoService extends MPJBaseService<EnrollmentStatisticsInfo> {
+
+    Boolean deleteDataByDate(String dataDay);
+
+    Boolean deleteGraduationDataByDate(String dataDay);
+
+    Boolean deleteCalendarDataByDate(String dataStartDay, String dataEndDay);
+}

+ 33 - 0
src/main/java/com/xjrsoft/module/student/service/impl/EnrollmentStatisticsInfoServiceImpl.java

@@ -0,0 +1,33 @@
+package com.xjrsoft.module.student.service.impl;
+
+import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.xjrsoft.module.student.entity.EnrollmentStatisticsInfo;
+import com.xjrsoft.module.student.mapper.EnrollmentStatisticsInfoMapper;
+import com.xjrsoft.module.student.service.IEnrollmentStatisticsInfoService;
+import lombok.AllArgsConstructor;
+import org.springframework.stereotype.Service;
+
+/**
+ * @title: 招生计划维护
+ * @Author phoenix
+ * @Date: 2024-06-13
+ * @Version 1.0
+ */
+@Service
+@AllArgsConstructor
+public class EnrollmentStatisticsInfoServiceImpl extends MPJBaseServiceImpl<EnrollmentStatisticsInfoMapper, EnrollmentStatisticsInfo> implements IEnrollmentStatisticsInfoService {
+    @Override
+    public Boolean deleteDataByDate(String dataDay) {
+        return this.baseMapper.deleteDataByDate(dataDay);
+    }
+
+    @Override
+    public Boolean deleteGraduationDataByDate(String dataDay) {
+        return this.baseMapper.deleteGraduationDataByDate(dataDay);
+    }
+
+    @Override
+    public Boolean deleteCalendarDataByDate(String dataStartDay, String dataEndDay) {
+        return this.baseMapper.deleteCalendarDataByDate(dataStartDay, dataEndDay);
+    }
+}

+ 1 - 0
src/main/resources/application-dev.yml

@@ -116,6 +116,7 @@ xjrsoft:
       - /system/findUserByCode
       - /system/imgcaptcha-answer
       - /student/basestudentinfo/studentinfoByKeyWord
+      - /student/pbCseFeeobjupdate/enrollment-statistics-start
     approval-time: 300 # 审核超时时间 目前设为5分钟
   email:
     host:  #邮件服务器的SMTP地址,可选,默认为smtp.<发件人邮箱后缀>

+ 1 - 0
src/main/resources/application-pre.yml

@@ -98,6 +98,7 @@ xjrsoft:
       - /event/visit
       - /system/findUserByCode
       - /student/basestudentinfo/studentinfoByKeyWord
+      - /student/pbCseFeeobjupdate/enrollment-statistics-start
     approval-time: 300 # 审核超时时间 目前设为5分钟
   email:
     host:  #邮件服务器的SMTP地址,可选,默认为smtp.<发件人邮箱后缀>

+ 1 - 0
src/main/resources/application-prod.yml

@@ -95,6 +95,7 @@ xjrsoft:
       - /system/findUserByCode
       - /student/basestudentinfo/studentinfoByKeyWord
       - /system/xjrTipsMessage/infoByCode
+      - /student/pbCseFeeobjupdate/enrollment-statistics-start
     approval-time: 300 # 审核超时时间 目前设为5分钟
   email:
     host:  #邮件服务器的SMTP地址,可选,默认为smtp.<发件人邮箱后缀>