diff --git a/src/main/java/com/chint/manage/entity/excel/OrderExceedStandardExcel.java b/src/main/java/com/chint/manage/entity/excel/OrderExceedStandardExcel.java index 4e1ce18d..a2ed2d5a 100644 --- a/src/main/java/com/chint/manage/entity/excel/OrderExceedStandardExcel.java +++ b/src/main/java/com/chint/manage/entity/excel/OrderExceedStandardExcel.java @@ -1,5 +1,6 @@ package com.chint.manage.entity.excel; +import com.alibaba.excel.annotation.ExcelIgnore; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; @@ -30,5 +31,7 @@ public class OrderExceedStandardExcel extends BaseExcel{ private String approvalStatus; @ExcelProperty("超标金额") private BigDecimal standardAmount; + @ExcelIgnore + private String employeeNo; } diff --git a/src/main/java/com/chint/manage/entity/query/ItineraryPageQuery.java b/src/main/java/com/chint/manage/entity/query/ItineraryPageQuery.java index 5511003a..4d743c9d 100644 --- a/src/main/java/com/chint/manage/entity/query/ItineraryPageQuery.java +++ b/src/main/java/com/chint/manage/entity/query/ItineraryPageQuery.java @@ -2,6 +2,7 @@ package com.chint.manage.entity.query; import com.chint.domain.value_object.BaseQuery; import com.chint.infrastructure.util.PageResult; +import com.chint.manage.util.BaseUtil; import lombok.Data; import java.util.ArrayList; @@ -13,4 +14,9 @@ public class ItineraryPageQuery extends BaseQuery { private String actualOrderNo=""; //申请单号 private List userIds=new ArrayList<>(); private List routeIds; + + + public String getActualOrderNo() { + return BaseUtil.extractAfterDash(actualOrderNo); + } } diff --git a/src/main/java/com/chint/manage/entity/query/StandardQuery.java b/src/main/java/com/chint/manage/entity/query/StandardQuery.java index bac68d28..c0c64a8e 100644 --- a/src/main/java/com/chint/manage/entity/query/StandardQuery.java +++ b/src/main/java/com/chint/manage/entity/query/StandardQuery.java @@ -9,4 +9,5 @@ public class StandardQuery extends BaseQuery { private String companyName=""; // 出差公司 private String orderNo=""; //订单号 private String actualOrderNo=""; //申请单号 + private String employeeNo=""; //SF工号 } diff --git a/src/main/java/com/chint/manage/mapper/JdbcOrderExceedStandardRepository.java b/src/main/java/com/chint/manage/mapper/JdbcOrderExceedStandardRepository.java index b7cdff16..3a6a270e 100644 --- a/src/main/java/com/chint/manage/mapper/JdbcOrderExceedStandardRepository.java +++ b/src/main/java/com/chint/manage/mapper/JdbcOrderExceedStandardRepository.java @@ -18,5 +18,5 @@ public interface JdbcOrderExceedStandardRepository extends CrudRepository findAllByApplicantContainsAndCompanyNameContainsAndActualOrderNoContainsAndOrderNoContainsAndOrderNoIn(String applicant, String company, String actualOrderNo, String orderNo, List orderNos, Pageable pageable); + Page findAllByApplicantContainsAndCompanyNameContainsAndActualOrderNoContainsAndOrderNoContainsAndEmployeeNoContainsAndOrderNoIn(String applicant, String company, String actualOrderNo, String orderNo,String employeeNo, List orderNos, Pageable pageable); } diff --git a/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java b/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java index a8d67902..93d79dce 100644 --- a/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java +++ b/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java @@ -3,6 +3,7 @@ package com.chint.manage.service.impl; import com.chint.application.dtos.response.LocationRes; import com.chint.domain.aggregates.order.*; import com.chint.domain.aggregates.user.User; +import com.chint.domain.exceptions.CommandException; import com.chint.domain.repository.UserRepository; import com.chint.domain.service.LegDomainService; import com.chint.infrastructure.repository.jdbc.JdbcLocationRepository; @@ -87,7 +88,11 @@ public class ManageServiceImpl implements ManageService { @Override public File saveConsumptionDetail(ConsumptionDetailQuery dto) { - return ExcelUtil.exportReport(jdbcConsumptionDetailRepository.pageConsumptionDetail(dto).getRecords()); + List records=jdbcConsumptionDetailRepository.pageConsumptionDetail(dto).getRecords(); + if (records.isEmpty()){ + throw new CommandException("导出数据为空"); + } + return ExcelUtil.exportReport(records); } @Override @@ -100,10 +105,11 @@ public class ManageServiceImpl implements ManageService { PageRequest pageRequest = PageRequest .of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("id").descending()); - Page page=jdbcOrderExceedStandardRepository.findAllByApplicantContainsAndCompanyNameContainsAndActualOrderNoContainsAndOrderNoContainsAndOrderNoIn(dto.getApplicant(), + Page page=jdbcOrderExceedStandardRepository.findAllByApplicantContainsAndCompanyNameContainsAndActualOrderNoContainsAndOrderNoContainsAndEmployeeNoContainsAndOrderNoIn(dto.getApplicant(), dto.getCompanyName(), dto.getActualOrderNo(), dto.getOrderNo(), + dto.getEmployeeNo(), orderNos, pageRequest); @@ -113,7 +119,11 @@ public class ManageServiceImpl implements ManageService { @Override public File standardExport(StandardQuery dto) { - return ExcelUtil.exportReport(standardQuery(dto).getRecords()); + List records=standardQuery(dto).getRecords(); + if (records.isEmpty()){ + throw new CommandException("导出数据为空"); + } + return ExcelUtil.exportReport(records); } @Override @@ -284,6 +294,10 @@ public class ManageServiceImpl implements ManageService { @Override public File orderExport(OrderPageQuery dto) { + List records=orderPageQuery(dto).getRecords(); + if (records.isEmpty()){ + throw new CommandException("导出数据为空"); + } return ExcelUtil.exportReport(orderPageQuery(dto).getRecords()); } diff --git a/src/main/java/com/chint/manage/util/BaseUtil.java b/src/main/java/com/chint/manage/util/BaseUtil.java index d0ac2b5a..2bf5dffb 100644 --- a/src/main/java/com/chint/manage/util/BaseUtil.java +++ b/src/main/java/com/chint/manage/util/BaseUtil.java @@ -45,4 +45,19 @@ public class BaseUtil { return jdbcOrderDetailRepository.findAllByRouteIdIn(routeIds).stream().map(OrderDetail::getOrderNo).toList(); } + /** + * 处理行程单 + */ + + public static String extractAfterDash(String input) { + if(input==null){ + return null; + } + int index = input.indexOf('-'); + if (index != -1) { + return input.substring(index + 1); + } + return input; + } + }