zoujiajian 2 rokov pred
rodič
commit
adbadca7cd

+ 24 - 0
netflix-web/src/main/java/com/cyksj/web/controller/goods/GoodsDonController.java

@@ -1046,4 +1046,28 @@ public class GoodsDonController {
 				.build());
 		return GatewayResponse.SUCCESS.newBuilder().toResult(equipmentActivityReduce);
 	}
+
+	/**
+	 * 获取租赁商品列表
+	 */
+	@GetMapping("/get")
+	public Result<? extends Object> getDepositGoods(@PathVariable Long id) {
+		String depositGoodsKey = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "deposit";
+		Object o = redisService.get(depositGoodsKey);
+		if (o == null) {
+			List<GoodsDon> depositList = beanSearcher.searchAll(GoodsDon.class, MapUtils.builder()
+					.field(GoodsDon::getType, 4)
+					.field(GoodsDon::getStatus, true)
+					.field(GoodsDon::getDeleted, true)
+					.onlySelect(GoodsDon::getId, GoodsDon::getTitle, GoodsDon::getLogo)
+					.build());
+			if (CollUtil.isEmpty(depositList)) {
+				return GatewayResponse.SUCCESS.newBuilder().toResult();
+			}
+			redisService.setNx(depositGoodsKey, depositList, RedisService.key.YH_HOME_PAGHE_CACHE.getTimeout() + 60 * RandomUtil.randomInt(10));
+			o = redisService.get(depositGoodsKey);
+		}
+		List<GoodsDon> depositList = Jsons.parseList(o, GoodsDon.class);
+		return GatewayResponse.SUCCESS.newBuilder().toResult(depositList);
+	}
 }