Commit 1b48077b authored by haoxuyang's avatar haoxuyang

维修记录导出新增车牌号的问题 ,列表查询修改

parent 0eaf74af
...@@ -57,7 +57,7 @@ public class ErpRepairFormController extends BaseController { ...@@ -57,7 +57,7 @@ public class ErpRepairFormController extends BaseController {
@Log(title = "报修单", businessType = BusinessType.EXPORT) @Log(title = "报修单", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(ErpRepairFormBo bo, HttpServletResponse response) { public void export(ErpRepairFormBo bo, HttpServletResponse response) {
List<ErpRepairFormVo> list = iErpRepairFormService.queryList(bo); List<ErpRepairFormVo> list = iErpRepairFormService.queryExportList(bo);
ExcelUtil.exportExcel(list, "报修单", ErpRepairFormVo.class, response); ExcelUtil.exportExcel(list, "报修单", ErpRepairFormVo.class, response);
} }
......
...@@ -295,5 +295,9 @@ public class ErpRepairFormBo extends BaseEntity { ...@@ -295,5 +295,9 @@ public class ErpRepairFormBo extends BaseEntity {
*/ */
private Date settlementTime; private Date settlementTime;
/**
* 导出选中IDs
*/
private List<Long> ids;
} }
...@@ -56,6 +56,12 @@ public class ErpRepairFormVo implements Serializable { ...@@ -56,6 +56,12 @@ public class ErpRepairFormVo implements Serializable {
@ExcelProperty(value = "报修单号") @ExcelProperty(value = "报修单号")
private String repairNumber; private String repairNumber;
/**
* 车牌号
*/
@ExcelProperty(value = "车牌号")
private String plateNumber;
/** /**
* 报修单类型(1修理 2维护 3修理与维护) * 报修单类型(1修理 2维护 3修理与维护)
*/ */
......
...@@ -53,6 +53,11 @@ public interface IErpRepairFormService { ...@@ -53,6 +53,11 @@ public interface IErpRepairFormService {
List<ErpRepairFormVo> queryList(ErpRepairFormBo bo); List<ErpRepairFormVo> queryList(ErpRepairFormBo bo);
List<ErpRepairFormVo> queryListByIds(List<Long> ids); List<ErpRepairFormVo> queryListByIds(List<Long> ids);
/**
* 导出报修单列表(有选中则按ids导出,否则与原导出一致;补充车辆表车牌号)
*/
List<ErpRepairFormVo> queryExportList(ErpRepairFormBo bo);
/** /**
* 新增报修单 * 新增报修单
*/ */
......
...@@ -31,6 +31,8 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -31,6 +31,8 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -175,6 +177,28 @@ public class ErpRepairFormServiceImpl implements IErpRepairFormService { ...@@ -175,6 +177,28 @@ public class ErpRepairFormServiceImpl implements IErpRepairFormService {
return baseMapper.selectVoList(lqw); return baseMapper.selectVoList(lqw);
} }
/**
* 导出报修单列表(有选中则按ids导出,否则与原导出一致;补充车辆表车牌号)
*/
@Override
public List<ErpRepairFormVo> queryExportList(ErpRepairFormBo bo) {
List<ErpRepairFormVo> list = (bo.getIds() != null && !bo.getIds().isEmpty())
? this.queryListByIds(bo.getIds())
: this.queryList(bo);
Set<Long> carIds = list.stream()
.map(ErpRepairFormVo::getCarId)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
if (carIds.isEmpty()) {
return list;
}
Map<Long, String> plateNumberMap = carMapper.selectBatchIds(carIds).stream()
.filter(car -> car.getPlateNumber() != null)
.collect(Collectors.toMap(ErpCar::getId, ErpCar::getPlateNumber, (a, b) -> a));
list.forEach(item -> item.setPlateNumber(plateNumberMap.get(item.getCarId())));
return list;
}
@Override @Override
public List<ErpRepairFormVo> queryListByIds(List<Long> ids) { public List<ErpRepairFormVo> queryListByIds(List<Long> ids) {
return baseMapper.selectVoBatchIds(ids); return baseMapper.selectVoBatchIds(ids);
......
...@@ -430,7 +430,8 @@ export default { ...@@ -430,7 +430,8 @@ export default {
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download('business/repairForm/export', { this.download('business/repairForm/export', {
...this.queryParams ...this.queryParams,
ids: this.ids
}, `维修记录_${new Date().getTime()}.xlsx`) }, `维修记录_${new Date().getTime()}.xlsx`)
} }
} }
......
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