| | |
| | | package com.gkhy.exam.pay.controller; |
| | | |
| | | import com.gkhy.exam.pay.dto.rep.CategoryCount; |
| | | import com.gkhy.exam.pay.dto.rep.NonCategoryCount; |
| | | import com.gkhy.exam.pay.dto.req.CountReq; |
| | | import com.gkhy.exam.pay.entity.CoalCategory; |
| | | import com.gkhy.exam.pay.entity.CoalTicket; |
| | | import com.gkhy.exam.pay.entity.NonCoalCategory; |
| | | import com.gkhy.exam.pay.service.CoalCategoryService; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @RestController |
| | | @Api(tags = "煤矿工种类别管理") |
| | |
| | | public AjaxResult ticketList(){ |
| | | return success(coalCategoryService.ticketList()); |
| | | } |
| | | |
| | | /** |
| | | * 工种缴费统计 |
| | | */ |
| | | @GetMapping("/count") |
| | | @ApiOperation(value = "工种缴费统计") |
| | | public TableDataInfo count(CountReq countReq){ |
| | | List<CategoryCount> categoryCounts = coalCategoryService.countCategory(countReq); |
| | | int pageNum = countReq.getPageNum(); // 当前页码 |
| | | int pageSize = countReq.getPageSize(); // 每页大小 |
| | | List<CategoryCount> pagedList = categoryCounts.stream() |
| | | .skip((pageNum - 1) * pageSize) // 跳过前面的数据 |
| | | .limit(pageSize) // 限制当前页的数据量 |
| | | .collect(Collectors.toList()); |
| | | |
| | | // 封装分页结果 |
| | | TableDataInfo dataTable = new TableDataInfo(); |
| | | dataTable.setCode(HttpStatus.SUCCESS); |
| | | dataTable.setMsg("查询成功"); |
| | | dataTable.setRows(pagedList); // 当前页数据 |
| | | dataTable.setTotal(categoryCounts.size()); // 总数据量 |
| | | return dataTable; |
| | | } |
| | | } |