| | |
| | | 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.framework.web.domain.R; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "售后服务-分页查询") |
| | | @Log(title = "售后服务-分页查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, AfterSalesServiceNewDto afterSalesService) { |
| | | public R<?> listPage(Page page, AfterSalesServiceNewDto afterSalesService) { |
| | | IPage<AfterSalesServiceNewDto> listPage = afterSalesServiceService.listPage(page, afterSalesService); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @Log(title = "售后服务-反馈登记", businessType = BusinessType.EXPORT) |
| | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "售后服务-新增") |
| | | @Log(title = "售后服务-新增", businessType = BusinessType.INSERT) |
| | | public AjaxResult add(@RequestBody AfterSalesServiceNewDto afterSalesServiceNewDto) { |
| | | return afterSalesServiceService.addAfterSalesServiceDto(afterSalesServiceNewDto) ? AjaxResult.success() : AjaxResult.error(); |
| | | public R<?> add(@RequestBody AfterSalesServiceNewDto afterSalesServiceNewDto) { |
| | | return afterSalesServiceService.addAfterSalesServiceDto(afterSalesServiceNewDto) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "售后服务-修改") |
| | | @Log(title = "售后服务-修改", businessType = BusinessType.UPDATE) |
| | | public AjaxResult update(@RequestBody AfterSalesServiceNewDto afterSalesServiceNewDto) { |
| | | public R<?> update(@RequestBody AfterSalesServiceNewDto afterSalesServiceNewDto) { |
| | | if (afterSalesServiceNewDto.getProductModelIdList() != null && afterSalesServiceNewDto.getProductModelIdList().isEmpty() ) { |
| | | String productModelIds = afterSalesServiceNewDto.getProductModelIdList().stream() |
| | | .map(String::valueOf) |
| | |
| | | afterSalesServiceNewDto.setProductModelIds(productModelIds); |
| | | } |
| | | boolean update = afterSalesServiceService.updateById(afterSalesServiceNewDto); |
| | | return update ? AjaxResult.success() : AjaxResult.error(); |
| | | return update ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "售后服务-删除") |
| | | @Log(title = "售后服务-删除", businessType = BusinessType.DELETE) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | return AjaxResult.error("请传入要删除的ID"); |
| | | return R.fail("请传入要删除的ID"); |
| | | } |
| | | boolean delete = afterSalesServiceService.removeByIds(ids); |
| | | return delete ? AjaxResult.success() : AjaxResult.error(); |
| | | return delete ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/dispose") |
| | | @Operation(summary = "售后服务-处理") |
| | | @Log(title = "售后服务-处理", businessType = BusinessType.UPDATE) |
| | | public AjaxResult dispose(@RequestBody AfterSalesService afterSalesService) { |
| | | public R<?> dispose(@RequestBody AfterSalesService afterSalesService) { |
| | | AfterSalesService byId = afterSalesServiceService.getById(afterSalesService.getId()); |
| | | if(byId == null) throw new RuntimeException("未找到该数据"); |
| | | if(byId.getStatus().equals(2)) throw new RuntimeException("该数据已处理"); |
| | |
| | | afterSalesService.setDisposeNickName(sysUser.getNickName()); |
| | | afterSalesService.setStatus(2); |
| | | boolean update = afterSalesServiceService.updateById(afterSalesService); |
| | | return update ? AjaxResult.success() : AjaxResult.error(); |
| | | return update ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | |
| | | @GetMapping("listSalesLedger") |
| | | @Operation(summary = "售后服务-获取销售台账") |
| | | public AjaxResult listSalesLedger(SalesLedgerDto salesLedgerDto, Page page) { |
| | | public R<?> listSalesLedger(SalesLedgerDto salesLedgerDto, Page page) { |
| | | IPage<SalesLedgerDto> list = salesLedgerService.listSalesLedger(salesLedgerDto,page); |
| | | return AjaxResult.success(list); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | | @GetMapping("getById") |
| | | @Operation(summary = "售后服务-根据id获取详情") |
| | | public AjaxResult getById(Long id) { |
| | | return AjaxResult.success(afterSalesServiceService.getAfterSalesServiceNewDtoById(id)); |
| | | public R<?> getById(Long id) { |
| | | return R.ok(afterSalesServiceService.getAfterSalesServiceNewDtoById(id)); |
| | | } |
| | | |
| | | @Operation(summary = "售后服务-统计工单情况") |
| | | @GetMapping("count") |
| | | public AjaxResult count() { |
| | | return AjaxResult.success(afterSalesServiceService.countAfterSalesService()); |
| | | public R<?> count() { |
| | | return R.ok(afterSalesServiceService.countAfterSalesService()); |
| | | } |
| | | |
| | | } |