| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.aftersalesservice.dto.AfterSalesNearExpiryExportDto; |
| | | import com.ruoyi.aftersalesservice.dto.AfterSalesNearExpiryImportDto; |
| | | import com.ruoyi.aftersalesservice.pojo.AfterSalesNearExpiry; |
| | | import com.ruoyi.aftersalesservice.service.AfterSalesNearExpiryService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <br> |
| | |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | |
| | | /** |
| | | * 导入临期售后 |
| | | */ |
| | | @PostMapping("/import") |
| | | @Operation(summary = "临期售后管理-导入") |
| | | @Log(title = "临期售后管理-导入", businessType = BusinessType.IMPORT) |
| | | public AjaxResult importData(MultipartFile file) { |
| | | return afterSalesNearExpiryService.importData(file); |
| | | } |
| | | |
| | | /** |
| | | * 下载导入模板 |
| | | */ |
| | | @PostMapping("/importTemplate") |
| | | @Operation(summary = "临期售后管理-导入模板") |
| | | public void importTemplate(HttpServletResponse response) { |
| | | ExcelUtil<AfterSalesNearExpiryImportDto> util = new ExcelUtil<AfterSalesNearExpiryImportDto>(AfterSalesNearExpiryImportDto.class); |
| | | util.importTemplateExcel(response, "临期售后管理导入模板"); |
| | | } |
| | | |
| | | /** |
| | | * 导出临期售后 |
| | | */ |
| | | @PostMapping("/export") |
| | | @Operation(summary = "临期售后管理-导出") |
| | | @Log(title = "临期售后管理-导出", businessType = BusinessType.EXPORT) |
| | | public void export(HttpServletResponse response) { |
| | | Page<AfterSalesNearExpiry> page = new Page<>(-1, -1); |
| | | List<AfterSalesNearExpiry> list = afterSalesNearExpiryService.listPage(page, new AfterSalesNearExpiry()).getRecords(); |
| | | List<AfterSalesNearExpiryExportDto> exportList = new ArrayList<>(); |
| | | for (AfterSalesNearExpiry item : list) { |
| | | AfterSalesNearExpiryExportDto dto = new AfterSalesNearExpiryExportDto(); |
| | | BeanUtils.copyProperties(item, dto); |
| | | if (item.getStatus() != null) { |
| | | dto.setStatusName(String.valueOf(item.getStatus())); |
| | | } |
| | | exportList.add(dto); |
| | | } |
| | | ExcelUtil<AfterSalesNearExpiryExportDto> util = new ExcelUtil<AfterSalesNearExpiryExportDto>(AfterSalesNearExpiryExportDto.class); |
| | | util.exportExcel(response, exportList, "临期售后管理"); |
| | | } |
| | | |
| | | } |