فهرست منبع

fix: 错误日志报警

wangcheng 2 سال پیش
والد
کامیت
f7c9822117

+ 8 - 8
launch-admin/src/main/java/com/webflux/launchadmin/config/LoginWebFiter.java

@@ -111,7 +111,7 @@ public class LoginWebFiter implements WebFilter {
 
     public Boolean getUser(String cookie) throws IOException {
         if (Objects.isNull(cookie)) {
-            log.error("111111111");
+            log.warn("111111111, no cookie");
             return false;
         }
         if(UserContext.cMap.containsKey(cookie)){
@@ -129,14 +129,14 @@ public class LoginWebFiter implements WebFilter {
             HttpEntity entity = response.getEntity();
             String result = EntityUtils.toString(entity);
             EntityUtils.consume(entity);
-            log.error("3");
+            log.warn("3");
             if (Objects.nonNull(result)) {
-                log.error("4");
+                log.warn("4");
                 JSONObject jsonObject = JSONUtil.parseObj(result);
                 if (jsonObject.containsKey("code") && jsonObject.get("code", Integer.class) == 200) {
-                    log.error("5");
+                    log.warn("5");
                     if(jsonObject.containsKey("data")){
-                        log.error("7");
+                        log.warn("7");
                         XxlSsoUser data = jsonObject.get("data", XxlSsoUser.class);
                         BaseContextHandler.setUserId(data.getUserid());
                         BaseContextHandler.setUserName(data.getUsername());
@@ -145,19 +145,19 @@ public class LoginWebFiter implements WebFilter {
                         return true;
                     }
                 }else if(jsonObject.containsKey("code") && jsonObject.get("code", Integer.class) == 501){
-                    log.error("7.1");
+                    log.warn("7.1");
                     return false;
                 }else {
                     return true;
                 }
             }
-            log.error("8");
+            log.warn("8");
         } catch (Exception e) {
             return true;
         } finally {
             response.close();
         }
-        log.error("2222222222222");
+        log.warn("2222222222222");
         return true;
 
     }

+ 9 - 6
launch-admin/src/main/java/com/webflux/launchadmin/global/GlobalExceptionHandler.java

@@ -17,14 +17,15 @@ import org.springframework.web.multipart.MaxUploadSizeExceededException;
 import org.springframework.web.server.ServerWebExchange;
 import reactor.core.publisher.Mono;
 
-import javax.management.RuntimeErrorException;
 import javax.security.auth.login.AccountExpiredException;
-import java.io.IOException;
 import java.nio.file.AccessDeniedException;
-import java.sql.SQLException;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Objects;
 
+/**
+ * @author moka
+ */
 @RestControllerAdvice
 @Slf4j
 public class GlobalExceptionHandler {
@@ -32,7 +33,7 @@ public class GlobalExceptionHandler {
     @ResponseStatus(HttpStatus.BAD_REQUEST)
     @ExceptionHandler(BaseException.class)
     public Mono<RW<Object>> handleException(BaseException e, ServerWebExchange exchange) {
-        log.warn("接口异常 uri={} e={}", exchange.getRequest().getPath().value(), e.getMessage());
+        log.warn("接口异常 uri={} e={}", exchange.getRequest().getPath().value(), LogExceptionStackTrace.erroStackTrace(e));
         return RW.fail("500", e.getMessage(), Mono.just(e.getMessage()));
     }
 
@@ -87,7 +88,8 @@ public class GlobalExceptionHandler {
     @ExceptionHandler(BindException.class)
     public Mono<RW<Object>> validatedBindException(ServerWebExchange exchange, BindException e) {
         log.warn("接口异常 uri={} e={}", exchange.getRequest().getPath().value(), LogExceptionStackTrace.erroStackTrace(e));
-        String message = e.getAllErrors().get(0).getDefaultMessage();
+        String message = e.getAllErrors().getFirst().getDefaultMessage();
+        assert message != null;
         return RW.fail(message, Mono.just(message));
     }
 
@@ -97,7 +99,8 @@ public class GlobalExceptionHandler {
     @ExceptionHandler(MethodArgumentNotValidException.class)
     public Mono<RW<Object>> validExceptionHandler(ServerWebExchange exchange, MethodArgumentNotValidException e) {
         log.warn("接口异常 uri={} e={}", exchange.getRequest().getPath().value(), LogExceptionStackTrace.erroStackTrace(e));
-        String message = e.getBindingResult().getFieldError().getDefaultMessage();
+        String message = Objects.requireNonNull(e.getBindingResult().getFieldError()).getDefaultMessage();
+        assert message != null;
         return RW.fail(message, Mono.just(message));
     }
 }

+ 3 - 3
launch-admin/src/main/java/com/webflux/launchadmin/mysql/controller/planNew/PlanNewCommonController.java

@@ -157,7 +157,7 @@ public class PlanNewCommonController {
                 .select(Query.query(Criteria.where("poster_template_id").is(planReq.getPosterTemplateId()))
                         .sort(Sort.by(Sort.Order.asc("created_at"))), Poster.class)
                 .switchIfEmpty(Mono.error(new BaseException("未查询到海报模版")))
-                .onErrorResume(throwable -> Mono.error(new Exception("未查询到海报模版")))
+                .onErrorResume(throwable -> Mono.error(new BaseException("未查询到海报模版")))
                 .collectList().flatMap(f -> {
                     Poster poster = f.getFirst();
                     String posterTemplate = poster.posterTemplate();
@@ -227,7 +227,7 @@ public class PlanNewCommonController {
             // 交友计划
             Mono<PlanNewCommon> planNewCommonMono = template.selectOne(Query.query(Criteria.where("id").is(planId)), PlanNewCommon.class)
                     .switchIfEmpty(Mono.error(new BaseException("计划id异常")))
-                    .onErrorResume(throwable -> Mono.error(new Exception("计划id异常")));
+                    .onErrorResume(throwable -> Mono.error(new BaseException("计划id异常")));
             return RStatus.success(planNewCommonMono);
 
     }
@@ -319,7 +319,7 @@ public class PlanNewCommonController {
             Query plan = Query.query(Criteria.where("id").is(planId));
             Mono<Long> planNewCommon = template.delete(plan, PlanNewCommon.class)
                     .switchIfEmpty(Mono.error(new BaseException("计划id异常")))
-                    .onErrorResume(throwable -> Mono.error(new Exception("删除计划 " + planId + "---" + type + "error:" + throwable.getMessage())));
+                    .onErrorResume(throwable -> Mono.error(new BaseException("删除计划 " + planId + "---" + type + "error:" + throwable.getMessage())));
             Query planNewId = Query.query(Criteria.where("plan_new_id").is(planId));
             Mono<Long> poster = template.count(planNewId, PlanNewBackgroupPoster.class).filter(f -> f > 0)
                     .flatMap(f -> template.delete(planNewId, PlanNewBackgroupPoster.class))

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

@@ -413,14 +413,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 Exception(throwable.getMessage()))).collectList().flatMap(fff -> {
+                    .onErrorResume(throwable -> Mono.error(new BaseException(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 {
-                            throw new BaseException("transferPageDomain 中轉域名查詢為空 group_type_id:::" +  request.getTransferPageDomain());
+                            return Mono.error(new BaseException("transferPageDomain 中轉域名查詢為空 group_type_id:::" +  request.getTransferPageDomain()));
                         }
                     });
         } else {
@@ -434,14 +434,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 Exception(throwable.getMessage()))).collectList().flatMap(fff -> {
+                    .onErrorResume(throwable -> Mono.error(new BaseException(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 {
-                            throw new BaseException("backgroupDomain 背景域名查詢為空 group_type_id" + request.getBackgroupDomain());
+                            return Mono.error(new BaseException("backgroupDomain 背景域名查詢為空 group_type_id" + request.getBackgroupDomain()));
                         }
                     });
         } else {
@@ -469,7 +469,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 BaseException(throwable.getMessage())))
                     .collectList().flatMap(fm -> {
                         int i = RandomUtil.randomInt(0, fm.size());
                         String domain = fm.get(i).domain();

+ 7 - 7
launch-admin/src/main/java/com/webflux/launchadmin/mysql/controller/planNew/PlanNewController.java

@@ -141,7 +141,7 @@ public class PlanNewController {
     public Mono<RStatus<BackgroupImageRes>> backgroupImageRes(@PathVariable("id") Long id) {
         Mono<BackgroupImage> id1 = template.selectOne(Query.query(Criteria.where("id")
                         .is(id)), BackgroupImage.class).switchIfEmpty(Mono.error(new BaseException(" 通过code查询结果为空")))
-                .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage())));
+                .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage())));
         Mono<List<BackgroupImageItem>> group_id = template.select(Query.query(Criteria.where("group_id")
                 .is(id)).sort(Sort.by(Sort.Order.asc("index"))), BackgroupImageItem.class).collectList();
         Mono<BackgroupImageRes> zip = Mono.zip(id1, group_id, (lambdaA, lambdaB) -> {
@@ -788,7 +788,7 @@ public class PlanNewController {
             Query plan_new_id2 = Query.query(Criteria.where("plan_new_id").is(planNewId));
             Mono<Long> plan_new_id = template.delete(plan_new_id2, PlanNew.class)
                     .switchIfEmpty(Mono.error(new BaseException("计划id异常"))) // Mono.error(new BaseException("查询海报模版 id:"+f.posterTemplateId()+"=>空"))
-                    .onErrorResume(throwable -> Mono.error(new Exception("删除计划 " + planNewId + "---" + type + "error:" + throwable.getMessage())));
+                    .onErrorResume(throwable -> Mono.error(new BaseException("删除计划 " + planNewId + "---" + type + "error:" + throwable.getMessage())));
             Mono<Long> plan_new_id1 = template.count(plan_new_id2, PlanNewBackgroupPoster.class).filter(f -> f > 0)
                     .flatMap(f -> template.delete(plan_new_id2, PlanNewBackgroupPoster.class))
                     .switchIfEmpty(Mono.just(0L));
@@ -799,7 +799,7 @@ public class PlanNewController {
                     .is(planNewId));
             Mono<Long> listening_plan_new_id = template.delete(listening_plan_new_id1, ListeningPlanNew.class)
                     .switchIfEmpty(Mono.error(new BaseException("计划id异常"))) // Mono.error(new BaseException("查询海报模版 id:"+f.posterTemplateId()+"=>空"))
-                    .onErrorResume(throwable -> Mono.error(new Exception("删除计划 " + planNewId + "---" + type + "error:" + throwable.getMessage())));
+                    .onErrorResume(throwable -> Mono.error(new BaseException("删除计划 " + planNewId + "---" + type + "error:" + throwable.getMessage())));
             Mono<Long> plan_new_id1 = template.count(listening_plan_new_id1, ListeningPlanNewBackgroupPoster.class).filter(f -> f > 0)
                     .flatMap(f -> template.delete(listening_plan_new_id1, ListeningPlanNewBackgroupPoster.class))
                     .switchIfEmpty(Mono.just(0L));
@@ -869,7 +869,7 @@ public class PlanNewController {
                                 return Mono.just(planNewAllRs);
                             }
                     ).switchIfEmpty(Mono.error(new BaseException("计划id异常"))) // Mono.error(new BaseException("查询海报模版 id:"+f.posterTemplateId()+"=>空"))
-                    .onErrorResume(throwable -> Mono.error(new Exception("计划id异常")));
+                    .onErrorResume(throwable -> Mono.error(new BaseException("计划id异常")));
             return RStatus.success(planNewAllRsMono);
         } else if (2 == type) {
             Mono<PlanNewAllRs> planNewAllRsMono = template
@@ -921,7 +921,7 @@ public class PlanNewController {
                                 return Mono.just(planNewAllRs);
                             }
                     ).switchIfEmpty(Mono.error(new BaseException("计划id异常"))) // Mono.error(new BaseException("查询海报模版 id:"+f.posterTemplateId()+"=>空"))
-                    .onErrorResume(throwable -> Mono.error(new Exception("计划id异常")));
+                    .onErrorResume(throwable -> Mono.error(new BaseException("计划id异常")));
             return RStatus.success(planNewAllRsMono);
         }
         throw new BaseException("type类型错误");
@@ -1048,11 +1048,11 @@ public class PlanNewController {
             Mono<String> poster_template_id = template.selectOne(Query.query(Criteria.where("poster_template_id")
                             .is(f.posterTemplateId())), PosterTemplate.class).flatMap(f0 -> Mono.just(f0.posterTemplateName()))
                     .switchIfEmpty(Mono.just("")) // Mono.error(new BaseException("查询海报模版 id:"+f.posterTemplateId()+"=>空"))
-                    .onErrorResume(throwable -> Mono.error(new Exception("查询海报模版 id:" + f.posterTemplateId() + "error:" + throwable.getMessage())));
+                    .onErrorResume(throwable -> Mono.error(new BaseException("查询海报模版 id:" + f.posterTemplateId() + "error:" + throwable.getMessage())));
             Mono<String> id = template.selectOne(Query.query(Criteria.where("id").is(f.groupId())), GroupType.class)
                     .flatMap(f1 -> Mono.just(f1.name()))
                     .switchIfEmpty(Mono.just(""))// Mono.error(new BaseException("查询GroupType id:"+f.groupId()+"=>空"))
-                    .onErrorResume(throwable -> Mono.error(new Exception("查询GroupType id:" + f.groupId() + "error:" + throwable.getMessage())));
+                    .onErrorResume(throwable -> Mono.error(new BaseException("查询GroupType id:" + f.groupId() + "error:" + throwable.getMessage())));
             return Mono.zip(Mono.just(f), poster_template_id, id).flatMap(ff -> {
                 PlanNew t1 = ff.getT1();
                 ListeningPlanNewRes2 listeningPlanNewRes = new ListeningPlanNewRes2();

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

@@ -104,7 +104,7 @@ public class PlanNewOutController {
             Mono<PlanNew> code1 = template
                     .selectOne(Query.query(Criteria.where("code").is(code)), PlanNew.class)
                     .switchIfEmpty(Mono.error(new BaseException("计划code异常 返回结果为空"))) //Mono.error(new BaseException("查询海报模版 id:"+f.posterTemplateId()+"=>空"))
-                    .onErrorResume(throwable -> Mono.error(new Exception(  throwable.getMessage())));
+                    .onErrorResume(throwable -> Mono.error(new BaseException(  throwable.getMessage())));
             Mono<DomainSelectRes> domainSelectResMono1 = code1.flatMap(f -> {
                 Mono<String> stringMono;
                 if (f.transferPageBl() == 1 && Objects.nonNull(f.transferPageDomain())) {
@@ -114,7 +114,7 @@ public class PlanNewOutController {
                             .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 BaseException(throwable.getMessage()))).collectList().flatMap(fff -> {
                                 if (!fff.isEmpty()) {
                                     DomainSelect domainSelect = fff.get(RandomUtil.randomInt(0, fff.size()));
                                     String string = RandomUtil.randomString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 6);
@@ -136,7 +136,7 @@ public class PlanNewOutController {
                             .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 BaseException(throwable.getMessage()))).collectList().flatMap(fff -> {
                                 if (!fff.isEmpty()) {
                                     DomainSelect domainSelect = fff.get(RandomUtil.randomInt(0, fff.size()));
                                     String string = RandomUtil.randomString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", 6);
@@ -152,7 +152,7 @@ public class PlanNewOutController {
                 Mono<String> stringMono2 = template.select(Query.query(Criteria.where("group_type_id").is(f.landingPageDomain())
                         .and("status").is(1).and("type").is(type).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 BaseException(throwable.getMessage()))).collectList().flatMap(fm -> {
                           //  DomainSelectRes domainSelectRes = new DomainSelectRes();
                             int i = RandomUtil.randomInt(0, fm.size());
                             String domain = fm.get(i).domain();
@@ -214,7 +214,7 @@ public class PlanNewOutController {
     public Mono<RStatus<DataListsKefu>> kefuList(@RequestBody KefuRequest request){
         Mono<PlanNew> code = template.selectOne(Query.query(Criteria.where("code").is(request.getCode())), PlanNew.class)
                 .switchIfEmpty(Mono.error(new BaseException("code查询返回结构为空"))) //Mono.error(new BaseException("查询海报模版 id:"+f.posterTemplateId()+"=>空"))
-                .onErrorResume(throwable -> Mono.error(new Exception("通过code查询计划异常::" + throwable.getMessage())));
+                .onErrorResume(throwable -> Mono.error(new BaseException("通过code查询计划异常::" + throwable.getMessage())));
         Mono<DataListsKefu> dataListsKefuMono = code.flatMap(planNew -> {
             Mono<List<Image>> image = template.select(Query.query(Criteria.where("type").is(5)
                     .and("deleted_at").isNull()
@@ -222,13 +222,13 @@ public class PlanNewOutController {
                     .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 BaseException(StrUtil.format("通过计划groupId:{}查询Image返回结果error:{}", planNew.groupId(), throwable.getMessage()))));
             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 BaseException(StrUtil.format("通过计划groupId:{}查询Material返回结果error:{}", planNew.groupId(), throwable.getMessage()))))
                     .collectList();
             Mono<List<H5ImageAndText>> arrayListMono = Mono.zip(Mono.just(planNew), image, text).flatMap(f -> {
                 //H5ImageAndText
@@ -323,7 +323,7 @@ public class PlanNewOutController {
 
         Mono<PlanNew> code0 = 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 BaseException(throwable.getMessage())));
         Mono<DataLists> dataListsMono1 = code0.flatMap(planNew -> {
             Mono<PlanNew> code = Mono.just(planNew);
             Long group_type_id ; //.and("group_type_id").is(group_type_id)
@@ -333,7 +333,7 @@ public class PlanNewOutController {
                 group_type_id=planNew.groupIdQs();
             }
             Mono<List<Domain>> domain = code.flatMap(plan -> template.select(Query.query(Criteria.where("group_type").is(1)
-                    .and("deleted_at").isNull()), Domain.class).onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"6"))).collectList());
+                    .and("deleted_at").isNull()), Domain.class).onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()+"6"))).collectList());
             // //类型 1素材分类2清水分类
             Criteria criteria = Criteria.where("type")
                     .is(1).and("deleted_at").isNull()
@@ -345,11 +345,11 @@ public class PlanNewOutController {
             }
             Query query = Query.query(criteria);
             Mono<List<Image>> image = template.select(query, Image.class)
-                    .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"7")))
+                    .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()+"7")))
                     .collectList();
             Mono<List<Material>> text = template.select(Query.query(Criteria.where("type")
                     .is(4).and("deleted_at").isNull().and("group_type_id").is(group_type_id)), Material.class)
-                    .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"8")))
+                    .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()+"8")))
                     .collectList();
             Mono<UserVisits> wx_user_id ;
             if (Objects.isNull(request.getWx_user_id()) || "".equals(request.getWx_user_id())) {
@@ -357,13 +357,13 @@ public class PlanNewOutController {
             }else{
                 Mono<UserVisits> insert = template.insert(new UserVisits(null, request.getWx_user_id(), 1));
                  wx_user_id = template.selectOne(Query.query(Criteria.where("wx_user_id").is(request.getWx_user_id())), UserVisits.class)
-                         .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"9")))
+                         .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()+"9")))
                         .flatMap(f -> {
                             if (f.num() >= 4) {
                                 return Mono.just(f);
                             } else {
                                 return template.update(new UserVisits(f.id(), f.wxUserId(), f.num() + 1))
-                                        .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"10")));
+                                        .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()+"10")));
                             }
                         }).switchIfEmpty(insert);
             }
