|
@@ -3,16 +3,19 @@ package com.huimv.farm.damsubsidy.controller;
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.lang.UUID;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.huimv.farm.damsubsidy.common.utils.Result;
|
|
|
import com.huimv.farm.damsubsidy.common.utils.UploadImage;
|
|
|
+import com.huimv.farm.damsubsidy.entity.AreaAll;
|
|
|
import com.huimv.farm.damsubsidy.entity.BillSubsidy;
|
|
|
+import com.huimv.farm.damsubsidy.entity.SysUser;
|
|
|
+import com.huimv.farm.damsubsidy.service.IAreaAllService;
|
|
|
import com.huimv.farm.damsubsidy.service.IBillSubsidyService;
|
|
|
import com.huimv.farm.damsubsidy.common.utils.PdfUtil;
|
|
|
+import com.huimv.farm.damsubsidy.test.QrCodeExcelPrinter;
|
|
|
import com.huimv.farm.test.Print;
|
|
|
import com.huimv.farm.test.Print2;
|
|
|
-import com.spire.xls.FileFormat;
|
|
|
-import com.spire.xls.Workbook;
|
|
|
-import com.spire.xls.Worksheet;
|
|
|
+import com.spire.xls.*;
|
|
|
import org.apache.tomcat.util.http.fileupload.FileUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.util.StringUtils;
|
|
@@ -38,6 +41,8 @@ import java.util.*;
|
|
|
public class BillSubsidyController {
|
|
|
@Autowired
|
|
|
private IBillSubsidyService iBillSubsidyService;
|
|
|
+ @Autowired
|
|
|
+ private IAreaAllService iAreaAllService;
|
|
|
|
|
|
@PostMapping("/addApplication")
|
|
|
public Result addApplication(HttpServletRequest httpServletRequest, @RequestBody BillSubsidy billSubsidy){
|
|
@@ -138,12 +143,21 @@ public class BillSubsidyController {
|
|
|
public void print(HttpServletResponse response, HttpServletRequest httpServletRequest,@RequestParam(name = "id", required = true) Integer id) throws Exception {
|
|
|
// Integer id=Integer.parseInt(parasMap.get("id"));
|
|
|
BillSubsidy subsidy = subsidyService.getById(id);
|
|
|
+ QrCodeExcelPrinter codeExcelPrinter = new QrCodeExcelPrinter();
|
|
|
+ codeExcelPrinter.test();
|
|
|
+
|
|
|
Print.print(subsidy);
|
|
|
String path = "/opt/subsidy/order_contract.xls";
|
|
|
|
|
|
//加载Excel文档
|
|
|
Workbook wb = new Workbook();
|
|
|
wb.loadFromFile(path);
|
|
|
+ Worksheet sheet = wb.getWorksheets().get(0);
|
|
|
+ //添加图片
|
|
|
+ ExcelPicture picture = sheet.getPictures().add(37,10,"/opt/subsidy/a.png");
|
|
|
+ picture.setHeight(70);//设置图片高度
|
|
|
+ picture.setWidth(75);//设置图片宽度
|
|
|
+
|
|
|
|
|
|
Worksheet worksheet = wb.getWorksheets().get(0);
|
|
|
worksheet.getRange().get("E3").getStyle().setWrapText(true);//地址自动换行
|
|
@@ -153,9 +167,8 @@ public class BillSubsidyController {
|
|
|
//调用方法保存为PDF格式
|
|
|
String pdfPath = "/opt/subsidy/"+subsidy.getFarmerName()+".pdf";
|
|
|
wb.saveToFile(pdfPath, FileFormat.PDF);
|
|
|
-// wb.getConverterSetting().setSheetFitToPage(true);
|
|
|
-// OutputStream outputStream = null;
|
|
|
-// wb.saveToStream(outputStream);
|
|
|
+ wb.dispose();
|
|
|
+
|
|
|
|
|
|
PdfUtil.returnPdfStream2(response,pdfPath,subsidy.getFarmerName());
|
|
|
//文件删除 TODO
|
|
@@ -196,13 +209,31 @@ public class BillSubsidyController {
|
|
|
|
|
|
//阶段性统计表
|
|
|
@GetMapping("/printAmount")
|
|
|
- public void printAmount(HttpServletResponse response) throws Exception {
|
|
|
+ public void printAmount(HttpServletResponse response, @RequestParam(name = "country", required = true) String country
|
|
|
+ , @RequestParam(name = "startDate", required = true) String startDate, @RequestParam(name = "endDate", required = true) String endDate) throws Exception {
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ map.put("start", startDate);
|
|
|
+ map.put("end", endDate);
|
|
|
+ map.put("code", country);
|
|
|
+ iBillSubsidyService.printAmount(response, map);
|
|
|
+
|
|
|
+ String path = "/opt/subsidy/amount.xls";
|
|
|
+ PdfUtil.returnPdfStream2(response,path,"阶段性统计表");
|
|
|
+ //文件删除 TODO
|
|
|
+ }
|
|
|
+
|
|
|
+ //阶段性待支付统计表
|
|
|
+ @GetMapping("/printWaitPay")
|
|
|
+ public void printWaitPay(HttpServletResponse response, @RequestParam(name = "country", required = true) String country
|
|
|
+ , @RequestParam(name = "startDate", required = true) String startDate, @RequestParam(name = "endDate", required = true) String endDate) throws Exception {
|
|
|
+ startDate = startDate + " 00:00:00";
|
|
|
+ endDate = endDate + " 23:59:59";
|
|
|
+
|
|
|
String path = "G://amount.xls";
|
|
|
|
|
|
+// queryWrapper.eq()
|
|
|
// Print2.print();
|
|
|
// PdfUtil.returnPdfStream2(response,path,subsidy.getFarmerName());
|
|
|
//文件删除 TODO
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
}
|