|
|
@@ -415,12 +415,15 @@ public class KwpGoodsService {
|
|
|
detail.setImages(images).setPrice(price).setGoodsEntInfo(goodsEntInfo).setAttributes(attributes).setAddressInfo(addressInfo);
|
|
|
Long entId = LoginUserHolder.getEntId();
|
|
|
detail.setSignFlag(false);
|
|
|
+ detail.setShowOrderButtonFlag(false);
|
|
|
if (Objects.nonNull(entId)) {
|
|
|
- TradeContractGoodsDto tradeContractResDto = remoteContractService.queryTradeContractNew(entId, id, LocalDateTime.now());
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
|
+ TradeContractGoodsDto tradeContractResDto = remoteContractService.queryTradeContractNew(entId, id, now);
|
|
|
if (Objects.nonNull(tradeContractResDto)) {
|
|
|
detail.setSignPrice(tradeContractResDto.getPrice());
|
|
|
detail.setSignFlag(true);
|
|
|
}
|
|
|
+ detail.setShowOrderButtonFlag(Objects.nonNull(queryOrderButtonTradeContract(entId, id, now, tradeContractResDto)));
|
|
|
}
|
|
|
return detail;
|
|
|
}
|
|
|
@@ -1570,16 +1573,31 @@ public class KwpGoodsService {
|
|
|
materials.setSignPrice(tradeContractResDto.getPrice());
|
|
|
materials.setSignFlag(true);
|
|
|
}
|
|
|
- TradeContractGoodsDto orderButtonContractDto = Objects.nonNull(tradeContractResDto)
|
|
|
- ? tradeContractResDto
|
|
|
- : remoteContractService.queryTradeContractNewByEnt(entId, e.getId(), LocalDateTime.now());
|
|
|
- materials.setShowOrderButtonFlag(Objects.nonNull(orderButtonContractDto));
|
|
|
+ materials.setShowOrderButtonFlag(Objects.nonNull(queryOrderButtonTradeContract(entId, e.getId(), LocalDateTime.now(), tradeContractResDto)));
|
|
|
}
|
|
|
result.add(materials);
|
|
|
});
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询当前企业是否存在可用于展示立即下单按钮的有效贸易合同商品。
|
|
|
+ *
|
|
|
+ * @param entId 当前登录企业ID
|
|
|
+ * @param goodsId 商品ID
|
|
|
+ * @param time 当前时间
|
|
|
+ * @param buyerContractGoods 当前企业作为买方时已查询到的合同商品
|
|
|
+ * @return 可展示立即下单按钮的贸易合同商品,未签有效合同则返回null
|
|
|
+ */
|
|
|
+ private TradeContractGoodsDto queryOrderButtonTradeContract(Long entId, Long goodsId, LocalDateTime time, TradeContractGoodsDto buyerContractGoods) {
|
|
|
+ if (Objects.isNull(entId) || Objects.isNull(goodsId) || Objects.isNull(time)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ return Objects.nonNull(buyerContractGoods)
|
|
|
+ ? buyerContractGoods
|
|
|
+ : remoteContractService.queryTradeContractNewByEnt(entId, goodsId, time);
|
|
|
+ }
|
|
|
+
|
|
|
public List<BuildingMaterialsMarketList> hootGoods() {
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
LocalDateTime start = now.minusDays(30);
|