@@ -426,18 +426,18 @@ public class PlanNewOutController {
                             Query.query(Criteria.where("id").is(plan.listAudioId()).and("deleted_at").isNull()),
                             Audio.class);
                 } }
-            ).onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"1")));
+            ).onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()+"1")));
             Mono<Audio> retAudioId = code.flatMap(plan -> template.selectOne(Query.query(Criteria.where("id")
-                    .is(plan.retAudioId()).and("deleted_at").isNull()), Audio.class)).onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"2")));
+                    .is(plan.retAudioId()).and("deleted_at").isNull()), Audio.class)).onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()+"2")));
             Mono<ReturnLoop> returnLoop = code.flatMap(plan -> {
                 if (Objects.isNull(plan.returnLoopId())) {
                     return Mono.just(getReturnLoop());
                 } else {
-                    return template.selectOne(Query.query(Criteria.where("id").is(plan.returnLoopId()).and("deleted_at").isNull()), ReturnLoop.class).onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"3")));
+                    return template.selectOne(Query.query(Criteria.where("id").is(plan.returnLoopId()).and("deleted_at").isNull()), ReturnLoop.class).onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()+"3")));
                 }
             }).switchIfEmpty(Mono.just(getReturnLoop()));
-            Mono<List<Ad>> adtop = template.select(Query.query(Criteria.where("type").is(1).and("deleted_at").isNull()), Ad.class).onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"4"))).collectList();////广告类型1顶部2底部3返回4安卓,ios的返回
-            Mono<List<Ad>> bottom = template.select(Query.query(Criteria.where("type").is(2).and("deleted_at").isNull()), Ad.class).onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()+"5"))).collectList();
+            Mono<List<Ad>> adtop = template.select(Query.query(Criteria.where("type").is(1).and("deleted_at").isNull()), Ad.class).onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()+"4"))).collectList();////广告类型1顶部2底部3返回4安卓,ios的返回
+            Mono<List<Ad>> bottom = template.select(Query.query(Criteria.where("type").is(2).and("deleted_at").isNull()), Ad.class).onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()+"5"))).collectList();
 
 
             Mono<DataLists> dataListsMono = Mono.zip(code, listAudio, retAudioId, returnLoop, arrayListMono, adtop, bottom, wx_user_id).flatMap(f -> {
@@ -552,7 +552,7 @@ public class PlanNewOutController {
         }
         Mono<PlanNew> code0 = 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 BaseException(throwable.getMessage())));
         Mono<DataLists0> dataLists0Mono =  code0.flatMap(ftmp->{
             //(如果wx_user_id值不为空则使用清水分类)
             Mono<StringBuilder> stringBuilderMono;
@@ -691,6 +691,7 @@ public class PlanNewOutController {
                     try {
                         jsonObject1 =  JSONUtil.parseObj(ret);
                     }catch (Exception e){
+                        log.error(e.getMessage() +"---"+JSONUtil.parseObj(goRequest2), e);
                         throw new BaseException(e.getMessage() +"---"+JSONUtil.parseObj(goRequest2));
                     }
                     if (jsonObject1.containsKey("code")
@@ -730,6 +731,7 @@ public class PlanNewOutController {
             try {
                 jsonObject = JSONUtil.parseObj(posterTemplate);
             }catch (Exception e){
+                log.error(e.getMessage() +"---"+posterTemplate, e);
                 throw new BaseException(e.getMessage() +"---"+posterTemplate);
             }
             //JSONObject jsonObject = JSONUtil.parseObj(posterTemplate);
@@ -831,6 +833,7 @@ public class PlanNewOutController {
             try {
                 encodedParam = URLEncoder.encode(first3.get().getV(), StandardCharsets.UTF_8.toString());
             }catch (Exception e){
+                log.error("URLEncoder Error"+e.getMessage(), e);
                 throw new BaseException("URLEncoder Error"+e.getMessage());
             }
         }
@@ -843,6 +846,7 @@ public class PlanNewOutController {
         try {
              jsonObject =  JSONUtil.parseObj(posterTemplate);
         }catch (Exception e){
+            log.error(e.getMessage() +"---"+posterTemplate, e);
             throw new BaseException(e.getMessage() +"---"+posterTemplate);
         }
         //JSONObject jsonObject = JSONUtil.parseObj(posterTemplate);

+ 8 - 5
launch-admin/src/main/java/com/webflux/launchadmin/mysql/service/listening/ListeningPlanServiceImpl.java

@@ -63,11 +63,11 @@ public class ListeningPlanServiceImpl implements ListeningPlanServiceInterface{
             Mono<String> poster_template_id = template.selectOne(Query.query(Criteria.where("poster_template_id")
                     .is(f.posterTemplateId())), PosterTemplate.class).flatMap(f0 -> Mono.just(f0.posterTemplateName()))
                     .switchIfEmpty(Mono.just("")) //Mono.error(new BaseException("查询海报模版 id:"+f.posterTemplateId()+"=>空"))
-                    .onErrorResume(throwable -> Mono.error(new Exception("查询海报模版 id:" + f.posterTemplateId() + "error:" + throwable.getMessage())));
+                    .onErrorResume(throwable -> Mono.error(new BaseException("查询海报模版 id:" + f.posterTemplateId() + "error:" + throwable.getMessage())));
             Mono<String> id = template.selectOne(Query.query(Criteria.where("id").is(f.groupId())), GroupType.class)
                     .flatMap(f1 -> Mono.just(f1.name()))
                     .switchIfEmpty(Mono.just(""))//Mono.error(new BaseException("查询GroupType id:"+f.groupId()+"=>空"))
-                    .onErrorResume(throwable -> Mono.error(new Exception("查询GroupType id:" + f.groupId() + "error:" + throwable.getMessage())));
+                    .onErrorResume(throwable -> Mono.error(new BaseException("查询GroupType id:" + f.groupId() + "error:" + throwable.getMessage())));
             return Mono.zip(Mono.just(f), poster_template_id, id).flatMap(ff -> {
                 ListeningPlanNew t1 = ff.getT1();
                 ListeningPlanNewRes2 listeningPlanNewRes = new ListeningPlanNewRes2();
@@ -313,7 +313,7 @@ public class ListeningPlanServiceImpl implements ListeningPlanServiceInterface{
         Mono<ListeningPlanNew> listening_plan_new_id = template
                 .selectOne(Query.query(Criteria.where("listening_plan_new_id").is(listeningPlanNewId)), ListeningPlanNew.class)
                 .switchIfEmpty(Mono.error(new BaseException("计划错误")))
-                .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage())))
+                .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage())))
                 .flatMap(f -> {
                     ListeningPlanNew listeningPlanNew = new ListeningPlanNew(IdUtil.fastSimpleUUID(),
                             f.name(),
@@ -382,7 +382,7 @@ public class ListeningPlanServiceImpl implements ListeningPlanServiceInterface{
         Mono<ListeningPlanNew> code1 = template.selectOne(Query.query(Criteria.where("code")
                 .is(outListeningRequest.getCode())), ListeningPlanNew.class)
                 .switchIfEmpty(Mono.error(new BaseException(" code错误")))
-                .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage())));
+                .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage())));
         Mono<ListeningDataLists> idx_num1 = code1.flatMap(f -> {
             Mono<List<ListeningAudio>> idx_num = template.select(Query.query(Criteria.empty())
                     .sort(Sort.by(Sort.Order.asc("idx_num")))
@@ -433,7 +433,7 @@ public class ListeningPlanServiceImpl implements ListeningPlanServiceInterface{
         Mono<ListeningPlanNew> code1 = template.selectOne(Query.query(Criteria.where("code")
                 .is(request.getCode())), ListeningPlanNew.class)
                 .switchIfEmpty(Mono.error(new BaseException("hello!!! code错误")))
-                .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage())));
+                .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage())));
         Mono<DataListsShare> dataListsShareMono = code1.flatMap(ftmp -> {
             Mono<ListeningPlanNew> code = Mono.just(ftmp);
             return Mono.zip(code, getPoster_template_id(code), getPoster(code), getPlanNewBackgroupPoster(code), getQrcode(code)).flatMap(f -> {
@@ -469,6 +469,7 @@ public class ListeningPlanServiceImpl implements ListeningPlanServiceInterface{
                 try {
                     jsonObject = JSONUtil.parseObj(posterTemplate);
                 } catch (Exception e) {
+                    log.error(e.getMessage() + "--解析海报模版--Errrrrrrrr" + posterTemplate, e);
                     throw new BaseException(e.getMessage() + "--解析海报模版--Errrrrrrrr" + posterTemplate);
                 }
                 GoRequest goRequest = new GoRequest();
@@ -743,6 +744,7 @@ public class ListeningPlanServiceImpl implements ListeningPlanServiceInterface{
                 try {
                     jsonObject1 =  JSONUtil.parseObj(ret);
                 }catch (Exception e){
+                    log.error(e.getMessage() +"--解析错误结果--"+JSONUtil.parseObj(goRequest), e);
                     throw new BaseException(e.getMessage() +"--解析错误结果--"+JSONUtil.parseObj(goRequest));
                 }
                 if (jsonObject1.containsKey("code") && jsonObject1.get("code", Integer.class) == 0 && jsonObject1.containsKey("data")) {
@@ -1099,6 +1101,7 @@ public class ListeningPlanServiceImpl implements ListeningPlanServiceInterface{
             body = HttpUtil.post(value + "/api/image/createImage",temStr,100000);
             return body;
         } catch (Exception e) {
+            log.error(e.getMessage() + "body:::" +body, e);
             throw new BaseException(e.getMessage() + "body:::" +body);
         }
 

+ 15 - 15
launch-admin/src/main/java/com/webflux/launchadmin/mysql/service/planNew/goGenerate/GoGenerateService.java

@@ -121,7 +121,7 @@ public class GoGenerateService {
                         getImageType1Poster(imageGroupId2),
                         getTextListsTitleSaveOrUpdatePoster(posterRequset)))
                 .switchIfEmpty(Mono.error(new BaseException(" 操作失败")))
-                .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage())))
+                .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage())))
                 .flatMap(f -> template.insert(f));
         return RStatus.success(posterMono1);
     }
