Authored by caoyan

订单管理

... ... @@ -40,6 +40,8 @@ public class BuyerOrderReq extends PageRequestBO{
private Integer depotNo;
private Integer navStatus;//头部bar的选中状态
public Integer getId() {
return id;
}
... ... @@ -144,6 +146,14 @@ public class BuyerOrderReq extends PageRequestBO{
this.depotNo = depotNo;
}
public Integer getNavStatus() {
return navStatus;
}
public void setNavStatus(Integer navStatus) {
this.navStatus = navStatus;
}
public String toString() {
return "BuyerOrderListReq{" +
"orderCode=" + orderCode +
... ...
... ... @@ -28,8 +28,6 @@ public class SellerOrder implements Serializable {
private BigDecimal earnestMoney;//保证金
private Byte isCancel;//是否取消出售 0:未取消,1:已取消
/**
* 状态 0:待付保证金,1:上架关闭(卖家取消支付),3:上架关闭(卖家支付超时),
* 4:出售中,5:上架关闭(卖家取消出售),6:上架关闭(平台取消出售),7:已售出
... ... @@ -104,14 +102,6 @@ public class SellerOrder implements Serializable {
this.earnestMoney = earnestMoney;
}
public Byte getIsCancel() {
return isCancel;
}
public void setIsCancel(Byte isCancel) {
this.isCancel = isCancel;
}
public Byte getStatus() {
return status;
}
... ... @@ -147,7 +137,6 @@ public class SellerOrder implements Serializable {
", payment=" + payment +
", income=" + income +
", earnestMoney=" + earnestMoney +
", isCancel=" + isCancel +
", status=" + status +
", createTime=" + createTime +
", updateTime=" + updateTime +
... ...
... ... @@ -10,7 +10,7 @@
<result column="payment" property="payment" jdbcType="TINYINT" />
<result column="payment_type" property="paymentType" jdbcType="TINYINT" />
<result column="is_cancel" property="isCancel" jdbcType="TINYINT" />
<result column="amount" property="uid" jdbcType="DECIMAL" />
<result column="amount" property="amount" jdbcType="DECIMAL" />
<result column="ship_fee" property="shipFee" jdbcType="DECIMAL" />
<result column="status" property="status" jdbcType="TINYINT" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
... ... @@ -30,10 +30,13 @@
<select id="selectCountByStatus" resultType="java.lang.Integer">
select count(1)
from buyer_order where status in
from buyer_order where 1=1
<if test="list != null and list.size()>0">
and status in
<foreach collection="list" item="status" open="(" close=")" separator=",">
#{status}
</foreach>
</if>
</select>
<sql id="Query_Order_Sql" >
... ...
... ... @@ -10,14 +10,13 @@
<result column="payment" property="payment" jdbcType="TINYINT" />
<result column="income" property="income" jdbcType="DECIMAL" />
<result column="earnest_money" property="earnestMoney" jdbcType="DECIMAL" />
<result column="is_cancel" property="isCancel" jdbcType="TINYINT" />
<result column="status" property="status" jdbcType="TINYINT" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List">
id, uid, order_code, skup, client_type, payment, income, earnest_money, is_cancel,
id, uid, order_code, skup, client_type, payment, income, earnest_money,
status, create_time, update_time
</sql>
... ...
... ... @@ -2,6 +2,12 @@ package com.yoho.ufo.order.constant;
public enum Constant {
//买家未付款
BUYER_ORDER_STATUS_BUYER_NOT_PAY((byte)0),
//买家已付款
BUYER_ORDER_STATUS_BUYER_PAYED((byte)1),
//商品调拨中(卖家发货,可查物流)
BUYER_ORDER_STATUS_ALLOCATING((byte)2),
... ... @@ -11,8 +17,32 @@ public enum Constant {
//待收货
BUYER_ORDER_STATUS_TO_BE_RECEIVED((byte)4),
//订单已完成
BUYER_ORDER_STATUS_FINISHED((byte)5),
//买家付款前卖家取消
BUYER_ORDER_STATUS_SELLER_CANCEL_BEFORE_PAY((byte)10),
//买家付款后取消
BUYER_ORDER_STATUS_CANCEL_AFTER_PAY((byte)11),
//超时未发货取消
BUYER_ORDER_STATUS_CANCEL_SENDGOODS_TIMEOUT((byte)12),
//鉴定不通过取消
BUYER_ORDER_STATUS_JUDGE_NOT_PASS((byte)13);
BUYER_ORDER_STATUS_JUDGE_NOT_PASS((byte)13),
//买家付款前买家取消
BUYER_ORDER_STATUS_BUYER_CANCEL_BEFORE_PAY((byte)14),
//超时未支付取消
BUYER_ORDER_STATUS_CANCEL_PAY_TIMEOUT((byte)15),
//卖家发货前取消
BUYER_ORDER_STATUS_SELLER_CANCEL_BEFORE_SENDGOODS((byte)16),
//客服取消
BUYER_ORDER_STATUS_CANCEL_BY_SERVICE_STAFF((byte)17);
private byte byteVal;
... ...
... ... @@ -33,6 +33,13 @@ public class BuyerOrderController {
return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(map).build();
}
@RequestMapping(value = "/getCountByOrderStatus")
public ApiResponse getCountByOrderStatus() {
LOGGER.info("getCountByOrderStatus in");
Map<String, Integer> map = buyerOrderService.getCountByOrderStatus();
return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(map).build();
}
@RequestMapping(value = "/queryOrderList")
public ApiResponse queryOrderList(BuyerOrderReq req) {
LOGGER.info("queryOrderList in. req is {}", req);
... ...
... ... @@ -24,4 +24,6 @@ public interface IBuyerOrderService {
List<ExpressCompany> queryAllExpressCompanyList();
BuyerOrderResp getSendBackInfoBySkup(BuyerOrderReq req);
Map<String, Integer> getCountByOrderStatus();
}
... ...
... ... @@ -98,6 +98,29 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
return resultMap;
}
public Map<String, Integer> getCountByOrderStatus(){
int num_0 = buyerOrderMapper.selectCountByStatus(null);//全部
int num_1 = buyerOrderMapper.selectCountByStatus(getStatusListByNavStatus(1));//待买家付款
int num_2 = buyerOrderMapper.selectCountByStatus(getStatusListByNavStatus(2));//待卖家发货
int num_3 = buyerOrderMapper.selectCountByStatus(getStatusListByNavStatus(3));//卖家已发货
int num_4 = buyerOrderMapper.selectCountByStatus(getStatusListByNavStatus(4));//平台鉴定中
int num_5 = buyerOrderMapper.selectCountByStatus(getStatusListByNavStatus(5));//平台已发货
int num_6 = buyerOrderMapper.selectCountByStatus(getStatusListByNavStatus(6));//订单完成
int num_7 = buyerOrderMapper.selectCountByStatus(getStatusListByNavStatus(7));//已取消
Map<String, Integer> resultMap = Maps.newHashMap();
resultMap.put("num_0", num_0);
resultMap.put("num_1", num_1);
resultMap.put("num_2", num_2);
resultMap.put("num_3", num_3);
resultMap.put("num_4", num_4);
resultMap.put("num_5", num_5);
resultMap.put("num_6", num_6);
resultMap.put("num_7", num_7);
return resultMap;
}
public PageResponseBO<BuyerOrderResp> queryOrderList(BuyerOrderReq req) {
if(!checkAndBuildParam(req)) {
return null;
... ... @@ -116,6 +139,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
//查询buyer_order_goods
List<String> buyerOrderCodeList = orderList.stream().map(BuyerOrder::getOrderCode).collect(Collectors.toList());
List<BuyerOrderGoods> buyerGoodsList = buyerOrderGoodsMapper.selectByOrderCode(buyerOrderCodeList);
if(CollectionUtils.isEmpty(buyerGoodsList)) {
return null;
}
Map<String, BuyerOrderGoods> buyerGoodsMap = buyerGoodsList.stream().collect(Collectors.toMap(BuyerOrderGoods::getOrderCode, b->b));
//查询seller_order_goods
... ... @@ -202,6 +228,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
Map<Integer, SellerOrder> sellerOrderMap, Map<Integer, SellerOrderGoods> sellerGoodsMap, Map<String, ExpressInfo> expressInfoMap){
List<BuyerOrderResp> respList = Lists.newArrayList();
for(BuyerOrder item : orderList) {
if(null == buyerGoodsMap.get(item.getOrderCode())) {
continue;
}
Integer skup = buyerGoodsMap.get(item.getOrderCode()).getSkup();
SellerOrder sellerOrder= sellerOrderMap.get(skup);
BuyerOrderResp resp = new BuyerOrderResp();
... ... @@ -211,10 +240,16 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
resp.setProductNum(1);//目前固定为1
resp.setSkuStr(sellerGoodsMap.get(skup).getStorageId().toString());
resp.setDepotNo(sellerGoodsMap.get(skup).getDepotNo());
resp.setSellerWaybillCode(expressInfoMap.get(sellerOrder.getOrderCode()).getWaybillCode());
resp.setSellerWaybillCode(null == expressInfoMap.get(sellerOrder.getOrderCode()) ? "" : expressInfoMap.get(sellerOrder.getOrderCode()).getWaybillCode());
resp.setSellerOrderCode(sellerOrder.getOrderCode());
resp.setSkup(skup);
resp.setCreateTimeStr(null == item.getCreateTime() ? "" : DateUtil.long2DateStr(item.getCreateTime().longValue()*1000, "yyyy-MM-dd HH:mm:ss"));
resp.setUid(item.getUid());
resp.setProductName(sellerGoodsMap.get(skup).getProductName());
resp.setColorName(sellerGoodsMap.get(skup).getColorName());
resp.setSizeName(sellerGoodsMap.get(skup).getSizeName());
resp.setGoodsPrice(String.format("%.2f", buyerGoodsMap.get(item.getOrderCode()).getGoodsPrice().doubleValue()));
resp.setAmount(null == item.getAmount() ? null : String.format("%.2f", item.getAmount().doubleValue()));
respList.add(resp);
}
... ... @@ -222,11 +257,35 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
return respList;
}
private List<Byte> getStatusListByNavStatus(Integer navStatus) {
switch(navStatus) {
case 1: return Lists.newArrayList(Constant.BUYER_ORDER_STATUS_BUYER_NOT_PAY.getByteVal());
case 2: return Lists.newArrayList(Constant.BUYER_ORDER_STATUS_BUYER_PAYED.getByteVal());
case 3: return Lists.newArrayList(Constant.BUYER_ORDER_STATUS_ALLOCATING.getByteVal());
case 4: return Lists.newArrayList(Constant.BUYER_ORDER_STATUS_JUDGING.getByteVal());
case 5: return Lists.newArrayList(Constant.BUYER_ORDER_STATUS_TO_BE_RECEIVED.getByteVal());
case 6: return Lists.newArrayList(Constant.BUYER_ORDER_STATUS_FINISHED.getByteVal());
case 7: return Lists.newArrayList(Constant.BUYER_ORDER_STATUS_SELLER_CANCEL_BEFORE_PAY.getByteVal(),
Constant.BUYER_ORDER_STATUS_CANCEL_AFTER_PAY.getByteVal(),
Constant.BUYER_ORDER_STATUS_CANCEL_SENDGOODS_TIMEOUT.getByteVal(),
Constant.BUYER_ORDER_STATUS_JUDGE_NOT_PASS.getByteVal(),
Constant.BUYER_ORDER_STATUS_BUYER_CANCEL_BEFORE_PAY.getByteVal(),
Constant.BUYER_ORDER_STATUS_CANCEL_PAY_TIMEOUT.getByteVal(),
Constant.BUYER_ORDER_STATUS_SELLER_CANCEL_BEFORE_SENDGOODS.getByteVal(),
Constant.BUYER_ORDER_STATUS_CANCEL_BY_SERVICE_STAFF.getByteVal());
default:return Lists.newArrayList();
}
}
private boolean checkAndBuildParam(BuyerOrderReq req) {
if(StringUtils.isNotEmpty(req.getStatusStr())) {
req.setStatusList(convertStatus(req.getStatusStr()));
}
if(null != req.getNavStatus()) {
req.setStatusList(getStatusListByNavStatus(req.getNavStatus()));
}
if(StringUtils.isNotEmpty(req.getSellerWaybillCode())) {
ExpressInfo expressInfo = expressInfoMapper.selectByWaybillCode(req.getSellerWaybillCode());
if(null == expressInfo) {
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Yoho!Buy运营平台</title>
<script src="/ufoPlatform/js/include.js"></script>
<style>
.selected{background: #5bc0de; color:#fff; }
</style>
<style type="text/css">
.nav li {float:left; list-style:none;}
.nav li a{float:left;text-decoration:none;padding:0.2em 1.6em;border-right:1px solid white;color:black; font-size:14px;}
</style>
</head>
<body class="easyui-layout">
<div region="north" style="height:320px;">
<script>
document.write(addHead('订单管理', '订单列表'));
</script>
<input type="hidden" id="navStatus">
<div>
<ul id="basicTab" class="nav">
<li class="selected"><a href="javascript:switchOrderStatus(0);">全部</a></li>
<li><a href="javascript:switchOrderStatus(1);">待卖家付款</a></li>
<li><a href="javascript:switchOrderStatus(2);">待卖家发货</a></li>
<li><a href="javascript:switchOrderStatus(3);">平台鉴定中</a></li>
<li><a href="javascript:switchOrderStatus(4);">平台鉴定中</a></li>
<li><a href="javascript:switchOrderStatus(5);">平台已发货</a></li>
<li><a href="javascript:switchOrderStatus(6);">订单完成</a></li>
<li><a href="javascript:switchOrderStatus(7);">已取消</a></li>
</ul>
</div>
<br>
<div style="margin-left: 10px;margin-top: 30px">
<hr style="border:1px solid #ddd;"><br>
<div style="border:1px solid #ddd;border-radius:5px 5px 5px 5px;width:500px:height:200px">
<div style="margin-left: 10px;margin-top: 20px;margin-bottom: 20px">
<label>订单编号:</label>
<input id="orderCode" type="text" class="easyui-textbox" style="width:150px">
<label>买家UID:</label>
<input id="buyerUid" type="text" class="easyui-textbox" style="width:150px"/>
<label>卖家快递单号:</label>
<input id="sellerWaybillCode" type="text" class="easyui-textbox" style="width:150px"/>
<label>订单状态:</label>
<select id="status" class="easyui-combobox" style="width:100px;" >
<option value="">全部</option>
<option value="0">待买家付款</option>
<option value="1">待卖家发货</option>
<option value="2">卖家已发货</option>
<option value="3">平台鉴定中</option>
<option value="4">平台已发货</option>
<option value="5">订单完成</option>
<option value="10">已取消(买家付款前卖家)</option>
<option value="11">已取消(买家付款后卖家)</option>
<option value="12">已取消(超时未发货)</option>
<option value="13">已取消(鉴定不通过)</option>
<option value="14">已取消(支付前取消)</option>
<option value="15">已取消(超时未支付)</option>
<option value="16">已取消(已支付,卖家发货前取消)</option>
<option value="17">已取消(客服取消)</option>
</select>
<br><br>
<label>商品编码:</label>
<input id="productId" type="text" class="easyui-textbox" style="width:150px"/>
<label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SKU:</label>
<input id="sku" type="text" class="easyui-textbox" style="width:150px"/>
<label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;手机号:</label>
<input id="mobile" type="text" class="easyui-textbox" style="width:150px"/>
<label>&nbsp;&nbsp;&nbsp;SKU-P:</label>
<input id="skup" type="text" class="easyui-textbox" style="width:150px"/>
<a id="searchBtn" class="btn-info">查询</a>
<a id="allBtn" class="btn-success">全部</a>
</div>
</div>
</div>
</div>
<div id="orderList" region="center">
<table id="orderListTable"></table>
</div>
<script>
$(function() {
$("#basicTab li").click(function() {
$(this).siblings('li').removeClass('selected'); // 删除其他兄弟元素的样式
$(this).addClass('selected'); // 添加当前元素的样式
});
$("#searchBtn").linkbutton({
iconCls : "icon-search",
onClick : function() {
$("#orderListTable").datagrid("load", {
navStatus : document.getElementById("navStatus").value,
status : $("#status").myCombobox("getValue"),
orderCode : $("#orderCode").val(),
uid : $("#buyerUid").val(),
productId : $("#productId").val(),
storageId : $("#sku").val(),
skup : $("#skup").val(),
sellerWaybillCode : $("#sellerWaybillCode").val(),
mobile : $("#mobile").val()
});
}
});
//全部按钮
$("#allBtn").linkbutton({
iconCls: "icon-import",
onClick: function () {
$("#orderCode_").textbox('setValue','');
$("#uid").textbox('setValue','');
$("#sellerWaybillCode").textbox('setValue','');
$("#status").combobox('setValue','');
$("#productId").textbox('setValue','');
$("#sku").textbox('setValue','');
$("#mobile").textbox('setValue','');
$("#skup").textbox('setValue','');
$("#orderListTable").datagrid("load", {
navStatus : document.getElementById("navStatus").value
});
}
});
getOrderList();
});
function getOrderList(){
var navStatus = document.getElementById("navStatus").value;
$("#orderListTable").myDatagrid({
fit: true,
fitColumns: true,
striped: true,
url: contextPath + "/buyerOrder/queryOrderList",
method: 'POST',
queryParams: {
navStatus: navStatus
},
loadFilter: function (data) {
var temp = defaultLoadFilter(data);
temp=null==temp?[]:temp;
temp.rows = temp.list;
return temp;
},
columns: [[{
title: "订单编号",
field: "orderCode",
width: 30,
align: "center"
}, {
title: "买家UID",
field: "uid",
width: 20,
align: "center"
}, {
title: "商品名称",
field: "productName",
width: 20,
align: "center"
}, {
title: "颜色",
field: "colorName",
width: 20,
align: "center"
}, {
title: "尺码",
field: "sizeName",
width: 20,
align: "center"
}, {
title: "商品件数",
field: "productNum",
width: 20,
align: "center"
}, {
title: "商品金额",
field: "goodsPrice",
width: 20,
align: "center"
}, {
title: "实付",
field: "amount",
width: 20,
align: "center"
}, {
title: "订单状态",
field: "status",
width: 20,
align: "center",
formatter: function (value, rowData, rowIndex) {
if(value==0){
return "待买家付款";
}else if(value == 1){
return "待卖家发货";
}else if (value == 2) {
return "卖家已发货";
}else if(value == 3){
return "平台鉴定中";
}else if(value == 4){
return "平台已发货";
}else if(value == 5){
return "订单完成";
}else if(value == 10){
return "已取消(买家付款前卖家取消交易)";
}else if(value == 11){
return "已取消(买家付款后卖家取消交易)";
}else if(value == 12){
return "已取消(卖家发货超时)";
}else if(value == 13){
return "已取消(商品鉴定不通过)";
}else if(value == 14){
return "已取消(买家支付前取消)";
}else if(value == 15){
return "已取消(买家支付超时)";
}else if(value == 16){
return "已取消(卖家发货前取消)";
}else if(value == 17){
return "已取消(客服取消)"
}
}
},{
title: "下单时间",
field: "createTimeStr",
width: 30,
align: "center"
},{
title: "操作",
field: "asdf",
width: 30,
align: "center",
formatter: function (value, rowData, rowIndex) {
return "<a role='detail' dataId='"+ rowData.id +"' style='margin-left:10px;background-color: #5cb85c !important;'>详情</a>";
}
}]],
cache: false,
pagination: true,
pageSize: 20,
idField: "id",
singleSelect: true,
onLoadSuccess: function (data) {
$(this).datagrid("getPanel").find("a[role='detail']").linkbutton({
onClick: function () {
var id = $(this).attr("dataId");
$.messager.confirm("确认收货提醒", "是否确认收货?确认收货前请务必确定货品已到达仓库。", function(flag) {
if (flag) {
$.post(contextPath + "/buyerOrder/updateOrderStatus", {
id : id,
status : 3
}, function(data) {
if (data.code == 200) {
$("#orderListTable").datagrid("reload");
window.self.$.messager.show({
title : "提示",
msg : "确认收货成功!"
});
}else {
window.self.$.messager.alert("失败", "失败!", "error");
}
});
}
});
}
});
}
});
}
function switchOrderStatus(navStatus){
$("#navStatus").val(navStatus);
$("#orderCode_").textbox('setValue','');
$("#uid").textbox('setValue','');
$("#sellerWaybillCode").textbox('setValue','');
$("#status").combobox('setValue','');
$("#productId").textbox('setValue','');
$("#sku").textbox('setValue','');
$("#mobile").textbox('setValue','');
$("#skup").textbox('setValue','');
$("#orderListTable").datagrid("load", {
navStatus : navStatus
});
}
</script>
</body>
</html>
\ No newline at end of file
... ...