|
|
|
@@ -17,8 +17,11 @@ import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
@Service |
|
|
|
@@ -75,10 +78,27 @@ public class WxMerchantSubsidyServiceImpl implements WxMerchantSubsidyService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void exportData(WxMerchantSubsidy wxMerchantSubsidy, HttpServletRequest request, HttpServletResponse response) { |
|
|
|
public void exportData(WxMerchantSubsidyVo wxMerchantSubsidy, HttpServletRequest request, HttpServletResponse response) { |
|
|
|
List<WxMerchantSubsidyVo> list = wxMerchantSubsidyMapper.findVoList(wxMerchantSubsidy); |
|
|
|
Map<String, Long> summary = summary(wxMerchantSubsidy); |
|
|
|
Long subsidy = summary.get("subsidy"); |
|
|
|
String subsidyStr = new BigDecimal(subsidy).divide(new BigDecimal(100)).toPlainString(); |
|
|
|
WxMerchantSubsidyVo merchantSubsidy = new WxMerchantSubsidyVo(); |
|
|
|
merchantSubsidy.setSubsidyStr(subsidyStr); |
|
|
|
merchantSubsidy.setSource(-1); |
|
|
|
merchantSubsidy.setType(-1); |
|
|
|
merchantSubsidy.setFreeze(-1); |
|
|
|
list.add(merchantSubsidy); |
|
|
|
excelService.exportExcel(list, null, "结算记录", WxMerchantSubsidyVo.class, "结算记录.xlsx", response, false); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<String, Long> summary(WxMerchantSubsidyVo wxMerchantSubsidy) { |
|
|
|
Long subsidy = wxMerchantSubsidyMapper.findVoList(wxMerchantSubsidy).stream().collect(Collectors.summingLong(WxMerchantSubsidy::getSubsidy)); |
|
|
|
Map<String, Long> data = new HashMap<>(); |
|
|
|
data.put("subsidy", subsidy); |
|
|
|
return data; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |