|
@@ -3,14 +3,24 @@ package com.charging.chargingparking.modules.backController;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.charging.chargingparking.dto.MessageResult;
|
|
|
+import com.charging.chargingparking.dto.PojoUtils;
|
|
|
+import com.charging.chargingparking.entity.ParkingInfo;
|
|
|
import com.charging.chargingparking.entity.ParkingPay;
|
|
|
+import com.charging.chargingparking.entity.ParkingRecord;
|
|
|
+import com.charging.chargingparking.modules.common.dto.Sort;
|
|
|
+import com.charging.chargingparking.service.ParkingInfoService;
|
|
|
import com.charging.chargingparking.service.ParkingPayService;
|
|
|
+import com.charging.chargingparking.service.ParkingRecordService;
|
|
|
+import com.charging.chargingparking.utils.StringUtils;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -22,6 +32,9 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
@RequestMapping("/backParkingPay")
|
|
|
public class BackParkingPayController {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ParkingRecordService parkingRecordService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private ParkingPayService parkingPayService;
|
|
|
|
|
@@ -45,4 +58,61 @@ public class BackParkingPayController {
|
|
|
|
|
|
return messageResult;
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value = "列表")
|
|
|
+ @RequestMapping(value = "pageList", method = RequestMethod.POST)
|
|
|
+ public MessageResult<Map> pageList(
|
|
|
+ String carNum, String payTimeRange,
|
|
|
+ @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "20") int pageSize,
|
|
|
+ @RequestAttribute String subject) {
|
|
|
+
|
|
|
+
|
|
|
+ //当前用户ID
|
|
|
+ System.out.println(subject);
|
|
|
+
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ Map<String, Object> searchParams = new HashMap<>();
|
|
|
+
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("a.create_time", "desc"));
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(carNum)) {
|
|
|
+ searchParams.put("carNum", "%" + carNum + "%");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(payTimeRange)) {
|
|
|
+ String[] timeRangeArray = payTimeRange.split(",");
|
|
|
+ String startTime = "";
|
|
|
+ String endTime = "";
|
|
|
+ if (timeRangeArray.length == 1) {
|
|
|
+ startTime = timeRangeArray[0];
|
|
|
+ startTime += " 00:00:00";
|
|
|
+ } else if (timeRangeArray.length == 2) {
|
|
|
+ startTime = timeRangeArray[0];
|
|
|
+ endTime = timeRangeArray[1];
|
|
|
+ startTime += " 00:00:00";
|
|
|
+ endTime += " 23:59:59";
|
|
|
+ }
|
|
|
+
|
|
|
+ searchParams.put("pay_time_start", startTime);
|
|
|
+ searchParams.put("pay_time_end", endTime);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ com.github.pagehelper.Page<ParkingPay> page = parkingPayService.pageSearch(searchParams, pageIndex, pageSize, sortList);
|
|
|
+
|
|
|
+ for (ParkingPay parkingPay : page) {
|
|
|
+ ParkingRecord parkingRecord = parkingRecordService.getById(parkingPay.getParkingRecordId());
|
|
|
+ if (parkingRecord != null) {
|
|
|
+ parkingPay.setCarNum(parkingRecord.getCarNum());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ msgResult.setResult(true);
|
|
|
+ msgResult.setData(PojoUtils.pageWrapper(page));
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
}
|