|
|
@@ -1,6 +1,9 @@
|
|
|
package com.ydtech.modules.admin.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.ydtech.core.page.HttpResult;
|
|
|
+import com.ydtech.modules.admin.model.dto.PayAmountExcel;
|
|
|
+import com.ydtech.modules.admin.model.dto.ReceivableExcel;
|
|
|
import com.ydtech.modules.admin.model.report.profitAnalysis.ProfitAnalysisDto;
|
|
|
import com.ydtech.modules.admin.model.report.profitAnalysis.ProfitAnalysisQueryDto;
|
|
|
import com.ydtech.modules.admin.service.ProfitAnalysisService;
|
|
|
@@ -12,14 +15,20 @@ import com.ydtech.modules.inv.dao.InvAccountMapper;
|
|
|
import com.ydtech.modules.inv.model.InvAccount;
|
|
|
import com.ydtech.modules.inv.model.InvAccountCardVo;
|
|
|
import com.ydtech.modules.inv.model.InvAccountExpenses;
|
|
|
+import com.ydtech.modules.inv.utils.EasyExcelUtils;
|
|
|
import com.ydtech.utils.BigDecimalUtils;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
+import java.nio.file.Files;
|
|
|
+import java.nio.file.Path;
|
|
|
+import java.nio.file.Paths;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
import java.util.stream.Stream;
|
|
|
@@ -44,6 +53,14 @@ public class ProfitAnalysisServiceImpl implements ProfitAnalysisService {
|
|
|
@Autowired
|
|
|
private InvAccountExpensesMapper invAccountExpensesMapper;
|
|
|
|
|
|
+
|
|
|
+ @Value("${upload.file.path}")
|
|
|
+ private String uploadPath;
|
|
|
+
|
|
|
+
|
|
|
+ @Value("${upload.file.url}")
|
|
|
+ private String uploadUrl;
|
|
|
+
|
|
|
/**
|
|
|
* @version
|
|
|
* @author: hxl
|
|
|
@@ -380,6 +397,47 @@ public class ProfitAnalysisServiceImpl implements ProfitAnalysisService {
|
|
|
map.put("endDate",endDateStr);
|
|
|
return map;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description: 控制台-利润分析应收金额导出明细
|
|
|
+ * @author: whp
|
|
|
+ **/
|
|
|
+ @Override
|
|
|
+ public HttpResult receivableExcel(ProfitAnalysisQueryDto profitAnalysisQueryDto) {
|
|
|
+ List<ReceivableExcel> list = profitAnalysisMapper.receivableExcel(profitAnalysisQueryDto);
|
|
|
+ String uploadPath = this.uploadPath + "/excel/";
|
|
|
+ Path path = Paths.get(uploadPath);
|
|
|
+ if (!Files.exists(path)) {
|
|
|
+ try {
|
|
|
+ Files.createDirectories(path);
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String fileName = EasyExcelUtils.downExcel(uploadPath, "应收明细", ReceivableExcel.class, list);
|
|
|
+ return HttpResult.ok("", uploadUrl + "excel/" + fileName);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @description: 控制台-利润分析实付金额导出明细
|
|
|
+ * @author: whp
|
|
|
+ **/
|
|
|
+ @Override
|
|
|
+ public HttpResult payAmountExcel(ProfitAnalysisQueryDto profitAnalysisQueryDto) {
|
|
|
+ List<PayAmountExcel> list = profitAnalysisMapper.payAmountExcel(profitAnalysisQueryDto);
|
|
|
+ String uploadPath = this.uploadPath + "/excel/";
|
|
|
+ Path path = Paths.get(uploadPath);
|
|
|
+ if (!Files.exists(path)) {
|
|
|
+ try {
|
|
|
+ Files.createDirectories(path);
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String fileName = EasyExcelUtils.downExcel(uploadPath, "实付明细", PayAmountExcel.class, list);
|
|
|
+ return HttpResult.ok("", uploadUrl + "excel/" + fileName);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|