| | |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.aftersalesservice.dto.AfterSalesServiceDto; |
| | | import com.ruoyi.aftersalesservice.dto.AfterSalesServiceExeclDto; |
| | | import com.ruoyi.aftersalesservice.dto.AfterSalesServiceNewDto; |
| | | import com.ruoyi.aftersalesservice.pojo.AfterSalesService; |
| | | import com.ruoyi.aftersalesservice.service.AfterSalesServiceService; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.equipmentenergyconsumption.pojo.EquipmentEnergyConsumption; |
| | | 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 com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.purchase.dto.VatDto; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | | import com.ruoyi.sales.service.ISalesLedgerService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author :yys |
| | |
| | | @Autowired |
| | | private SysUserMapper sysUserMapper; |
| | | |
| | | @Autowired |
| | | private ISalesLedgerService salesLedgerService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("售后服务-分页查询") |
| | | @Log(title = "售后服务-分页查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, AfterSalesService afterSalesService) { |
| | | IPage<AfterSalesService> listPage = afterSalesServiceService.listPage(page, afterSalesService); |
| | | public AjaxResult listPage(Page page, AfterSalesServiceNewDto afterSalesService) { |
| | | IPage<AfterSalesServiceNewDto> listPage = afterSalesServiceService.listPage(page, afterSalesService); |
| | | return AjaxResult.success(listPage); |
| | | } |
| | | |
| | |
| | | @ApiOperation("售后服务-反馈登记") |
| | | public void export(HttpServletResponse response) { |
| | | Page page = new Page(-1,-1); |
| | | AfterSalesService afterSalesService = new AfterSalesService(); |
| | | IPage<AfterSalesService> listPage = afterSalesServiceService.listPage(page, afterSalesService); |
| | | List<AfterSalesServiceDto> list = new ArrayList<>(); |
| | | AfterSalesServiceNewDto afterSalesService = new AfterSalesServiceNewDto(); |
| | | IPage<AfterSalesServiceNewDto> listPage = afterSalesServiceService.listPage(page, afterSalesService); |
| | | List<AfterSalesServiceExeclDto> list = new ArrayList<>(); |
| | | listPage.getRecords().forEach(item -> { |
| | | AfterSalesServiceDto dto = new AfterSalesServiceDto(); |
| | | AfterSalesServiceExeclDto dto = new AfterSalesServiceExeclDto(); |
| | | BeanUtils.copyProperties(item, dto); |
| | | dto.setStatusName(item.getStatus().toString()); |
| | | list.add(dto); |
| | | }); |
| | | ExcelUtil<AfterSalesServiceDto> util = new ExcelUtil<AfterSalesServiceDto>(AfterSalesServiceDto.class); |
| | | ExcelUtil<AfterSalesServiceExeclDto> util = new ExcelUtil<AfterSalesServiceExeclDto>(AfterSalesServiceExeclDto.class); |
| | | util.exportExcel(response, list , "反馈登记"); |
| | | } |
| | | |
| | |
| | | @ApiOperation("售后服务-售后处理") |
| | | public void exportTwo(HttpServletResponse response) { |
| | | Page page = new Page(-1,-1); |
| | | AfterSalesService afterSalesService = new AfterSalesService(); |
| | | IPage<AfterSalesService> listPage = afterSalesServiceService.listPage(page, afterSalesService); |
| | | AfterSalesServiceNewDto afterSalesService = new AfterSalesServiceNewDto(); |
| | | IPage<AfterSalesServiceNewDto> listPage = afterSalesServiceService.listPage(page, afterSalesService); |
| | | listPage.getRecords().forEach(item -> { |
| | | item.setStatusName(item.getStatus().toString()); |
| | | }); |
| | | ExcelUtil<AfterSalesService> util = new ExcelUtil<AfterSalesService>(AfterSalesService.class); |
| | | ExcelUtil<AfterSalesServiceNewDto> util = new ExcelUtil<AfterSalesServiceNewDto>(AfterSalesServiceNewDto.class); |
| | | util.exportExcel(response, listPage.getRecords() , "售后处理"); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @ApiOperation("售后服务-新增") |
| | | @Log(title = "售后服务-新增", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody AfterSalesService afterSalesService) { |
| | | afterSalesService.setStatus(1); |
| | | SysUser sysUser = sysUserMapper.selectUserById(afterSalesService.getCheckUserId()); |
| | | if(sysUser == null) throw new RuntimeException("审核人不存在"); |
| | | afterSalesService.setCheckNickName(sysUser.getNickName()); |
| | | boolean save = afterSalesServiceService.save(afterSalesService); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | public AjaxResult add(@RequestBody AfterSalesServiceNewDto afterSalesServiceNewDto) { |
| | | return afterSalesServiceService.addAfterSalesServiceDto(afterSalesServiceNewDto) ? AjaxResult.success() : AjaxResult.error(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @ApiOperation("售后服务-修改") |
| | | @Log(title = "售后服务-修改", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody AfterSalesService afterSalesService) { |
| | | boolean update = afterSalesServiceService.updateById(afterSalesService); |
| | | public AjaxResult update(@RequestBody AfterSalesServiceNewDto afterSalesServiceNewDto) { |
| | | if (afterSalesServiceNewDto.getProductModelIdList() != null && afterSalesServiceNewDto.getProductModelIdList().isEmpty() ) { |
| | | String productModelIds = afterSalesServiceNewDto.getProductModelIdList().stream() |
| | | .map(String::valueOf) |
| | | .collect(Collectors.joining(",")); |
| | | afterSalesServiceNewDto.setProductModelIds(productModelIds); |
| | | } |
| | | boolean update = afterSalesServiceService.updateById(afterSalesServiceNewDto); |
| | | return update ? AjaxResult.success() : AjaxResult.error(); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | @GetMapping("listSalesLedger") |
| | | @ApiOperation("售后服务-获取销售台账") |
| | | public AjaxResult listSalesLedger(SalesLedgerDto salesLedgerDto, Page page) { |
| | | IPage<SalesLedgerDto> list = salesLedgerService.listSalesLedger(salesLedgerDto,page); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | |
| | | @GetMapping("getById") |
| | | @ApiOperation("售后服务-根据id获取详情") |
| | | public AjaxResult getById(Long id) { |
| | | return AjaxResult.success(afterSalesServiceService.getAfterSalesServiceNewDtoById(id)); |
| | | } |
| | | |
| | | @ApiOperation("售后服务-统计工单情况") |
| | | @GetMapping("count") |
| | | public AjaxResult count() { |
| | | return AjaxResult.success(afterSalesServiceService.countAfterSalesService()); |
| | | } |
| | | |
| | | } |