Commit 366c3aa9 authored by hongguangwu's avatar hongguangwu

1.7.24 - 公司主体导出-cursor

parent b06d0451
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 导出-法大大专业版公司信息表
*
* @author hgw
* @date 2025-10-22 17:43:17
*/
@Data
@ColumnWidth(20)
@Schema(description = "法大大专业版公司信息表导出")
public class TFascCompanyExportVo implements Serializable {
/**
* 公司主体
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("公司主体")
@Schema(description = "公司主体")
private String companyName;
/**
* app_id
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("app_id")
@Schema(description = "app_id")
private String appId;
/**
* app_secret
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("app_secret")
@Schema(description = "app_secret")
private String appSecret;
/**
* open_corp_id
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("open_corp_id")
@Schema(description = "open_corp_id")
private String openCorpId;
/**
* app_url
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("app_url")
@Schema(description = "app_url")
private String appUrl;
/**
* business_id
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("business_id")
@Schema(description = "business_id")
private String businessId;
/**
* 创建人
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("创建人")
@Schema(description = "创建人")
private String createName;
/**
* 创建时间
*/
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("创建时间")
@Schema(description = "创建时间")
private String createTime;
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TFascCompany;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 法大大专业版公司信息表查询
*
* @author hgw
* @date 2025-10-22 17:43:17
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "法大大专业版公司信息表查询")
public class TFascCompanySearchVo extends TFascCompany {
/**
* 查询数据起
*/
@Schema(description = "查询limit 开始")
private int limitStart;
/**
* 查询数据条数
*/
@Schema(description = "查询limit 数据条数")
private int limitEnd;
}
......@@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TFascCompany;
import com.yifu.cloud.plus.v1.yifu.archives.service.TFascCompanyService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TFascCompanySearchVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
......@@ -33,6 +34,7 @@ import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.util.List;
......@@ -203,4 +205,15 @@ public class TFascCompanyController {
return R.ok("已删除!");
}
}
/**
* 法大大专业版公司信息表 批量导出
* cursor-hgw
* 2026-06-10
*/
@Operation(description = "导出法大大专业版公司信息表 hasPermission('archives_tfasccompany-export')")
@PostMapping("/export")
public void export(HttpServletResponse response, @RequestBody(required = false) TFascCompanySearchVo searchVo) {
tFascCompanyService.listExport(response, searchVo);
}
}
......@@ -21,6 +21,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TFascCompany;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TFascCompanyExportVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TFascCompanySearchVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -45,4 +47,14 @@ public interface TFascCompanyMapper extends BaseMapper<TFascCompany> {
// 查重
int getTFascCompanyByNameAndId(@Param("companyName") String companyName, @Param("id") String id);
/**
* 导出列表
*/
List<TFascCompanyExportVo> listExport(@Param("tFascCompany") TFascCompanySearchVo tFascCompany);
/**
* 导出总数
*/
long listExportCount(@Param("tFascCompany") TFascCompanySearchVo tFascCompany);
}
......@@ -21,7 +21,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TFascCompany;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TFascCompanySearchVo;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
......@@ -43,4 +45,11 @@ public interface TFascCompanyService extends IService<TFascCompany> {
// 查重
int getTFascCompanyByNameAndId(String companyName, String id);
/**
* 批量导出
* cursor-hgw
* 2026-06-10
*/
void listExport(HttpServletResponse response, TFascCompanySearchVo searchVo);
}
......@@ -16,15 +16,27 @@
*/
package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TFascCompany;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TFascCompanyMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TFascCompanyService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TFascCompanyExportVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TFascCompanySearchVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -56,4 +68,63 @@ public class TFascCompanyServiceImpl extends ServiceImpl<TFascCompanyMapper, TFa
public int getTFascCompanyByNameAndId(String companyName, String id) {
return baseMapper.getTFascCompanyByNameAndId(companyName,id);
}
/**
* 法大大专业版公司信息表批量导出
* cursor-hgw
* 2026-06-10
*/
@Override
public void listExport(HttpServletResponse response, TFascCompanySearchVo searchVo) {
String fileName = "公司主体基础配置表.xlsx";
List<TFascCompanyExportVo> list = new ArrayList<>();
if (searchVo == null) {
searchVo = new TFascCompanySearchVo();
}
long count = baseMapper.listExportCount(searchVo);
ServletOutputStream out = null;
try {
out = response.getOutputStream();
response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setCharacterEncoding("utf-8");
response.setHeader(CommonConstants.CONTENT_DISPOSITION,
CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, CommonConstants.UTF8));
ExcelWriter excelWriter = EasyExcelFactory.write(out, TFascCompanyExportVo.class).build();
int index = 0;
if (count > CommonConstants.ZERO_INT) {
WriteSheet writeSheet;
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) {
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = baseMapper.listExport(searchVo);
if (Common.isNotNull(list)) {
writeSheet = EasyExcelFactory.writerSheet("公司主体基础配置表" + index).build();
excelWriter.write(list, writeSheet);
index++;
}
}
if (Common.isNotNull(list)) {
list.clear();
}
} else {
WriteSheet writeSheet = EasyExcelFactory.writerSheet("公司主体基础配置表" + index).build();
excelWriter.write(list, writeSheet);
}
if (Common.isNotNull(list)) {
list.clear();
}
out.flush();
excelWriter.finish();
} catch (Exception e) {
log.error("执行异常", e);
} finally {
try {
if (null != out) {
out.close();
}
} catch (IOException e) {
log.error("执行异常", e);
}
}
}
}
......@@ -125,4 +125,39 @@
</if>
</select>
<!--导出列表-->
<select id="listExport" resultType="com.yifu.cloud.plus.v1.yifu.archives.vo.TFascCompanyExportVo">
SELECT
a.company_name,
a.app_id,
a.app_secret,
a.open_id AS open_corp_id,
a.app_url,
a.business_id,
a.CREATE_NAME AS create_name,
date_format(a.create_time, '%Y-%m-%d %H:%i:%s') AS create_time
FROM t_fasc_company a
<where>
a.DELETE_FLAG = '0'
<include refid="tFascCompany_where"/>
</where>
order by a.CREATE_TIME asc
<if test="tFascCompany != null">
<if test="tFascCompany.limitEnd > 0">
limit #{tFascCompany.limitStart},#{tFascCompany.limitEnd}
</if>
</if>
</select>
<!--导出总数-->
<select id="listExportCount" resultType="java.lang.Long">
SELECT
count(1)
FROM t_fasc_company a
<where>
a.DELETE_FLAG = '0'
<include refid="tFascCompany_where"/>
</where>
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment