Browse Source

👍 删除部分异常 新增BXG统一异常SHOPEX

sj
Loki 2 years ago
parent
commit
c8ca54f026
  1. 2
      zsw-bxg/src/main/java/co/yixiang/aspect/LimitAspect.java
  2. 30
      zsw-bxg/src/main/java/co/yixiang/exception/BadLimitRequestException.java
  3. 31
      zsw-bxg/src/main/java/co/yixiang/exception/BadRequestException.java
  4. 35
      zsw-bxg/src/main/java/co/yixiang/exception/BusinessException.java
  5. 34
      zsw-bxg/src/main/java/co/yixiang/exception/DaoException.java
  6. 24
      zsw-bxg/src/main/java/co/yixiang/exception/EntityNotFoundException.java
  7. 31
      zsw-bxg/src/main/java/co/yixiang/exception/ErrorRequestException.java
  8. 4
      zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreBargainServiceImpl.java
  9. 4
      zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCombinationServiceImpl.java
  10. 4
      zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreSeckillServiceImpl.java
  11. 10
      zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxUserExtractServiceImpl.java
  12. 4
      zsw-bxg/src/main/java/co/yixiang/modules/customer/rest/QrCodeController.java
  13. 4
      zsw-bxg/src/main/java/co/yixiang/modules/customer/rest/YxStoreCustomerController.java
  14. 62
      zsw-bxg/src/main/java/co/yixiang/modules/evaluation/service/impl/YxEvaluationServiceImpl.java
  15. 37
      zsw-bxg/src/main/java/co/yixiang/modules/hotList/service/impl/YxStoreHotListServiceImpl.java
  16. 7
      zsw-bxg/src/main/java/co/yixiang/modules/mp/service/WeixinPayService.java
  17. 8
      zsw-bxg/src/main/java/co/yixiang/modules/mp/service/impl/YxWechatLiveGoodsServiceImpl.java
  18. 4
      zsw-bxg/src/main/java/co/yixiang/modules/mp/service/impl/YxWechatLiveServiceImpl.java
  19. 24
      zsw-bxg/src/main/java/co/yixiang/modules/order/rest/StoreOrderController.java
  20. 10
      zsw-bxg/src/main/java/co/yixiang/modules/order/service/impl/YxStoreOrderServiceImpl.java
  21. 7
      zsw-bxg/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductAttrServiceImpl.java
  22. 38
      zsw-bxg/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductServiceImpl.java
  23. 3
      zsw-bxg/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesServiceImpl.java
  24. 13
      zsw-bxg/src/main/java/co/yixiang/modules/services/WechatArticleService.java
  25. 12
      zsw-bxg/src/main/java/co/yixiang/modules/shop/rest/SystemGroupDataController.java
  26. 6
      zsw-bxg/src/main/java/co/yixiang/modules/shop/rest/SystemStoreController.java
  27. 6
      zsw-bxg/src/main/java/co/yixiang/modules/system/service/impl/BxgMenuServiceImpl.java
  28. 4
      zsw-bxg/src/main/java/co/yixiang/modules/template/rest/ShippingTemplatesController.java
  29. 3
      zsw-bxg/src/main/java/co/yixiang/modules/template/service/impl/YxShippingTemplatesServiceImpl.java
  30. 4
      zsw-bxg/src/main/java/co/yixiang/modules/user/rest/SystemUserTaskController.java
  31. 4
      zsw-bxg/src/main/java/co/yixiang/modules/wechat/rest/WechatMenuController.java
  32. 9
      zsw-bxg/src/main/java/co/yixiang/tools/service/impl/AlipayConfigServiceImpl.java
  33. 8
      zsw-bxg/src/main/java/co/yixiang/tools/service/impl/EmailConfigServiceImpl.java
  34. 4
      zsw-bxg/src/main/java/co/yixiang/tools/service/impl/LocalStorageServiceImpl.java
  35. 4
      zsw-bxg/src/main/java/co/yixiang/tools/service/impl/PictureServiceImpl.java
  36. 10
      zsw-bxg/src/main/java/co/yixiang/tools/service/impl/QiNiuServiceImpl.java
  37. 4
      zsw-bxg/src/main/java/co/yixiang/tools/service/impl/VerificationCodeServiceImpl.java
  38. 4
      zsw-bxg/src/main/java/co/yixiang/utils/FileUtil.java
  39. 8
      zsw-bxg/src/main/java/co/yixiang/utils/SecurityUtils.java
  40. 6
      zsw-bxg/src/main/java/co/yixiang/utils/ThrowableUtil.java
  41. 4
      zsw-bxg/src/main/java/co/yixiang/utils/ValidationUtil.java
  42. 2
      zsw-bxg/src/main/java/co/yixiang/utils/location/LocationUtils.java

2
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;

30
zsw-bxg/src/main/java/co/yixiang/exception/BadLimitRequestException.java

@ -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();
}
}

31
zsw-bxg/src/main/java/co/yixiang/exception/BadRequestException.java

@ -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();
}
}

35
zsw-bxg/src/main/java/co/yixiang/exception/BusinessException.java

@ -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);
}
}

34
zsw-bxg/src/main/java/co/yixiang/exception/DaoException.java

@ -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);
}
}

24
zsw-bxg/src/main/java/co/yixiang/exception/EntityNotFoundException.java

@ -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";
}
}

