From 5cf36c89a641c654c9a229aea11585386a8f2006 Mon Sep 17 00:00:00 2001
From: Cui Zhi Feng <7426394+wuxixiaocui@user.noreply.gitee.com>
Date: 星期五, 13 九月 2024 10:17:08 +0800
Subject: [PATCH] 查询我的集货站列表 参数
---
src/main/java/com/mzl/flower/mapper/payment/DeliveryOrderMapper.java | 3 ++-
src/main/java/com/mzl/flower/web/payment/DeliveryOrderController.java | 31 +++++++++++++++++++++----------
src/main/java/com/mzl/flower/service/payment/DeliveryOrderService.java | 12 +++++++-----
src/main/resources/mapper/payment/DeliveryOrderMapper.xml | 10 +++++++---
4 files changed, 37 insertions(+), 19 deletions(-)
diff --git a/src/main/java/com/mzl/flower/mapper/payment/DeliveryOrderMapper.java b/src/main/java/com/mzl/flower/mapper/payment/DeliveryOrderMapper.java
index 5ed5364..aacaae1 100644
--- a/src/main/java/com/mzl/flower/mapper/payment/DeliveryOrderMapper.java
+++ b/src/main/java/com/mzl/flower/mapper/payment/DeliveryOrderMapper.java
@@ -38,7 +38,8 @@
List<StationStatisticDTO> statisticStationList(@Param("startDate") LocalDateTime startDate,
@Param("endDate")LocalDateTime endDate,
@Param("name") String name,
- @Param("userId") String userId);
+ @Param("userId") String userId,
+ @Param("statusList") List<String> statusList);
List<DeliveryOrder> selectSupplierDoEntity4Check(@Param("supplierId") Long supplierId
, @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate);
diff --git a/src/main/java/com/mzl/flower/service/payment/DeliveryOrderService.java b/src/main/java/com/mzl/flower/service/payment/DeliveryOrderService.java
index 16ab844..fb22949 100644
--- a/src/main/java/com/mzl/flower/service/payment/DeliveryOrderService.java
+++ b/src/main/java/com/mzl/flower/service/payment/DeliveryOrderService.java
@@ -479,17 +479,19 @@
return dto;
}
- public List<StationStatisticDTO> statisticStationList(String name, LocalDateTime startDate, LocalDateTime endDate) {
+ public List<StationStatisticDTO> statisticStationList(String name, LocalDateTime startDate
+ , LocalDateTime endDate, String status) {
String userId = SecurityUtils.getUserId();
LambdaQueryWrapper<Station> lambdaQueryWrapper = new LambdaQueryWrapper<>();
- lambdaQueryWrapper.like(Station::getUserIds, userId);
+ lambdaQueryWrapper.like(Station::getUserIds, "%" + userId + "%");
lambdaQueryWrapper.eq(Station::getType, "0");
- boolean hasZc = stationMapper.selectCount(lambdaQueryWrapper)>0;//当前用户是否有总仓权限,总仓能查看到所有集货站的数据
+ boolean hasZc = stationMapper.selectCount(lambdaQueryWrapper) > 0;//当前用户是否有总仓权限,总仓能查看到所有集货站的数据
+ List<String> statusList = splitParam(status);
if(hasZc){
- List<StationStatisticDTO> stationStatisticDTOS = deliveryOrderMapper.statisticStationList(startDate, endDate,name,null);
+ List<StationStatisticDTO> stationStatisticDTOS = deliveryOrderMapper.statisticStationList(startDate, endDate,name,null, statusList);
return stationStatisticDTOS;
}else{
- List<StationStatisticDTO> stationStatisticDTOS = deliveryOrderMapper.statisticStationList(startDate, endDate,name,userId);
+ List<StationStatisticDTO> stationStatisticDTOS = deliveryOrderMapper.statisticStationList(startDate, endDate, name, userId, statusList);
return stationStatisticDTOS;
}
}
diff --git a/src/main/java/com/mzl/flower/web/payment/DeliveryOrderController.java b/src/main/java/com/mzl/flower/web/payment/DeliveryOrderController.java
index 9ed9801..d1e7b97 100644
--- a/src/main/java/com/mzl/flower/web/payment/DeliveryOrderController.java
+++ b/src/main/java/com/mzl/flower/web/payment/DeliveryOrderController.java
@@ -37,20 +37,31 @@
@GetMapping("/station/list")
@ApiOperation(value = "查询我的集货站列表")
- public ResponseEntity<ReturnDataDTO<List<StationStatisticDTO>>> statisticStationList(String name){
- LocalDateTime now = LocalDateTime.now();
- LocalDateTime towAm = LocalDate.now().atTime(2, 0, 0);
- LocalDateTime fivePm = LocalDate.now().atTime(17, 0, 0);
+ public ResponseEntity<ReturnDataDTO<List<StationStatisticDTO>>> statisticStationList(String name
+ , String status, String date){
+ /*if(StringUtils.isEmpty(date)){
+ throw new ValidationException("请选择日期");
+ }*/
LocalDateTime startDate;
LocalDateTime endDate;
- if(now.isAfter(towAm)){
- startDate = fivePm.plusDays(-1);
- endDate = fivePm;
+ LocalDate localDate = deliveryOrderService.parseLocalDate(date);
+ if(localDate != null){
+ endDate = localDate.atTime(17, 0, 0);
+ startDate = endDate.plusDays(-1);
} else {
- startDate = fivePm.plusDays(-2);
- endDate = fivePm.plusDays(-1);
+ LocalDateTime now = LocalDateTime.now();
+ LocalDateTime towAm = LocalDate.now().atTime(2, 0, 0);
+ LocalDateTime fivePm = LocalDate.now().atTime(17, 0, 0);
+ if(now.isAfter(towAm)){
+ startDate = fivePm.plusDays(-1);
+ endDate = fivePm;
+ } else {
+ startDate = fivePm.plusDays(-2);
+ endDate = fivePm.plusDays(-1);
+ }
}
- return returnData(R.SUCCESS.getCode(), deliveryOrderService.statisticStationList(name,startDate,endDate));
+
+ return returnData(R.SUCCESS.getCode(), deliveryOrderService.statisticStationList(name, startDate, endDate, status));
}
diff --git a/src/main/resources/mapper/payment/DeliveryOrderMapper.xml b/src/main/resources/mapper/payment/DeliveryOrderMapper.xml
index f6d68af..7d64fcf 100644
--- a/src/main/resources/mapper/payment/DeliveryOrderMapper.xml
+++ b/src/main/resources/mapper/payment/DeliveryOrderMapper.xml
@@ -218,10 +218,14 @@
<if test="endDate != null">
AND o.create_time <= #{endDate}
</if>
- GROUP BY
- s.station_id,
- st.`name`;
+ <if test="statusList != null and statusList.size > 0">
+ AND o.status in
+ <foreach collection="statusList" item="status" open="(" separator="," close=")">
+ #{status}
+ </foreach>
+ </if>
+ GROUP BY s.station_id, st.`name`
</select>
<update id="setDeliveryOrderPending">
--
Gitblit v1.9.3