错误消息机制问题重新处理
This commit is contained in:
parent
09cb489dc9
commit
0528a1e1ca
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,6 +2,7 @@ package cn.lili.controller.common;
|
||||
|
||||
import cn.lili.common.aop.limiter.annotation.LimitPoint;
|
||||
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;
|
||||
@ -46,7 +47,7 @@ public class SmsController {
|
||||
smsUtil.sendSmsCode(mobile, verificationEnums, uuid);
|
||||
return ResultUtil.success(ResultCode.VERIFICATION_SEND_SUCCESS);
|
||||
} else {
|
||||
return ResultUtil.error(ResultCode.VERIFICATION_SMS_EXPIRED_ERROR);
|
||||
throw new ServiceException(ResultCode.VERIFICATION_SMS_EXPIRED_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ public class UploadController {
|
||||
newFile.setCreateBy(authUser.getUsername());
|
||||
newFile.setUserEnums(authUser.getRole().name());
|
||||
//如果是店铺,则记录店铺id
|
||||
if (authUser.getRole().equals(UserEnums.STORE.name())) {
|
||||
if (authUser.getRole().equals(UserEnums.STORE)) {
|
||||
newFile.setOwnerId(authUser.getStoreId());
|
||||
} else {
|
||||
newFile.setOwnerId(authUser.getId());
|
||||
@ -96,7 +96,7 @@ public class UploadController {
|
||||
fileService.save(newFile);
|
||||
} catch (Exception e) {
|
||||
log.error("文件上传失败", e);
|
||||
return ResultUtil.error(400, e.toString());
|
||||
throw new ServiceException(ResultCode.OSS_EXCEPTION);
|
||||
}
|
||||
return ResultUtil.data(result);
|
||||
}
|
||||
|
@ -259,6 +259,7 @@ public enum ResultCode {
|
||||
* OSS
|
||||
*/
|
||||
OSS_NOT_EXIST(80201,"OSS未配置"),
|
||||
OSS_EXCEPTION(80202,"文件上传失败,请稍后重试"),
|
||||
|
||||
/**
|
||||
* 验证码
|
||||
@ -266,7 +267,17 @@ public enum ResultCode {
|
||||
VERIFICATION_SEND_SUCCESS(80301,"短信验证码,发送成功"),
|
||||
VERIFICATION_ERROR(80302,"验证失败"),
|
||||
VERIFICATION_SMS_ERROR(80303,"短信验证码错误,请重新校验"),
|
||||
VERIFICATION_SMS_EXPIRED_ERROR(80304,"验证码已失效,请重新校验")
|
||||
VERIFICATION_SMS_EXPIRED_ERROR(80304,"验证码已失效,请重新校验"),
|
||||
|
||||
/**
|
||||
* 配置错误
|
||||
*/
|
||||
ALIPAY_NOT_SETTING(80401,"支付宝支付未配置"),
|
||||
ALIPAY_EXCEPTION(80402,"支付宝支付错误,请稍后重试"),
|
||||
ALIPAY_PARAMS_EXCEPTION(80403,"支付宝参数异常"),
|
||||
WECHAT_PAY_NOT_SETTING(80402,"微信支付未配置"),
|
||||
|
||||
|
||||
|
||||
;
|
||||
private final Integer code;
|
||||
|
@ -1,7 +1,6 @@
|
||||
package cn.lili.common.exception;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@ -23,7 +22,7 @@ import java.util.List;
|
||||
*/
|
||||
@RestControllerAdvice
|
||||
@Slf4j
|
||||
public class GlobalControllerExceptionHandler {
|
||||
public class GlobalControllerExceptionHandler {
|
||||
|
||||
/**
|
||||
* 如果超过长度,则前后段交互体验不佳,使用默认错误消息
|
||||
@ -44,9 +43,9 @@ public class GlobalControllerExceptionHandler {
|
||||
|
||||
//如果是自定义异常,则获取异常,返回自定义错误消息
|
||||
if (e instanceof ServiceException) {
|
||||
ResultCode resultCode=((ServiceException) e).getResultCode();
|
||||
ResultCode resultCode = ((ServiceException) e).getResultCode();
|
||||
if (resultCode != null) {
|
||||
return ResultUtil.error(resultCode.code(), resultCode.message());
|
||||
throw new ServiceException(resultCode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,7 +54,7 @@ public class GlobalControllerExceptionHandler {
|
||||
if (e != null && e.getMessage() != null && e.getMessage().length() < MAX_LENGTH) {
|
||||
errorMsg = e.getMessage();
|
||||
}
|
||||
return ResultUtil.error(400, errorMsg);
|
||||
throw new ServiceException(ResultCode.ERROR, errorMsg);
|
||||
}
|
||||
|
||||
@ExceptionHandler(RuntimeException.class)
|
||||
@ -64,7 +63,7 @@ public class GlobalControllerExceptionHandler {
|
||||
|
||||
log.error("全局异常[RuntimeException]:", e);
|
||||
|
||||
return ResultUtil.error(400, "服务器异常,请稍后重试");
|
||||
throw new ServiceException(ResultCode.ERROR, "服务器异常,请稍后重试");
|
||||
}
|
||||
|
||||
// /**
|
||||
@ -101,9 +100,9 @@ public class GlobalControllerExceptionHandler {
|
||||
BindException exception = (BindException) e;
|
||||
List<FieldError> fieldErrors = exception.getBindingResult().getFieldErrors();
|
||||
for (FieldError error : fieldErrors) {
|
||||
return ResultUtil.error(400,error.getDefaultMessage());
|
||||
throw new ServiceException(ResultCode.ERROR, error.getDefaultMessage());
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -27,4 +27,9 @@ public class ServiceException extends RuntimeException {
|
||||
this.resultCode = resultCode;
|
||||
}
|
||||
|
||||
public ServiceException(ResultCode resultCode, String message) {
|
||||
this.resultCode = resultCode;
|
||||
this.msg = message;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,10 +17,6 @@ public class ResultUtil<T> {
|
||||
* 正常响应
|
||||
*/
|
||||
private static final Integer SUCCESS = 200;
|
||||
/**
|
||||
* 业务异常
|
||||
*/
|
||||
private static final Integer ERROR = 400;
|
||||
|
||||
|
||||
/**
|
||||
@ -44,30 +40,6 @@ public class ResultUtil<T> {
|
||||
return this.resultMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务器异常 追加状态码
|
||||
*
|
||||
* @param resultCode 返回码
|
||||
*/
|
||||
public ResultMessage<T> setErrorMsg(ResultCode resultCode) {
|
||||
this.resultMessage.setSuccess(false);
|
||||
this.resultMessage.setMessage(resultCode.message());
|
||||
this.resultMessage.setCode(resultCode.code());
|
||||
return this.resultMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 服务器异常 追加状态码
|
||||
* @param code 状态码
|
||||
* @param msg 返回消息
|
||||
*/
|
||||
public ResultMessage<T> setErrorMsg(Integer code, String msg) {
|
||||
this.resultMessage.setSuccess(false);
|
||||
this.resultMessage.setMessage(msg);
|
||||
this.resultMessage.setCode(code);
|
||||
return this.resultMessage;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 返回成功消息
|
||||
@ -95,20 +67,4 @@ public class ResultUtil<T> {
|
||||
public static <T> ResultMessage<T> success(ResultCode resultCode) {
|
||||
return new ResultUtil<T>().setSuccessMsg(resultCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回失败
|
||||
* @param resultCode 返回状态码
|
||||
*/
|
||||
public static <T> ResultMessage<T> error(ResultCode resultCode) {
|
||||
return new ResultUtil<T>().setErrorMsg(resultCode);
|
||||
}
|
||||
/**
|
||||
* 返回失败
|
||||
* @param code 状态码
|
||||
* @param msg 返回消息
|
||||
*/
|
||||
public static <T> ResultMessage<T> error(Integer code, String msg) {
|
||||
return new ResultUtil<T>().setErrorMsg(code, msg);
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class VueCodeGenerator {
|
||||
try {
|
||||
result = generateClassData(path);
|
||||
} catch (Exception e) {
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
return ResultUtil.data(result);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package cn.lili.modules.connect.util;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.common.cache.Cache;
|
||||
import cn.lili.common.cache.CachePrefix;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.token.Token;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
@ -27,7 +28,6 @@ import cn.lili.modules.system.entity.dto.connect.dto.QQConnectSettingItem;
|
||||
import cn.lili.modules.system.entity.dto.connect.dto.WechatConnectSettingItem;
|
||||
import cn.lili.modules.system.entity.enums.SettingEnum;
|
||||
import cn.lili.modules.system.service.SettingService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -83,12 +83,12 @@ public class ConnectUtil {
|
||||
token = connectService.unionLoginCallback(type, authUser, callback.getState());
|
||||
resultMessage = ResultUtil.data(token);
|
||||
} catch (ServiceException e) {
|
||||
resultMessage = ResultUtil.error(400,e.getMessage());
|
||||
throw new ServiceException(ResultCode.ERROR, e.getMessage());
|
||||
}
|
||||
}
|
||||
//否则录入响应结果,等待前端获取信息
|
||||
else {
|
||||
resultMessage = ResultUtil.error(400,response.getMsg());
|
||||
throw new ServiceException(ResultCode.ERROR, response.getMsg());
|
||||
}
|
||||
//缓存写入登录结果,300秒有效
|
||||
cache.put(CachePrefix.CONNECT_RESULT.getPrefix() + callback.getCode(), resultMessage, 300L);
|
||||
|
@ -118,7 +118,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
|
||||
|
||||
@Override
|
||||
public Token usernameLogin(String username, String password) {
|
||||
Member member = this.findByUsername(username);
|
||||
Member member = this.findMember(username);
|
||||
//判断用户是否存在
|
||||
if (member == null || !member.getDisabled()) {
|
||||
throw new ServiceException(ResultCode.USER_NOT_EXIST);
|
||||
@ -134,7 +134,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
|
||||
@Override
|
||||
public Token usernameStoreLogin(String username, String password) {
|
||||
|
||||
Member member = this.findByUsername(username);
|
||||
Member member = this.findMember(username);
|
||||
//判断用户是否存在
|
||||
if (member == null || !member.getDisabled()) {
|
||||
throw new ServiceException(ResultCode.USER_NOT_EXIST);
|
||||
@ -156,6 +156,18 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
|
||||
return storeTokenGenerate.createToken(member.getUsername(), false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 传递手机号或者用户名
|
||||
*
|
||||
* @param userName
|
||||
* @return
|
||||
*/
|
||||
private Member findMember(String userName) {
|
||||
QueryWrapper<Member> queryWrapper = new QueryWrapper();
|
||||
queryWrapper.eq("username", userName).or().eq("mobile", userName);
|
||||
return memberMapper.selectOne(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Token autoRegister(ConnectAuthUser authUser) {
|
||||
|
||||
@ -347,7 +359,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
|
||||
queryWrapper.like(StringUtils.isNotBlank(memberSearchVO.getMobile()), "mobile", memberSearchVO.getMobile());
|
||||
//按照会员状态查询
|
||||
queryWrapper.eq(StringUtils.isNotBlank(memberSearchVO.getDisabled()), "disabled",
|
||||
memberSearchVO.getDisabled().equals(SwitchEnum.OPEN.name())?1:0);
|
||||
memberSearchVO.getDisabled().equals(SwitchEnum.OPEN.name()) ? 1 : 0);
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
return this.page(PageUtil.initPage(page), queryWrapper);
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public class AliPayPlugin implements Payment {
|
||||
CashierParam cashierParam = cashierSupport.cashierParam(payParam);
|
||||
//请求订单编号
|
||||
String outTradeNo = SnowFlake.getIdStr();
|
||||
|
||||
//准备支付参数
|
||||
AlipayTradeWapPayModel payModel = new AlipayTradeWapPayModel();
|
||||
payModel.setBody(cashierParam.getTitle());
|
||||
payModel.setSubject(cashierParam.getDetail());
|
||||
@ -86,7 +86,8 @@ public class AliPayPlugin implements Payment {
|
||||
AliPayRequest.wapPay(response, payModel, callbackUrl(apiProperties.getBuyer(), PaymentMethodEnum.ALIPAY),
|
||||
notifyUrl(apiProperties.getBuyer(), PaymentMethodEnum.ALIPAY));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("H5支付异常", e);
|
||||
throw new ServiceException(ResultCode.ALIPAY_EXCEPTION);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -121,8 +122,11 @@ public class AliPayPlugin implements Payment {
|
||||
String orderInfo = AliPayRequest.appPayToResponse(payModel, notifyUrl(apiProperties.getBuyer(), PaymentMethodEnum.ALIPAY)).getBody();
|
||||
return ResultUtil.data(orderInfo);
|
||||
} catch (AlipayApiException e) {
|
||||
e.printStackTrace();
|
||||
return ResultUtil.error(ResultCode.PAY_ERROR);
|
||||
log.error("支付宝支付异常:", e);
|
||||
throw new ServiceException(ResultCode.ALIPAY_EXCEPTION);
|
||||
} catch (Exception e) {
|
||||
log.error("支付业务异常:", e);
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,9 +155,9 @@ public class AliPayPlugin implements Payment {
|
||||
JSONObject jsonObject = JSONObject.parseObject(resultStr);
|
||||
return ResultUtil.data(jsonObject.getJSONObject("alipay_trade_precreate_response").getString("qr_code"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("支付业务异常:", e);
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -169,6 +173,7 @@ public class AliPayPlugin implements Payment {
|
||||
model.setRefundAmount(refundLog.getTotalAmount() + "");
|
||||
model.setRefundReason(refundLog.getRefundReason());
|
||||
model.setOutRequestNo(refundLog.getOutOrderNo());
|
||||
//交互退款
|
||||
try {
|
||||
AlipayTradeRefundResponse alipayTradeRefundResponse = AliPayApi.tradeRefundToResponse(model);
|
||||
log.error("支付宝退款,参数:{},支付宝响应:{}", JSONUtil.toJsonStr(model), JSONUtil.toJsonStr(alipayTradeRefundResponse));
|
||||
@ -180,7 +185,8 @@ public class AliPayPlugin implements Payment {
|
||||
}
|
||||
refundLogService.save(refundLog);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("支付退款异常:", e);
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
@ -192,9 +198,11 @@ public class AliPayPlugin implements Payment {
|
||||
if (StringUtils.isNotEmpty(refundLog.getPaymentReceivableNo())) {
|
||||
model.setTradeNo(refundLog.getPaymentReceivableNo());
|
||||
} else {
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
log.error("退款时,支付参数为空导致异常:{}", refundLog);
|
||||
throw new ServiceException(ResultCode.ALIPAY_PARAMS_EXCEPTION);
|
||||
}
|
||||
try {
|
||||
//与阿里进行交互
|
||||
AlipayTradeCancelResponse alipayTradeCancelResponse = AliPayApi.tradeCancelToResponse(model);
|
||||
if (alipayTradeCancelResponse.isSuccess()) {
|
||||
refundLog.setIsRefund(true);
|
||||
@ -204,7 +212,7 @@ public class AliPayPlugin implements Payment {
|
||||
}
|
||||
refundLogService.save(refundLog);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("支付宝退款异常",e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -256,8 +264,7 @@ public class AliPayPlugin implements Payment {
|
||||
log.info("支付回调通知:支付失败-参数:{}", map);
|
||||
}
|
||||
} catch (AlipayApiException e) {
|
||||
e.printStackTrace();
|
||||
throw new ServiceException("支付回调通知异常");
|
||||
log.error("支付回调通知异常", e);
|
||||
}
|
||||
|
||||
}
|
||||
@ -272,7 +279,7 @@ public class AliPayPlugin implements Payment {
|
||||
if (setting != null) {
|
||||
return JSONUtil.toBean(setting.getSettingValue(), AlipayPaymentSetting.class);
|
||||
}
|
||||
throw new ServiceException("支付未配置");
|
||||
throw new ServiceException(ResultCode.ALIPAY_NOT_SETTING);
|
||||
}
|
||||
|
||||
|
||||
|
@ -138,7 +138,7 @@ public class WechatPlugin implements Payment {
|
||||
return ResultUtil.data(JSONUtil.toJsonStr(response.getBody()));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultUtil.error(ResultCode.PAY_ERROR);
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,10 +206,10 @@ public class WechatPlugin implements Payment {
|
||||
return ResultUtil.data(map);
|
||||
}
|
||||
log.error("微信支付参数验证错误,请及时处理");
|
||||
return ResultUtil.error(ResultCode.PAY_ERROR);
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
} catch (Exception e) {
|
||||
log.error("支付异常", e);
|
||||
return ResultUtil.error(ResultCode.PAY_ERROR);
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -269,10 +269,10 @@ public class WechatPlugin implements Payment {
|
||||
return ResultUtil.data(map);
|
||||
}
|
||||
log.error("微信支付参数验证错误,请及时处理");
|
||||
return ResultUtil.error(ResultCode.PAY_ERROR);
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
} catch (Exception e) {
|
||||
log.error("支付异常", e);
|
||||
return ResultUtil.error(ResultCode.PAY_ERROR);
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -324,14 +324,14 @@ public class WechatPlugin implements Payment {
|
||||
return ResultUtil.data(new JSONObject(response.getBody()).getStr("code_url"));
|
||||
} else {
|
||||
log.error("微信支付参数验证错误,请及时处理");
|
||||
return ResultUtil.error(ResultCode.PAY_ERROR);
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
}
|
||||
} catch (ServiceException e) {
|
||||
log.error("支付异常", e);
|
||||
return ResultUtil.error(ResultCode.PAY_ERROR);
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
} catch (Exception e) {
|
||||
log.error("支付异常", e);
|
||||
return ResultUtil.error(ResultCode.PAY_ERROR);
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -407,10 +407,10 @@ public class WechatPlugin implements Payment {
|
||||
return ResultUtil.data(map);
|
||||
}
|
||||
log.error("微信支付参数验证错误,请及时处理");
|
||||
return ResultUtil.error(ResultCode.PAY_ERROR);
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
} catch (Exception e) {
|
||||
log.error("支付异常", e);
|
||||
return ResultUtil.error(ResultCode.PAY_ERROR);
|
||||
throw new ServiceException(ResultCode.PAY_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
|
||||
if (CharSequenceUtil.isNotEmpty(searchDTO.getKeyword())) {
|
||||
cache.incrementScore(HotWordsRedisKeyEnum.SEARCH_HOT_WORD.name(), searchDTO.getKeyword());
|
||||
}
|
||||
NativeSearchQueryBuilder searchQueryBuilder = createSearchQueryBuilder(searchDTO, pageVo, false);
|
||||
NativeSearchQueryBuilder searchQueryBuilder = createSearchQueryBuilder(searchDTO, pageVo, true);
|
||||
NativeSearchQuery searchQuery = searchQueryBuilder.build();
|
||||
log.info("searchGoods DSL:{}", searchQuery.getQuery());
|
||||
|
||||
@ -260,10 +260,14 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
|
||||
//分页
|
||||
nativeSearchQueryBuilder.withPageable(pageable);
|
||||
}
|
||||
//查询参数非空判定
|
||||
if (searchDTO != null) {
|
||||
//过滤条件
|
||||
BoolQueryBuilder filterBuilder = QueryBuilders.boolQuery();
|
||||
//查询条件
|
||||
BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery();
|
||||
|
||||
//对查询条件进行处理
|
||||
this.commonSearch(filterBuilder, queryBuilder, searchDTO, isAggregation);
|
||||
|
||||
// 未上架的商品不显示
|
||||
@ -279,6 +283,7 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
|
||||
this.keywordSearch(filterBuilder, queryBuilder, searchDTO.getKeyword(), isAggregation);
|
||||
}
|
||||
|
||||
//如果是聚合查询
|
||||
if (isAggregation) {
|
||||
nativeSearchQueryBuilder.withQuery(filterBuilder);
|
||||
} else {
|
||||
@ -297,23 +302,36 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
|
||||
return nativeSearchQueryBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询属性处理
|
||||
* @param filterBuilder
|
||||
* @param queryBuilder
|
||||
* @param searchDTO
|
||||
* @param isAggregation
|
||||
*/
|
||||
private void commonSearch(BoolQueryBuilder filterBuilder, BoolQueryBuilder queryBuilder, EsGoodsSearchDTO searchDTO, boolean isAggregation) {
|
||||
//品牌判定
|
||||
if (CharSequenceUtil.isNotEmpty(searchDTO.getBrandId())) {
|
||||
String[] brands = searchDTO.getBrandId().split("@");
|
||||
filterBuilder.must(QueryBuilders.termsQuery("brandId", brands));
|
||||
}
|
||||
//规格项判定
|
||||
if (searchDTO.getNameIds() != null && !searchDTO.getNameIds().isEmpty()) {
|
||||
filterBuilder.must(QueryBuilders.nestedQuery(ATTR_PATH, QueryBuilders.termsQuery("attrList.nameId", searchDTO.getNameIds()), ScoreMode.None));
|
||||
}
|
||||
//分类判定
|
||||
if (CharSequenceUtil.isNotEmpty(searchDTO.getCategoryId())) {
|
||||
filterBuilder.must(QueryBuilders.wildcardQuery("categoryPath", "*" + searchDTO.getCategoryId() + "*"));
|
||||
}
|
||||
//店铺分类判定
|
||||
if (CharSequenceUtil.isNotEmpty(searchDTO.getStoreCatId())) {
|
||||
filterBuilder.must(QueryBuilders.wildcardQuery("storeCategoryPath", "*" + searchDTO.getStoreCatId() + "*"));
|
||||
}
|
||||
//店铺判定
|
||||
if (CharSequenceUtil.isNotEmpty(searchDTO.getStoreId())) {
|
||||
filterBuilder.filter(QueryBuilders.termQuery("storeId", searchDTO.getStoreId()));
|
||||
}
|
||||
//属性判定
|
||||
if (CharSequenceUtil.isNotEmpty(searchDTO.getProp())) {
|
||||
String[] props = searchDTO.getProp().split("@");
|
||||
List<String> nameList = new ArrayList<>();
|
||||
@ -340,6 +358,7 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
|
||||
searchDTO.getNotShowCol().put(ATTR_NAME_KEY, nameList);
|
||||
searchDTO.getNotShowCol().put(ATTR_VALUE_KEY, valueList);
|
||||
}
|
||||
//价格区间判定
|
||||
if (CharSequenceUtil.isNotEmpty(searchDTO.getPrice())) {
|
||||
String[] prices = searchDTO.getPrice().split("_");
|
||||
if(prices.length==0){
|
||||
@ -355,20 +374,33 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 关键字查询处理
|
||||
* @param filterBuilder
|
||||
* @param queryBuilder
|
||||
* @param keyword
|
||||
* @param isAggregation
|
||||
*/
|
||||
private void keywordSearch(BoolQueryBuilder filterBuilder, BoolQueryBuilder queryBuilder, String keyword, boolean isAggregation) {
|
||||
List<FunctionScoreQueryBuilder.FilterFunctionBuilder> filterFunctionBuilders = new ArrayList<>();
|
||||
//商品名字匹配
|
||||
filterFunctionBuilders.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(QueryBuilders.wildcardQuery("goodsName", "*" + keyword + "*"),
|
||||
ScoreFunctionBuilders.weightFactorFunction(10)));
|
||||
//属性匹配
|
||||
filterFunctionBuilders.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(QueryBuilders.nestedQuery(ATTR_PATH, QueryBuilders.wildcardQuery(ATTR_VALUE, "*" + keyword + "*"), ScoreMode.None),
|
||||
ScoreFunctionBuilders.weightFactorFunction(8)));
|
||||
|
||||
FunctionScoreQueryBuilder.FilterFunctionBuilder[] builders = new FunctionScoreQueryBuilder.FilterFunctionBuilder[filterFunctionBuilders.size()];
|
||||
filterFunctionBuilders.toArray(builders);
|
||||
FunctionScoreQueryBuilder functionScoreQueryBuilder = QueryBuilders.functionScoreQuery(builders)
|
||||
.scoreMode(FunctionScoreQuery.ScoreMode.SUM)
|
||||
.setMinScore(2);
|
||||
//聚合搜索则将结果放入过滤条件
|
||||
if (isAggregation) {
|
||||
filterBuilder.must(functionScoreQueryBuilder);
|
||||
} else {
|
||||
}
|
||||
//否则放入查询条件
|
||||
else {
|
||||
queryBuilder.must(functionScoreQueryBuilder);
|
||||
}
|
||||
}
|
||||
|
@ -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.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -12,7 +13,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.*;
|
||||
|
||||
@ -48,7 +48,7 @@ public class DistributionManagerController {
|
||||
if (distributionService.retreat(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
} else {
|
||||
return ResultUtil.error(ResultCode.DISTRIBUTION_RETREAT_ERROR);
|
||||
throw new ServiceException(ResultCode.DISTRIBUTION_RETREAT_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
@ -62,7 +62,7 @@ public class DistributionManagerController {
|
||||
if (distributionService.resume(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
} else {
|
||||
return ResultUtil.error(ResultCode.DISTRIBUTION_RETREAT_ERROR);
|
||||
throw new ServiceException(ResultCode.DISTRIBUTION_RETREAT_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
@ -77,7 +77,7 @@ public class DistributionManagerController {
|
||||
if (distributionService.audit(id, status)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
} else {
|
||||
return ResultUtil.error(ResultCode.DISTRIBUTION_AUDIT_ERROR);
|
||||
throw new ServiceException(ResultCode.DISTRIBUTION_AUDIT_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
|
||||
import cn.lili.common.enums.MessageCode;
|
||||
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.goods.entity.dos.Brand;
|
||||
@ -15,7 +15,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.*;
|
||||
|
||||
@ -67,7 +66,7 @@ public class BrandManagerController {
|
||||
if (brandService.addBrand(brand)) {
|
||||
return ResultUtil.data(brand);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.BRAND_SAVE_ERROR);
|
||||
throw new ServiceException(ResultCode.BRAND_SAVE_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新数据")
|
||||
@ -78,7 +77,7 @@ public class BrandManagerController {
|
||||
if (brandService.updateBrand(brand)) {
|
||||
return ResultUtil.data(brand);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.BRAND_UPDATE_ERROR);
|
||||
throw new ServiceException(ResultCode.BRAND_UPDATE_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "后台禁用品牌")
|
||||
@ -91,7 +90,7 @@ public class BrandManagerController {
|
||||
if (brandService.brandDisable(brandId, disable)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.BRAND_DISABLE_ERROR);
|
||||
throw new ServiceException(ResultCode.BRAND_DISABLE_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.utils.StringUtils;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -12,7 +13,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.cache.annotation.CacheConfig;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -67,22 +67,22 @@ public class CategoryManagerController {
|
||||
category1.setName(category.getName());
|
||||
List<Category> list = categoryService.findByAllBySortOrder(category1);
|
||||
if (StringUtils.isNotEmpty(list)) {
|
||||
return ResultUtil.error(ResultCode.CATEGORY_NOT_EXIST);
|
||||
throw new ServiceException(ResultCode.CATEGORY_NOT_EXIST);
|
||||
}
|
||||
// 非顶级分类
|
||||
if (category.getParentId() != null && !category.getParentId().equals("0")) {
|
||||
Category parent = categoryService.getById(category.getParentId());
|
||||
if (parent == null) {
|
||||
return ResultUtil.error(ResultCode.CATEGORY_PARENT_NOT_EXIST);
|
||||
throw new ServiceException(ResultCode.CATEGORY_PARENT_NOT_EXIST);
|
||||
}
|
||||
if (category.getLevel() >= 4) {
|
||||
return ResultUtil.error(ResultCode.CATEGORY_BEYOND_THREE);
|
||||
throw new ServiceException(ResultCode.CATEGORY_BEYOND_THREE);
|
||||
}
|
||||
}
|
||||
if (categoryService.saveCategory(category)) {
|
||||
return ResultUtil.data(category);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.CATEGORY_SAVE_ERROR);
|
||||
throw new ServiceException(ResultCode.CATEGORY_SAVE_ERROR);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ -90,7 +90,7 @@ public class CategoryManagerController {
|
||||
public ResultMessage<Category> updateCategory(CategoryVO category) {
|
||||
Category catTemp = categoryService.getById(category.getId());
|
||||
if (catTemp == null) {
|
||||
return ResultUtil.error(ResultCode.CATEGORY_PARENT_NOT_EXIST);
|
||||
throw new ServiceException(ResultCode.CATEGORY_PARENT_NOT_EXIST);
|
||||
}
|
||||
//不能添加重复的分类名称
|
||||
Category category1 = new Category();
|
||||
@ -98,7 +98,7 @@ public class CategoryManagerController {
|
||||
category1.setId(category.getId());
|
||||
List<Category> list = categoryService.findByAllBySortOrder(category1);
|
||||
if (StringUtils.isNotEmpty(list)) {
|
||||
return ResultUtil.error(ResultCode.CATEGORY_NAME_IS_EXIST);
|
||||
throw new ServiceException(ResultCode.CATEGORY_NAME_IS_EXIST);
|
||||
}
|
||||
|
||||
categoryService.updateCategory(category);
|
||||
@ -113,13 +113,13 @@ public class CategoryManagerController {
|
||||
category.setParentId(id);
|
||||
List<Category> list = categoryService.findByAllBySortOrder(category);
|
||||
if (list != null && !list.isEmpty()) {
|
||||
return ResultUtil.error(ResultCode.CATEGORY_HAS_CHILDREN);
|
||||
throw new ServiceException(ResultCode.CATEGORY_HAS_CHILDREN);
|
||||
|
||||
}
|
||||
// 查询某商品分类的商品数量
|
||||
Integer count = goodsService.getGoodsCountByCategory(id);
|
||||
if (count > 0) {
|
||||
return ResultUtil.error(ResultCode.CATEGORY_HAS_GOODS);
|
||||
throw new ServiceException(ResultCode.CATEGORY_HAS_GOODS);
|
||||
}
|
||||
categoryService.delete(id);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
@ -134,7 +134,7 @@ public class CategoryManagerController {
|
||||
|
||||
Category category = categoryService.getById(id);
|
||||
if (category == null) {
|
||||
return ResultUtil.error(ResultCode.CATEGORY_NOT_EXIST);
|
||||
throw new ServiceException(ResultCode.CATEGORY_NOT_EXIST);
|
||||
}
|
||||
categoryService.updateCategoryStatus(id, enableOperations);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
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.goods.entity.dos.CategoryParameterGroup;
|
||||
@ -12,7 +13,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
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.*;
|
||||
|
||||
@ -55,7 +55,7 @@ public class CategoryParameterGroupManagerController {
|
||||
if (categoryParameterGroupService.save(categoryParameterGroup)) {
|
||||
return ResultUtil.data(categoryParameterGroup);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.CATEGORY_PARAMETER_SAVE_ERROR);
|
||||
throw new ServiceException(ResultCode.CATEGORY_PARAMETER_SAVE_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新数据")
|
||||
@ -65,7 +65,7 @@ public class CategoryParameterGroupManagerController {
|
||||
if (categoryParameterGroupService.updateById(categoryParameterGroup)) {
|
||||
return ResultUtil.data(categoryParameterGroup);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.CATEGORY_PARAMETER_UPDATE_ERROR);
|
||||
throw new ServiceException(ResultCode.CATEGORY_PARAMETER_UPDATE_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过id删除参数组")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
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.goods.entity.dos.Goods;
|
||||
@ -71,7 +72,7 @@ public class GoodsManagerController {
|
||||
if (Boolean.TRUE.equals(goodsService.updateGoodsMarketAble(goodsIds, GoodsStatusEnum.DOWN, reason))) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.GOODS_UNDER_ERROR);
|
||||
throw new ServiceException(ResultCode.GOODS_UNDER_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "管理员审核商品", notes = "管理员审核商品")
|
||||
@ -85,7 +86,7 @@ public class GoodsManagerController {
|
||||
if (goodsService.auditGoods(goodsIds, GoodsAuthEnum.valueOf(isAuth))) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.GOODS_AUTH_ERROR);
|
||||
throw new ServiceException(ResultCode.GOODS_AUTH_ERROR);
|
||||
}
|
||||
|
||||
|
||||
@ -98,7 +99,7 @@ public class GoodsManagerController {
|
||||
if (goodsService.updateGoodsMarketAble(goodsId, GoodsStatusEnum.UPPER, "")) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.GOODS_UPPER_ERROR);
|
||||
throw new ServiceException(ResultCode.GOODS_UPPER_ERROR);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
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.goods.entity.dos.Parameters;
|
||||
@ -34,7 +35,7 @@ public class ParameterManagerController {
|
||||
if (parametersService.save(parameters)) {
|
||||
return ResultUtil.data(parameters);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.PARAMETER_SAVE_ERROR);
|
||||
throw new ServiceException(ResultCode.PARAMETER_SAVE_ERROR);
|
||||
|
||||
}
|
||||
|
||||
@ -45,7 +46,7 @@ public class ParameterManagerController {
|
||||
if (parametersService.updateById(parameters)) {
|
||||
return ResultUtil.data(parameters);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.PARAMETER_UPDATE_ERROR);
|
||||
throw new ServiceException(ResultCode.PARAMETER_UPDATE_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过id删除参数")
|
||||
|
@ -2,6 +2,7 @@ package cn.lili.controller.goods;
|
||||
|
||||
|
||||
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;
|
||||
@ -14,7 +15,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.*;
|
||||
|
||||
@ -68,7 +68,7 @@ public class SpecificationManagerController {
|
||||
if (specificationService.updateSpecification(parameters)) {
|
||||
return ResultUtil.data(parameters);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.SPEC_UPDATE_ERROR);
|
||||
throw new ServiceException(ResultCode.SPEC_UPDATE_ERROR);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ -80,7 +80,7 @@ public class SpecificationManagerController {
|
||||
if (specificationService.addSpecification(parameters) != null) {
|
||||
return ResultUtil.data(parameters);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.SPEC_SAVE_ERROR);
|
||||
throw new ServiceException(ResultCode.SPEC_SAVE_ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
|
@ -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;
|
||||
@ -10,7 +11,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.*;
|
||||
|
||||
@ -42,7 +42,7 @@ public class MemberAddressManagerController {
|
||||
if (memberAddressService.removeMemberAddress(id)) {
|
||||
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.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -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.*;
|
||||
|
||||
@ -57,7 +57,7 @@ public class MemberEvaluationManagerController {
|
||||
if (memberEvaluationService.updateStatus(id, status)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除评论")
|
||||
@ -67,7 +67,7 @@ public class MemberEvaluationManagerController {
|
||||
if (memberEvaluationService.delete(id)) {
|
||||
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;
|
||||
@ -71,7 +72,7 @@ public class MemberManagerController {
|
||||
if (memberService.updateMemberStatus(memberIds, disabled)) {
|
||||
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.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
@ -10,7 +11,6 @@ import cn.lili.modules.member.service.MemberNoticeLogService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
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.*;
|
||||
|
||||
@ -56,7 +56,7 @@ public class MemberNoticeLogManagerController {
|
||||
if (memberNoticeLogService.saveOrUpdate(memberNoticeLog)) {
|
||||
return ResultUtil.data(memberNoticeLog);
|
||||
}
|
||||
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.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
@ -11,7 +12,6 @@ import cn.lili.modules.member.service.MemberNoticeSenterService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
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.*;
|
||||
|
||||
@ -61,7 +61,7 @@ public class MemberNoticeSenterManagerController {
|
||||
if (memberNoticeSenterService.customSave(memberNoticeSenter)) {
|
||||
return ResultUtil.data(memberNoticeSenter);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
|
@ -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.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.page.entity.dos.ArticleCategory;
|
||||
@ -75,6 +76,6 @@ public class ArticleCategoryManagerController {
|
||||
if (articleCategoryService.deleteById(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.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.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.page.entity.dos.Article;
|
||||
@ -79,7 +80,7 @@ public class ArticleManagerController {
|
||||
if(articleService.updateArticleStatus(id,status)){
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.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.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -40,7 +41,7 @@ public class CustomWordsManagerController {
|
||||
if (customWordsService.addCustomWords(customWords)) {
|
||||
return ResultUtil.data(customWords);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改自定义分词")
|
||||
@ -49,7 +50,7 @@ public class CustomWordsManagerController {
|
||||
if (customWordsService.updateCustomWords(customWords)) {
|
||||
return ResultUtil.data(customWords);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除自定义分词")
|
||||
@ -59,7 +60,7 @@ public class CustomWordsManagerController {
|
||||
if (customWordsService.deleteCustomWords(id)) {
|
||||
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.other;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
@ -52,7 +53,7 @@ public class SensitiveWordsManagerController {
|
||||
SensitiveWordsFilter.put(sensitiveWords.getSensitiveWord());
|
||||
return ResultUtil.data(sensitiveWords);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改敏感词")
|
||||
@ -64,7 +65,7 @@ public class SensitiveWordsManagerController {
|
||||
SensitiveWordsFilter.put(sensitiveWords.getSensitiveWord());
|
||||
return ResultUtil.data(sensitiveWords);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
|
@ -1,7 +1,7 @@
|
||||
package cn.lili.controller.other;
|
||||
|
||||
import cn.lili.common.enums.MessageCode;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
@ -12,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.*;
|
||||
|
||||
@ -47,7 +46,7 @@ public class SpecialManagerController {
|
||||
if (specialService.updateById(special)) {
|
||||
return ResultUtil.data(special);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除专题活动")
|
||||
@ -57,8 +56,7 @@ public class SpecialManagerController {
|
||||
if(specialService.removeSpecial(id)){
|
||||
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.other;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
@ -58,7 +59,7 @@ public class VerificationSourceController {
|
||||
verificationSourceService.initCache();
|
||||
return ResultUtil.data(verificationSource);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
@ -69,7 +70,7 @@ public class VerificationSourceController {
|
||||
verificationSourceService.initCache();
|
||||
return ResultUtil.data(verificationSource);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
|
@ -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.security.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.token.Token;
|
||||
@ -74,7 +75,7 @@ public class AdminUserManagerController {
|
||||
adminUser.setPassword(null);
|
||||
return ResultUtil.data(adminUser);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.USER_NOT_LOGIN);
|
||||
throw new ServiceException(ResultCode.USER_NOT_LOGIN);
|
||||
}
|
||||
|
||||
@PutMapping(value = "/edit")
|
||||
@ -88,11 +89,11 @@ public class AdminUserManagerController {
|
||||
adminUserDB.setAvatar(adminUser.getAvatar());
|
||||
adminUserDB.setNickName(adminUser.getNickName());
|
||||
if (!adminUserService.updateById(adminUserDB)) {
|
||||
return ResultUtil.error(ResultCode.USER_EDIT_ERROR);
|
||||
throw new ServiceException(ResultCode.USER_EDIT_ERROR);
|
||||
}
|
||||
return ResultUtil.success(ResultCode.USER_EDIT_SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.USER_NOT_LOGIN);
|
||||
throw new ServiceException(ResultCode.USER_NOT_LOGIN);
|
||||
}
|
||||
|
||||
@PutMapping(value = "/admin/edit")
|
||||
@ -100,7 +101,7 @@ public class AdminUserManagerController {
|
||||
public ResultMessage<Object> edit(AdminUser adminUser,
|
||||
@RequestParam(required = false) List<String> roles) {
|
||||
if (!adminUserService.updateAdminUser(adminUser, roles)) {
|
||||
return ResultUtil.error(ResultCode.USER_EDIT_ERROR);
|
||||
throw new ServiceException(ResultCode.USER_EDIT_ERROR);
|
||||
}
|
||||
return ResultUtil.success(ResultCode.USER_EDIT_SUCCESS);
|
||||
}
|
||||
@ -143,7 +144,7 @@ public class AdminUserManagerController {
|
||||
@RequestParam(required = false) List<String> roles) {
|
||||
try {
|
||||
if (roles != null && roles.size() >= 10) {
|
||||
return ResultUtil.error(ResultCode.PERMISSION_BEYOND_TEN);
|
||||
throw new ServiceException(ResultCode.PERMISSION_BEYOND_TEN);
|
||||
}
|
||||
adminUserService.saveAdminUser(adminUser, roles);
|
||||
} catch (Exception e) {
|
||||
@ -157,7 +158,7 @@ public class AdminUserManagerController {
|
||||
public ResultMessage<Object> disable(@ApiParam("用户唯一id标识") @PathVariable String userId, Boolean status) {
|
||||
AdminUser user = adminUserService.getById(userId);
|
||||
if (user == null) {
|
||||
return ResultUtil.error(ResultCode.USER_NOT_EXIST);
|
||||
throw new ServiceException(ResultCode.USER_NOT_EXIST);
|
||||
}
|
||||
user.setStatus(status);
|
||||
adminUserService.updateById(user);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.permission;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -10,7 +11,6 @@ import cn.lili.modules.permission.entity.vo.DepartmentVO;
|
||||
import cn.lili.modules.permission.service.DepartmentService;
|
||||
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.*;
|
||||
|
||||
@ -51,7 +51,7 @@ public class DepartmentManagerController {
|
||||
if (departmentService.save(department)) {
|
||||
return ResultUtil.data(department);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
@ -60,7 +60,7 @@ public class DepartmentManagerController {
|
||||
if (departmentService.updateById(department)) {
|
||||
return ResultUtil.data(department);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
|
@ -1,13 +1,13 @@
|
||||
package cn.lili.controller.permission;
|
||||
|
||||
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.permission.entity.dos.DepartmentRole;
|
||||
import cn.lili.modules.permission.service.DepartmentRoleService;
|
||||
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.*;
|
||||
|
||||
@ -40,7 +40,7 @@ public class DepartmentRoleManagerController {
|
||||
departmentRoleService.updateByDepartmentId(departmentId, departmentRole);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ public class CouponManagerController {
|
||||
if (couponService.add(couponVO) != null) {
|
||||
return ResultUtil.data(couponVO);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改优惠券")
|
||||
@ -74,7 +74,7 @@ public class CouponManagerController {
|
||||
if (couponService.updateCoupon(couponVO) != null) {
|
||||
return ResultUtil.data(coupon);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改优惠券状态")
|
||||
@ -84,7 +84,7 @@ public class CouponManagerController {
|
||||
if (couponService.updateCouponStatus(Arrays.asList(split), PromotionStatusEnum.valueOf(promotionStatus))) {
|
||||
return ResultUtil.success(ResultCode.COUPON_EDIT_STATUS_SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.COUPON_EDIT_STATUS_ERROR);
|
||||
throw new ServiceException(ResultCode.COUPON_EDIT_STATUS_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.promotion;
|
||||
|
||||
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;
|
||||
@ -15,7 +16,6 @@ import cn.lili.modules.promotion.service.PromotionGoodsService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
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.*;
|
||||
|
||||
@ -66,7 +66,7 @@ public class PintuanManagerController {
|
||||
if (pintuanService.openPintuan(pintuanId, new Date(startTime), new Date(endTime))) {
|
||||
return ResultUtil.success(ResultCode.PINTUAN_MANUAL_OPEN_SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.PINTUAN_MANUAL_OPEN_ERROR);
|
||||
throw new ServiceException(ResultCode.PINTUAN_MANUAL_OPEN_ERROR);
|
||||
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ public class PintuanManagerController {
|
||||
if (pintuanService.closePintuan(pintuanId)) {
|
||||
return ResultUtil.success(ResultCode.PINTUAN_MANUAL_CLOSE_SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.PINTUAN_MANUAL_CLOSE_ERROR);
|
||||
throw new ServiceException(ResultCode.PINTUAN_MANUAL_CLOSE_ERROR);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.promotion;
|
||||
|
||||
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;
|
||||
@ -32,7 +33,7 @@ public class PointsGoodsCategoryManagerController {
|
||||
if (pointsGoodsCategoryService.addCategory(pointsGoodsCategory)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ -41,7 +42,7 @@ public class PointsGoodsCategoryManagerController {
|
||||
if (pointsGoodsCategoryService.updateCategory(pointsGoodsCategory)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
@ -50,7 +51,7 @@ public class PointsGoodsCategoryManagerController {
|
||||
if (pointsGoodsCategoryService.deleteCategory(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.promotion;
|
||||
|
||||
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;
|
||||
@ -12,7 +13,6 @@ import cn.lili.modules.promotion.service.PointsGoodsService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
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.*;
|
||||
|
||||
@ -46,7 +46,7 @@ public class PointsGoodsManagerController {
|
||||
if (pointsGoodsService.addPointsGoods(collect)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping(consumes = "application/json", produces = "application/json")
|
||||
@ -58,7 +58,7 @@ public class PointsGoodsManagerController {
|
||||
if (pointsGoodsService.updatePointsGoods(pointsGoods)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping("/{ids}")
|
||||
@ -67,7 +67,7 @@ public class PointsGoodsManagerController {
|
||||
if (pointsGoodsService.updatePointsGoodsPromotionStatus(Arrays.asList(ids.split(",")), promotionStatus)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{ids}")
|
||||
@ -76,7 +76,7 @@ public class PointsGoodsManagerController {
|
||||
if (pointsGoodsService.deletePointsGoods(Arrays.asList(ids.split(",")))) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.promotion;
|
||||
|
||||
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;
|
||||
@ -44,7 +45,7 @@ public class SeckillManagerController {
|
||||
if (seckillService.saveSeckill(seckillVO)) {
|
||||
return ResultUtil.data(seckillVO);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ -56,7 +57,7 @@ public class SeckillManagerController {
|
||||
if (seckillService.modifySeckill(seckillVO)) {
|
||||
return ResultUtil.data(seckillVO);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/{id}")
|
||||
|
@ -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.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.purchase.entity.dos.PurchaseOrder;
|
||||
@ -64,7 +65,7 @@ public class PurchaseManagerController {
|
||||
if (purchaseOrderService.close(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "报价列表")
|
||||
|
@ -2,6 +2,7 @@ package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.enums.SwitchEnum;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.BeanUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
@ -15,7 +16,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 lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.EnumUtils;
|
||||
import org.elasticsearch.ResourceNotFoundException;
|
||||
@ -99,7 +99,7 @@ public class NoticeMessageManagerController {
|
||||
if (result) {
|
||||
return ResultUtil.data(noticeMessage);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
throw new ResourceNotFoundException(ResultCode.NOTICE_NOT_EXIST.message());
|
||||
}
|
||||
@ -125,7 +125,7 @@ public class NoticeMessageManagerController {
|
||||
return ResultUtil.data(messageTemplate);
|
||||
}
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
throw new ResourceNotFoundException(ResultCode.NOTICE_NOT_EXIST.message());
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
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.base.service.RegionService;
|
||||
@ -8,7 +9,6 @@ import cn.lili.modules.system.entity.dos.Region;
|
||||
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.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -59,7 +59,7 @@ public class RegionManagerController {
|
||||
if (regionService.updateById(region)) {
|
||||
return ResultUtil.data(region);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ public class RegionManagerController {
|
||||
if (regionService.save(region)) {
|
||||
return ResultUtil.data(region);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "{ids}")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
@ -54,7 +55,7 @@ public class ServiceNoticeManagerController {
|
||||
if (serviceNoticeService.saveOrUpdate(serviceNotice)) {
|
||||
return ResultUtil.data(serviceNotice);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "更新服务订阅消息")
|
||||
@ -63,7 +64,7 @@ public class ServiceNoticeManagerController {
|
||||
if (serviceNoticeService.saveOrUpdate(serviceNotice)) {
|
||||
return ResultUtil.data(serviceNotice);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除服务订阅消息")
|
||||
|
@ -2,6 +2,7 @@ package cn.lili.controller.setting;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
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.base.aspect.DemoSite;
|
||||
@ -98,7 +99,7 @@ public class SettingManagerController {
|
||||
return createSetting(key);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,7 +188,7 @@ public class SettingManagerController {
|
||||
ResultUtil.data(new WechatPaymentSetting()) :
|
||||
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), WechatPaymentSetting.class));
|
||||
default:
|
||||
return ResultUtil.error(ResultCode.SETTING_NOT_TO_SET);
|
||||
throw new ServiceException(ResultCode.SETTING_NOT_TO_SET);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
@ -59,7 +60,7 @@ public class WechatMPMessageManagerController {
|
||||
if (wechatMPMessageService.save(wechatMPMessage)) {
|
||||
return new ResultUtil<WechatMPMessage>().setData(wechatMPMessage);
|
||||
}
|
||||
return new ResultUtil<WechatMPMessage>().setErrorMsg(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
@ -68,7 +69,7 @@ public class WechatMPMessageManagerController {
|
||||
if (wechatMPMessageService.updateById(wechatMPMessage)) {
|
||||
return new ResultUtil<WechatMPMessage>().setData(wechatMPMessage);
|
||||
}
|
||||
return new ResultUtil<WechatMPMessage>().setErrorMsg(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.setting;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
@ -10,7 +11,6 @@ import cn.lili.modules.message.service.WechatMessageService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
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.*;
|
||||
|
||||
@ -60,7 +60,7 @@ public class WechatMessageManageController {
|
||||
if (wechatMessageService.save(wechatMessage)) {
|
||||
return ResultUtil.data(wechatMessage);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
@ -69,7 +69,7 @@ public class WechatMessageManageController {
|
||||
if (wechatMessageService.updateById(wechatMessage)) {
|
||||
return ResultUtil.data(wechatMessage);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
|
@ -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.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -14,7 +15,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.*;
|
||||
|
||||
@ -63,7 +63,7 @@ public class BillManagerController {
|
||||
if (billService.complete(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.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -98,7 +99,7 @@ public class StoreManagerController {
|
||||
if (storeService.disable(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "开启店铺")
|
||||
@ -108,7 +109,7 @@ public class StoreManagerController {
|
||||
if (storeService.enable(id)) {
|
||||
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.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;
|
||||
@ -20,7 +21,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.*;
|
||||
|
||||
@ -66,7 +66,7 @@ public class OrderComplaintManagerController {
|
||||
if (orderComplaintService.updateOrderComplain(orderComplainVO)) {
|
||||
return ResultUtil.data(orderComplainVO);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加交易投诉对话")
|
||||
@ -81,7 +81,7 @@ public class OrderComplaintManagerController {
|
||||
if (orderComplaintCommunicationService.addCommunication(communicationVO)) {
|
||||
return ResultUtil.data(communicationVO);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改状态")
|
||||
@ -90,7 +90,7 @@ public class OrderComplaintManagerController {
|
||||
if (orderComplaintService.updateOrderComplainByStatus(orderComplainVO) != null) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
|
||||
@ -111,6 +111,6 @@ public class OrderComplaintManagerController {
|
||||
if (orderComplaintService.updateOrderComplainByStatus(orderComplaintOperationParams) != null) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
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.goods.entity.dos.CategoryParameterGroup;
|
||||
@ -12,7 +13,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
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.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -49,7 +49,7 @@ public class CategoryParameterGroupStoreController {
|
||||
if (categoryParameterGroupService.save(categoryParameterGroup)) {
|
||||
return ResultUtil.data(categoryParameterGroup);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过id删除参数组")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
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;
|
||||
@ -13,7 +14,6 @@ import cn.lili.modules.goods.service.DraftGoodsService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
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.*;
|
||||
|
||||
@ -44,7 +44,7 @@ public class DraftGoodsStoreController {
|
||||
public ResultMessage<DraftGoodsVO> getDraftGoods(@PathVariable String id) {
|
||||
DraftGoodsVO draftGoods = draftGoodsService.getDraftGoods(id);
|
||||
if (!UserContext.getCurrentUser().getStoreId().equals(draftGoods.getStoreId())) {
|
||||
return ResultUtil.error(ResultCode.USER_AUTHORITY_ERROR);
|
||||
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
||||
}
|
||||
return ResultUtil.data(draftGoods);
|
||||
}
|
||||
@ -56,7 +56,7 @@ public class DraftGoodsStoreController {
|
||||
AuthUser currentUser = UserContext.getCurrentUser();
|
||||
draftGoodsVO.setStoreId(currentUser.getStoreId());
|
||||
} else if (draftGoodsVO.getStoreId() != null && !UserContext.getCurrentUser().getStoreId().equals(draftGoodsVO.getStoreId())) {
|
||||
return ResultUtil.error(ResultCode.USER_AUTHORITY_ERROR);
|
||||
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
||||
}
|
||||
draftGoodsService.saveGoodsDraft(draftGoodsVO);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
@ -67,7 +67,7 @@ public class DraftGoodsStoreController {
|
||||
public ResultMessage<String> deleteDraftGoods(@PathVariable String id) {
|
||||
DraftGoods draftGoods = draftGoodsService.getById(id);
|
||||
if (!draftGoods.getStoreId().equals(UserContext.getCurrentUser().getStoreId())) {
|
||||
return ResultUtil.error(ResultCode.USER_AUTHORITY_ERROR);
|
||||
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
||||
}
|
||||
draftGoodsService.deleteGoodsDraft(id);
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
@ -61,7 +62,7 @@ public class GoodsGalleryController {
|
||||
if (goodsGalleryService.save(goodsGallery)) {
|
||||
return ResultUtil.data(goodsGallery);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改商品相册")
|
||||
@ -71,7 +72,7 @@ public class GoodsGalleryController {
|
||||
if (goodsGalleryService.updateById(goodsGallery)) {
|
||||
return ResultUtil.data(goodsGallery);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "批量删除")
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.goods;
|
||||
|
||||
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;
|
||||
@ -22,7 +23,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.*;
|
||||
|
||||
@ -92,7 +92,7 @@ public class GoodsStoreController {
|
||||
if (tokenUser.getStoreId().equals(goods.getStoreId())) {
|
||||
return ResultUtil.data(goods);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.USER_AUTHORITY_ERROR);
|
||||
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增商品")
|
||||
@ -118,7 +118,7 @@ public class GoodsStoreController {
|
||||
if (goodsService.updateGoodsMarketAble(goodsId, GoodsStatusEnum.DOWN, "商家下架")) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "上架商品", notes = "上架商品时使用")
|
||||
@ -128,7 +128,7 @@ public class GoodsStoreController {
|
||||
if (goodsService.updateGoodsMarketAble(goodsId, GoodsStatusEnum.UPPER, "")) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除商品")
|
||||
@ -138,7 +138,7 @@ public class GoodsStoreController {
|
||||
if (goodsService.deleteGoods(goodsId)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "设置商品运费模板")
|
||||
@ -152,7 +152,7 @@ public class GoodsStoreController {
|
||||
if (goodsService.freight(goodsId, freightPayer, templateId)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据goodsId分页获取商品规格列表")
|
||||
|
@ -2,6 +2,7 @@ package cn.lili.controller.goods;
|
||||
|
||||
|
||||
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;
|
||||
@ -14,7 +15,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.*;
|
||||
|
||||
@ -52,7 +52,7 @@ public class SpecificationStoreController {
|
||||
if (specificationService.addSpecification(parameters) != null) {
|
||||
return ResultUtil.data(parameters);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
|
@ -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.AuthUser;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
@ -38,7 +39,7 @@ public class StoreUserController {
|
||||
member.setPassword(null);
|
||||
return ResultUtil.data(member);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.USER_NOT_LOGIN);
|
||||
throw new ServiceException(ResultCode.USER_NOT_LOGIN);
|
||||
}
|
||||
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class CouponStoreController {
|
||||
AuthUser currentUser = UserContext.getCurrentUser();
|
||||
Coupon coupon = couponService.getCouponDetailFromMongo(couponId);
|
||||
if (coupon == null || !coupon.getStoreId().equals(currentUser.getStoreId())) {
|
||||
return ResultUtil.error(ResultCode.USER_AUTHORITY_ERROR);
|
||||
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
||||
}
|
||||
return ResultUtil.data(coupon);
|
||||
}
|
||||
@ -65,7 +65,7 @@ public class CouponStoreController {
|
||||
if (couponService.add(couponVO) != null) {
|
||||
return ResultUtil.data(couponVO);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@PutMapping(consumes = "application/json", produces = "application/json")
|
||||
@ -84,7 +84,7 @@ public class CouponStoreController {
|
||||
|
||||
return ResultUtil.data(coupon);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping(value = "/{ids}")
|
||||
@ -108,6 +108,6 @@ public class CouponStoreController {
|
||||
if (couponService.updateCouponStatus(Arrays.asList(split), PromotionStatusEnum.valueOf(promotionStatus))) {
|
||||
return ResultUtil.success(ResultCode.COUPON_EDIT_STATUS_SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.COUPON_EDIT_STATUS_ERROR);
|
||||
throw new ServiceException(ResultCode.COUPON_EDIT_STATUS_ERROR);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.promotion;
|
||||
|
||||
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;
|
||||
@ -72,7 +73,7 @@ public class PintuanStoreController {
|
||||
if (pintuanService.addPintuan(pintuan)) {
|
||||
return ResultUtil.success(ResultCode.PINTUAN_ADD_SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.PINTUAN_ADD_ERROR);
|
||||
throw new ServiceException(ResultCode.PINTUAN_ADD_ERROR);
|
||||
}
|
||||
|
||||
@PutMapping(consumes = "application/json", produces = "application/json")
|
||||
@ -84,7 +85,7 @@ public class PintuanStoreController {
|
||||
if (pintuanService.modifyPintuan(pintuan)) {
|
||||
return ResultUtil.success(ResultCode.PINTUAN_EDIT_SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.PINTUAN_EDIT_ERROR);
|
||||
throw new ServiceException(ResultCode.PINTUAN_EDIT_ERROR);
|
||||
}
|
||||
|
||||
@PutMapping("/open/{pintuanId}")
|
||||
@ -93,7 +94,7 @@ public class PintuanStoreController {
|
||||
if (pintuanService.openPintuan(pintuanId, new Date(startTime), new Date(endTime))) {
|
||||
return ResultUtil.success(ResultCode.PINTUAN_MANUAL_OPEN_SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.PINTUAN_MANUAL_OPEN_ERROR);
|
||||
throw new ServiceException(ResultCode.PINTUAN_MANUAL_OPEN_ERROR);
|
||||
|
||||
}
|
||||
|
||||
@ -103,7 +104,7 @@ public class PintuanStoreController {
|
||||
if (pintuanService.closePintuan(pintuanId)) {
|
||||
return ResultUtil.success(ResultCode.PINTUAN_MANUAL_CLOSE_SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.PINTUAN_MANUAL_CLOSE_ERROR);
|
||||
throw new ServiceException(ResultCode.PINTUAN_MANUAL_CLOSE_ERROR);
|
||||
}
|
||||
|
||||
@DeleteMapping("/{pintuanId}")
|
||||
@ -112,7 +113,7 @@ public class PintuanStoreController {
|
||||
if (pintuanService.deletePintuan(pintuanId)) {
|
||||
return ResultUtil.success(ResultCode.PINTUAN_DELETE_SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.PINTUAN_DELETE_ERROR);
|
||||
throw new ServiceException(ResultCode.PINTUAN_DELETE_ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.settings;
|
||||
|
||||
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;
|
||||
@ -9,7 +10,6 @@ import cn.lili.modules.store.service.FreightTemplateService;
|
||||
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.*;
|
||||
|
||||
@ -61,6 +61,6 @@ public class FreightTemplateStoreController {
|
||||
if (freightTemplateService.removeFreightTemplate(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package cn.lili.controller.settings;
|
||||
|
||||
|
||||
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.store.entity.dos.StoreDetail;
|
||||
@ -57,7 +58,7 @@ public class StoreSettingsController {
|
||||
if (storeDetailService.editStoreSetting(storeSettingDTO)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改店铺库存预警数量")
|
||||
@ -68,7 +69,7 @@ public class StoreSettingsController {
|
||||
if (storeDetailService.updateStockWarning(stockWarning)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取商家退货收件地址")
|
||||
@ -85,6 +86,6 @@ public class StoreSettingsController {
|
||||
if (storeDetailService.editStoreAfterSaleAddressDTO(storeAfterSaleAddressDTO)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.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.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
@ -14,7 +15,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.*;
|
||||
|
||||
@ -71,6 +71,6 @@ public class BillStoreController {
|
||||
if (billService.check(id)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.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.utils.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.member.entity.dto.StoreEvaluationQueryParams;
|
||||
@ -12,7 +13,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.*;
|
||||
|
||||
@ -55,6 +55,6 @@ public class MemberEvaluationStoreController {
|
||||
if (memberEvaluationService.reply(id, reply, replyImage)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.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.*;
|
||||
|
||||
@ -69,7 +69,7 @@ public class OrderComplaintStoreController {
|
||||
if (orderComplaintCommunicationService.addCommunication(communicationVO)) {
|
||||
return ResultUtil.data(communicationVO);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改申诉信息")
|
||||
@ -79,7 +79,7 @@ public class OrderComplaintStoreController {
|
||||
if (orderComplaintService.updateOrderComplain(orderComplainVO)) {
|
||||
return ResultUtil.data(orderComplainVO);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ public class OrderComplaintStoreController {
|
||||
if (orderComplaintService.appeal(storeAppealVO)) {
|
||||
return ResultUtil.data(orderComplaintService.getOrderComplainById(storeAppealVO.getOrderComplaintId()));
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改状态")
|
||||
@ -99,7 +99,7 @@ public class OrderComplaintStoreController {
|
||||
if (orderComplaintService.updateOrderComplainByStatus(orderComplainVO) != null) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user