31
zsw-bxg/src/main/java/co/yixiang/exception/ErrorRequestException.java

@ -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();
}
}

4
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<YxStoreBargainMap
if (ObjectUtil.isNotNull(shippingTemplates)) {
tempName = shippingTemplates.getName();
} else {
throw new BadRequestException("请配置运费模板");
throw new ShopException("请配置运费模板");
}
}

4
zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreCombinationServiceImpl.java

@ -21,7 +21,7 @@ import co.yixiang.dozer.service.IGenerator;
import co.yixiang.enums.ProductTypeEnum;
import co.yixiang.enums.ShopCommonEnum;
import co.yixiang.enums.SpecTypeEnum;
import co.yixiang.exception.BadRequestException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.modules.activity.domain.YxStoreCombination;
import co.yixiang.modules.activity.domain.YxStorePink;
import co.yixiang.modules.activity.domain.YxStoreVisit;
@ -157,7 +157,7 @@ public class YxStoreCombinationServiceImpl extends BaseServiceImpl<YxStoreCombin
if(ObjectUtil.isNotNull(shippingTemplates)){
tempName = shippingTemplates.getName();
}else {
throw new BadRequestException("请配置运费模板");
throw new ShopException("请配置运费模板");
}
}

4
zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxStoreSeckillServiceImpl.java

@ -21,7 +21,7 @@ import co.yixiang.constant.ShopConstants;
import co.yixiang.dozer.service.IGenerator;
import co.yixiang.enums.ShopCommonEnum;
import co.yixiang.enums.SpecTypeEnum;
import co.yixiang.exception.BadRequestException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.modules.activity.domain.YxStoreSeckill;
import co.yixiang.modules.activity.service.YxStoreSeckillService;
import co.yixiang.modules.activity.service.dto.SeckillTimeDto;
@ -226,7 +226,7 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap
if(ObjectUtil.isNotNull(shippingTemplates)){
tempName = shippingTemplates.getName();
}else {
throw new BadRequestException("请配置运费模板");
throw new ShopException("请配置运费模板");
}
}

10
zsw-bxg/src/main/java/co/yixiang/modules/activity/service/impl/YxUserExtractServiceImpl.java

