| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.ExportParams; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.WebUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.dto.HandleAppealServicesDTO; |
| | | import com.ruoyi.system.export.TAppealServicesExport; |
| | | import com.ruoyi.system.export.TRefundOrderExport; |
| | | import com.ruoyi.system.model.TAppealServices; |
| | | import com.ruoyi.system.query.TAppealServicesQuery; |
| | | import com.ruoyi.system.query.TCourseOrderQuery; |
| | | import com.ruoyi.system.service.TAppealServicesService; |
| | | import com.ruoyi.system.vo.TAppealServicesVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @ApiOperation(value = "获取诉求服务管理分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TAppealServicesVO>> pageList(@RequestBody TAppealServicesQuery query) { |
| | | public R<PageInfo<TAppealServicesVO>> pageList(@Validated @RequestBody TAppealServicesQuery query) { |
| | | return R.ok(appealServicesService.pageList(query)); |
| | | } |
| | | /** |
| | | * 获取诉求服务管理管理列表 |
| | | */ |
| | | @ApiOperation(value = "获取诉求服务管理分页列表-大屏使用") |
| | | @PostMapping(value = "/pageListLarge") |
| | | public R<PageInfo<TAppealServicesVO>> pageListLarge(@RequestBody TAppealServicesQuery query) { |
| | | return R.ok(appealServicesService.pageList(query)); |
| | | } |
| | | |
| | |
| | | appealServicesService.updateById(appealServices); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @Log(title = "诉求服务管理信息-群众诉求服务导出", businessType = BusinessType.EXPORT) |
| | | @ApiOperation(value = "群众诉求服务导出") |
| | | @PostMapping("/exportAppealServices") |
| | | public void exportAppealServices(@RequestBody TAppealServicesQuery query){ |
| | | query.setAppealType(1); |
| | | List<TAppealServicesExport> appealServicesExports = appealServicesService.exportAppealServices(query); |
| | | for (TAppealServicesExport appealServicesExport : appealServicesExports) { |
| | | if(Objects.nonNull(appealServicesExport.getCreateTime())){ |
| | | appealServicesExport.setCreateTimeStr(DateUtils.localDateTimeToString(appealServicesExport.getCreateTime())); |
| | | } |
| | | if(Objects.nonNull(appealServicesExport.getProcessTime())){ |
| | | appealServicesExport.setProcessTimeStr(DateUtils.localDateTimeToString(appealServicesExport.getProcessTime())); |
| | | } |
| | | } |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), TAppealServicesExport.class, appealServicesExports); |
| | | HttpServletResponse response = WebUtils.response(); |
| | | assert response != null; |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | String fileName = URLEncoder.encode("群众诉求服务导出.xls", "utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
| | | response.setContentType("application/vnd.ms-excel;charset=UTF-8"); |
| | | response.setHeader("Pragma", "no-cache"); |
| | | response.setHeader("Cache-Control", "no-cache"); |
| | | outputStream = response.getOutputStream(); |
| | | workbook.write(outputStream); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Log(title = "诉求服务管理信息-随心拍导出", businessType = BusinessType.EXPORT) |
| | | @ApiOperation(value = "随心拍导出") |
| | | @PostMapping("/exportAppealServicesGratified") |
| | | public void exportAppealServicesGratified(@RequestBody TAppealServicesQuery query){ |
| | | query.setAppealType(2); |
| | | List<TAppealServicesExport> appealServicesExports = appealServicesService.exportAppealServices(query); |
| | | for (TAppealServicesExport appealServicesExport : appealServicesExports) { |
| | | if(Objects.nonNull(appealServicesExport.getCreateTime())){ |
| | | appealServicesExport.setCreateTimeStr(DateUtils.localDateTimeToString(appealServicesExport.getCreateTime())); |
| | | } |
| | | if(Objects.nonNull(appealServicesExport.getProcessTime())){ |
| | | appealServicesExport.setProcessTimeStr(DateUtils.localDateTimeToString(appealServicesExport.getProcessTime())); |
| | | } |
| | | } |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), TAppealServicesExport.class, appealServicesExports); |
| | | HttpServletResponse response = WebUtils.response(); |
| | | assert response != null; |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | String fileName = URLEncoder.encode("随心拍导出.xls", "utf-8"); |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + fileName); |
| | | response.setContentType("application/vnd.ms-excel;charset=UTF-8"); |
| | | response.setHeader("Pragma", "no-cache"); |
| | | response.setHeader("Cache-Control", "no-cache"); |
| | | outputStream = response.getOutputStream(); |
| | | workbook.write(outputStream); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |