| | |
| | | |
| | | 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.util.collection.CollectionUtils.*; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAndThen; |
| | | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| | |
| | | @GetMapping("/page-by-customer") |
| | | @Operation(summary = "获得合同分页,基于指定客户") |
| | | public CommonResult<PageResult<CrmContractRespVO>> getContractPageByCustomer(@Valid CrmContractPageReqVO pageVO) { |
| | | Assert.notNull(pageVO.getCustomerId(), "客户编号不能为空"); |
| | | if (pageVO.getCustomerId() == null) { |
| | | throw exception0(BAD_REQUEST.getCode(), "客户编号不能为空"); |
| | | } |
| | | PageResult<CrmContractDO> pageResult = contractService.getContractPageByCustomerId(pageVO); |
| | | return success(BeanUtils.toBean(pageResult, CrmContractRespVO.class).setList(buildContractDetailList(pageResult.getList()))); |
| | | } |
| | |
| | | @GetMapping("/page-by-business") |
| | | @Operation(summary = "获得合同分页,基于指定商机") |
| | | public CommonResult<PageResult<CrmContractRespVO>> getContractPageByBusiness(@Valid CrmContractPageReqVO pageVO) { |
| | | Assert.notNull(pageVO.getBusinessId(), "商机编号不能为空"); |
| | | if (pageVO.getBusinessId() == null) { |
| | | throw exception0(BAD_REQUEST.getCode(), "商机编号不能为空"); |
| | | } |
| | | PageResult<CrmContractDO> pageResult = contractService.getContractPageByBusinessId(pageVO); |
| | | return success(BeanUtils.toBean(pageResult, CrmContractRespVO.class).setList(buildContractDetailList(pageResult.getList()))); |
| | | } |
| | |
| | | .payCycle(null).remark("").build() |
| | | ); |
| | | // 输出 |
| | | ExcelUtils.write(response, "合同导入模板.xls", "合同列表", CrmContractImportExcelVO.class, list); |
| | | ExcelUtils.writeTemplate(response, "合同导入模板.xls", "合同列表", CrmContractImportExcelVO.class, list); |
| | | } |
| | | |
| | | @PostMapping("/import") |