feat(transport):基础数据-运营数据-车辆管理增加导出功能
新增 /vehicle/export 导出接口(GET/POST,兼容前端 download 工具), 复用列表查询条件与数据权限,不分页导出全量数据为 xlsx; 新增 VehicleExportVO 导出对象(40列,状态字段转中文)。
This commit is contained in:
+28
@@ -32,6 +32,7 @@ import com.linke.transport.interfaces.assemble.vehicle.VehicleAssembler;
|
||||
import com.mhd.common.core.constant.Constants;
|
||||
import com.mhd.common.core.domain.dto.SyncTmsVehicleDTO;
|
||||
import com.linke.transport.interfaces.dto.vehicle.VehicleDto;
|
||||
import com.linke.transport.interfaces.dto.vehicle.VehicleExportVO;
|
||||
import com.mhd.common.core.annotation.fieldsetvalue.NeedSetValueField;
|
||||
import com.mhd.common.core.annotation.fieldsetvalue.NeedSetValueMethod;
|
||||
import com.mhd.common.core.constant.NoticeConstants;
|
||||
@@ -238,6 +239,33 @@ public class VehicleApplicationService {
|
||||
return vehiclePos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建车辆管理导出数据(不分页,按列表查询条件导出)
|
||||
*
|
||||
* @param vehiclePo 查询条件
|
||||
* @param dataPermission 数据权限
|
||||
* @return 导出数据
|
||||
*/
|
||||
public List<VehicleExportVO> buildExportList(VehiclePo vehiclePo, DataPermission dataPermission) {
|
||||
List<VehiclePo> vehiclePos = selectVehicleList(vehiclePo, dataPermission);
|
||||
List<VehicleExportVO> exportList = new ArrayList<>();
|
||||
if (CollUtil.isEmpty(vehiclePos)) {
|
||||
return exportList;
|
||||
}
|
||||
for (VehiclePo po : vehiclePos) {
|
||||
VehicleExportVO vo = new VehicleExportVO();
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
// 司机名称集合拼接为字符串(List与String类型不匹配,copyProperties不会复制,需手动设置)
|
||||
if (CollUtil.isNotEmpty(po.getDriverNames())) {
|
||||
vo.setDriverNames(String.join(",", po.getDriverNames()));
|
||||
}
|
||||
// 所属组织与归属组织一致
|
||||
vo.setBelongOrganizationName(po.getOrganizationName());
|
||||
exportList.add(vo);
|
||||
}
|
||||
return exportList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询未绑定车辆列表
|
||||
*
|
||||
|
||||
+178
@@ -0,0 +1,178 @@
|
||||
package com.linke.transport.interfaces.dto.vehicle;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 车辆管理导出对象(基础数据-运营数据-车辆管理列表,列顺序与页面列表一致)
|
||||
*
|
||||
* @author gen
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "车辆管理导出对象", description = "车辆管理导出对象")
|
||||
public class VehicleExportVO implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Excel(name = "车辆主体", readConverterExp = "1=主车,2=挂车")
|
||||
@ApiModelProperty(name = "车辆主体(1-主车,2-挂车)")
|
||||
private Integer vehicleBody;
|
||||
|
||||
@Excel(name = "车牌号码")
|
||||
@ApiModelProperty(name = "车牌号码")
|
||||
private String vehicleLicensePlateNumber;
|
||||
|
||||
@Excel(name = "跨境车牌")
|
||||
@ApiModelProperty(name = "跨境车牌")
|
||||
private String crossPlate;
|
||||
|
||||
@Excel(name = "车辆类型")
|
||||
@ApiModelProperty(name = "车辆类型")
|
||||
private String vehicleTypeName;
|
||||
|
||||
@Excel(name = "类型", readConverterExp = "0=自由车辆,1=社会车辆")
|
||||
@ApiModelProperty(name = "类型(车辆来源)")
|
||||
private Integer vehicleSource;
|
||||
|
||||
@Excel(name = "部门")
|
||||
@ApiModelProperty(name = "部门")
|
||||
private String departmentName;
|
||||
|
||||
@Excel(name = "车辆认证", readConverterExp = "0=无状态,1=未认证,2=等待审核,3=已通过,4=已驳回")
|
||||
@ApiModelProperty(name = "车辆认证状态")
|
||||
private Integer authenticationStatus;
|
||||
|
||||
@Excel(name = "司机姓名")
|
||||
@ApiModelProperty(name = "司机姓名(多个以逗号分隔)")
|
||||
private String driverNames;
|
||||
|
||||
@Excel(name = "副驾1")
|
||||
@ApiModelProperty(name = "副驾1")
|
||||
private String pilot1;
|
||||
|
||||
@Excel(name = "副驾2")
|
||||
@ApiModelProperty(name = "副驾2")
|
||||
private String pilot2;
|
||||
|
||||
@Excel(name = "车队名称")
|
||||
@ApiModelProperty(name = "车队名称")
|
||||
private String motorcadeName;
|
||||
|
||||
@Excel(name = "年检有效期", width = 20, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "年检有效期")
|
||||
private Date annualValidityPeriod;
|
||||
|
||||
@Excel(name = "保险有效期", width = 20, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "保险有效期")
|
||||
private Date insuranceValidityPeriod;
|
||||
|
||||
@Excel(name = "运载状态", readConverterExp = "0=无状态,1=空载,2=负载")
|
||||
@ApiModelProperty(name = "运载状态")
|
||||
private Integer carryStatus;
|
||||
|
||||
@Excel(name = "使用性质")
|
||||
@ApiModelProperty(name = "使用性质")
|
||||
private String vehicleUseNature;
|
||||
|
||||
@Excel(name = "总质量(kg)")
|
||||
@ApiModelProperty(name = "总质量(kg)")
|
||||
private BigDecimal vehicleTotalMass;
|
||||
|
||||
@Excel(name = "核定载质量(kg)")
|
||||
@ApiModelProperty(name = "核定载质量(kg)")
|
||||
private BigDecimal vehicleApprovedLoadQuantity;
|
||||
|
||||
@Excel(name = "车轴数")
|
||||
@ApiModelProperty(name = "车轴数")
|
||||
private String otherAxlesNumberName;
|
||||
|
||||
@Excel(name = "车长(米)")
|
||||
@ApiModelProperty(name = "车长(米)")
|
||||
private String otherCarLengthName;
|
||||
|
||||
@Excel(name = "容积(方)")
|
||||
@ApiModelProperty(name = "容积(方)")
|
||||
private String otherVehicleVolumeName;
|
||||
|
||||
@Excel(name = "车牌颜色")
|
||||
@ApiModelProperty(name = "车牌颜色")
|
||||
private String otherLicensePlateColorName;
|
||||
|
||||
@Excel(name = "行驶证有效期限", width = 20, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "行驶证有效期限")
|
||||
private Date vehicleCheckoutPeriodValidity;
|
||||
|
||||
@Excel(name = "道路运输证号")
|
||||
@ApiModelProperty(name = "道路运输证号")
|
||||
private String roadTransportCertificateNo;
|
||||
|
||||
@Excel(name = "道路运输证有效期限", width = 20, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "道路运输证有效期限")
|
||||
private Date roadTransportCertificateExpireDate;
|
||||
|
||||
@Excel(name = "道路运输证校验状态", readConverterExp = "0=无状态,1=未核验,2=核验通过,3=核验失败")
|
||||
@ApiModelProperty(name = "道路运输证校验状态")
|
||||
private Integer roadTransportCertificateCheckoutStatus;
|
||||
|
||||
@Excel(name = "经营许可证号")
|
||||
@ApiModelProperty(name = "经营许可证号")
|
||||
private String businessLicenseNumber;
|
||||
|
||||
@Excel(name = "经营许可证业户名称")
|
||||
@ApiModelProperty(name = "经营许可证业户名称")
|
||||
private String specializedHouseholdsName;
|
||||
|
||||
@Excel(name = "道路运输经营许可证有效期", width = 20, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "道路运输经营许可证有效期(截止日期)")
|
||||
private Date businessLicenseExpireEndDate;
|
||||
|
||||
@Excel(name = "经营许可证校验状态", readConverterExp = "0=无状态,1=未核验,2=核验通过,3=核验失败")
|
||||
@ApiModelProperty(name = "经营许可证校验状态")
|
||||
private Integer businessLicenseCheckoutStatus;
|
||||
|
||||
@Excel(name = "入网校验状态", readConverterExp = "0=无状态,1=未核验,2=已入网,3=未入网")
|
||||
@ApiModelProperty(name = "入网校验状态")
|
||||
private Integer netInStatus;
|
||||
|
||||
@Excel(name = "入网查询时间", width = 20, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "入网查询时间")
|
||||
private Date netInDate;
|
||||
|
||||
@Excel(name = "使用状态", readConverterExp = "0=无状态,1=正常,2=黑名单")
|
||||
@ApiModelProperty(name = "使用状态")
|
||||
private Integer useStatus;
|
||||
|
||||
@Excel(name = "归属组织")
|
||||
@ApiModelProperty(name = "归属组织")
|
||||
private String organizationName;
|
||||
|
||||
@Excel(name = "添加人员")
|
||||
@ApiModelProperty(name = "添加人员")
|
||||
private String createByName;
|
||||
|
||||
@Excel(name = "添加时间", width = 25, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(name = "添加时间")
|
||||
private Date createTime;
|
||||
|
||||
@Excel(name = "审核人员")
|
||||
@ApiModelProperty(name = "审核人员")
|
||||
private String checkoutPersonName;
|
||||
|
||||
@Excel(name = "审核时间", width = 20, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "审核时间")
|
||||
private Date checkoutDate;
|
||||
|
||||
@Excel(name = "更新时间", width = 25, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(name = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
@Excel(name = "所属组织")
|
||||
@ApiModelProperty(name = "所属组织(与归属组织一致)")
|
||||
private String belongOrganizationName;
|
||||
}
|
||||
+32
@@ -9,6 +9,7 @@ import com.linke.transport.domain.vehicle.repository.po.VehiclePo;
|
||||
import com.linke.transport.interfaces.assemble.vehicle.VehicleAssembler;
|
||||
import com.mhd.common.core.domain.dto.SyncTmsVehicleDTO;
|
||||
import com.linke.transport.interfaces.dto.vehicle.VehicleDto;
|
||||
import com.linke.transport.interfaces.dto.vehicle.VehicleExportVO;
|
||||
import com.mhd.common.core.domain.dto.StatisticalMattersDTO;
|
||||
import com.mhd.common.core.domain.entity.R;
|
||||
import com.mhd.common.core.domain.todo.StatisticalMattersDo;
|
||||
@@ -16,6 +17,7 @@ import com.mhd.common.core.exception.ServiceException;
|
||||
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
|
||||
import com.mhd.common.core.utils.IgnoreNullUtil;
|
||||
import com.mhd.common.core.utils.bean.BeanUtils;
|
||||
import com.mhd.common.core.utils.poi.ExcelUtil;
|
||||
import com.mhd.common.core.web.controller.BaseController;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.core.web.page.TableDataInfo;
|
||||
@@ -28,6 +30,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -65,6 +70,33 @@ public class VehicleApi extends BaseController
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出车辆管理列表
|
||||
*/
|
||||
@Log(title = "车辆管理-导出", description = "导出车辆管理列表", businessType = BusinessType.EXPORT)
|
||||
@ApiOperation("导出车辆管理列表")
|
||||
// 同时支持 GET(query 参数)与 POST(form 表单,兼容前端 this.download() 工具)
|
||||
@RequestMapping(value = "/export", method = {RequestMethod.GET, RequestMethod.POST}, produces = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
|
||||
public void export(VehicleDto vehicleDto, HttpServletResponse response) throws IOException
|
||||
{
|
||||
VehiclePo vehiclePo = new VehiclePo();
|
||||
//转换实体
|
||||
BeanUtils.copyProperties(vehicleDto, vehiclePo);
|
||||
//判断当前登录人数据权限
|
||||
DataPermission dataPermission = commonApplicationService.dataPermission(vehiclePo.getPermissionMenuId());
|
||||
//查询全量(不分页)
|
||||
List<VehicleExportVO> list = vehicleApplicationService.buildExportList(vehiclePo, dataPermission);
|
||||
|
||||
//设置下载头,防止浏览器乱码
|
||||
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<VehicleExportVO> util = new ExcelUtil<>(VehicleExportVO.class);
|
||||
util.exportExcel(response, list, "车辆管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆绑定副驾
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user