| | |
| | | |
| | | import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0; |
| | | import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST; |
| | | import static cn.iocoder.yudao.framework.common.pojo.PageParam.PAGE_SIZE_NONE; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertListByFlatMap; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "获得回款") |
| | | @Parameter(name = "id", description = "编号", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('crm:receivable:query')") |
| | | public CommonResult<CrmReceivableRespVO> getReceivable(@RequestParam("id") Long id) { |
| | | CrmReceivableDO receivable = receivableService.getReceivable(id); |
| | | return success(buildReceivableDetail(receivable)); |
| | |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "获得回款分页") |
| | | @PreAuthorize("@ss.hasPermission('crm:receivable:query')") |
| | | public CommonResult<PageResult<CrmReceivableRespVO>> getReceivablePage(@Valid CrmReceivablePageReqVO pageReqVO) { |
| | | PageResult<CrmReceivableDO> pageResult = receivableService.getReceivablePage(pageReqVO, getLoginUserId()); |
| | | return success(new PageResult<>(buildReceivableDetailList(pageResult.getList()), pageResult.getTotal())); |
| | |
| | | @GetMapping("/page-by-customer") |
| | | @Operation(summary = "获得回款分页,基于指定客户") |
| | | public CommonResult<PageResult<CrmReceivableRespVO>> getReceivablePageByCustomer(@Valid CrmReceivablePageReqVO pageReqVO) { |
| | | Assert.notNull(pageReqVO.getCustomerId(), "客户编号不能为空"); |
| | | if (pageReqVO.getCustomerId() == null) { |
| | | throw exception0(BAD_REQUEST.getCode(), "客户编号不能为空"); |
| | | } |
| | | PageResult<CrmReceivableDO> pageResult = receivableService.getReceivablePageByCustomerId(pageReqVO); |
| | | return success(new PageResult<>(buildReceivableDetailList(pageResult.getList()), pageResult.getTotal())); |
| | | } |
| | |
| | | }); |
| | | } |
| | | |
| | | @PutMapping("/update-status") |
| | | @Operation(summary = "更新回款的状态(审核/反审核)") |
| | | @PutMapping("/submit") |
| | | @Operation(summary = "提交回款审批(草稿/驳回→审批中)") |
| | | @PreAuthorize("@ss.hasPermission('crm:receivable:update')") |
| | | public CommonResult<Boolean> updateReceivableStatus(@RequestParam("id") Long id, |
| | | @RequestParam("status") Integer status) { |
| | | receivableService.updateReceivableStatus(id, status); |
| | | public CommonResult<Boolean> submitReceivable(@RequestParam("id") Long id) { |
| | | receivableService.submitReceivable(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/audit-count") |
| | | @Operation(summary = "获得待审核回款数量") |
| | | @PreAuthorize("@ss.hasPermission('crm:receivable:query')") |
| | | public CommonResult<Long> getAuditReceivableCount() { |
| | | return success(receivableService.getAuditReceivableCount(getLoginUserId())); |
| | | } |