|
|
|
|
@ -4,7 +4,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
|
|
|
|
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import io.swagger.annotations.ApiParam; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springblade.common.cache.AddressCache; |
|
|
|
|
@ -65,7 +68,7 @@ public class OrderController { |
|
|
|
|
if (Func.isNotEmpty(orderNo)) { |
|
|
|
|
wrapper.like(Order::getOrderNo, orderNo); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(orderNo)) { |
|
|
|
|
if (Func.isNotEmpty(status)) { |
|
|
|
|
wrapper.eq(Order::getStatus, status); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -116,11 +119,16 @@ public class OrderController { |
|
|
|
|
// 生成订单号, 年月日+4位自增
|
|
|
|
|
info.setOrderNo(DateUtil.format(DateUtil.now(), "yyyyMMddHH") + orderService.getAutoIncreSerialNumber()); |
|
|
|
|
|
|
|
|
|
String goodsName = DictBizCache.getValue(DictConstant.GOODS_INFO, DictConstant.GOODS_INFO_KEY_NAME); |
|
|
|
|
info.setGoodsName(goodsName); |
|
|
|
|
info.setGoodsNum(1); |
|
|
|
|
String price = DictBizCache.getValue(DictConstant.GOODS_INFO, DictConstant.GOODS_INFO_KEY_PRICE); |
|
|
|
|
info.setGoodsPrice(Func.toDouble(price)); |
|
|
|
|
String goodsName = DictBizCache.getValue(DictConstant.GOODS_INFO, DictConstant.GOODS_INFO_KEY_NAME); |
|
|
|
|
info.setGoodsName(goodsName); |
|
|
|
|
int goodsNum = 1; |
|
|
|
|
if (Func.isNotEmpty(info.getGoodsNum()) && info.getGoodsNum() > 0) { |
|
|
|
|
goodsNum = info.getGoodsNum(); |
|
|
|
|
} |
|
|
|
|
info.setGoodsNum(goodsNum); |
|
|
|
|
info.setTotalPrice(Func.toDouble(info.getGoodsPrice() * goodsNum)); |
|
|
|
|
|
|
|
|
|
// 设置默认地址
|
|
|
|
|
WeChatAddress address = AddressCache.getAddress(info.getBuyerPhone()); |
|
|
|
|
@ -216,4 +224,27 @@ public class OrderController { |
|
|
|
|
|
|
|
|
|
return R.status(orderService.update(null, lambdaUpdateWrapper)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 确认收货 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/cancel") |
|
|
|
|
public R cancel(@RequestParam String id) { |
|
|
|
|
LambdaUpdateWrapper<Order> lambdaUpdateWrapper = new LambdaUpdateWrapper<>(); |
|
|
|
|
lambdaUpdateWrapper |
|
|
|
|
.eq(Order::getId, id) |
|
|
|
|
.set(Order::getStatus, OrderStatusEnum.ORDER_STATUS_CANCEL.getCode()) |
|
|
|
|
; |
|
|
|
|
|
|
|
|
|
return R.status(orderService.update(null, lambdaUpdateWrapper)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 删除 |
|
|
|
|
*/ |
|
|
|
|
@PostMapping("/remove") |
|
|
|
|
public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) { |
|
|
|
|
boolean temp = orderService.deleteLogic(Func.toLongList(ids)); |
|
|
|
|
return R.status(temp); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|