@ -21,7 +21,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.YxUserExtract;
import co.yixiang.modules.activity.param.UserExtParam;
import co.yixiang.modules.activity.service.YxUserExtractService;
@ -202,19 +202,19 @@ public class YxUserExtractServiceImpl extends BaseServiceImpl<YxUserExtractMappe
@Transactional(rollbackFor = Exception.class)
public void doExtract(YxUserExtract resources){
if(resources.getStatus() == null){
throw new BadRequestException("请选择审核状态");
throw new ShopException("请选择审核状态");
}
if(ShopCommonEnum.EXTRACT_0.getValue().equals(resources.getStatus())){
throw new BadRequestException("请选择审核状态");
throw new ShopException("请选择审核状态");
}
YxUserExtract userExtract = this.getById(resources.getId());
if(!ShopCommonEnum.EXTRACT_0.getValue().equals(userExtract.getStatus())){
throw new BadRequestException("该申请已经处理过啦!");
throw new ShopException("该申请已经处理过啦!");
}
if(ShopCommonEnum.EXTRACT_MINUS_1.getValue().equals(resources.getStatus())){
if(StrUtil.isEmpty(resources.getFailMsg())){
throw new BadRequestException("请填写失败原因");
throw new ShopException("请填写失败原因");
}
//防止无限添加佣金
if (ObjectUtil.isNull(userExtract.getFailTime())) {

4
zsw-bxg/src/main/java/co/yixiang/modules/customer/rest/QrCodeController.java

@ -3,7 +3,7 @@ package co.yixiang.modules.customer.rest;
import cn.hutool.core.util.StrUtil;
import co.yixiang.annotation.AnonymousAccess;
import co.yixiang.constant.ShopConstants;
import co.yixiang.exception.BadRequestException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.modules.mp.config.BxgConstans;
import co.yixiang.modules.mp.config.WxMpConfiguration;
import co.yixiang.modules.shop.service.YxSystemConfigService;
@ -73,7 +73,7 @@ public class QrCodeController {
public ResponseEntity wechatCode() {
String wechatFollowImg = systemConfigService.getData(ShopConstants.WECHAT_FOLLOW_IMG);
if(StrUtil.isBlank(wechatFollowImg)){
throw new BadRequestException("请配置后台-->微信管理-->公众号配置->关注二维码");
throw new ShopException("请配置后台-->微信管理-->公众号配置->关注二维码");
}
return ResponseEntity.ok(wechatFollowImg);
}

4
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<Object> create(@Validated @RequestBody YxStoreCustomer resources){
Long count = yxStoreCustomerService.count(new LambdaQueryWrapper<YxStoreCustomer>().eq(YxStoreCustomer::getOpenId, resources.getOpenId()));
if (count > 0) {
throw new BadRequestException("当前用户已存在,请勿重复提交");
throw new ShopException("当前用户已存在,请勿重复提交");
}
return new ResponseEntity<>(yxStoreCustomerService.save(resources),HttpStatus.CREATED);
}

62
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)
@ -76,7 +72,7 @@ public class YxEvaluationServiceImpl extends BaseServiceImpl<YxEvaluationMapper,
getPage(pageable);
PageInfo<YxEvaluation> page = new PageInfo<>(queryAll(criteria));
//根据page里面的list的商品id查询对应的商品信息,并将商品id替换为商品信息
page.getList().forEach(yxEvaluation->{
page.getList().forEach(yxEvaluation -> {
LambdaQueryWrapper<YxStoreProduct> 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<YxEvaluationMapper,
if (ObjectUtil.isNull(storeProduct)) {
// throw new ErrorRequestException("商品不存在或已下架");
yxEvaluation.setProduct(JSONUtil.toJsonStr(new YxStoreProduct()));
}else {
} else {
yxEvaluation.setProduct(JSONUtil.toJsonStr(storeProduct));
}
});
return generator.convertPageInfo(page,YxEvaluationDto.class);
return generator.convertPageInfo(page, YxEvaluationDto.class);
}
@Override
//@Cacheable
public List<YxEvaluation> queryAll(YxEvaluationQueryCriteria criteria){
public List<YxEvaluation> queryAll(YxEvaluationQueryCriteria criteria) {
return baseMapper.selectList(QueryHelpPlus.getPredicate(YxEvaluation.class, criteria));
}
@ -103,7 +99,7 @@ public class YxEvaluationServiceImpl extends BaseServiceImpl<YxEvaluationMapper,
public void download(List<YxEvaluationDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (YxEvaluationDto yxEvaluation : all) {
Map<String,Object> map = new LinkedHashMap<>();
Map<String, Object> map = new LinkedHashMap<>();
map.put("在列表里面的首页图", yxEvaluation.getHomeImage());
map.put("评测介绍", yxEvaluation.getSynopsis());
map.put("评测视频", yxEvaluation.getVideoInput());
@ -135,16 +131,16 @@ public class YxEvaluationServiceImpl extends BaseServiceImpl<YxEvaluationMapper,
LambdaQueryWrapper<YxEvaluation> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(YxEvaluation::getIsShow, ShopCommonEnum.SHOW_1.getValue())
.orderByAsc(YxEvaluation::getSort);
List<EvaluationDTO> list = generator.convert(baseMapper.selectList(wrapper),EvaluationDTO.class);
list.forEach(evaluationDTO->{
List<EvaluationDTO> list = generator.convert(baseMapper.selectList(wrapper), EvaluationDTO.class);
list.forEach(evaluationDTO -> {
LambdaQueryWrapper<YxStoreProduct> 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<YxEvaluationMapper,
* @return List
*/
@Override
public List<YxEvaluationQueryVo> getList(int page,int limit){
public List<YxEvaluationQueryVo> getList(int page, int limit) {
LambdaQueryWrapper<YxEvaluation> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(YxEvaluation::getIsShow, ShopCommonEnum.SHOW_1.getValue())
.orderByAsc(YxEvaluation::getSort);
@ -173,12 +169,12 @@ public class YxEvaluationServiceImpl extends BaseServiceImpl<YxEvaluationMapper,
*/
@Override
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "词条ID", paramType = "query", dataType = "int",dataTypeClass = Integer.class)
@ApiImplicitParam(name = "id", value = "词条ID", paramType = "query", dataType = "int", dataTypeClass = Integer.class)
})
public EvaluationDTO getEvaluationById(Long uid,int id) {
EvaluationDTO evaluationDTO=generator.convert(this.baseMapper.selectById(id), EvaluationDTO.class);
public EvaluationDTO getEvaluationById(Long uid, int id) {
EvaluationDTO evaluationDTO = generator.convert(this.baseMapper.selectById(id), EvaluationDTO.class);
// YxStoreProduct yxStoreProduct = yxStoreProductService.getProductInfo(Long.valueOf(evaluationDTO.getProduct()));
YxStoreProduct yxStoreProduct=yxStoreProductService.getById(evaluationDTO.getProduct());
YxStoreProduct yxStoreProduct = yxStoreProductService.getById(evaluationDTO.getProduct());
evaluationDTO.setProductInfo(yxStoreProduct);
//是否收藏
boolean isCollect = yxEvaluationRelationService.isEvaluationRelation(id, uid);

37
zsw-bxg/src/main/java/co/yixiang/modules/hotList/service/impl/YxStoreHotListServiceImpl.java

@ -10,44 +10,41 @@ package co.yixiang.modules.hotList.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
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.enums.SortEnum;
import co.yixiang.event.TemplateBean;
import co.yixiang.event.TemplateEvent;
import co.yixiang.event.TemplateListenEnum;
import co.yixiang.exception.ErrorRequestException;
import co.yixiang.modules.activity.domain.YxStoreCouponUser;
import co.yixiang.modules.activity.service.mapper.YxStoreCouponUserMapper;
import co.yixiang.modules.cart.domain.YxStoreCart;
import co.yixiang.modules.category.service.mapper.StoreCategoryMapper;
import co.yixiang.modules.hotList.domain.YxStoreHotListRecord;
import co.yixiang.modules.hotList.service.mapper.YxStoreHotListRecordMapper;
import co.yixiang.modules.product.service.mapper.StoreProductMapper;
import co.yixiang.modules.product.vo.YxStoreProductQueryVo;
import co.yixiang.utils.StringUtils;
import co.yixiang.utils.hotListDto.CateDto;
import co.yixiang.utils.hotListDto.HotListDataDto;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.SerializationUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.BeanUtils;
import cn.hutool.json.JSONUtil;
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.ShopCommonEnum;
import co.yixiang.modules.hotList.domain.YxStoreHotList;
import co.yixiang.modules.hotList.domain.YxStoreHotListRecord;
import co.yixiang.modules.hotList.param.YxStoreHotListRecordQueryParam;
import co.yixiang.modules.hotList.service.YxStoreHotListService;
import co.yixiang.modules.hotList.service.dto.YxStoreHotListDto;
import co.yixiang.modules.hotList.service.dto.YxStoreHotListQueryCriteria;
import co.yixiang.modules.hotList.service.mapper.YxStoreHotListMapper;
import co.yixiang.modules.hotList.service.mapper.YxStoreHotListRecordMapper;
import co.yixiang.modules.hotList.service.vo.YxStoreHotListVo;
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.utils.FileUtil;
import co.yixiang.utils.HotListDTO;
import co.yixiang.utils.StringUtils;
import co.yixiang.utils.hotListDto.CateDto;
import co.yixiang.utils.hotListDto.HotListDataDto;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.SerializationUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageInfo;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
@ -62,8 +59,6 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
import co.yixiang.modules.hotList.param.YxStoreHotListRecordQueryParam;
/**
* @author ssj

7
zsw-bxg/src/main/java/co/yixiang/modules/mp/service/WeixinPayService.java

@ -11,7 +11,6 @@ import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import co.yixiang.exception.BusinessException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.enums.AppFromEnum;
import co.yixiang.enums.BillDetailEnum;
@ -94,7 +93,7 @@ public class WeixinPayService {
YxUserRecharge userRecharge = userRechargeService.getOne(Wrappers.<YxUserRecharge>lambdaQuery()
.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());
}
}

8
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<YxWechatLiveGo
}else if(LiveGoodsEnum.IS_Audit_0.getValue().equals(wechatLiveGoods.getAuditStatus())){
resources.setCoverImgUrl(uploadPhotoToWx(wxMaService,resources.getCoverImgeUrl()).getMediaId());
}else if(LiveGoodsEnum.IS_Audit_1.getValue().equals(wechatLiveGoods.getAuditStatus())){
throw new BadRequestException("商品审核中不允许修改");
throw new ShopException("商品审核中不允许修改");
}else if(LiveGoodsEnum.IS_Audit_3.getValue().equals(wechatLiveGoods.getAuditStatus())){
resources.setCoverImgUrl(uploadPhotoToWx(wxMaService,resources.getCoverImgeUrl()).getMediaId());
wxMaService.getLiveGoodsService().updateGoods(goods);
@ -119,7 +119,7 @@ public class YxWechatLiveGoodsServiceImpl extends BaseServiceImpl<YxWechatLiveGo
boolean wxMaLiveResult = wxMaService.getLiveGoodsService().updateGoods(goods);
this.saveOrUpdate(resources);
} catch (WxErrorException e) {
throw new BadRequestException(e.toString());
throw new ShopException(e.toString());
}
}
@ -197,7 +197,7 @@ public class YxWechatLiveGoodsServiceImpl extends BaseServiceImpl<YxWechatLiveGo
resources.setAuditId(Long.valueOf(wxMaLiveResult.getAuditId()));
this.save(resources);
} catch (WxErrorException e) {
throw new BadRequestException(e.toString());
throw new ShopException(e.toString());
}
return true;
}

4
zsw-bxg/src/main/java/co/yixiang/modules/mp/service/impl/YxWechatLiveServiceImpl.java

@ -16,7 +16,7 @@ import cn.hutool.json.JSONUtil;
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.modules.mp.domain.YxWechatLiveGoods;
import co.yixiang.modules.mp.service.YxWechatLiveGoodsService;
import co.yixiang.modules.mp.service.YxWechatLiveService;
@ -178,7 +178,7 @@ public class YxWechatLiveServiceImpl extends BaseServiceImpl<YxWechatLiveMapper,
this.save(resources);
} catch (WxErrorException e) {
e.printStackTrace();
throw new BadRequestException(e.toString());
throw new ShopException(e.toString());
}
return false;
}

24
zsw-bxg/src/main/java/co/yixiang/modules/order/rest/StoreOrderController.java

@ -18,7 +18,7 @@ import co.yixiang.dozer.service.IGenerator;
import co.yixiang.enums.OrderInfoEnum;
import co.yixiang.enums.OrderLogEnum;
import co.yixiang.enums.ShopCommonEnum;
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.order.domain.YxStoreOrder;
@ -209,10 +209,10 @@ public class StoreOrderController {
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
public ResponseEntity update(@Validated @RequestBody YxStoreOrder resources) {
if (StrUtil.isBlank(resources.getDeliveryName())) {
throw new BadRequestException("请选择快递公司");
throw new ShopException("请选择快递公司");
}
if (StrUtil.isBlank(resources.getDeliveryId())) {
throw new BadRequestException("快递单号不能为空");
throw new ShopException("快递单号不能为空");
}
yxStoreOrderService.orderDelivery(resources.getOrderId(), resources.getDeliveryId(),
@ -242,10 +242,10 @@ public class StoreOrderController {
@PreAuthorize("hasAnyAuthority('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
public ResponseEntity updateDelivery(@Validated @RequestBody YxStoreOrder resources) {
if (StrUtil.isBlank(resources.getDeliveryName())) {
throw new BadRequestException("请选择快递公司");
throw new ShopException("请选择快递公司");
}
if (StrUtil.isBlank(resources.getDeliveryId())) {
throw new BadRequestException("快递单号不能为空");
throw new ShopException("快递单号不能为空");
}
yxStoreOrderService.updateDelivery(resources.getOrderId(), resources.getDeliveryId(),
@ -259,14 +259,14 @@ public class StoreOrderController {
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
public ResponseEntity check(@Validated @RequestBody YxStoreOrder resources) {
if (StrUtil.isBlank(resources.getVerifyCode())) {
throw new BadRequestException("核销码不能为空");
throw new ShopException("核销码不能为空");
}
YxStoreOrderDto storeOrderDTO = generator.convert(yxStoreOrderService.getById(resources.getId()), YxStoreOrderDto.class);
if (!resources.getVerifyCode().equals(storeOrderDTO.getVerifyCode())) {
throw new BadRequestException("核销码不对");
throw new ShopException("核销码不对");
}
if (OrderInfoEnum.PAY_STATUS_0.getValue().equals(storeOrderDTO.getPaid())) {
throw new BadRequestException("订单未支付");
throw new ShopException("订单未支付");
}
yxStoreOrderService.verifyOrder(resources.getVerifyCode(),
@ -303,10 +303,10 @@ public class StoreOrderController {
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
public ResponseEntity editOrder(@RequestBody YxStoreOrder resources) {
if (ObjectUtil.isNull(resources.getPayPrice())) {
throw new BadRequestException("请输入支付金额");
throw new ShopException("请输入支付金额");
}
if (resources.getPayPrice().doubleValue() < 0) {
throw new BadRequestException("金额不能低于0");
throw new ShopException("金额不能低于0");
}
YxStoreOrderDto storeOrder = generator.convert(yxStoreOrderService.getById(resources.getId()), YxStoreOrderDto.class);
//判断金额是否有变动,生成一个额外订单号去支付
@ -330,7 +330,7 @@ public class StoreOrderController {
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
public ResponseEntity editOrderRemark(@RequestBody YxStoreOrder resources) {
if (StrUtil.isBlank(resources.getRemark())) {
throw new BadRequestException("请输入备注");
throw new ShopException("请输入备注");
}
yxStoreOrderService.saveOrUpdate(resources);
return new ResponseEntity(HttpStatus.OK);
@ -347,7 +347,7 @@ public class StoreOrderController {
ExpressInfo expressInfo = expressService.getExpressInfo(expressInfoDo.getOrderCode(),
expressInfoDo.getShipperCode(), expressInfoDo.getLogisticCode());
if (!expressInfo.isSuccess()) {
// throw new BadRequestException(expressInfo.getReason());
// throw new ShopException(expressInfo.getReason());
throw new ShopException(expressInfo.getReason());
}
return new ResponseEntity<>(expressInfo, HttpStatus.OK);

10
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 BaseServiceImpl<StoreOrderMapper, Y
if (OrderInfoEnum.SHIPPIING_TYPE_2.getValue().toString().equals(param.getShippingType())) {
YxSystemStore systemStoreQueryVo = systemStoreService.getById(param.getStoreId());
if (systemStoreQueryVo == null) {
throw new ErrorRequestException("暂无门店无法选择门店自提");
throw new ShopException("暂无门店无法选择门店自提");
}
storeOrder.setVerifyCode(StrUtil.sub(orderSn, orderSn.length(), -12));
storeOrder.setStoreId(systemStoreQueryVo.getId());
@ -1062,7 +1060,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
}
order = handleOrder(order);
if (!OrderStatusEnum.STATUS_2.getValue().toString().equals(order.get_status().get_type())) {
throw new BusinessException("订单状态错误");
throw new ShopException("订单状态错误");
}
YxStoreOrder storeOrder = new YxStoreOrder();
@ -2892,7 +2890,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
public YxStoreOrderDto getOrderDetail(Long id) {
YxStoreOrder yxStoreOrder = this.getById(id);
if (ObjectUtil.isEmpty(yxStoreOrder)) {
throw new BadRequestException("订单详情不存在");
throw new ShopException("订单详情不存在");
}
YxStoreOrderDto yxStoreOrderDto = generator.convert(yxStoreOrder, YxStoreOrderDto.class);
Integer _status = OrderUtil.orderStatus(yxStoreOrder.getPaid(), yxStoreOrder.getStatus(),

7
zsw-bxg/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductAttrServiceImpl.java

@ -11,7 +11,6 @@ package co.yixiang.modules.product.service.impl;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import co.yixiang.exception.BusinessException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.dozer.service.IGenerator;
@ -88,14 +87,14 @@ public class YxStoreProductAttrServiceImpl extends BaseServiceImpl<StoreProductA
/*Long count = storeProductAttrValueService.count(Wrappers.<YxStoreProductAttrValue>lambdaQuery().eq(YxStoreProductAttrValue::getProductId, productId));
if (count > 0 ) {
throw new BadRequestException("该产品已被添加到其他活动,禁止操作!");
throw new ShopException("该产品已被添加到其他活动,禁止操作!");
}*/
List<YxStoreProductAttrValue> 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<String> stringList = new ArrayList<>(productFormatDto.getDetail().values());
@ -127,7 +126,7 @@ public class YxStoreProductAttrServiceImpl extends BaseServiceImpl<StoreProductA
}
if(attrGroup.isEmpty() || valueGroup.isEmpty()){
throw new BusinessException("请设置至少一个属性!");
throw new ShopException("请设置至少一个属性!");
}
//清理属性

38
zsw-bxg/src/main/java/co/yixiang/modules/product/service/impl/YxStoreProductServiceImpl.java

@ -19,36 +19,18 @@ import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.constant.ShopConstants;
import co.yixiang.dozer.service.IGenerator;
import co.yixiang.enums.CommonEnum;
import co.yixiang.enums.ProductEnum;
import co.yixiang.enums.ProductTypeEnum;
import co.yixiang.enums.ShopCommonEnum;
import co.yixiang.enums.SortEnum;
import co.yixiang.enums.SpecTypeEnum;
import co.yixiang.exception.BadRequestException;
import co.yixiang.exception.ErrorRequestException;
import co.yixiang.enums.*;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.modules.category.service.YxStoreCategoryService;
import co.yixiang.modules.evaluation.domain.YxEvaluation;
import co.yixiang.modules.evaluation.service.mapper.YxEvaluationMapper;
import co.yixiang.modules.hotList.service.mapper.YxStoreHotListMapper;
import co.yixiang.modules.store.domain.YxStoreBrand;
import co.yixiang.modules.store.service.YxStoreBrandService;
import co.yixiang.modules.product.domain.YxStoreProduct;
import co.yixiang.modules.product.domain.YxStoreProductAttrValue;
import co.yixiang.modules.product.domain.YxStoreProductRelation;
import co.yixiang.modules.product.param.YxStoreProductQueryParam;
import co.yixiang.modules.product.service.YxStoreProductAttrService;
import co.yixiang.modules.product.service.YxStoreProductAttrValueService;
import co.yixiang.modules.product.service.YxStoreProductRelationService;
import co.yixiang.modules.product.service.YxStoreProductReplyService;
import co.yixiang.modules.product.service.YxStoreProductService;
import co.yixiang.modules.product.service.dto.DetailDto;
import co.yixiang.modules.product.service.dto.FromatDetailDto;
import co.yixiang.modules.product.service.dto.ProductFormatDto;
import co.yixiang.modules.product.service.dto.ProductResultDto;
import co.yixiang.modules.product.service.dto.StoreProductDto;
import co.yixiang.modules.product.service.dto.YxStoreProductDto;
import co.yixiang.modules.product.service.dto.YxStoreProductQueryCriteria;
import co.yixiang.modules.product.service.*;
import co.yixiang.modules.product.service.dto.*;
import co.yixiang.modules.product.service.mapper.StoreProductMapper;
import co.yixiang.modules.product.vo.ProductVo;
import co.yixiang.modules.product.vo.YxStoreProductAttrQueryVo;
@ -56,12 +38,16 @@ import co.yixiang.modules.product.vo.YxStoreProductQueryVo;
import co.yixiang.modules.product.vo.YxStoreProductReplyQueryVo;
import co.yixiang.modules.shop.service.YxSystemConfigService;
import co.yixiang.modules.shop.service.YxSystemStoreService;
import co.yixiang.modules.store.domain.YxStoreBrand;
import co.yixiang.modules.store.service.YxStoreBrandService;
import co.yixiang.modules.store.service.mapper.YxStoreBrandMapper;
import co.yixiang.modules.store.vo.YxStoreBrandVo;
import co.yixiang.modules.template.domain.YxShippingTemplates;
import co.yixiang.modules.template.service.YxShippingTemplatesService;
import co.yixiang.modules.user.service.YxUserService;
import co.yixiang.utils.*;
import co.yixiang.utils.FileUtil;
import co.yixiang.utils.RegexUtil;
import co.yixiang.utils.ShopKeyUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -194,7 +180,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
wrapper.eq(YxStoreProduct::getIsShow, 1).eq(YxStoreProduct::getId, id);
YxStoreProduct storeProduct = this.baseMapper.selectOne(wrapper);
if (ObjectUtil.isNull(storeProduct)) {
throw new ErrorRequestException("商品不存在或已下架");
throw new ShopException("商品不存在或已下架");
}
return storeProduct;
}
@ -340,7 +326,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
.eq(YxStoreProduct::getId, id);
YxStoreProduct storeProduct = storeProductMapper.selectOne(wrapper);
if (ObjectUtil.isNull(storeProduct)) {
throw new ErrorRequestException("商品不存在或已下架");
throw new ShopException("商品不存在或已下架");
}
LambdaQueryWrapper<YxStoreBrand> wrapper1 = new LambdaQueryWrapper<>();
wrapper1.eq(YxStoreBrand::getIsShow, ShopCommonEnum.SHOW_1.getValue())
@ -389,7 +375,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
if (ObjectUtil.isNotNull(shippingTemplates)) {
tempName = shippingTemplates.getName();
} else {
throw new BadRequestException("请配置运费模板");
throw new ShopException("请配置运费模板");
}
}

3
zsw-bxg/src/main/java/co/yixiang/modules/sales/service/impl/StoreAfterSalesServiceImpl.java

@ -12,7 +12,6 @@ import co.yixiang.enums.ShopCommonEnum;
import co.yixiang.event.TemplateBean;
import co.yixiang.event.TemplateEvent;
import co.yixiang.event.TemplateListenEnum;
import co.yixiang.exception.ErrorRequestException;
import co.yixiang.modules.cart.vo.YxStoreCartQueryVo;
import co.yixiang.modules.mp.service.WeixinPayService;
import co.yixiang.modules.order.domain.YxStoreOrder;
@ -342,7 +341,7 @@ public class StoreAfterSalesServiceImpl extends BaseServiceImpl<StoreAfterSalesM
storeAfterSales.setState(AfterSalesStatusEnum.STATUS_1.getValue());
if (storeAfterSales.getServiceType() == 1) { //退货退款
if (StringUtils.isEmpty(consignee) || StringUtils.isEmpty(phoneNumber) || StringUtils.isEmpty(address)) {
throw new ErrorRequestException("请输入收货人信息");
throw new ShopException("请输入收货人信息");
}
storeAfterSales.setConsignee(consignee);
storeAfterSales.setPhoneNumber(phoneNumber);

13
zsw-bxg/src/main/java/co/yixiang/modules/services/WechatArticleService.java

@ -3,23 +3,18 @@ package co.yixiang.modules.services;
import cn.hutool.core.util.ReUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import co.yixiang.exception.ErrorRequestException;
import co.yixiang.modules.mp.service.dto.YxArticleDto;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.modules.mp.config.WxMpConfiguration;
import co.yixiang.modules.mp.service.dto.YxArticleDto;
import co.yixiang.modules.mp.utils.URLUtils;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.WxMpMassTagMessage;
import me.chanjar.weixin.mp.bean.material.WxMediaImgUploadResult;
import me.chanjar.weixin.mp.bean.material.WxMpMaterial;
import me.chanjar.weixin.mp.bean.material.WxMpMaterialNews;
import me.chanjar.weixin.mp.bean.material.WxMpMaterialUploadResult;
import me.chanjar.weixin.mp.bean.material.WxMpNewsArticle;
import me.chanjar.weixin.mp.bean.material.*;
import me.chanjar.weixin.mp.bean.result.WxMpMassSendResult;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.File;
@ -83,7 +78,7 @@ public class WechatArticleService {
.massGroupMessageSend(massMessage);
if(!"0".equals(massResult.getErrorCode())) {
log.info("error:"+massResult.getErrorMsg());
throw new ErrorRequestException("发送失败");
throw new ShopException("发送失败");
}
log.info( "massResult : {}", JSONUtil.toJsonStr( massResult ) );

12
zsw-bxg/src/main/java/co/yixiang/modules/shop/rest/SystemGroupDataController.java

@ -9,7 +9,7 @@ import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.constant.ShopConstants;
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.YxSystemGroupData;
@ -117,7 +117,7 @@ public class SystemGroupDataController {
yshop_seckill_time.forEach(item -> {
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("简介必须填写");
}
}

6
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);
}

6
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<BxgMenuMapper, Menu> 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<BxgMenuMapper, Menu> 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://开头");
}
}
}

4
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);

3
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<YxShippingTe
}
if(shippingTemplatesRegions.isEmpty()) {
throw new BusinessException("请添加区域");
throw new ShopException("请添加区域");
}
yxShippingTemplatesRegionService.saveBatch(shippingTemplatesRegions);

4
zsw-bxg/src/main/java/co/yixiang/modules/user/rest/SystemUserTaskController.java

@ -69,7 +69,7 @@ public class SystemUserTaskController {
@PutMapping(value = "/yxSystemUserTask")
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSYSTEMUSERTASK_ALL','YXSYSTEMUSERTASK_EDIT')")
public ResponseEntity update(@Validated @RequestBody YxSystemUserTask resources){
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
//if(StrUtil.isNotEmpty("22")) throw new ShopException("演示环境禁止操作");
yxSystemUserTaskService.saveOrUpdate(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
@ -79,7 +79,7 @@ public class SystemUserTaskController {
@DeleteMapping(value = "/yxSystemUserTask/{id}")
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSYSTEMUSERTASK_ALL','YXSYSTEMUSERTASK_DELETE')")
public ResponseEntity delete(@PathVariable Integer id){
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
//if(StrUtil.isNotEmpty("22")) throw new ShopException("演示环境禁止操作");
yxSystemUserTaskService.removeById(id);
return new ResponseEntity(HttpStatus.OK);
}

4
zsw-bxg/src/main/java/co/yixiang/modules/wechat/rest/WechatMenuController.java

@ -7,7 +7,7 @@ package co.yixiang.modules.wechat.rest;
import co.yixiang.constant.ShopConstants;
import co.yixiang.exception.BadRequestException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import co.yixiang.modules.aop.ForbidSubmit;
import co.yixiang.modules.mp.domain.YxWechatMenu;
import co.yixiang.modules.mp.service.YxWechatMenuService;
@ -83,7 +83,7 @@ public class WechatMenuController {
wxService.getMenuService().menuDelete();
wxService.getMenuService().menuCreate(menu);
} catch (WxErrorException e) {
throw new BadRequestException(e.getMessage());
throw new ShopException(e.getMessage());
// e.printStackTrace();
}

9
zsw-bxg/src/main/java/co/yixiang/tools/service/impl/AlipayConfigServiceImpl.java

@ -5,8 +5,9 @@
*/
package co.yixiang.tools.service.impl;
import cn.iocoder.yudao.framework.common.exception.ShopException;
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.AlipayConfig;
import co.yixiang.tools.domain.vo.TradeVo;
import co.yixiang.tools.service.AlipayConfigService;
@ -38,7 +39,7 @@ public class AlipayConfigServiceImpl extends BaseServiceImpl<AlipayConfigMapper,
public String toPayAsPc(AlipayConfig alipay, TradeVo trade) throws Exception {
if(alipay.getId() == null){
throw new BadRequestException("请先添加相应配置,再操作");
throw new ShopException("请先添加相应配置,再操作");
}
AlipayClient alipayClient = new DefaultAlipayClient(alipay.getGatewayUrl(), alipay.getAppId(), alipay.getPrivateKey(), alipay.getFormat(), alipay.getCharset(), alipay.getPublicKey(), alipay.getSignType());
@ -67,14 +68,14 @@ public class AlipayConfigServiceImpl extends BaseServiceImpl<AlipayConfigMapper,
@Override
public String toPayAsWeb(AlipayConfig alipay, TradeVo trade) throws Exception {
if(alipay.getId() == null){
throw new BadRequestException("请先添加相应配置,再操作");
throw new ShopException("请先添加相应配置,再操作");
}
AlipayClient alipayClient = new DefaultAlipayClient(alipay.getGatewayUrl(), alipay.getAppId(), alipay.getPrivateKey(), alipay.getFormat(), alipay.getCharset(), alipay.getPublicKey(), alipay.getSignType());
double money = Double.parseDouble(trade.getTotalAmount());
double maxMoney = 5000;
if(money <= 0 || money >= maxMoney){
throw new BadRequestException("测试金额过大");
throw new ShopException("测试金额过大");
}
// 创建API对应的request(手机网页版)
AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest();

8
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<EmailConfigMapper, E
@Transactional(rollbackFor = Exception.class)
public void send(EmailVo emailVo, EmailConfig emailConfig){
if(emailConfig == null){
throw new BadRequestException("请先配置,再操作");
throw new ShopException("请先配置,再操作");
}
// 封装
MailAccount account = new MailAccount();
@ -77,7 +77,7 @@ public class EmailConfigServiceImpl extends BaseServiceImpl<EmailConfigMapper, E
// 对称解密
account.setPass(EncryptUtils.desDecrypt(emailConfig.getPass()));
} catch (Exception e) {
throw new BadRequestException(e.getMessage());
throw new ShopException(e.getMessage());
}
account.setFrom(emailConfig.getUser()+"<"+emailConfig.getFromUser()+">");
// ssl方式发送
@ -97,7 +97,7 @@ public class EmailConfigServiceImpl extends BaseServiceImpl<EmailConfigMapper, E
.setUseGlobalSession(false)
.send();
}catch (Exception e){
throw new BadRequestException(e.getMessage());
throw new ShopException(e.getMessage());
}
}
}

4
zsw-bxg/src/main/java/co/yixiang/tools/service/impl/LocalStorageServiceImpl.java

@ -9,7 +9,7 @@ import cn.hutool.core.util.ObjectUtil;
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.tools.domain.LocalStorage;
import co.yixiang.tools.service.LocalStorageService;
import co.yixiang.tools.service.dto.LocalStorageDto;
@ -88,7 +88,7 @@ public class LocalStorageServiceImpl extends BaseServiceImpl<LocalStorageMapper,
String type = FileUtil.getFileType(suffix);
File file = FileUtil.upload(multipartFile, path + type + File.separator);
if(ObjectUtil.isNull(file)){
throw new BadRequestException("上传失败");
throw new ShopException("上传失败");
}
try {
name = StringUtils.isBlank(name) ? FileUtil.getFileNameNoEx(multipartFile.getOriginalFilename()) : name;

4
zsw-bxg/src/main/java/co/yixiang/tools/service/impl/PictureServiceImpl.java

@ -12,7 +12,7 @@ import cn.hutool.json.JSONUtil;
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.tools.domain.Picture;
import co.yixiang.tools.service.PictureService;
import co.yixiang.tools.service.dto.PictureDto;
@ -129,7 +129,7 @@ public class PictureServiceImpl extends BaseServiceImpl<PictureMapper, Picture>
.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())));

10
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()));

4
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<VerificationCod
.eq(VerificationCode::getScenes,code.getScenes()).eq(VerificationCode::getType,code.getType()).eq(VerificationCode::getValue,code.getValue())
.eq(VerificationCode::getStatus,true));
if(verificationCode == null || !verificationCode.getCode().equals(code.getCode())){
throw new BadRequestException("无效验证码");
throw new ShopException("无效验证码");
} else {
verificationCode.setStatus(false);
this.save(verificationCode);

4
zsw-bxg/src/main/java/co/yixiang/utils/FileUtil.java

@ -10,7 +10,7 @@ import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.poi.excel.BigExcelWriter;
import cn.hutool.poi.excel.ExcelUtil;
import co.yixiang.exception.BadRequestException;
import cn.iocoder.yudao.framework.common.exception.ShopException;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.ServletOutputStream;
@ -227,7 +227,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
// 1M
int len = 1024 * 1024;
if(size > (maxSize * len)){
throw new BadRequestException("文件超出规定大小");
throw new ShopException("文件超出规定大小");
}
}

8
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();

6
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());
}
}

4
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);
}
}

2
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;

Loading…
Cancel
Save