format the code and remove the unused import
This commit is contained in:
@@ -71,8 +71,20 @@ public class BuyOrderController {
|
||||
private PayWechatOrderService payWechatOrderService;
|
||||
@Autowired
|
||||
private PayZfbOrderService payZfbOrderService;
|
||||
// @Autowired
|
||||
// private
|
||||
|
||||
/**
|
||||
* 订单状态 - 待支付
|
||||
*/
|
||||
private static final String ORDER_STATUS_TO_BE_PAID = "0";
|
||||
/**
|
||||
* 订单状态 - 待发货
|
||||
*/
|
||||
private static final String ORDER_STATUS_TO_BE_SHIPPED = "1";
|
||||
/**
|
||||
* 订单状态 - 待收货
|
||||
*/
|
||||
private static final String ORDER_STATUS_TO_BE_RECEIVED = "2";
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@@ -124,23 +136,18 @@ public class BuyOrderController {
|
||||
|
||||
|
||||
/**
|
||||
* 保存
|
||||
* 下单
|
||||
*/
|
||||
@RequestMapping("/buysave")
|
||||
@Transactional
|
||||
// @RequiresPermissions("book:buyorder:save")
|
||||
public R buysave(@RequestBody BuyOrderEntity buyOrder){
|
||||
|
||||
|
||||
BigDecimal realMoney = new BigDecimal(0);
|
||||
|
||||
Lock l = new ReentrantLock();
|
||||
l.lock();
|
||||
try {
|
||||
// 根据订单获取订单详情
|
||||
List<BuyOrderDetailEntity> products = buyOrder.getProducts();
|
||||
|
||||
BigDecimal bigDecimal1 = new BigDecimal(0);
|
||||
|
||||
ArrayList<BuyOrderDetailEntity> list = new ArrayList<>();
|
||||
|
||||
// 遍历商品 查询价格
|
||||
@@ -152,12 +159,13 @@ public class BuyOrderController {
|
||||
BigDecimal big = new BigDecimal(0);
|
||||
BigDecimal price=null;
|
||||
|
||||
//activityPrice等于0,则原价
|
||||
//activityPrice等于 0,则原价
|
||||
if (activityPrice.equals(big)||activityPrice==null) {
|
||||
price = product.getPrice();
|
||||
}else {
|
||||
price = product.getActivityPrice();
|
||||
}
|
||||
|
||||
Integer quantity = buyOrderDetail.getQuantity();
|
||||
BigDecimal bigDecimal = new BigDecimal(price.doubleValue() * quantity);
|
||||
System.out.println("bigDecimal=================bigDecimal======================"+bigDecimal);
|
||||
@@ -170,6 +178,7 @@ public class BuyOrderController {
|
||||
product.setProductStock(product.getProductStock() - buyOrderDetail.getQuantity());
|
||||
product.setSumSales(product.getSumSales() + buyOrderDetail.getQuantity());
|
||||
shopProductService.updateById(product);
|
||||
|
||||
BeanUtils.copyProperties(buyOrderDetail,buyOrderDetailEntity);
|
||||
buyOrderDetailEntity.setProductName(product.getProductName());
|
||||
buyOrderDetailEntity.setProductPrice(product.getPrice());
|
||||
@@ -200,9 +209,8 @@ public class BuyOrderController {
|
||||
String timeId = IdWorker.getTimeId().substring(0,32);
|
||||
buyOrder.setOrderSn(timeId);
|
||||
if("4".equals(buyOrder.getPaymentMethod())){
|
||||
buyOrder.setOrderStatus("1");
|
||||
buyOrder.setOrderStatus(ORDER_STATUS_TO_BE_SHIPPED);
|
||||
}
|
||||
//todo 增加结束时间
|
||||
buyOrder.setPaymentDate(new Date());
|
||||
buyOrderService.save(buyOrder);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user