|
|
@@ -7,12 +7,10 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.json.JSONArray;
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.plumelog.core.util.LogExceptionStackTrace;
|
|
|
import com.webflux.launchadmin.global.BaseException;
|
|
|
-import com.webflux.launchadmin.mysql.controller.planNew.req.KefuRequest;
|
|
|
-import com.webflux.launchadmin.mysql.controller.planNew.req.OutDomainRequest;
|
|
|
-import com.webflux.launchadmin.mysql.controller.planNew.req.PlanNewCommonMaterialReq;
|
|
|
-import com.webflux.launchadmin.mysql.controller.planNew.req.PlanNewCommonShareReq;
|
|
|
+import com.webflux.launchadmin.mysql.controller.planNew.req.*;
|
|
|
import com.webflux.launchadmin.mysql.controller.planNew.res.*;
|
|
|
import com.webflux.launchadmin.mysql.controller.takeawayController.res.TakeawayH5Data;
|
|
|
import com.webflux.launchadmin.mysql.entity.groupUsers.GroupUsers;
|
|
|
@@ -26,11 +24,15 @@ import com.webflux.launchadmin.mysql.service.takeaway.TakeawayServicesInterface;
|
|
|
import com.webflux.launchcommon.returnObj.RStatus;
|
|
|
import com.webflux.launchcommon.utils.StringUtils;
|
|
|
import jakarta.annotation.Resource;
|
|
|
+import jakarta.json.Json;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import net.javacrumbs.shedlock.spring.annotation.SchedulerLock;
|
|
|
+import org.apache.commons.lang3.exception.ExceptionUtils;
|
|
|
import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.data.r2dbc.core.R2dbcEntityTemplate;
|
|
|
import org.springframework.data.redis.core.ReactiveRedisTemplate;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
+import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.data.relational.core.query.Criteria;
|
|
|
import org.springframework.data.relational.core.query.Query;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
@@ -70,6 +72,7 @@ public class PlanNewCommonOutController {
|
|
|
private static final ConcurrentHashMap<String, Integer> MAP = new ConcurrentHashMap<>();
|
|
|
|
|
|
@Scheduled(cron = "1 1 4 * * ?")
|
|
|
+ @SchedulerLock(name = "launch:PlanNewCommonOutController:clearUserContextHashMap", lockAtLeastFor = "PT5S", lockAtMostFor = "PT15M")
|
|
|
public void clearUserContextHashMap() {
|
|
|
log.info("清空计划-H5用户Map数据》》》》》》》》》》》》》》》》》》》》》》开始");
|
|
|
MAP.clear();
|
|
|
@@ -85,8 +88,8 @@ public class PlanNewCommonOutController {
|
|
|
@GetMapping("getPlanNewCommonH5")
|
|
|
public Mono<RStatus<byte[]>> getPlanNewCommonH5(@RequestParam("code") String code) {
|
|
|
Mono<PlanNewCommon> planNewCommonMono = template.selectOne(Query.query(Criteria.where("code").is(code)), PlanNewCommon.class)
|
|
|
- .switchIfEmpty(Mono.error(new BaseException("计划code异常")))
|
|
|
- .onErrorResume(throwable -> Mono.error(new BaseException("计划code异常")));
|
|
|
+ .switchIfEmpty(Mono.error(new BaseException("计划code异常:" + ExceptionUtils.getStackTrace(new Exception()))))
|
|
|
+ .onErrorResume(throwable -> Mono.error(new Exception(LogExceptionStackTrace.erroStackTrace(throwable).toString())));
|
|
|
Mono<PlanNewCommonRes> resMono = planNewCommonMono.flatMap(f -> {
|
|
|
// 群成员
|
|
|
Mono<List<GroupUserRes>> groupUserResMono = Mono.just(new ArrayList<>());
|
|
|
@@ -94,16 +97,16 @@ public class PlanNewCommonOutController {
|
|
|
Mono<List<Image>> imageMono = template.select(Query.query(Criteria.where("type").is(1)
|
|
|
.and("group_type_id").is(f.groupId())
|
|
|
.and("deleted_at").isNull()), Image.class)
|
|
|
- .onErrorResume(throwable -> Mono.error(new BaseException("获取群封面异常"))).collectList();
|
|
|
+ .onErrorResume(throwable -> Mono.error(new Exception(LogExceptionStackTrace.erroStackTrace(throwable).toString()))).collectList();
|
|
|
// 群名称
|
|
|
Mono<List<Material>> textMono = template.select(Query.query(Criteria.where("type").is(4)
|
|
|
.and("deleted_at").isNull()
|
|
|
.and("group_type_id").is(f.groupId())), Material.class)
|
|
|
- .onErrorResume(throwable -> Mono.error(new BaseException("获取群名称异常"))).collectList();
|
|
|
+ .onErrorResume(throwable -> Mono.error(new Exception(LogExceptionStackTrace.erroStackTrace(throwable).toString()))).collectList();
|
|
|
if (3 == f.type()) {
|
|
|
// 交友裂变, 需要群成员
|
|
|
Mono<List<GroupUsers>> groupUsersMono = template.select(Query.query(Criteria.where("group_users_type").is(f.groupId())).limit(14), GroupUsers.class)
|
|
|
- .onErrorResume(throwable -> Mono.error(new BaseException("获取群成员异常"))).collectList();
|
|
|
+ .onErrorResume(throwable -> Mono.error(new Exception(LogExceptionStackTrace.erroStackTrace(throwable).toString()))).collectList();
|
|
|
groupUserResMono = groupUsersMono.flatMap(groupUsers -> {
|
|
|
List<GroupUserRes> groupUserResList = groupUsers.stream().map(groupUsers1 -> {
|
|
|
GroupUserRes groupUserRes = new GroupUserRes();
|
|
|
@@ -175,7 +178,7 @@ public class PlanNewCommonOutController {
|
|
|
public Mono<RStatus<byte[]>> kefuList(@RequestBody KefuRequest request) {
|
|
|
Mono<PlanNewCommon> code = template.selectOne(Query.query(Criteria.where("code").is(request.getCode())), PlanNewCommon.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException("code查询返回结构为空")))
|
|
|
- .onErrorResume(throwable -> Mono.error(new BaseException("code查询返回结构为空")));
|
|
|
+ .onErrorResume(throwable -> Mono.error(new Exception(LogExceptionStackTrace.erroStackTrace(throwable).toString())));
|
|
|
Mono<DataListsKefu> dataListsKefuMono = code.flatMap(planNew -> {
|
|
|
Mono<List<Image>> image = template.select(Query.query(Criteria.where("type").is(5)
|
|
|
.and("deleted_at").isNull()
|
|
|
@@ -183,13 +186,13 @@ public class PlanNewCommonOutController {
|
|
|
.collectList()
|
|
|
.switchIfEmpty(Mono.error(new BaseException(StrUtil.format("通过计划groupId:{}查询Image返回结构为空", planNew.groupId()))))
|
|
|
.onErrorResume(throwable ->
|
|
|
- Mono.error(new BaseException(StrUtil.format("通过计划groupId:{}查询Image返回结果error:{}", planNew.groupId(), throwable.getMessage()))));
|
|
|
+ Mono.error(new Exception(StrUtil.format("通过计划groupId:{}查询Image返回结果error:{}", planNew.groupId(), LogExceptionStackTrace.erroStackTrace(throwable).toString()))));
|
|
|
Mono<List<Material>> text = template.select(Query.query(Criteria.where("type").is(11)
|
|
|
.and("group_type_id").is(planNew.groupId())
|
|
|
.and("deleted_at").isNull()), Material.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException(StrUtil.format("通过计划groupId:{}查询Material返回结构为空", planNew.groupId()))))
|
|
|
.onErrorResume(throwable ->
|
|
|
- Mono.error(new BaseException(StrUtil.format("通过计划groupId:{}查询Material返回结果error:{}", planNew.groupId(), throwable.getMessage()))))
|
|
|
+ Mono.error(new Exception(StrUtil.format("通过计划groupId:{}查询Material返回结果error:{}", planNew.groupId(), LogExceptionStackTrace.erroStackTrace(throwable).toString()))))
|
|
|
.collectList();
|
|
|
Mono<List<H5ImageAndText>> arrayListMono = Mono.zip(Mono.just(planNew), image, text).flatMap(f -> {
|
|
|
// H5ImageAndText
|
|
|
@@ -198,7 +201,7 @@ public class PlanNewCommonOutController {
|
|
|
List<Image> t3 = f.getT2();
|
|
|
List<Material> t4 = f.getT3();
|
|
|
if (t3.size() < integer || t4.size() < integer) {
|
|
|
- return Mono.error(new BaseException("图片或文字素材小于计划设置数"));
|
|
|
+ throw new BaseException("图片或文字素材小于计划设置数");
|
|
|
}
|
|
|
ArrayList<Long> listImg = new ArrayList<>();
|
|
|
ArrayList<Long> listTxt = new ArrayList<>();
|
|
|
@@ -284,7 +287,7 @@ public class PlanNewCommonOutController {
|
|
|
Mono<PlanNew> code1 = template
|
|
|
.selectOne(Query.query(Criteria.where("code").is(request.getCode())), PlanNew.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException("计划code异常 返回结果为空")))
|
|
|
- .onErrorResume(throwable -> Mono.error(new BaseException("计划code异常")));
|
|
|
+ .onErrorResume(throwable -> Mono.error(new Exception(LogExceptionStackTrace.erroStackTrace(throwable).toString())));
|
|
|
Mono<DomainSelectRes> domainSelectResMono1 = code1.flatMap(f -> {
|
|
|
Mono<String> stringMono;
|
|
|
if (f.transferPageBl() == 1 && Objects.nonNull(f.transferPageDomain())) {
|
|
|
@@ -294,7 +297,7 @@ public class PlanNewCommonOutController {
|
|
|
.and("type").is(5)
|
|
|
.and("deleted_at").isNull()), DomainSelect.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException("transferPageDomain 域名查詢為空 group_type_id:::" + f.transferPageDomain())))
|
|
|
- .onErrorResume(throwable -> Mono.error(new BaseException("transferPageDomain 域名查詢為空 group_type_id:::" + f.transferPageDomain()))).collectList().flatMap(fff -> {
|
|
|
+ .onErrorResume(throwable -> Mono.error(new Exception(LogExceptionStackTrace.erroStackTrace(throwable).toString()))).collectList().flatMap(fff -> {
|
|
|
if (!fff.isEmpty()) {
|
|
|
DomainSelect domainSelect = fff.get(RandomUtil.randomInt(0, fff.size()));
|
|
|
String string = RandomUtil.randomString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 6);
|
|
|
@@ -302,7 +305,7 @@ public class PlanNewCommonOutController {
|
|
|
return Mono.just(string + "." + domain1);
|
|
|
|
|
|
} else {
|
|
|
- return Mono.error(new BaseException("transferPageDomain 中轉域名查詢為空 group_type_id:::" + f.transferPageDomain()));
|
|
|
+ throw new BaseException("transferPageDomain 中轉域名查詢為空 group_type_id:::" + f.transferPageDomain());
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
@@ -316,14 +319,14 @@ public class PlanNewCommonOutController {
|
|
|
.and("type").is(4)
|
|
|
.and("deleted_at").isNull()), DomainSelect.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException("backgroupDomain 域名查询为空 group_type_id" + f.backgroupDomain())))
|
|
|
- .onErrorResume(throwable -> Mono.error(new BaseException("backgroupDomain 域名查询为空 group_type_id" + f.backgroupDomain()))).collectList().flatMap(fff -> {
|
|
|
+ .onErrorResume(throwable -> Mono.error(new Exception(LogExceptionStackTrace.erroStackTrace(throwable).toString()))).collectList().flatMap(fff -> {
|
|
|
if (!fff.isEmpty()) {
|
|
|
DomainSelect domainSelect = fff.get(RandomUtil.randomInt(0, fff.size()));
|
|
|
String string = RandomUtil.randomString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 6);
|
|
|
String domain1 = domainSelect.domain();
|
|
|
return Mono.just(string + "." + domain1);
|
|
|
} else {
|
|
|
- return Mono.error(new BaseException("backgroupDomain 背景域名查詢為空 group_type_id" + f.backgroupDomain()));
|
|
|
+ throw new BaseException("backgroupDomain 背景域名查詢為空 group_type_id" + f.backgroupDomain());
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
@@ -335,7 +338,7 @@ public class PlanNewCommonOutController {
|
|
|
.and("type").is(request.getType())
|
|
|
.and("deleted_at").isNull()), DomainSelect.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException("查询domain 返回结果为空")))
|
|
|
- .onErrorResume(throwable -> Mono.error(new BaseException("查询domain 返回结果为空"))).collectList().flatMap(fm -> {
|
|
|
+ .onErrorResume(throwable -> Mono.error(new Exception(LogExceptionStackTrace.erroStackTrace(throwable).toString()))).collectList().flatMap(fm -> {
|
|
|
// DomainSelectRes domainSelectRes = new DomainSelectRes();
|
|
|
int i = RandomUtil.randomInt(0, fm.size());
|
|
|
String domain = fm.get(i).domain();
|
|
|
@@ -362,14 +365,14 @@ public class PlanNewCommonOutController {
|
|
|
private Mono<RStatus<DomainSelectRes>> getListeningPlan(OutDomainRequest request) {
|
|
|
Mono<ListeningPlanNew> code1 = template.selectOne(Query.query(Criteria.where("code").is(request.getCode())), ListeningPlanNew.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException("计划code异常 返回结果为空")))
|
|
|
- .onErrorResume(throwable -> Mono.error(new BaseException("计划code异常 返回结果为空")));
|
|
|
+ .onErrorResume(throwable -> Mono.error(new Exception(LogExceptionStackTrace.erroStackTrace(throwable).toString())));
|
|
|
Mono<DomainSelectRes> domainSelectResMono1 = code1.flatMap(f -> template.select(Query.query(Criteria
|
|
|
.where("group_type_id").is(f.groupId())
|
|
|
.and("status").is(1)
|
|
|
.and("type").is(request.getType())
|
|
|
.and("deleted_at").isNull()), DomainSelect.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException("查询domain 返回结果为空")))
|
|
|
- .onErrorResume(throwable -> Mono.error(new BaseException("查询domain 返回结果为空"))).collectList()
|
|
|
+ .onErrorResume(throwable -> Mono.error(new Exception(LogExceptionStackTrace.erroStackTrace(throwable).toString()))).collectList()
|
|
|
.flatMap(fm -> {
|
|
|
DomainSelectRes domainSelectRes = new DomainSelectRes();
|
|
|
int i = RandomUtil.randomInt(0, fm.size());
|
|
|
@@ -397,7 +400,7 @@ public class PlanNewCommonOutController {
|
|
|
.and("deleted_at").isNull()
|
|
|
.and("type").is(request.getType())), DomainSelect.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException("查询domain 返回结果为空")))
|
|
|
- .onErrorResume(throwable -> Mono.error(new BaseException("查询domain 返回结果为空")))
|
|
|
+ .onErrorResume(throwable -> Mono.error(new Exception(LogExceptionStackTrace.erroStackTrace(throwable).toString())))
|
|
|
.collectList().flatMap(fm -> {
|
|
|
int i = RandomUtil.randomInt(0, fm.size());
|
|
|
String domain = fm.get(i).domain();
|
|
|
@@ -413,14 +416,14 @@ public class PlanNewCommonOutController {
|
|
|
.and("type").is(5)
|
|
|
.and("deleted_at").isNull()), DomainSelect.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException("transferPageDomain 域名查詢為空 group_type_id:::" + request.getTransferPageDomain())))
|
|
|
- .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()))).collectList().flatMap(fff -> {
|
|
|
+ .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()))).collectList().flatMap(fff -> {
|
|
|
if (!fff.isEmpty()) {
|
|
|
DomainSelect domainSelect = fff.get(RandomUtil.randomInt(0, fff.size()));
|
|
|
String string = RandomUtil.randomString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 6);
|
|
|
String domain1 = domainSelect.domain();
|
|
|
return Mono.just(string + "." + domain1);
|
|
|
} else {
|
|
|
- return Mono.error(new BaseException("transferPageDomain 中轉域名查詢為空 group_type_id:::" + request.getTransferPageDomain()));
|
|
|
+ throw new BaseException("transferPageDomain 中轉域名查詢為空 group_type_id:::" + request.getTransferPageDomain());
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
@@ -434,14 +437,14 @@ public class PlanNewCommonOutController {
|
|
|
.and("type").is(4)
|
|
|
.and("deleted_at").isNull()), DomainSelect.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException("backgroupDomain 域名查询为空 group_type_id" + request.getBackgroupDomain())))
|
|
|
- .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()))).collectList().flatMap(fff -> {
|
|
|
+ .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()))).collectList().flatMap(fff -> {
|
|
|
if (!fff.isEmpty()) {
|
|
|
DomainSelect domainSelect = fff.get(RandomUtil.randomInt(0, fff.size()));
|
|
|
String string = RandomUtil.randomString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 6);
|
|
|
String domain1 = domainSelect.domain();
|
|
|
return Mono.just(string + "." + domain1);
|
|
|
} else {
|
|
|
- return Mono.error(new BaseException("backgroupDomain 背景域名查詢為空 group_type_id" + request.getBackgroupDomain()));
|
|
|
+ throw new BaseException("backgroupDomain 背景域名查詢為空 group_type_id" + request.getBackgroupDomain());
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
@@ -469,7 +472,7 @@ public class PlanNewCommonOutController {
|
|
|
.and("deleted_at").isNull()
|
|
|
.and("type").is(request.getType())), DomainSelect.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException("查询domain 返回结果为空")))
|
|
|
- .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage())))
|
|
|
+ .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage())))
|
|
|
.collectList().flatMap(fm -> {
|
|
|
int i = RandomUtil.randomInt(0, fm.size());
|
|
|
String domain = fm.get(i).domain();
|
|
|
@@ -497,7 +500,7 @@ public class PlanNewCommonOutController {
|
|
|
public Mono<RStatus<PlanNewCommonMaterialRes>> getCommonMaterial(@RequestBody PlanNewCommonMaterialReq request) {
|
|
|
Mono<PlanNewCommon> planNewCommonMono = template.selectOne(Query.query(Criteria.where("code").is(request.getCode())), PlanNewCommon.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException("计划code异常 返回结果为空")))
|
|
|
- .onErrorResume(throwable -> Mono.error(new BaseException("计划code异常 返回结果为空")));
|
|
|
+ .onErrorResume(throwable -> Mono.error(new Exception(LogExceptionStackTrace.erroStackTrace(throwable).toString())));
|
|
|
Mono<PlanNewCommonMaterialRes> materialResMono = planNewCommonMono.flatMap(plan -> {
|
|
|
// 群音频
|
|
|
Mono<Audio> groupAudio = this.getAudio(request.getAudioId());
|
|
|
@@ -511,7 +514,7 @@ public class PlanNewCommonOutController {
|
|
|
returnLoop = template.selectOne(Query.query(Criteria.where("id").is(request.getReturnLoopId())
|
|
|
.and("deleted_at").isNull()), ReturnLoop.class)
|
|
|
.switchIfEmpty(Mono.just(getReturnLoop()))
|
|
|
- .onErrorResume(throwable -> Mono.error(new BaseException("查询返回广告异常:::" + throwable.getMessage())));
|
|
|
+ .onErrorResume(throwable -> Mono.error(new Exception(LogExceptionStackTrace.erroStackTrace(throwable).toString())));
|
|
|
}
|
|
|
// 分享背景组
|
|
|
Mono<List<BackgroupImageItem>> backgroupImageItemMono;
|
|
|
@@ -521,17 +524,17 @@ public class PlanNewCommonOutController {
|
|
|
backgroupImageItemMono = template.select(Query.query(Criteria
|
|
|
.where("group_id").is(request.getBackgroundGroupId())), BackgroupImageItem.class).collectList()
|
|
|
.switchIfEmpty(Mono.just(List.of()))
|
|
|
- .onErrorResume(throwable -> Mono.error(new BaseException("查询分享背景组异常:::" + throwable.getMessage())));
|
|
|
+ .onErrorResume(throwable -> Mono.error(new Exception(LogExceptionStackTrace.erroStackTrace(throwable).toString())));
|
|
|
}
|
|
|
- Mono<TakeawayH5Data> takeaway;
|
|
|
+ Mono<TakeawayH5Data> takeaway ;
|
|
|
if (Objects.nonNull(request.getTakeawayId()) && request.getTakeawayId() > 0) {
|
|
|
takeaway = takeawayServicesInterface.getTakeaway(request.getTakeawayId())
|
|
|
.switchIfEmpty(Mono.just(new TakeawayH5Data()))
|
|
|
- .onErrorResume(e -> Mono.error(new BaseException("查询外卖模版数据异常:::" + e.getMessage())));
|
|
|
- } else {
|
|
|
- takeaway = Mono.just(new TakeawayH5Data());
|
|
|
+ .onErrorResume(e->Mono.error(new BaseException("查询外卖模版数据异常:::"+LogExceptionStackTrace.erroStackTrace(e).toString())));
|
|
|
+ }else {
|
|
|
+ takeaway=Mono.just(new TakeawayH5Data());
|
|
|
}
|
|
|
- return Mono.zip(groupAudio, retAudio, returnLoop, backgroupImageItemMono, takeaway).flatMap(f -> {
|
|
|
+ return Mono.zip(groupAudio, retAudio, returnLoop, backgroupImageItemMono,takeaway).flatMap(f -> {
|
|
|
PlanNewCommonMaterialRes materialRes = new PlanNewCommonMaterialRes();
|
|
|
materialRes.setGroupAudio(f.getT1());
|
|
|
materialRes.setRetAudio(f.getT2());
|
|
|
@@ -591,9 +594,6 @@ public class PlanNewCommonOutController {
|
|
|
*/
|
|
|
@PostMapping("planCommonShare")
|
|
|
public Mono<RStatus<PlanNewCommonShareRes>> planCommonShare(@RequestBody PlanNewCommonShareReq request) {
|
|
|
- if (request == null) {
|
|
|
- return Mono.error(new BaseException("请求参数为空"));
|
|
|
- }
|
|
|
if (MAP.containsKey(request.getUnique())) {
|
|
|
Integer integer = MAP.get(request.getUnique());
|
|
|
MAP.put(request.getUnique(), integer + 1);
|
|
|
@@ -604,7 +604,7 @@ public class PlanNewCommonOutController {
|
|
|
}
|
|
|
Mono<PlanNewCommon> planNewCommonMono = template.selectOne(Query.query(Criteria.where("code").is(request.getCode())), PlanNewCommon.class)
|
|
|
.switchIfEmpty(Mono.error(new BaseException(" code错误")))
|
|
|
- .onErrorResume(throwable -> Mono.error(new BaseException("code错误::" + throwable.getMessage())));
|
|
|
+ .onErrorResume(throwable -> Mono.error(new Exception(LogExceptionStackTrace.erroStackTrace(throwable).toString())));
|
|
|
Mono<PlanNewCommonShareRes> resMono = planNewCommonMono.flatMap(plan -> {
|
|
|
Mono<StringBuilder> stringBuilderMono;
|
|
|
boolean isQs = Objects.nonNull(request.getWx_user_id()) && !request.getWx_user_id().isEmpty();
|
|
|
@@ -644,7 +644,7 @@ public class PlanNewCommonOutController {
|
|
|
int v = userVisits % qs.size();
|
|
|
res.setQsSetting(qs.get(v));
|
|
|
if (f.getT6().toString().isEmpty()) {
|
|
|
- return Mono.error(new BaseException("计划链接 查询匹配域名为空"));
|
|
|
+ throw new BaseException("计划链接 查询匹配域名为空");
|
|
|
}
|
|
|
res.setLink(f.getT6().toString());
|
|
|
} else {
|
|
|
@@ -666,7 +666,7 @@ public class PlanNewCommonOutController {
|
|
|
int v = userVisits % fx.size();
|
|
|
res.setFxSetting(fx.get(v));
|
|
|
if (f.getT6().toString().isEmpty()) {
|
|
|
- return Mono.error(new BaseException("计划链接 查询匹配域名为空"));
|
|
|
+ throw new BaseException("计划链接 查询匹配域名为空");
|
|
|
}
|
|
|
res.setLink(f.getT6().toString());
|
|
|
} else {
|
|
|
@@ -720,7 +720,7 @@ public class PlanNewCommonOutController {
|
|
|
try {
|
|
|
jsonObject1 = JSONUtil.parseObj(ret);
|
|
|
} catch (Exception e) {
|
|
|
- return Mono.error(new Exception(e.getMessage() + "---" + JSONUtil.parseObj(goRequest) + " error:" + LogExceptionStackTrace.erroStackTrace(e).toString()));
|
|
|
+ throw new BaseException(e.getMessage() + "---" + JSONUtil.parseObj(goRequest) + " error:" + LogExceptionStackTrace.erroStackTrace(e).toString());
|
|
|
}
|
|
|
if (jsonObject1.containsKey("code") && jsonObject1.get("code", Integer.class) == 0 && jsonObject1.containsKey("data")) {
|
|
|
JSONObject data = jsonObject1.get("data", JSONObject.class);
|
|
|
@@ -748,8 +748,7 @@ public class PlanNewCommonOutController {
|
|
|
try {
|
|
|
jsonObject = JSONUtil.parseObj(posterTemplate);
|
|
|
} catch (Exception e) {
|
|
|
- log.error(e.getMessage() + "---" + posterTemplate + " error:" + LogExceptionStackTrace.erroStackTrace(e).toString());
|
|
|
- return null;
|
|
|
+ throw new BaseException(e.getMessage() + "---" + posterTemplate + " error:" + LogExceptionStackTrace.erroStackTrace(e).toString());
|
|
|
}
|
|
|
// JSONObject jsonObject = JSONUtil.parseObj(posterTemplate);
|
|
|
GoRequest goRequest = new GoRequest();
|
|
|
@@ -795,7 +794,7 @@ public class PlanNewCommonOutController {
|
|
|
try {
|
|
|
jsonObject = JSONUtil.parseObj(posterTemplate);
|
|
|
} catch (Exception e) {
|
|
|
- return Mono.error(new Exception(e.getMessage() + "---" + posterTemplate + " error:" + LogExceptionStackTrace.erroStackTrace(e).toString()));
|
|
|
+ throw new BaseException(e.getMessage() + "---" + posterTemplate + " error:" + LogExceptionStackTrace.erroStackTrace(e).toString());
|
|
|
}
|
|
|
GoRequest goRequest = new GoRequest();
|
|
|
BeanUtil.copyProperties(jsonObject, goRequest);
|