@@ -147,7 +147,7 @@ public class GoGenerateService {
                         .and("group_type_id").is(groupTypeId)
                         .and("size_type").is(1)
                         .and("deleted_at").isNull()), Image.class)
-                .onErrorResume(throwable -> Mono.error(new Exception("getImageType1Plan error:" + throwable.getMessage())))
+                .onErrorResume(throwable -> Mono.error(new BaseException("getImageType1Plan error:" + throwable.getMessage())))
                 .collectList();
     }
 
@@ -167,7 +167,7 @@ public class GoGenerateService {
         return template.select(Query.query(Criteria.where("type").is(14)
                         .and("group_type_id").in(groupTypeId)
                         .and("deleted_at").isNull()), Material.class)
-                .onErrorResume(throwable -> Mono.error(new Exception("getTextListsPlan error:" + throwable.getMessage())))
+                .onErrorResume(throwable -> Mono.error(new BaseException("getTextListsPlan error:" + throwable.getMessage())))
                 .collectList();
     }
 
@@ -196,7 +196,7 @@ public class GoGenerateService {
             return template.select(Query.query(Criteria.where("type").is(6)
                             .and("group_type_id").is(first.get().getGroupTypeIdSc())
                             .and("deleted_at").isNull()), Material.class)
-                    .onErrorResume(throwable -> Mono.error(new Exception("getImageType1Plan error:" + throwable.getMessage())))
+                    .onErrorResume(throwable -> Mono.error(new BaseException("getImageType1Plan error:" + throwable.getMessage())))
                     .collectList();
         } else {
             return Mono.just(List.of(getMaterialNull()));
@@ -226,7 +226,7 @@ public class GoGenerateService {
     private Mono<List<Image>> getBgImage(Long id) {
         return template.select(Query.query(Criteria.where("type").is(2).and("group_type_id").is(id)
                         .and("deleted_at").isNull()), Image.class)
-                .onErrorResume(throwable -> Mono.error(new Exception("getBgImage error:" + throwable.getMessage())))
+                .onErrorResume(throwable -> Mono.error(new BaseException("getBgImage error:" + throwable.getMessage())))
                 .collectList();
     }
 
@@ -777,7 +777,7 @@ public class GoGenerateService {
                 }
                 return Mono.just(url);
             });
