| | |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractDO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.contract.CrmContractProductDO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| | | import cn.iocoder.yudao.module.crm.enums.common.CrmAuditStatusEnum; |
| | | import cn.iocoder.yudao.module.mdm.api.item.MdmItemApi; |
| | | import cn.iocoder.yudao.module.mdm.api.item.dto.MdmItemRespDTO; |
| | | import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService; |
| | | import cn.iocoder.yudao.module.crm.service.contact.CrmContactService; |
| | | import cn.iocoder.yudao.module.crm.service.contract.CrmContractService; |
| | | import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; |
| | | import cn.iocoder.yudao.module.crm.service.product.CrmProductService; |
| | | import cn.iocoder.yudao.module.crm.service.receivable.CrmReceivableService; |
| | | import cn.iocoder.yudao.module.system.api.dept.DeptApi; |
| | | import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; |
| | |
| | | public void exportContractExcel(@Valid CrmContractPageReqVO exportReqVO, |
| | | HttpServletResponse response) throws IOException { |
| | | PageResult<CrmContractDO> pageResult = contractService.getContractPage(exportReqVO, getLoginUserId()); |
| | | List<CrmContractRespVO> list = BeanUtils.toBean(pageResult.getList(), CrmContractRespVO.class); |
| | | // 计算未回款金额、转换审批状态为中文 |
| | | list.forEach(vo -> { |
| | | if (vo.getTotalPrice() != null && vo.getTotalReceivablePrice() != null) { |
| | | vo.setUnReceivablePrice(vo.getTotalPrice().subtract(vo.getTotalReceivablePrice())); |
| | | } |
| | | if (vo.getAuditStatus() != null) { |
| | | vo.setAuditStatusName(CrmAuditStatusEnum.getNameByStatus(vo.getAuditStatus())); |
| | | } |
| | | }); |
| | | // 导出 Excel |
| | | ExcelUtils.write(response, "合同.xls", "数据", CrmContractRespVO.class, |
| | | BeanUtils.toBean(pageResult.getList(), CrmContractRespVO.class)); |
| | | ExcelUtils.write(response, "合同.xls", "数据", CrmContractRespVO.class, list); |
| | | } |
| | | |
| | | @PutMapping("/transfer") |