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