Browse Source

fix:修改司机导出 内容呈现

dist.1.3.0
pref_mail@163.com 6 months ago
parent
commit
b996baff2a
  1. 9
      blade-biz-common/src/main/java/org/springblade/common/constant/driver/DriverApprovedDrivingModelConstant.java
  2. 9
      blade-biz-common/src/main/java/org/springblade/common/constant/driver/DriverBankTypeConverter.java
  3. 9
      blade-biz-common/src/main/java/org/springblade/common/constant/driver/DriverPositionTypeConstant.java
  4. 13
      blade-biz-common/src/main/java/org/springblade/common/constant/driver/DriverTypeStatusConstant.java
  5. 5
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataDriverArteryController.java
  6. 2
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/dto/BasicdataDriverArteryDTO.java
  7. 2
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdataDriverArteryExcel.java
  8. 187
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdataExportDriverArteryExcel.java
  9. 7
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataDriverArteryMapper.xml
  10. 3
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataDriverArteryService.java
  11. 76
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataDriverArteryServiceImpl.java

9
blade-biz-common/src/main/java/org/springblade/common/constant/driver/DriverApprovedDrivingModelConstant.java

@ -40,4 +40,13 @@ public enum DriverApprovedDrivingModelConstant {
public void setValue(String value) {
this.value = value;
}
public static String getName(String value) {
for (DriverApprovedDrivingModelConstant t : DriverApprovedDrivingModelConstant.values()) {
if (t.getValue().equals(value)) {
return t.getName();
}
}
return null;
}
}

9
blade-biz-common/src/main/java/org/springblade/common/constant/driver/DriverBankTypeConverter.java

@ -45,4 +45,13 @@ public enum DriverBankTypeConverter {
public void setValue(String value) {
this.value = value;
}
public static String getName(String value) {
for (DriverBankTypeConverter t : DriverBankTypeConverter.values()) {
if (t.getValue().equals(value)) {
return t.getName();
}
}
return null;
}
}

9
blade-biz-common/src/main/java/org/springblade/common/constant/driver/DriverPositionTypeConstant.java

@ -33,4 +33,13 @@ public enum DriverPositionTypeConstant {
this.value = value;
}
public static String getName(String value) {
for (DriverPositionTypeConstant t : DriverPositionTypeConstant.values()) {
if (t.getValue().equals(value)) {
return t.getName();
}
}
return null;
}
}

13
blade-biz-common/src/main/java/org/springblade/common/constant/driver/DriverTypeStatusConstant.java

