【add】新增报表导出为空判断,行程单'-'处理,超标报表新增SF工号查询条件

This commit is contained in:
nixj 2024-06-20 13:04:59 +08:00
parent a3fc44e83e
commit 9e8807c19f
6 changed files with 43 additions and 4 deletions

View File

@ -1,5 +1,6 @@
package com.chint.manage.entity.excel; package com.chint.manage.entity.excel;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
@ -30,5 +31,7 @@ public class OrderExceedStandardExcel extends BaseExcel{
private String approvalStatus; private String approvalStatus;
@ExcelProperty("超标金额") @ExcelProperty("超标金额")
private BigDecimal standardAmount; private BigDecimal standardAmount;
@ExcelIgnore
private String employeeNo;
} }

View File

@ -2,6 +2,7 @@ package com.chint.manage.entity.query;
import com.chint.domain.value_object.BaseQuery; import com.chint.domain.value_object.BaseQuery;
import com.chint.infrastructure.util.PageResult; import com.chint.infrastructure.util.PageResult;
import com.chint.manage.util.BaseUtil;
import lombok.Data; import lombok.Data;
import java.util.ArrayList; import java.util.ArrayList;
@ -13,4 +14,9 @@ public class ItineraryPageQuery extends BaseQuery {
private String actualOrderNo=""; //申请单号 private String actualOrderNo=""; //申请单号
private List<String> userIds=new ArrayList<>(); private List<String> userIds=new ArrayList<>();
private List<Long> routeIds; private List<Long> routeIds;
public String getActualOrderNo() {
return BaseUtil.extractAfterDash(actualOrderNo);
}
} }

View File

@ -9,4 +9,5 @@ public class StandardQuery extends BaseQuery {
private String companyName=""; // 出差公司 private String companyName=""; // 出差公司
private String orderNo=""; //订单号 private String orderNo=""; //订单号
private String actualOrderNo=""; //申请单号 private String actualOrderNo=""; //申请单号
private String employeeNo=""; //SF工号
} }

View File

@ -18,5 +18,5 @@ public interface JdbcOrderExceedStandardRepository extends CrudRepository<OrderE
@Query("UPDATE order_exceed_standard SET approval_status = :status WHERE order_no = :orderNo") @Query("UPDATE order_exceed_standard SET approval_status = :status WHERE order_no = :orderNo")
void updateApprovalStatusById(@Param("status") String status, @Param("orderNo") String orderNo); void updateApprovalStatusById(@Param("status") String status, @Param("orderNo") String orderNo);
Page<OrderExceedStandard> findAllByApplicantContainsAndCompanyNameContainsAndActualOrderNoContainsAndOrderNoContainsAndOrderNoIn(String applicant, String company, String actualOrderNo, String orderNo, List<String> orderNos, Pageable pageable); Page<OrderExceedStandard> findAllByApplicantContainsAndCompanyNameContainsAndActualOrderNoContainsAndOrderNoContainsAndEmployeeNoContainsAndOrderNoIn(String applicant, String company, String actualOrderNo, String orderNo,String employeeNo, List<String> orderNos, Pageable pageable);
} }

View File

@ -3,6 +3,7 @@ package com.chint.manage.service.impl;
import com.chint.application.dtos.response.LocationRes; import com.chint.application.dtos.response.LocationRes;
import com.chint.domain.aggregates.order.*; import com.chint.domain.aggregates.order.*;
import com.chint.domain.aggregates.user.User; import com.chint.domain.aggregates.user.User;
import com.chint.domain.exceptions.CommandException;
import com.chint.domain.repository.UserRepository; import com.chint.domain.repository.UserRepository;
import com.chint.domain.service.LegDomainService; import com.chint.domain.service.LegDomainService;
import com.chint.infrastructure.repository.jdbc.JdbcLocationRepository; import com.chint.infrastructure.repository.jdbc.JdbcLocationRepository;
@ -87,7 +88,11 @@ public class ManageServiceImpl implements ManageService {
@Override @Override
public File saveConsumptionDetail(ConsumptionDetailQuery dto) { public File saveConsumptionDetail(ConsumptionDetailQuery dto) {
return ExcelUtil.exportReport(jdbcConsumptionDetailRepository.pageConsumptionDetail(dto).getRecords()); List<? extends BaseExcel> records=jdbcConsumptionDetailRepository.pageConsumptionDetail(dto).getRecords();
if (records.isEmpty()){
throw new CommandException("导出数据为空");
}
return ExcelUtil.exportReport(records);
} }
@Override @Override
@ -100,10 +105,11 @@ public class ManageServiceImpl implements ManageService {
PageRequest pageRequest = PageRequest PageRequest pageRequest = PageRequest
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("id").descending()); .of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("id").descending());
Page<OrderExceedStandard> page=jdbcOrderExceedStandardRepository.findAllByApplicantContainsAndCompanyNameContainsAndActualOrderNoContainsAndOrderNoContainsAndOrderNoIn(dto.getApplicant(), Page<OrderExceedStandard> page=jdbcOrderExceedStandardRepository.findAllByApplicantContainsAndCompanyNameContainsAndActualOrderNoContainsAndOrderNoContainsAndEmployeeNoContainsAndOrderNoIn(dto.getApplicant(),
dto.getCompanyName(), dto.getCompanyName(),
dto.getActualOrderNo(), dto.getActualOrderNo(),
dto.getOrderNo(), dto.getOrderNo(),
dto.getEmployeeNo(),
orderNos, orderNos,
pageRequest); pageRequest);
@ -113,7 +119,11 @@ public class ManageServiceImpl implements ManageService {
@Override @Override
public File standardExport(StandardQuery dto) { public File standardExport(StandardQuery dto) {
return ExcelUtil.exportReport(standardQuery(dto).getRecords()); List<OrderExceedStandardExcel> records=standardQuery(dto).getRecords();
if (records.isEmpty()){
throw new CommandException("导出数据为空");
}
return ExcelUtil.exportReport(records);
} }
@Override @Override
@ -284,6 +294,10 @@ public class ManageServiceImpl implements ManageService {
@Override @Override
public File orderExport(OrderPageQuery dto) { public File orderExport(OrderPageQuery dto) {
List<OrderPageExcel> records=orderPageQuery(dto).getRecords();
if (records.isEmpty()){
throw new CommandException("导出数据为空");
}
return ExcelUtil.exportReport(orderPageQuery(dto).getRecords()); return ExcelUtil.exportReport(orderPageQuery(dto).getRecords());
} }

View File

@ -45,4 +45,19 @@ public class BaseUtil {
return jdbcOrderDetailRepository.findAllByRouteIdIn(routeIds).stream().map(OrderDetail::getOrderNo).toList(); 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;
}
} }