|
|
@@ -1,12 +1,9 @@ |
|
|
package com.iformall.service.impl; |
|
|
package com.iformall.service.impl; |
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
|
import java.util.*; |
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
import com.github.pagehelper.PageHelper; |
|
|
import com.github.pagehelper.PageInfo; |
|
|
import com.github.pagehelper.PageInfo; |
|
|
import com.iformall.common.ErrorCode; |
|
|
import com.iformall.common.ErrorCode; |
|
|
|
|
|
import com.iformall.common.IdWorker; |
|
|
import com.iformall.common.Result; |
|
|
import com.iformall.common.Result; |
|
|
import com.iformall.common.ResultData; |
|
|
import com.iformall.common.ResultData; |
|
|
import com.iformall.domain.po.WxMall; |
|
|
import com.iformall.domain.po.WxMall; |
|
|
@@ -15,17 +12,17 @@ import com.iformall.domain.po.WxMerchantBUser; |
|
|
import com.iformall.domain.po.WxMerchantTradeDaily; |
|
|
import com.iformall.domain.po.WxMerchantTradeDaily; |
|
|
import com.iformall.domain.vo.WxMerchantTradeDailyVo; |
|
|
import com.iformall.domain.vo.WxMerchantTradeDailyVo; |
|
|
import com.iformall.mapper.WxMerchantTradeDailyMapper; |
|
|
import com.iformall.mapper.WxMerchantTradeDailyMapper; |
|
|
import com.iformall.service.WxMerchantTradeDailyService; |
|
|
|
|
|
import com.iformall.service.WxMallService; |
|
|
|
|
|
import com.iformall.service.WxMerchantBUserService; |
|
|
|
|
|
import com.iformall.service.WxMerchantService; |
|
|
|
|
|
import com.iformall.utils.DateUtils; |
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
|
|
|
|
import com.iformall.service.*; |
|
|
import org.slf4j.Logger; |
|
|
import org.slf4j.Logger; |
|
|
import org.slf4j.LoggerFactory; |
|
|
import org.slf4j.LoggerFactory; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import com.iformall.common.IdWorker; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
|
import java.util.*; |
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
@Service |
|
|
@Service |
|
|
public class WxMerchantTradeDailyServiceImpl implements WxMerchantTradeDailyService { |
|
|
public class WxMerchantTradeDailyServiceImpl implements WxMerchantTradeDailyService { |
|
|
@@ -43,6 +40,9 @@ public class WxMerchantTradeDailyServiceImpl implements WxMerchantTradeDailyServ |
|
|
@Autowired |
|
|
@Autowired |
|
|
WxMallService wxMallService; |
|
|
WxMallService wxMallService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
ExcelService excelService; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PageInfo<WxMerchantTradeDaily> listAsPage(WxMerchantTradeDaily record, Integer pageIndex, Integer pageSize) { |
|
|
public PageInfo<WxMerchantTradeDaily> listAsPage(WxMerchantTradeDaily record, Integer pageIndex, Integer pageSize) { |
|
|
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantTradeDailyMapper.findList(record)); |
|
|
return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantTradeDailyMapper.findList(record)); |
|
|
@@ -172,6 +172,29 @@ public class WxMerchantTradeDailyServiceImpl implements WxMerchantTradeDailyServ |
|
|
return new ResultData(wxMerchantTradeDaily); |
|
|
return new ResultData(wxMerchantTradeDaily); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void exportData(WxMerchantTradeDailyVo wxMerchantTradeDailyVo, HttpServletRequest request, HttpServletResponse response) { |
|
|
|
|
|
//没有商户ID导出全部数据 |
|
|
|
|
|
String name = "解单数据"; |
|
|
|
|
|
if (wxMerchantTradeDailyVo.getMerchantId() == null) { |
|
|
|
|
|
String title = wxMerchantTradeDailyVo.getReportDate() + "商户解单数据"; |
|
|
|
|
|
List<WxMerchantTradeDailyVo> list = wxMerchantTradeDailyMapper.findListVo(wxMerchantTradeDailyVo); |
|
|
|
|
|
excelService.exportExcel(list, title, name, WxMerchantTradeDailyVo.class, name + ".xlsx", response, false); |
|
|
|
|
|
} else { |
|
|
|
|
|
WxMerchantTradeDaily wxMerchantTradeDaily = new WxMerchantTradeDaily(); |
|
|
|
|
|
wxMerchantTradeDaily.setTenantId(wxMerchantTradeDailyVo.getTenantId()); |
|
|
|
|
|
wxMerchantTradeDaily.setMerchantId(wxMerchantTradeDailyVo.getMerchantId()); |
|
|
|
|
|
List<WxMerchantTradeDailyVo> list = wxMerchantTradeDailyMapper.findListVoOfMonth(wxMerchantTradeDaily); |
|
|
|
|
|
list.parallelStream().forEach(t -> t.setMerchantName(null)); |
|
|
|
|
|
String title = "近30天解单数据"; |
|
|
|
|
|
if (!list.isEmpty()) { |
|
|
|
|
|
String merchantName = list.get(0).getMerchantName(); |
|
|
|
|
|
title = merchantName + title; |
|
|
|
|
|
} |
|
|
|
|
|
excelService.exportExcel(list, title, name, WxMerchantTradeDailyVo.class, name + ".xlsx", response, false); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public ResultData getVolumeOfMonth(Long merchantId) { |
|
|
public ResultData getVolumeOfMonth(Long merchantId) { |
|
|
|
|
|
|
|
|
@@ -188,9 +211,9 @@ public class WxMerchantTradeDailyServiceImpl implements WxMerchantTradeDailyServ |
|
|
Calendar cal = Calendar.getInstance(); |
|
|
Calendar cal = Calendar.getInstance(); |
|
|
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
SimpleDateFormat fmtv = new SimpleDateFormat("MM/dd"); |
|
|
SimpleDateFormat fmtv = new SimpleDateFormat("MM/dd"); |
|
|
cal.setTime(new Date()); |
|
|
|
|
|
for (int i = 0; i < 30; i++) { |
|
|
for (int i = 0; i < 30; i++) { |
|
|
cal.add(Calendar.DAY_OF_YEAR, -1); |
|
|
|
|
|
|
|
|
cal.setTime(new Date()); |
|
|
|
|
|
cal.add(Calendar.DAY_OF_YEAR, -i); |
|
|
WxMerchantTradeDailyVo trade = recordMap.get(fmt.format(cal.getTime())); |
|
|
WxMerchantTradeDailyVo trade = recordMap.get(fmt.format(cal.getTime())); |
|
|
if (trade != null){ |
|
|
if (trade != null){ |
|
|
trade.setReportDate(fmtv.format(cal.getTime())); |
|
|
trade.setReportDate(fmtv.format(cal.getTime())); |
|
|
@@ -204,6 +227,7 @@ public class WxMerchantTradeDailyServiceImpl implements WxMerchantTradeDailyServ |
|
|
trade.setReportDate(fmtv.format(cal.getTime())); |
|
|
trade.setReportDate(fmtv.format(cal.getTime())); |
|
|
tradeList.add(trade); |
|
|
tradeList.add(trade); |
|
|
} |
|
|
} |
|
|
|
|
|
cal.clear(); |
|
|
} |
|
|
} |
|
|
Collections.reverse(tradeList); |
|
|
Collections.reverse(tradeList); |
|
|
return new ResultData(tradeList); |
|
|
return new ResultData(tradeList); |
|
|
@@ -223,9 +247,10 @@ public class WxMerchantTradeDailyServiceImpl implements WxMerchantTradeDailyServ |
|
|
Calendar cal = Calendar.getInstance(); |
|
|
Calendar cal = Calendar.getInstance(); |
|
|
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
SimpleDateFormat fmtv = new SimpleDateFormat("MM/dd"); |
|
|
SimpleDateFormat fmtv = new SimpleDateFormat("MM/dd"); |
|
|
cal.setTime(new Date()); |
|
|
|
|
|
for (int i = 0; i < 30; i++) { |
|
|
for (int i = 0; i < 30; i++) { |
|
|
cal.add(Calendar.DAY_OF_YEAR, -1); |
|
|
|
|
|
|
|
|
cal.setTime(new Date()); |
|
|
|
|
|
cal.add(Calendar.DAY_OF_MONTH, -i); |
|
|
|
|
|
System.out.println(fmt.format(cal.getTime())); |
|
|
WxMerchantTradeDaily trade = recordMap.get(fmt.format(cal.getTime())); |
|
|
WxMerchantTradeDaily trade = recordMap.get(fmt.format(cal.getTime())); |
|
|
if (trade != null){ |
|
|
if (trade != null){ |
|
|
trade.setReportDate(fmtv.format(cal.getTime())); |
|
|
trade.setReportDate(fmtv.format(cal.getTime())); |
|
|
@@ -236,6 +261,7 @@ public class WxMerchantTradeDailyServiceImpl implements WxMerchantTradeDailyServ |
|
|
trade.setReportDate(fmtv.format(cal.getTime())); |
|
|
trade.setReportDate(fmtv.format(cal.getTime())); |
|
|
tradeList.add(trade); |
|
|
tradeList.add(trade); |
|
|
} |
|
|
} |
|
|
|
|
|
cal.clear(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Collections.reverse(tradeList); |
|
|
Collections.reverse(tradeList); |
|
|
|