|
@@ -22,9 +22,11 @@ import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.qunzhixinxi.hnqz.daemon.quartz.constants.HnqzQuartzEnum;
|
|
|
+import com.qunzhixinxi.hnqz.daemon.quartz.entity.SingleEnterpriseSettleSameAmountForSeveralMembersInCurrentMonth;
|
|
|
import com.qunzhixinxi.hnqz.daemon.quartz.entity.SingleMemberSettleAmountOverrunInSeveralMonths;
|
|
|
import com.qunzhixinxi.hnqz.daemon.quartz.entity.SingleMemberSettleSameAmountInSeveralMonths;
|
|
|
import com.qunzhixinxi.hnqz.daemon.quartz.entity.WmTaskType;
|
|
|
+import com.qunzhixinxi.hnqz.daemon.quartz.mapper.SingleEnterpriseSettleSameAmountForSeveralMembersInCurrentMonthMapper;
|
|
|
import com.qunzhixinxi.hnqz.daemon.quartz.mapper.SingleMemberSettleAmountOverrunInSeveralMonthsMapper;
|
|
|
import com.qunzhixinxi.hnqz.daemon.quartz.mapper.SingleMemberSettleSameAmountInSeveralMonthsMapper;
|
|
|
import com.qunzhixinxi.hnqz.daemon.quartz.service.*;
|
|
@@ -61,6 +63,7 @@ public class SpringBeanTaskDemo {
|
|
|
private final WmStatisticsService wmStatisticsService;
|
|
|
private final SingleMemberSettleSameAmountInSeveralMonthsMapper singleMemberSettleSameAmountInSeveralMonthsMapper;
|
|
|
private final SingleMemberSettleAmountOverrunInSeveralMonthsMapper singleMemberSettleAmountOverrunInSeveralMonthsMapper;
|
|
|
+ private final SingleEnterpriseSettleSameAmountForSeveralMembersInCurrentMonthMapper singleEnterpriseSettleSameAmountForSeveralMembersInCurrentMonthMapper;
|
|
|
|
|
|
// /**
|
|
|
// * 测试Spring Bean的演示方法
|
|
@@ -236,4 +239,59 @@ public class SpringBeanTaskDemo {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 同一企业,当前月给多个用户支付相同金额
|
|
|
+ *
|
|
|
+ * @param para 参数(统计人数)
|
|
|
+ * @return 运行结果
|
|
|
+ */
|
|
|
+ @SneakyThrows
|
|
|
+ public String singleEnterpriseSettleSameAmountForSeveralMembersInCurrentMonth(String para) {
|
|
|
+
|
|
|
+ // 校验参数
|
|
|
+ if (StrUtil.isBlank(para)) {
|
|
|
+ log.error("参数缺失");
|
|
|
+ return HnqzQuartzEnum.JOB_LOG_STATUS_FAIL.getType();
|
|
|
+ }
|
|
|
+
|
|
|
+ int memberCount = Integer.parseInt(para.trim());
|
|
|
+
|
|
|
+ if (memberCount <= 1) {
|
|
|
+ log.error("参数错误");
|
|
|
+ return HnqzQuartzEnum.JOB_LOG_STATUS_FAIL.getType();
|
|
|
+ }
|
|
|
+
|
|
|
+ // 计算查询时间
|
|
|
+ int period = 1;
|
|
|
+ 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("singleEnterpriseSettleSameAmountForSeveralMembersInCurrentMonth开始于:{},输入参数{}", LocalDateTime.now(), para);
|
|
|
+
|
|
|
+ List<SingleMemberSettleSameAmountInSeveralMonths> result = scorePackageSettleNoteService.singleEnterpriseSettleSameAmountForSeveralMembersInCurrentMonth(startTime, endTime, memberCount);
|
|
|
+
|
|
|
+ if (CollUtil.isNotEmpty(result)) {
|
|
|
+ List<SingleEnterpriseSettleSameAmountForSeveralMembersInCurrentMonth> history = singleEnterpriseSettleSameAmountForSeveralMembersInCurrentMonthMapper.selectList(Wrappers.<SingleEnterpriseSettleSameAmountForSeveralMembersInCurrentMonth>lambdaQuery().between(SingleEnterpriseSettleSameAmountForSeveralMembersInCurrentMonth::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(SingleEnterpriseSettleSameAmountForSeveralMembersInCurrentMonth::getRecordId).boxed().collect(Collectors.toList());
|
|
|
+ singleEnterpriseSettleSameAmountForSeveralMembersInCurrentMonthMapper.deleteBatchIds(ids);
|
|
|
+ }
|
|
|
+
|
|
|
+ result.forEach(e -> {
|
|
|
+ SingleEnterpriseSettleSameAmountForSeveralMembersInCurrentMonth singleEnterpriseSettleSameAmountForSeveralMembersInCurrentMonth
|
|
|
+ = BeanUtil.copyProperties(e, SingleEnterpriseSettleSameAmountForSeveralMembersInCurrentMonth.class);
|
|
|
+ singleEnterpriseSettleSameAmountForSeveralMembersInCurrentMonth.setPeriod(period);
|
|
|
+ singleEnterpriseSettleSameAmountForSeveralMembersInCurrentMonth.setMemberCount(memberCount);
|
|
|
+ singleEnterpriseSettleSameAmountForSeveralMembersInCurrentMonth.setCreateTime(LocalDateTime.now());
|
|
|
+ singleEnterpriseSettleSameAmountForSeveralMembersInCurrentMonthMapper.insert(singleEnterpriseSettleSameAmountForSeveralMembersInCurrentMonth);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ return HnqzQuartzEnum.JOB_LOG_STATUS_SUCCESS.getType();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|