【add】后台管理模块订单接口部分实体类新增
This commit is contained in:
parent
5fce77d120
commit
6e10545c36
|
@ -2,11 +2,12 @@ package com.chint.manage.controller;
|
|||
|
||||
import com.chint.infrastructure.util.PageResult;
|
||||
import com.chint.infrastructure.util.Result;
|
||||
import com.chint.manage.entity.dto.OrderPageDto;
|
||||
import com.chint.manage.entity.dto.ItineraryPageDto;
|
||||
import com.chint.manage.entity.excel.BaseExcel;
|
||||
import com.chint.manage.entity.excel.OrderExceedStandardExcel;
|
||||
import com.chint.manage.entity.query.ConsumptionDetailQuery;
|
||||
import com.chint.manage.entity.query.ItineraryPageQuery;
|
||||
import com.chint.manage.entity.query.OrderPageQuery;
|
||||
import com.chint.manage.entity.query.StandardQuery;
|
||||
import com.chint.manage.service.ManageService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
@ -86,7 +87,7 @@ public class ManageController {
|
|||
|
||||
@ApiOperation("行程单分页查询接口")
|
||||
@PostMapping("/itinerary/pageQuery")
|
||||
public Result<PageResult<OrderPageDto>> orderPageQuery(@RequestBody ItineraryPageQuery dto){
|
||||
public Result<PageResult<ItineraryPageDto>> orderPageQuery(@RequestBody ItineraryPageQuery dto){
|
||||
return Result.Success(SUCCESS,manageService.orderPageQuery(dto));
|
||||
}
|
||||
|
||||
|
@ -94,7 +95,7 @@ public class ManageController {
|
|||
|
||||
@ApiOperation("订单分页查询接口")
|
||||
@PostMapping("/order/pageQuery")
|
||||
public Result<?> orderPage(@RequestBody ItineraryPageQuery dto){
|
||||
public Result<?> orderPageQuery(@RequestBody OrderPageQuery dto){
|
||||
//订单查询 order_detail 行程号改为申请单号 任务创建创建生成记录 异步生成 完成之后再开发下载
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
package com.chint.manage.entity.dto;
|
||||
|
||||
import com.chint.application.dtos.response.LocationRes;
|
||||
import com.chint.domain.aggregates.order.ApprovalEvent;
|
||||
import com.chint.domain.aggregates.order.Leg;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ItineraryPageDto {
|
||||
private Long routeId;
|
||||
//差旅订单单号
|
||||
private String routeOrderNo;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime startTime;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime endTime;
|
||||
private String userId;
|
||||
private String userName;
|
||||
//差标等级
|
||||
private String standardLevel;
|
||||
//申请说明
|
||||
private String instructions;
|
||||
private String actualOrderNo;
|
||||
private List<ApprovalEvent> approveEvents;
|
||||
|
||||
private String approvalStatus;
|
||||
|
||||
private List<Leg> legItems;
|
||||
|
||||
//差旅订单总价值
|
||||
private List<LocationRes> locationResList;
|
||||
|
||||
public String getApprovalStatus() {
|
||||
if (this.approveEvents != null && !this.approveEvents.isEmpty()) {
|
||||
ApprovalEvent lastApprovalEvent = getLastApprovalEvent();
|
||||
if (lastApprovalEvent != null) {
|
||||
lastApprovalEvent.reloadStatus();
|
||||
this.approvalStatus = lastApprovalEvent.getEventName();
|
||||
}
|
||||
}
|
||||
return approvalStatus;
|
||||
}
|
||||
private ApprovalEvent getLastApprovalEvent() {
|
||||
return this.approveEvents.isEmpty() ? null : this.approveEvents.get(this.approveEvents.size() - 1);
|
||||
}
|
||||
}
|
|
@ -1,50 +1,20 @@
|
|||
package com.chint.manage.entity.dto;
|
||||
|
||||
import com.chint.application.dtos.response.LocationRes;
|
||||
import com.chint.domain.aggregates.order.ApprovalEvent;
|
||||
import com.chint.domain.aggregates.order.Leg;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class OrderPageDto {
|
||||
private Long routeId;
|
||||
//差旅订单单号
|
||||
private String routeOrderNo;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private String orderNo;
|
||||
private String supplierName;
|
||||
private Integer productType;
|
||||
private String price; // 价格
|
||||
private String employeeNo;
|
||||
private LocalDateTime orderDate;
|
||||
private LocalDateTime startTime;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime endTime;
|
||||
private String userId;
|
||||
private String userName;
|
||||
//差标等级
|
||||
private String standardLevel;
|
||||
//申请说明
|
||||
private String instructions;
|
||||
private String actualOrderNo;
|
||||
private List<ApprovalEvent> approveEvents;
|
||||
|
||||
private String approvalStatus;
|
||||
|
||||
private List<Leg> legItems;
|
||||
|
||||
//差旅订单总价值
|
||||
private List<LocationRes> locationResList;
|
||||
|
||||
public String getApprovalStatus() {
|
||||
if (this.approveEvents != null && !this.approveEvents.isEmpty()) {
|
||||
ApprovalEvent lastApprovalEvent = getLastApprovalEvent();
|
||||
if (lastApprovalEvent != null) {
|
||||
lastApprovalEvent.reloadStatus();
|
||||
this.approvalStatus = lastApprovalEvent.getEventName();
|
||||
}
|
||||
}
|
||||
return approvalStatus;
|
||||
}
|
||||
private ApprovalEvent getLastApprovalEvent() {
|
||||
return this.approveEvents.isEmpty() ? null : this.approveEvents.get(this.approveEvents.size() - 1);
|
||||
}
|
||||
private LocalDateTime createTime;
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package com.chint.manage.entity.query;
|
||||
|
||||
import com.chint.domain.value_object.BaseQuery;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class OrderPageQuery extends BaseQuery {
|
||||
//订单号
|
||||
private String oderNo;
|
||||
//申请单号
|
||||
private String actualOrderNo;
|
||||
//出行人
|
||||
private String travelers;
|
||||
//预订人
|
||||
private String applicant;
|
||||
//开始日期
|
||||
private String startTime;
|
||||
//结束日期
|
||||
private String endTime;
|
||||
//产品类型
|
||||
private String productType;
|
||||
//部门名称
|
||||
private String deptName;
|
||||
private List<String> userIds=new ArrayList<>();
|
||||
}
|
|
@ -1,14 +1,14 @@
|
|||
package com.chint.manage.mapper;
|
||||
|
||||
import com.chint.infrastructure.util.PageResult;
|
||||
import com.chint.manage.entity.dto.OrderPageDto;
|
||||
import com.chint.manage.entity.dto.ItineraryPageDto;
|
||||
import com.chint.manage.entity.excel.BaseExcel;
|
||||
import com.chint.manage.entity.query.ConsumptionDetailQuery;
|
||||
import com.chint.manage.entity.query.ItineraryPageQuery;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
||||
public interface JdbcConsumptionDetailRepository {
|
||||
Page<OrderPageDto> orderPageQueryByDto(ItineraryPageQuery dto);
|
||||
Page<ItineraryPageDto> orderPageQueryByDto(ItineraryPageQuery dto);
|
||||
|
||||
PageResult<? extends BaseExcel> pageConsumptionDetail(ConsumptionDetailQuery dto);
|
||||
}
|
|
@ -2,7 +2,7 @@ package com.chint.manage.mapper.impl;
|
|||
|
||||
import com.chint.domain.aggregates.order.*;
|
||||
import com.chint.infrastructure.util.PageResult;
|
||||
import com.chint.manage.entity.dto.OrderPageDto;
|
||||
import com.chint.manage.entity.dto.ItineraryPageDto;
|
||||
import com.chint.manage.entity.query.ConsumptionDetailQuery;
|
||||
import com.chint.manage.entity.query.ItineraryPageQuery;
|
||||
import com.chint.manage.entity.excel.*;
|
||||
|
@ -44,7 +44,7 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai
|
|||
|
||||
|
||||
@Override
|
||||
public Page<OrderPageDto> orderPageQueryByDto(ItineraryPageQuery dto) {
|
||||
public Page<ItineraryPageDto> orderPageQueryByDto(ItineraryPageQuery dto) {
|
||||
String query = "SELECT * FROM route_order " +
|
||||
"WHERE 1 = 1 " +
|
||||
"AND (:actualOrderNo IS NULL OR actual_order_no = :actualOrderNo ) ";
|
||||
|
@ -63,7 +63,7 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai
|
|||
|
||||
String pagedQuery = query + " LIMIT :limit OFFSET :offset";
|
||||
|
||||
List<OrderPageDto> results = jdbcTemplate.query(pagedQuery, params, BeanPropertyRowMapper.newInstance(OrderPageDto.class));
|
||||
List<ItineraryPageDto> results = jdbcTemplate.query(pagedQuery, params, BeanPropertyRowMapper.newInstance(ItineraryPageDto.class));
|
||||
long count = jdbcTemplate.queryForObject("SELECT COUNT(*) FROM (" + query + ") AS count", params, Long.class);
|
||||
|
||||
return new PageImpl<>(results, pageRequest, count);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.chint.manage.service;
|
||||
|
||||
import com.chint.infrastructure.util.PageResult;
|
||||
import com.chint.manage.entity.dto.OrderPageDto;
|
||||
import com.chint.manage.entity.dto.ItineraryPageDto;
|
||||
import com.chint.manage.entity.query.ConsumptionDetailQuery;
|
||||
import com.chint.manage.entity.query.ItineraryPageQuery;
|
||||
import com.chint.manage.entity.query.StandardQuery;
|
||||
|
@ -25,5 +25,5 @@ public interface ManageService {
|
|||
|
||||
File standardExport(StandardQuery dto);
|
||||
|
||||
PageResult<OrderPageDto> orderPageQuery(ItineraryPageQuery dto);
|
||||
PageResult<ItineraryPageDto> orderPageQuery(ItineraryPageQuery dto);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import com.chint.infrastructure.repository.jdbc.JdbcRouteRepository;
|
|||
import com.chint.infrastructure.repository.jdbc.JdbcUserRepository;
|
||||
import com.chint.infrastructure.util.PageResult;
|
||||
import com.chint.manage.entity.OrderExceedStandard;
|
||||
import com.chint.manage.entity.dto.OrderPageDto;
|
||||
import com.chint.manage.entity.dto.ItineraryPageDto;
|
||||
import com.chint.manage.entity.excel.BaseExcel;
|
||||
import com.chint.manage.entity.excel.OrderExceedStandardExcel;
|
||||
import com.chint.manage.entity.query.ConsumptionDetailQuery;
|
||||
|
@ -83,20 +83,20 @@ public class ManageServiceImpl implements ManageService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public PageResult<OrderPageDto> orderPageQuery(ItineraryPageQuery dto) {
|
||||
public PageResult<ItineraryPageDto> orderPageQuery(ItineraryPageQuery dto) {
|
||||
List<User> users=jdbcUserRepository.findAllByNameContains(dto.getApplicant());
|
||||
if (users==null||users.isEmpty()){
|
||||
return null;
|
||||
}
|
||||
dto.setUserIds(users.stream().map(User::getEmployeeNo).toList());
|
||||
Page<OrderPageDto> page= jdbcConsumptionDetailRepository.orderPageQueryByDto(dto);
|
||||
Page<ItineraryPageDto> page= jdbcConsumptionDetailRepository.orderPageQueryByDto(dto);
|
||||
//处理信息
|
||||
List<OrderPageDto> list=page.getContent();
|
||||
List<ItineraryPageDto> list=page.getContent();
|
||||
//查询行程和审批单信息
|
||||
List<Long> routeIdList=list.stream().map(OrderPageDto::getRouteId).toList();
|
||||
List<Long> routeIdList=list.stream().map(ItineraryPageDto::getRouteId).toList();
|
||||
List<RouteOrder> routeOrders=jdbcRouteRepository.findByRouteIdIn(routeIdList);
|
||||
|
||||
List<OrderPageDto> orders = list
|
||||
List<ItineraryPageDto> orders = list
|
||||
.stream()
|
||||
.map(routeOrder -> {
|
||||
RouteOrder order=routeOrders.stream().filter(s->s.getRouteId().equals(routeOrder.getRouteId())).toList().get(0);
|
||||
|
@ -125,7 +125,7 @@ public class ManageServiceImpl implements ManageService {
|
|||
return excelList;
|
||||
}
|
||||
|
||||
private static OrderPageDto getRouteOrderPageRes(OrderPageDto res, User user) {
|
||||
private static ItineraryPageDto getRouteOrderPageRes(ItineraryPageDto res, User user) {
|
||||
List<Leg> legItems=res.getLegItems();
|
||||
List<LocationRes> locationRes = legItems
|
||||
.stream()
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.chint.domain.aggregates.order.OrderDetail;
|
|||
import com.chint.infrastructure.repository.jdbc.JdbcOrderDetailRepository;
|
||||
import com.chint.infrastructure.util.PageResult;
|
||||
import com.chint.manage.entity.OrderExceedStandard;
|
||||
import com.chint.manage.entity.dto.OrderPageDto;
|
||||
import com.chint.manage.entity.dto.ItineraryPageDto;
|
||||
import com.chint.manage.entity.excel.BaseExcel;
|
||||
import com.chint.manage.entity.query.ConsumptionDetailQuery;
|
||||
import com.chint.manage.entity.query.ItineraryPageQuery;
|
||||
|
@ -33,7 +33,7 @@ public class ManageTest {
|
|||
@Test
|
||||
void pageQuery(){
|
||||
ItineraryPageQuery dto=new ItineraryPageQuery();
|
||||
Page<OrderPageDto> page= jdbcConsumptionDetailRepository.orderPageQueryByDto(dto);
|
||||
Page<ItineraryPageDto> page= jdbcConsumptionDetailRepository.orderPageQueryByDto(dto);
|
||||
System.out.println(page);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue