错误消息机制问题重新处理
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.distribution;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.distribution.entity.dto.DistributionGoodsSearchParams;
|
||||
@@ -11,7 +12,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
@@ -57,6 +57,6 @@ public class DistributionGoodsBuyerController {
|
||||
if (distributionSelectedGoodsService.add(distributionGoodsId)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@@ -9,7 +10,6 @@ import cn.lili.modules.search.entity.dos.EsGoodsIndex;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -47,7 +47,7 @@ public class FootprintController {
|
||||
if (footprintService.deleteByIds(ids)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "清空足迹")
|
||||
@@ -56,7 +56,7 @@ public class FootprintController {
|
||||
if (footprintService.clean()) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取当前会员足迹数量")
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.member;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
@@ -12,7 +13,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -81,7 +81,7 @@ public class MemberAddressBuyerController {
|
||||
if (memberAddressService.removeMemberAddress(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -79,9 +79,9 @@ public class MemberWalletBuyerController {
|
||||
//校验验证码
|
||||
if (verificationService.check(uuid, VerificationEnums.WALLET_PASSWORD)) {
|
||||
memberWalletService.setMemberWalletPassword(member, password);
|
||||
return ResultUtil.error(ResultCode.SUCCESS);
|
||||
throw new ServiceException(ResultCode.SUCCESS);
|
||||
} else {
|
||||
return ResultUtil.error(ResultCode.VERIFICATION_ERROR);
|
||||
throw new ServiceException(ResultCode.VERIFICATION_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@@ -8,7 +9,6 @@ import cn.lili.modules.page.entity.dos.Feedback;
|
||||
import cn.lili.modules.page.service.FeedbackService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -38,7 +38,7 @@ public class FeedbackBuyerController {
|
||||
if (feedbackService.save(feedback)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.passport;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.sms.SmsUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.verification.enums.VerificationEnums;
|
||||
@@ -13,7 +14,6 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -50,7 +50,7 @@ public class MemberBuyerController {
|
||||
if (verificationService.check(uuid, VerificationEnums.LOGIN)) {
|
||||
return ResultUtil.data(this.memberService.usernameLogin(username, password));
|
||||
} else {
|
||||
return ResultUtil.error(ResultCode.VERIFICATION_ERROR);
|
||||
throw new ServiceException(ResultCode.VERIFICATION_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class MemberBuyerController {
|
||||
// if(smsUtil.verifyCode(mobile,VerificationEnums.LOGIN,uuid,code)){
|
||||
return ResultUtil.data(memberService.mobilePhoneLogin(mobile));
|
||||
// }else {
|
||||
// return ResultUtil.error("验证码错误");
|
||||
// throw new ServiceException("验证码错误");
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public class MemberBuyerController {
|
||||
if (result) {
|
||||
return ResultUtil.data(memberService.register(username, password, mobilePhone));
|
||||
} else {
|
||||
return ResultUtil.error(ResultCode.VERIFICATION_SMS_ERROR);
|
||||
throw new ServiceException(ResultCode.VERIFICATION_SMS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public class MemberBuyerController {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
}
|
||||
return ResultUtil.error(ResultCode.VERIFICATION_ERROR);
|
||||
throw new ServiceException(ResultCode.VERIFICATION_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改密码")
|
||||
|
||||
@@ -2,6 +2,7 @@ package cn.lili.controller.passport.connect;
|
||||
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.token.Token;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@@ -16,7 +17,6 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -68,7 +68,7 @@ public class ConnectBuyerWebController {
|
||||
@GetMapping("/result")
|
||||
public ResultMessage<Object> callBackResult(String state) {
|
||||
if (state == null) {
|
||||
return ResultUtil.error(ResultCode.USER_CONNECT_LOGIN_ERROR);
|
||||
throw new ServiceException(ResultCode.USER_CONNECT_LOGIN_ERROR);
|
||||
}
|
||||
return connectUtil.getResult(state);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.purchase;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@@ -68,7 +69,7 @@ public class PurchaseBuyerController {
|
||||
if (purchaseOrderService.close(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.store;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
@@ -82,7 +83,7 @@ public class StoreBuyerController {
|
||||
if (storeService.applyFirstStep(storeCompanyDTO)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "申请店铺第二步-填写银行信息")
|
||||
@@ -91,7 +92,7 @@ public class StoreBuyerController {
|
||||
if (storeService.applySecondStep(storeBankDTO)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "申请店铺第三步-填写其他信息")
|
||||
@@ -100,7 +101,7 @@ public class StoreBuyerController {
|
||||
if (storeService.applyThirdStep(storeOtherInfoDTO)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取当前登录会员的店铺信息-入驻店铺")
|
||||
|
||||
@@ -155,7 +155,7 @@ public class CartController {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error(ResultCode.CART_ERROR.message(), e);
|
||||
return ResultUtil.error(ResultCode.CART_ERROR);
|
||||
throw new ServiceException(ResultCode.CART_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,10 +172,10 @@ public class CartController {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
} catch (ServiceException se) {
|
||||
log.error(ResultCode.SHIPPING_NOT_APPLY.message(), se);
|
||||
return ResultUtil.error(ResultCode.SHIPPING_NOT_APPLY);
|
||||
throw new ServiceException(ResultCode.SHIPPING_NOT_APPLY);
|
||||
} catch (Exception e) {
|
||||
log.error(ResultCode.CART_ERROR.message(), e);
|
||||
return ResultUtil.error(ResultCode.CART_ERROR);
|
||||
throw new ServiceException(ResultCode.CART_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ public class CartController {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
} catch (Exception e) {
|
||||
log.error(ResultCode.CART_ERROR.message(), e);
|
||||
return ResultUtil.error(ResultCode.CART_ERROR);
|
||||
throw new ServiceException(ResultCode.CART_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,9 +232,9 @@ public class CartController {
|
||||
} catch (Exception e) {
|
||||
log.error(ResultCode.ORDER_ERROR.message(), e);
|
||||
if (e.getMessage().equals(ResultCode.SHIPPING_NOT_APPLY.message())) {
|
||||
return ResultUtil.error(ResultCode.SHIPPING_NOT_APPLY);
|
||||
throw new ServiceException(ResultCode.SHIPPING_NOT_APPLY);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ORDER_ERROR);
|
||||
throw new ServiceException(ResultCode.ORDER_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.trade;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
@@ -16,7 +17,6 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
@@ -66,11 +66,11 @@ public class OrderBuyerController {
|
||||
public ResultMessage<Object> receiving(@NotNull(message = "订单编号不能为空") @PathVariable("orderSn") String orderSn) {
|
||||
Order order = orderService.getBySn(orderSn);
|
||||
if (order == null) {
|
||||
return ResultUtil.error(ResultCode.ORDER_NOT_EXIST);
|
||||
throw new ServiceException(ResultCode.ORDER_NOT_EXIST);
|
||||
}
|
||||
//判定是否是待收货状态
|
||||
if (!order.getOrderStatus().equals(OrderStatusEnum.DELIVERED.name())) {
|
||||
return ResultUtil.error(ResultCode.ORDER_DELIVERED_ERROR);
|
||||
throw new ServiceException(ResultCode.ORDER_DELIVERED_ERROR);
|
||||
}
|
||||
orderService.complete(orderSn);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.trade;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
@@ -82,7 +83,7 @@ public class OrderComplaintBuyerController {
|
||||
return ResultUtil.data(communicationVO);
|
||||
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "取消售后")
|
||||
@@ -92,7 +93,7 @@ public class OrderComplaintBuyerController {
|
||||
if (orderComplaintService.cancel(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user