Quellcode durchsuchen

知行同德v1.0

wzy vor 1 Jahr
Ursprung
Commit
c74afb32b6
18 geänderte Dateien mit 1178 neuen und 110 gelöschten Zeilen
  1. 35 5
      mjava-zhixingtongde/src/main/java/com/malk/zhixingtongde/controller/ZxtdReportConroller.java
  2. 16 12
      mjava-zhixingtongde/src/main/java/com/malk/zhixingtongde/entity/Accounts.java
  3. 112 0
      mjava-zhixingtongde/src/main/java/com/malk/zhixingtongde/entity/Cash.java
  4. 5 3
      mjava-zhixingtongde/src/main/java/com/malk/zhixingtongde/entity/Profit.java
  5. 36 0
      mjava-zhixingtongde/src/main/java/com/malk/zhixingtongde/service/ZxtdReportService.java
  6. 943 73
      mjava-zhixingtongde/src/main/java/com/malk/zhixingtongde/service/impl/ZxtdReportServiceImpl.java
  7. 14 5
      mjava-zhixingtongde/src/main/resources/application-dev.yml
  8. 3 3
      mjava-zhixingtongde/src/main/resources/application-prod.yml
  9. BIN
      mjava-zhixingtongde/src/main/resources/templates/Quarter_Template_profit.xlsx
  10. BIN
      mjava-zhixingtongde/src/main/resources/templates/Template_all.xlsx
  11. BIN
      mjava-zhixingtongde/src/main/resources/templates/Template_cash.xlsx
  12. BIN
      mjava-zhixingtongde/src/main/resources/templates/Template_liabilities.xlsx
  13. BIN
      mjava-zhixingtongde/src/main/resources/templates/Template_other_payable.xlsx
  14. BIN
      mjava-zhixingtongde/src/main/resources/templates/Template_other_receivable.xlsx
  15. BIN
      mjava-zhixingtongde/src/main/resources/templates/Template_payable.xlsx
  16. BIN
      mjava-zhixingtongde/src/main/resources/templates/Template_profit.xlsx
  17. BIN
      mjava-zhixingtongde/src/main/resources/templates/Template_receivable.xlsx
  18. 14 9
      mjava/src/main/java/com/malk/utils/UtilExcel.java

+ 35 - 5
mjava-zhixingtongde/src/main/java/com/malk/zhixingtongde/controller/ZxtdReportConroller.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.malk.server.aliwork.YDConf;
 import com.malk.server.aliwork.YDParam;
 import com.malk.server.common.McR;
+import com.malk.server.common.McREnum;
 import com.malk.service.aliwork.YDClient;
 import com.malk.utils.UtilMap;
 import com.malk.zhixingtongde.entity.Profit;
