|
|
@@ -0,0 +1,59 @@
|
|
|
+package com.ydtech.modules.console.service.impl;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.ydtech.modules.admin.utils.SliceUpDateUtil;
|
|
|
+import com.ydtech.modules.console.dao.WithdrawalTaskMapper;
|
|
|
+import com.ydtech.modules.console.dto.WithdrawalTaskDto;
|
|
|
+import com.ydtech.modules.console.service.WithdrawalTaskService;
|
|
|
+import com.ydtech.modules.console.vo.WithdrawalTaskVo;
|
|
|
+import com.ydtech.modules.order.entity.BasePageResult;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+
|
|
|
+@Service
|
|
|
+public class WithdrawalTaskServiceImpl implements WithdrawalTaskService {
|
|
|
+ @Autowired
|
|
|
+ private WithdrawalTaskMapper withdrawalTaskMapper;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public BasePageResult<WithdrawalTaskDto> queryByVo(WithdrawalTaskVo withdrawalTaskVo) {
|
|
|
+ HashMap<String, String> dateMapByType = getDateMapByType(withdrawalTaskVo.getDateType(), withdrawalTaskVo.getBeginDate(), withdrawalTaskVo.getEndDate());
|
|
|
+ withdrawalTaskVo.setBeginDate(dateMapByType.get("startDate"));
|
|
|
+ withdrawalTaskVo.setEndDate(dateMapByType.get("endDate"));
|
|
|
+ Page<WithdrawalTaskDto> page = new Page<>(withdrawalTaskVo.getPageNum(), withdrawalTaskVo.getPageSize());
|
|
|
+ Page<WithdrawalTaskDto> result = withdrawalTaskMapper.queryByVo(page, withdrawalTaskVo);
|
|
|
+ return new BasePageResult<>(withdrawalTaskVo.getPageNum(), page.getSize(), result.getTotal(), page.getPages(),
|
|
|
+ result.getRecords());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private static HashMap<String, String> getDateMapByType(String type, String startDate, String endDate) {
|
|
|
+ HashMap<String, String> map = new HashMap<>();
|
|
|
+ String startDateStr = "";
|
|
|
+ String endDateStr = "";
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isNotBlank(startDate) && org.apache.commons.lang3.StringUtils.isNotBlank(endDate)) {
|
|
|
+ startDateStr = org.apache.commons.lang3.StringUtils.isNotBlank(startDate) ? startDate + " 00:00:00" : null;
|
|
|
+ endDateStr = org.apache.commons.lang3.StringUtils.isNotBlank(endDate) ? endDate + " 23:59:59" : null;
|
|
|
+ } else {
|
|
|
+ if ("1".equals(type)) {
|
|
|
+ // 近1天
|
|
|
+ startDateStr = SliceUpDateUtil.getBeforeDay(new Date(), 0) + " 00:00:00";
|
|
|
+ endDateStr = SliceUpDateUtil.getBeforeDay(new Date(), 0) + " 23:59:59";
|
|
|
+ } else if ("2".equals(type)) {
|
|
|
+ // 近7天
|
|
|
+ startDateStr = SliceUpDateUtil.getBeforeDay(new Date(), 1) + " 00:00:00";
|
|
|
+ endDateStr = SliceUpDateUtil.getBeforeDay(new Date(), 0) + " 23:59:59";
|
|
|
+ } else if ("3".equals(type)) {
|
|
|
+ // 近30天
|
|
|
+ startDateStr = SliceUpDateUtil.getBeforeDay(new Date(), 6) + " 00:00:00";
|
|
|
+ endDateStr = SliceUpDateUtil.getBeforeDay(new Date(), 0) + " 23:59:59";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ map.put("startDate", startDateStr);
|
|
|
+ map.put("endDate", endDateStr);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+}
|