-        }).onErrorResume(throwable -> Mono.error(new Exception("saveAndUpdatePlanGenerateImage1 error:" + throwable.getMessage())));
+        }).onErrorResume(throwable -> Mono.error(new BaseException("saveAndUpdatePlanGenerateImage1 error:" + throwable.getMessage())));
         return stringMono;
     }
 
@@ -797,7 +797,7 @@ public class GoGenerateService {
                         .and("type").is(1)
                         .and("deleted_at").isNull()), DomainSelect.class)
                 .collectList()
-                .onErrorResume(throwable -> Mono.error(new Exception("getImportDomain error:" + throwable.getMessage())))
+                .onErrorResume(throwable -> Mono.error(new BaseException("getImportDomain error:" + throwable.getMessage())))
                 .switchIfEmpty(Mono.just(List.of())).flatMap(b -> {
                     StringBuilder stringBuilder = new StringBuilder();
                     if (Objects.nonNull(b) && !b.isEmpty()) {
@@ -1237,7 +1237,7 @@ public class GoGenerateService {
                 if (1 == type) {
                     stringMono = template.selectOne(query, PlanNew.class)
                             .switchIfEmpty(Mono.error(new BaseException("自定义二维码:裂变计划查询::PlanId 返回空结果::" + planId)))
-                            .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage())))
+                            .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage())))
                             .flatMap(f1 -> {
                                 String code = f1.code();
                                 return getDomainSetV(ftm, planId, type, f1.groupId(), code);
@@ -1245,7 +1245,7 @@ public class GoGenerateService {
                 } else if (2 == type) {
                     stringMono = template.selectOne(query, ListeningPlanNew.class)
                             .switchIfEmpty(Mono.error(new BaseException("自定义二维码:听书计划查询::PlanId  返回空结果::" + planId)))
-                            .onErrorResume(throwable -> Mono.error(new Exception("select ListeningPlanNew::" + throwable.getMessage())))
+                            .onErrorResume(throwable -> Mono.error(new BaseException("select ListeningPlanNew::" + throwable.getMessage())))
                             .flatMap(f1 -> {
                                 String code = f1.code();
                                 return getDomainSetV(ftm, planId, type, f1.groupId(), code);
@@ -1253,14 +1253,14 @@ public class GoGenerateService {
                 } else {
                     stringMono = template.selectOne(query, PlanNewCommon.class)
                             .switchIfEmpty(Mono.error(new BaseException("自定义二维码:交友计划查询::PlanId 返回空结果::" + planId)))
-                            .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage())))
+                            .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage())))
                             .flatMap(f1 -> {
                                 String code = f1.code();
                                 return getDomainSetV(ftm, planId, type, f1.groupId(), code);
                             });
                 }
                 return stringMono;
