wangcheng 2 anos atrás
pai
commit
197865ab56

+ 23 - 23
launch-admin/src/main/java/com/webflux/launchadmin/mysql/controller/planNew/PlanNewCommonOutController.java

@@ -95,16 +95,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 Exception(throwable.getMessage() + "2"))).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 Exception(throwable.getMessage() + "3"))).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 Exception(throwable.getMessage() + "4"))).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();
@@ -176,7 +176,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 Exception("通过code查询计划异常::" + throwable.getMessage())));
+                .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()
@@ -184,13 +184,13 @@ public class PlanNewCommonOutController {
                     .collectList()
                     .switchIfEmpty(Mono.error(new BaseException(StrUtil.format("通过计划groupId:{}查询Image返回结构为空", planNew.groupId()))))
                     .onErrorResume(throwable ->
-                            Mono.error(new Exception(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 Exception(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
@@ -283,7 +283,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 Exception(throwable.getMessage())));
+                .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())) {
@@ -293,7 +293,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 Exception(throwable.getMessage()))).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);
@@ -315,7 +315,7 @@ 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 Exception(throwable.getMessage()))).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);
@@ -334,7 +334,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 Exception(throwable.getMessage()))).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();
@@ -361,14 +361,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 Exception(throwable.getMessage())));
+                .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 Exception(throwable.getMessage()))).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());
@@ -396,7 +396,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 Exception(throwable.getMessage())))
+                    .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();
@@ -424,7 +424,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 Exception(throwable.getMessage())));
+                .onErrorResume(throwable -> Mono.error(new Exception(LogExceptionStackTrace.erroStackTrace(throwable).toString())));
         Mono<PlanNewCommonMaterialRes> materialResMono = planNewCommonMono.flatMap(plan -> {
             // 群音频
             Mono<Audio> groupAudio = this.getAudio(request.getAudioId());
@@ -438,7 +438,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 Exception(throwable.getMessage() + "3")));
+                        .onErrorResume(throwable -> Mono.error(new Exception(LogExceptionStackTrace.erroStackTrace(throwable).toString())));
             }
             // 分享背景组
             Mono<List<BackgroupImageItem>> backgroupImageItemMono;
@@ -448,13 +448,13 @@ 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 Exception(throwable.getMessage() + "4")));
+                        .onErrorResume(throwable -> Mono.error(new Exception(LogExceptionStackTrace.erroStackTrace(throwable).toString())));
             }
             Mono<TakeawayH5Data> takeaway ;
             if (Objects.nonNull(request.getTakeawayId()) && request.getTakeawayId() > 0) {
                 takeaway = takeawayServicesInterface.getTakeaway(request.getTakeawayId())
-                        .switchIfEmpty(Mono.error(new BaseException("查询外卖模版数据异常 查询结果为空")))
-                        .onErrorResume(e->Mono.error(new BaseException("查询外卖模版数据异常:::"+e.getMessage())));
+                        .switchIfEmpty(Mono.just(new TakeawayH5Data()))
+                        .onErrorResume(e->Mono.error(new BaseException("查询外卖模版数据异常:::"+LogExceptionStackTrace.erroStackTrace(e).toString())));
             }else {
                 takeaway=Mono.just(new TakeawayH5Data());
             }
@@ -484,7 +484,7 @@ public class PlanNewCommonOutController {
         }
         return template.selectOne(Query.query(Criteria.where("id").is(id)), Audio.class)
                 .switchIfEmpty(Mono.error(new BaseException(StrUtil.format("通过计划retAudioId:{}查询音频为空", id))))
-                .onErrorResume(throwable -> Mono.error(new BaseException(StrUtil.format("通过计划retAudioId:{}查询音频Error::", id, throwable.getMessage()))));
+                .onErrorResume(throwable -> Mono.error(new BaseException(StrUtil.format("通过计划retAudioId:{}查询音频Error::{}", id, throwable.getMessage()))));
         // String value = redisTemplate.opsForValue().get(RedisKey.FISSION_AUDIO + id);
         // 优先读缓存
         // Mono<String> obj = reactiveRedisTemplate.opsForValue().get(RedisKey.FISSION_AUDIO + id)
@@ -528,7 +528,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 Exception(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 {
                 try {
                     jsonObject1 = JSONUtil.parseObj(ret);
                 } catch (Exception e) {
-                    throw new BaseException(e.getMessage() + "---" + JSONUtil.parseObj(goRequest));
+                    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);
@@ -672,7 +672,7 @@ public class PlanNewCommonOutController {
         try {
             jsonObject = JSONUtil.parseObj(posterTemplate);
         } catch (Exception e) {
-            throw new BaseException(e.getMessage() + "---" + posterTemplate);
+            throw new BaseException(e.getMessage() + "---" + posterTemplate + " error:" + LogExceptionStackTrace.erroStackTrace(e).toString());
         }
         // JSONObject jsonObject = JSONUtil.parseObj(posterTemplate);
         GoRequest goRequest = new GoRequest();
@@ -718,7 +718,7 @@ public class PlanNewCommonOutController {
             try {
                 jsonObject = JSONUtil.parseObj(posterTemplate);
             } catch (Exception e) {
-                throw new BaseException(e.getMessage() + "---" + posterTemplate);
+                throw new BaseException(e.getMessage() + "---" + posterTemplate + " error:" + LogExceptionStackTrace.erroStackTrace(e).toString());
             }
             GoRequest goRequest = new GoRequest();
             BeanUtil.copyProperties(jsonObject, goRequest);