Browse Source

模板导出和导出数据处理功能

user5 2 years ago
parent
commit
53c7e5a8fe

+ 2 - 5
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAccountant/domain/dto/AccountantReimbursementUserDTO.java

@@ -44,10 +44,8 @@ public class AccountantReimbursementUserDTO extends BaseEntity {
     @Excel(name = "年报销额度",width = 14)
     @Length(min = 1, max = 100)
     private String reimbursementQuota;  //年报销额度
-    @Excel(name = "分所已报销额度", type = 10,width = 16)
-    private String substationAlreadyReimbursementAmount;  //分所已报销额度
-    @Excel(name = "总所已报销额度", type = 10,width = 16)
-    private String headquarterAlreadyReimbursementAmount;  //总所已报销额度
+    @Excel(name = "已报销额度", type = 10,width = 16)
+    private String alreadyReimbursementAmount;  //已报销额度
     @Excel(name = "剩余额度", type = 10,width = 10)
     private String remainReimbursementAmount;  //剩余报销额度
     @Excel(name = "已报天数",width = 10)
@@ -60,7 +58,6 @@ public class AccountantReimbursementUserDTO extends BaseEntity {
     private Integer reimbursementAllDay;  //年可报销天数
     private String reimbursementDay;  //报销天数
     private String reimbursementAmount;  //报销额度
-    private String alreadyReimbursementAmount;  //已报销额度
     private String remarks; //备注
 
 

+ 2 - 5
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementAssess/domain/dto/AssessReimbursementUserDTO.java

@@ -44,10 +44,8 @@ public class AssessReimbursementUserDTO extends BaseEntity {
     @Excel(name = "年报销额度",width = 14)
     @Length(min = 1, max = 100)
     private String reimbursementQuota;  //年报销额度
-    @Excel(name = "分所已报销额度", type = 10,width = 16)
-    private String substationAlreadyReimbursementAmount;  //分所已报销额度
-    @Excel(name = "总所已报销额度", type = 10,width = 16)
-    private String headquarterAlreadyReimbursementAmount;  //总所已报销额度
+    @Excel(name = "已报销额度", type = 10,width = 16)
+    private String alreadyReimbursementAmount;  //已报销额度
     @Excel(name = "剩余额度", type = 10,width = 10)
     private String remainReimbursementAmount;  //剩余报销额度
     @Excel(name = "已报天数",width = 10)
@@ -60,7 +58,6 @@ public class AssessReimbursementUserDTO extends BaseEntity {
     private Integer reimbursementAllDay;  //年可报销天数
     private String reimbursementDay;  //报销天数
     private String reimbursementAmount;  //报销额度
-    private String alreadyReimbursementAmount;  //已报销额度
     private String remarks; //备注
 
 

+ 2 - 5
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementProject/domain/dto/ProjectReimbursementUserDTO.java

@@ -44,10 +44,8 @@ public class ProjectReimbursementUserDTO extends BaseEntity {
     @Excel(name = "年报销额度",width = 14)
     @Length(min = 1, max = 100)
     private String reimbursementQuota;  //年报销额度
-    @Excel(name = "分所已报销额度", type = 10,width = 16)
-    private String substationAlreadyReimbursementAmount;  //分所已报销额度
-    @Excel(name = "总所已报销额度", type = 10,width = 16)
-    private String headquarterAlreadyReimbursementAmount;  //总所已报销额度
+    @Excel(name = "已报销额度", type = 10,width = 16)
+    private String alreadyReimbursementAmount;  //已报销额度
     @Excel(name = "剩余额度", type = 10,width = 10)
     private String remainReimbursementAmount;  //剩余报销额度
     @Excel(name = "已报天数",width = 10)
@@ -60,7 +58,6 @@ public class ProjectReimbursementUserDTO extends BaseEntity {
     private Integer reimbursementAllDay;  //年可报销天数
     private String reimbursementDay;  //报销天数
     private String reimbursementAmount;  //报销额度
-    private String alreadyReimbursementAmount;  //已报销额度
     private String remarks; //备注
 
 

+ 17 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementsys/controller/ReimbursementSysController.java

@@ -13,7 +13,10 @@ import com.jeeplus.core.query.QueryWrapperGenerator;
 import com.jeeplus.sys.service.dto.UserDTO;
 import com.jeeplus.sys.utils.StringUtils;
 import com.jeeplus.test.reimbursementsys.domain.dto.ReimbursementDTO;
+import com.jeeplus.test.reimbursementsys.domain.dto.ReimbursementImportDTO;
+import com.jeeplus.test.reimbursementsys.domain.dto.ReimbursementUserImportDTO;
 import com.jeeplus.test.reimbursementsys.service.ReimbursementSysService;
+import com.jeeplus.test.reimbursementsys.utils.ThisLocalityDownloadUtil;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
@@ -248,4 +251,18 @@ public class ReimbursementSysController {
         }
         EasyPoiUtil.exportExcel ( result, "分所报销数据",  options.getSheetName ( ), ReimbursementDTO.class, fileName, response );
     }
+
+    /**
+     * 下载报销发票导入模板
+     *
+     * @param response
+     * @return
+     */
+    @GetMapping("import/template")
+    @ApiOperation(value = "下载模板")
+    public void importFileTemplate(HttpServletResponse response, HttpServletRequest request) {
+
+        ThisLocalityDownloadUtil download = new ThisLocalityDownloadUtil();
+        download.download("报销发票导入模板.xlsx",request,response);
+    }
 }

+ 97 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementsys/domain/dto/ReimbursementImportDTO.java

@@ -0,0 +1,97 @@
+package com.jeeplus.test.reimbursementsys.domain.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jeeplus.core.domain.TreeEntity;
+import com.jeeplus.sys.utils.StringUtils;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 中审报表数据表
+ * @author: 徐滕
+ * @version: 2022-05-11 10:31
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("zs_reimbursement_info")
+public class ReimbursementImportDTO extends TreeEntity<ReimbursementImportDTO> {
+    private static final long serialVersionUID = 1L;
+    //@Excel(name = "所属年份")
+    private String year;    //业务编码年份(相同的业务编码根据年份不同生成不同的数据列)(仅业务表中使用)
+    private String businessCodeId;    //业务编号id
+    @Excel(name = "发票代码",width = 10)
+    private String invoiceCode;     //发票代码
+    @Excel(name = "发票号码",width = 10)
+    private String invoiceNumber;   //发票号码
+    //@Excel(name = "报销比例")
+    private String reimbursementRatio;    //报销比例
+    //@Excel(name = "已报金额",type = 10)
+    private String allAlreadyReimbursementQuota;    //总报销额度(已报金额)
+    //@Excel(name = "可报金额",type = 10)
+    private String canReimbursementAmount;    //可报销额度
+    @Excel(name = "购方企业名称",width = 30)
+    private String firmName;        //购方企业名称
+
+    @Excel(name = "开票日期",importFormat = "yyyy-MM-dd",exportFormat = "yyyy-MM-dd",width = 16)
+    private String makeTime;          //开票日期
+    @Excel(name = "商品名称",width = 30)
+    private String name;     //商品名称
+    @Excel(name = "金额",type = 10)
+    private String money;       //金额
+    @Excel(name = "税额",type = 10)
+    private String tax;         //税额
+    @Excel(name = "收入",type = 10)
+    private String income;      //收入
+
+    @Excel(name = "申请人",width = 10)
+    private String proposer;        //申请人
+    @Excel(name = "合伙人",width = 10)
+    private String partner;         //合伙人
+    @Excel(name = "业务类型",width = 12)
+    private String businessType;    //业务类型
+    @Excel(name = "业务编号",width = 10)
+    private String businessCode;    //业务编号
+    private String remarks;    //备注
+    private Integer type;    //状态
+    private String surplusReimbursementAmount;    //剩余报销额度
+    private String reimbursementType;    //报销比例
+    private String gatheringStatus;    //收款状态
+    private String reimbursementStatus;    //报销状态
+    private String randomType;    //随机状态(1:随机业务编码,2:指定业务编码)(默认为指定业务编码仅业务表中使用)
+    private String batchFlag;    //批量报销状态(1:批量报销)(仅业务表中使用)
+    private String randomBusinessCodeIndex;    //随即业务编码序号
+    private List<String> idList;
+
+    @Excel(name = "收款日期",importFormat = "yyyy-MM-dd",exportFormat = "yyyy-MM-dd",width = 16)
+    private String gatheringTime;     //收款日期
+
+
+    /**
+     * 开票开始日期
+     */
+    private Date beginDate;
+    /**
+     * 开票结束日期
+     */
+    private Date endDate;
+    /**
+     * 收入前区间
+     */
+    private String beginIncome;
+    /**
+     * 收入后区间
+     */
+    private String endIncome;
+
+
+    public String getReimbursementType() {
+        if(StringUtils.isBlank(this.reimbursementType)){
+            this.reimbursementType = "1";
+        }
+        return reimbursementType;
+    }
+}

+ 2 - 2
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementsys/mapper/xml/WuHanReimbursementSysMapper.xml

@@ -15,13 +15,13 @@
         a.invoice_code AS "invoiceCode",
         a.invoice_number AS "invoiceNumber",
         a.firm_name AS "firmName",
-        a.make_time AS "makeTime",
+        DATE_FORMAT(a.make_time,'%Y-%m-%d') AS "makeTime",
 		a.name AS "name",
         a.money AS "money",
         a.tax AS "tax",
         a.income AS "income",
         a.business_code AS "businessCode",
-        a.gathering_time AS "gatheringTime",
+        DATE_FORMAT(a.gathering_time,'%Y-%m-%d') AS "gatheringTime",
         a.proposer AS "proposer",
         a.partner AS "partner",
         a.business_type AS "businessType",

+ 86 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursementsys/utils/ThisLocalityDownloadUtil.java

@@ -0,0 +1,86 @@
+package com.jeeplus.test.reimbursementsys.utils;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+/**
+ * 本地服务器文件下载工具类
+ */
+public class ThisLocalityDownloadUtil {
+
+    public void download(String fileName, HttpServletRequest request, HttpServletResponse response) {
+        try {
+            //读取服务器的文件下载路径
+            String paths = this.getClass().getResource("/").getPath();
+            String filePath = paths.substring(1, paths.length() - 16);
+            System.out.println("===========os.name:"+System.getProperties().getProperty("os.name"));
+            //判定当前系统是否为linux版本
+            Boolean isWindows = System.getProperty("os.name").toLowerCase().contains("linux");
+            String path = "";
+            if(!isWindows){
+                path = filePath+"/dot/"+fileName;
+            }else{
+                //如果是linux系统 则需要在路径前加上一个 /
+                path = "/"+filePath+"/dot/"+fileName;
+            }
+            downCfg(fileName, request, response);
+            OutputStream out;
+            FileInputStream inputStream = new FileInputStream(path);
+            out = response.getOutputStream();
+            byte[] buffer = new byte[1024];
+            int len;
+            while ((len = inputStream.read(buffer)) != -1) {
+                out.write(buffer, 0, len);
+            }
+            inputStream.close();
+            out.close();
+            out.flush();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    private void downCfg(String fileName, HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException {
+        // 判断浏览器,进行不同的加密,这样下载的时候保存的文件名就不会乱码
+        String userAgent = request.getHeader("User-Agent");
+        // 针对IE或者以IE为内核的浏览器:
+        if (userAgent.contains("MSIE") || userAgent.contains("Trident")) {
+            fileName = URLEncoder.encode(fileName, "UTF-8");
+        } else {
+            // 非IE浏览器的处理:
+            fileName = new String(fileName.getBytes("UTF-8"), "ISO-8859-1");
+        }
+        response.setHeader("Content-disposition", String.format("attachment; filename=\"%s\"", fileName));
+        response.setContentType("application/octet-stream;charset=utf-8");
+        response.setCharacterEncoding("UTF-8");
+    }
+
+    public void downloadFileTemplate(String fileName, HttpServletRequest request, HttpServletResponse response) {
+        try {
+            //读取服务器的文件下载路径
+            String paths = this.getClass().getResource("/").getPath();
+            String filePath = paths.substring(1, paths.length() - 16);
+            System.out.println("===========os.name:"+System.getProperties().getProperty("os.name"));
+            String path = "";
+            path = this.getClass().getResource("/").getPath()+"template/"+fileName;
+            downCfg(fileName, request, response);
+            OutputStream out;
+            FileInputStream inputStream = new FileInputStream(path);
+            out = response.getOutputStream();
+            byte[] buffer = new byte[1024];
+            int len;
+            while ((len = inputStream.read(buffer)) != -1) {
+                out.write(buffer, 0, len);
+            }
+            inputStream.close();
+            out.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+}

BIN
jeeplus-plugins/jeeplus-ureport/target/jeeplus-ureport-9.0.jar


+ 7 - 0
jeeplus-plugins/jeeplus-ureport/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst

@@ -0,0 +1,7 @@
+com\jeeplus\ureport\ReportDatasource.class
+com\jeeplus\ureport\cache\CacheController.class
+com\jeeplus\ureport\ReportService.class
+com\jeeplus\ureport\cache\NullCache.class
+com\jeeplus\ureport\ReportConfiguration.class
+com\jeeplus\ureport\cache\ErasableMemoryCache.class
+com\jeeplus\ureport\ReportController.class

+ 7 - 0
jeeplus-plugins/jeeplus-ureport/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst

@@ -0,0 +1,7 @@
+D:\java_project\xg_reimbursement_spring_boot\jeeplus-plugins\jeeplus-ureport\src\main\java\com\jeeplus\ureport\ReportDatasource.java
+D:\java_project\xg_reimbursement_spring_boot\jeeplus-plugins\jeeplus-ureport\src\main\java\com\jeeplus\ureport\ReportConfiguration.java
+D:\java_project\xg_reimbursement_spring_boot\jeeplus-plugins\jeeplus-ureport\src\main\java\com\jeeplus\ureport\ReportService.java
+D:\java_project\xg_reimbursement_spring_boot\jeeplus-plugins\jeeplus-ureport\src\main\java\com\jeeplus\ureport\cache\NullCache.java
+D:\java_project\xg_reimbursement_spring_boot\jeeplus-plugins\jeeplus-ureport\src\main\java\com\jeeplus\ureport\cache\CacheController.java
+D:\java_project\xg_reimbursement_spring_boot\jeeplus-plugins\jeeplus-ureport\src\main\java\com\jeeplus\ureport\cache\ErasableMemoryCache.java
+D:\java_project\xg_reimbursement_spring_boot\jeeplus-plugins\jeeplus-ureport\src\main\java\com\jeeplus\ureport\ReportController.java

BIN
jeeplus-web/dot/报销发票导入模板.xlsx