diff --git a/src/main/java/com/chint/manage/controller/ManageController.java b/src/main/java/com/chint/manage/controller/ManageController.java index 3991a3ae..54fda7a6 100644 --- a/src/main/java/com/chint/manage/controller/ManageController.java +++ b/src/main/java/com/chint/manage/controller/ManageController.java @@ -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> orderPageQuery(@RequestBody ItineraryPageQuery dto){ + public Result> 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; } diff --git a/src/main/java/com/chint/manage/entity/dto/ItineraryPageDto.java b/src/main/java/com/chint/manage/entity/dto/ItineraryPageDto.java new file mode 100644 index 00000000..85d034ed --- /dev/null +++ b/src/main/java/com/chint/manage/entity/dto/ItineraryPageDto.java @@ -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 approveEvents; + + private String approvalStatus; + + private List legItems; + + //差旅订单总价值 + private List 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); + } +} diff --git a/src/main/java/com/chint/manage/entity/dto/OrderPageDto.java b/src/main/java/com/chint/manage/entity/dto/OrderPageDto.java index 2986af22..9ed1d93e 100644 --- a/src/main/java/com/chint/manage/entity/dto/OrderPageDto.java +++ b/src/main/java/com/chint/manage/entity/dto/OrderPageDto.java @@ -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 approveEvents; - - private String approvalStatus; - - private List legItems; - - //差旅订单总价值 - private List 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; } diff --git a/src/main/java/com/chint/manage/entity/query/OrderPageQuery.java b/src/main/java/com/chint/manage/entity/query/OrderPageQuery.java new file mode 100644 index 00000000..f3e08024 --- /dev/null +++ b/src/main/java/com/chint/manage/entity/query/OrderPageQuery.java @@ -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 userIds=new ArrayList<>(); +} diff --git a/src/main/java/com/chint/manage/mapper/JdbcConsumptionDetailRepository.java b/src/main/java/com/chint/manage/mapper/JdbcConsumptionDetailRepository.java index b70e6520..62adc392 100644 --- a/src/main/java/com/chint/manage/mapper/JdbcConsumptionDetailRepository.java +++ b/src/main/java/com/chint/manage/mapper/JdbcConsumptionDetailRepository.java @@ -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 orderPageQueryByDto(ItineraryPageQuery dto); + Page orderPageQueryByDto(ItineraryPageQuery dto); PageResult pageConsumptionDetail(ConsumptionDetailQuery dto); } \ No newline at end of file diff --git a/src/main/java/com/chint/manage/mapper/impl/JdbcConsumptionDetailRepositoryImpl.java b/src/main/java/com/chint/manage/mapper/impl/JdbcConsumptionDetailRepositoryImpl.java index eafd47c6..664b25e4 100644 --- a/src/main/java/com/chint/manage/mapper/impl/JdbcConsumptionDetailRepositoryImpl.java +++ b/src/main/java/com/chint/manage/mapper/impl/JdbcConsumptionDetailRepositoryImpl.java @@ -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 orderPageQueryByDto(ItineraryPageQuery dto) { + public Page 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 results = jdbcTemplate.query(pagedQuery, params, BeanPropertyRowMapper.newInstance(OrderPageDto.class)); + List 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); diff --git a/src/main/java/com/chint/manage/service/ManageService.java b/src/main/java/com/chint/manage/service/ManageService.java index 1247e18b..bf840dcf 100644 --- a/src/main/java/com/chint/manage/service/ManageService.java +++ b/src/main/java/com/chint/manage/service/ManageService.java @@ -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 orderPageQuery(ItineraryPageQuery dto); + PageResult orderPageQuery(ItineraryPageQuery dto); } diff --git a/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java b/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java index 6d48bb0e..34e23d31 100644 --- a/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java +++ b/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java @@ -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 orderPageQuery(ItineraryPageQuery dto) { + public PageResult orderPageQuery(ItineraryPageQuery dto) { List users=jdbcUserRepository.findAllByNameContains(dto.getApplicant()); if (users==null||users.isEmpty()){ return null; } dto.setUserIds(users.stream().map(User::getEmployeeNo).toList()); - Page page= jdbcConsumptionDetailRepository.orderPageQueryByDto(dto); + Page page= jdbcConsumptionDetailRepository.orderPageQueryByDto(dto); //处理信息 - List list=page.getContent(); + List list=page.getContent(); //查询行程和审批单信息 - List routeIdList=list.stream().map(OrderPageDto::getRouteId).toList(); + List routeIdList=list.stream().map(ItineraryPageDto::getRouteId).toList(); List routeOrders=jdbcRouteRepository.findByRouteIdIn(routeIdList); - List orders = list + List 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 legItems=res.getLegItems(); List locationRes = legItems .stream() diff --git a/src/test/java/com/chint/ManageTest.java b/src/test/java/com/chint/ManageTest.java index 3c4c444b..4ab051e7 100644 --- a/src/test/java/com/chint/ManageTest.java +++ b/src/test/java/com/chint/ManageTest.java @@ -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 page= jdbcConsumptionDetailRepository.orderPageQueryByDto(dto); + Page page= jdbcConsumptionDetailRepository.orderPageQueryByDto(dto); System.out.println(page); }