【add】超标报表查询功能实现
This commit is contained in:
parent
6a945c3b84
commit
4fbcbd779a
|
@ -173,12 +173,12 @@ public class BPMOrderDomainService {
|
||||||
private String getProductTypeName(Integer type){
|
private String getProductTypeName(Integer type){
|
||||||
String typeName = null;
|
String typeName = null;
|
||||||
switch (type){
|
switch (type){
|
||||||
case LEG_TYPE_TRAIN -> typeName="火车";
|
case LEG_TYPE_TRAIN -> typeName=LEG_TYPE_TRAIN_NAME;
|
||||||
case LEG_TYPE_AIRPLANE -> typeName="飞机";
|
case LEG_TYPE_AIRPLANE -> typeName=LEG_TYPE_AIRPLANE_NAME;
|
||||||
case LEG_TYPE_HOTEL -> typeName="酒店";
|
case LEG_TYPE_HOTEL -> typeName=LEG_TYPE_HOTEL_NAME;
|
||||||
case LEG_TYPE_TAXI -> typeName="用车";
|
case LEG_TYPE_TAXI -> typeName=LEG_TYPE_TAXI_NAME;
|
||||||
case LEG_TYPE_OTHER -> typeName="其他";
|
case LEG_TYPE_OTHER -> typeName=LEG_TYPE_OTHER_NAME;
|
||||||
default -> typeName="未分类";
|
default -> typeName=LEG_TYPE_OTHER_NAME+type;
|
||||||
}
|
}
|
||||||
return typeName;
|
return typeName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package com.chint.manage.controller;
|
package com.chint.manage.controller;
|
||||||
|
|
||||||
import com.chint.infrastructure.util.PageResult;
|
import com.chint.infrastructure.util.PageResult;
|
||||||
|
import com.chint.manage.entity.dto.StandardQueryDto;
|
||||||
import com.chint.manage.entity.excel.BaseExcel;
|
import com.chint.manage.entity.excel.BaseExcel;
|
||||||
|
import com.chint.manage.entity.excel.OrderExceedStandardExcel;
|
||||||
import com.chint.manage.entity.excel.TrainOrderDetailExcel;
|
import com.chint.manage.entity.excel.TrainOrderDetailExcel;
|
||||||
import com.chint.manage.entity.dto.ConsumptionDetailDto;
|
import com.chint.manage.entity.dto.ConsumptionDetailDto;
|
||||||
import com.chint.manage.service.ManageService;
|
import com.chint.manage.service.ManageService;
|
||||||
|
@ -50,4 +52,11 @@ public class ManageController {
|
||||||
.contentType(MediaType.parseMediaType("application/octet-stream"))
|
.contentType(MediaType.parseMediaType("application/octet-stream"))
|
||||||
.body(resource);
|
.body(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("超标查询接口")
|
||||||
|
@PostMapping("/standard/query")
|
||||||
|
public PageResult<OrderExceedStandardExcel> standardQuery(@RequestBody StandardQueryDto dto){
|
||||||
|
return manageService.standardQuery(dto);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.chint.manage.entity.dto;
|
||||||
|
|
||||||
|
import com.chint.domain.value_object.BaseQuery;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class StandardQueryDto extends BaseQuery {
|
||||||
|
private String applicant="";// 申请人
|
||||||
|
private String companyName=""; // 出差公司
|
||||||
|
private String orderNo=""; //订单号
|
||||||
|
private String actualOrderNo=""; //申请单号
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.chint.manage.entity.excel;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @Author:nxj
|
||||||
|
* @Date:2024/5/11 8:51
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class OrderExceedStandardExcel {
|
||||||
|
@ExcelProperty("订单号")
|
||||||
|
private String orderNo;
|
||||||
|
@ExcelProperty("出差人")
|
||||||
|
private String applicant;
|
||||||
|
@ExcelProperty("出差人公司")
|
||||||
|
private String companyName;
|
||||||
|
@ExcelProperty("出差部门")
|
||||||
|
private String deptName;
|
||||||
|
@ExcelProperty("超标类型")
|
||||||
|
private String standardType;
|
||||||
|
@ExcelProperty("来源")
|
||||||
|
private String sourceName;
|
||||||
|
@ExcelProperty("原因")
|
||||||
|
private String reason;
|
||||||
|
@ExcelProperty("审批情况")
|
||||||
|
private String approvalStatus;
|
||||||
|
@ExcelProperty("超标金额")
|
||||||
|
private BigDecimal standardAmount;
|
||||||
|
|
||||||
|
}
|
|
@ -2,6 +2,8 @@ package com.chint.manage.mapper;
|
||||||
|
|
||||||
import com.chint.manage.entity.OrderExceedStandard;
|
import com.chint.manage.entity.OrderExceedStandard;
|
||||||
import io.lettuce.core.dynamic.annotation.Param;
|
import io.lettuce.core.dynamic.annotation.Param;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.jdbc.repository.query.Modifying;
|
import org.springframework.data.jdbc.repository.query.Modifying;
|
||||||
import org.springframework.data.jdbc.repository.query.Query;
|
import org.springframework.data.jdbc.repository.query.Query;
|
||||||
import org.springframework.data.repository.CrudRepository;
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
@ -13,4 +15,6 @@ public interface JdbcOrderExceedStandardRepository extends CrudRepository<OrderE
|
||||||
@Modifying
|
@Modifying
|
||||||
@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> findAllByApplicantContainsAndCompanyNameContainsAndActualOrderNoContainsAndOrderNoContains(String applicant, String company, String actualOrderNo, String orderNo, Pageable pageable);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai
|
||||||
dto.setOrderNo("");
|
dto.setOrderNo("");
|
||||||
}
|
}
|
||||||
PageRequest pageRequest = PageRequest
|
PageRequest pageRequest = PageRequest
|
||||||
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("id"));
|
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("id").descending());
|
||||||
Page<? extends BaseExcel> data=new PageImpl<>(Collections.emptyList());
|
Page<? extends BaseExcel> data=new PageImpl<>(Collections.emptyList());
|
||||||
switch (dto.getProductType()) {
|
switch (dto.getProductType()) {
|
||||||
case LEG_TYPE_TRAIN -> data=getOrderTrainRecord(jdbcTrainOrderDetailRepository.findAllByUserNameContainsAndOrderNoContaining(dto.getUserName(),dto.getOrderNo(),pageRequest));
|
case LEG_TYPE_TRAIN -> data=getOrderTrainRecord(jdbcTrainOrderDetailRepository.findAllByUserNameContainsAndOrderNoContaining(dto.getUserName(),dto.getOrderNo(),pageRequest));
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
package com.chint.manage.service;
|
package com.chint.manage.service;
|
||||||
|
|
||||||
import com.chint.infrastructure.util.PageResult;
|
import com.chint.infrastructure.util.PageResult;
|
||||||
import com.chint.manage.entity.excel.BaseExcel;
|
|
||||||
import com.chint.manage.entity.excel.TrainOrderDetailExcel;
|
|
||||||
import com.chint.manage.entity.dto.ConsumptionDetailDto;
|
import com.chint.manage.entity.dto.ConsumptionDetailDto;
|
||||||
|
import com.chint.manage.entity.dto.StandardQueryDto;
|
||||||
|
import com.chint.manage.entity.excel.BaseExcel;
|
||||||
|
import com.chint.manage.entity.excel.OrderExceedStandardExcel;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
@ -17,4 +18,6 @@ public interface ManageService {
|
||||||
PageResult<? extends BaseExcel> pageConsumptionDetail(ConsumptionDetailDto dto);
|
PageResult<? extends BaseExcel> pageConsumptionDetail(ConsumptionDetailDto dto);
|
||||||
|
|
||||||
File saveConsumptionDetail(ConsumptionDetailDto dto);
|
File saveConsumptionDetail(ConsumptionDetailDto dto);
|
||||||
|
|
||||||
|
PageResult<OrderExceedStandardExcel> standardQuery(StandardQueryDto dto);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,29 @@
|
||||||
package com.chint.manage.service.impl;
|
package com.chint.manage.service.impl;
|
||||||
|
|
||||||
import com.chint.infrastructure.util.PageResult;
|
import com.chint.infrastructure.util.PageResult;
|
||||||
|
import com.chint.manage.entity.OrderExceedStandard;
|
||||||
|
import com.chint.manage.entity.dto.StandardQueryDto;
|
||||||
import com.chint.manage.entity.excel.BaseExcel;
|
import com.chint.manage.entity.excel.BaseExcel;
|
||||||
|
import com.chint.manage.entity.excel.OrderExceedStandardExcel;
|
||||||
import com.chint.manage.entity.excel.TrainOrderDetailExcel;
|
import com.chint.manage.entity.excel.TrainOrderDetailExcel;
|
||||||
import com.chint.manage.entity.dto.ConsumptionDetailDto;
|
import com.chint.manage.entity.dto.ConsumptionDetailDto;
|
||||||
|
import com.chint.manage.mapper.JdbcOrderExceedStandardRepository;
|
||||||
import com.chint.manage.mapper.impl.JdbcConsumptionDetailRepositoryImpl;
|
import com.chint.manage.mapper.impl.JdbcConsumptionDetailRepositoryImpl;
|
||||||
import com.chint.manage.service.ManageService;
|
import com.chint.manage.service.ManageService;
|
||||||
import com.chint.manage.util.ExcelUtil;
|
import com.chint.manage.util.ExcelUtil;
|
||||||
import org.apache.poi.ss.formula.functions.T;
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.PageImpl;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Sort;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -22,6 +34,8 @@ import java.io.File;
|
||||||
public class ManageServiceImpl implements ManageService {
|
public class ManageServiceImpl implements ManageService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private JdbcConsumptionDetailRepositoryImpl jdbcConsumptionDetailRepository;
|
private JdbcConsumptionDetailRepositoryImpl jdbcConsumptionDetailRepository;
|
||||||
|
@Autowired
|
||||||
|
private JdbcOrderExceedStandardRepository jdbcOrderExceedStandardRepository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<? extends BaseExcel> pageConsumptionDetail(ConsumptionDetailDto dto) {
|
public PageResult<? extends BaseExcel> pageConsumptionDetail(ConsumptionDetailDto dto) {
|
||||||
|
@ -32,4 +46,33 @@ public class ManageServiceImpl implements ManageService {
|
||||||
public File saveConsumptionDetail(ConsumptionDetailDto dto) {
|
public File saveConsumptionDetail(ConsumptionDetailDto dto) {
|
||||||
return ExcelUtil.exportReport(jdbcConsumptionDetailRepository.pageConsumptionDetail(dto).getRecords());
|
return ExcelUtil.exportReport(jdbcConsumptionDetailRepository.pageConsumptionDetail(dto).getRecords());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<OrderExceedStandardExcel> standardQuery(StandardQueryDto dto) {
|
||||||
|
PageRequest pageRequest = PageRequest
|
||||||
|
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("id").descending());
|
||||||
|
Page<OrderExceedStandard> page=jdbcOrderExceedStandardRepository.findAllByApplicantContainsAndCompanyNameContainsAndActualOrderNoContainsAndOrderNoContains(dto.getApplicant(),
|
||||||
|
dto.getCompanyName(),
|
||||||
|
dto.getActualOrderNo(),
|
||||||
|
dto.getOrderNo(),
|
||||||
|
pageRequest);
|
||||||
|
|
||||||
|
List<OrderExceedStandardExcel> excelList = getOrderExceedStandardExcels(page);
|
||||||
|
return PageResult.totalPageNum(page.getTotalElements(), excelList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<OrderExceedStandardExcel> getOrderExceedStandardExcels(Page<OrderExceedStandard> page) {
|
||||||
|
List<OrderExceedStandard> orderList = page.getContent();
|
||||||
|
List<OrderExceedStandardExcel> excelList = new ArrayList<>();
|
||||||
|
for (OrderExceedStandard order : orderList) {
|
||||||
|
OrderExceedStandardExcel excelOrder = new OrderExceedStandardExcel();
|
||||||
|
try {
|
||||||
|
BeanUtils.copyProperties(order, excelOrder);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
excelList.add(excelOrder);
|
||||||
|
}
|
||||||
|
return excelList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue