委托方导出功能

This commit is contained in:
秦鸿展
2026-09-07 14:28:29 +08:00
parent b6a69411f1
commit 98b5ce81cc
2 changed files with 105 additions and 0 deletions
@@ -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<UserShipperPo> list = userShipperApplicationService.userShipperList(userShipperDO);
List<UserShipperExportVO> 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<UserShipperExportVO> util = new ExcelUtil<>(UserShipperExportVO.class);
util.exportExcel(response, exportList, "托运人列表");
}
@ApiOperation("查询托运人列表统计表单")
@GetMapping("/userShipperCount")
@@ -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;
}