| | |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusDO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessStatusTypeDO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO; |
| | | import cn.iocoder.yudao.module.crm.dal.dataobject.product.CrmProductDO; |
| | | import cn.iocoder.yudao.module.crm.service.business.CrmBusinessService; |
| | | import cn.iocoder.yudao.module.crm.service.business.CrmBusinessStatusService; |
| | | import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService; |
| | | import cn.iocoder.yudao.module.crm.service.product.CrmProductService; |
| | | import cn.iocoder.yudao.module.mdm.api.item.MdmItemApi; |
| | | import cn.iocoder.yudao.module.mdm.api.item.dto.MdmItemRespDTO; |
| | | import cn.iocoder.yudao.module.system.api.dept.DeptApi; |
| | | import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | |
| | | @Resource |
| | | private CrmBusinessStatusService businessStatusService; |
| | | @Resource |
| | | private CrmProductService productService; |
| | | private MdmItemApi mdmItemApi; |
| | | |
| | | @Resource |
| | | private AdminUserApi adminUserApi; |
| | |
| | | CrmBusinessRespVO businessVO = buildBusinessDetailList(Collections.singletonList(business)).get(0); |
| | | // 拼接产品项 |
| | | List<CrmBusinessProductDO> businessProducts = businessService.getBusinessProductListByBusinessId(businessVO.getId()); |
| | | Map<Long, CrmProductDO> productMap = productService.getProductMap( |
| | | convertSet(businessProducts, CrmBusinessProductDO::getProductId)); |
| | | Map<Long, MdmItemRespDTO> itemMap = mdmItemApi.getItemMap( |
| | | convertSet(businessProducts, CrmBusinessProductDO::getItemId)); |
| | | businessVO.setProducts(BeanUtils.toBean(businessProducts, CrmBusinessRespVO.Product.class, businessProductVO -> |
| | | MapUtils.findAndThen(productMap, businessProductVO.getProductId(), |
| | | product -> businessProductVO.setProductName(product.getName()) |
| | | .setProductNo(product.getNo()).setProductUnit(product.getUnit())))); |
| | | MapUtils.findAndThen(itemMap, businessProductVO.getItemId(), |
| | | item -> businessProductVO.setItemName(item.getName()) |
| | | .setItemCode(item.getCode()).setItemUnitId(item.getUnitMeasureId())))); |
| | | return businessVO; |
| | | } |
| | | |