From 98b5ce81cce700ebb617117e1e00fe1c6f897195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Mon, 7 Sep 2026 14:28:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A7=94=E6=89=98=E6=96=B9=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../interfaces/facade/UserShipperAPI.java | 32 ++++++++ .../interfaces/vo/UserShipperExportVO.java | 73 +++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 mhd-user-center/src/main/java/com/mhd/user/interfaces/vo/UserShipperExportVO.java diff --git a/mhd-user-center/src/main/java/com/mhd/user/interfaces/facade/UserShipperAPI.java b/mhd-user-center/src/main/java/com/mhd/user/interfaces/facade/UserShipperAPI.java index 41ae750a4..78b243ee1 100644 --- a/mhd-user-center/src/main/java/com/mhd/user/interfaces/facade/UserShipperAPI.java +++ b/mhd-user-center/src/main/java/com/mhd/user/interfaces/facade/UserShipperAPI.java @@ -3,6 +3,7 @@ package com.mhd.user.interfaces.facade; import com.github.pagehelper.PageHelper; import com.mhd.common.core.domain.entity.R; import com.mhd.common.core.utils.bean.BeanUtils; +import com.mhd.common.core.utils.poi.ExcelUtil; import com.mhd.common.log.annotation.Log; import com.mhd.common.log.enums.BusinessType; import com.mhd.common.security.utils.SecurityUtils; @@ -24,6 +25,7 @@ import com.mhd.user.application.service.WechatMiniAppService; import com.mhd.user.interfaces.dto.updateDTO.SettlementInfoUpdateDTO; import com.mhd.user.interfaces.vo.SettlementInfoQueryVo; import com.mhd.user.interfaces.vo.ShipperMasterDataSyncTimeVo; +import com.mhd.user.interfaces.vo.UserShipperExportVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; @@ -31,6 +33,9 @@ import org.springframework.format.annotation.DateTimeFormat; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.net.URLEncoder; import java.util.*; @Api(tags = "用户中台管理-托运人管理") @@ -128,6 +133,33 @@ public class UserShipperAPI extends BaseController { return getDataTable(list); } + @Log(title = "托运人管理-导出", description ="导出托运人列表",businessType = BusinessType.EXPORT) + @ApiOperation("导出托运人列表") + @GetMapping(value = "/exportUserShipper", produces = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet") + public void exportUserShipper(UserShipperDTO userShipperDTO, HttpServletResponse response) throws IOException { + //转换实体 + UserShipperDO userShipperDO = userShipperAssember.toUserShipperDO(userShipperDTO); + //查询全量(不分页),复用列表查询逻辑(含数据权限过滤) + List list = userShipperApplicationService.userShipperList(userShipperDO); + + List exportList = new ArrayList<>(); + if (list != null) { + for (UserShipperPo po : list) { + UserShipperExportVO vo = new UserShipperExportVO(); + BeanUtils.copyProperties(po, vo); + exportList.add(vo); + } + } + + //设置下载头,防止浏览器乱码 + String fileName = URLEncoder.encode("托运人列表", "UTF-8").replaceAll("\\+", "%20"); + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setCharacterEncoding("utf-8"); + response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); + + ExcelUtil util = new ExcelUtil<>(UserShipperExportVO.class); + util.exportExcel(response, exportList, "托运人列表"); + } @ApiOperation("查询托运人列表统计表单") @GetMapping("/userShipperCount") diff --git a/mhd-user-center/src/main/java/com/mhd/user/interfaces/vo/UserShipperExportVO.java b/mhd-user-center/src/main/java/com/mhd/user/interfaces/vo/UserShipperExportVO.java new file mode 100644 index 000000000..dd5f4633a --- /dev/null +++ b/mhd-user-center/src/main/java/com/mhd/user/interfaces/vo/UserShipperExportVO.java @@ -0,0 +1,73 @@ +package com.mhd.user.interfaces.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.mhd.common.core.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 托运人(委托方)列表导出对象 + * + * @author gen + */ +@Data +@ApiModel(value = "托运人列表导出对象", description = "托运人列表导出对象") +public class UserShipperExportVO { + + @Excel(name = "登录账号", sort = 1, width = 20) + @ApiModelProperty(value = "登录账号") + private String userAccount; + + @Excel(name = "公司名称", sort = 2, width = 30) + @ApiModelProperty(value = "公司名称") + private String shipperEnterpriseName; + + @Excel(name = "联系人", sort = 3, width = 15) + @ApiModelProperty(value = "联系人") + private String emergencyContactName; + + @Excel(name = "联系电话", sort = 4, width = 18) + @ApiModelProperty(value = "联系电话") + private String emergencyContactPhone; + + @Excel(name = "地址", sort = 5, width = 30) + @ApiModelProperty(value = "企业注册地址") + private String shipperEnterpriseAddress; + + @Excel(name = "详细地址", sort = 6, width = 30) + @ApiModelProperty(value = "详细地址") + private String userAreaAddressShipper; + + @Excel(name = "备注", sort = 7, width = 25) + @ApiModelProperty(value = "备注") + private String remark; + + @Excel(name = "结算币种", sort = 8, width = 12) + @ApiModelProperty(value = "结算币种") + private String settlementCurrency; + + @Excel(name = "信用额度", sort = 9, width = 15) + @ApiModelProperty(value = "信用额度(授权额度)") + private BigDecimal authorizedQuota; + + @Excel(name = "信用占用", sort = 10, width = 15) + @ApiModelProperty(value = "信用占用") + private BigDecimal authorizedUsedAmount; + + @Excel(name = "信用余额", sort = 11, width = 15) + @ApiModelProperty(value = "信用余额") + private BigDecimal creditAmount; + + @Excel(name = "客户协议", sort = 12, width = 12) + @ApiModelProperty(value = "客户协议数量") + private BigDecimal agreementCount; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Excel(name = "最近同步信用时间", sort = 13, width = 22, dateFormat = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "最近同步信用时间") + private Date limitTime; +}