🐛 完善港口码头/铁路导入失败原因与软删除恢复,并修复运单导入列表筛选
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+26
-2
@@ -23,6 +23,7 @@
|
||||
package org.springblade.transport.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import cn.idev.excel.write.handler.SheetWriteHandler;
|
||||
import cn.idev.excel.write.metadata.holder.WriteSheetHolder;
|
||||
@@ -43,6 +44,7 @@ import org.springblade.core.secure.annotation.PreAuth;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.DateUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.system.cache.UserCache;
|
||||
import org.springblade.transport.excel.WaybillExcel;
|
||||
import org.springblade.transport.excel.WaybillImportBatchExcel;
|
||||
import org.springblade.transport.pojo.entity.ContractManage;
|
||||
@@ -50,6 +52,7 @@ import org.springblade.transport.pojo.entity.CustomerArchive;
|
||||
import org.springblade.transport.pojo.entity.ProjectApply;
|
||||
import org.springblade.transport.pojo.entity.TransportPlan;
|
||||
import org.springblade.transport.pojo.entity.Waybill;
|
||||
import org.springblade.transport.pojo.entity.WaybillImportBatch;
|
||||
import org.springblade.transport.pojo.dto.WaybillImportBatchRequest;
|
||||
import org.springblade.transport.pojo.vo.BusinessRemoveResultVO;
|
||||
import org.springblade.transport.pojo.vo.LoadingManageVO;
|
||||
@@ -77,8 +80,11 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 运单管理 控制器
|
||||
@@ -159,10 +165,22 @@ public class WaybillController extends BladeController {
|
||||
.map(contract -> option(contract.getId(), "contractName", contract.getContractName(), "projectId", contract.getProjectId()))
|
||||
.toList());
|
||||
options.put("carriers", customerArchiveService.list().stream()
|
||||
.filter(customer -> "承运商".equals(customer.getCustomerType()) && Integer.valueOf(1).equals(customer.getStatus()))
|
||||
.filter(customer -> isCarrierCustomer(customer) && Integer.valueOf(1).equals(customer.getStatus()))
|
||||
.map(customer -> option(customer.getId(), "name", customer.getFullName(), null, null))
|
||||
.toList());
|
||||
options.put("creators", new ArrayList<>());
|
||||
// 创建人选项取已有导入批次的创建人,保证筛选项与列表数据可对应。
|
||||
Set<Long> creatorIds = new LinkedHashSet<>();
|
||||
waybillImportBatchService.list(Wrappers.<WaybillImportBatch>lambdaQuery()
|
||||
.select(WaybillImportBatch::getCreateUser)
|
||||
.eq(WaybillImportBatch::getIsDeleted, 0)
|
||||
.isNotNull(WaybillImportBatch::getCreateUser))
|
||||
.stream()
|
||||
.map(WaybillImportBatch::getCreateUser)
|
||||
.filter(Objects::nonNull)
|
||||
.forEach(creatorIds::add);
|
||||
options.put("creators", creatorIds.stream()
|
||||
.map(userId -> option(userId, "name", UserCache.getUserRealName(userId), null, null))
|
||||
.toList());
|
||||
options.put("plans", transportPlanService.list().stream()
|
||||
.map(plan -> option(plan.getId(), "planName", plan.getPlanName(), "projectId", plan.getProjectId()))
|
||||
.toList());
|
||||
@@ -372,6 +390,12 @@ public class WaybillController extends BladeController {
|
||||
return option;
|
||||
}
|
||||
|
||||
/** 客商类型支持多选(逗号分隔),包含「承运商」即视为承运商。 */
|
||||
private boolean isCarrierCustomer(CustomerArchive customer) {
|
||||
String type = Func.toStr(customer.getCustomerType()).replace(",", ",");
|
||||
return Func.toStrList(type).stream().anyMatch("承运商"::equals);
|
||||
}
|
||||
|
||||
private static final class TextColumnStyleHandler implements SheetWriteHandler {
|
||||
|
||||
private final int[] columnIndexes;
|
||||
|
||||
+9
@@ -344,7 +344,16 @@ public class WaybillImportBatchServiceImpl extends BaseServiceImpl<WaybillImport
|
||||
.like(Func.isNotEmpty(request.getBatchNo()), WaybillImportBatch::getBatchNo, request.getBatchNo())
|
||||
.apply(Func.isNotEmpty(request.getCarrierId()), "FIND_IN_SET({0}, carrier_ids)", request.getCarrierId())
|
||||
.eq(Func.isNotEmpty(request.getCarrierName()), WaybillImportBatch::getCarrierName, request.getCarrierName())
|
||||
.eq(Func.isNotEmpty(request.getCreateUser()), WaybillImportBatch::getCreateUser, request.getCreateUser())
|
||||
.orderByDesc(WaybillImportBatch::getCreateTime);
|
||||
if (Func.isNotEmpty(request.getCreateTimeStart())) {
|
||||
queryWrapper.ge(WaybillImportBatch::getCreateTime,
|
||||
DateUtil.parse(request.getCreateTimeStart(), DateUtil.PATTERN_DATETIME));
|
||||
}
|
||||
if (Func.isNotEmpty(request.getCreateTimeEnd())) {
|
||||
queryWrapper.le(WaybillImportBatch::getCreateTime,
|
||||
DateUtil.parse(request.getCreateTimeEnd(), DateUtil.PATTERN_DATETIME));
|
||||
}
|
||||
IPage<WaybillImportBatch> entityPage = page(page, queryWrapper);
|
||||
List<WaybillImportBatchVO> records = entityPage.getRecords().stream().map(this::toVO).toList();
|
||||
Page<WaybillImportBatchVO> resultPage = new Page<>(entityPage.getCurrent(), entityPage.getSize(), entityPage.getTotal());
|
||||
|
||||
Reference in New Issue
Block a user