|
@@ -28,6 +28,7 @@ import net.javacrumbs.shedlock.spring.annotation.SchedulerLock;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Sort;
|
|
import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.data.r2dbc.core.R2dbcEntityTemplate;
|
|
import org.springframework.data.r2dbc.core.R2dbcEntityTemplate;
|
|
|
|
|
+import org.springframework.data.redis.core.ReactiveRedisTemplate;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.data.relational.core.query.Criteria;
|
|
import org.springframework.data.relational.core.query.Criteria;
|
|
|
import org.springframework.data.relational.core.query.Query;
|
|
import org.springframework.data.relational.core.query.Query;
|
|
@@ -41,6 +42,7 @@ import java.net.InetSocketAddress;
|
|
|
import java.net.URLEncoder;
|
|
import java.net.URLEncoder;
|
|
|
import java.net.http.HttpRequest;
|
|
import java.net.http.HttpRequest;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
|
+import java.time.Duration;
|
|
|
import java.time.ZonedDateTime;
|
|
import java.time.ZonedDateTime;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
@@ -72,7 +74,8 @@ public class PlanNewOutController {
|
|
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
|
private PlanServiceInterface planServiceInterface;
|
|
private PlanServiceInterface planServiceInterface;
|
|
|
-
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private ReactiveRedisTemplate<String,String> reactiveRedisTemplate;
|
|
|
//private static final ConcurrentHashMap<String,Integer> map = new ConcurrentHashMap<String,Integer>();
|
|
//private static final ConcurrentHashMap<String,Integer> map = new ConcurrentHashMap<String,Integer>();
|
|
|
|
|
|
|
|
//清空用户Map数据
|
|
//清空用户Map数据
|
|
@@ -329,6 +332,7 @@ public class PlanNewOutController {
|
|
|
*/
|
|
*/
|
|
|
@PostMapping("hfoInfo")
|
|
@PostMapping("hfoInfo")
|
|
|
public Mono<RStatus<DataLists>> hfoInfo(@RequestBody HfoRequest request, ServerWebExchange exchange){
|
|
public Mono<RStatus<DataLists>> hfoInfo(@RequestBody HfoRequest request, ServerWebExchange exchange){
|
|
|
|
|
+ Mono<String> stringMono = reactiveRedisTemplate.opsForValue().get(request.getUnique()).switchIfEmpty(Mono.just(""));
|
|
|
if (Objects.isNull(request.getCode()) || "".equals(request.getCode().trim())) {
|
|
if (Objects.isNull(request.getCode()) || "".equals(request.getCode().trim())) {
|
|
|
throw new BaseException("code异常");
|
|
throw new BaseException("code异常");
|
|
|
}
|
|
}
|
|
@@ -345,7 +349,16 @@ public class PlanNewOutController {
|
|
|
.columns(COLUMNARRAYPLANNEW), PlanNew.class)
|
|
.columns(COLUMNARRAYPLANNEW), PlanNew.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException(" code错误")))
|
|
.switchIfEmpty(Mono.error(new BaseException(" code错误")))
|
|
|
.onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage())));
|
|
.onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage())));
|
|
|
- Mono<DataLists> dataListsMono1 = code0.flatMap(planNew -> {
|
|
|
|
|
|
|
+ Mono<DataLists> dataListsMono1 = Mono.zip(code0,stringMono).flatMap(tuple2 -> {
|
|
|
|
|
+ String t21 = tuple2.getT2();
|
|
|
|
|
+ if( !t21.isBlank()){
|
|
|
|
|
+ JSONArray jsonArray = JSONUtil.parseArray(t21);
|
|
|
|
|
+ List<H5ImageAndText> collect = jsonArray.stream().map(str -> JSONUtil.toBean(JSONUtil.parseObj(str), H5ImageAndText.class)).collect(Collectors.toList());
|
|
|
|
|
+ DataLists dataLists = new DataLists();
|
|
|
|
|
+ dataLists.setImages(collect);
|
|
|
|
|
+ return Mono.just(dataLists);
|
|
|
|
|
+ }
|
|
|
|
|
+ PlanNew planNew = tuple2.getT1();
|
|
|
Mono<PlanNew> code = Mono.just(planNew);
|
|
Mono<PlanNew> code = Mono.just(planNew);
|
|
|
Long group_type_id ; //.and("group_type_id").is(group_type_id)
|
|
Long group_type_id ; //.and("group_type_id").is(group_type_id)
|
|
|
if (Objects.isNull(request.getWx_user_id()) || "".equals(request.getWx_user_id())) {
|
|
if (Objects.isNull(request.getWx_user_id()) || "".equals(request.getWx_user_id())) {
|
|
@@ -544,8 +557,11 @@ public class PlanNewOutController {
|
|
|
// t3.setBackgroupDomain(fff.getT2());
|
|
// t3.setBackgroupDomain(fff.getT2());
|
|
|
// return Mono.just(t3);
|
|
// return Mono.just(t3);
|
|
|
// });
|
|
// });
|
|
|
|
|
+ reactiveRedisTemplate.opsForValue().set(request.getUnique(), JSONUtil.toJsonStr(dataLists.getImages()), Duration.ofHours(1)).subscribe();
|
|
|
return Mono.just(dataLists);
|
|
return Mono.just(dataLists);
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
return dataListsMono;
|
|
return dataListsMono;
|
|
|
});
|
|
});
|
|
|
return RStatus.successList(dataListsMono1);
|
|
return RStatus.successList(dataListsMono1);
|