bug--代码规范优化,升级fastjson1.2.73
This commit is contained in:
@ -96,7 +96,9 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
||||
@Override
|
||||
public void decStockIncSales(int num, Long bargainId) {
|
||||
int res = yxStoreBargainMapper.decStockIncSales(num,bargainId);
|
||||
if(res == 0) throw new YshopException("砍价产品库存不足");
|
||||
if(res == 0) {
|
||||
throw new YshopException("砍价产品库存不足");
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
@ -133,14 +135,18 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
||||
//用户剩余要砍掉的价格
|
||||
double surplusPrice = NumberUtil.sub(coverPrice,
|
||||
storeBargainUser.getPrice()).doubleValue();
|
||||
if(surplusPrice == 0) return;
|
||||
if(surplusPrice == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//生成一个区间随机数
|
||||
random = OrderUtil.randomNumber(
|
||||
storeBargain.getBargainMinPrice().doubleValue(),
|
||||
storeBargain.getBargainMaxPrice().doubleValue());
|
||||
if(random > surplusPrice) random = surplusPrice;
|
||||
if(random > surplusPrice) {
|
||||
random = surplusPrice;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -174,7 +180,9 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
||||
*/
|
||||
@Override
|
||||
public TopCountVo topCount(Long bargainId) {
|
||||
if(bargainId != null) this.addBargainShare(bargainId);
|
||||
if(bargainId != null) {
|
||||
this.addBargainShare(bargainId);
|
||||
}
|
||||
return TopCountVo.builder()
|
||||
.lookCount(yxStoreBargainMapper.lookCount())
|
||||
.shareCount(yxStoreBargainMapper.shareCount())
|
||||
@ -214,7 +222,9 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
||||
.eq(YxStoreBargainUserHelp::getUid,myUid)
|
||||
.count();
|
||||
|
||||
if(helpCount > 0) userBargainStatus = false;
|
||||
if(helpCount > 0) {
|
||||
userBargainStatus = false;
|
||||
}
|
||||
|
||||
|
||||
int count = storeBargainUserHelpService
|
||||
@ -268,7 +278,9 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
|
||||
.ge(YxStoreBargain::getStopTime,now)
|
||||
.one();
|
||||
|
||||
if(storeBargain == null) throw new YshopException("砍价已结束");
|
||||
if(storeBargain == null) {
|
||||
throw new YshopException("砍价已结束");
|
||||
}
|
||||
|
||||
this.addBargainLook(id);
|
||||
|
||||
|
@ -65,12 +65,18 @@ public class YxStoreBargainUserServiceImpl extends BaseServiceImpl<YxStoreBargai
|
||||
@Override
|
||||
public void setBargainUserStatus(Long bargainId, Long uid) {
|
||||
YxStoreBargainUser storeBargainUser = getBargainUserInfo(bargainId.longValue(),uid);
|
||||
if(ObjectUtil.isNull(storeBargainUser)) return;
|
||||
if(ObjectUtil.isNull(storeBargainUser)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(storeBargainUser.getStatus() != 1) return;
|
||||
if(storeBargainUser.getStatus() != 1) {
|
||||
return;
|
||||
}
|
||||
double price = NumberUtil.sub(NumberUtil.sub(storeBargainUser.getBargainPrice(),
|
||||
storeBargainUser.getBargainPriceMin()),storeBargainUser.getPrice()).doubleValue();
|
||||
if(price > 0) return;
|
||||
if(price > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
storeBargainUser.setStatus(3);
|
||||
|
||||
@ -85,7 +91,9 @@ public class YxStoreBargainUserServiceImpl extends BaseServiceImpl<YxStoreBargai
|
||||
@Override
|
||||
public void bargainCancel(Long bargainId, Long uid) {
|
||||
YxStoreBargainUser storeBargainUser = this.getBargainUserInfo(bargainId,uid);
|
||||
if(ObjectUtil.isNull(storeBargainUser)) throw new YshopException("数据不存在");
|
||||
if(ObjectUtil.isNull(storeBargainUser)) {
|
||||
throw new YshopException("数据不存在");
|
||||
}
|
||||
if(!OrderInfoEnum.BARGAIN_STATUS_1.getValue().equals(storeBargainUser.getStatus())){
|
||||
throw new YshopException("状态错误");
|
||||
}
|
||||
@ -125,7 +133,9 @@ public class YxStoreBargainUserServiceImpl extends BaseServiceImpl<YxStoreBargai
|
||||
.eq(YxStoreBargainUserHelp::getBargainUserId,storeBargainUser.getId())
|
||||
.eq(YxStoreBargainUserHelp::getUid,uid)
|
||||
.count();
|
||||
if(count == 0) return true;
|
||||
if(count == 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -137,9 +147,13 @@ public class YxStoreBargainUserServiceImpl extends BaseServiceImpl<YxStoreBargai
|
||||
@Override
|
||||
public void setBargain(Long bargainId, Long uid) {
|
||||
YxStoreBargainUser storeBargainUser = this.getBargainUserInfo(bargainId,uid);
|
||||
if(storeBargainUser != null) throw new YshopException("你已经参与了");
|
||||
if(storeBargainUser != null) {
|
||||
throw new YshopException("你已经参与了");
|
||||
}
|
||||
YxStoreBargain storeBargain = storeBargainService.getById(bargainId);
|
||||
if(storeBargain == null) throw new YshopException("砍价商品不存在");
|
||||
if(storeBargain == null) {
|
||||
throw new YshopException("砍价商品不存在");
|
||||
}
|
||||
YxStoreBargainUser yxStoreBargainUser = YxStoreBargainUser
|
||||
.builder()
|
||||
.bargainId(bargainId)
|
||||
|
@ -105,7 +105,9 @@ public class YxStoreCombinationServiceImpl extends BaseServiceImpl<YxStoreCombin
|
||||
@Override
|
||||
public void decStockIncSales(int num, Long combinationId) {
|
||||
int res = yxStoreCombinationMapper.decStockIncSales(num,combinationId);
|
||||
if(res == 0) throw new YshopException("拼团产品库存不足");
|
||||
if(res == 0) {
|
||||
throw new YshopException("拼团产品库存不足");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -315,7 +317,9 @@ public class YxStoreCombinationServiceImpl extends BaseServiceImpl<YxStoreCombin
|
||||
//添加商品
|
||||
YxStoreCombination yxStoreCombination = new YxStoreCombination();
|
||||
BeanUtil.copyProperties(resources,yxStoreCombination,"images");
|
||||
if(resources.getImages().isEmpty()) throw new YshopException("请上传轮播图");
|
||||
if(resources.getImages().isEmpty()) {
|
||||
throw new YshopException("请上传轮播图");
|
||||
}
|
||||
|
||||
yxStoreCombination.setPrice(BigDecimal.valueOf(resultDTO.getMinPrice()));
|
||||
yxStoreCombination.setCost(resultDTO.getMinCost().intValue());
|
||||
@ -379,7 +383,9 @@ public class YxStoreCombinationServiceImpl extends BaseServiceImpl<YxStoreCombin
|
||||
.reduce(Integer::sum)
|
||||
.orElse(0);
|
||||
|
||||
if(stock <= 0) throw new YshopException("库存不能低于0");
|
||||
if(stock <= 0) {
|
||||
throw new YshopException("库存不能低于0");
|
||||
}
|
||||
|
||||
return ProductResultDto.builder()
|
||||
.minPrice(minPrice)
|
||||
|
@ -68,10 +68,14 @@ public class YxStoreCouponIssueServiceImpl extends BaseServiceImpl<YxStoreCoupon
|
||||
public void issueUserCoupon(Integer id, Long uid) {
|
||||
YxStoreCouponIssueQueryVo couponIssueQueryVo = yxStoreCouponIssueMapper
|
||||
.selectOne(id);
|
||||
if(ObjectUtil.isNull(couponIssueQueryVo)) throw new YshopException("领取的优惠劵已领完或已过期");
|
||||
if(ObjectUtil.isNull(couponIssueQueryVo)) {
|
||||
throw new YshopException("领取的优惠劵已领完或已过期");
|
||||
}
|
||||
|
||||
int count = this.couponCount(id,uid);
|
||||
if(count > 0) throw new YshopException("已领取过该优惠劵");
|
||||
if(count > 0) {
|
||||
throw new YshopException("已领取过该优惠劵");
|
||||
}
|
||||
|
||||
if(couponIssueQueryVo.getRemainCount() <= 0
|
||||
&& CouponEnum.PERMANENT_0.getValue().equals(couponIssueQueryVo.getIsPermanent())){
|
||||
@ -100,7 +104,9 @@ public class YxStoreCouponIssueServiceImpl extends BaseServiceImpl<YxStoreCoupon
|
||||
public List<YxStoreCouponIssueQueryVo> getCouponList(int page, int limit, Long uid,Long productId,Integer type) {
|
||||
Page<YxStoreCouponIssue> pageModel = new Page<>(page, limit);
|
||||
|
||||
if(type == null) type = CouponEnum.TYPE_0.getValue();
|
||||
if(type == null) {
|
||||
type = CouponEnum.TYPE_0.getValue();
|
||||
}
|
||||
List<YxStoreCouponIssueQueryVo> list = yxStoreCouponIssueMapper
|
||||
.selecCoupontList(pageModel,type,productId);
|
||||
for (YxStoreCouponIssueQueryVo couponIssue : list) {
|
||||
|
@ -179,7 +179,7 @@ public class YxStoreCouponUserServiceImpl extends BaseServiceImpl<YxStoreCouponU
|
||||
.selectList(Wrappers.<YxStoreCouponUser>lambdaQuery()
|
||||
.eq(YxStoreCouponUser::getUid,uid));
|
||||
List<YxStoreCouponUserQueryVo> storeCouponUserQueryVoList = new ArrayList<>();
|
||||
long nowTime = new Date().getTime();
|
||||
long nowTime = System.currentTimeMillis();
|
||||
for (YxStoreCouponUser couponUser : storeCouponUsers) {
|
||||
YxStoreCouponUserQueryVo queryVo = generator.convert(couponUser,YxStoreCouponUserQueryVo.class);
|
||||
if(couponUser.getIsFail() == 1){
|
||||
@ -212,7 +212,9 @@ public class YxStoreCouponUserServiceImpl extends BaseServiceImpl<YxStoreCouponU
|
||||
@Override
|
||||
public void addUserCoupon(Long uid, Integer cid) {
|
||||
YxStoreCoupon storeCoupon = storeCouponService.getById(cid);
|
||||
if(storeCoupon == null) throw new YshopException("优惠劵不存在");
|
||||
if(storeCoupon == null) {
|
||||
throw new YshopException("优惠劵不存在");
|
||||
}
|
||||
|
||||
Date now = new Date();
|
||||
|
||||
@ -240,7 +242,9 @@ public class YxStoreCouponUserServiceImpl extends BaseServiceImpl<YxStoreCouponU
|
||||
* @return boolean
|
||||
*/
|
||||
private boolean isSame(List<String> list1,List<String> list2){
|
||||
if(list2.isEmpty()) return true;
|
||||
if(list2.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
list1 = new ArrayList<>(list1);
|
||||
list2 = new ArrayList<>(list2);
|
||||
list1.addAll(list2);
|
||||
|
@ -104,7 +104,9 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
|
||||
.eq(YxStorePink::getStatus,OrderInfoEnum.REFUND_STATUS_1.getValue())
|
||||
.gt(YxStorePink::getStopTime,new Date())
|
||||
.one();
|
||||
if(pink == null) throw new YshopException("拼团不存在或已经取消");
|
||||
if(pink == null) {
|
||||
throw new YshopException("拼团不存在或已经取消");
|
||||
}
|
||||
|
||||
PinkUserDto pinkUserDto = this.getPinkMemberAndPinK(pink);
|
||||
List<YxStorePink> pinkAll = pinkUserDto.getPinkAll();
|
||||
@ -156,6 +158,7 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
|
||||
* @param pink 拼团信息
|
||||
* @return int
|
||||
*/
|
||||
@Override
|
||||
public int surplusPeople(YxStorePink pink) {
|
||||
List<YxStorePink> listT = new ArrayList<>();
|
||||
if(pink.getKId() > 0){ //团长存在
|
||||
@ -178,7 +181,9 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
|
||||
@Override
|
||||
public PinkInfoVo pinkInfo(Long id, Long uid) {
|
||||
YxStorePink pink = this.getPinkUserOne(id);
|
||||
if(ObjectUtil.isNull(pink)) throw new YshopException("拼团不存在");
|
||||
if(ObjectUtil.isNull(pink)) {
|
||||
throw new YshopException("拼团不存在");
|
||||
}
|
||||
if( OrderInfoEnum.PINK_REFUND_STATUS_1.getValue().equals(pink.getIsRefund())){
|
||||
throw new YshopException("订单已退款");
|
||||
}
|
||||
@ -194,7 +199,9 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
|
||||
List<Long> uidAll = pinkUserDto.getUidAll();
|
||||
int count = pinkUserDto.getCount();
|
||||
|
||||
if(count < 0) count = 0;
|
||||
if(count < 0) {
|
||||
count = 0;
|
||||
}
|
||||
if(OrderInfoEnum.PINK_STATUS_2.getValue().equals(pinkT.getStatus())){
|
||||
pinkBool = PinkEnum.PINK_BOOL_1.getValue();
|
||||
isOk = PinkEnum.IS_OK_1.getValue();
|
||||
@ -213,14 +220,20 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
|
||||
//团员是否在团
|
||||
if(ObjectUtil.isNotNull(pinkAll)){
|
||||
for (YxStorePink storePink : pinkAll) {
|
||||
if(storePink.getUid().equals(uid)) userBool = PinkEnum.USER_BOOL_1.getValue();
|
||||
if(storePink.getUid().equals(uid)) {
|
||||
userBool = PinkEnum.USER_BOOL_1.getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
//团长
|
||||
if(pinkT.getUid().equals(uid)) userBool = PinkEnum.USER_BOOL_1.getValue();
|
||||
if(pinkT.getUid().equals(uid)) {
|
||||
userBool = PinkEnum.USER_BOOL_1.getValue();
|
||||
}
|
||||
|
||||
YxStoreCombinationQueryVo storeCombinationQueryVo = yxStoreCombinationMapper.getCombDetail(pink.getCid());
|
||||
if(ObjectUtil.isNull(storeCombinationQueryVo)) throw new YshopException("拼团不存在或已下架");
|
||||
if(ObjectUtil.isNull(storeCombinationQueryVo)) {
|
||||
throw new YshopException("拼团不存在或已下架");
|
||||
}
|
||||
|
||||
YxUserQueryVo userInfo = userService.getYxUserById(uid);
|
||||
|
||||
@ -265,7 +278,9 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
|
||||
order = storeOrderService.handleOrder(order);
|
||||
int pinkCount = yxStorePinkMapper.selectCount(Wrappers.<YxStorePink>lambdaQuery()
|
||||
.eq(YxStorePink::getOrderId,order.getOrderId()));
|
||||
if(pinkCount > 0) return;
|
||||
if(pinkCount > 0) {
|
||||
return;
|
||||
}
|
||||
if(storeCombination != null){
|
||||
YxStorePink storePink = YxStorePink.builder()
|
||||
.uid(order.getUid())
|
||||
@ -285,7 +300,9 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
|
||||
storePink.setPeople(storeCombination.getPeople());
|
||||
storePink.setStopTime(stopTime);
|
||||
if(order.getPinkId() > 0){ //其他成员入团
|
||||
if(this.getIsPinkUid(order.getPinkId(),order.getUid())) return;
|
||||
if(this.getIsPinkUid(order.getPinkId(),order.getUid())) {
|
||||
return;
|
||||
}
|
||||
storePink.setKId(order.getPinkId());
|
||||
storePink.setStopTime(null);
|
||||
this.save(storePink);
|
||||
@ -434,7 +451,9 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
|
||||
if(pink == null){
|
||||
pink = yxStorePinkMapper.selectOne(Wrappers.<YxStorePink>lambdaQuery()
|
||||
.eq(YxStorePink::getKId,id).eq(YxStorePink::getUid,uid));
|
||||
if(pink == null) return "";
|
||||
if(pink == null) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return pink.getOrderId();
|
||||
}
|
||||
@ -471,7 +490,9 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
|
||||
int count = this.lambdaQuery().in(YxStorePink::getId,idAll)
|
||||
.eq(YxStorePink::getIsRefund,OrderInfoEnum.PINK_REFUND_STATUS_1.getValue())
|
||||
.count();
|
||||
if(count == 0) return true;
|
||||
if(count == 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,9 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap
|
||||
@Override
|
||||
public void decStockIncSales(int num, Long seckillId) {
|
||||
int res = yxStoreSeckillMapper.decStockIncSales(num,seckillId);
|
||||
if(res == 0) throw new YshopException("秒杀产品库存不足");
|
||||
if(res == 0) {
|
||||
throw new YshopException("秒杀产品库存不足");
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
@ -245,7 +247,9 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap
|
||||
//添加商品
|
||||
YxStoreSeckill yxStoreSeckill = new YxStoreSeckill();
|
||||
BeanUtil.copyProperties(resources,yxStoreSeckill,"images");
|
||||
if(resources.getImages().isEmpty()) throw new YshopException("请上传轮播图");
|
||||
if(resources.getImages().isEmpty()) {
|
||||
throw new YshopException("请上传轮播图");
|
||||
}
|
||||
|
||||
yxStoreSeckill.setPrice(BigDecimal.valueOf(resultDTO.getMinPrice()));
|
||||
yxStoreSeckill.setCost(new BigDecimal(resultDTO.getMinCost()));
|
||||
@ -308,7 +312,9 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap
|
||||
.reduce(Integer::sum)
|
||||
.orElse(0);
|
||||
|
||||
if(stock <= 0) throw new YshopException("库存不能低于0");
|
||||
if(stock <= 0) {
|
||||
throw new YshopException("库存不能低于0");
|
||||
}
|
||||
|
||||
return ProductResultDto.builder()
|
||||
.minPrice(minPrice)
|
||||
|
@ -68,15 +68,23 @@ public class YxUserExtractServiceImpl extends BaseServiceImpl<YxUserExtractMappe
|
||||
@Override
|
||||
public void userExtract(YxUser userInfo, UserExtParam param) {
|
||||
BigDecimal extractPrice = userInfo.getBrokeragePrice();
|
||||
if(extractPrice.compareTo(BigDecimal.ZERO) <= 0) throw new YshopException("提现佣金不足");
|
||||
if(extractPrice.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
throw new YshopException("提现佣金不足");
|
||||
}
|
||||
|
||||
double money = Double.valueOf(param.getMoney());
|
||||
if( extractPrice.compareTo(BigDecimal.valueOf(money)) < 0) throw new YshopException("提现佣金不足");
|
||||
if( extractPrice.compareTo(BigDecimal.valueOf(money)) < 0) {
|
||||
throw new YshopException("提现佣金不足");
|
||||
}
|
||||
|
||||
if(money <= 0) throw new YshopException("提现佣金大于0");
|
||||
if(money <= 0) {
|
||||
throw new YshopException("提现佣金大于0");
|
||||
}
|
||||
|
||||
double balance = NumberUtil.sub(extractPrice.doubleValue(),money);
|
||||
if(balance < 0) balance = 0;
|
||||
if(balance < 0) {
|
||||
balance = 0;
|
||||
}
|
||||
|
||||
YxUserExtract userExtract = new YxUserExtract();
|
||||
userExtract.setUid(userInfo.getUid());
|
||||
@ -184,6 +192,7 @@ public class YxUserExtractServiceImpl extends BaseServiceImpl<YxUserExtractMappe
|
||||
* 操作提现
|
||||
* @param resources YxUserExtract
|
||||
*/
|
||||
@Override
|
||||
public void doExtract(YxUserExtract resources){
|
||||
if(resources.getStatus() == null){
|
||||
throw new BadRequestException("请选择审核状态");
|
||||
|
@ -138,7 +138,9 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<StoreCartMapper, YxS
|
||||
throw new YshopException("该产品库存不足"+cartNum);
|
||||
}
|
||||
|
||||
if(cartNum == cart.getCartNum()) return;
|
||||
if(cartNum == cart.getCartNum()) {
|
||||
return;
|
||||
}
|
||||
|
||||
YxStoreCart storeCart = new YxStoreCart();
|
||||
storeCart.setCartNum(cartNum);
|
||||
@ -162,8 +164,12 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<StoreCartMapper, YxS
|
||||
wrapper.lambda().eq(YxStoreCart::getUid,uid)
|
||||
.eq(YxStoreCart::getIsPay,OrderInfoEnum.PAY_STATUS_0.getValue())
|
||||
.orderByDesc(YxStoreCart::getId);
|
||||
if(status == null) wrapper.lambda().eq(YxStoreCart::getIsNew, CartTypeEnum.NEW_0.getValue());
|
||||
if(StrUtil.isNotEmpty(cartIds)) wrapper.lambda().in(YxStoreCart::getId, Arrays.asList(cartIds.split(",")));
|
||||
if(status == null) {
|
||||
wrapper.lambda().eq(YxStoreCart::getIsNew, CartTypeEnum.NEW_0.getValue());
|
||||
}
|
||||
if(StrUtil.isNotEmpty(cartIds)) {
|
||||
wrapper.lambda().in(YxStoreCart::getId, Arrays.asList(cartIds.split(",")));
|
||||
}
|
||||
List<YxStoreCart> carts = yxStoreCartMapper.selectList(wrapper);
|
||||
|
||||
List<YxStoreCartQueryVo> valid = new ArrayList<>();
|
||||
|
@ -130,10 +130,11 @@ public class YxStoreCategoryServiceImpl extends BaseServiceImpl<StoreCategoryMap
|
||||
deptDTO.getChildren().add(it);
|
||||
}
|
||||
}
|
||||
if (isChild)
|
||||
if (isChild) {
|
||||
cates.add(deptDTO);
|
||||
}
|
||||
for (YxStoreCategory category : categories) {
|
||||
if (category.getId() == deptDTO.getPid() && !deptNames.contains(category.getCateName())) {
|
||||
if (category.getId().equals(deptDTO.getPid()) && !deptNames.contains(category.getCateName())) {
|
||||
cates.add(deptDTO);
|
||||
}
|
||||
}
|
||||
@ -161,10 +162,14 @@ public class YxStoreCategoryServiceImpl extends BaseServiceImpl<StoreCategoryMap
|
||||
*/
|
||||
@Override
|
||||
public boolean checkCategory(int pid){
|
||||
if(pid == 0) return true;
|
||||
if(pid == 0) {
|
||||
return true;
|
||||
}
|
||||
YxStoreCategory yxStoreCategory = this.getOne(Wrappers.<YxStoreCategory>lambdaQuery()
|
||||
.eq(YxStoreCategory::getId,pid));
|
||||
if(yxStoreCategory.getPid() > 0) return false;
|
||||
if(yxStoreCategory.getPid() > 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -174,11 +179,14 @@ public class YxStoreCategoryServiceImpl extends BaseServiceImpl<StoreCategoryMap
|
||||
* @param id 分类id
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean checkProductCategory(int id){
|
||||
YxStoreCategory yxStoreCategory = this.getOne(Wrappers.<YxStoreCategory>lambdaQuery()
|
||||
.eq(YxStoreCategory::getId,id));
|
||||
|
||||
if(yxStoreCategory.getPid() == 0) return false;
|
||||
if(yxStoreCategory.getPid() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -289,7 +289,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
.getUsableCouponList(uid, priceGroup.getTotalPrice().doubleValue(), productIds);
|
||||
|
||||
StoreCouponUserVo storeCouponUser = null;
|
||||
if(storeCouponUsers != null && !storeCouponUsers.isEmpty()) storeCouponUser = storeCouponUsers.get(0);
|
||||
if(storeCouponUsers != null && !storeCouponUsers.isEmpty()) {
|
||||
storeCouponUser = storeCouponUsers.get(0);
|
||||
}
|
||||
|
||||
return ConfirmOrderVo.builder()
|
||||
.addressInfo(userAddress)
|
||||
@ -365,7 +367,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
BigDecimal couponPrice = BigDecimal.ZERO;
|
||||
if(StrUtil.isNotBlank(couponId) && !ShopConstants.YSHOP_ZERO.equals(couponId)){//使用优惠券
|
||||
YxStoreCouponUser couponUser = couponUserService.getCoupon(Integer.valueOf(couponId),uid);
|
||||
if(couponUser == null) throw new YshopException("使用优惠劵失败");
|
||||
if(couponUser == null) {
|
||||
throw new YshopException("使用优惠劵失败");
|
||||
}
|
||||
|
||||
if(couponUser.getUseMinPrice().compareTo(payPrice) > 0){
|
||||
throw new YshopException("不满足优惠劵的使用条件");
|
||||
@ -401,7 +405,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
}
|
||||
}
|
||||
|
||||
if(payPrice.compareTo(BigDecimal.ZERO) <= 0) payPrice = BigDecimal.ZERO;
|
||||
if(payPrice.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
payPrice = BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
return ComputeVo.builder()
|
||||
.totalPrice(cacheDTO.getPriceGroup().getTotalPrice())
|
||||
@ -434,9 +440,13 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
//处理选择门店与正常选择地址下单
|
||||
YxUserAddress userAddress = null;
|
||||
if(OrderInfoEnum.SHIPPIING_TYPE_1.getValue().equals(Integer.valueOf(param.getShippingType()))){
|
||||
if(StrUtil.isEmpty(param.getAddressId())) throw new YshopException("请选择收货地址");
|
||||
if(StrUtil.isEmpty(param.getAddressId())) {
|
||||
throw new YshopException("请选择收货地址");
|
||||
}
|
||||
userAddress = userAddressService.getById(param.getAddressId());
|
||||
if(ObjectUtil.isNull(userAddress)) throw new YshopException("地址选择有误");
|
||||
if(ObjectUtil.isNull(userAddress)) {
|
||||
throw new YshopException("地址选择有误");
|
||||
}
|
||||
}else{ //门店
|
||||
if(StrUtil.isBlank(param.getRealName()) || StrUtil.isBlank(param.getPhone())) {
|
||||
throw new YshopException("请填写姓名和电话");
|
||||
@ -517,13 +527,17 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
//处理门店
|
||||
if(OrderInfoEnum.SHIPPIING_TYPE_2.getValue().toString().equals(param.getShippingType())){
|
||||
YxSystemStore systemStoreQueryVo = systemStoreService.getById(param.getStoreId());
|
||||
if(systemStoreQueryVo == null ) throw new ErrorRequestException("暂无门店无法选择门店自提");
|
||||
if(systemStoreQueryVo == null ) {
|
||||
throw new ErrorRequestException("暂无门店无法选择门店自提");
|
||||
}
|
||||
storeOrder.setVerifyCode(StrUtil.sub(orderSn,orderSn.length(),-12));
|
||||
storeOrder.setStoreId(systemStoreQueryVo.getId());
|
||||
}
|
||||
|
||||
boolean res = this.save(storeOrder);
|
||||
if(!res) throw new YshopException("订单生成失败");
|
||||
if(!res) {
|
||||
throw new YshopException("订单生成失败");
|
||||
}
|
||||
|
||||
//使用了积分扣积分
|
||||
if(computeVo.getUsedIntegral() > 0){
|
||||
@ -588,12 +602,16 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
.getOne(Wrappers.<YxStoreOrderCartInfo>lambdaQuery()
|
||||
.eq(YxStoreOrderCartInfo::getUnique,unique));
|
||||
|
||||
if(ObjectUtil.isEmpty(orderCartInfo)) throw new YshopException("评价产品不存在");
|
||||
if(ObjectUtil.isEmpty(orderCartInfo)) {
|
||||
throw new YshopException("评价产品不存在");
|
||||
}
|
||||
|
||||
int count = productReplyService.count(Wrappers.<YxStoreProductReply>lambdaQuery()
|
||||
.eq(YxStoreProductReply::getOid,orderCartInfo.getOid())
|
||||
.eq(YxStoreProductReply::getProductId,orderCartInfo.getProductId()));
|
||||
if(count > 0) throw new YshopException("该产品已评价");
|
||||
if(count > 0) {
|
||||
throw new YshopException("该产品已评价");
|
||||
}
|
||||
|
||||
|
||||
YxStoreProductReply storeProductReply = YxStoreProductReply.builder()
|
||||
@ -634,16 +652,22 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
public void orderRefund(String orderId,BigDecimal price,Integer type) {
|
||||
|
||||
YxStoreOrderQueryVo orderQueryVo = getOrderInfo(orderId,null);
|
||||
if(ObjectUtil.isNull(orderQueryVo)) throw new YshopException("订单不存在");
|
||||
if(ObjectUtil.isNull(orderQueryVo)) {
|
||||
throw new YshopException("订单不存在");
|
||||
}
|
||||
|
||||
YxUserQueryVo userQueryVo = userService.getYxUserById(orderQueryVo.getUid());
|
||||
if(ObjectUtil.isNull(userQueryVo)) throw new YshopException("用户不存在");
|
||||
if(ObjectUtil.isNull(userQueryVo)) {
|
||||
throw new YshopException("用户不存在");
|
||||
}
|
||||
|
||||
if(OrderInfoEnum.REFUND_STATUS_2.getValue().equals(orderQueryVo.getRefundStatus())){
|
||||
throw new YshopException("订单已经退款了哦!");
|
||||
}
|
||||
|
||||
if(orderQueryVo.getPayPrice().compareTo(price) < 0) throw new YshopException("退款金额不正确");
|
||||
if(orderQueryVo.getPayPrice().compareTo(price) < 0) {
|
||||
throw new YshopException("退款金额不正确");
|
||||
}
|
||||
|
||||
YxStoreOrder storeOrder = new YxStoreOrder();
|
||||
//修改状态
|
||||
@ -697,7 +721,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
@Override
|
||||
public void orderDelivery(String orderId,String deliveryId,String deliveryName,String deliveryType) {
|
||||
YxStoreOrderQueryVo orderQueryVo = this.getOrderInfo(orderId,null);
|
||||
if(ObjectUtil.isNull(orderQueryVo)) throw new YshopException("订单不存在");
|
||||
if(ObjectUtil.isNull(orderQueryVo)) {
|
||||
throw new YshopException("订单不存在");
|
||||
}
|
||||
|
||||
if(!OrderInfoEnum.STATUS_0.getValue().equals(orderQueryVo.getStatus()) ||
|
||||
OrderInfoEnum.PAY_STATUS_0.getValue().equals( orderQueryVo.getPaid())){
|
||||
@ -705,7 +731,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
}
|
||||
|
||||
YxExpress expressQueryVo = expressService.getById(Integer.valueOf(deliveryName));
|
||||
if(ObjectUtil.isNull(expressQueryVo)) throw new YshopException("请后台先添加快递公司");
|
||||
if(ObjectUtil.isNull(expressQueryVo)) {
|
||||
throw new YshopException("请后台先添加快递公司");
|
||||
}
|
||||
|
||||
//判断拼团产品
|
||||
if(orderQueryVo.getPinkId() != null && orderQueryVo.getPinkId() >0 ){
|
||||
@ -759,10 +787,14 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
@Override
|
||||
public void editOrderPrice(String orderId,String price) {
|
||||
YxStoreOrderQueryVo orderQueryVo = getOrderInfo(orderId,null);
|
||||
if(ObjectUtil.isNull(orderQueryVo)) throw new YshopException("订单不存在");
|
||||
if(ObjectUtil.isNull(orderQueryVo)) {
|
||||
throw new YshopException("订单不存在");
|
||||
}
|
||||
|
||||
|
||||
if(orderQueryVo.getPayPrice().compareTo(new BigDecimal(price)) == 0) return;
|
||||
if(orderQueryVo.getPayPrice().compareTo(new BigDecimal(price)) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(OrderInfoEnum.PAY_STATUS_1.getValue().equals(orderQueryVo.getPaid())) {
|
||||
@ -811,7 +843,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
@Override
|
||||
public void cancelOrder(String orderId, Long uid) {
|
||||
YxStoreOrderQueryVo order = this.getOrderInfo(orderId,uid);
|
||||
if(ObjectUtil.isNull(order)) throw new YshopException("订单不存在");
|
||||
if(ObjectUtil.isNull(order)) {
|
||||
throw new YshopException("订单不存在");
|
||||
}
|
||||
|
||||
this.regressionIntegral(order);
|
||||
|
||||
@ -834,7 +868,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
@Override
|
||||
public void removeOrder(String orderId, Long uid) {
|
||||
YxStoreOrderQueryVo order = getOrderInfo(orderId,(long)uid);
|
||||
if(order == null) throw new YshopException("订单不存在");
|
||||
if(order == null) {
|
||||
throw new YshopException("订单不存在");
|
||||
}
|
||||
order = handleOrder(order);
|
||||
if(!OrderInfoEnum.STATUS_3.getValue().equals(order.getStatus())) {
|
||||
throw new YshopException("该订单无法删除");
|
||||
@ -857,7 +893,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
@Override
|
||||
public void takeOrder(String orderId, Long uid) {
|
||||
YxStoreOrderQueryVo order = this.getOrderInfo(orderId,uid);
|
||||
if(ObjectUtil.isNull(order)) throw new YshopException("订单不存在");
|
||||
if(ObjectUtil.isNull(order)) {
|
||||
throw new YshopException("订单不存在");
|
||||
}
|
||||
order = handleOrder(order);
|
||||
if(!OrderStatusEnum.STATUS_2.getValue().toString().equals(order.get_status().get_type())) {
|
||||
throw new BusinessException("订单状态错误");
|
||||
@ -896,14 +934,20 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
.eq(YxStoreOrder::getVerifyCode,verifyCode)
|
||||
.eq(YxStoreOrder::getPaid,OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||
.eq(YxStoreOrder::getRefundStatus,OrderInfoEnum.REFUND_STATUS_0.getValue()));
|
||||
if(order == null) throw new YshopException("核销的订单不存在或未支付或已退款");
|
||||
if(order == null) {
|
||||
throw new YshopException("核销的订单不存在或未支付或已退款");
|
||||
}
|
||||
|
||||
if(uid != null){
|
||||
boolean checkStatus = systemStoreStaffService.checkStatus(uid,order.getStoreId());
|
||||
if(!checkStatus) throw new YshopException("您没有当前店铺核销权限");
|
||||
if(!checkStatus) {
|
||||
throw new YshopException("您没有当前店铺核销权限");
|
||||
}
|
||||
}
|
||||
|
||||
if(!OrderInfoEnum.STATUS_0.getValue().equals(order.getStatus())) throw new YshopException("订单已经核销");
|
||||
if(!OrderInfoEnum.STATUS_0.getValue().equals(order.getStatus())) {
|
||||
throw new YshopException("订单已经核销");
|
||||
}
|
||||
|
||||
if(order.getCombinationId() != null && order.getCombinationId() > 0
|
||||
&& order.getPinkId() != null && order.getPinkId() > 0){
|
||||
@ -950,7 +994,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
@Override
|
||||
public void orderApplyRefund(String explain,String Img,String text,String orderId, Long uid) {
|
||||
YxStoreOrderQueryVo order = getOrderInfo(orderId,uid);
|
||||
if(order == null) throw new YshopException("订单不存在");
|
||||
if(order == null) {
|
||||
throw new YshopException("订单不存在");
|
||||
}
|
||||
|
||||
if(OrderInfoEnum.REFUND_STATUS_2.getValue().equals(order.getRefundStatus())){
|
||||
throw new YshopException("订单已退款");
|
||||
@ -958,7 +1004,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
if(OrderInfoEnum.REFUND_STATUS_1.getValue().equals(order.getRefundStatus())) {
|
||||
throw new YshopException("正在申请退款中");
|
||||
}
|
||||
if(OrderInfoEnum.STATUS_1.getValue().equals(order.getStatus())) throw new YshopException("订单当前无法退款");
|
||||
if(OrderInfoEnum.STATUS_1.getValue().equals(order.getStatus())) {
|
||||
throw new YshopException("订单当前无法退款");
|
||||
}
|
||||
|
||||
|
||||
YxStoreOrder storeOrder = new YxStoreOrder();
|
||||
@ -1174,7 +1222,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
|
||||
//订单支付没有退款 数量
|
||||
QueryWrapper<YxStoreOrder> wrapperOne = new QueryWrapper<>();
|
||||
if(uid != null) wrapperOne.lambda().eq(YxStoreOrder::getUid,uid);
|
||||
if(uid != null) {
|
||||
wrapperOne.lambda().eq(YxStoreOrder::getUid,uid);
|
||||
}
|
||||
wrapperOne.lambda().eq(YxStoreOrder::getRefundStatus,OrderInfoEnum.REFUND_STATUS_0.getValue())
|
||||
.eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue());
|
||||
Integer orderCount = yxStoreOrderMapper.selectCount(wrapperOne);
|
||||
@ -1184,7 +1234,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
|
||||
//订单待支付 数量
|
||||
QueryWrapper<YxStoreOrder> wrapperTwo = new QueryWrapper<>();
|
||||
if(uid != null) wrapperTwo.lambda().eq(YxStoreOrder::getUid,uid);
|
||||
if(uid != null) {
|
||||
wrapperTwo.lambda().eq(YxStoreOrder::getUid,uid);
|
||||
}
|
||||
wrapperTwo.lambda().eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_0.getValue())
|
||||
.eq(YxStoreOrder::getRefundStatus,OrderInfoEnum.REFUND_STATUS_0.getValue())
|
||||
.eq(YxStoreOrder::getStatus,OrderInfoEnum.STATUS_0.getValue());
|
||||
@ -1192,7 +1244,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
|
||||
//订单待发货 数量
|
||||
QueryWrapper<YxStoreOrder> wrapperThree = new QueryWrapper<>();
|
||||
if(uid != null) wrapperThree.lambda().eq(YxStoreOrder::getUid,uid);
|
||||
if(uid != null) {
|
||||
wrapperThree.lambda().eq(YxStoreOrder::getUid,uid);
|
||||
}
|
||||
wrapperThree.lambda().eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||
.eq(YxStoreOrder::getRefundStatus,OrderInfoEnum.REFUND_STATUS_0.getValue())
|
||||
.eq(YxStoreOrder::getStatus,OrderInfoEnum.STATUS_0.getValue());
|
||||
@ -1200,7 +1254,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
|
||||
//订单待收货 数量
|
||||
QueryWrapper<YxStoreOrder> wrapperFour = new QueryWrapper<>();
|
||||
if(uid != null) wrapperFour.lambda().eq(YxStoreOrder::getUid,uid);
|
||||
if(uid != null) {
|
||||
wrapperFour.lambda().eq(YxStoreOrder::getUid,uid);
|
||||
}
|
||||
wrapperFour.lambda().eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||
.eq(YxStoreOrder::getRefundStatus,OrderInfoEnum.REFUND_STATUS_0.getValue())
|
||||
.eq(YxStoreOrder::getStatus,OrderInfoEnum.STATUS_1.getValue());
|
||||
@ -1208,7 +1264,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
|
||||
//订单待评价 数量
|
||||
QueryWrapper<YxStoreOrder> wrapperFive = new QueryWrapper<>();
|
||||
if(uid != null) wrapperFive.lambda().eq(YxStoreOrder::getUid,uid);
|
||||
if(uid != null) {
|
||||
wrapperFive.lambda().eq(YxStoreOrder::getUid,uid);
|
||||
}
|
||||
wrapperFive.lambda().eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||
.eq(YxStoreOrder::getRefundStatus,OrderInfoEnum.REFUND_STATUS_0.getValue())
|
||||
.eq(YxStoreOrder::getStatus,OrderInfoEnum.STATUS_2.getValue());
|
||||
@ -1216,7 +1274,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
|
||||
//订单已完成 数量
|
||||
QueryWrapper<YxStoreOrder> wrapperSix= new QueryWrapper<>();
|
||||
if(uid != null) wrapperSix.lambda().eq(YxStoreOrder::getUid,uid);
|
||||
if(uid != null) {
|
||||
wrapperSix.lambda().eq(YxStoreOrder::getUid,uid);
|
||||
}
|
||||
wrapperSix.lambda().eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||
.eq(YxStoreOrder::getRefundStatus,OrderInfoEnum.REFUND_STATUS_0.getValue())
|
||||
.eq(YxStoreOrder::getStatus,OrderInfoEnum.STATUS_3.getValue());
|
||||
@ -1224,7 +1284,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
|
||||
//订单退款
|
||||
QueryWrapper<YxStoreOrder> wrapperSeven= new QueryWrapper<>();
|
||||
if(uid != null) wrapperSeven.lambda().eq(YxStoreOrder::getUid,uid);
|
||||
if(uid != null) {
|
||||
wrapperSeven.lambda().eq(YxStoreOrder::getUid,uid);
|
||||
}
|
||||
String[] strArr = {"1","2"};
|
||||
wrapperSeven.lambda().eq(YxStoreOrder::getPaid, OrderInfoEnum.PAY_STATUS_1.getValue())
|
||||
.in(YxStoreOrder::getRefundStatus,Arrays.asList(strArr));
|
||||
@ -1364,7 +1426,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
orderStatusService.create(orderInfo.getId(),OrderLogEnum.PAY_ORDER_SUCCESS.getValue(),
|
||||
OrderLogEnum.PAY_ORDER_SUCCESS.getDesc());
|
||||
//拼团
|
||||
if(orderInfo.getCombinationId() > 0) pinkService.createPink(orderInfo);
|
||||
if(orderInfo.getCombinationId() > 0) {
|
||||
pinkService.createPink(orderInfo);
|
||||
}
|
||||
|
||||
//砍价
|
||||
if(orderInfo.getBargainId() > 0) {
|
||||
@ -1374,7 +1438,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
YxUser userInfo = userService.getById(orderInfo.getUid());
|
||||
//增加流水
|
||||
String payTypeMsg = PayTypeEnum.WEIXIN.getDesc();
|
||||
if(PayTypeEnum.YUE.getValue().equals(payType)) payTypeMsg = PayTypeEnum.YUE.getDesc();
|
||||
if(PayTypeEnum.YUE.getValue().equals(payType)) {
|
||||
payTypeMsg = PayTypeEnum.YUE.getDesc();
|
||||
}
|
||||
billService.expend(userInfo.getUid(), "购买商品",
|
||||
BillDetailEnum.CATEGORY_1.getValue(),
|
||||
BillDetailEnum.TYPE_3.getValue(),
|
||||
@ -1403,12 +1469,20 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
@Override
|
||||
public String aliPay(String orderId) throws Exception {
|
||||
AlipayConfig alipay = alipayService.find();
|
||||
if(ObjectUtil.isNull(alipay)) throw new YshopException("请先配置支付宝");
|
||||
if(ObjectUtil.isNull(alipay)) {
|
||||
throw new YshopException("请先配置支付宝");
|
||||
}
|
||||
YxStoreOrderQueryVo orderInfo = getOrderInfo(orderId,null);
|
||||
if(ObjectUtil.isNull(orderInfo)) throw new YshopException("订单不存在");
|
||||
if(OrderInfoEnum.PAY_STATUS_1.getValue().equals(orderInfo.getPaid())) throw new YshopException("该订单已支付");
|
||||
if(ObjectUtil.isNull(orderInfo)) {
|
||||
throw new YshopException("订单不存在");
|
||||
}
|
||||
if(OrderInfoEnum.PAY_STATUS_1.getValue().equals(orderInfo.getPaid())) {
|
||||
throw new YshopException("该订单已支付");
|
||||
}
|
||||
|
||||
if(orderInfo.getPayPrice().compareTo(BigDecimal.ZERO) <= 0) throw new YshopException("该支付无需支付");
|
||||
if(orderInfo.getPayPrice().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
throw new YshopException("该支付无需支付");
|
||||
}
|
||||
TradeVo trade = new TradeVo();
|
||||
trade.setOutTradeNo(orderId);
|
||||
String payUrl = alipayService.toPayAsWeb(alipay,trade);
|
||||
@ -1427,9 +1501,13 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
@Override
|
||||
public void yuePay(String orderId, Long uid) {
|
||||
YxStoreOrderQueryVo orderInfo = getOrderInfo(orderId,uid);
|
||||
if(ObjectUtil.isNull(orderInfo)) throw new YshopException("订单不存在");
|
||||
if(ObjectUtil.isNull(orderInfo)) {
|
||||
throw new YshopException("订单不存在");
|
||||
}
|
||||
|
||||
if(OrderInfoEnum.PAY_STATUS_1.getValue().equals(orderInfo.getPaid())) throw new YshopException("该订单已支付");
|
||||
if(OrderInfoEnum.PAY_STATUS_1.getValue().equals(orderInfo.getPaid())) {
|
||||
throw new YshopException("该订单已支付");
|
||||
}
|
||||
|
||||
YxUserQueryVo userInfo = userService.getYxUserById(uid);
|
||||
|
||||
@ -1459,7 +1537,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
wrapper.lambda().and(
|
||||
i->i.eq(YxStoreOrder::getOrderId,unique).or().eq(YxStoreOrder::getUnique,unique).or()
|
||||
.eq(YxStoreOrder::getExtendOrderId,unique));
|
||||
if(uid != null) wrapper.lambda().eq(YxStoreOrder::getUid,uid);
|
||||
if(uid != null) {
|
||||
wrapper.lambda().eq(YxStoreOrder::getUid,uid);
|
||||
}
|
||||
|
||||
return generator.convert(yxStoreOrderMapper.selectOne(wrapper),YxStoreOrderQueryVo.class);
|
||||
}
|
||||
@ -1506,7 +1586,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
storeBargainService.decStockIncSales(storeCartVO.getCartNum(),bargainId);
|
||||
} else {
|
||||
productService.decProductStock(storeCartVO.getCartNum(),storeCartVO.getProductId(),
|
||||
storeCartVO.getProductAttrUnique(),0l,"");
|
||||
storeCartVO.getProductAttrUnique(), 0L,"");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1533,7 +1613,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
private BigDecimal getGainIntegral(List<YxStoreCartQueryVo> cartInfo){
|
||||
BigDecimal gainIntegral = BigDecimal.ZERO;
|
||||
for (YxStoreCartQueryVo cart : cartInfo) {
|
||||
if(cart.getCombinationId() >0 || cart.getSeckillId() > 0 || cart.getBargainId() > 0) continue;
|
||||
if(cart.getCombinationId() >0 || cart.getSeckillId() > 0 || cart.getBargainId() > 0) {
|
||||
continue;
|
||||
}
|
||||
BigDecimal cartInfoGainIntegral = BigDecimal.ZERO;
|
||||
Double gain = cart.getProductInfo().getGiveIntegral().doubleValue();
|
||||
if(gain > 0){
|
||||
@ -1614,7 +1696,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
return;
|
||||
}
|
||||
|
||||
if(order.getUseIntegral().compareTo(BigDecimal.ZERO) <= 0) return;
|
||||
if(order.getUseIntegral().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!OrderStatusEnum.STATUS_MINUS_2.getValue().equals(order.getStatus())
|
||||
&& !OrderInfoEnum.REFUND_STATUS_2.getValue().equals(order.getRefundStatus())
|
||||
@ -1651,7 +1735,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
*/
|
||||
private CacheDto getCacheOrderInfo(Long uid, String key) {
|
||||
Object obj = redisUtils.get(ShopConstants.YSHOP_ORDER_CACHE_KEY + uid + key);
|
||||
if(obj == null) return null;
|
||||
if(obj == null) {
|
||||
return null;
|
||||
}
|
||||
return JSON.parseObject(obj.toString(), CacheDto.class);
|
||||
}
|
||||
|
||||
@ -1733,7 +1819,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
private BigDecimal handlePostage(List<YxStoreCartQueryVo> cartInfo,YxUserAddress userAddress){
|
||||
BigDecimal storePostage = BigDecimal.ZERO;
|
||||
if(userAddress != null){
|
||||
if(userAddress.getCityId() == null) return storePostage;
|
||||
if(userAddress.getCityId() == null) {
|
||||
return storePostage;
|
||||
}
|
||||
//城市包括默认
|
||||
int cityId = userAddress.getCityId();
|
||||
List<Integer> citys = new ArrayList<>();
|
||||
@ -1782,7 +1870,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
Integer tempId = storeCartVO.getProductInfo().getTempId();
|
||||
|
||||
//处理拼团等营销商品没有设置运费模板
|
||||
if(tempId == null) return storePostage;
|
||||
if(tempId == null) {
|
||||
return storePostage;
|
||||
}
|
||||
|
||||
//根据模板类型获取相应的数量
|
||||
double num = 0d;
|
||||
@ -1832,7 +1922,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
.le(YxShippingTemplatesFree::getNumber,mapValue.getNumber())
|
||||
.le(YxShippingTemplatesFree::getPrice,mapValue.getPrice()));
|
||||
//满足包邮条件剔除
|
||||
if(count > 0) templateDTOMap.remove(mapKey);
|
||||
if(count > 0) {
|
||||
templateDTOMap.remove(mapKey);
|
||||
}
|
||||
}
|
||||
|
||||
//处理区域邮费
|
||||
@ -1892,16 +1984,16 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
private BigDecimal getOrderSumPrice(List<YxStoreCartQueryVo> cartInfo, String key) {
|
||||
BigDecimal sumPrice = BigDecimal.ZERO;
|
||||
|
||||
if(key.equals("truePrice")){
|
||||
if("truePrice".equals(key)){
|
||||
for (YxStoreCartQueryVo storeCart : cartInfo) {
|
||||
sumPrice = NumberUtil.add(sumPrice,NumberUtil.mul(storeCart.getCartNum(),storeCart.getTruePrice()));
|
||||
}
|
||||
}else if(key.equals("costPrice")){
|
||||
}else if("costPrice".equals(key)){
|
||||
for (YxStoreCartQueryVo storeCart : cartInfo) {
|
||||
sumPrice = NumberUtil.add(sumPrice,
|
||||
NumberUtil.mul(storeCart.getCartNum(),storeCart.getCostPrice()));
|
||||
}
|
||||
}else if(key.equals("vipTruePrice")){
|
||||
}else if("vipTruePrice".equals(key)){
|
||||
for (YxStoreCartQueryVo storeCart : cartInfo) {
|
||||
sumPrice = NumberUtil.add(sumPrice,
|
||||
NumberUtil.mul(storeCart.getCartNum(),storeCart.getVipTruePrice()));
|
||||
@ -2195,7 +2287,9 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
||||
str = "[砍价订单]";
|
||||
}
|
||||
|
||||
if(OrderInfoEnum.SHIPPIING_TYPE_2.getValue().equals(shippingType)) str = "[核销订单]";
|
||||
if(OrderInfoEnum.SHIPPIING_TYPE_2.getValue().equals(shippingType)) {
|
||||
str = "[核销订单]";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,9 @@ public class YxStoreProductAttrServiceImpl extends BaseServiceImpl<StoreProductA
|
||||
* @param productId 商品id
|
||||
*/
|
||||
private void clearProductAttr(Long productId) {
|
||||
if(ObjectUtil.isNull(productId)) throw new YshopException("产品不存在");
|
||||
if(ObjectUtil.isNull(productId)) {
|
||||
throw new YshopException("产品不存在");
|
||||
}
|
||||
|
||||
yxStoreProductAttrMapper.delete(Wrappers.<YxStoreProductAttr>lambdaQuery()
|
||||
.eq(YxStoreProductAttr::getProductId,productId));
|
||||
@ -180,7 +182,9 @@ public class YxStoreProductAttrServiceImpl extends BaseServiceImpl<StoreProductA
|
||||
}else {
|
||||
res = yxStoreProductAttrValueMapper.decStockIncSales(num,productId,unique);
|
||||
}
|
||||
if(res == 0) throw new YshopException("商品库存不足");
|
||||
if(res == 0) {
|
||||
throw new YshopException("商品库存不足");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -62,7 +62,9 @@ public class YxStoreProductRelationServiceImpl extends BaseServiceImpl<YxStorePr
|
||||
*/
|
||||
@Override
|
||||
public void addRroductRelation(long productId,long uid) {
|
||||
if(isProductRelation(productId,uid)) throw new YshopException("已收藏");
|
||||
if(isProductRelation(productId,uid)) {
|
||||
throw new YshopException("已收藏");
|
||||
}
|
||||
YxStoreProductRelation storeProductRelation = YxStoreProductRelation.builder()
|
||||
.productId(productId)
|
||||
.uid(uid)
|
||||
@ -81,7 +83,9 @@ public class YxStoreProductRelationServiceImpl extends BaseServiceImpl<YxStorePr
|
||||
.eq(YxStoreProductRelation::getProductId,productId)
|
||||
.eq(YxStoreProductRelation::getUid,uid)
|
||||
.one();
|
||||
if(productRelation == null) throw new YshopException("已取消");
|
||||
if(productRelation == null) {
|
||||
throw new YshopException("已取消");
|
||||
}
|
||||
|
||||
|
||||
this.removeById(productRelation.getId());
|
||||
@ -100,7 +104,9 @@ public class YxStoreProductRelationServiceImpl extends BaseServiceImpl<YxStorePr
|
||||
.selectCount(Wrappers.<YxStoreProductRelation>lambdaQuery()
|
||||
.eq(YxStoreProductRelation::getUid,uid)
|
||||
.eq(YxStoreProductRelation::getProductId,productId));
|
||||
if(count > 0) return true;
|
||||
if(count > 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -151,7 +151,9 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
res = storeProductMapper.decStockIncSales(num,productId);
|
||||
}
|
||||
|
||||
if(res == 0) throw new YshopException("商品库存不足");
|
||||
if(res == 0) {
|
||||
throw new YshopException("商品库存不足");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -193,7 +195,9 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
.eq(YxStoreProductAttrValue::getUnique, unique)
|
||||
.eq(YxStoreProductAttrValue::getProductId, productId));
|
||||
|
||||
if (storeProductAttrValue == null) return 0;
|
||||
if (storeProductAttrValue == null) {
|
||||
return 0;
|
||||
}
|
||||
if("pink".equals(type)){
|
||||
return storeProductAttrValue.getPinkStock();
|
||||
}else if ("seckill".equals(type)){
|
||||
@ -482,7 +486,9 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
//添加商品
|
||||
YxStoreProduct yxStoreProduct = new YxStoreProduct();
|
||||
BeanUtil.copyProperties(storeProductDto,yxStoreProduct,"sliderImage");
|
||||
if(storeProductDto.getSliderImage().isEmpty()) throw new YshopException("请上传轮播图");
|
||||
if(storeProductDto.getSliderImage().isEmpty()) {
|
||||
throw new YshopException("请上传轮播图");
|
||||
}
|
||||
|
||||
yxStoreProduct.setPrice(BigDecimal.valueOf(resultDTO.getMinPrice()));
|
||||
yxStoreProduct.setOtPrice(BigDecimal.valueOf(resultDTO.getMinOtPrice()));
|
||||
@ -683,7 +689,9 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
.reduce(Integer::sum)
|
||||
.orElse(0);
|
||||
|
||||
if(stock <= 0) throw new YshopException("库存不能低于0");
|
||||
if(stock <= 0) {
|
||||
throw new YshopException("库存不能低于0");
|
||||
}
|
||||
|
||||
return ProductResultDto.builder()
|
||||
.minPrice(minPrice)
|
||||
@ -807,14 +815,20 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
fromatDetailDTOList.stream()
|
||||
.map(FromatDetailDto::getDetail)
|
||||
.forEach(i -> {
|
||||
if(i == null || i.isEmpty()) throw new YshopException("请至少添加一个规格值哦");
|
||||
if(i == null || i.isEmpty()) {
|
||||
throw new YshopException("请至少添加一个规格值哦");
|
||||
}
|
||||
String str = ArrayUtil.join(i.toArray(),",");
|
||||
if(str.contains("-")) throw new YshopException("规格值里包含'-',请重新添加");
|
||||
if(str.contains("-")) {
|
||||
throw new YshopException("规格值里包含'-',请重新添加");
|
||||
}
|
||||
});
|
||||
|
||||
if(fromatDetailDTOList.size() > 1){
|
||||
for (int i=0; i < fromatDetailDTOList.size() - 1;i++){
|
||||
if(i == 0) data = fromatDetailDTOList.get(i).getDetail();
|
||||
if(i == 0) {
|
||||
data = fromatDetailDTOList.get(i).getDetail();
|
||||
}
|
||||
List<String> tmp = new LinkedList<>();
|
||||
for (String v : data) {
|
||||
for (String g : fromatDetailDTOList.get(i+1).getDetail()) {
|
||||
|
@ -55,12 +55,16 @@ public class YxSystemConfigServiceImpl extends BaseServiceImpl<SystemConfigMappe
|
||||
@Override
|
||||
public String getData(String name) {
|
||||
String result = redisUtils.getY(name);
|
||||
if(StrUtil.isNotBlank(result)) return result;
|
||||
if(StrUtil.isNotBlank(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
QueryWrapper<YxSystemConfig> wrapper = new QueryWrapper<>();
|
||||
wrapper.lambda().eq(YxSystemConfig::getMenuName,name);
|
||||
YxSystemConfig systemConfig = this.baseMapper.selectOne(wrapper);
|
||||
if(systemConfig == null) return "";
|
||||
if(systemConfig == null) {
|
||||
return "";
|
||||
}
|
||||
return systemConfig.getValue();
|
||||
}
|
||||
|
||||
|
@ -94,9 +94,13 @@ public class YxSystemStoreServiceImpl extends BaseServiceImpl<SystemStoreMapper,
|
||||
.eq(YxSystemStore::getIsShow, ShopCommonEnum.SHOW_1.getValue())
|
||||
.orderByDesc(YxSystemStore::getId)
|
||||
.last("limit 1"));
|
||||
if(yxSystemStore == null) return null;
|
||||
if(yxSystemStore == null) {
|
||||
return null;
|
||||
}
|
||||
String mention = RedisUtil.get(ShopKeyUtils.getStoreSelfMention());
|
||||
if(StrUtil.isBlank(mention) || ShopCommonEnum.ENABLE_2.getValue().toString().equals(mention)) return null;
|
||||
if(StrUtil.isBlank(mention) || ShopCommonEnum.ENABLE_2.getValue().toString().equals(mention)) {
|
||||
return null;
|
||||
}
|
||||
YxSystemStoreQueryVo systemStoreQueryVo = generator.convert(yxSystemStore,YxSystemStoreQueryVo.class);
|
||||
if(StrUtil.isNotEmpty(latitude) && StrUtil.isNotEmpty(longitude)){
|
||||
double distance = LocationUtils.getDistance(Double.valueOf(latitude),Double.valueOf(longitude),
|
||||
|
@ -58,7 +58,9 @@ public class YxSystemStoreStaffServiceImpl extends BaseServiceImpl<SystemStoreSt
|
||||
YxSystemStoreStaff storeStaff = new YxSystemStoreStaff();
|
||||
storeStaff.setUid(uid);
|
||||
storeStaff.setVerifyStatus(ShopCommonEnum.IS_STATUS_1.getValue());
|
||||
if(storeId != null) storeStaff.setStoreId(storeId);
|
||||
if(storeId != null) {
|
||||
storeStaff.setStoreId(storeId);
|
||||
}
|
||||
return this.baseMapper.selectCount(Wrappers.query(storeStaff)) > 0;
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,9 @@ public class YxShippingTemplatesServiceImpl extends BaseServiceImpl<YxShippingTe
|
||||
}
|
||||
|
||||
|
||||
if(shippingTemplatesFrees.isEmpty()) throw new YshopException("请添加包邮区域");
|
||||
if(shippingTemplatesFrees.isEmpty()) {
|
||||
throw new YshopException("请添加包邮区域");
|
||||
}
|
||||
|
||||
yxShippingTemplatesFreeService.saveBatch(shippingTemplatesFrees);
|
||||
|
||||
@ -243,7 +245,9 @@ public class YxShippingTemplatesServiceImpl extends BaseServiceImpl<YxShippingTe
|
||||
}
|
||||
}
|
||||
|
||||
if(shippingTemplatesRegions.isEmpty()) throw new BusinessException("请添加区域");
|
||||
if(shippingTemplatesRegions.isEmpty()) {
|
||||
throw new BusinessException("请添加区域");
|
||||
}
|
||||
|
||||
yxShippingTemplatesRegionService.saveBatch(shippingTemplatesRegions);
|
||||
|
||||
|
@ -74,7 +74,9 @@ public class YxSystemUserLevelServiceImpl extends BaseServiceImpl<SystemUserLeve
|
||||
|
||||
int grade = 0;
|
||||
for (YxSystemUserLevel userLevel : list) {
|
||||
if(userLevel.getId() == levelId) grade = userLevel.getGrade();
|
||||
if(userLevel.getId() == levelId) {
|
||||
grade = userLevel.getGrade();
|
||||
}
|
||||
}
|
||||
|
||||
YxSystemUserLevel userLevel = this.lambdaQuery()
|
||||
@ -83,7 +85,9 @@ public class YxSystemUserLevelServiceImpl extends BaseServiceImpl<SystemUserLeve
|
||||
.gt(YxSystemUserLevel::getGrade,grade)
|
||||
.last("limit 1")
|
||||
.one();
|
||||
if(ObjectUtil.isNull(userLevel)) return 0;
|
||||
if(ObjectUtil.isNull(userLevel)) {
|
||||
return 0;
|
||||
}
|
||||
return userLevel.getId();
|
||||
}
|
||||
|
||||
@ -113,7 +117,9 @@ public class YxSystemUserLevelServiceImpl extends BaseServiceImpl<SystemUserLeve
|
||||
|
||||
//会员等级列表
|
||||
List<YxSystemUserLevelQueryVo> list = this.getLevelListAndGrade(levelId);
|
||||
if(list.isEmpty()) throw new YshopException("请后台设置会员等级");
|
||||
if(list.isEmpty()) {
|
||||
throw new YshopException("请后台设置会员等级");
|
||||
}
|
||||
|
||||
//任务列表
|
||||
TaskDto taskDTO = systemUserTaskService.getTaskList(list.get(0).getId(),uid);
|
||||
@ -138,7 +144,9 @@ public class YxSystemUserLevelServiceImpl extends BaseServiceImpl<SystemUserLeve
|
||||
.list();
|
||||
List<YxSystemUserLevelQueryVo> newList = generator.convert(list,YxSystemUserLevelQueryVo.class);
|
||||
for (YxSystemUserLevelQueryVo userLevelQueryVo : newList) {
|
||||
if(userLevelQueryVo.getId().compareTo(levelId) == 0) grade = userLevelQueryVo.getGrade();
|
||||
if(userLevelQueryVo.getId().compareTo(levelId) == 0) {
|
||||
grade = userLevelQueryVo.getGrade();
|
||||
}
|
||||
if(grade.compareTo(userLevelQueryVo.getGrade()) < 0){
|
||||
userLevelQueryVo.setIsClear(true); //不解锁
|
||||
}else{
|
||||
|
@ -94,7 +94,9 @@ public class YxSystemUserTaskServiceImpl extends BaseServiceImpl<SystemUserTaskM
|
||||
.list();
|
||||
List<Integer> taskIds = list.stream().map(YxSystemUserTask::getId)
|
||||
.collect(Collectors.toList());
|
||||
if(taskIds.isEmpty()) return 0;
|
||||
if(taskIds.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int count = yxUserTaskFinishMapper.selectCount(Wrappers.<YxUserTaskFinish>lambdaQuery()
|
||||
.in(YxUserTaskFinish::getTaskId,taskIds)
|
||||
@ -192,7 +194,9 @@ public class YxSystemUserTaskServiceImpl extends BaseServiceImpl<SystemUserTaskM
|
||||
List<YxSystemUserTaskDto> systemUserTaskDTOS = generator.convert(page.getList(),YxSystemUserTaskDto.class);
|
||||
for (YxSystemUserTaskDto systemUserTaskDTO : systemUserTaskDTOS) {
|
||||
YxSystemUserLevel userLevel=systemUserLevelService.getById(systemUserTaskDTO.getLevelId());
|
||||
if(userLevel == null) continue;
|
||||
if(userLevel == null) {
|
||||
continue;
|
||||
}
|
||||
systemUserTaskDTO.setLevalName(userLevel.getName());
|
||||
}
|
||||
Map<String, Object> map = new LinkedHashMap<>(2);
|
||||
|
@ -72,7 +72,8 @@ public class YxUserAddressServiceImpl extends BaseServiceImpl<YxUserAddressMappe
|
||||
* @param uid uid
|
||||
* @param param AddressParam
|
||||
*/
|
||||
public Long addAndEdit(Long uid,AddressParam param){
|
||||
@Override
|
||||
public Long addAndEdit(Long uid, AddressParam param){
|
||||
YxUserAddress userAddress = YxUserAddress.builder()
|
||||
.city(param.getAddress().getCity())
|
||||
.cityId(param.getAddress().getCityId())
|
||||
|
@ -68,7 +68,9 @@ public class YxUserLevelServiceImpl extends BaseServiceImpl<YxUserLevelMapper, Y
|
||||
levelId = yxUserLevel.getLevelId();
|
||||
}
|
||||
int nextLevelId = systemUserLevelService.getNextLevelId(levelId);
|
||||
if(nextLevelId == 0) return false;
|
||||
if(nextLevelId == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int finishCount = systemUserTaskService.getTaskComplete(nextLevelId,uid);
|
||||
|
||||
@ -95,10 +97,16 @@ public class YxUserLevelServiceImpl extends BaseServiceImpl<YxUserLevelMapper, Y
|
||||
.eq(YxUserLevel::getStatus, ShopCommonEnum.IS_STATUS_1.getValue())
|
||||
.eq(YxUserLevel::getUid,uid)
|
||||
.orderByDesc(YxUserLevel::getGrade);
|
||||
if(grade != null) wrapper.lambda().lt(YxUserLevel::getGrade,grade);
|
||||
if(grade != null) {
|
||||
wrapper.lambda().lt(YxUserLevel::getGrade,grade);
|
||||
}
|
||||
YxUserLevel userLevel = this.getOne(wrapper,false);
|
||||
if(ObjectUtil.isNull(userLevel)) return null;
|
||||
if(ShopCommonEnum.IS_FOREVER_1.getValue().equals(userLevel.getIsForever())) return userLevel;
|
||||
if(ObjectUtil.isNull(userLevel)) {
|
||||
return null;
|
||||
}
|
||||
if(ShopCommonEnum.IS_FOREVER_1.getValue().equals(userLevel.getIsForever())) {
|
||||
return userLevel;
|
||||
}
|
||||
int nowTime = OrderUtil.getSecondTimestampTwo();
|
||||
if(nowTime > userLevel.getValidTime()){
|
||||
if(ShopCommonEnum.IS_STATUS_1.getValue().equals(userLevel.getStatus())){
|
||||
@ -119,7 +127,9 @@ public class YxUserLevelServiceImpl extends BaseServiceImpl<YxUserLevelMapper, Y
|
||||
private void setUserLevel(Long uid, int levelId){
|
||||
YxSystemUserLevel systemUserLevelQueryVo = systemUserLevelService
|
||||
.getById(levelId);
|
||||
if(ObjectUtil.isNull(systemUserLevelQueryVo)) return;
|
||||
if(ObjectUtil.isNull(systemUserLevelQueryVo)) {
|
||||
return;
|
||||
}
|
||||
|
||||
int validTime = systemUserLevelQueryVo.getValidDate() * 86400;
|
||||
|
||||
|
@ -167,9 +167,13 @@ public class YxUserServiceImpl extends BaseServiceImpl<UserMapper, YxUser> imple
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<PromUserDto> list = new ArrayList<>();
|
||||
if (userIds.isEmpty()) return list;
|
||||
if (userIds.isEmpty()) {
|
||||
return list;
|
||||
}
|
||||
|
||||
if (StrUtil.isBlank(sort)) sort = "u.uid desc";
|
||||
if (StrUtil.isBlank(sort)) {
|
||||
sort = "u.uid desc";
|
||||
}
|
||||
|
||||
Page<YxUser> pageModel = new Page<>(page, limit);
|
||||
if (ShopCommonEnum.GRADE_0.getValue().equals(grade)) {//-级
|
||||
@ -181,7 +185,9 @@ public class YxUserServiceImpl extends BaseServiceImpl<UserMapper, YxUser> imple
|
||||
List<Long> userIdsT = userListT.stream()
|
||||
.map(YxUser::getUid)
|
||||
.collect(Collectors.toList());
|
||||
if (userIdsT.isEmpty()) return list;
|
||||
if (userIdsT.isEmpty()) {
|
||||
return list;
|
||||
}
|
||||
list = yxUserMapper.getUserSpreadCountList(pageModel, userIdsT,
|
||||
keyword, sort);
|
||||
|
||||
@ -224,14 +230,18 @@ public class YxUserServiceImpl extends BaseServiceImpl<UserMapper, YxUser> imple
|
||||
public void backOrderBrokerage(YxStoreOrderQueryVo order) {
|
||||
//如果分销没开启直接返回
|
||||
String open = systemConfigService.getData(SystemConfigConstants.STORE_BROKERAGE_OPEN);
|
||||
if(StrUtil.isBlank(open) || ShopCommonEnum.ENABLE_2.getValue().toString().equals(open)) return;
|
||||
if(StrUtil.isBlank(open) || ShopCommonEnum.ENABLE_2.getValue().toString().equals(open)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//获取购买商品的用户
|
||||
YxUser userInfo = this.getById(order.getUid());
|
||||
System.out.println("userInfo:"+userInfo);
|
||||
//当前用户不存在 没有上级 直接返回
|
||||
if(ObjectUtil.isNull(userInfo) || userInfo.getSpreadUid() == 0) return;
|
||||
if(ObjectUtil.isNull(userInfo) || userInfo.getSpreadUid() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
YxUser preUser = this.getById(userInfo.getSpreadUid());
|
||||
@ -241,7 +251,9 @@ public class YxUserServiceImpl extends BaseServiceImpl<UserMapper, YxUser> imple
|
||||
|
||||
//返佣金额小于等于0 直接返回不返佣金
|
||||
|
||||
if(brokeragePrice.compareTo(BigDecimal.ZERO) <= 0) return;
|
||||
if(brokeragePrice.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
//计算上级推广员返佣之后的金额
|
||||
double balance = NumberUtil.add(preUser.getBrokeragePrice(),brokeragePrice).doubleValue();
|
||||
@ -351,9 +363,13 @@ public class YxUserServiceImpl extends BaseServiceImpl<UserMapper, YxUser> imple
|
||||
.last("limit 1");
|
||||
YxUserLevel userLevel = userLevelService.getOne(wrapper);
|
||||
YxSystemUserLevel systemUserLevel = new YxSystemUserLevel();
|
||||
if(ObjectUtil.isNotNull(userLevel)) systemUserLevel= systemUserLevelService.getById(userLevel.getLevelId());
|
||||
if(ObjectUtil.isNotNull(userLevel)) {
|
||||
systemUserLevel= systemUserLevelService.getById(userLevel.getLevelId());
|
||||
}
|
||||
int discount = 100;
|
||||
if(ObjectUtil.isNotNull(userLevel)) discount = systemUserLevel.getDiscount().intValue();
|
||||
if(ObjectUtil.isNotNull(userLevel)) {
|
||||
discount = systemUserLevel.getDiscount().intValue();
|
||||
}
|
||||
return NumberUtil.mul(NumberUtil.div(discount,100),price);
|
||||
}
|
||||
|
||||
@ -365,27 +381,43 @@ public class YxUserServiceImpl extends BaseServiceImpl<UserMapper, YxUser> imple
|
||||
*/
|
||||
@Override
|
||||
public void setSpread(String spread, long uid) {
|
||||
if(StrUtil.isBlank(spread) || !NumberUtil.isNumber(spread)) return;
|
||||
if(StrUtil.isBlank(spread) || !NumberUtil.isNumber(spread)) {
|
||||
return;
|
||||
}
|
||||
|
||||
//如果分销没开启直接返回
|
||||
String open = systemConfigService.getData(SystemConfigConstants.STORE_BROKERAGE_OPEN);
|
||||
if(StrUtil.isBlank(open) || ShopCommonEnum.ENABLE_2.getValue().toString().equals(open)) return;
|
||||
if(StrUtil.isBlank(open) || ShopCommonEnum.ENABLE_2.getValue().toString().equals(open)) {
|
||||
return;
|
||||
}
|
||||
//当前用户信息
|
||||
YxUser userInfo = this.getById(uid);
|
||||
if(ObjectUtil.isNull(userInfo)) return;
|
||||
if(ObjectUtil.isNull(userInfo)) {
|
||||
return;
|
||||
}
|
||||
|
||||
//当前用户有上级直接返回
|
||||
if(userInfo.getSpreadUid() != null && userInfo.getSpreadUid() > 0) return;
|
||||
if(userInfo.getSpreadUid() != null && userInfo.getSpreadUid() > 0) {
|
||||
return;
|
||||
}
|
||||
//没有推广编号直接返回
|
||||
long spreadInt = Long.valueOf(spread);
|
||||
if(spreadInt == 0) return;
|
||||
if(spreadInt == uid) return;
|
||||
if(spreadInt == 0) {
|
||||
return;
|
||||
}
|
||||
if(spreadInt == uid) {
|
||||
return;
|
||||
}
|
||||
|
||||
//不能互相成为上下级
|
||||
YxUser userInfoT = this.getById(spreadInt);
|
||||
if(ObjectUtil.isNull(userInfoT)) return;
|
||||
if(ObjectUtil.isNull(userInfoT)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(userInfoT.getSpreadUid() == uid) return;
|
||||
if(userInfoT.getSpreadUid() == uid) {
|
||||
return;
|
||||
}
|
||||
|
||||
YxUser yxUser = YxUser.builder()
|
||||
.spreadUid(spreadInt)
|
||||
@ -410,7 +442,9 @@ public class YxUserServiceImpl extends BaseServiceImpl<UserMapper, YxUser> imple
|
||||
YxUser userInfoTwo = this.getById(userInfo.getSpreadUid());
|
||||
|
||||
//上推广人不存在 或者 上推广人没有上级 直接返回
|
||||
if(ObjectUtil.isNull(userInfoTwo) || userInfoTwo.getSpreadUid() == 0) return;
|
||||
if(ObjectUtil.isNull(userInfoTwo) || userInfoTwo.getSpreadUid() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//指定分销 判断 上上级是否时推广员 如果不是推广员直接返回
|
||||
@ -421,7 +455,9 @@ public class YxUserServiceImpl extends BaseServiceImpl<UserMapper, YxUser> imple
|
||||
BigDecimal brokeragePrice = this.computeProductBrokerage(order,Brokerage.LEVEL_2);
|
||||
|
||||
//返佣金额小于等于0 直接返回不返佣金
|
||||
if(brokeragePrice.compareTo(BigDecimal.ZERO) <= 0) return;
|
||||
if(brokeragePrice.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
//获取上上级推广员信息
|
||||
double balance = NumberUtil.add(preUser.getBrokeragePrice(),brokeragePrice).doubleValue();
|
||||
@ -627,7 +663,9 @@ public class YxUserServiceImpl extends BaseServiceImpl<UserMapper, YxUser> imple
|
||||
}else{
|
||||
mark = "系统扣除了"+param.getMoney()+"余额";
|
||||
newMoney = NumberUtil.sub(yxUser.getNowMoney(),param.getMoney()).doubleValue();
|
||||
if(newMoney < 0) newMoney = 0d;
|
||||
if(newMoney < 0) {
|
||||
newMoney = 0d;
|
||||
}
|
||||
billService.expend(yxUser.getUid(), "系统减少余额",
|
||||
BillDetailEnum.CATEGORY_1.getValue(),
|
||||
BillDetailEnum.TYPE_7.getValue(),
|
||||
|
@ -79,10 +79,14 @@ public class YxUserSignServiceImpl extends BaseServiceImpl<YxUserSignMapper, YxU
|
||||
@Override
|
||||
public int sign(YxUser yxUser) {
|
||||
List<JSONObject> list = systemGroupDataService.getDatas(ShopConstants.YSHOP_SIGN_DAY_NUM);
|
||||
if(ObjectUtil.isNull(list) || list.isEmpty()) throw new YshopException("请先配置签到天数");
|
||||
if(ObjectUtil.isNull(list) || list.isEmpty()) {
|
||||
throw new YshopException("请先配置签到天数");
|
||||
}
|
||||
|
||||
boolean isDaySign = this.getToDayIsSign(yxUser.getUid());
|
||||
if(isDaySign) throw new YshopException("已签到");
|
||||
if(isDaySign) {
|
||||
throw new YshopException("已签到");
|
||||
}
|
||||
int signNumber = 0; //积分
|
||||
int userSignNum = yxUser.getSignNum(); //签到次数
|
||||
if(getYesterDayIsSign(yxUser.getUid())){
|
||||
@ -121,7 +125,9 @@ public class YxUserSignServiceImpl extends BaseServiceImpl<YxUserSignMapper, YxU
|
||||
.signNum(userSignNum)
|
||||
.build();
|
||||
boolean res = yxUserService.updateById(user);
|
||||
if(!res) throw new YshopException("签到失败");
|
||||
if(!res) {
|
||||
throw new YshopException("签到失败");
|
||||
}
|
||||
|
||||
//插入流水
|
||||
billService.income(yxUser.getUid(),title, BillDetailEnum.CATEGORY_2.getValue(),
|
||||
@ -162,7 +168,9 @@ public class YxUserSignServiceImpl extends BaseServiceImpl<YxUserSignMapper, YxU
|
||||
userQueryVo.setSumSignDay(sumSignDay);
|
||||
userQueryVo.setIsDaySign(isDaySign);
|
||||
userQueryVo.setIsYesterDaySign(isYesterDaySign);
|
||||
if(!isDaySign && !isYesterDaySign) userQueryVo.setSignNum(0);
|
||||
if(!isDaySign && !isYesterDaySign) {
|
||||
userQueryVo.setSignNum(0);
|
||||
}
|
||||
return userQueryVo;
|
||||
}
|
||||
|
||||
@ -176,7 +184,9 @@ public class YxUserSignServiceImpl extends BaseServiceImpl<YxUserSignMapper, YxU
|
||||
int count = this.lambdaQuery().eq(YxUserSign::getUid,uid)
|
||||
.ge(YxUserSign::getCreateTime,today)
|
||||
.count();
|
||||
if(count > 0) return true;
|
||||
if(count > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -193,7 +203,9 @@ public class YxUserSignServiceImpl extends BaseServiceImpl<YxUserSignMapper, YxU
|
||||
.lt(YxUserSign::getCreateTime,today)
|
||||
.ge(YxUserSign::getCreateTime,yesterday)
|
||||
.count();
|
||||
if(count > 0) return true;
|
||||
if(count > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user