| | |
| | | |
| | | 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.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | 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> |
| | |
| | | * @since 2026/03/02 14:40 |
| | | */ |
| | | @RestController |
| | | @Api(tags = "临期售后管理") |
| | | @Tag(name = "临期售后管理") |
| | | @RequestMapping("/afterSalesNearExpiryService") |
| | | @AllArgsConstructor |
| | | public class AfterSalesNearExpiryController extends BaseController { |
| | | |
| | | @Autowired |
| | | private AfterSalesNearExpiryService afterSalesNearExpiryService; |
| | | |
| | | /** |
| | | * 新增临期售后 |
| | | */ |
| | | @PostMapping("/add") |
| | | @ApiOperation("新增临期售后") |
| | | @Operation(summary = "新增临期售后") |
| | | @Log(title = "新增临期售后", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody AfterSalesNearExpiry entity) { |
| | | afterSalesNearExpiryService.add(entity); |
| | |
| | | * 更新临期售后 |
| | | */ |
| | | @PostMapping("/update") |
| | | @ApiOperation("更新临期售后") |
| | | @Operation(summary = "更新临期售后") |
| | | @Log(title = "更新临期售后", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody AfterSalesNearExpiry entity) { |
| | | afterSalesNearExpiryService.update(entity); |
| | |
| | | * 删除临期售后 |
| | | */ |
| | | @DeleteMapping("/delete") |
| | | @ApiOperation("删除临期售后") |
| | | @Operation(summary = "删除临期售后") |
| | | @Log(title = "删除临期售后", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(Long[] ids) { |
| | | afterSalesNearExpiryService.delete(ids); |
| | |
| | | * 分页查询临期售后 |
| | | */ |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("分页查询临期售后") |
| | | @Operation(summary = "分页查询临期售后") |
| | | @Log(title = "分页查询临期售后", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page<AfterSalesNearExpiry> page, AfterSalesNearExpiry entity) { |
| | | IPage<AfterSalesNearExpiry> listPage = afterSalesNearExpiryService.listPage(page, entity); |
| | | 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, "临期售后管理"); |
| | | } |
| | | |
| | | } |