Commit 6be9e8ac authored by hongguangwu's avatar hongguangwu

1.7.20-瓜子新需求

parent 40c180cd
/*
* 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.write.style.ColumnWidth;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
/**
* 瓜子特殊字典导出Vo
*
* @author hgw
* @date 2026-02-05 14:16:10
*/
@Data
@ColumnWidth(25)
public class TGzAreaExportVo {
/**
* 皖信地址编码
*/
@ExcelAttribute(name = "皖信地址编码", isNotEmpty = true, errorInfo = "皖信地址编码不能为空", maxLength = 11)
@NotBlank(message = "皖信地址编码不能为空")
@Length(max = 11, message = "皖信地址编码不能超过11个字符")
@ExcelProperty("皖信地址编码")
@Schema(description = "皖信地址编码")
private String areaCode;
/**
* 皖信地址
*/
@ExcelAttribute(name = "皖信地址", maxLength = 50)
@Length(max = 50, message = "皖信地址不能超过50个字符")
@ExcelProperty("皖信地址")
@Schema(description = "皖信地址")
private String areaName;
/**
* 瓜子地址编码
*/
@ExcelAttribute(name = "瓜子地址编码", isNotEmpty = true, errorInfo = "瓜子地址编码不能为空", maxLength = 11)
@NotBlank(message = "瓜子地址编码不能为空")
@Length(max = 11, message = "瓜子地址编码不能超过11个字符")
@ExcelProperty("瓜子地址编码")
@Schema(description = "瓜子地址编码")
private String gzCode;
/**
* 瓜子城市名称
*/
@ExcelAttribute(name = "瓜子城市名称", maxLength = 50)
@Length(max = 50, message = "瓜子城市名称不能超过50个字符")
@ExcelProperty("瓜子城市名称")
@Schema(description = "瓜子城市名称")
private String gzName;
}
...@@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TGzArea; import com.yifu.cloud.plus.v1.yifu.archives.entity.TGzArea;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TGzAreaExportVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TGzAreaSearchVo; import com.yifu.cloud.plus.v1.yifu.archives.vo.TGzAreaSearchVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -48,6 +49,6 @@ public interface TGzAreaMapper extends BaseMapper<TGzArea> { ...@@ -48,6 +49,6 @@ public interface TGzAreaMapper extends BaseMapper<TGzArea> {
long getTGzAreaCountByCode(@Param("areaCode") String areaCode, @Param("id") String id); long getTGzAreaCountByCode(@Param("areaCode") String areaCode, @Param("id") String id);
List<TGzArea> getTGzAreaExport(@Param("tGzArea") TGzAreaSearchVo tGzArea); List<TGzAreaExportVo> getTGzAreaExport(@Param("tGzArea") TGzAreaSearchVo tGzArea);
} }
...@@ -16,25 +16,20 @@ ...@@ -16,25 +16,20 @@
*/ */
package com.yifu.cloud.plus.v1.yifu.archives.service.impl; package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import cn.hutool.core.util.ArrayUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.EasyExcelFactory; import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TGzArea; import com.yifu.cloud.plus.v1.yifu.archives.entity.TGzArea;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TGzAreaMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TGzAreaMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TGzAreaService; import com.yifu.cloud.plus.v1.yifu.archives.service.TGzAreaService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TGzAreaExportVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TGzAreaSearchVo; import com.yifu.cloud.plus.v1.yifu.archives.vo.TGzAreaSearchVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; 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.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil; import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ExcelUtil;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -91,13 +86,14 @@ public class TGzAreaServiceImpl extends ServiceImpl<TGzAreaMapper, TGzArea> impl ...@@ -91,13 +86,14 @@ public class TGzAreaServiceImpl extends ServiceImpl<TGzAreaMapper, TGzArea> impl
/** /**
* 瓜子地址映射表批量导出 * 瓜子地址映射表批量导出
*
* @return * @return
*/ */
@Override @Override
public void listExport(HttpServletResponse response, TGzAreaSearchVo searchVo) { public void listExport(HttpServletResponse response, TGzAreaSearchVo searchVo) {
String fileName = "瓜子地址映射表批量导出" + DateUtil.getThisTime() + ".xlsx"; String fileName = "瓜子地址映射表批量导出" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表 //获取要导出的列表
List<TGzArea> list = new ArrayList<>(); List<TGzAreaExportVo> list = new ArrayList<>();
long count = baseMapper.getTGzAreaExportCount(searchVo); long count = baseMapper.getTGzAreaExportCount(searchVo);
ServletOutputStream out = null; ServletOutputStream out = null;
try { try {
...@@ -105,7 +101,7 @@ public class TGzAreaServiceImpl extends ServiceImpl<TGzAreaMapper, TGzArea> impl ...@@ -105,7 +101,7 @@ public class TGzAreaServiceImpl extends ServiceImpl<TGzAreaMapper, TGzArea> impl
response.setContentType(CommonConstants.MULTIPART_FORM_DATA); response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, CommonConstants.UTF8)); response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, CommonConstants.UTF8));
ExcelWriter excelWriter = EasyExcelFactory.write(out, TGzArea.class).build(); ExcelWriter excelWriter = EasyExcelFactory.write(out, TGzAreaExportVo.class).build();
int index = 0; int index = 0;
if (count > CommonConstants.ZERO_INT) { if (count > CommonConstants.ZERO_INT) {
WriteSheet writeSheet; WriteSheet writeSheet;
......
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
</select> </select>
<!-- 导出 --> <!-- 导出 -->
<select id="getTGzAreaExport" resultMap="tGzAreaMap"> <select id="getTGzAreaExport" resultType="com.yifu.cloud.plus.v1.yifu.archives.vo.TGzAreaExportVo">
SELECT SELECT
a.AREA_CODE, a.AREA_CODE,
a.AREA_NAME, a.AREA_NAME,
......
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