|
@@ -10,11 +10,15 @@ import com.ydtech.modules.inv.model.excel.InvSourceExcel;
|
|
|
import com.ydtech.modules.inv.service.InvAccountExcelService;
|
|
import com.ydtech.modules.inv.service.InvAccountExcelService;
|
|
|
import com.ydtech.modules.inv.utils.excel.InvSettlementSourceDataListener;
|
|
import com.ydtech.modules.inv.utils.excel.InvSettlementSourceDataListener;
|
|
|
import com.ydtech.modules.inv.utils.excel.InvSourceDataListener;
|
|
import com.ydtech.modules.inv.utils.excel.InvSourceDataListener;
|
|
|
|
|
+import lombok.SneakyThrows;
|
|
|
import org.aspectj.weaver.ast.Literal;
|
|
import org.aspectj.weaver.ast.Literal;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.core.io.ClassPathResource;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
|
|
+import java.io.IOException;
|
|
|
|
|
+import java.io.InputStream;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
@@ -178,7 +182,7 @@ public class EasyExcelUtils {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if (invAccountOperate.getEntProfit() != null){
|
|
|
|
|
|
|
+ if (invAccountOperate.getEntProfit() != null) {
|
|
|
for (Map.Entry<String, Object> entry : invAccountOperate.getEntProfit().entrySet()) {
|
|
for (Map.Entry<String, Object> entry : invAccountOperate.getEntProfit().entrySet()) {
|
|
|
if (entry.getKey().equals(invAccountProfit.getProfitEng())) {
|
|
if (entry.getKey().equals(invAccountProfit.getProfitEng())) {
|
|
|
data.add(entry.getValue());
|
|
data.add(entry.getValue());
|
|
@@ -225,9 +229,11 @@ public class EasyExcelUtils {
|
|
|
/**
|
|
/**
|
|
|
* 导出资金申请模板
|
|
* 导出资金申请模板
|
|
|
*/
|
|
*/
|
|
|
|
|
+ @SneakyThrows
|
|
|
public String downAccountExcel(String uploadFilePath, List<InvAccountExcel> invAccountExcel, List<InvAccountProfit> invAccountProfit) {
|
|
public String downAccountExcel(String uploadFilePath, List<InvAccountExcel> invAccountExcel, List<InvAccountProfit> invAccountProfit) {
|
|
|
// 加载模板
|
|
// 加载模板
|
|
|
- String templateFile = "src/main/resources/template/资金申请单模板.xlsx";
|
|
|
|
|
|
|
+ InputStream inputStream = getClass().getResourceAsStream("/template/资金申请单模板.xlsx");
|
|
|
|
|
+
|
|
|
List<InvAccountExcel> list = new ArrayList<>();
|
|
List<InvAccountExcel> list = new ArrayList<>();
|
|
|
// 获取工作表并填充
|
|
// 获取工作表并填充
|
|
|
for (InvAccountExcel excel : invAccountExcel) {
|
|
for (InvAccountExcel excel : invAccountExcel) {
|
|
@@ -268,7 +274,7 @@ public class EasyExcelUtils {
|
|
|
excel.setPayMethod(a.toString());
|
|
excel.setPayMethod(a.toString());
|
|
|
// 生成工作簿对象
|
|
// 生成工作簿对象
|
|
|
ExcelWriterBuilder workBookWriter = EasyExcel.write(fileName, InvAccountExcel.class)
|
|
ExcelWriterBuilder workBookWriter = EasyExcel.write(fileName, InvAccountExcel.class)
|
|
|
- .withTemplate(templateFile);
|
|
|
|
|
|
|
+ .withTemplate(inputStream);
|
|
|
|
|
|
|
|
workBookWriter.sheet().doFill(excel);
|
|
workBookWriter.sheet().doFill(excel);
|
|
|
excel.setUplodePath(file);
|
|
excel.setUplodePath(file);
|