|
|
|
|
@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springblade.common.cache.AddressCache; |
|
|
|
|
import org.springblade.common.cache.DictBizCache; |
|
|
|
|
import org.springblade.common.constant.DictConstant; |
|
|
|
|
import org.springblade.common.enums.*; |
|
|
|
|
@ -19,6 +20,7 @@ import org.springblade.core.tool.utils.*; |
|
|
|
|
import org.springblade.modules.desk.entity.Order; |
|
|
|
|
import org.springblade.modules.desk.service.IOrderService; |
|
|
|
|
import org.springblade.modules.desk.vo.OrderExcelVO; |
|
|
|
|
import org.springblade.modules.weixin.entity.WeChatAddress; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
@ -52,7 +54,7 @@ public class OrderController { |
|
|
|
|
* 分页 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/page") |
|
|
|
|
public R<IPage<Order>> page(Query query, String buyerName, String buyerPhone, String orderNo) { |
|
|
|
|
public R<IPage<Order>> page(Query query, String buyerName, String buyerPhone, String orderNo, String status) { |
|
|
|
|
LambdaQueryWrapper<Order> wrapper = Wrappers.lambdaQuery(); |
|
|
|
|
if (Func.isNotEmpty(buyerName)) { |
|
|
|
|
wrapper.like(Order::getBuyerName, buyerName); |
|
|
|
|
@ -63,6 +65,9 @@ public class OrderController { |
|
|
|
|
if (Func.isNotEmpty(orderNo)) { |
|
|
|
|
wrapper.like(Order::getOrderNo, orderNo); |
|
|
|
|
} |
|
|
|
|
if (Func.isNotEmpty(orderNo)) { |
|
|
|
|
wrapper.eq(Order::getStatus, status); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
IPage<Order> pages = orderService.page(Condition.getPage(query), wrapper); |
|
|
|
|
return R.data(pages); |
|
|
|
|
@ -114,9 +119,17 @@ public class OrderController { |
|
|
|
|
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_NAME); |
|
|
|
|
String price = DictBizCache.getValue(DictConstant.GOODS_INFO, DictConstant.GOODS_INFO_KEY_PRICE); |
|
|
|
|
info.setGoodsPrice(Func.toDouble(price)); |
|
|
|
|
|
|
|
|
|
// 设置默认地址
|
|
|
|
|
WeChatAddress address = AddressCache.getAddress(info.getBuyerPhone()); |
|
|
|
|
if (Func.isNotEmpty(address)) { |
|
|
|
|
info.setAddress(address.getArea().concat(address.getAddress())); |
|
|
|
|
info.setConsignee(address.getConsignee()); |
|
|
|
|
info.setConsigneePhone(address.getPhone()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (orderService.save(info)) { |
|
|
|
|
return R.data(info); |
|
|
|
|
} else { |
|
|
|
|
|