完善了订单信息
This commit is contained in:
parent
938d2472da
commit
62b6b3b634
|
@ -83,6 +83,8 @@ public class CartRecordController {
|
|||
CartRecord cartRecord = new CartRecord();
|
||||
BeanUtils.copyProperties(cartRecordUpdateRequest, cartRecord);
|
||||
cartRecord.setUserId(userId);
|
||||
// 校验
|
||||
cartRecordService.validCart(cartRecord, true);
|
||||
return cartRecord;
|
||||
}).toList();
|
||||
boolean result = cartRecordService.updateBatchById(cartRecordList);
|
||||
|
|
|
@ -71,6 +71,8 @@ public class CouponController {
|
|||
}
|
||||
Coupon coupon = new Coupon();
|
||||
BeanUtils.copyProperties(couponAddRequest, coupon);
|
||||
// 校验
|
||||
couponService.validCoupon(coupon, false);
|
||||
boolean result = couponService.save(coupon);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
|
||||
return ResultUtils.success(true);
|
||||
|
@ -92,6 +94,8 @@ public class CouponController {
|
|||
}
|
||||
Coupon coupon = new Coupon();
|
||||
BeanUtils.copyProperties(couponUpdateRequest, coupon);
|
||||
// 校验
|
||||
couponService.validCoupon(coupon, true);
|
||||
boolean result = couponService.updateById(coupon);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
|
||||
return ResultUtils.success(true);
|
||||
|
|
|
@ -75,6 +75,8 @@ public class GoodController {
|
|||
}
|
||||
Good good = new Good();
|
||||
BeanUtils.copyProperties(goodAddRequest, good);
|
||||
// 校验
|
||||
goodService.validGood(good, false);
|
||||
boolean save = goodService.save(good);
|
||||
ThrowUtils.throwIf(!save, ErrorCode.OPERATION_ERROR);
|
||||
return ResultUtils.success(true, "商品插入成功");
|
||||
|
@ -98,6 +100,8 @@ public class GoodController {
|
|||
// 向商品表插入服务类商品的基本信息
|
||||
Good good = new Good();
|
||||
BeanUtils.copyProperties(serviceGoodAddRequest, good);
|
||||
// 校验
|
||||
goodService.validGood(good, false);
|
||||
boolean save = goodService.save(good);
|
||||
ThrowUtils.throwIf(!save, ErrorCode.OPERATION_ERROR);
|
||||
|
||||
|
@ -108,6 +112,8 @@ public class GoodController {
|
|||
AppointmentDate appointmentDate = new AppointmentDate();
|
||||
BeanUtils.copyProperties(appointmentDateAddRequest, appointmentDate);
|
||||
appointmentDate.setGoodId(id);
|
||||
// 校验
|
||||
appointmentDateService.validAppointmentDate(appointmentDate, false);
|
||||
return appointmentDate;
|
||||
}).toList();
|
||||
boolean isSuccess = appointmentDateService.saveBatch(appointmentDates);
|
||||
|
@ -179,6 +185,8 @@ public class GoodController {
|
|||
}
|
||||
Good good = new Good();
|
||||
BeanUtils.copyProperties(goodUpdateRequest, good);
|
||||
// 校验
|
||||
goodService.validGood(good, true);
|
||||
boolean result = goodService.updateById(good);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
|
||||
return ResultUtils.success(true);
|
||||
|
@ -349,6 +357,8 @@ public class GoodController {
|
|||
// 更新商品的基本信息
|
||||
ServiceGoodVO serviceGoodVO = new ServiceGoodVO();
|
||||
BeanUtils.copyProperties(serviceGoodUpdateRequest, serviceGoodVO);
|
||||
// 校验
|
||||
goodService.validGood(serviceGoodVO, true);
|
||||
boolean result = goodService.updateById(serviceGoodVO);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
|
||||
|
||||
|
@ -388,6 +398,8 @@ public class GoodController {
|
|||
AppointmentDate appointmentDate = new AppointmentDate();
|
||||
BeanUtils.copyProperties(appointmentDateUpdateRequest, appointmentDate);
|
||||
appointmentDate.setGoodId(id);
|
||||
// 校验
|
||||
appointmentDateService.validAppointmentDate(appointmentDate, true);
|
||||
return appointmentDate;
|
||||
}).toList();
|
||||
boolean isSuccess = appointmentDateService.updateBatchById(appointmentDateList);
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.cultural.heritage.common.ResultUtils;
|
|||
import com.cultural.heritage.constant.UserConstant;
|
||||
import com.cultural.heritage.exception.BusinessException;
|
||||
import com.cultural.heritage.exception.ThrowUtils;
|
||||
import com.cultural.heritage.model.dto.CommonRequest;
|
||||
import com.cultural.heritage.model.dto.order.OrderAddRequest;
|
||||
import com.cultural.heritage.model.dto.order.OrderItemAddRequest;
|
||||
import com.cultural.heritage.model.dto.order.OrderQueryRequest;
|
||||
|
@ -29,10 +30,7 @@ import jakarta.servlet.http.HttpServletRequest;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -189,4 +187,30 @@ public class OrderController {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端根据订单id查询订单信息
|
||||
* @param commonRequest 根据id查询请求体
|
||||
* @return 用户订单信息
|
||||
*/
|
||||
@PostMapping ("/get/id")
|
||||
@Operation(summary = "小程序端用户根据id查询订单", description = "参数:根据id查询请求体,权限:所有人,方法名:getOrderById")
|
||||
@AuthCheck(mustRole = UserConstant.ADMIN_ROLE)
|
||||
public BaseResponse<OrderVO> getOrderById(@RequestBody CommonRequest commonRequest, HttpServletRequest request) {
|
||||
if (commonRequest == null || commonRequest.getId() <= 0) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
userService.getLoginUser(request);
|
||||
Long orderId = commonRequest.getId();
|
||||
Order order = orderService.getById(orderId);
|
||||
ThrowUtils.throwIf(order == null, ErrorCode.NOT_FOUND_ERROR, "订单不存在");
|
||||
OrderVO orderVO = new OrderVO();
|
||||
BeanUtils.copyProperties(order, orderVO);
|
||||
QueryWrapper<OrderItems> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("orderId", orderId);
|
||||
List<OrderItems> orderItemsList = orderItemService.list(queryWrapper);
|
||||
orderVO.setOrderItemList(orderItemsList);
|
||||
return ResultUtils.success(orderVO);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> impl
|
|||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "参数id错误");
|
||||
}
|
||||
}
|
||||
if (ObjectUtils.isEmpty(isDefault)) {
|
||||
if (ObjectUtils.isEmpty(isDefault) || isDefault != 1 && isDefault != 0) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
if (StringUtils.isAnyBlank(name, region, detailAddress, phone)) {
|
||||
|
|
|
@ -55,7 +55,7 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
|
|||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "参数id错误");
|
||||
}
|
||||
}
|
||||
if (ObjectUtils.isEmpty(isDefault)) {
|
||||
if (ObjectUtils.isEmpty(isDefault) || isDefault != 0 && isDefault != 1) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
if (StringUtils.isAnyBlank(name, phone)) {
|
||||
|
|
|
@ -4,4 +4,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
import com.cultural.heritage.model.entity.AppointmentDate;
|
||||
|
||||
public interface AppointmentDateService extends IService<AppointmentDate> {
|
||||
|
||||
/**
|
||||
* 校验
|
||||
*/
|
||||
void validAppointmentDate(AppointmentDate appointmentDate, boolean update);
|
||||
}
|
||||
|
|
|
@ -18,4 +18,10 @@ public interface CouponService extends IService<Coupon> {
|
|||
* 校验用户限领量是否已达到上限
|
||||
*/
|
||||
Integer verifyIsReachTheUpperLimit(Long userId, Long couponId);
|
||||
|
||||
|
||||
/**
|
||||
* 校验
|
||||
*/
|
||||
void validCoupon(Coupon coupon, boolean update);
|
||||
}
|
||||
|
|
|
@ -19,4 +19,10 @@ public interface GoodService extends IService<Good> {
|
|||
* 根据商品类名查询商品列表
|
||||
*/
|
||||
List<Good> getGoodListByTypeName(String typeName);
|
||||
|
||||
|
||||
/**
|
||||
* 校验
|
||||
*/
|
||||
void validGood(Good good, boolean update);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,54 @@
|
|||
package com.cultural.heritage.service.good.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.cultural.heritage.common.ErrorCode;
|
||||
import com.cultural.heritage.exception.BusinessException;
|
||||
import com.cultural.heritage.exception.ThrowUtils;
|
||||
import com.cultural.heritage.mapper.AppointmentDateMapper;
|
||||
import com.cultural.heritage.model.entity.AppointmentDate;
|
||||
import com.cultural.heritage.model.entity.Good;
|
||||
import com.cultural.heritage.service.good.AppointmentDateService;
|
||||
import com.cultural.heritage.service.good.GoodService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class AppointmentDateServiceImpl extends ServiceImpl<AppointmentDateMapper, AppointmentDate> implements AppointmentDateService {
|
||||
|
||||
|
||||
@Resource
|
||||
private GoodService goodService;
|
||||
|
||||
|
||||
/**
|
||||
* 校验
|
||||
*/
|
||||
@Override
|
||||
public void validAppointmentDate(AppointmentDate appointmentDate, boolean update) {
|
||||
Long id = appointmentDate.getId();
|
||||
String specificDate = appointmentDate.getSpecificDate();
|
||||
String timeSlot = appointmentDate.getTimeSlot();
|
||||
Integer isAvailable = appointmentDate.getIsAvailable();
|
||||
Long goodId = appointmentDate.getGoodId();
|
||||
String numberRange = appointmentDate.getNumberRange();
|
||||
if (update) {
|
||||
if (id == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "参数id错误");
|
||||
}
|
||||
}
|
||||
if (ObjectUtils.isEmpty(isAvailable) || isAvailable != 0 && isAvailable != 1) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "是否可预约参数错误");
|
||||
}
|
||||
if (ObjectUtils.isEmpty(goodId)) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "商品id参数为null");
|
||||
}
|
||||
Good good = goodService.getById(goodId);
|
||||
ThrowUtils.throwIf(good == null, ErrorCode.SYSTEM_ERROR, "商品不存在");
|
||||
if (StringUtils.isAnyBlank(specificDate, timeSlot, numberRange)) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "存在参数为空");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.cultural.heritage.service.good.impl;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.cultural.heritage.common.ErrorCode;
|
||||
import com.cultural.heritage.exception.BusinessException;
|
||||
import com.cultural.heritage.exception.ThrowUtils;
|
||||
import com.cultural.heritage.mapper.CartRecordMapper;
|
||||
import com.cultural.heritage.mapper.GoodMapper;
|
||||
|
@ -13,9 +14,11 @@ import com.cultural.heritage.model.entity.User;
|
|||
import com.cultural.heritage.model.vo.cart.CartRecordVO;
|
||||
import com.cultural.heritage.model.vo.good.GoodVO;
|
||||
import com.cultural.heritage.service.good.CartRecordService;
|
||||
import com.cultural.heritage.service.good.GoodService;
|
||||
import com.cultural.heritage.service.user.UserService;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -29,6 +32,10 @@ public class CartRecordServiceImpl extends ServiceImpl<CartRecordMapper, CartRec
|
|||
private GoodMapper goodMapper;
|
||||
|
||||
|
||||
@Resource
|
||||
private GoodService goodService;
|
||||
|
||||
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
|
@ -53,6 +60,7 @@ public class CartRecordServiceImpl extends ServiceImpl<CartRecordMapper, CartRec
|
|||
CartRecord cartGood = new CartRecord();
|
||||
BeanUtils.copyProperties(cartRecordAddRequest, cartGood);
|
||||
cartGood.setUserId(userId);
|
||||
// 校验
|
||||
this.validCart(cartGood, false);
|
||||
boolean result = this.save(cartGood);
|
||||
ThrowUtils.throwIf(!result, ErrorCode.OPERATION_ERROR);
|
||||
|
@ -93,6 +101,29 @@ public class CartRecordServiceImpl extends ServiceImpl<CartRecordMapper, CartRec
|
|||
*/
|
||||
@Override
|
||||
public void validCart(CartRecord cartRecord, boolean update) {
|
||||
Long userId = cartRecord.getUserId();
|
||||
Long goodId = cartRecord.getGoodId();
|
||||
Integer quantity = cartRecord.getQuantity();
|
||||
Double subtotal = cartRecord.getSubtotal();
|
||||
Integer isGoodType = cartRecord.getIsGoodType();
|
||||
if (update) {
|
||||
if (userId == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR);
|
||||
}
|
||||
}
|
||||
Good good = goodService.getById(goodId);
|
||||
if (good == null || good.getIsShelves() == 0) {
|
||||
throw new BusinessException(ErrorCode.NOT_FOUND_ERROR, "不存在该商品或该商品已下架");
|
||||
}
|
||||
if (ObjectUtils.isEmpty(quantity) || quantity < 1) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "请传递正确的商品数量");
|
||||
}
|
||||
if (ObjectUtils.isEmpty(subtotal) || subtotal <= 0) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "价格错误");
|
||||
}
|
||||
if (ObjectUtils.isEmpty(isGoodType) || isGoodType != 1 && isGoodType != 0) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "请传递正确的商品类别");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,21 +50,23 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> i
|
|||
public void validCategory(Category category, boolean add) {
|
||||
String typeName = category.getTypeName();
|
||||
String typeUrl = category.getTypeUrl();
|
||||
String typeIntro = category.getTypeIntro();
|
||||
ThrowUtils.throwIf(StringUtils.isBlank(typeName), ErrorCode.PARAMS_ERROR);
|
||||
QueryWrapper<Category> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("typeName", typeName);
|
||||
// 创建时,参数不能为空
|
||||
if (add) {
|
||||
ThrowUtils.throwIf(typeName == null, ErrorCode.PARAMS_ERROR);
|
||||
Long count = this.baseMapper.selectCount(queryWrapper);
|
||||
ThrowUtils.throwIf(count > 0, ErrorCode.PARAMS_ERROR, "类别名称不可重复");
|
||||
} else {
|
||||
queryWrapper.ne("id", category.getId());
|
||||
Long id = category.getId();
|
||||
queryWrapper.ne("id", id);
|
||||
Long count = this.baseMapper.selectCount(queryWrapper);
|
||||
ThrowUtils.throwIf(count > 0, ErrorCode.PARAMS_ERROR, "类别名称已存在");
|
||||
}
|
||||
// 有参数则校验
|
||||
if (StringUtils.isAnyBlank(typeUrl)) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "请上传图片");
|
||||
if (StringUtils.isAnyBlank(typeUrl, typeIntro)) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "请上传图片或填写商品详情");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.cultural.heritage.service.good.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.cultural.heritage.common.ErrorCode;
|
||||
|
@ -14,7 +13,6 @@ import com.cultural.heritage.utils.SqlUtils;
|
|||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.yaml.snakeyaml.scanner.Constant;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
@ -47,4 +45,45 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> impleme
|
|||
public Integer verifyIsReachTheUpperLimit(Long userId, Long couponId) {
|
||||
return this.baseMapper.verifyIsReachTheUpperLimit(userId, couponId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验
|
||||
*/
|
||||
@Override
|
||||
public void validCoupon(Coupon coupon, boolean update) {
|
||||
Long id = coupon.getId();
|
||||
String name = coupon.getName();
|
||||
Double conditionAmount = coupon.getConditionAmount();
|
||||
Integer requirePoints = coupon.getRequirePoints();
|
||||
Integer totalNum = coupon.getTotalNum();
|
||||
Integer residueNum = coupon.getResidueNum();
|
||||
Integer limitNum = coupon.getLimitNum();
|
||||
String useScope = coupon.getUseScope();
|
||||
String startTime = coupon.getStartTime();
|
||||
String endTime = coupon.getEndTime();
|
||||
String intro = coupon.getIntro();
|
||||
String image = coupon.getImage();
|
||||
String description = coupon.getDescription();
|
||||
if (update) {
|
||||
if (id == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "参数id错误");
|
||||
}
|
||||
}
|
||||
if (ObjectUtils.isEmpty(conditionAmount) || conditionAmount <= 0) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "满减价格错误");
|
||||
}
|
||||
if (ObjectUtils.isEmpty(requirePoints) || requirePoints <= 0) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "积分参数错误");
|
||||
}
|
||||
if (ObjectUtils.isEmpty(totalNum) || ObjectUtils.isEmpty(residueNum) || ObjectUtils.isEmpty(limitNum)) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "优惠券数量参数为null");
|
||||
}
|
||||
if (totalNum <= 0 || residueNum < 0 || residueNum > totalNum || limitNum <= 0 || limitNum > totalNum) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "优惠券数量参数错误");
|
||||
}
|
||||
if (StringUtils.isAnyBlank(name, useScope, startTime, endTime, intro, image, description)) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "存在参数为空");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,4 +63,51 @@ public class GoodServiceImpl extends ServiceImpl<GoodMapper, Good> implements Go
|
|||
return list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验
|
||||
*/
|
||||
@Override
|
||||
public void validGood(Good good, boolean update) {
|
||||
Long id = good.getId();
|
||||
String name = good.getName();
|
||||
String type = good.getType();
|
||||
String goodImg = good.getGoodImg();
|
||||
String intro = good.getIntro();
|
||||
String introDetail = good.getIntroDetail();
|
||||
String detailImg = good.getDetailImg();
|
||||
String label = good.getLabel();
|
||||
Integer inventory = good.getInventory();
|
||||
Integer isGoodType = good.getIsGoodType();
|
||||
Integer festivalOrder = good.getFestivalOrder();
|
||||
Integer isShelves = good.getIsShelves();
|
||||
Double price = good.getPrice();
|
||||
|
||||
if (update) {
|
||||
if (id == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "参数id错误");
|
||||
}
|
||||
}
|
||||
if (StringUtils.isAnyBlank(type, goodImg, intro, introDetail, detailImg, label, name)) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "存在参数为空");
|
||||
}
|
||||
if (ObjectUtils.isEmpty(inventory) || inventory < 1) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "库存量不能小于1");
|
||||
}
|
||||
if (ObjectUtils.isEmpty(isGoodType) || isGoodType != 0 && isGoodType != 1) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "商品类型参数错误");
|
||||
}
|
||||
if (ObjectUtils.isEmpty(festivalOrder) || festivalOrder <= 0) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "节日参数错误");
|
||||
}
|
||||
if (ObjectUtils.isEmpty(isShelves) || isShelves != 0 && isShelves != 1) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "是否上架参数错误");
|
||||
}
|
||||
if (ObjectUtils.isEmpty(price) || price <= 0) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "商品价格不能小于等于0");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|||
String userName = order.getUserName();
|
||||
Double totalAmount = order.getTotalAmount();
|
||||
String orderStatus = order.getOrderStatus();
|
||||
if (ObjectUtils.isEmpty(totalAmount) || totalAmount.floatValue() <= 0) {
|
||||
if (ObjectUtils.isEmpty(totalAmount) || totalAmount <= 0) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "价格错误");
|
||||
}
|
||||
if (ObjectUtils.isEmpty(userId)) {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.cultural.heritage.test;
|
||||
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
|
||||
public class Test {
|
||||
public static void main(String[] args) {
|
||||
// Date date = new Date();
|
||||
|
@ -22,6 +20,7 @@ public class Test {
|
|||
// System.out.printf("%.2f", num); // 输出:3.14
|
||||
|
||||
// System.out.println(StringUtils.isAnyBlank("333", "333", null, "dfs"));
|
||||
System.out.println(ObjectUtils.anyNull(null));
|
||||
// System.out.println(StringUtils.isAnyBlank(null));
|
||||
// System.out.println(ObjectUtils.anyNull(null));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user