|
@@ -40,8 +40,10 @@ import com.fjhx.file.service.FileInfoService;
|
|
|
import com.fjhx.file.utils.ObsFileUtil;
|
|
|
import com.fjhx.flow.service.flow.FlowExampleService;
|
|
|
import com.fjhx.item.entity.product.bo.ProductAnalysisBo;
|
|
|
+import com.fjhx.item.entity.product.dto.ProductInfoDto;
|
|
|
import com.fjhx.item.entity.product.dto.ProductInfoSelectDto;
|
|
|
import com.fjhx.item.entity.product.po.ProductInfo;
|
|
|
+import com.fjhx.item.entity.product.po.ProductInfoEhsdJson;
|
|
|
import com.fjhx.item.service.product.ProductInfoService;
|
|
|
import com.fjhx.purchase.entity.arrival.po.ArrivalDetail;
|
|
|
import com.fjhx.purchase.entity.pay.po.Pay;
|
|
@@ -2358,4 +2360,57 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
|
|
|
return productAnalysisPage;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Map<Long, Map<String, Object>> getProductPriceInfo(ProductInfoDto dto) {
|
|
|
+ List<ProductInfo> list = productInfoService.list(q -> q.in(ProductInfo::getId, dto.getProductIds()));
|
|
|
+ if (ObjectUtil.isEmpty(list)) {
|
|
|
+ return new HashMap<>();
|
|
|
+ }
|
|
|
+ List<Long> pIds = list.stream().map(ProductInfo::getId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ //获取客户某客户近3条销售价格信息
|
|
|
+ Map<Long, List<ContractProductVo>> customerContractProductMap = new HashMap<>();
|
|
|
+ Long customerId = dto.getCustomerId();
|
|
|
+ if (ObjectUtil.isNotEmpty(customerId)) {
|
|
|
+ List<ContractProductVo> customerContractProductList = baseMapper.getProductPriceInfo(IWrapper.getWrapper()
|
|
|
+ .in("cp.product_id", pIds)
|
|
|
+ .eq("c.buy_corporation_id", customerId)
|
|
|
+ .orderByDesc("c.create_time")
|
|
|
+ .orderByDesc("c.id")
|
|
|
+ .last("LIMIT 3")
|
|
|
+ );
|
|
|
+ customerContractProductMap =
|
|
|
+ customerContractProductList.stream().collect(Collectors.groupingBy(ContractProduct::getProductId));
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取产品近三条销售价格信息
|
|
|
+ List<ContractProduct> contractProductList = contractProductService.list(q -> q
|
|
|
+ .in(ContractProduct::getProductId, pIds)
|
|
|
+ .orderByDesc(ContractProduct::getCreateTime)
|
|
|
+ .orderByDesc(ContractProduct::getId)
|
|
|
+ .last("LIMIT 20")
|
|
|
+ );
|
|
|
+ Map<Long, List<ContractProduct>> contractProductMap =
|
|
|
+ contractProductList.stream().collect(Collectors.groupingBy(ContractProduct::getProductId));
|
|
|
+
|
|
|
+
|
|
|
+ //处理输出数据
|
|
|
+ Map<Long, Map<String, Object>> reData = new HashMap<>();
|
|
|
+ for (ProductInfo productInfo : list) {
|
|
|
+ ProductInfoEhsdJson ehsdJson = JSONObject.parseObject(productInfo.getEhsdJson(), ProductInfoEhsdJson.class);
|
|
|
+
|
|
|
+ Long productInfoId = productInfo.getId();
|
|
|
+
|
|
|
+ Map<String, Object> data = new HashMap<>();
|
|
|
+ data.put("price", ehsdJson.getPrice());
|
|
|
+ data.put("costPrice", ehsdJson.getCostPrice());
|
|
|
+ data.put("customerContractProductList", customerContractProductMap.get(productInfoId));
|
|
|
+ data.put("contractProductList", contractProductMap.get(productInfoId));
|
|
|
+
|
|
|
+ reData.put(productInfoId, data);
|
|
|
+ }
|
|
|
+
|
|
|
+ return reData;
|
|
|
+ }
|
|
|
+
|
|
|
}
|