Browse Source

no message

ly 1 year ago
parent
commit
e775d2c0f6

+ 4 - 1
pom.xml

@@ -68,7 +68,10 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter</artifactId>
         </dependency>
-
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+        </dependency>
         <!-- SpringBoot 测试 -->
         <dependency>
             <groupId>org.springframework.boot</groupId>

+ 243 - 0
src/main/java/cn/ezhizao/common/utils/poi/ExcelMultipleSheetsUtil.java

@@ -0,0 +1,243 @@
+package cn.ezhizao.common.utils.poi;
+
+import cn.ezhizao.common.utils.DictUtils;
+import cn.ezhizao.framework.aspectj.lang.annotation.Excel;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.convert.Convert;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Field;
+import java.net.URLEncoder;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import static org.apache.commons.codec.CharEncoding.UTF_8;
+
+public class ExcelMultipleSheetsUtil {
+
+    /**
+     * 导出excel:可多个sheet页
+     *
+     * @param data          数据:Map 集合【key == 每一个sheet页的名称,value == sheet页数据】
+     * @param excelFileName excel文件名
+     * @param suffixName    后缀名
+     * @param response      响应
+     * @throws IOException 异常
+     */
+    public static void excelMultipleSheets(Map<String, Object> data, String excelFileName, String suffixName, HttpServletResponse response) throws IOException {
+        // 创建工作簿
+        try (Workbook workbook = new XSSFWorkbook()) {
+            for (Map.Entry<String, Object> entry : data.entrySet()) {
+                String sheetName = entry.getKey();
+                Object sheetData = entry.getValue();
+                Sheet sheet = workbook.createSheet(sheetName);
+                createSheetWithData(sheet, sheetData);
+            }
+
+            setResponseHeader(response, excelFileName, suffixName);
+            // 写出文件
+            workbook.write(response.getOutputStream());
+        }
+    }
+
+    /**
+     * 创建表单并填充数据
+     *
+     * @param sheet 表单
+     * @param data  数据
+     */
+    private static void createSheetWithData(Sheet sheet, Object data) {
+        if (data instanceof List) {
+            createSheetWithListData(sheet, (List<?>) data);
+        } else {
+            createSheetWithObjectData(sheet, data);
+        }
+    }
+
+    /**
+     * 创建列表类型数据对应的Excel表单
+     *
+     * @param sheet    表单
+     * @param dataList 数据列表
+     */
+    private static void createSheetWithListData(Sheet sheet, List<?> dataList) {
+        if (CollUtil.isNotEmpty(dataList)) {
+            Object firstItem = dataList.get(0);
+            createHeaderRow(sheet, firstItem.getClass());
+            int rowIndex = 1;
+            for (Object item : dataList) {
+                createDataRow(sheet, item, rowIndex++);
+            }
+        }
+    }
+
+    /**
+     * 创建对象类型数据对应的Excel表单
+     *
+     * @param sheet 表单
+     * @param data  数据
+     */
+    private static void createSheetWithObjectData(Sheet sheet, Object data) {
+        createHeaderRow(sheet, data.getClass());
+        createDataRow(sheet, data, 1);
+    }
+
+    /**
+     * 创建表头行
+     *
+     * @param sheet 表单
+     * @param clazz 数据类
+     */
+    private static void createHeaderRow(Sheet sheet, Class<?> clazz) {
+        // 创建单元格样式
+        CellStyle headerCellStyle = createCellStyle(sheet.getWorkbook());
+
+        // 创建标题行
+        Row headerRow = sheet.createRow(0);
+        Field[] fields = clazz.getDeclaredFields();
+        for (int i = 0; i < fields.length; i++) {
+            createHeaderCell(sheet, headerCellStyle, fields, headerRow, i);
+        }
+    }
+
+    /**
+     * 创建数据行
+     *
+     * @param sheet    表单
+     * @param data     数据
+     * @param rowIndex 行号
+     */
+    private static void createDataRow(Sheet sheet, Object data, int rowIndex) {
+        // 创建单元格样式
+        CellStyle dataCellStyle = createCellStyle(sheet.getWorkbook());
+
+        // 创建数据行
+        Row dataRow = sheet.createRow(rowIndex);
+        Field[] fields = data.getClass().getDeclaredFields();
+        for (int i = 0; i < fields.length; i++) {
+            createDataCell(dataCellStyle, fields, dataRow, i, data);
+        }
+    }
+
+    /**
+     * 创建单元格样式
+     *
+     * @param workbook 工作簿
+     * @return 单元格样式
+     */
+    private static CellStyle createCellStyle(Workbook workbook) {
+        CellStyle cellStyle = workbook.createCellStyle();
+
+        // 设置 水平和垂直 居中对齐
+        cellStyle.setAlignment(HorizontalAlignment.CENTER);
+        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
+
+        // 设置 上 下 左 右 边框及颜色
+        cellStyle.setBorderTop(BorderStyle.THIN);
+        cellStyle.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
+        cellStyle.setBorderBottom(BorderStyle.THIN);
+        cellStyle.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
+        cellStyle.setBorderLeft(BorderStyle.THIN);
+        cellStyle.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
+        cellStyle.setBorderRight(BorderStyle.THIN);
+        cellStyle.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
+
+        // 设置字体
+        Font dataFont = workbook.createFont();
+        dataFont.setFontName("Arial");
+        dataFont.setFontHeightInPoints((short) 10);
+        cellStyle.setFont(dataFont);
+
+        return cellStyle;
+    }
+
+    /**
+     * 创建Excel表头单元格
+     *
+     * @param sheet           表单
+     * @param headerCellStyle 单元格样式
+     * @param fields          字段
+     * @param headerRow       标题行
+     * @param i               序号
+     */
+    private static void createHeaderCell(Sheet sheet, CellStyle headerCellStyle, Field[] fields, Row headerRow, int i) {
+        // 默认宽度
+        double width = 16;
+        Excel excelAnnotation = fields[i].getAnnotation(Excel.class);
+        if (excelAnnotation != null && !ObjectUtil.isEmpty(excelAnnotation.width())) {
+            width = excelAnnotation.width();
+        }
+
+        // 设置宽度
+        sheet.setColumnWidth(i, (int) ((width + 0.72) * 256));
+
+        if (excelAnnotation != null) {
+            Cell cell = headerRow.createCell(i);
+            cell.setCellValue(excelAnnotation.name());
+            cell.setCellStyle(headerCellStyle);
+        }
+    }
+
+    /**
+     * 创建Excel数据单元格
+     *
+     * @param dataCellStyle 单元格样式
+     * @param fields        字段
+     * @param dataRow       数据行
+     * @param i             序号
+     * @param data          数据
+     */
+    private static void createDataCell(CellStyle dataCellStyle, Field[] fields, Row dataRow, int i, Object data) {
+        Cell cell = dataRow.createCell(i);
+        cell.setCellStyle(dataCellStyle);
+
+        try {
+            fields[i].setAccessible(true);
+            Object value = fields[i].get(data);
+            handleAnnotationAndSetValue(cell, fields[i], value);
+        } catch (IllegalAccessException e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 处理注解并设置单元格值
+     *
+     * @param cell  单元格
+     * @param field 字段
+     * @param value 值
+     */
+    private static void handleAnnotationAndSetValue(Cell cell, Field field, Object value) {
+        if (field.isAnnotationPresent(Excel.class) && field.getAnnotation(Excel.class).dictType().length() > 0) {
+            value = DictUtils.getDictLabel(field.getAnnotation(Excel.class).dictType(), String.valueOf(value));
+        }
+        if (field.isAnnotationPresent(Excel.class) && StrUtil.isNotEmpty(field.getAnnotation(Excel.class).dateFormat())) {
+            value = DateUtil.format(Convert.convert(Date.class, value), field.getAnnotation(Excel.class).dateFormat());
+        }
+
+        cell.setCellValue(ObjectUtil.isEmpty(value) ? null : value.toString());
+    }
+
+    /**
+     * 设置响应头
+     *
+     * @param response      响应
+     * @param excelFileName 文件名
+     * @param suffixName    后缀名
+     * @throws UnsupportedEncodingException 编码异常
+     */
+    private static void setResponseHeader(HttpServletResponse response, String excelFileName, String suffixName) throws UnsupportedEncodingException {
+        response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+        response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(excelFileName + suffixName, UTF_8));
+    }
+
+}

+ 152 - 41
src/main/java/cn/ezhizao/project/business/deduct/controller/BizDeductController.java

@@ -1,18 +1,16 @@
 package cn.ezhizao.project.business.deduct.controller;
 
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletResponse;
-
-import cn.ezhizao.common.utils.DateUtils;
+import cn.ezhizao.common.utils.poi.ExcelMultipleSheetsUtil;
+import cn.ezhizao.common.utils.poi.ExcelUtil;
+import cn.ezhizao.framework.aspectj.lang.annotation.Log;
+import cn.ezhizao.framework.aspectj.lang.enums.BusinessType;
+import cn.ezhizao.framework.web.controller.BaseController;
+import cn.ezhizao.framework.web.domain.AjaxResult;
+import cn.ezhizao.framework.web.page.TableDataInfo;
 import cn.ezhizao.project.business.company.domain.BizCompany;
 import cn.ezhizao.project.business.company.service.IBizCompanyService;
+import cn.ezhizao.project.business.deduct.domain.BizDeduct;
+import cn.ezhizao.project.business.deduct.service.IBizDeductService;
 import cn.ezhizao.project.business.deposit.domain.BizDeposit;
 import cn.ezhizao.project.business.deposit.service.IBizDepositService;
 import cn.ezhizao.project.business.entrust.domain.BizEntrust;
@@ -27,9 +25,7 @@ import cn.ezhizao.project.business.keepAccounts.domain.BizFinancialKeepAccountDe
 import cn.ezhizao.project.business.keepAccounts.service.IBizFinancialKeepAccountDetailService;
 import cn.ezhizao.project.business.socialSecurity.domain.BizSocialSecurityConfirmDetail;
 import cn.ezhizao.project.business.socialSecurity.service.IBizSocialSecurityConfirmDetailService;
-import cn.ezhizao.project.business.statementAccount.domain.BizStatementAccount;
-import cn.ezhizao.project.business.statementAccount.domain.BizStatementAccountLoop;
-import cn.ezhizao.project.business.statementAccount.domain.BizStatementAccountOnce;
+import cn.ezhizao.project.business.statementAccount.domain.*;
 import cn.ezhizao.project.business.statementAccount.service.IBizStatementAccountLoopService;
 import cn.ezhizao.project.business.statementAccount.service.IBizStatementAccountOnceService;
 import cn.ezhizao.project.business.statementAccount.service.IBizStatementAccountService;
@@ -45,22 +41,15 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import cn.ezhizao.framework.aspectj.lang.annotation.Log;
-import cn.ezhizao.framework.aspectj.lang.enums.BusinessType;
-import cn.ezhizao.project.business.deduct.domain.BizDeduct;
-import cn.ezhizao.project.business.deduct.service.IBizDeductService;
-import cn.ezhizao.framework.web.controller.BaseController;
-import cn.ezhizao.framework.web.domain.AjaxResult;
-import cn.ezhizao.common.utils.poi.ExcelUtil;
-import cn.ezhizao.framework.web.page.TableDataInfo;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 扣款记录Controller
@@ -132,8 +121,8 @@ public class BizDeductController extends BaseController {
         startOrderBy();
         List<BizDeduct> list = bizDeductService.getList(bizDeduct);
         list.forEach(item -> {
-            item.setContactMsg(item.getYear()+"年"+item.getMonth()+"月");
-            switch (item.getStatus()){
+            item.setContactMsg(item.getYear() + "年" + item.getMonth() + "月");
+            switch (item.getStatus()) {
                 case 0:
                     item.setStatusName("已提交");
                     break;
@@ -164,7 +153,7 @@ public class BizDeductController extends BaseController {
         BizDeduct deduct = bizDeductService.getList(conditions).stream().findFirst().orElse(null);
         if (deduct != null) {
             BizEntrustOrder order = bizEntrustOrderService.getById(deduct.getEntrustOrderId());
-            if(order==null){
+            if (order == null) {
                 return error("未查到该委托单号,请检查是否存在,或联系管理员。");
             }
             deduct.setEntrustOrderStatus(order.getStatus());
@@ -195,7 +184,8 @@ public class BizDeductController extends BaseController {
         BizDeduct bizDeduct = this.abstractVoid(conditions);
         return success(bizDeduct);
     }
-    BizDeduct abstractVoid ( BizDeduct conditions){
+
+    BizDeduct abstractVoid(BizDeduct conditions) {
         BizDeduct bizDeduct = new BizDeduct();
         bizDeduct.setEntrustOrderId(conditions.getEntrustOrderId());
         bizDeduct.setMonth(DateTime.of(conditions.getStartMonth()).toString("MM"));
@@ -208,7 +198,7 @@ public class BizDeductController extends BaseController {
         entrustCondition.setId(conditions.getEntrustOrderId());
         BizEntrustOrder bizEntrustOrder = bizEntrustOrderService.getList(entrustCondition).stream().findFirst().orElse(null);
         if (bizEntrustOrder == null) {
-             new RuntimeException("委托单不存在");
+            new RuntimeException("委托单不存在");
         }
         // 结算订单号
         bizDeduct.setFormNo(bizEntrustOrder.getFormNo());
@@ -237,8 +227,25 @@ public class BizDeductController extends BaseController {
         List<BizEntrust> loopEntrust = entrustService.getList(entrustLoopCondition);
         List<BizStatementAccountLoop> loops = new ArrayList<>();
         BizFinancialKeepAccountDetail keepAccountCondition = new BizFinancialKeepAccountDetail();
-        keepAccountCondition.setStartMonth(DateTime.of(conditions.getStartMonth()).toSqlDate());
-        keepAccountCondition.setEndMonth(DateTime.of(conditions.getEndMonth()).toSqlDate());
+        Date startMonth = conditions.getStartMonth();
+        Date endMonth = conditions.getEndMonth();
+        // 创建一个 Calendar 对象,并设置为 startMonth 的时间
+        Calendar calendar = Calendar.getInstance();
+        Calendar calendar2 = Calendar.getInstance();
+        calendar.setTime(startMonth);
+        calendar2.setTime(endMonth);
+        // 将 Calendar 对象的月份减 1
+        calendar.add(Calendar.MONTH, -1);
+        calendar2.add(Calendar.MONTH, -1);
+        // 得到修改后的日期
+        Date oneMonthAgo = calendar.getTime();
+        Date oneMonthAgo2 = calendar2.getTime();
+        // 如果需要将 oneMonthAgo 转换成 java.sql.Date,可以这样做:
+        java.sql.Date sqlDate = new java.sql.Date(oneMonthAgo.getTime());
+        java.sql.Date sqlDate2 = new java.sql.Date(oneMonthAgo2.getTime());
+
+        keepAccountCondition.setStartMonth(sqlDate);
+        keepAccountCondition.setEndMonth(sqlDate2);
         List<BizFinancialKeepAccountDetail> keepAccountDetails = keepAccountDetailService.getList(keepAccountCondition);
         BizHousingFundConfirmDetail housingFundCondition = new BizHousingFundConfirmDetail();
         housingFundCondition.setStartMonth(DateTime.of(conditions.getStartMonth()).toSqlDate());
@@ -337,9 +344,9 @@ public class BizDeductController extends BaseController {
         Map<Long, List<BizCompany>> company = companyService.list(new LambdaQueryWrapper<BizCompany>().eq(BizCompany::getIsZero, 1)).stream().collect(Collectors.groupingBy(BizCompany::getId));
         for (BizStatementAccountLoop bizStatementAccountLoop : loops) {
             List<BizCompany> bizCompanyList = company.get(bizStatementAccountLoop.getCompanyId());
-            if (!CollectionUtils.isEmpty(bizCompanyList)){
+            if (!CollectionUtils.isEmpty(bizCompanyList)) {
                 bizStatementAccountLoop.setIsZero(bizCompanyList.get(0).getIsZero());
-            }else {
+            } else {
                 bizStatementAccountLoop.setIsZero(0);
             }
         }
@@ -357,6 +364,7 @@ public class BizDeductController extends BaseController {
         bizDeduct.setRemainAmount(bizDeduct.getPrevRemainAmount().subtract(deduct));
         return bizDeduct;
     }
+
     private List<BizStatementAccount> getStatementAccount(List<BizStatementAccountOnce> onceList, List<BizStatementAccountLoop> loops, BizDeduct bizDeduct) {
         List<BizStatementAccount> accounts = new ArrayList<>();
         BizEntrustPrice priceCondition = new BizEntrustPrice();
@@ -692,7 +700,7 @@ public class BizDeductController extends BaseController {
         BigDecimal amount = bizDeduct.getAmount();
         int index = 0;
         while (amount.compareTo(BigDecimal.ZERO) > 0) {
-            if(deposits.isEmpty()){
+            if (deposits.isEmpty()) {
                 return error("扣款失败,余额不足。");
             }
             BigDecimal money = new BigDecimal(0);
@@ -700,7 +708,7 @@ public class BizDeductController extends BaseController {
             for (BizDeposit d : deposits) {
                 money = money.add(d.getRemainAmount());
             }
-            if(money.compareTo(amount)<0){
+            if (money.compareTo(amount) < 0) {
                 return error("扣款失败,余额不足。");
             }
 
@@ -742,4 +750,107 @@ public class BizDeductController extends BaseController {
         boolean status = bizDeductService.updateById(bizDeduct);
         return toAjax(status);
     }
+
+
+    @Log(title = "合同导出", businessType = BusinessType.EXPORT)
+    @PostMapping("/exportAccountStatement")
+    public void exportAccountStatement(HttpServletResponse response, BizDeduct bizDeduct) throws Exception {
+        BizDeduct bizDeduct1 = this.abstractVoid(bizDeduct);
+        Map<String, Object> result = new LinkedHashMap <>();
+        List<BizStatementAccount> collect = bizDeduct1.getCollect();
+        List<BizStatementAccountLoop> loopList = bizDeduct1.getLoopList();
+        List<BizStatementAccountOnce> onceList = bizDeduct1.getOnceList();
+        List<BizStatementAccountExport> list1 = new ArrayList();
+        List<BizStatementAccountLoopExport> list2 = new ArrayList();
+        List<BizStatementAccountOnceExport> list3 = new ArrayList();
+        if (!collect.isEmpty()) {
+            for (BizStatementAccount bizStatementAccount : collect) {
+                BizStatementAccountExport bizStatementAccountExport = new BizStatementAccountExport();
+                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
+                Date startMonth = bizDeduct.getStartMonth();
+                Date endMonth = bizDeduct.getEndMonth();
+                String yearMonthS = dateFormat.format(startMonth);
+                String yearMonthE = dateFormat.format(endMonth);
+                bizStatementAccountExport.setYearMonth(yearMonthS + "~" + yearMonthE);
+                if (bizStatementAccount.getTaskType().equals("代理记账")) {
+                    bizStatementAccountExport.setTaskType(bizStatementAccount.getTaskType());
+                    bizStatementAccountExport.setTaskTypeDetail(bizStatementAccount.getAnnualIncome());
+                } else if (bizStatementAccount.getTaskType().equals("社保代缴") ||
+                        bizStatementAccount.getTaskType().equals("公积金代缴")) {
+                    if (bizStatementAccount.getHaveChanged() == 1) {
+                        bizStatementAccountExport.setTaskType(bizStatementAccount.getTaskType() + "有变化");
+                        bizStatementAccountExport.setTaskTypeDetail("有变化");
+                    } else {
+                        bizStatementAccountExport.setTaskType(bizStatementAccount.getTaskType());
+                        bizStatementAccountExport.setTaskTypeDetail("无变化");
+                    }
+                } else {
+                    bizStatementAccountExport.setTaskType(bizStatementAccount.getTaskType());
+                }
+                bizStatementAccountExport.setCompanyNum(bizStatementAccount.getCompanyNum());
+                bizStatementAccountExport.setPrice(bizStatementAccount.getPrice());
+                bizStatementAccountExport.setAmount(bizStatementAccount.getAmount());
+                bizStatementAccountExport.setDiscountPrice(bizStatementAccount.getDiscountPrice());
+                bizStatementAccountExport.setDiscountAmount(bizStatementAccount.getDiscountAmount());
+                bizStatementAccountExport.setFreeAmount(bizStatementAccount.getFreeAmount());
+                bizStatementAccountExport.setActuallyAmount(bizStatementAccount.getActuallyAmount());
+                bizStatementAccountExport.setDescription(bizDeduct1.getDescription());
+                list1.add(bizStatementAccountExport);
+            }
+        }
+        if (!loopList.isEmpty()) {
+            for (BizStatementAccountLoop bizStatementAccountLoop : loopList) {
+                BizStatementAccountLoopExport bizStatementAccountLoopExport = new BizStatementAccountLoopExport();
+                bizStatementAccountLoopExport.setWorkMonth(bizStatementAccountLoop.getWorkMonth());
+                bizStatementAccountLoopExport.setCompanyName(bizStatementAccountLoop.getCompanyName());
+                bizStatementAccountLoopExport.setSocialCreditCode(bizStatementAccountLoop.getSocialCreditCode());
+                bizStatementAccountLoopExport.setAddress(bizStatementAccountLoop.getProvince() + bizStatementAccountLoop.getCity() + bizStatementAccountLoop.getDistrict());
+                bizStatementAccountLoopExport.setAnnualIncome(bizStatementAccountLoop.getAnnualIncome());
+                bizStatementAccountLoopExport.setIsTax(bizStatementAccountLoop.getIsTax() == 1 ? "是" : "否");
+                bizStatementAccountLoopExport.setIsSocialSecurity(bizStatementAccountLoop.getIsSocialSecurity() == 1 ? "是" : "否");
+                bizStatementAccountLoopExport.setIsHousingFund(bizStatementAccountLoop.getIsHousingFund() == 1 ? "是" : "否");
+                bizStatementAccountLoopExport.setTaxType(bizStatementAccountLoop.getTaxType());
+                bizStatementAccountLoopExport.setCollectionMethod(bizStatementAccountLoop.getCollectionMethod());
+                bizStatementAccountLoopExport.setIsZero(bizStatementAccountLoop.getIsZero() == 1 ? "是" : "否");
+                bizStatementAccountLoopExport.setActuallyAnnualIncome(bizStatementAccountLoop.getActuallyAnnualIncome());
+                bizStatementAccountLoopExport.setChangedSocialSecurity(bizStatementAccountLoop.getChangedSocialSecurity() == 1 ? "是" : "否");
+                bizStatementAccountLoopExport.setChangedHousingFund(bizStatementAccountLoop.getChangedHousingFund() == 1 ? "是" : "否");
+                bizStatementAccountLoopExport.setCumulativeIncome(bizStatementAccountLoop.getCumulativeIncome());
+                list2.add(bizStatementAccountLoopExport);
+            }
+        }
+
+        if (!onceList.isEmpty()) {
+            for (BizStatementAccountOnce bizStatementAccountOnce : onceList) {
+                BizStatementAccountOnceExport bizStatementAccountOnceExport = new BizStatementAccountOnceExport();
+                bizStatementAccountOnceExport.setCompanyName(bizStatementAccountOnce.getCompanyName());
+                bizStatementAccountOnceExport.setAddress(bizStatementAccountOnce.getProvince() + bizStatementAccountOnce.getCity() + bizStatementAccountOnce.getDistrict());
+                bizStatementAccountOnceExport.setTask(bizStatementAccountOnce.getTaskTypeName() + bizStatementAccountOnce.getTaskTypeDetailName());
+                bizStatementAccountOnceExport.setEntrustDate(bizStatementAccountOnce.getEntrustDate());
+                bizStatementAccountOnceExport.setFinishedDate(bizStatementAccountOnce.getFinishedDate());
+                bizStatementAccountOnceExport.setAmount(bizStatementAccountOnce.getAmount());
+                bizStatementAccountOnceExport.setDescription(bizStatementAccountOnce.getDescription());
+                list3.add(bizStatementAccountOnceExport);
+            }
+        }else{
+            BizStatementAccountOnceExport bizStatementAccountOnceExport = new BizStatementAccountOnceExport();
+            bizStatementAccountOnceExport.setCompanyName(null);
+            bizStatementAccountOnceExport.setAddress(null);
+            bizStatementAccountOnceExport.setTask(null);
+            bizStatementAccountOnceExport.setEntrustDate(null);
+            bizStatementAccountOnceExport.setFinishedDate(null);
+            bizStatementAccountOnceExport.setAmount(null);
+            bizStatementAccountOnceExport.setDescription(null);
+            list3.add(bizStatementAccountOnceExport);
+        }
+
+
+        result.put("汇总", list1);
+        result.put("循环任务", list2);
+        result.put("工商任务", list3);
+        String contactCompany = "(" + bizDeduct1.getContactCompany() + "-" + bizDeduct1.getFormNo() + ")";
+
+        ExcelMultipleSheetsUtil.excelMultipleSheets(result, "对账单导出" + contactCompany, ".xlsx", response);
+    }
+
 }

+ 57 - 0
src/main/java/cn/ezhizao/project/business/statementAccount/domain/BizStatementAccountExport.java

@@ -0,0 +1,57 @@
+package cn.ezhizao.project.business.statementAccount.domain;
+
+import cn.ezhizao.framework.aspectj.lang.annotation.Excel;
+import cn.ezhizao.framework.web.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 对账单对象 biz_statement_account
+ *
+ * @author ruoyi
+ * @date 2023-12-05
+ */
+@Data
+public class BizStatementAccountExport
+{
+
+    @Excel(name = "自然月",needMerge = true)
+    private String yearMonth;
+    @Excel(name = "服务")
+    private String taskType;
+    @Excel(name = "项目分类")
+    private String taskTypeDetail;
+
+    @Excel(name = "客户数量(单位:户)")
+    private Integer companyNum;
+    @Excel(name = "单价(单位:元)")
+    private BigDecimal price;
+    @Excel(name = "总价")
+    private BigDecimal amount;
+    /** 优惠后单价 */
+    @Excel(name = "优惠后单价")
+    @ApiModelProperty(value = "优惠后单价")
+    private BigDecimal discountPrice;
+
+    /** 减免总额  (单价-优惠后单价) * 户数 */
+    @Excel(name = "优惠后金额")
+    @ApiModelProperty(value = "优惠后金额")
+    private BigDecimal discountAmount;
+
+    /** 减免总额  (单价-优惠后单价) * 户数 */
+    @Excel(name = "减免金额")
+    @ApiModelProperty(value = "减免金额")
+    private BigDecimal freeAmount;
+
+    /** 实际金额 */
+    @Excel(name = "实际金额")
+    @ApiModelProperty(value = "实际金额")
+    private BigDecimal actuallyAmount;
+
+
+    @Excel(name = "说明")
+    private String description;
+}

+ 69 - 0
src/main/java/cn/ezhizao/project/business/statementAccount/domain/BizStatementAccountLoopExport.java

@@ -0,0 +1,69 @@
+package cn.ezhizao.project.business.statementAccount.domain;
+
+import cn.ezhizao.framework.aspectj.lang.annotation.Excel;
+import cn.ezhizao.framework.web.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.sql.Date;
+
+/**
+ * 对账单明细 循环对象 biz_statement_account_loop
+ *
+ * @author ruoyi
+ * @date 2023-12-05
+ */
+@Data
+public class BizStatementAccountLoopExport {
+
+
+    @Excel(name = "工作月", dateFormat = "yyyy-MM")
+    private Date workMonth;
+
+    @Excel(name = "客户名称")
+    private String companyName;
+
+    @Excel(name = "税号")
+    private String socialCreditCode;
+
+    @Excel(name = "注册地址")
+    private String address;
+
+    @Excel(name = "年收入")
+    private String annualIncome;
+
+    @Excel(name = "报税申报")
+    private String isTax;
+
+    @Excel(name = "社保")
+    private String isSocialSecurity;
+
+    @Excel(name = "公积金")
+    private String isHousingFund;
+
+    @Excel(name = "纳税性质")
+    private String taxType;
+
+    @Excel(name = "征收方式")
+    private String collectionMethod;
+
+    @Excel(name = "是否零申报")
+    private String isZero;
+
+    @Excel(name = "实际年收入")
+    private String actuallyAnnualIncome;
+
+    @Excel(name = "社保有无变化")
+    private String changedSocialSecurity;
+
+    @Excel(name = "公积金有无变化")
+    private String changedHousingFund;
+
+    @Excel(name = "累计年收入")
+    private BigDecimal cumulativeIncome;
+
+
+}

+ 46 - 0
src/main/java/cn/ezhizao/project/business/statementAccount/domain/BizStatementAccountOnceExport.java

@@ -0,0 +1,46 @@
+package cn.ezhizao.project.business.statementAccount.domain;
+
+import cn.ezhizao.framework.aspectj.lang.annotation.Excel;
+import cn.ezhizao.framework.web.domain.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 对账单明细 单次对象 biz_statement_account_once
+ *
+ * @author ruoyi
+ * @date 2023-12-05
+ */
+@Data
+public class BizStatementAccountOnceExport
+{
+
+
+
+    @Excel(name = "客户名称")
+    private String companyName;
+
+    @Excel(name = "所在区")
+    private String address;
+
+    @Excel(name = "办理事项")
+    private String task;
+
+    @Excel(name = "下单时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date entrustDate;
+
+    @Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date finishedDate;
+
+    @Excel(name = "收费")
+    private BigDecimal amount;
+
+    @Excel(name = "说明")
+    private String description;
+}