Skip to content

Commit

Permalink
调整异常机制
Browse files Browse the repository at this point in the history
  • Loading branch information
chopper711 committed May 19, 2021
1 parent 0528a1e commit a10110e
Show file tree
Hide file tree
Showing 196 changed files with 733 additions and 1,233 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cn.lili.controller.distribution;

import cn.lili.common.security.context.UserContext;
import cn.lili.common.utils.ResultUtil;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.distribution.entity.dos.Distribution;
import cn.lili.modules.distribution.entity.dos.DistributionOrder;
Expand All @@ -13,7 +13,6 @@
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.*;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package cn.lili.controller.distribution;

import cn.lili.common.utils.ResultUtil;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.distribution.entity.dos.DistributionCash;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
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.enums.ResultUtil;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.distribution.entity.dto.DistributionGoodsSearchParams;
import cn.lili.modules.distribution.entity.vos.DistributionGoodsVO;
Expand Down Expand Up @@ -54,9 +52,7 @@ public ResultMessage<IPage<DistributionGoodsVO>> distributionGoods(DistributionG
@GetMapping(value = "/checked/{distributionGoodsId}")
public ResultMessage<IPage<DistributionGoodsVO>> distributionCheckGoods(
@NotNull(message = "分销商品不能为空") @PathVariable("distributionGoodsId") String distributionGoodsId) {
if (distributionSelectedGoodsService.add(distributionGoodsId)) {
return ResultUtil.success(ResultCode.SUCCESS);
}
throw new ServiceException(ResultCode.ERROR);
distributionSelectedGoodsService.add(distributionGoodsId);
return ResultUtil.success();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package cn.lili.controller.distribution;

import cn.lili.common.utils.ResultUtil;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.distribution.entity.dos.DistributionOrder;
import cn.lili.modules.distribution.entity.vos.DistributionOrderSearchParams;
Expand All @@ -9,7 +9,6 @@
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.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package cn.lili.controller.goods;

import cn.lili.common.utils.ResultUtil;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.goods.entity.vos.CategoryVO;
import cn.lili.modules.goods.service.CategoryService;
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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cn.lili.controller.goods;

import cn.hutool.core.text.CharSequenceUtil;
import cn.lili.common.utils.ResultUtil;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.distribution.service.DistributionService;
Expand All @@ -21,7 +21,6 @@
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.data.domain.Page;
import org.springframework.web.bind.annotation.GetMapping;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import cn.lili.common.enums.ResultCode;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.utils.ResultUtil;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.promotion.entity.dos.MemberCoupon;
Expand All @@ -15,7 +15,6 @@
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.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
Expand Down Expand Up @@ -82,7 +81,7 @@ public ResultMessage<Object> getMemberCouponsNum() {
public ResultMessage<Object> receiveCoupon(@NotNull(message = "优惠券ID不能为空") @PathVariable("couponId") String couponId) {
memberCouponService.checkCouponLimit(couponId, UserContext.getCurrentUser().getId());
memberCouponService.receiveCoupon(couponId, UserContext.getCurrentUser().getId(), UserContext.getCurrentUser().getNickName());
return ResultUtil.success(ResultCode.SUCCESS);
return ResultUtil.success();
}

@ApiOperation(value = "通过id获取")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
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.enums.ResultUtil;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.member.service.FootprintService;
Expand Down Expand Up @@ -44,19 +42,16 @@ public ResultMessage<List<EsGoodsIndex>> getByPage(PageVO page) {
@ApiImplicitParam(name = "ids", value = "商品ID", required = true, allowMultiple = true, dataType = "String", paramType = "path")
@DeleteMapping(value = "/delByIds/{ids}")
public ResultMessage<Object> delAllByIds(@NotNull(message = "商品ID不能为空") @PathVariable("ids") List ids) {
if (footprintService.deleteByIds(ids)) {
return ResultUtil.success(ResultCode.SUCCESS);
}
throw new ServiceException(ResultCode.ERROR);
footprintService.deleteByIds(ids);
return ResultUtil.success();

}

@ApiOperation(value = "清空足迹")
@DeleteMapping
public ResultMessage<Object> deleteAll() {
if (footprintService.clean()) {
return ResultUtil.success(ResultCode.SUCCESS);
}
throw new ServiceException(ResultCode.ERROR);
footprintService.clean();
return ResultUtil.success();
}

@ApiOperation(value = "获取当前会员足迹数量")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package cn.lili.controller.member;

import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.utils.ResultUtil;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.base.service.RegionService;
import cn.lili.modules.member.entity.dos.MemberAddress;
import cn.lili.modules.promotion.service.MemberAddressService;
import com.baomidou.mybatisplus.core.metadata.IPage;
Expand Down Expand Up @@ -36,9 +33,6 @@ public class MemberAddressBuyerController {
@Autowired
private MemberAddressService memberAddressService;

@Autowired
private RegionService regionService;

@ApiOperation(value = "获取会员收件地址分页列表")
@GetMapping
public ResultMessage<IPage<MemberAddress>> page(PageVO page) {
Expand All @@ -63,6 +57,9 @@ public ResultMessage<MemberAddress> getDefaultShippingAddress() {
public ResultMessage<MemberAddress> addShippingAddress(@Valid MemberAddress shippingAddress) {
//添加会员地址
shippingAddress.setMemberId(UserContext.getCurrentUser().getId());
if(shippingAddress.getIsDefault()==null){
shippingAddress.setIsDefault(false);
}
return ResultUtil.data(memberAddressService.saveMemberAddress(shippingAddress));
}

Expand All @@ -71,17 +68,18 @@ public ResultMessage<MemberAddress> addShippingAddress(@Valid MemberAddress ship
public ResultMessage<MemberAddress> editShippingAddress(@Valid MemberAddress shippingAddress) {
//修改会员地址
shippingAddress.setMemberId(UserContext.getCurrentUser().getId());
if(shippingAddress.getIsDefault()==null){
shippingAddress.setIsDefault(false);
}
return ResultUtil.data(memberAddressService.updateMemberAddress(shippingAddress));
}

@ApiOperation(value = "删除会员收件地址")
@ApiImplicitParam(name = "id", value = "会员地址ID", dataType = "String", paramType = "path")
@DeleteMapping(value = "/delById/{id}")
public ResultMessage<Object> delShippingAddressById(@PathVariable String id) {
if (memberAddressService.removeMemberAddress(id)) {
return ResultUtil.success(ResultCode.SUCCESS);
}
throw new ServiceException(ResultCode.ERROR);
memberAddressService.removeMemberAddress(id);
return ResultUtil.success();
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package cn.lili.controller.member;

import cn.lili.common.utils.ResultUtil;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.member.service.GoodsCollectionService;
Expand All @@ -9,7 +9,6 @@
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.*;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cn.lili.controller.member;

import cn.lili.common.security.context.UserContext;
import cn.lili.common.utils.ResultUtil;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.member.entity.dos.MemberEvaluation;
import cn.lili.modules.member.entity.dto.EvaluationQueryParams;
Expand All @@ -13,7 +13,6 @@
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.*;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package cn.lili.controller.member;

import cn.lili.common.utils.ResultUtil;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.message.entity.enums.MessageStatusEnum;
Expand All @@ -11,7 +11,6 @@
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.*;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


import cn.lili.common.security.context.UserContext;
import cn.lili.common.utils.ResultUtil;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.member.entity.vo.MemberReceiptAddVO;
Expand All @@ -11,7 +11,6 @@
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.*;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package cn.lili.controller.member;

import cn.lili.common.utils.ResultUtil;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.member.entity.dos.MemberSign;
import cn.lili.modules.member.service.MemberSignService;
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.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
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;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.verification.enums.VerificationEnums;
import cn.lili.common.verification.service.VerificationService;
import cn.lili.common.vo.ResultMessage;
Expand All @@ -18,7 +18,6 @@
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.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.web.bind.annotation.*;
Expand Down Expand Up @@ -108,8 +107,9 @@ public ResultMessage updatePassword(@RequestParam @Pattern(regexp = "[a-fA-F0-9]
}
this.memberWalletService.setMemberWalletPassword(member, newPassword);
return ResultUtil.data("修改成功");
} else {
throw new ServiceException(ResultCode.WALLET_NOT_EXIT_ERROR);
}
throw new ServiceException(ResultCode.ERROR);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


import cn.lili.common.security.context.UserContext;
import cn.lili.common.utils.ResultUtil;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.member.entity.dos.MemberWithdrawApply;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import cn.lili.common.security.context.UserContext;
import cn.lili.common.utils.PageUtil;
import cn.lili.common.utils.ResultUtil;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.member.entity.dos.MemberPointsHistory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cn.lili.controller.member;

import cn.lili.common.security.context.UserContext;
import cn.lili.common.utils.ResultUtil;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.order.trade.entity.dos.Recharge;
Expand All @@ -10,7 +10,6 @@
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.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cn.lili.controller.member;

import cn.lili.common.utils.PageUtil;
import cn.lili.common.utils.ResultUtil;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.system.entity.dos.ServiceNotice;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package cn.lili.controller.other;

import cn.lili.common.utils.ResultUtil;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.page.entity.dos.Article;
import cn.lili.modules.page.entity.dto.ArticleSearchParams;
Expand All @@ -12,7 +12,6 @@
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;
Expand Down
Loading

0 comments on commit a10110e

Please sign in to comment.