From 9e8807c19f18c60f301313d84bb1dcdbe9a8e821 Mon Sep 17 00:00:00 2001 From: nixj Date: Thu, 20 Jun 2024 13:04:59 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90add=E3=80=91=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E5=AF=BC=E5=87=BA=E4=B8=BA=E7=A9=BA=E5=88=A4?= =?UTF-8?q?=E6=96=AD=EF=BC=8C=E8=A1=8C=E7=A8=8B=E5=8D=95'-'=E5=A4=84?= =?UTF-8?q?=E7=90=86=EF=BC=8C=E8=B6=85=E6=A0=87=E6=8A=A5=E8=A1=A8=E6=96=B0?= =?UTF-8?q?=E5=A2=9ESF=E5=B7=A5=E5=8F=B7=E6=9F=A5=E8=AF=A2=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../excel/OrderExceedStandardExcel.java | 3 +++ .../entity/query/ItineraryPageQuery.java | 6 ++++++ .../manage/entity/query/StandardQuery.java | 1 + .../JdbcOrderExceedStandardRepository.java | 2 +- .../service/impl/ManageServiceImpl.java | 20 ++++++++++++++++--- .../java/com/chint/manage/util/BaseUtil.java | 15 ++++++++++++++ 6 files changed, 43 insertions(+), 4 deletions(-) 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; + } + }