【update】数据权限暂时去除,等待后续优化
This commit is contained in:
parent
c7dfb7f045
commit
34c40ce2e6
|
@ -122,7 +122,7 @@ public class BPMOrderDomainService {
|
|||
//保存超标报表
|
||||
OrderExceedStandard orderExceedStandard = OrderExceedStandard.builder()
|
||||
.applicant(orderDetail.getSupplierName())
|
||||
.companyName(user.getCompanyName())
|
||||
.companyName(user.getDepartmentInfo().getCompanyName())
|
||||
.deptName(user.getDepartmentInfo().getDepartmentNameOne())
|
||||
.standardType(getProductTypeName(command.getProductType()))
|
||||
.sourceName(anExceedStandardDto.getSourceSystem())
|
||||
|
@ -161,7 +161,7 @@ public class BPMOrderDomainService {
|
|||
//保存超标报表
|
||||
OrderExceedStandard orderExceedStandard = OrderExceedStandard.builder()
|
||||
.applicant(orderDetail.getSupplierName())
|
||||
.companyName(user.getCompanyName())
|
||||
.companyName(user.getDepartmentInfo().getCompanyName())
|
||||
.deptName(user.getDepartmentInfo().getDepartmentNameOne())
|
||||
.standardType(getProductTypeName(command.getProductType()))
|
||||
.sourceName(exceedStandardDto.getOrderSource())
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.chint.manage.entity.query.OrderPageQuery;
|
|||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jdbc.repository.query.Modifying;
|
||||
import org.springframework.data.jdbc.repository.query.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
@ -33,11 +34,24 @@ public interface JdbcOrderDetailRepository extends CrudRepository<OrderDetail, L
|
|||
List<OrderDetail> findByCreateTimeBetweenAndProductTypeAndOrderNoContaining(LocalDateTime createTime, LocalDateTime createTime2, Integer productType, String orderNo);
|
||||
List<OrderDetail> findByUpdateTimeBetween(LocalDateTime createTime, LocalDateTime createTime2);
|
||||
|
||||
List<OrderDetail> findAllByRouteIdIn(List<Long> routeIds);
|
||||
@Query("SELECT order_no FROM order_detail " +
|
||||
"WHERE route_id IN (:#{#routeIds})")
|
||||
List<String> findAllOrderNo(@Param("routeIds") List<Long> routeIds);
|
||||
|
||||
@Query("SELECT order_id FROM order_detail " +
|
||||
"WHERE route_id IN (:#{#routeIds})")
|
||||
List<Long> findAllOrderId(@Param("routeIds") List<Long> routeIds);
|
||||
|
||||
@Query("SELECT order_no FROM order_detail " )
|
||||
List<String> findAllOrderNo();
|
||||
|
||||
@Query("SELECT order_id FROM order_detail ")
|
||||
List<Long> findAllOrderId();
|
||||
|
||||
|
||||
@Query("SELECT * FROM order_detail " +
|
||||
"WHERE route_id IN (:#{#dto.routeIds}) " +
|
||||
// "WHERE route_id IN (:#{#dto.routeIds}) " +
|
||||
"WHERE 1=1 " +
|
||||
"AND (:#{#dto.orderNo} ='' OR order_no LIKE :#{#dto.orderNo}) " +
|
||||
"AND (:#{#dto.startTime} IS NULL OR :#{#dto.endTime} IS NULL OR order_date BETWEEN :#{#dto.startTime} AND :#{#dto.endTime}) " +
|
||||
"AND (:#{#dto.productType} ='' OR product_type = :#{#dto.productType}) " +
|
||||
|
@ -47,7 +61,8 @@ public interface JdbcOrderDetailRepository extends CrudRepository<OrderDetail, L
|
|||
List<OrderDetail> listByCondition(@Param("dto") OrderPageQuery dto, @Param("pageRequest")PageRequest pageRequest);
|
||||
|
||||
@Query("SELECT COUNT(*) FROM order_detail " +
|
||||
"WHERE route_id IN (:#{#dto.routeIds}) " +
|
||||
// "WHERE route_id IN (:#{#dto.routeIds}) " +
|
||||
"WHERE 1=1 " +
|
||||
"AND (:#{#dto.orderNo} ='' OR order_no LIKE :#{#dto.orderNo}) " +
|
||||
"AND (:#{#dto.startTime} IS NULL OR :#{#dto.endTime} IS NULL OR order_date BETWEEN :#{#dto.startTime} AND :#{#dto.endTime} ) " +
|
||||
"AND (:#{#dto.productType} ='' OR product_type = :#{#dto.productType}) "+
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
package com.chint.manage.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xx RouteOrderBasic.java
|
||||
*
|
||||
**/
|
||||
@Data
|
||||
@Table("route_order")
|
||||
public class RouteOrderBasic implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
private Long routeId;
|
||||
|
||||
/****/
|
||||
private java.util.Date bookingTime;
|
||||
|
||||
/****/
|
||||
private String userId;
|
||||
|
||||
/****/
|
||||
private java.util.Date createTime;
|
||||
|
||||
/****/
|
||||
private String createUser;
|
||||
|
||||
/****/
|
||||
private Integer sort;
|
||||
|
||||
/****/
|
||||
private Integer status;
|
||||
|
||||
/****/
|
||||
private java.util.Date updateTime;
|
||||
|
||||
/****/
|
||||
private String updateUser;
|
||||
|
||||
/****/
|
||||
private String fakeOrderNo;
|
||||
|
||||
/****/
|
||||
private String actualOrderNo;
|
||||
|
||||
/**差旅订单号**/
|
||||
private String routeOrderNo;
|
||||
|
||||
/****/
|
||||
private String supplierName;
|
||||
|
||||
/****/
|
||||
private String accountCompany;
|
||||
|
||||
/****/
|
||||
private String sysCode;
|
||||
|
||||
/****/
|
||||
private String instructions;
|
||||
|
||||
/****/
|
||||
private String standardLevel;
|
||||
|
||||
/****/
|
||||
private String creator;
|
||||
|
||||
/****/
|
||||
private String accountCompanyName;
|
||||
|
||||
/**入账公司64位编码**/
|
||||
private String accountCompanyCode;
|
||||
|
||||
/****/
|
||||
private String projectName;
|
||||
|
||||
/****/
|
||||
private String costCenter;
|
||||
|
||||
/****/
|
||||
private java.util.Date startTime;
|
||||
|
||||
/****/
|
||||
private java.util.Date endTime;
|
||||
|
||||
|
||||
}
|
|
@ -4,6 +4,9 @@ import com.chint.domain.value_object.BaseQuery;
|
|||
import com.chint.manage.util.BaseUtil;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @Author:nxj
|
||||
|
@ -17,6 +20,8 @@ public class ConsumptionDetailQuery extends BaseQuery{
|
|||
private Integer productType;
|
||||
private String userName="";
|
||||
private String actualOrderNo=""; //申请单号
|
||||
private List<Long> orderIds=new ArrayList<>();
|
||||
private List<String> orderNos=new ArrayList<>();
|
||||
|
||||
public String getActualOrderNo() {
|
||||
return BaseUtil.extractAfterDash(actualOrderNo);
|
||||
|
|
|
@ -13,11 +13,5 @@ import java.util.List;
|
|||
@Repository
|
||||
public interface JdbcCarOrderDetailRepository extends CrudRepository<CarOrderDetail, Long> {
|
||||
|
||||
Page<CarOrderDetail> findAllByUserNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable);
|
||||
|
||||
Page<CarOrderDetail> findAllByUserNameContainsAndOrderNoInAndOrderIdIn(String userName, List<String> orderNo,List<Long> orderIds, Pageable pageable);
|
||||
|
||||
Page<CarOrderDetail> findAllByUserNameContainsAndOrderIdIn(String userName,List<Long> orderIds, Pageable pageable);
|
||||
|
||||
List<CarOrderDetail> findAllByOrderIdIn(List<Long> orderIds);
|
||||
}
|
||||
|
|
|
@ -12,11 +12,5 @@ import java.util.List;
|
|||
@Repository
|
||||
public interface JdbcFlightOrderDetailRepository extends CrudRepository<FlightOrderDetail, Long> {
|
||||
|
||||
Page<FlightOrderDetail> findAllByUserNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable);
|
||||
|
||||
Page<FlightOrderDetail> findAllByUserNameContainsAndOrderNoInAndOrderIdIn(String userName, List<String> orderNo,List<Long> orderIds, Pageable pageable);
|
||||
|
||||
Page<FlightOrderDetail> findAllByUserNameContainsAndOrderIdIn(String userName,List<Long> orderIds, Pageable pageable);
|
||||
|
||||
List<FlightOrderDetail> findAllByOrderIdIn(List<Long> orderIds);
|
||||
}
|
||||
|
|
|
@ -14,11 +14,5 @@ import java.util.List;
|
|||
@Repository
|
||||
public interface JdbcHotelOrderDetailRepository extends CrudRepository<HotelOrderDetail, Long> {
|
||||
|
||||
Page<HotelOrderDetail> findAllByBookingNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable);
|
||||
|
||||
Page<HotelOrderDetail> findAllByBookingNameContainsAndOrderNoInAndOrderIdIn(String userName, List<String> orderNo,List<Long> orderIds, Pageable pageable);
|
||||
|
||||
Page<HotelOrderDetail> findAllByBookingNameContainsAndOrderIdIn(String userName,List<Long> orderIds, Pageable pageable);
|
||||
|
||||
List<HotelOrderDetail> findAllByOrderIdIn(List<Long> orderIds);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.chint.manage.mapper;
|
|||
|
||||
import com.chint.manage.entity.OrderExceedStandard;
|
||||
import io.lettuce.core.dynamic.annotation.Param;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jdbc.repository.query.Modifying;
|
||||
|
@ -18,5 +19,8 @@ public interface JdbcOrderExceedStandardRepository extends CrudRepository<OrderE
|
|||
@Query("UPDATE order_exceed_standard SET approval_status = :status WHERE order_no = :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);
|
||||
List<OrderExceedStandard> findAll();
|
||||
|
||||
// Page<OrderExceedStandard> findAllByApplicantContainsAndDeptNameContainsAndActualOrderNoContainsAndOrderNoContainsAndOrderNoIn(String applicant, String company, String actualOrderNo, String orderNo, List<String> orderNos, Pageable pageable);
|
||||
Page<OrderExceedStandard> findAllByApplicantContainsAndDeptNameContainsAndActualOrderNoContainsAndOrderNoContains(String applicant, String company, String actualOrderNo, String orderNo, Pageable pageable);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package com.chint.manage.mapper;
|
||||
import com.chint.domain.aggregates.order.RouteOrder;
|
||||
import com.chint.manage.entity.RouteOrderBasic;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xx JdbcRouteOrderBasicRepository数据库操作接口类
|
||||
*
|
||||
**/
|
||||
@Repository
|
||||
public interface JdbcRouteOrderBasicRepository extends CrudRepository<RouteOrderBasic,Long> {
|
||||
|
||||
List<RouteOrderBasic> findByRouteIdIn(List<Long> routeIds);
|
||||
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
package com.chint.manage.mapper;
|
||||
import com.chint.manage.entity.RouteOrderExtensionField;
|
||||
import org.springframework.data.jdbc.repository.query.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -14,5 +16,7 @@ import java.util.List;
|
|||
@Repository
|
||||
public interface JdbcRouteOrderExtensionFieldRepository extends CrudRepository<RouteOrderExtensionField,Long> {
|
||||
|
||||
List<RouteOrderExtensionField> findByBelongDeptCodeIn(List<String> belongDeptCode);
|
||||
@Query("SELECT * FROM route_order_extension_field " +
|
||||
"WHERE belong_dept_code IN (:#{#belongDeptCode})")
|
||||
List<RouteOrderExtensionField> findByCondition(@Param("belongDeptCode") List<String> belongDeptCode);
|
||||
}
|
|
@ -11,11 +11,5 @@ import java.util.List;
|
|||
@Repository
|
||||
public interface JdbcTrainOrderDetailRepository extends CrudRepository<TrainOrderDetail, Long> {
|
||||
|
||||
Page<TrainOrderDetail> findAllByUserNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable);
|
||||
|
||||
Page<TrainOrderDetail> findAllByUserNameContainsAndOrderNoInAndOrderIdIn(String userName, List<String> orderNo,List<Long> orderIds ,Pageable pageable);
|
||||
|
||||
Page<TrainOrderDetail> findAllByUserNameContainsAndOrderIdIn(String userName,List<Long> orderIds, Pageable pageable);
|
||||
|
||||
List<TrainOrderDetail> findAllByOrderIdIn(List<Long> orderIds);
|
||||
}
|
||||
|
|
|
@ -35,15 +35,6 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai
|
|||
|
||||
@Autowired
|
||||
private NamedParameterJdbcTemplate jdbcTemplate;
|
||||
|
||||
@Autowired
|
||||
private JdbcTrainOrderDetailRepository jdbcTrainOrderDetailRepository;
|
||||
@Autowired
|
||||
private JdbcCarOrderDetailRepository jdbcCarOrderDetailRepository;
|
||||
@Autowired
|
||||
private JdbcHotelOrderDetailRepository jdbcHotelOrderDetailRepository;
|
||||
@Autowired
|
||||
private JdbcFlightOrderDetailRepository jdbcFlightOrderDetailRepository;
|
||||
@Autowired
|
||||
private JdbcRouteRepository jdbcRouteRepository;
|
||||
@Autowired
|
||||
|
@ -56,23 +47,22 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai
|
|||
public Page<ItineraryPageDto> itineraryPageQueryByDto(ItineraryPageQuery dto) {
|
||||
String query = "SELECT * FROM route_order "
|
||||
+ "WHERE route_id IN (:routeIds) "
|
||||
+ "AND (:actualOrderNo IS NULL OR actual_order_no = :actualOrderNo ) "
|
||||
+ "AND actual_order_no IS NOT NULL ";
|
||||
|
||||
if (!dto.getUserIds().isEmpty()) {
|
||||
query+="AND user_id IN (:userIds)";
|
||||
query+="AND user_id IN (:userIds) ";
|
||||
}
|
||||
|
||||
if (!dto.getActualOrderNo().isEmpty()) {
|
||||
query+="AND actual_order_no = :actualOrderNo ";
|
||||
}
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
//设置null
|
||||
if (dto.getActualOrderNo().isEmpty()){
|
||||
dto.setActualOrderNo(null);
|
||||
}
|
||||
PageRequest pageRequest = PageRequest
|
||||
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("create_time").descending());
|
||||
params.put("actualOrderNo", dto.getActualOrderNo());
|
||||
params.put("userIds", dto.getUserIds());
|
||||
params.put("routeIds", dto.getRouteIds());
|
||||
PageRequest pageRequest = PageRequest
|
||||
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("route_id").descending());
|
||||
params.put("offset", pageRequest.getOffset());
|
||||
params.put("limit", pageRequest.getPageSize());
|
||||
|
||||
|
@ -87,13 +77,12 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai
|
|||
@Override
|
||||
public PageResult<? extends BaseExcel> pageConsumptionDetail(ConsumptionDetailQuery dto) {
|
||||
//数据权限
|
||||
List<Long> orderIds=baseUtil.getOrderIds();
|
||||
if (orderIds==null||orderIds.isEmpty()) {
|
||||
return PageResult.totalPageNum(0, new ArrayList<>());
|
||||
}
|
||||
// List<Long> orderIds=baseUtil.getOrderIds();
|
||||
// if (orderIds==null||orderIds.isEmpty()) {
|
||||
// return PageResult.totalPageNum(0, new ArrayList<>());
|
||||
// }
|
||||
|
||||
PageRequest pageRequest = PageRequest
|
||||
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("id").descending());
|
||||
List<Long> orderIds=jdbcOrderDetailRepository.findAllOrderId();
|
||||
Page<? extends BaseExcel> data=new PageImpl<>(Collections.emptyList());
|
||||
//申请单查询
|
||||
if (!dto.getActualOrderNo().isEmpty()){
|
||||
|
@ -101,79 +90,100 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai
|
|||
if (orderNos.isEmpty()){
|
||||
return new PageResult<BaseExcel>(0,new ArrayList<>());
|
||||
}
|
||||
switch (dto.getProductType()) {
|
||||
case LEG_TYPE_TRAIN -> data=getOrderTrainRecord(jdbcTrainOrderDetailRepository.findAllByUserNameContainsAndOrderNoInAndOrderIdIn(dto.getUserName(),orderNos,orderIds,pageRequest));
|
||||
case LEG_TYPE_AIRPLANE -> data=getOrderFlightRecord(jdbcFlightOrderDetailRepository.findAllByUserNameContainsAndOrderNoInAndOrderIdIn(dto.getUserName(),orderNos,orderIds,pageRequest));
|
||||
case LEG_TYPE_HOTEL -> data=getOrderHotelRecord(jdbcHotelOrderDetailRepository.findAllByBookingNameContainsAndOrderNoInAndOrderIdIn(dto.getUserName(),orderNos,orderIds,pageRequest));
|
||||
case LEG_TYPE_TAXI -> data=getOrderCarRecord(jdbcCarOrderDetailRepository.findAllByUserNameContainsAndOrderNoInAndOrderIdIn(dto.getUserName(),orderNos,orderIds,pageRequest));
|
||||
}
|
||||
return PageResult.totalPageNum(data.getTotalElements(), data.getContent());
|
||||
dto.setOrderNos(orderNos);
|
||||
}
|
||||
|
||||
switch (dto.getProductType()) {
|
||||
case LEG_TYPE_TRAIN -> data=getOrderTrainRecord(jdbcTrainOrderDetailRepository.findAllByUserNameContainsAndOrderIdIn(dto.getUserName(),orderIds,pageRequest));
|
||||
case LEG_TYPE_AIRPLANE -> data=getOrderFlightRecord(jdbcFlightOrderDetailRepository.findAllByUserNameContainsAndOrderIdIn(dto.getUserName(),orderIds,pageRequest));
|
||||
case LEG_TYPE_HOTEL -> data=getOrderHotelRecord(jdbcHotelOrderDetailRepository.findAllByBookingNameContainsAndOrderIdIn(dto.getUserName(),orderIds,pageRequest));
|
||||
case LEG_TYPE_TAXI -> data=getOrderCarRecord(jdbcCarOrderDetailRepository.findAllByUserNameContainsAndOrderIdIn(dto.getUserName(),orderIds,pageRequest));
|
||||
case LEG_TYPE_TRAIN -> data=trainPageConsumptionDetail(dto);
|
||||
case LEG_TYPE_AIRPLANE -> data=flightPageConsumptionDetail(dto);
|
||||
case LEG_TYPE_HOTEL -> data=hotelPageConsumptionDetail(dto);
|
||||
case LEG_TYPE_TAXI -> data=carPageConsumptionDetail(dto);
|
||||
}
|
||||
return PageResult.totalPageNum(data.getTotalElements(), data.getContent());
|
||||
}
|
||||
|
||||
public Page<TrainOrderDetailExcel> getOrderTrainRecord(Page<TrainOrderDetail> page) {
|
||||
List<TrainOrderDetail> orderRecords = page.getContent();
|
||||
List<TrainOrderDetailExcel> trainOrderDetailExcels = new ArrayList<>();
|
||||
// 遍历 OrderBaseRecord,将其转换为 ConsumptionDetailExcel
|
||||
for (TrainOrderDetail orderRecord : orderRecords) {
|
||||
TrainOrderDetailExcel trainOrderDetailExcel = new TrainOrderDetailExcel();
|
||||
BeanUtils.copyProperties(orderRecord, trainOrderDetailExcel);
|
||||
trainOrderDetailExcels.add(trainOrderDetailExcel);
|
||||
}
|
||||
// 构建一个新的 Page<ConsumptionDetailExcel> 对象并返回
|
||||
return new PageImpl<>(trainOrderDetailExcels, page.getPageable(), page.getTotalElements());
|
||||
|
||||
private Page<TrainOrderDetailExcel> trainPageConsumptionDetail(ConsumptionDetailQuery dto){
|
||||
String query = "SELECT * FROM train_order_detail "
|
||||
+ "WHERE 1=1 ";
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
PageRequest pageRequest = PageRequest
|
||||
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("create_time").descending());
|
||||
query = getString(dto, query, params, pageRequest);
|
||||
|
||||
String pagedQuery = query + " LIMIT :limit OFFSET :offset";
|
||||
long count = jdbcTemplate.queryForObject("SELECT COUNT(*) FROM (" + query + ") AS count", params, Long.class);
|
||||
List<TrainOrderDetailExcel> results = jdbcTemplate.query(pagedQuery, params, BeanPropertyRowMapper.newInstance(TrainOrderDetailExcel.class));
|
||||
return new PageImpl<>(results, pageRequest, count);
|
||||
}
|
||||
|
||||
public Page<FlightOrderDetailExcel> getOrderFlightRecord(Page<FlightOrderDetail> page) {
|
||||
List<FlightOrderDetail> orderRecords = page.getContent();
|
||||
List<FlightOrderDetailExcel> trainOrderDetailExcels = new ArrayList<>();
|
||||
for (FlightOrderDetail orderRecord : orderRecords) {
|
||||
FlightOrderDetailExcel flightOrderDetailExcel = new FlightOrderDetailExcel();
|
||||
BeanUtils.copyProperties(orderRecord, flightOrderDetailExcel);
|
||||
trainOrderDetailExcels.add(flightOrderDetailExcel);
|
||||
}
|
||||
// 构建一个新的 Page<ConsumptionDetailExcel> 对象并返回
|
||||
return new PageImpl<>(trainOrderDetailExcels, page.getPageable(), page.getTotalElements());
|
||||
private Page<FlightOrderDetailExcel> flightPageConsumptionDetail(ConsumptionDetailQuery dto){
|
||||
String query = "SELECT * FROM flight_order_detail "
|
||||
+ "WHERE 1=1 ";
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
PageRequest pageRequest = PageRequest
|
||||
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("create_time").descending());
|
||||
query = getString(dto, query, params, pageRequest);
|
||||
|
||||
String pagedQuery = query + " LIMIT :limit OFFSET :offset";
|
||||
long count = jdbcTemplate.queryForObject("SELECT COUNT(*) FROM (" + query + ") AS count", params, Long.class);
|
||||
List<FlightOrderDetailExcel> results = jdbcTemplate.query(pagedQuery, params, BeanPropertyRowMapper.newInstance(FlightOrderDetailExcel.class));
|
||||
return new PageImpl<>(results, pageRequest, count);
|
||||
}
|
||||
|
||||
public Page<HotelOrderDetailExcel> getOrderHotelRecord(Page<HotelOrderDetail> page) {
|
||||
List<HotelOrderDetail> orderRecords = page.getContent();
|
||||
List<HotelOrderDetailExcel> trainOrderDetailExcels = new ArrayList<>();
|
||||
private Page<HotelOrderDetailExcel> hotelPageConsumptionDetail(ConsumptionDetailQuery dto){
|
||||
String query = "SELECT * FROM hotel_order_detail "
|
||||
+ "WHERE 1=1 ";
|
||||
|
||||
for (HotelOrderDetail orderRecord : orderRecords) {
|
||||
HotelOrderDetailExcel hotelOrderDetailExcel = new HotelOrderDetailExcel();
|
||||
BeanUtils.copyProperties(orderRecord, hotelOrderDetailExcel);
|
||||
List<HotelOrderDetailCustomer> customers=orderRecord.getCustomers();
|
||||
String userNames = customers.stream()
|
||||
.map(HotelOrderDetailCustomer::getUserName) // 获取用户名
|
||||
.collect(Collectors.joining(",")); // 用逗号分隔拼接
|
||||
hotelOrderDetailExcel.setUserName(userNames);
|
||||
trainOrderDetailExcels.add(hotelOrderDetailExcel);
|
||||
}
|
||||
// 构建一个新的 Page<ConsumptionDetailExcel> 对象并返回
|
||||
return new PageImpl<>(trainOrderDetailExcels, page.getPageable(), page.getTotalElements());
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
PageRequest pageRequest = PageRequest
|
||||
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("create_time").descending());
|
||||
query = getString(dto, query, params, pageRequest);
|
||||
|
||||
String pagedQuery = query + " LIMIT :limit OFFSET :offset";
|
||||
long count = jdbcTemplate.queryForObject("SELECT COUNT(*) FROM (" + query + ") AS count", params, Long.class);
|
||||
List<HotelOrderDetailExcel> results = jdbcTemplate.query(pagedQuery, params, BeanPropertyRowMapper.newInstance(HotelOrderDetailExcel.class));
|
||||
return new PageImpl<>(results, pageRequest, count);
|
||||
}
|
||||
|
||||
public Page<CarOrderDetailExcel> getOrderCarRecord(Page<CarOrderDetail> page) {
|
||||
List<CarOrderDetail> orderRecords = page.getContent();
|
||||
List<CarOrderDetailExcel> trainOrderDetailExcels = new ArrayList<>();
|
||||
private Page<CarOrderDetailExcel> carPageConsumptionDetail(ConsumptionDetailQuery dto){
|
||||
String query = "SELECT * FROM car_order_detail "
|
||||
+ "WHERE 1=1 ";
|
||||
|
||||
// 遍历 OrderBaseRecord,将其转换为 ConsumptionDetailExcel
|
||||
for (CarOrderDetail orderRecord : orderRecords) {
|
||||
CarOrderDetailExcel carOrderDetailExcel = new CarOrderDetailExcel();
|
||||
BeanUtils.copyProperties(orderRecord, carOrderDetailExcel);
|
||||
trainOrderDetailExcels.add(carOrderDetailExcel);
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
PageRequest pageRequest = PageRequest
|
||||
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("create_time").descending());
|
||||
|
||||
query = getString(dto, query, params, pageRequest);
|
||||
|
||||
String pagedQuery = query + " LIMIT :limit OFFSET :offset";
|
||||
long count = jdbcTemplate.queryForObject("SELECT COUNT(*) FROM (" + query + ") AS count", params, Long.class);
|
||||
List<CarOrderDetailExcel> results = jdbcTemplate.query(pagedQuery, params, BeanPropertyRowMapper.newInstance(CarOrderDetailExcel.class));
|
||||
return new PageImpl<>(results, pageRequest, count);
|
||||
}
|
||||
|
||||
private static String getString(ConsumptionDetailQuery dto, String query, Map<String, Object> params, PageRequest pageRequest) {
|
||||
if (!dto.getUserName().isEmpty()) {
|
||||
dto.setUserName("%"+ dto.getUserName()+"%");
|
||||
query +="AND user_name LIKE (:userName)";
|
||||
}
|
||||
|
||||
// 构建一个新的 Page<ConsumptionDetailExcel> 对象并返回
|
||||
return new PageImpl<>(trainOrderDetailExcels, page.getPageable(), page.getTotalElements());
|
||||
if (!dto.getOrderIds().isEmpty()) {
|
||||
query +="AND order_id IN (:orderIds)";
|
||||
}
|
||||
|
||||
if (!dto.getOrderNos().isEmpty()) {
|
||||
query +="AND order_no IN (:orderNos)";
|
||||
}
|
||||
|
||||
params.put("userName", dto.getUserName());
|
||||
params.put("orderNos", dto.getOrderNos());
|
||||
params.put("orderIds", dto.getOrderIds());
|
||||
|
||||
params.put("offset", pageRequest.getOffset());
|
||||
params.put("limit", pageRequest.getPageSize());
|
||||
return query;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,20 +98,19 @@ public class ManageServiceImpl implements ManageService {
|
|||
@Override
|
||||
public PageResult<OrderExceedStandardExcel> standardQuery(StandardQuery dto) {
|
||||
//数据权限
|
||||
List<String> orderNos=baseUtil.getOrderNos();
|
||||
if (orderNos==null||orderNos.isEmpty()) {
|
||||
return PageResult.totalPageNum(0, new ArrayList<>());
|
||||
}
|
||||
// List<String> orderNos=baseUtil.getOrderNos();
|
||||
// if (orderNos==null||orderNos.isEmpty()) {
|
||||
// return PageResult.totalPageNum(0, new ArrayList<>());
|
||||
// }
|
||||
|
||||
PageRequest pageRequest = PageRequest
|
||||
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("id").descending());
|
||||
Page<OrderExceedStandard> page=jdbcOrderExceedStandardRepository.findAllByApplicantContainsAndCompanyNameContainsAndActualOrderNoContainsAndOrderNoContainsAndOrderNoIn(dto.getApplicant(),
|
||||
Page<OrderExceedStandard> page=jdbcOrderExceedStandardRepository.findAllByApplicantContainsAndDeptNameContainsAndActualOrderNoContainsAndOrderNoContains(dto.getApplicant(),
|
||||
dto.getCompanyName(),
|
||||
dto.getActualOrderNo(),
|
||||
dto.getOrderNo(),
|
||||
orderNos,
|
||||
// orderNos,
|
||||
pageRequest);
|
||||
|
||||
List<OrderExceedStandardExcel> excelList = getOrderExceedStandardExcels(page);
|
||||
return PageResult.totalPageNum(page.getTotalElements(), excelList);
|
||||
}
|
||||
|
@ -128,10 +127,11 @@ public class ManageServiceImpl implements ManageService {
|
|||
@Override
|
||||
public PageResult<ItineraryPageDto> itineraryPageQuery(ItineraryPageQuery dto) {
|
||||
//数据权限
|
||||
List<Long> routeIds=baseUtil.getRouteIds();
|
||||
if (routeIds==null||routeIds.isEmpty()) {
|
||||
return PageResult.totalPageNum(0, new ArrayList<>());
|
||||
}
|
||||
// List<Long> routeIds=baseUtil.getRouteIds();
|
||||
// if (routeIds==null||routeIds.isEmpty()) {
|
||||
// return PageResult.totalPageNum(0, new ArrayList<>());
|
||||
// }
|
||||
// dto.setRouteIds(routeIds);
|
||||
|
||||
List<User> users=new ArrayList<>();
|
||||
if (!dto.getApplicant().isEmpty()){
|
||||
|
@ -140,7 +140,6 @@ public class ManageServiceImpl implements ManageService {
|
|||
return PageResult.totalPageNum(0, new ArrayList<>());
|
||||
}
|
||||
}
|
||||
dto.setRouteIds(routeIds);
|
||||
dto.setUserIds(users.stream().map(User::getEmployeeNo).toList());
|
||||
Page<ItineraryPageDto> page= jdbcConsumptionDetailRepository.itineraryPageQueryByDto(dto);
|
||||
//处理信息
|
||||
|
@ -180,11 +179,11 @@ public class ManageServiceImpl implements ManageService {
|
|||
@Override
|
||||
public PageResult<OrderPageExcel> orderPageQuery(OrderPageQuery dto) {
|
||||
//数据权限
|
||||
List<Long> dataRouteIds=baseUtil.getRouteIds();
|
||||
if (dataRouteIds==null||dataRouteIds.isEmpty()) {
|
||||
return PageResult.totalPageNum(0, new ArrayList<>());
|
||||
}
|
||||
dto.setRouteIds(dataRouteIds);
|
||||
// List<Long> dataRouteIds=baseUtil.getRouteIds();
|
||||
// if (dataRouteIds==null||dataRouteIds.isEmpty()) {
|
||||
// return PageResult.totalPageNum(0, new ArrayList<>());
|
||||
// }
|
||||
// dto.setRouteIds(dataRouteIds);
|
||||
|
||||
//预订人
|
||||
if (!dto.getApplicant().equals("")){
|
||||
|
@ -212,7 +211,7 @@ public class ManageServiceImpl implements ManageService {
|
|||
}
|
||||
//部门
|
||||
if (dto.getBelongDeptCode() != null && !dto.getBelongDeptCode().isEmpty()) {
|
||||
List<RouteOrderExtensionField> routeOrderExtensionFields = jdbcRouteOrderExtensionFieldRepository.findByBelongDeptCodeIn(dto.getBelongDeptCode());
|
||||
List<RouteOrderExtensionField> routeOrderExtensionFields = jdbcRouteOrderExtensionFieldRepository.findByCondition(dto.getBelongDeptCode());
|
||||
if (routeOrderExtensionFields == null || routeOrderExtensionFields.isEmpty()) {
|
||||
return PageResult.totalPageNum(0, new ArrayList<>());
|
||||
}
|
||||
|
|
|
@ -31,18 +31,18 @@ public class BaseUtil {
|
|||
public List<Long> getRouteIds(){
|
||||
List<String> list = BaseContext.getCurrentUser().loadRoleOrg().getRoleOrgList()
|
||||
.stream().filter(s->s.getOrgShortCode()!=null).map(SystemOrganizationVO::getOrgShortCode).toList();
|
||||
List<RouteOrderExtensionField> result=jdbcRouteOrderExtensionFieldRepository.findByBelongDeptCodeIn(list);
|
||||
List<RouteOrderExtensionField> result=jdbcRouteOrderExtensionFieldRepository.findByCondition(list);
|
||||
return result.stream().map(RouteOrderExtensionField::getRouteId).toList();
|
||||
}
|
||||
|
||||
public List<Long> getOrderIds(){
|
||||
List<Long> routeIds = getRouteIds();
|
||||
return jdbcOrderDetailRepository.findAllByRouteIdIn(routeIds).stream().map(OrderDetail::getOrderId).toList();
|
||||
return jdbcOrderDetailRepository.findAllOrderId(routeIds);
|
||||
}
|
||||
|
||||
public List<String> getOrderNos(){
|
||||
List<Long> routeIds = getRouteIds();
|
||||
return jdbcOrderDetailRepository.findAllByRouteIdIn(routeIds).stream().map(OrderDetail::getOrderNo).toList();
|
||||
return jdbcOrderDetailRepository.findAllOrderNo(routeIds);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -39,7 +39,7 @@ public class DataJdbcCreatorUtil {
|
|||
*/
|
||||
private List<String> getTables() throws SQLException {
|
||||
List<String> tables = new ArrayList<String>();
|
||||
tables.add("route_order_extension_field");
|
||||
tables.add("route_order");
|
||||
return tables;
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ public class DataJdbcCreatorUtil {
|
|||
temp = tables[i].trim();
|
||||
sb.append(temp.substring(0, 1).toUpperCase()).append(temp.substring(1));
|
||||
}
|
||||
beanName = sb.toString();
|
||||
beanName = sb.toString()+"Basic";
|
||||
mapperName = "Jdbc"+beanName + "Repository";
|
||||
_mapperName = shotFirst(mapperName);
|
||||
serviceName = beanName + "Service";
|
||||
|
|
Loading…
Reference in New Issue