From c8ca54f02667d8fc995e63e76610d086e8e5d3c8 Mon Sep 17 00:00:00 2001 From: Loki <654612@qq.com> Date: Wed, 21 Dec 2022 15:44:55 +0800 Subject: [PATCH] =?UTF-8?q?:+1:=20=E5=88=A0=E9=99=A4=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=20=E6=96=B0=E5=A2=9EBXG=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E5=BC=82=E5=B8=B8SHOPEX?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/co/yixiang/aspect/LimitAspect.java | 2 +- .../exception/BadLimitRequestException.java | 30 --------- .../exception/BadRequestException.java | 31 --------- .../yixiang/exception/BusinessException.java | 35 ---------- .../co/yixiang/exception/DaoException.java | 34 ---------- .../exception/EntityNotFoundException.java | 24 ------- .../exception/ErrorRequestException.java | 31 --------- .../impl/YxStoreBargainServiceImpl.java | 4 +- .../impl/YxStoreCombinationServiceImpl.java | 4 +- .../impl/YxStoreSeckillServiceImpl.java | 4 +- .../impl/YxUserExtractServiceImpl.java | 10 +-- .../customer/rest/QrCodeController.java | 4 +- .../rest/YxStoreCustomerController.java | 4 +- .../service/impl/YxEvaluationServiceImpl.java | 66 +++++++++---------- .../impl/YxStoreHotListServiceImpl.java | 37 +++++------ .../modules/mp/service/WeixinPayService.java | 7 +- .../impl/YxWechatLiveGoodsServiceImpl.java | 8 +-- .../service/impl/YxWechatLiveServiceImpl.java | 4 +- .../order/rest/StoreOrderController.java | 24 +++---- .../service/impl/YxStoreOrderServiceImpl.java | 10 ++- .../impl/YxStoreProductAttrServiceImpl.java | 7 +- .../impl/YxStoreProductServiceImpl.java | 38 ++++------- .../impl/StoreAfterSalesServiceImpl.java | 3 +- .../services/WechatArticleService.java | 13 ++-- .../shop/rest/SystemGroupDataController.java | 12 ++-- .../shop/rest/SystemStoreController.java | 6 +- .../service/impl/BxgMenuServiceImpl.java | 6 +- .../rest/ShippingTemplatesController.java | 4 +- .../impl/YxShippingTemplatesServiceImpl.java | 3 +- .../user/rest/SystemUserTaskController.java | 4 +- .../wechat/rest/WechatMenuController.java | 4 +- .../service/impl/AlipayConfigServiceImpl.java | 9 +-- .../service/impl/EmailConfigServiceImpl.java | 8 +-- .../service/impl/LocalStorageServiceImpl.java | 4 +- .../service/impl/PictureServiceImpl.java | 4 +- .../tools/service/impl/QiNiuServiceImpl.java | 10 +-- .../impl/VerificationCodeServiceImpl.java | 4 +- .../main/java/co/yixiang/utils/FileUtil.java | 4 +- .../java/co/yixiang/utils/SecurityUtils.java | 8 +-- .../java/co/yixiang/utils/ThrowableUtil.java | 6 +- .../java/co/yixiang/utils/ValidationUtil.java | 4 +- .../yixiang/utils/location/LocationUtils.java | 2 +- 42 files changed, 159 insertions(+), 377 deletions(-) delete mode 100644 zsw-bxg/src/main/java/co/yixiang/exception/BadLimitRequestException.java delete mode 100644 zsw-bxg/src/main/java/co/yixiang/exception/BadRequestException.java delete mode 100644 zsw-bxg/src/main/java/co/yixiang/exception/BusinessException.java delete mode 100644 zsw-bxg/src/main/java/co/yixiang/exception/DaoException.java delete mode 100644 zsw-bxg/src/main/java/co/yixiang/exception/EntityNotFoundException.java delete mode 100644 zsw-bxg/src/main/java/co/yixiang/exception/ErrorRequestException.java diff --git a/zsw-bxg/src/main/java/co/yixiang/aspect/LimitAspect.java b/zsw-bxg/src/main/java/co/yixiang/aspect/LimitAspect.java index ad545120..506b2222 100644 --- a/zsw-bxg/src/main/java/co/yixiang/aspect/LimitAspect.java +++ b/zsw-bxg/src/main/java/co/yixiang/aspect/LimitAspect.java @@ -7,7 +7,7 @@ // //import co.yixiang.annotation.Limit; //import co.yixiang.exception.BadLimitRequestException; -//import co.yixiang.exception.BadRequestException; +//import cn.iocoder.yudao.framework.common.exception.ShopException; //import co.yixiang.utils.RequestHolder; //import co.yixiang.utils.StringUtils; //import com.google.common.collect.ImmutableList; diff --git a/zsw-bxg/src/main/java/co/yixiang/exception/BadLimitRequestException.java b/zsw-bxg/src/main/java/co/yixiang/exception/BadLimitRequestException.java deleted file mode 100644 index 06aa2972..00000000 --- a/zsw-bxg/src/main/java/co/yixiang/exception/BadLimitRequestException.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (C) 2018-2022 - * All rights reserved, Designed By www.yixiang.co - - */ -package co.yixiang.exception; - -import cn.iocoder.yudao.framework.common.exception.ApiCode; -import lombok.Getter; -import org.springframework.http.HttpStatus; - -/** - * @author Zheng Jie - * @date 2018-11-23 - * 统一异常处理 - */ -@Getter -public class BadLimitRequestException extends RuntimeException{ - - private Integer status = ApiCode.BAD_LIMIT_EXCEPTION.getCode(); - - public BadLimitRequestException(String msg){ - super(msg); - } - - public BadLimitRequestException(HttpStatus status, String msg){ - super(msg); - this.status = status.value(); - } -} diff --git a/zsw-bxg/src/main/java/co/yixiang/exception/BadRequestException.java b/zsw-bxg/src/main/java/co/yixiang/exception/BadRequestException.java deleted file mode 100644 index df2f728c..00000000 --- a/zsw-bxg/src/main/java/co/yixiang/exception/BadRequestException.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (C) 2018-2022 - * All rights reserved, Designed By www.yixiang.co - - */ -package co.yixiang.exception; - -import lombok.Getter; -import org.springframework.http.HttpStatus; - -import static org.springframework.http.HttpStatus.BAD_REQUEST; - -/** - * @author Zheng Jie - * @date 2018-11-23 - * 统一异常处理 - */ -@Getter -public class BadRequestException extends RuntimeException{ - - private Integer status = BAD_REQUEST.value(); - - public BadRequestException(String msg){ - super(msg); - } - - public BadRequestException(HttpStatus status,String msg){ - super(msg); - this.status = status.value(); - } -} diff --git a/zsw-bxg/src/main/java/co/yixiang/exception/BusinessException.java b/zsw-bxg/src/main/java/co/yixiang/exception/BusinessException.java deleted file mode 100644 index 5d26e119..00000000 --- a/zsw-bxg/src/main/java/co/yixiang/exception/BusinessException.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (C) 2018-2022 - * All rights reserved, Designed By www.yixiang.co - * 注意: - * 本软件为www.yixiang.co开发研制,未经购买不得使用 - * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) - * 一经发现盗用、分享等行为,将追究法律责任,后果自负 - */ -package co.yixiang.exception; - - -import cn.iocoder.yudao.framework.common.exception.ApiCode; -import cn.iocoder.yudao.framework.common.exception.ShopException; - -/** - * 业务异常 - * @author hupeng - * @date 2020-04-30 - */ -public class BusinessException extends ShopException { - private static final long serialVersionUID = -2303357122330162359L; - - public BusinessException(String message) { - super(message); - } - - public BusinessException(Integer errorCode, String message) { - super(errorCode, message); - } - - public BusinessException(ApiCode apiCode) { - super(apiCode); - } - -} diff --git a/zsw-bxg/src/main/java/co/yixiang/exception/DaoException.java b/zsw-bxg/src/main/java/co/yixiang/exception/DaoException.java deleted file mode 100644 index c292e7bd..00000000 --- a/zsw-bxg/src/main/java/co/yixiang/exception/DaoException.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (C) 2018-2022 - * All rights reserved, Designed By www.yixiang.co - * 注意: - * 本软件为www.yixiang.co开发研制,未经购买不得使用 - * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) - * 一经发现盗用、分享等行为,将追究法律责任,后果自负 - */ -package co.yixiang.exception; - - -import cn.iocoder.yudao.framework.common.exception.ApiCode; -import cn.iocoder.yudao.framework.common.exception.ShopException; - -/** - * DAO异常 - * @author hupeng - * @date 2020-04-30 - */ -public class DaoException extends ShopException { - private static final long serialVersionUID = -6912618737345878854L; - - public DaoException(String message) { - super(message); - } - - public DaoException(Integer errorCode, String message) { - super(errorCode, message); - } - - public DaoException(ApiCode apiCode) { - super(apiCode); - } -} diff --git a/zsw-bxg/src/main/java/co/yixiang/exception/EntityNotFoundException.java b/zsw-bxg/src/main/java/co/yixiang/exception/EntityNotFoundException.java deleted file mode 100644 index cde4d3f1..00000000 --- a/zsw-bxg/src/main/java/co/yixiang/exception/EntityNotFoundException.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (C) 2018-2022 - * All rights reserved, Designed By www.yixiang.co - - */ -package co.yixiang.exception; - -import org.springframework.util.StringUtils; - -/** - * @author Zheng Jie - * @date 2018-11-23 - */ -public class EntityNotFoundException extends RuntimeException { - - public EntityNotFoundException(Class clazz, String field, String val) { - super(EntityNotFoundException.generateMessage(clazz.getSimpleName(), field, val)); - } - - private static String generateMessage(String entity, String field, String val) { - return StringUtils.capitalize(entity) - + " with " + field + " "+ val + " does not exist"; - } -} diff --git a/zsw-bxg/src/main/java/co/yixiang/exception/ErrorRequestException.java b/zsw-bxg/src/main/java/co/yixiang/exception/ErrorRequestException.java deleted file mode 100644 index b8146456..00000000 --- a/zsw-bxg/src/main/java/co/yixiang/exception/ErrorRequestException.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (C) 2018-2022 - * All rights reserved, Designed By www.yixiang.co - - */ -package co.yixiang.exception; - -import lombok.Getter; -import org.springframework.http.HttpStatus; - -import static org.springframework.http.HttpStatus.BAD_REQUEST; - -/** - * @author hupeng - * @date 2019-11-11 - * 统一异常处理 - */ -@Getter -public class ErrorRequestException extends RuntimeException{ - - private Integer status = BAD_REQUEST.value(); - - public ErrorRequestException(String msg){ - super(msg); - } - - public ErrorRequestException(HttpStatus status, String msg){ - super(msg); - this.status = status.value(); - } -} diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreBargainServiceImpl.java b/zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreBargainServiceImpl.java index c1c9328b..aa540698 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreBargainServiceImpl.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreBargainServiceImpl.java @@ -23,7 +23,7 @@ import co.yixiang.enums.ShopCommonEnum; import co.yixiang.event.TemplateBean; import co.yixiang.event.TemplateEvent; import co.yixiang.event.TemplateListenEnum; -import co.yixiang.exception.BadRequestException; +import cn.iocoder.yudao.framework.common.exception.ShopException; import co.yixiang.modules.activity.domain.YxStoreBargain; import co.yixiang.modules.activity.domain.YxStoreBargainUser; import co.yixiang.modules.activity.domain.YxStoreBargainUserHelp; @@ -365,7 +365,7 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl微信管理-->公众号配置->关注二维码"); + throw new ShopException("请配置后台-->微信管理-->公众号配置->关注二维码"); } return ResponseEntity.ok(wechatFollowImg); } diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/customer/rest/YxStoreCustomerController.java b/zsw-bxg/src/main/java/co/yixiang/modules/customer/rest/YxStoreCustomerController.java index dae6f939..226b1ac9 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/customer/rest/YxStoreCustomerController.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/customer/rest/YxStoreCustomerController.java @@ -9,7 +9,7 @@ package co.yixiang.modules.customer.rest; import java.util.Arrays; import co.yixiang.dozer.service.IGenerator; -import co.yixiang.exception.BadRequestException; +import cn.iocoder.yudao.framework.common.exception.ShopException; import co.yixiang.modules.aop.ForbidSubmit; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import lombok.AllArgsConstructor; @@ -66,7 +66,7 @@ public class YxStoreCustomerController { public ResponseEntity create(@Validated @RequestBody YxStoreCustomer resources){ Long count = yxStoreCustomerService.count(new LambdaQueryWrapper().eq(YxStoreCustomer::getOpenId, resources.getOpenId())); if (count > 0) { - throw new BadRequestException("当前用户已存在,请勿重复提交"); + throw new ShopException("当前用户已存在,请勿重复提交"); } return new ResponseEntity<>(yxStoreCustomerService.save(resources),HttpStatus.CREATED); } diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/impl/YxEvaluationServiceImpl.java b/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/impl/YxEvaluationServiceImpl.java index 490f1a7d..b06fff9a 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/impl/YxEvaluationServiceImpl.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/impl/YxEvaluationServiceImpl.java @@ -1,11 +1,11 @@ /** -* Copyright (C) 2018-2020 -* All rights reserved, Designed By www.yixiang.co -* 注意: -* 本软件为www.yixiang.co开发研制,未经购买不得使用 -* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) -* 一经发现盗用、分享等行为,将追究法律责任,后果自负 -*/ + * Copyright (C) 2018-2020 + * All rights reserved, Designed By www.yixiang.co + * 注意: + * 本软件为www.yixiang.co开发研制,未经购买不得使用 + * 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台) + * 一经发现盗用、分享等行为,将追究法律责任,后果自负 + */ package co.yixiang.modules.evaluation.service.impl; import cn.hutool.core.util.ObjectUtil; @@ -14,10 +14,7 @@ import co.yixiang.common.service.impl.BaseServiceImpl; import co.yixiang.common.utils.QueryHelpPlus; import co.yixiang.domain.PageResult; import co.yixiang.dozer.service.IGenerator; -import co.yixiang.enums.CommonEnum; import co.yixiang.enums.ShopCommonEnum; -import co.yixiang.exception.ErrorRequestException; -import co.yixiang.modules.entry.domain.YxStoreEntry; import co.yixiang.modules.evaluation.domain.YxEvaluation; import co.yixiang.modules.evaluation.service.YxEvaluationRelationService; import co.yixiang.modules.evaluation.service.YxEvaluationService; @@ -28,18 +25,14 @@ import co.yixiang.modules.evaluation.vo.YxEvaluationQueryVo; import co.yixiang.modules.product.domain.YxStoreProduct; import co.yixiang.modules.product.service.YxStoreProductService; import co.yixiang.modules.product.service.mapper.StoreProductMapper; -import co.yixiang.modules.product.vo.ProductVo; -import co.yixiang.modules.product.vo.YxStoreProductQueryVo; -import co.yixiang.utils.EntryDTO; -import co.yixiang.utils.FileUtil; import co.yixiang.utils.EvaluationDTO; +import co.yixiang.utils.FileUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.github.pagehelper.PageInfo; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; -import lombok.AllArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; @@ -48,12 +41,15 @@ import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.util.*; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; /** -* @author sj -* @date 2022-10-21 -*/ + * @author sj + * @date 2022-10-21 + */ @Service @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) //@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) @@ -66,7 +62,7 @@ public class YxEvaluationServiceImpl extends BaseServiceImpl page = new PageInfo<>(queryAll(criteria)); //根据page里面的list的商品id查询对应的商品信息,并将商品id替换为商品信息 - page.getList().forEach(yxEvaluation->{ + page.getList().forEach(yxEvaluation -> { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue()) .eq(YxStoreProduct::getId, yxEvaluation.getProduct()); @@ -84,17 +80,17 @@ public class YxEvaluationServiceImpl extends BaseServiceImpl queryAll(YxEvaluationQueryCriteria criteria){ + public List queryAll(YxEvaluationQueryCriteria criteria) { return baseMapper.selectList(QueryHelpPlus.getPredicate(YxEvaluation.class, criteria)); } @@ -103,7 +99,7 @@ public class YxEvaluationServiceImpl extends BaseServiceImpl all, HttpServletResponse response) throws IOException { List> list = new ArrayList<>(); for (YxEvaluationDto yxEvaluation : all) { - Map map = new LinkedHashMap<>(); + Map map = new LinkedHashMap<>(); map.put("在列表里面的首页图", yxEvaluation.getHomeImage()); map.put("评测介绍", yxEvaluation.getSynopsis()); map.put("评测视频", yxEvaluation.getVideoInput()); @@ -120,7 +116,7 @@ public class YxEvaluationServiceImpl extends BaseServiceImpl wrapper = new LambdaQueryWrapper<>(); wrapper.eq(YxEvaluation::getIsShow, ShopCommonEnum.SHOW_1.getValue()) .orderByAsc(YxEvaluation::getSort); - List list = generator.convert(baseMapper.selectList(wrapper),EvaluationDTO.class); - list.forEach(evaluationDTO->{ + List list = generator.convert(baseMapper.selectList(wrapper), EvaluationDTO.class); + list.forEach(evaluationDTO -> { LambdaQueryWrapper wrapper1 = new LambdaQueryWrapper<>(); wrapper1.eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue()) .eq(YxStoreProduct::getId, evaluationDTO.getProduct()); YxStoreProduct yxStoreProduct = storeProductMapper.selectOne(wrapper1); //这里需要有一个非空判断 - if (ObjectUtil.isNotNull(yxStoreProduct)){ + if (ObjectUtil.isNotNull(yxStoreProduct)) { evaluationDTO.setProductInfo(yxStoreProduct); - }else{ + } else { evaluationDTO.setProductInfo(new YxStoreProduct().setStoreName("该评测商品已删除或已下架")); } }); @@ -156,7 +152,7 @@ public class YxEvaluationServiceImpl extends BaseServiceImpl getList(int page,int limit){ + public List getList(int page, int limit) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(YxEvaluation::getIsShow, ShopCommonEnum.SHOW_1.getValue()) .orderByAsc(YxEvaluation::getSort); @@ -173,12 +169,12 @@ public class YxEvaluationServiceImpl extends BaseServiceImpllambdaQuery() .eq(YxUserRecharge::getOrderId,orderId)); if(userRecharge == null) { - throw new BusinessException("充值订单不存在"); + throw new ShopException("充值订单不存在"); } if(userRecharge.getPaid().equals(OrderInfoEnum.PAY_STATUS_1.getValue())) { @@ -148,7 +147,7 @@ public class WeixinPayService { return wxPayService.createOrder(orderRequest); }catch (WxPayException e) { log.info("支付错误信息:{}",e.getMessage()); - throw new BusinessException(e.getMessage()); + throw new ShopException(e.getMessage()); } @@ -188,7 +187,7 @@ public class WeixinPayService { wxPayService.refundV2(wxPayRefundRequest); } catch (WxPayException e) { log.info("退款错误信息:{}",e.getMessage()); - throw new BusinessException(e.getMessage()); + throw new ShopException(e.getMessage()); } } diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/mp/service/impl/YxWechatLiveGoodsServiceImpl.java b/zsw-bxg/src/main/java/co/yixiang/modules/mp/service/impl/YxWechatLiveGoodsServiceImpl.java index 9bd1eff0..975cc24c 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/mp/service/impl/YxWechatLiveGoodsServiceImpl.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/mp/service/impl/YxWechatLiveGoodsServiceImpl.java @@ -18,7 +18,7 @@ import co.yixiang.common.service.impl.BaseServiceImpl; import co.yixiang.common.utils.QueryHelpPlus; import co.yixiang.dozer.service.IGenerator; import co.yixiang.enums.LiveGoodsEnum; -import co.yixiang.exception.BadRequestException; +import cn.iocoder.yudao.framework.common.exception.ShopException; import co.yixiang.modules.mp.service.mapper.YxWechatLiveGoodsMapper; import co.yixiang.modules.mp.domain.YxWechatLiveGoods; import co.yixiang.modules.mp.service.YxWechatLiveGoodsService; @@ -107,7 +107,7 @@ public class YxWechatLiveGoodsServiceImpl extends BaseServiceImpl(expressInfo, HttpStatus.OK); diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderServiceImpl.java b/zsw-bxg/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderServiceImpl.java index 7188d2d5..e30f1715 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderServiceImpl.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderServiceImpl.java @@ -16,7 +16,6 @@ import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.json.JSONUtil; import cn.iocoder.yudao.framework.common.exception.ShopException; -import co.yixiang.exception.BusinessException; import co.yixiang.common.service.impl.BaseServiceImpl; import co.yixiang.common.utils.QueryHelpPlus; import co.yixiang.constant.ShopConstants; @@ -26,9 +25,8 @@ import co.yixiang.enums.*; import co.yixiang.event.TemplateBean; import co.yixiang.event.TemplateEvent; import co.yixiang.event.TemplateListenEnum; -import co.yixiang.exception.BadRequestException; +import cn.iocoder.yudao.framework.common.exception.ShopException; import co.yixiang.exception.EntityExistException; -import co.yixiang.exception.ErrorRequestException; import co.yixiang.modules.activity.domain.YxStoreCombination; import co.yixiang.modules.activity.domain.YxStoreCouponUser; import co.yixiang.modules.activity.domain.YxStorePink; @@ -550,7 +548,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpllambdaQuery().eq(YxStoreProductAttrValue::getProductId, productId)); if (count > 0 ) { - throw new BadRequestException("该产品已被添加到其他活动,禁止操作!"); + throw new ShopException("该产品已被添加到其他活动,禁止操作!"); }*/ List valueGroup = new ArrayList<>(); for (ProductFormatDto productFormatDto : attrs) { if(productFormatDto.getPinkStock()>productFormatDto.getStock() || productFormatDto.getSeckillStock()>productFormatDto.getStock()){ -// throw new BadRequestException("活动商品库存不能大于原有商品库存"); +// throw new ShopException("活动商品库存不能大于原有商品库存"); throw new ShopException("活动商品库存不能大于原有商品库存"); } List stringList = new ArrayList<>(productFormatDto.getDetail().values()); @@ -127,7 +126,7 @@ public class YxStoreProductAttrServiceImpl extends BaseServiceImpl wrapper1 = new LambdaQueryWrapper<>(); wrapper1.eq(YxStoreBrand::getIsShow, ShopCommonEnum.SHOW_1.getValue()) @@ -389,7 +375,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl { Map map = JSONUtil.toBean(item.getValue(), Map.class); if (jsonObject.getInteger("time").equals(map.get("time"))) { -// throw new BadRequestException("不能同时开启同一时间点"); +// throw new ShopException("不能同时开启同一时间点"); throw new ShopException("已存在相同时间配置,不能同时开启同一时间点"); } @@ -160,26 +160,26 @@ public class SystemGroupDataController { private void checkParam(JSONObject jsonObject) { if (ObjectUtil.isNotNull(jsonObject.get("name"))) { if (StrUtil.isEmpty(jsonObject.getString("name"))) { - throw new BadRequestException("名称必须填写"); + throw new ShopException("名称必须填写"); } } if (ObjectUtil.isNotNull(jsonObject.get("title"))) { if (StrUtil.isEmpty(jsonObject.getString("title"))) { - throw new BadRequestException("标题必须填写"); + throw new ShopException("标题必须填写"); } } if (ObjectUtil.isNotNull(jsonObject.get("pic"))) { if (StrUtil.isEmpty(jsonObject.getString("pic"))) { - throw new BadRequestException("图片必须上传"); + throw new ShopException("图片必须上传"); } } if (ObjectUtil.isNotNull(jsonObject.get("info"))) { if (StrUtil.isEmpty(jsonObject.getString("info"))) { - throw new BadRequestException("简介必须填写"); + throw new ShopException("简介必须填写"); } } diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/shop/rest/SystemStoreController.java b/zsw-bxg/src/main/java/co/yixiang/modules/shop/rest/SystemStoreController.java index eb9bd236..45290c29 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/shop/rest/SystemStoreController.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/shop/rest/SystemStoreController.java @@ -8,7 +8,7 @@ package co.yixiang.modules.shop.rest; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpUtil; import co.yixiang.dozer.service.IGenerator; -import co.yixiang.exception.BadRequestException; +import cn.iocoder.yudao.framework.common.exception.ShopException; import co.yixiang.logging.aop.log.Log; import co.yixiang.modules.aop.ForbidSubmit; import co.yixiang.modules.shop.domain.YxSystemStore; @@ -98,7 +98,7 @@ public class SystemStoreController { String key = systemConfigService.getData(ShopKeyUtils.getTengXunMapKey()); if (StrUtil.isBlank(key)) { - throw new BadRequestException("请先配置腾讯地图key"); + throw new ShopException("请先配置腾讯地图key"); } String url = StrUtil.format("?address={}&key={}", addr, key); String json = HttpUtil.get(QQ_MAP_URL + url); @@ -106,7 +106,7 @@ public class SystemStoreController { if(locationVO.getStatus()!=0){ - throw new BadRequestException(locationVO.getMessage()); + throw new ShopException(locationVO.getMessage()); } return new ResponseEntity<>(locationVO, HttpStatus.CREATED); } diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/system/service/impl/BxgMenuServiceImpl.java b/zsw-bxg/src/main/java/co/yixiang/modules/system/service/impl/BxgMenuServiceImpl.java index a5a710ed..c882e284 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/system/service/impl/BxgMenuServiceImpl.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/system/service/impl/BxgMenuServiceImpl.java @@ -14,7 +14,7 @@ import cn.iocoder.yudao.framework.common.exception.ShopException; import co.yixiang.common.service.impl.BaseServiceImpl; import co.yixiang.common.utils.QueryHelpPlus; import co.yixiang.dozer.service.IGenerator; -import co.yixiang.exception.BadRequestException; +import cn.iocoder.yudao.framework.common.exception.ShopException; import co.yixiang.exception.EntityExistException; import co.yixiang.modules.system.domain.Menu; import co.yixiang.modules.system.domain.vo.MenuMetaVo; @@ -289,7 +289,7 @@ public class BxgMenuServiceImpl extends BaseServiceImpl imp @CacheEvict(allEntries = true) public void update(Menu resources) { if(resources.getId().equals(resources.getPid())) { - throw new BadRequestException("上级不能为自己"); + throw new ShopException("上级不能为自己"); } Menu menu = this.getById(resources.getId()); ValidationUtil.isNull(menu.getId(),"Permission","id",resources.getId()); @@ -355,7 +355,7 @@ public class BxgMenuServiceImpl extends BaseServiceImpl imp if(resources.getIFrame()){ String http = "http://", https = "https://"; if (!(resources.getPath().toLowerCase().startsWith(http)||resources.getPath().toLowerCase().startsWith(https))) { - throw new BadRequestException("外链必须以http://或者https://开头"); + throw new ShopException("外链必须以http://或者https://开头"); } } } diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/template/rest/ShippingTemplatesController.java b/zsw-bxg/src/main/java/co/yixiang/modules/template/rest/ShippingTemplatesController.java index 8999ca0e..897875c3 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/template/rest/ShippingTemplatesController.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/template/rest/ShippingTemplatesController.java @@ -10,7 +10,7 @@ package co.yixiang.modules.template.rest; import co.yixiang.constant.ShopConstants; import co.yixiang.dozer.service.IGenerator; -import co.yixiang.exception.BadRequestException; +import cn.iocoder.yudao.framework.common.exception.ShopException; import co.yixiang.logging.aop.log.Log; import co.yixiang.modules.aop.ForbidSubmit; import co.yixiang.modules.product.domain.YxStoreProduct; @@ -98,7 +98,7 @@ public class ShippingTemplatesController { Arrays.asList(ids).forEach(id->{ for (YxStoreProduct yxStoreProduct : productList) { if(id.equals(yxStoreProduct.getTempId())){ - throw new BadRequestException("运费模板存在商品关联,请删除对应商品"); + throw new ShopException("运费模板存在商品关联,请删除对应商品"); } } yxShippingTemplatesService.removeById(id); diff --git a/zsw-bxg/src/main/java/co/yixiang/modules/template/service/impl/YxShippingTemplatesServiceImpl.java b/zsw-bxg/src/main/java/co/yixiang/modules/template/service/impl/YxShippingTemplatesServiceImpl.java index 0be4da1e..f625f7f4 100644 --- a/zsw-bxg/src/main/java/co/yixiang/modules/template/service/impl/YxShippingTemplatesServiceImpl.java +++ b/zsw-bxg/src/main/java/co/yixiang/modules/template/service/impl/YxShippingTemplatesServiceImpl.java @@ -10,7 +10,6 @@ package co.yixiang.modules.template.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.IdUtil; -import co.yixiang.exception.BusinessException; import cn.iocoder.yudao.framework.common.exception.ShopException; import co.yixiang.common.service.impl.BaseServiceImpl; import co.yixiang.common.utils.QueryHelpPlus; @@ -246,7 +245,7 @@ public class YxShippingTemplatesServiceImpl extends BaseServiceImpl= maxMoney){ - throw new BadRequestException("测试金额过大"); + throw new ShopException("测试金额过大"); } // 创建API对应的request(手机网页版) AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest(); diff --git a/zsw-bxg/src/main/java/co/yixiang/tools/service/impl/EmailConfigServiceImpl.java b/zsw-bxg/src/main/java/co/yixiang/tools/service/impl/EmailConfigServiceImpl.java index cf0274c6..d26bf6f9 100644 --- a/zsw-bxg/src/main/java/co/yixiang/tools/service/impl/EmailConfigServiceImpl.java +++ b/zsw-bxg/src/main/java/co/yixiang/tools/service/impl/EmailConfigServiceImpl.java @@ -9,7 +9,7 @@ import cn.hutool.extra.mail.Mail; import cn.hutool.extra.mail.MailAccount; import co.yixiang.common.service.impl.BaseServiceImpl; import co.yixiang.dozer.service.IGenerator; -import co.yixiang.exception.BadRequestException; +import cn.iocoder.yudao.framework.common.exception.ShopException; import co.yixiang.tools.domain.EmailConfig; import co.yixiang.tools.domain.vo.EmailVo; import co.yixiang.tools.service.EmailConfigService; @@ -63,7 +63,7 @@ public class EmailConfigServiceImpl extends BaseServiceImpl"); // ssl方式发送 @@ -97,7 +97,7 @@ public class EmailConfigServiceImpl extends BaseServiceImpl .execute().body(); JSONObject jsonObject = JSONUtil.parseObj(result); if(!jsonObject.get(CODE).toString().equals(SUCCESS)){ - throw new BadRequestException(TranslatorUtil.translate(jsonObject.get(MSG).toString())); + throw new ShopException(TranslatorUtil.translate(jsonObject.get(MSG).toString())); } picture = JSON.parseObject(jsonObject.get("data").toString(), Picture.class); picture.setSize(FileUtil.getSize(Integer.parseInt(picture.getSize()))); diff --git a/zsw-bxg/src/main/java/co/yixiang/tools/service/impl/QiNiuServiceImpl.java b/zsw-bxg/src/main/java/co/yixiang/tools/service/impl/QiNiuServiceImpl.java index d4917a2e..9e3bd5f3 100644 --- a/zsw-bxg/src/main/java/co/yixiang/tools/service/impl/QiNiuServiceImpl.java +++ b/zsw-bxg/src/main/java/co/yixiang/tools/service/impl/QiNiuServiceImpl.java @@ -6,7 +6,7 @@ package co.yixiang.tools.service.impl; import co.yixiang.dozer.service.IGenerator; -import co.yixiang.exception.BadRequestException; +import cn.iocoder.yudao.framework.common.exception.ShopException; import co.yixiang.tools.domain.QiniuConfig; import co.yixiang.tools.domain.QiniuContent; import co.yixiang.tools.service.QiNiuService; @@ -83,7 +83,7 @@ public class QiNiuServiceImpl implements QiNiuService { public QiniuConfig update(QiniuConfig qiniuConfig) { String http = "http://", https = "https://"; if (!(qiniuConfig.getHost().toLowerCase().startsWith(http)||qiniuConfig.getHost().toLowerCase().startsWith(https))) { - throw new BadRequestException("外链域名必须以http://或者https://开头"); + throw new ShopException("外链域名必须以http://或者https://开头"); } qiniuConfig.setId(1L); qiniuConfigService.saveOrUpdate(qiniuConfig); @@ -95,7 +95,7 @@ public class QiNiuServiceImpl implements QiNiuService { @Transactional(rollbackFor = Exception.class) public QiniuContent upload(MultipartFile file, QiniuConfig qiniuConfig) { if(qiniuConfig.getId() == null){ - throw new BadRequestException("请先添加相应配置,再操作"); + throw new ShopException("请先添加相应配置,再操作"); } // 构造一个带指定Zone对象的配置类 Configuration cfg = new Configuration(QiNiuUtil.getRegion(qiniuConfig.getZone())); @@ -128,7 +128,7 @@ public class QiNiuServiceImpl implements QiNiuService { } return content; } catch (Exception e) { - throw new BadRequestException(e.getMessage()); + throw new ShopException(e.getMessage()); } } @@ -176,7 +176,7 @@ public class QiNiuServiceImpl implements QiNiuService { @Transactional(rollbackFor = Exception.class) public void synchronize(QiniuConfig config) { if(config.getId() == null){ - throw new BadRequestException("请先添加相应配置,再操作"); + throw new ShopException("请先添加相应配置,再操作"); } //构造一个带指定Zone对象的配置类 Configuration cfg = new Configuration(QiNiuUtil.getRegion(config.getZone())); diff --git a/zsw-bxg/src/main/java/co/yixiang/tools/service/impl/VerificationCodeServiceImpl.java b/zsw-bxg/src/main/java/co/yixiang/tools/service/impl/VerificationCodeServiceImpl.java index d9775e08..0b248a26 100644 --- a/zsw-bxg/src/main/java/co/yixiang/tools/service/impl/VerificationCodeServiceImpl.java +++ b/zsw-bxg/src/main/java/co/yixiang/tools/service/impl/VerificationCodeServiceImpl.java @@ -12,7 +12,7 @@ import cn.hutool.extra.template.TemplateConfig; import cn.hutool.extra.template.TemplateEngine; import cn.hutool.extra.template.TemplateUtil; import co.yixiang.common.service.impl.BaseServiceImpl; -import co.yixiang.exception.BadRequestException; +import cn.iocoder.yudao.framework.common.exception.ShopException; import co.yixiang.tools.domain.VerificationCode; import co.yixiang.tools.domain.vo.EmailVo; import co.yixiang.tools.service.VerificationCodeService; @@ -70,7 +70,7 @@ public class VerificationCodeServiceImpl extends BaseServiceImpl (maxSize * len)){ - throw new BadRequestException("文件超出规定大小"); + throw new ShopException("文件超出规定大小"); } } diff --git a/zsw-bxg/src/main/java/co/yixiang/utils/SecurityUtils.java b/zsw-bxg/src/main/java/co/yixiang/utils/SecurityUtils.java index 83e4f990..6bfa6279 100644 --- a/zsw-bxg/src/main/java/co/yixiang/utils/SecurityUtils.java +++ b/zsw-bxg/src/main/java/co/yixiang/utils/SecurityUtils.java @@ -6,7 +6,7 @@ //package co.yixiang.utils; // //import cn.hutool.json.JSONObject; -//import co.yixiang.exception.BadRequestException; +//import cn.iocoder.yudao.framework.common.exception.ShopException; //import org.springframework.http.HttpStatus; //import org.springframework.security.core.Authentication; //import org.springframework.security.core.context.SecurityContextHolder; @@ -23,14 +23,14 @@ // public static UserDetails getUserDetails() { // final Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); // if (authentication == null) { -// throw new BadRequestException(HttpStatus.UNAUTHORIZED, "当前登录状态过期"); +// throw new ShopException(HttpStatus.UNAUTHORIZED, "当前登录状态过期"); // } // if (authentication.getPrincipal() instanceof UserDetails) { // UserDetails userDetails = (UserDetails) authentication.getPrincipal(); // UserDetailsService userDetailsService = SpringContextHolder.getBean(UserDetailsService.class); // return userDetailsService.loadUserByUsername(userDetails.getUsername()); // } -// throw new BadRequestException(HttpStatus.UNAUTHORIZED, "找不到当前登录的信息"); +// throw new ShopException(HttpStatus.UNAUTHORIZED, "找不到当前登录的信息"); // } // // /** @@ -40,7 +40,7 @@ // public static String getUsername(){ // final Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); // if (authentication == null) { -// throw new BadRequestException(HttpStatus.UNAUTHORIZED, "当前登录状态过期"); +// throw new ShopException(HttpStatus.UNAUTHORIZED, "当前登录状态过期"); // } // UserDetails userDetails = (UserDetails) authentication.getPrincipal(); // return userDetails.getUsername(); diff --git a/zsw-bxg/src/main/java/co/yixiang/utils/ThrowableUtil.java b/zsw-bxg/src/main/java/co/yixiang/utils/ThrowableUtil.java index 7bc8448a..9ded7c8b 100644 --- a/zsw-bxg/src/main/java/co/yixiang/utils/ThrowableUtil.java +++ b/zsw-bxg/src/main/java/co/yixiang/utils/ThrowableUtil.java @@ -5,7 +5,7 @@ */ package co.yixiang.utils; -import co.yixiang.exception.BadRequestException; +import cn.iocoder.yudao.framework.common.exception.ShopException; import javax.validation.ConstraintViolationException; import java.io.PrintWriter; @@ -34,9 +34,9 @@ public class ThrowableUtil { t = t.getCause(); } if (t != null) { - throw new BadRequestException(msg); + throw new ShopException(msg); } assert false; - throw new BadRequestException("删除失败:" + t.getMessage()); + throw new ShopException("删除失败:" + t.getMessage()); } } diff --git a/zsw-bxg/src/main/java/co/yixiang/utils/ValidationUtil.java b/zsw-bxg/src/main/java/co/yixiang/utils/ValidationUtil.java index 4cae9e7a..37bef0c9 100644 --- a/zsw-bxg/src/main/java/co/yixiang/utils/ValidationUtil.java +++ b/zsw-bxg/src/main/java/co/yixiang/utils/ValidationUtil.java @@ -6,7 +6,7 @@ package co.yixiang.utils; import cn.hutool.core.util.ObjectUtil; -import co.yixiang.exception.BadRequestException; +import cn.iocoder.yudao.framework.common.exception.ShopException; import org.hibernate.validator.internal.constraintvalidators.hv.EmailValidator; /** @@ -22,7 +22,7 @@ public class ValidationUtil{ public static void isNull(Object obj, String entity, String parameter , Object value){ if(ObjectUtil.isNull(obj)){ String msg = entity + " 不存在: "+ parameter +" is "+ value; - throw new BadRequestException(msg); + throw new ShopException(msg); } } diff --git a/zsw-bxg/src/main/java/co/yixiang/utils/location/LocationUtils.java b/zsw-bxg/src/main/java/co/yixiang/utils/location/LocationUtils.java index 7f582df7..8a2af55e 100644 --- a/zsw-bxg/src/main/java/co/yixiang/utils/location/LocationUtils.java +++ b/zsw-bxg/src/main/java/co/yixiang/utils/location/LocationUtils.java @@ -3,7 +3,7 @@ package co.yixiang.utils.location; import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpUtil; -import co.yixiang.exception.BadRequestException; +import cn.iocoder.yudao.framework.common.exception.ShopException; import co.yixiang.utils.ShopKeyUtils; import com.alibaba.fastjson.JSONObject;