From d63bfb6b21bfa56aec3c7a545e7d09682c6b60e0 Mon Sep 17 00:00:00 2001 From: nixj Date: Tue, 14 May 2024 14:36:50 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90update=E3=80=91=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=BF=94=E5=9B=9E=E6=A0=BC=E5=BC=8F=E4=B8=BA?= =?UTF-8?q?Result=EF=BC=8C=E8=A1=8C=E7=A8=8B=E5=8D=95=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E4=BA=BA=E7=AD=9B=E9=80=89=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/jdbc/JdbcUserRepository.java | 2 ++ .../chint/manage/controller/ManageController.java | 12 +++++++----- .../chint/manage/entity/query/OrderPageQuery.java | 2 +- .../impl/JdbcConsumptionDetailRepositoryImpl.java | 1 + .../com/chint/manage/service/ManageService.java | 2 +- .../manage/service/impl/ManageServiceImpl.java | 13 ++++++++++--- 6 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcUserRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcUserRepository.java index 8bca63ad..87721ccc 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcUserRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcUserRepository.java @@ -13,4 +13,6 @@ public interface JdbcUserRepository extends CrudRepository { List findByStatus(Integer status); List findByStatusIsNull(); + + List findAllByNameContains(String name); } diff --git a/src/main/java/com/chint/manage/controller/ManageController.java b/src/main/java/com/chint/manage/controller/ManageController.java index 6d456235..483ca333 100644 --- a/src/main/java/com/chint/manage/controller/ManageController.java +++ b/src/main/java/com/chint/manage/controller/ManageController.java @@ -25,6 +25,8 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; +import static com.chint.dama.dc.basic.Result.SUCCESS; + @Slf4j @RestController @RequestMapping("/manage") @@ -36,8 +38,8 @@ public class ManageController { @ApiOperation("消费明细查询接口") @PostMapping("/query") - public PageResult query(@RequestBody ConsumptionDetailQuery dto){ - return manageService.pageConsumptionDetail(dto); + public Result> query(@RequestBody ConsumptionDetailQuery dto){ + return Result.Success(SUCCESS,manageService.pageConsumptionDetail(dto)); } @ApiOperation("消费明细导出接口") @@ -60,8 +62,8 @@ public class ManageController { @ApiOperation("超标报表查询接口") @PostMapping("/standard/query") - public PageResult standardQuery(@RequestBody StandardQuery dto){ - return manageService.standardQuery(dto); + public Result> standardQuery(@RequestBody StandardQuery dto){ + return Result.Success(SUCCESS,manageService.standardQuery(dto)); } @ApiOperation("超标报表导出接口") @@ -85,7 +87,7 @@ public class ManageController { @ApiOperation("行程单查询接口") @PostMapping("/order/pageQuery") public Result> orderPageQuery(@RequestBody OrderPageQuery dto){ - return manageService.orderPageQuery(dto); + return Result.Success(SUCCESS,manageService.orderPageQuery(dto)); } } diff --git a/src/main/java/com/chint/manage/entity/query/OrderPageQuery.java b/src/main/java/com/chint/manage/entity/query/OrderPageQuery.java index 22345f3e..319a9099 100644 --- a/src/main/java/com/chint/manage/entity/query/OrderPageQuery.java +++ b/src/main/java/com/chint/manage/entity/query/OrderPageQuery.java @@ -8,7 +8,7 @@ import java.util.List; @Data public class OrderPageQuery extends BaseQuery { - private String supplierName;// 申请人 + private String applicant;// 申请人 private String actualOrderNo; //申请单号 private List userIds=new ArrayList<>(); } 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 16eefa9f..9b2ef5b7 100644 --- a/src/main/java/com/chint/manage/mapper/impl/JdbcConsumptionDetailRepositoryImpl.java +++ b/src/main/java/com/chint/manage/mapper/impl/JdbcConsumptionDetailRepositoryImpl.java @@ -55,6 +55,7 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai Map params = new HashMap<>(); params.put("actualOrderNo", dto.getActualOrderNo()); + params.put("userIds", dto.getUserIds()); PageRequest pageRequest = PageRequest .of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("route_id").descending()); params.put("offset", pageRequest.getOffset()); diff --git a/src/main/java/com/chint/manage/service/ManageService.java b/src/main/java/com/chint/manage/service/ManageService.java index 66c46e42..e0489100 100644 --- a/src/main/java/com/chint/manage/service/ManageService.java +++ b/src/main/java/com/chint/manage/service/ManageService.java @@ -27,5 +27,5 @@ public interface ManageService { File standardExport(StandardQuery dto); - Result> orderPageQuery(OrderPageQuery dto); + PageResult orderPageQuery(OrderPageQuery 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 5b660f01..07fa2787 100644 --- a/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java +++ b/src/main/java/com/chint/manage/service/impl/ManageServiceImpl.java @@ -7,6 +7,7 @@ import com.chint.domain.aggregates.user.User; import com.chint.domain.repository.UserRepository; import com.chint.domain.service.LegDomainService; import com.chint.infrastructure.repository.jdbc.JdbcRouteRepository; +import com.chint.infrastructure.repository.jdbc.JdbcUserRepository; import com.chint.infrastructure.util.PageResult; import com.chint.infrastructure.util.Result; import com.chint.manage.entity.OrderExceedStandard; @@ -52,6 +53,8 @@ public class ManageServiceImpl implements ManageService { private UserRepository userRepository; @Autowired private JdbcRouteRepository jdbcRouteRepository; + @Autowired + private JdbcUserRepository jdbcUserRepository; @Override public PageResult pageConsumptionDetail(ConsumptionDetailQuery dto) { @@ -83,8 +86,12 @@ public class ManageServiceImpl implements ManageService { } @Override - public Result> orderPageQuery(OrderPageQuery dto) { - + public PageResult orderPageQuery(OrderPageQuery 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); //处理信息 List list=page.getContent(); @@ -103,7 +110,7 @@ public class ManageServiceImpl implements ManageService { return getRouteOrderPageRes(routeOrder, user); }) .toList(); - return Result.Success(SUCCESS,PageResult.totalPageNum(page.getTotalElements(), orders)); + return PageResult.totalPageNum(page.getTotalElements(), orders); } private static List getOrderExceedStandardExcels(Page page) {