kongdeqiang
2024-04-24 83a1aa3133ce9c35fb428d0cdf4a84adda4ba3ac
src/main/java/com/boying/controller/OrderRecordController.java
@@ -7,6 +7,7 @@
import com.boying.common.R;
import com.boying.entity.OrderRecord;
import com.boying.entity.OutPark;
import com.boying.entity.Park;
import com.boying.entity.User;
import com.boying.entity.vo.OrderRecordVo;
import com.boying.service.OrderRecordService;
@@ -15,6 +16,8 @@
import com.boying.service.UserService;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.GetMapping;
@@ -32,6 +35,7 @@
@RestController
@RequestMapping("ffzf/orderrecord")
@RequiredArgsConstructor
@Tag(description = "ffzf/orderrecord" , name = "订单接口" )
public class OrderRecordController {
    private final OrderRecordService orderRecordService;
@@ -47,12 +51,13 @@
     */
    @ApiOperation(value = "分页查询", notes = "分页查询")
    @PostMapping("/findPage" )
    @Operation(summary = "分页查询" , description = "分页查询" )
    public R getOrderRecordPage(Page page, OrderRecord orderRecord) {
        QueryWrapper<OrderRecord> wrapper = new QueryWrapper<>();
        wrapper.lambda()
                .eq(OrderRecord::getType,orderRecord.getType())
                .eq(OrderRecord::getStatus,1)
                .eq(StringUtils.isNotBlank(orderRecord.getCarNo()),OrderRecord::getCarNo,orderRecord.getCarNo())
                .like(StringUtils.isNotBlank(orderRecord.getCarNo()),OrderRecord::getCarNo,orderRecord.getCarNo())
                .isNotNull(OrderRecord::getPayCode)
                .orderByDesc(OrderRecord::getCreateTime);
        Page page1 = orderRecordService.page(page, wrapper);
@@ -71,6 +76,7 @@
    @PostMapping("/getByCarNo")
    @Operation(summary = "通过车牌号月份分页查询" , description = "通过车牌号月份分页查询" )
    public Object getByCarNo(Page page,String carNo,String month,String phone) {
        List<OrderRecordVo> recordVos = new ArrayList<>();
        QueryWrapper<OrderRecord> wrapper = new QueryWrapper<>();
@@ -99,6 +105,7 @@
    }
    @PostMapping("/findCountPage")
    @Operation(summary = "查询停车场订单金额统计" , description = "查询停车场订单金额统计" )
    public Object findCountPage(Integer parkId,String startTime,String endTime) throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        QueryWrapper<OutPark> wrapper = new QueryWrapper<>();
@@ -120,7 +127,12 @@
                List<OutPark> value = objectListEntry.getValue();
                Double collect1 = value.stream().collect(Collectors.summingDouble(OutPark::getPrice));
                Map<String,Object> map  = new HashMap<>();
                map.put("parkName",parkService.getById(key).getName());
                Park byId = parkService.getById(key);
                if(byId != null){
                    map.put("parkName",byId.getName());
                }else {
                    map.put("parkName","未知停车场");
                }
                map.put("orderNum",value.size());
                map.put("orderMoney",collect1);
                resultList.add(map);