-            }).onErrorResume(throwable -> Mono.error(new Exception("setCusqrcodeSetV error:" + throwable.getMessage()))).collectList();
+            }).onErrorResume(throwable -> Mono.error(new BaseException("setCusqrcodeSetV error:" + throwable.getMessage()))).collectList();
         }
         return Mono.just(List.of(new StringBuilder("无自定义二维码 随机事件")));
     }
@@ -1272,7 +1272,7 @@ public class GoGenerateService {
                         .and("deleted_at").isNull()), DomainSelect.class)
                 .collectList()
                 .switchIfEmpty(Mono.error(new BaseException("自定义二维码:裂变计划类型查询域名::不存在::(groupId::type(1裂變))(" + groupId + "::" + type + ")")))
-                .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage()))).flatMap(f2 -> {
+                .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage()))).flatMap(f2 -> {
                     StringBuilder stringBuilder = new StringBuilder();
                     if (!f2.isEmpty()) {
                         DomainSelect domainSelect = f2.get(RandomUtil.randomInt(0, f2.size()));
@@ -1406,7 +1406,7 @@ public class GoGenerateService {
                     posterRes.setGenerateImagesUrl(url);
                     template.update(Query.query(empty), update, Poster.class)
                             .switchIfEmpty(Mono.error(new BaseException(" 操作失败")))
-                            .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage())));
+                            .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage())));
                 }
             }
             return posterRes;
@@ -1488,7 +1488,7 @@ public class GoGenerateService {
                         getTextListsTitleSaveOrUpdatePoster(posterRequset)),
                 posterRequset)
                 .switchIfEmpty(Mono.error(new BaseException(" 操作失败")))
-                .onErrorResume(throwable -> Mono.error(new Exception(throwable.getMessage())))
+                .onErrorResume(throwable -> Mono.error(new BaseException(throwable.getMessage())))
                 .flatMap(f -> template.update(f));
         return RStatus.success(posterMono1);
     }
@@ -1509,7 +1509,7 @@ public class GoGenerateService {
         return template.select(Query.query(Criteria.where("type").is(10)
                         .and("group_type_id").in(id)
                         .and("deleted_at").isNull()), Image.class)
-                .onErrorResume(throwable -> Mono.error(new Exception("getImageSaveOrUpdatePlan error:" + throwable.getMessage())))
+                .onErrorResume(throwable -> Mono.error(new BaseException("getImageSaveOrUpdatePlan error:" + throwable.getMessage())))
                 .collectList();
     }