|
@@ -32,6 +32,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalTime;
|
|
import java.time.LocalTime;
|
|
@@ -142,6 +143,64 @@ public class SpringBeanTaskDemo {
|
|
LocalDateTime startTime = LocalDateTime.of(now.minusMonths(period), LocalTime.MIN);
|
|
LocalDateTime startTime = LocalDateTime.of(now.minusMonths(period), LocalTime.MIN);
|
|
LocalDateTime endTime = LocalDateTime.of(now, LocalTime.MIN).minusSeconds(1);
|
|
LocalDateTime endTime = LocalDateTime.of(now, LocalTime.MIN).minusSeconds(1);
|
|
|
|
|
|
|
|
+ System.out.println(startTime);
|
|
|
|
+ System.out.println(endTime);
|
|
|
|
+
|
|
|
|
+ log.info("singleMemberSettleSameAmountInSeveralMonths开始于:{},输入参数{}", LocalDateTime.now(), para);
|
|
|
|
+
|
|
|
|
+ List<SingleMemberSettleSameAmountInSeveralMonths> result = scorePackageSettleNoteService.singleMemberSettleSameAmountInSeveralMonths(startTime, endTime);
|
|
|
|
+
|
|
|
|
+ if (CollUtil.isNotEmpty(result)) {
|
|
|
|
+ List<SingleMemberSettleSameAmountInSeveralMonths> history = singleMemberSettleSameAmountInSeveralMonthsMapper.selectList(Wrappers.<SingleMemberSettleSameAmountInSeveralMonths>lambdaQuery().between(SingleMemberSettleSameAmountInSeveralMonths::getCreateTime, LocalDateTime.of(LocalDate.now(), LocalTime.MIN), LocalDateTime.of(LocalDate.now(), LocalTime.MAX)));
|
|
|
|
+ // 删除历史记录
|
|
|
|
+ log.warn("删除当期的历史记录:{}", history);
|
|
|
|
+ if (CollUtil.isNotEmpty(history)) {
|
|
|
|
+ List<Integer> ids = history.stream().mapToInt(SingleMemberSettleSameAmountInSeveralMonths::getRecordId).boxed().collect(Collectors.toList());
|
|
|
|
+ singleMemberSettleSameAmountInSeveralMonthsMapper.deleteBatchIds(ids);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ result.forEach(e -> {
|
|
|
|
+ e.setPeriod(period);
|
|
|
|
+ singleMemberSettleSameAmountInSeveralMonthsMapper.insert(e);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return HnqzQuartzEnum.JOB_LOG_STATUS_SUCCESS.getType();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 同一用户,连续多月结算金额超过限额
|
|
|
|
+ *
|
|
|
|
+ * @param para 参数(月数和限额)
|
|
|
|
+ * @return 运行结果
|
|
|
|
+ */
|
|
|
|
+ @SneakyThrows
|
|
|
|
+ public String singleMemberSettleAmountOverrunInSeveralMonths(String para) {
|
|
|
|
+ // 校验参数
|
|
|
|
+ if (StrUtil.isBlank(para)) {
|
|
|
|
+ log.error("参数缺失");
|
|
|
|
+ return HnqzQuartzEnum.JOB_LOG_STATUS_FAIL.getType();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!para.contains(StrUtil.COMMA)){
|
|
|
|
+ log.error("参数错误");
|
|
|
|
+ return HnqzQuartzEnum.JOB_LOG_STATUS_FAIL.getType();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<String> params = StrUtil.split(para.trim(), StrUtil.COMMA);
|
|
|
|
+ int period = Integer.parseInt(params.get(0));
|
|
|
|
+ BigDecimal limit = new BigDecimal(params.get(1));
|
|
|
|
+
|
|
|
|
+ if (period < 2) {
|
|
|
|
+ log.error("参数错误");
|
|
|
|
+ return HnqzQuartzEnum.JOB_LOG_STATUS_FAIL.getType();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 计算查询时间
|
|
|
|
+ LocalDate now = LocalDateTime.now().toLocalDate().with(TemporalAdjusters.firstDayOfNextMonth());
|
|
|
|
+ LocalDateTime startTime = LocalDateTime.of(now.minusMonths(period), LocalTime.MIN);
|
|
|
|
+ LocalDateTime endTime = LocalDateTime.of(now, LocalTime.MIN).minusSeconds(1);
|
|
|
|
+
|
|
log.info("singleMemberSettleSameAmountInSeveralMonths开始于:{},输入参数{}", LocalDateTime.now(), para);
|
|
log.info("singleMemberSettleSameAmountInSeveralMonths开始于:{},输入参数{}", LocalDateTime.now(), para);
|
|
|
|
|
|
List<SingleMemberSettleSameAmountInSeveralMonths> result = scorePackageSettleNoteService.singleMemberSettleSameAmountInSeveralMonths(startTime, endTime);
|
|
List<SingleMemberSettleSameAmountInSeveralMonths> result = scorePackageSettleNoteService.singleMemberSettleSameAmountInSeveralMonths(startTime, endTime);
|