| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- 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 = getDateMapByTypeNew(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());
- }
- /**
- *
- * @param withdrawalTaskVo
- * @return 控制台 提现任务 统计
- */
- @Override
- public HashMap<String, Object> countWithdrawal(WithdrawalTaskVo withdrawalTaskVo) {
- HashMap<String, String> dateMapByType = getDateMapByTypeNew(withdrawalTaskVo.getDateType(), withdrawalTaskVo.getBeginDate(), withdrawalTaskVo.getEndDate());
- withdrawalTaskVo.setBeginDate(dateMapByType.get("startDate"));
- withdrawalTaskVo.setEndDate(dateMapByType.get("endDate"));
- HashMap<String, Object> resultItem = withdrawalTaskMapper.countWithdrawal(withdrawalTaskVo);
- return resultItem;
- }
- /**
- * @version
- * @author: hxl
- * @Date: 2024/6/19 11:57
- * @Description: 通过时间类型判断
- */
- private static HashMap<String,String> getDateMapByTypeNew(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;
- }
- }
|