@@ -13,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
+import java.io.File;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
@@ -28,9 +30,6 @@ public class ZxtdReportConroller {
     @Autowired
     private ZxtdReportService zxtdReportService;
 
-    @Autowired
-    private YDClient ydClient;
-
     @GetMapping("/test")
     public McR test(){
         return McR.success();
@@ -42,7 +41,7 @@ public class ZxtdReportConroller {
     }
 
     //导出季度核算表
-    @GetMapping("/exportQuarterProfit")
+        @GetMapping("/exportQuarterProfit")
     public void exportQuarterProfit(HttpServletResponse response,String year){
         zxtdReportService.exportQuarterProfit(response,year);
     }
@@ -59,16 +58,47 @@ public class ZxtdReportConroller {
         zxtdReportService.exportOtherReceivableDetails(response,year);
     }
 
+    //导出应付账款明细表
+    @GetMapping("/exportPayableDetails")
+    public void exportPayableDetails(HttpServletResponse response,String year){
+        zxtdReportService.exportPayableDetails(response,year);
+    }
+
     //导出其他应付款明细表
     @GetMapping("/exportOtherPayableDetails")
     public void exportOtherPayableDetails(HttpServletResponse response,String year){
         zxtdReportService.exportOtherPayableDetails(response,year);
     }
 
-    //导出所有表
+    //导出资产负债表
+    @GetMapping("/exportLiabilitiesDetails")
+    public void exportBalanceSheet(HttpServletResponse response,String year){
+        zxtdReportService.exportLiabilitiesDetails(response,year);
+    }
+
+    //导出所有表(利润表、季度利润表、应收账款表、其他应收款表、应付账款表、其他应付款表)
     @GetMapping("/exportAll")
     public void exportAll(HttpServletResponse response,String year){
         zxtdReportService.exportAll(response,year);
     }
 
+    //导出现金流量主表及附表
+    @GetMapping("/exportCash")
+    public void exportCash(HttpServletResponse response,String year) {
+        zxtdReportService.exportCash(response, year);
+    }
+
+    //上传文件至钉盘
+    @PostMapping("/uploadToDingTalk")
+    public McR uploadToDingTalk(HttpServletResponse response,String userId) {
+        try {
+            zxtdReportService.uploadToDingTalk(response,userId);
+        }catch (Exception e){
+            return McR.error(McREnum.UNKNOWN_EXCEPTION.toString(),"上传文件至钉盘失败");
+        }
+
+        return McR.success();
+    }
+
+
 }

+ 16 - 12
mjava-zhixingtongde/src/main/java/com/malk/zhixingtongde/entity/Accounts.java

@@ -3,6 +3,8 @@ package com.malk.zhixingtongde.entity;
 import cn.hutool.core.util.NumberUtil;
 import lombok.Data;
 
+import java.math.RoundingMode;
+
 @Data
 public class Accounts {
 
@@ -99,18 +101,20 @@ public class Accounts {
 
     public Accounts add(Accounts subTotalAccounts) {
         this.initialAmt = NumberUtil.add(this.initialAmt, subTotalAccounts.getInitialAmt()).toString();
-        this.amt1 = NumberUtil.add(this.amt1, subTotalAccounts.getAmt1()).toString();
-        this.amt2 = NumberUtil.add(this.amt2, subTotalAccounts.getAmt2()).toString();
-        this.amt3 = NumberUtil.add(this.amt3, subTotalAccounts.getAmt3()).toString();
-        this.amt4 = NumberUtil.add(this.amt4, subTotalAccounts.getAmt4()).toString();
-        this.amt5 = NumberUtil.add(this.amt5, subTotalAccounts.getAmt5()).toString();
-        this.amt6 = NumberUtil.add(this.amt6, subTotalAccounts.getAmt6()).toString();
-        this.amt7 = NumberUtil.add(this.amt7, subTotalAccounts.getAmt7()).toString();
-        this.amt8 = NumberUtil.add(this.amt8, subTotalAccounts.getAmt8()).toString();
-        this.amt9 = NumberUtil.add(this.amt9, subTotalAccounts.getAmt9()).toString();
-        this.amt10 = NumberUtil.add(this.amt10, subTotalAccounts.getAmt10()).toString();
-        this.amt11 = NumberUtil.add(this.amt11, subTotalAccounts.getAmt11()).toString();
-        this.amt12 = NumberUtil.add(this.amt12, subTotalAccounts.getAmt12()).toString();
+        this.amt1 = NumberUtil.add(this.amt1, subTotalAccounts.getAmt1()).setScale(2, RoundingMode.HALF_UP).toString();
+        this.amt2 = NumberUtil.add(this.amt2, subTotalAccounts.getAmt2()).setScale(2, RoundingMode.HALF_UP).toString();
+        this.amt3 = NumberUtil.add(this.amt3, subTotalAccounts.getAmt3()).setScale(2, RoundingMode.HALF_UP).toString();
+        this.amt4 = NumberUtil.add(this.amt4, subTotalAccounts.getAmt4()).setScale(2, RoundingMode.HALF_UP).toString();
+        this.amt5 = NumberUtil.add(this.amt5, subTotalAccounts.getAmt5()).setScale(2, RoundingMode.HALF_UP).toString();
+        this.amt6 = NumberUtil.add(this.amt6, subTotalAccounts.getAmt6()).setScale(2, RoundingMode.HALF_UP).toString();
+        this.amt7 = NumberUtil.add(this.amt7, subTotalAccounts.getAmt7()).setScale(2, RoundingMode.HALF_UP).toString();
+        this.amt8 = NumberUtil.add(this.amt8, subTotalAccounts.getAmt8()).setScale(2, RoundingMode.HALF_UP).toString();
+        this.amt9 = NumberUtil.add(this.amt9, subTotalAccounts.getAmt9()).setScale(2, RoundingMode.HALF_UP).toString();
+        this.amt10 = NumberUtil.add(this.amt10, subTotalAccounts.getAmt10()).setScale(2, RoundingMode.HALF_UP).toString();
+        this.amt11 = NumberUtil.add(this.amt11, subTotalAccounts.getAmt11()).setScale(2, RoundingMode.HALF_UP).toString();
+        this.amt12 = NumberUtil.add(this.amt12, subTotalAccounts.getAmt12()).setScale(2, RoundingMode.HALF_UP).toString();
         return this;
     }
+
+
 }

+ 112 - 0
mjava-zhixingtongde/src/main/java/com/malk/zhixingtongde/entity/Cash.java

@@ -0,0 +1,112 @@
+package com.malk.zhixingtongde.entity;
+
+import lombok.Data;
+
+@Data
+public class Cash {
+    private String amt1;
+    private String amt2;
+    private String amt3;
+    private String amt4;
+    private String amt5;
+    private String amt6;
+    private String amt7;
+    private String amt8;
+    private String amt9;
+    private String amt10;
+    private String amt11;
+    private String amt12;
+    private String amt13;
+    private String amt14;
+    private String amt15;
+    private String amt16;
+    private String amt17;
+    private String amt18;
+    private String amt19;
+    private String amt20;
+    private String amt21;
+    private String amt22;
+    private String amt23;
+    private String amt24;
+    private String amt25;
+
+    private String lastAmt1;
+    private String lastAmt2;
+    private String lastAmt3;
+    private String lastAmt4;
+    private String lastAmt5;
+    private String lastAmt6;
+    private String lastAmt7;
+    private String lastAmt8;
+    private String lastAmt9;
+    private String lastAmt10;
+    private String lastAmt11;
+    private String lastAmt12;
+    private String lastAmt13;
+    private String lastAmt14;
+    private String lastAmt15;
+    private String lastAmt16;
+    private String lastAmt17;
+    private String lastAmt18;
+    private String lastAmt19;
+    private String lastAmt20;
+    private String lastAmt21;
+    private String lastAmt22;
+    private String lastAmt23;
+    private String lastAmt24;
+    private String lastAmt25;
+
+    public Cash() {
+        this.amt1 = "0.00";
+        this.amt2 = "0.00";
+        this.amt3 = "0.00";
+        this.amt4 = "0.00";
+        this.amt5 = "0.00";
+        this.amt6 = "0.00";
+        this.amt7 = "0.00";
+        this.amt8 = "0.00";
+        this.amt9 = "0.00";
+        this.amt10 = "0.00";
+        this.amt11 = "0.00";
+        this.amt12 = "0.00";
+        this.amt13 = "0.00";
+        this.amt14 = "0.00";
+        this.amt15 = "0.00";
+        this.amt16 = "0.00";
+        this.amt17 = "0.00";
+        this.amt18 = "0.00";
+        this.amt19 = "0.00";
+        this.amt20 = "0.00";
+        this.amt21 = "0.00";
+        this.amt22 = "0.00";
+        this.amt23 = "0.00";
+        this.amt24 = "0.00";
+        this.amt25 = "0.00";
+
+        this.lastAmt1 = "0.00";
+        this.lastAmt2 = "0.00";
+        this.lastAmt3 = "0.00";
+        this.lastAmt4 = "0.00";
+        this.lastAmt5 = "0.00";
+        this.lastAmt6 = "0.00";
+        this.lastAmt7 = "0.00";
+        this.lastAmt8 = "0.00";
+        this.lastAmt9 = "0.00";
+        this.lastAmt10 = "0.00";
+        this.lastAmt11 = "0.00";
+        this.lastAmt12 = "0.00";
+        this.lastAmt13 = "0.00";
+        this.lastAmt14 = "0.00";
+        this.lastAmt15 = "0.00";
+        this.lastAmt16 = "0.00";
+        this.lastAmt17 = "0.00";
+        this.lastAmt18 = "0.00";
+        this.lastAmt19 = "0.00";
+        this.lastAmt20 = "0.00";
+        this.lastAmt21 = "0.00";
+        this.lastAmt22 = "0.00";
+        this.lastAmt23 = "0.00";
+        this.lastAmt24 = "0.00";
+        this.lastAmt25 = "0.00";
+    }
+}

+ 5 - 3
mjava-zhixingtongde/src/main/java/com/malk/zhixingtongde/entity/Profit.java

@@ -4,6 +4,8 @@ import cn.hutool.core.util.NumberUtil;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 
+import java.math.RoundingMode;
+
 @Data
 public class Profit {
     private String subject;
@@ -43,13 +45,13 @@ public class Profit {
     }
 
     public Profit buildTotal(){
-        this.totalAmt= NumberUtil.add(amt1,amt2,amt3,amt4,amt5,amt6,amt7,amt8,amt9,amt10,amt11,amt12).toString();
+        this.totalAmt= NumberUtil.add(amt1,amt2,amt3,amt4,amt5,amt6,amt7,amt8,amt9,amt10,amt11,amt12).setScale(2, RoundingMode.HALF_UP).toString();
         return this;
     }
 
     public Profit buildTotalBudget(){
-        this.totalBudget= NumberUtil.add(quarterAmt1,quarterBudget2,quarterBudget3,quarterBudget4).toString();
-            return this;
+        this.totalBudget= NumberUtil.add(quarterAmt1,quarterBudget2,quarterBudget3,quarterBudget4).setScale(2,RoundingMode.HALF_UP).toString();
+        return this;
     }
 
 }

+ 36 - 0
mjava-zhixingtongde/src/main/java/com/malk/zhixingtongde/service/ZxtdReportService.java

@@ -1,5 +1,7 @@
 package com.malk.zhixingtongde.service;
 
+import org.springframework.scheduling.annotation.Async;
+
 import javax.servlet.http.HttpServletResponse;
 
 public interface ZxtdReportService {
@@ -34,5 +36,39 @@ public interface ZxtdReportService {
      */
     void exportOtherPayableDetails(HttpServletResponse response, String year);
 
+    /**
+     * 导出所有表(利润表、季度利润表、应收账款表、其他应收款表、其他应付款表)
+     * @param response
+     * @param year
+     */
     void exportAll(HttpServletResponse response, String year);
+
+    /**
+     * 导出现金流量主表及附表
+     * @param response
+     * @param year
+     */
+    void exportCash(HttpServletResponse response, String year);
+
+    /**
+     * 上传文件至钉盘
+     * @param response
+     * @param userId
+     */
+    @Async
+    void uploadToDingTalk(HttpServletResponse response,String userId);
+
+    /**
+     * 导出应付账款明细表
+     * @param response
+     * @param year
+     */
+    void exportPayableDetails(HttpServletResponse response, String year);
+
+    /**
+     * 导出资产负债表
+     * @param response
+     * @param year
+     */
+    void exportLiabilitiesDetails(HttpServletResponse response, String year);
 }

Datei-Diff unterdrückt, da er zu groß ist
+ 943 - 73
mjava-zhixingtongde/src/main/java/com/malk/zhixingtongde/service/impl/ZxtdReportServiceImpl.java


+ 14 - 5
mjava-zhixingtongde/src/main/resources/application-dev.yml

@@ -39,13 +39,22 @@ logging:
 
 # dingtalk
 dingtalk:
-  agentId: 2673435445
-  appKey: dingozv6fzkpqkiupd3d
-  appSecret: bO4AA6ujXj8xgLBJI5pR7ns0vRsHCn8Ng9fTf9WF95HTOlCW0oybYpHsuxXuBPiO
-  corpId: dingcc1b1ffad0d5ca1d
+  #agentId: 2673435445
+  #appKey: dingozv6fzkpqkiupd3d
+  #appSecret: bO4AA6ujXj8xgLBJI5pR7ns0vRsHCn8Ng9fTf9WF95HTOlCW0oybYpHsuxXuBPiO
+  #corpId: dingcc1b1ffad0d5ca1d
+  #aesKey:
+  #token:
+  #operator: ""   # OA管理员账号 [0开头需要转一下字符串]
+
+  #poc
+  agentId: 2995824312
+  appKey: ding3ap1jk1tg44tz3s2
+  appSecret: PaWTDG-FiX-RW5fnV9r8CzEmR-9QlJpubC88txhprL_Z_iREO62B-iRW6w7gkA_K
+  corpId: ding321c72787fffc78b35c2f4657eb6378f
   aesKey:
   token:
-  operator: ""   # OA管理员账号 [0开头需要转一下字符串]
+  operator: "344749020127590108"   # OA管理员账号 [0开头需要转一下字符串] wzy
 
 # aliwork
 aliwork:

+ 3 - 3
mjava-zhixingtongde/src/main/resources/application-prod.yml

@@ -24,9 +24,9 @@ spring:
 
 # dingtalk
 dingtalk:
-  agentId: 2673435445
-  appKey: dingozv6fzkpqkiupd3d
-  appSecret: bO4AA6ujXj8xgLBJI5pR7ns0vRsHCn8Ng9fTf9WF95HTOlCW0oybYpHsuxXuBPiO
+  agentId: 3086109407
+  appKey: dinghyyu1rci8fgejgbx
+  appSecret: dE4r1mqQJqGPk8lQdbvmDdxqToE6RbcRL53mys4ajRPD4W2jAx3mhTbOULfT25wJ
   corpId: ding9400625d56a28e4135c2f4657eb6378f
   aesKey:
   token:

BIN
mjava-zhixingtongde/src/main/resources/templates/Quarter_Template_profit.xlsx


BIN
mjava-zhixingtongde/src/main/resources/templates/Template_all.xlsx


BIN
mjava-zhixingtongde/src/main/resources/templates/Template_cash.xlsx


BIN
mjava-zhixingtongde/src/main/resources/templates/Template_liabilities.xlsx


BIN
mjava-zhixingtongde/src/main/resources/templates/Template_other_payable.xlsx


BIN
mjava-zhixingtongde/src/main/resources/templates/Template_other_receivable.xlsx


BIN
mjava-zhixingtongde/src/main/resources/templates/Template_payable.xlsx


BIN
mjava-zhixingtongde/src/main/resources/templates/Template_profit.xlsx


BIN
mjava-zhixingtongde/src/main/resources/templates/Template_receivable.xlsx


+ 14 - 9
mjava/src/main/java/com/malk/utils/UtilExcel.java

@@ -1,6 +1,9 @@
 package com.malk.utils;
 
+import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.json.JSONObject;
+import cn.hutool.json.JSONUtil;
 import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.ExcelWriter;
 import com.alibaba.excel.write.metadata.WriteSheet;
@@ -17,9 +20,7 @@ import org.apache.poi.xssf.usermodel.*;
 import javax.annotation.Nullable;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.constraints.NotNull;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
+import java.io.*;
 import java.math.BigDecimal;
 import java.net.URLEncoder;
 import java.text.SimpleDateFormat;
@@ -249,11 +250,18 @@ public class UtilExcel {
      * 列表与主表进行填充 [格式: 模板主表 {字段}, 列表 {.字段}]
      */
     @SneakyThrows
-    public static void exportAllSheetByTemplate(HttpServletResponse response, List<Object> dataMainList, List<List> dataLists, @Nullable String fileName, String templateName) {
+    public static void exportAllSheetByTemplate(HttpServletResponse response, List<Object> dataMainList, List<List> dataLists,String year, @Nullable String fileName, String templateName) {
         InputStream inputStream = UtilFile.readPackageResource("templates/" + templateName);
-        UtilExcel.setResponseHeader(response, fileName, ".xlsx");
+
         if (dataMainList.size() == dataLists.size()){
-            ExcelWriter workBook = EasyExcel.write(response.getOutputStream()).withTemplate(inputStream).build();
+            //删除本地磁盘中"D:\\" + fileName + "-" + year + ".xlsx"的文件
+            File file = new File("D:\\" + fileName + "-" + year + ".xlsx");
+            if (file.exists()) {
+                file.delete();
+            }
+
+//            UtilExcel.setResponseHeader(response, fileName, ".xlsx");
+            ExcelWriter workBook = EasyExcel.write("D:\\" + fileName + "-" + year + ".xlsx").withTemplate(inputStream).build();
             for (int i = 0; i < dataMainList.size(); i++) {
                 WriteSheet sheet = EasyExcel.writerSheet(i).build();
                 // 先单组数据填充,再多组数据填充
@@ -262,9 +270,6 @@ public class UtilExcel {
             }
             workBook.finish();
         }
-
-
-
     }
 
 }