@ -5,6 +5,8 @@ package org.springblade.common.constant.driver;
* @Create 2024/1/12 15:19
*/
import org.springblade.common.constant.WorkNodeEnums;
/**
* 司机类型的状态
*/
@ -17,6 +19,9 @@ public enum DriverTypeStatusConstant {
private String name;
private String value;
DriverTypeStatusConstant(String name, String value) {
this.name = name;
this.value = value;
@ -37,4 +42,12 @@ public enum DriverTypeStatusConstant {
public void setValue(String value) {
this.value = value;
}
public static String getName(String value) {
for (DriverTypeStatusConstant t : DriverTypeStatusConstant.values()) {
if (t.getValue().equals(value)) {
return t.getName();
}
}
return null;
}
}

5
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataDriverArteryController.java

@ -25,6 +25,7 @@ import com.logpm.basicdata.entity.BasicdataDriverWarehouseEntity;
import com.logpm.basicdata.excel.BasicdataDriverArteryExcel;
import com.logpm.basicdata.excel.BasicdataDriverArteryImporter;
import com.logpm.basicdata.excel.BasicdataDriverArteryImproterExcel;
import com.logpm.basicdata.excel.BasicdataExportDriverArteryExcel;
import com.logpm.basicdata.service.IBasicdataDriverArteryService;
import com.logpm.basicdata.service.IBasicdataDriverWarehouseService;
import com.logpm.basicdata.service.IBasicdataDrivermiddleService;
@ -244,8 +245,8 @@ public class BasicdataDriverArteryController extends BladeController {
public void exportBasicdataDriverArtery(BasicdataDriverArteryDTO basicdataDriverArtery, HttpServletResponse response) {
// QueryWrapper<BasicdataDriverArteryEntity> queryWrapper = Condition.getQueryWrapper(basicdataDriverArtery, BasicdataDriverArteryEntity.class);
// queryWrapper.lambda().eq(BasicdataDriverArteryEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
List<BasicdataDriverArteryExcel> list = basicdataDriverArteryService.exportBasicdataDriverArtery(basicdataDriverArtery);
ExcelUtil.export(response, "司机信息表数据" + DateUtil.time(), "司机信息表数据表", list, BasicdataDriverArteryExcel.class);
List<BasicdataExportDriverArteryExcel> list = basicdataDriverArteryService.exportBasicdataDriverArtery(basicdataDriverArtery);
ExcelUtil.export(response, "司机信息表数据" + DateUtil.time(), "司机信息表数据表", list, BasicdataExportDriverArteryExcel.class);
}
/**

2
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/dto/BasicdataDriverArteryDTO.java

@ -42,5 +42,7 @@ public class BasicdataDriverArteryDTO extends BasicdataDriverArteryEntity {
private List<Long> warehouseIds = new ArrayList<>();
private List<Long> ids;
}

2
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdataDriverArteryExcel.java

@ -68,7 +68,7 @@ public class BasicdataDriverArteryExcel implements Serializable {
*/
@ColumnWidth(40)
@ExcelProperty("职务类型;1-干线,2-配送")
private Integer jobType;
private String jobType;
/**
* 准驾车型;1-A1,2-A2,3-A3,4-B1,5-B2,6-C1,7-C2
*/

187
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdataExportDriverArteryExcel.java

@ -0,0 +1,187 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang 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 dreamlu.net 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: Chill 庄骞 (smallchill@163.com)
*/
package com.logpm.basicdata.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.io.Serializable;
/**
* 司机信息导出
*
* @author lmy
* @since 2023-05-15
*/
@Data
@ColumnWidth(25)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class BasicdataExportDriverArteryExcel implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 司机姓名
*/
@ColumnWidth(40)
@ExcelProperty("司机姓名")
private String name;
/**
* 司机手机号码
*/
@ColumnWidth(40)
@ExcelProperty("司机手机号码")
private String phone;
/**
* 司机类型;1-自有,2-加盟,3-外调,4-临调
*/
@ColumnWidth(40)
@ExcelProperty("司机类型")
private String type;
/**
* 职务类型;1-干线,2-配送
*/
@ColumnWidth(40)
@ExcelProperty("职务类型")
private String jobType;
/**
* 准驾车型;1-A1,2-A2,3-A3,4-B1,5-B2,6-C1,7-C2
*/
@ColumnWidth(40)
@ExcelProperty("准驾车型")
private String drivingType;
/**
* 车辆信息
*/
@ColumnWidth(40)
@ExcelProperty("车辆信息")
private String bindVehicles;
/**
* 合同开始时间
*/
@ColumnWidth(40)
@ExcelProperty("合同开始时间")
private String contractStartTime;
/**
* 合同结束时间
*/
@ColumnWidth(40)
@ExcelProperty("合同结束时间")
private String contractEndTime;
/**
* 身份证号
*/
@ColumnWidth(40)
@ExcelProperty("身份证号")
private String idCard;
/**
* 性别
*/
@ColumnWidth(40)
@ExcelProperty("性别")
private String gender;
/**
* 仓库
*/
@ColumnWidth(40)
@ExcelProperty("仓库")
private String warehouseName;
/**
* 居住地址
*/
@ColumnWidth(40)
@ExcelProperty("居住地址")
private String residentialAddress;
/**
* 银行类型;1-工商银行,2-建设银行,3-农业银行,4-邮政银行,5-中国银行,6-交通银行,7-其他
*/
@ColumnWidth(40)
@ExcelProperty("银行类型")
private String bankType;
/**
* 银行卡号
*/
@ColumnWidth(40)
@ExcelProperty("银行卡号")
private String bankCardNub;
/**
* 驾驶证号
*/
@ColumnWidth(40)
@ExcelProperty("驾驶证号")
private String driverLicenseNub;
/**
* 驾驶证发证机关
*/
@ColumnWidth(40)
@ExcelProperty("驾驶证发证机关")
private String driverLicenseOrgan;
/**
* 驾驶证起始日期
*/
@ColumnWidth(40)
@ExcelProperty("驾驶证起始日期")
private String driverLicenseStartTime;
/**
* 驾驶证到期日期
*/
@ColumnWidth(40)
@ExcelProperty("驾驶证到期日期")
private String driverLicenseEndTime;
/**
* 从业资格证编号
*/
@ColumnWidth(40)
@ExcelProperty("从业资格证编号")
private String employeeQualificationNub;
/**
* 道路经营许可证号
*/
@ColumnWidth(40)
@ExcelProperty("道路经营许可证号")
private String roadOperationLicenseNub;
/**
* 关联承运商Id
*/
@ColumnWidth(40)
@ExcelProperty("关联承运商")
private String carrierName;
/**
* 运输协议
*/
@ColumnWidth(40)
@ExcelProperty("运输协议")
private String transportationAgreement;
/**
* 备注
*/
@ColumnWidth(40)
@ExcelProperty("备注")
private String notes;
}

7
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataDriverArteryMapper.xml

@ -104,6 +104,13 @@
</if>
<if test="param.jobType != null ">and lbda.job_type like concat('%',#{param.jobType},'%')</if>
<if test="param.carrierId != null ">and lbda.carrier_id = #{param.carrierId}</if>
<if test="param.ids != null and param.ids.size() > 0">
and lbda.id in
<foreach collection="param.ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</where>
</select>

3
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataDriverArteryService.java

@ -21,6 +21,7 @@ import com.logpm.basicdata.dto.BasicdataDriverArteryDTO;
import com.logpm.basicdata.entity.BasicdataDriverArteryEntity;
import com.logpm.basicdata.excel.BasicdataDriverArteryExcel;
import com.logpm.basicdata.excel.BasicdataDriverArteryImproterExcel;
import com.logpm.basicdata.excel.BasicdataExportDriverArteryExcel;
import com.logpm.basicdata.vo.BasicdataDriverArteryVO;
import org.springblade.core.mp.base.BaseService;
@ -49,7 +50,7 @@ public interface IBasicdataDriverArteryService extends BaseService<BasicdataDriv
* @param basicdataDriverArteryDTO
* @return
*/
List<BasicdataDriverArteryExcel> exportBasicdataDriverArtery(BasicdataDriverArteryDTO basicdataDriverArteryDTO);
List<BasicdataExportDriverArteryExcel> exportBasicdataDriverArtery(BasicdataDriverArteryDTO basicdataDriverArteryDTO);
/**
* 修改
*

76
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataDriverArteryServiceImpl.java

@ -21,11 +21,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.basicdata.dto.BasicdataDriverArteryDTO;
import com.logpm.basicdata.entity.*;
import com.logpm.basicdata.excel.BasicdataDriverArteryExcel;
import com.logpm.basicdata.excel.BasicdataDriverArteryImproterExcel;
import com.logpm.basicdata.excel.BasicdataExportDriverArteryExcel;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.basicdata.mapper.BasicdataDriverArteryMapper;
import com.logpm.basicdata.mapper.BasicdataDrivermiddleMapper;
@ -34,16 +36,26 @@ import com.logpm.basicdata.service.IBasicdataCarrierService;
import com.logpm.basicdata.service.IBasicdataDriverArteryService;
import com.logpm.basicdata.service.IBasicdataDriverWarehouseService;
import com.logpm.basicdata.service.IBasicdataVehicleService;
import com.logpm.basicdata.vo.BasicdataCarrierVO;
import com.logpm.basicdata.vo.BasicdataDriverArteryVO;
import com.logpm.basicdata.vo.BasicdataDriverWarehouseVO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.DictBizConstant;
import org.springblade.common.constant.driver.DriverApprovedDrivingModelConstant;
import org.springblade.common.constant.driver.DriverBankTypeConverter;
import org.springblade.common.constant.driver.DriverPositionTypeConstant;
import org.springblade.common.constant.driver.DriverTypeStatusConstant;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.system.cache.DictBizCache;
import org.springblade.system.entity.DictBiz;
import org.springblade.system.entity.User;
import org.springblade.system.feign.IUserClient;
import org.springframework.dao.DataAccessException;
@ -94,13 +106,65 @@ public class BasicdataDriverArteryServiceImpl extends BaseServiceImpl<BasicdataD
@Override
public List<BasicdataDriverArteryExcel> exportBasicdataDriverArtery(BasicdataDriverArteryDTO basicdataDriverArteryDTO) {
List<BasicdataDriverArteryExcel> basicdataDriverArteryList = baseMapper.exportBasicdataDriverArtery(basicdataDriverArteryDTO);
//basicdataDriverArteryList.forEach(basicdataDriverArtery -> {
// basicdataDriverArtery.setTypeName(DictCache.getValue(DictEnum.YES_NO, BasicdataDriverArtery.getType()));
//});
public List<BasicdataExportDriverArteryExcel> exportBasicdataDriverArtery(BasicdataDriverArteryDTO basicdataDriverArteryDTO) {
List<BasicdataDriverArteryVO> basicdataDriverArteryVOS = baseMapper.selectBasicdataDriverArteryPage(null, basicdataDriverArteryDTO);
return basicdataDriverArteryList;
List<BasicdataExportDriverArteryExcel> data = new ArrayList<>();
// 查找承运商
List<BasicdataCarrierVO> basicdataCarrierVOS = basicdataCarrierService.selectBasicdataCarrierDictionary();
for (BasicdataDriverArteryVO basicdataDriverArteryVO : basicdataDriverArteryVOS) {
BasicdataExportDriverArteryExcel t = new BasicdataExportDriverArteryExcel();
BeanUtil.copy(basicdataDriverArteryVO, t);
List<BasicdataDriverWarehouseVO> ls = basicdataDriverWarehouseService.findByDriverId(basicdataDriverArteryVO.getId());
if(!ls.isEmpty()){
t.setWarehouseName(ls.stream().map(BasicdataDriverWarehouseVO::getWarehouseName).collect(Collectors.joining(",")));
}
// 根据获取枚举类型的值
t.setType(DriverTypeStatusConstant.getName(basicdataDriverArteryVO.getType()));
t.setGender(basicdataDriverArteryVO.getGender()==null?"未知": "0".equals(basicdataDriverArteryVO.getGender()) ? "女" : "男");
t.setDrivingType(DriverApprovedDrivingModelConstant.getName(basicdataDriverArteryVO.getDrivingType()));
if(StringUtils.isNotBlank(basicdataDriverArteryVO.getJobType())){
String [] jobTypes = basicdataDriverArteryVO.getJobType().split(",");
StringBuffer sb = new StringBuffer();
for (String jobType : jobTypes) {
if(!sb.toString().isEmpty()){
sb.append(",");
}
sb.append(DriverPositionTypeConstant.getName(jobType));
}
t.setJobType(sb.toString());
}
BasicdataCarrierVO basicdataCarrierVO =checkBasicdataCarrierVO(basicdataCarrierVOS,basicdataDriverArteryVO.getCarrierId());
t.setCarrierName(basicdataCarrierVO==null?"":basicdataCarrierVO.getCarrierName());
t.setBankType(DriverBankTypeConverter.getName(basicdataDriverArteryVO.getBankType()));
t.setContractStartTime(Objects.isNull(basicdataDriverArteryVO.getContractStartTime())?"":DateUtil.formatDate(basicdataDriverArteryVO.getContractStartTime()));
t.setContractEndTime(Objects.isNull(basicdataDriverArteryVO.getContractEndTime())?"":DateUtil.formatDate(basicdataDriverArteryVO.getContractEndTime()));
data.add(t);
}
return data;
}
private BasicdataCarrierVO checkBasicdataCarrierVO(List<BasicdataCarrierVO> basicdataCarrierVOS, Long carrierId) {
if(basicdataCarrierVOS!= null && !basicdataCarrierVOS.isEmpty()){
for (BasicdataCarrierVO basicdataCarrierVO : basicdataCarrierVOS) {
if(basicdataCarrierVO.getId().equals(carrierId)){
return basicdataCarrierVO;
}
}
}
return null;
}
@Override

Loading…
Cancel
Save