Authored by tanling

Merge branch 'master' of http://git.yoho.cn/ufo/yohoufo-fore

@@ -20,7 +20,7 @@ public class StoragePrice { @@ -20,7 +20,7 @@ public class StoragePrice {
20 20
21 private BigDecimal price; 21 private BigDecimal price;
22 22
23 - /** 1:可售,2卖出,3鉴定失败,4卖家取消. */ 23 + /** 1:可售,2卖出,3鉴定失败,4卖家取消, 5客服取消. */
24 private Integer status; 24 private Integer status;
25 25
26 private Integer updateTime; 26 private Integer updateTime;
@@ -78,7 +78,7 @@ @@ -78,7 +78,7 @@
78 from product 78 from product
79 </select> 79 </select>
80 <select id="selectByIds" resultMap="BaseResultMap"> 80 <select id="selectByIds" resultMap="BaseResultMap">
81 - select id, series_id from product where id in 81 + select id, product_name, product_code, series_id from product where id in
82 <foreach item="item" index="index" collection="list" 82 <foreach item="item" index="index" collection="list"
83 open="(" separator="," close=")"> 83 open="(" separator="," close=")">
84 #{item} 84 #{item}
@@ -4,51 +4,105 @@ import com.google.common.collect.Lists; @@ -4,51 +4,105 @@ import com.google.common.collect.Lists;
4 import com.yohoufo.order.constants.OrderDetailDesc; 4 import com.yohoufo.order.constants.OrderDetailDesc;
5 5
6 import java.util.Arrays; 6 import java.util.Arrays;
  7 +import java.util.HashMap;
7 import java.util.List; 8 import java.util.List;
  9 +import java.util.Map;
8 10
9 public enum OrderStatus { 11 public enum OrderStatus {
10 12
11 - WAITING_PAY(0,  
12 - "未付款", 13 +
  14 +
  15 +
  16 + WAITING_PAY(0, "未付款", new Node[]{
  17 + new Node(
13 "待付款", 18 "待付款",
14 Arrays.asList(ButtonShow.CANCEL_ORDER, ButtonShow.NOW_BUY), 19 Arrays.asList(ButtonShow.CANCEL_ORDER, ButtonShow.NOW_BUY),
15 Arrays.asList(ButtonShow.CANCEL_ORDER, ButtonShow.NOW_BUY), 20 Arrays.asList(ButtonShow.CANCEL_ORDER, ButtonShow.NOW_BUY),
16 - OrderDetailDesc.NO_PAY), 21 + OrderDetailDesc.NO_PAY
  22 + ),
  23 + new Node(
  24 + "待买家付款",
  25 + Arrays.asList(ButtonShow.SHOW_DETAIL),
  26 + null,
  27 + OrderDetailDesc.Seller.BUYER_NO_PAY
  28 + )
  29 + }),
17 30
18 - HAS_PAYED(1,  
19 - "已付款", 31 + HAS_PAYED(1, "已付款", new Node[]{
  32 + new Node(
20 "商品调拨中", 33 "商品调拨中",
21 Arrays.asList(ButtonShow.SHOW_DETAIL), 34 Arrays.asList(ButtonShow.SHOW_DETAIL),
22 Lists.newArrayList(), 35 Lists.newArrayList(),
23 - OrderDetailDesc.BUY_HAS_PAID),  
24 -  
25 - SELLER_SEND_OUT(2,  
26 - "商品调拨中(卖家发货,可查物流)", 36 + OrderDetailDesc.BUY_HAS_PAID
  37 + ),
  38 + new Node(
  39 + "待发货",
  40 + Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.NOT_SOLD, ButtonShow.DELIVER_GOODS),
  41 + Arrays.asList(ButtonShow.NOT_SOLD, ButtonShow.DELIVER_GOODS),
  42 + OrderDetailDesc.Seller.BUYER_HAS_PAID
  43 + )
  44 + }),
  45 +
  46 + SELLER_SEND_OUT(2, "商品调拨中(卖家发货,可查物流)", new Node[]{
  47 + new Node(
27 "商品调拨中", 48 "商品调拨中",
28 Arrays.asList(ButtonShow.SHOW_DETAIL), 49 Arrays.asList(ButtonShow.SHOW_DETAIL),
29 Lists.newArrayList(), 50 Lists.newArrayList(),
30 - OrderDetailDesc.SELL_HAS_SENDED),  
31 -  
32 - PLATFORM_CHECKING(3,  
33 - "有货平台鉴定中", 51 + OrderDetailDesc.SELL_HAS_SENDED
  52 + ),
  53 + new Node(
  54 + "已发货",
  55 + Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.SHOW_EXPRESS),
  56 + Arrays.asList(ButtonShow.SHOW_EXPRESS),
  57 + null
  58 + )
  59 + }),
  60 +
  61 + PLATFORM_CHECKING(3, "有货平台鉴定中", new Node[]{
  62 + new Node(
34 "有货平台鉴定中", 63 "有货平台鉴定中",
35 Arrays.asList(ButtonShow.SHOW_DETAIL), 64 Arrays.asList(ButtonShow.SHOW_DETAIL),
36 Lists.newArrayList(), 65 Lists.newArrayList(),
37 - OrderDetailDesc.PLATFORM_SEND),  
38 -  
39 - WAITING_RECEIVE(4,  
40 - "待收货", 66 + OrderDetailDesc.PLATFORM_SEND
  67 + ),
  68 + new Node(
  69 + "有货平台鉴定中",
  70 + Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.SHOW_EXPRESS),
  71 + Arrays.asList(ButtonShow.SHOW_EXPRESS),
  72 + OrderDetailDesc.Seller.IN_CHECK
  73 + )
  74 + }),
  75 +
  76 + WAITING_RECEIVE(4, "待收货", new Node[]{
  77 + new Node(
41 "待收货", 78 "待收货",
42 Arrays.asList(ButtonShow.SHOW_EXPRESS, ButtonShow.CONFIRM_DELIVERY), 79 Arrays.asList(ButtonShow.SHOW_EXPRESS, ButtonShow.CONFIRM_DELIVERY),
43 Arrays.asList(ButtonShow.SHOW_EXPRESS, ButtonShow.CONFIRM_DELIVERY), 80 Arrays.asList(ButtonShow.SHOW_EXPRESS, ButtonShow.CONFIRM_DELIVERY),
44 - OrderDetailDesc.CHECK_OK_SEND), 81 + OrderDetailDesc.CHECK_OK_SEND
  82 + ),
45 83
46 - DONE(5,  
47 - "已完成", 84 + new Node(
  85 + "交易成功",
  86 + Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.DEL_ORDER),
  87 + Arrays.asList( ButtonShow.DEL_ORDER),
  88 + OrderDetailDesc.Seller.TRADE_DONE
  89 + )
  90 + }),
  91 +
  92 + DONE(5, "已完成", new Node[]{
  93 + new Node(
48 "交易成功", 94 "交易成功",
49 Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER), 95 Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
50 Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER), 96 Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
51 - OrderDetailDesc.DONE), 97 + OrderDetailDesc.DONE
  98 + ),
  99 + new Node(
  100 + "交易成功",
  101 + Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.DEL_ORDER),
  102 + Arrays.asList( ButtonShow.DEL_ORDER),
  103 + OrderDetailDesc.Seller.TRADE_DONE
  104 + )
  105 + } ),
52 106
53 // TODO 这种状态不存在 107 // TODO 这种状态不存在
54 // SELLER_CANCEL_BEFORE_PAY(10, 108 // SELLER_CANCEL_BEFORE_PAY(10,
@@ -58,40 +112,57 @@ public enum OrderStatus { @@ -58,40 +112,57 @@ public enum OrderStatus {
58 // Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER), 112 // Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
59 // ), 113 // ),
60 114
61 - SELLER_CANCEL_AFTER_PAY(11,  
62 - "买家付款后卖家取消", 115 + SELLER_CANCEL_AFTER_PAY(11, "买家付款后卖家取消", new Node[]{
  116 + new Node(
63 "交易失败", 117 "交易失败",
64 Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER), 118 Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
65 Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER), 119 Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
66 - OrderDetailDesc.SELL_CANCEL_SEND), 120 + OrderDetailDesc.SELL_CANCEL_SEND
  121 + ),
  122 + buildFail4Seller(OrderDetailDesc.Seller.NO_SALE)
  123 + }
  124 + ),
67 125
68 - SEND_OUT_TIMEOUT(12,  
69 - "超时未发货取消", 126 + SEND_OUT_TIMEOUT(12, "超时未发货取消", new Node[]{
  127 + new Node(
70 "交易失败", 128 "交易失败",
71 Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER), 129 Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
72 Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER), 130 Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
73 - OrderDetailDesc.SELL_TIMETOUT_CANCEL), 131 + OrderDetailDesc.SELL_TIMETOUT_CANCEL
  132 + ),
  133 + buildFail4Seller(OrderDetailDesc.Seller.DELIVER_GOODS_TIMEOUT)
  134 + }
  135 + ),
74 136
75 - CHECKING_FAKE(13,  
76 - "鉴定不通过取消", 137 + CHECKING_FAKE(13, "鉴定不通过取消", new Node[]{
  138 + new Node(
77 "交易失败", 139 "交易失败",
78 Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER), 140 Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
79 Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER), 141 Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
80 - OrderDetailDesc.CHECK_FAKE), 142 + OrderDetailDesc.CHECK_FAKE
  143 + ),
  144 + buildFail4Seller(OrderDetailDesc.Seller.CHECK_FAIL)
  145 + }),
81 146
82 - BUYER_CANCEL_BEFORE_PAY(14,  
83 - "支付前取消", 147 + BUYER_CANCEL_BEFORE_PAY(14, "支付前取消", new Node[]{
  148 + new Node(
84 "交易失败", 149 "交易失败",
85 Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER), 150 Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
86 Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER), 151 Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
87 - OrderDetailDesc.BUY_CANCEL),  
88 -  
89 - BUYER_CANCEL_TIMEOUT(15,  
90 - "超时未支付取消",  
91 - "交易失败", 152 + OrderDetailDesc.BUY_CANCEL
  153 + ),
  154 + buildFail4Seller(OrderDetailDesc.Seller.BUYER_CANCEL)
  155 + }),
  156 +
  157 + BUYER_CANCEL_TIMEOUT(15, "超时未支付取消", new Node[]{
  158 + new Node(
  159 + "交易失败",
92 Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER), 160 Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
93 Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER), 161 Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
94 - OrderDetailDesc.BUY_TIMEOUT_CANCEL), 162 + OrderDetailDesc.BUY_TIMEOUT_CANCEL
  163 + ),
  164 + buildFail4Seller(OrderDetailDesc.Seller.BUYER_CANCEL_OF_TIMEOUT)
  165 + }),
95 166
96 // CUSTOMER_SERVICE(17, 167 // CUSTOMER_SERVICE(17,
97 // "客服取消", 168 // "客服取消",
@@ -104,72 +175,105 @@ public enum OrderStatus { @@ -104,72 +175,105 @@ public enum OrderStatus {
104 175
105 String desc; 176 String desc;
106 177
107 - /**  
108 - * 列表or详情显示状态  
109 - */  
110 - String statusStr;  
111 -  
112 - /**  
113 - * 订单列表中的按钮  
114 - */  
115 - List<ButtonShow> listButtons;  
116 -  
117 - /**  
118 - * 详情的按钮  
119 - */  
120 - List<ButtonShow> detailButtons;  
121 - 178 + Node[] nodes;
122 179
123 - /**  
124 - * 详情页状态说明  
125 - */  
126 - String detailDesc;  
127 180
  181 + static Node buildFail4Seller(String detailDesc){
  182 + return new Node(
  183 + "交易失败",
  184 + Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.DEL_ORDER),
  185 + Arrays.asList(ButtonShow.DEL_ORDER),
  186 + detailDesc
  187 + );
  188 + }
128 189
129 /** 190 /**
130 * 191 *
131 * @param code db中code 192 * @param code db中code
132 - * @param desc db中code的含义  
133 - * @param statusStr 订单列表中状态显示  
134 - * @param listButtons 订单列表显示的按钮 193 + * @param nodes db中code的含义
135 */ 194 */
136 - OrderStatus(int code, String desc, String statusStr, List<ButtonShow> listButtons,  
137 - List<ButtonShow> detailButtons, String detailDesc) { 195 + OrderStatus(int code, String desc, Node[] nodes) {
138 this.code = code; 196 this.code = code;
139 this.desc = desc; 197 this.desc = desc;
140 - this.statusStr = statusStr;  
141 - this.listButtons = listButtons;  
142 - this.detailButtons = detailButtons;  
143 - this.detailDesc = detailDesc; 198 + this.nodes = nodes;
144 } 199 }
145 200
146 public int getCode() { 201 public int getCode() {
147 return code; 202 return code;
148 } 203 }
149 204
  205 + private int getIndex(TabType actorType){
  206 + switch (actorType){
  207 + case BUY:
  208 + return 0;
  209 + case SELL:
  210 + return 1;
  211 + }
  212 + return -1;
  213 + }
150 214
151 - public List<ButtonShow> getListButtons() {  
152 - return listButtons; 215 + public List<ButtonShow> getListButtons(TabType actorType) {
  216 + return nodes[getIndex(actorType)].listButtons;
153 } 217 }
154 218
155 - public List<ButtonShow> getDetailButtons() {  
156 - return detailButtons; 219 + public List<ButtonShow> getDetailButtons(TabType actorType) {
  220 + return nodes[getIndex(actorType)].detailButtons;
157 } 221 }
158 222
159 - public String getDetailDesc() {  
160 - return detailDesc; 223 + public String getDetailDesc(TabType actorType) {
  224 + return nodes[getIndex(actorType)].detailDesc;
161 } 225 }
162 226
163 - public String getStatusStr() {  
164 - return statusStr; 227 + public String getStatusStr(TabType actorType) {
  228 + return nodes[getIndex(actorType)].statusStr;
165 } 229 }
166 230
167 - public static OrderStatus getOrderStatus(int code){ 231 + static Map<Integer,OrderStatus> localcache;
  232 +
  233 + static {
  234 + localcache = new HashMap<>();
168 for(OrderStatus v : values()){ 235 for(OrderStatus v : values()){
169 - if(v.code == code){  
170 - return v;  
171 - } 236 + localcache.put(v.code, v);
  237 + }
  238 + }
  239 +
  240 + public static OrderStatus getOrderStatus(int code){
  241 +
  242 + return localcache.get(code);
  243 + }
  244 +
  245 + public static class Node{
  246 +
  247 +
  248 +
  249 + /**
  250 + * 列表or详情显示状态
  251 + */
  252 + String statusStr;
  253 +
  254 + /**
  255 + * 订单列表中的按钮
  256 + */
  257 + List<ButtonShow> listButtons;
  258 +
  259 + /**
  260 + * 详情的按钮
  261 + */
  262 + List<ButtonShow> detailButtons;
  263 +
  264 + /**
  265 + * 详情页状态说明
  266 + */
  267 + String detailDesc;
  268 +
  269 + public Node(String statusStr,
  270 + List<ButtonShow> listButtons,
  271 + List<ButtonShow> detailButtons,
  272 + String detailDesc) {
  273 + this.statusStr = statusStr;
  274 + this.listButtons = listButtons;
  275 + this.detailButtons = detailButtons;
  276 + this.detailDesc = detailDesc;
172 } 277 }
173 - return null;  
174 } 278 }
175 } 279 }
@@ -58,4 +58,24 @@ public interface OrderDetailDesc { @@ -58,4 +58,24 @@ public interface OrderDetailDesc {
58 * 非直接显示 58 * 非直接显示
59 */ 59 */
60 String DONE = OrderConstant.EXPRESS_SENDTIME_TO_QUERY; 60 String DONE = OrderConstant.EXPRESS_SENDTIME_TO_QUERY;
  61 +
  62 + interface Seller{
  63 + String TRADE_DONE = "您出售的商品鉴定通过,支付的保证金已退还至您的支付账户,货款已打入您的有货账户,亲注意查收";
  64 +
  65 + String CHECK_FAIL = "您出售的商品鉴定未通过,商品已寄回,您支付的保证金已作为补偿赔付给买家";
  66 +
  67 + String BUYER_CANCEL = "买家取消订单,您的商品已重新上架出售";
  68 +
  69 + String BUYER_CANCEL_OF_TIMEOUT = "买家未在15分钟内付款,系统取消订单,您的商品已重新上架出售";
  70 +
  71 + String DELIVER_GOODS_TIMEOUT = "您未在48小时内发货,系统取消订单,您支付的保证金作已为补偿赔付给买家";
  72 +
  73 + String IN_CHECK = "有货鉴定中心已收货,您出售的商品正在鉴定中,如鉴定不通过则按您提供的收货地址寄回,您支付的保证金将作为补偿赔付给买家";
  74 +
  75 + String NO_SALE = "您已取消商品出售,您支付的保证金作已为补偿赔付给买家";
  76 +
  77 + String BUYER_HAS_PAID = "买家已付款,请于48小时内发货,超时发货系统自动取消订单并下架商品,您支付的保证金将作为补偿赔付给买家";
  78 +
  79 + String BUYER_NO_PAY = "等待买家付款,15分钟未付款将自动取消订单并重新上架商品";
  80 + }
61 } 81 }
@@ -34,6 +34,7 @@ public class BuyerOrderController { @@ -34,6 +34,7 @@ public class BuyerOrderController {
34 @ResponseBody 34 @ResponseBody
35 public ApiResponse getOrderList(@RequestParam("type") int type, 35 public ApiResponse getOrderList(@RequestParam("type") int type,
36 @RequestParam("uid") int uid, 36 @RequestParam("uid") int uid,
  37 + @RequestParam("tabType") String tabType,
37 @RequestParam(value = "page", required = false, defaultValue = "1") int page, 38 @RequestParam(value = "page", required = false, defaultValue = "1") int page,
38 @RequestParam(value = "limit", required = false, defaultValue = "10") int limit) { 39 @RequestParam(value = "limit", required = false, defaultValue = "10") int limit) {
39 40
@@ -42,6 +43,7 @@ public class BuyerOrderController { @@ -42,6 +43,7 @@ public class BuyerOrderController {
42 .type(type) 43 .type(type)
43 .page(page) 44 .page(page)
44 .limit(limit) 45 .limit(limit)
  46 + .tabType(tabType)
45 .build(); 47 .build();
46 OrderListInfoRsp orderListInfoRsp = buyerOrderService.getOrderList(orderListRequest); 48 OrderListInfoRsp orderListInfoRsp = buyerOrderService.getOrderList(orderListRequest);
47 49
@@ -18,4 +18,6 @@ public class OrderListRequest { @@ -18,4 +18,6 @@ public class OrderListRequest {
18 int page; 18 int page;
19 19
20 int limit; 20 int limit;
  21 +
  22 + String tabType;
21 } 23 }
@@ -16,4 +16,5 @@ public class OrderRequest { @@ -16,4 +16,5 @@ public class OrderRequest {
16 long orderCode; 16 long orderCode;
17 17
18 String tabType; 18 String tabType;
  19 +
19 } 20 }
@@ -133,6 +133,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -133,6 +133,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
133 } 133 }
134 134
135 if (TabType.BUY != tabType){ 135 if (TabType.BUY != tabType){
  136 + //todo 对于卖家出售中的订单处理
136 return new OrderDetailInfo(); 137 return new OrderDetailInfo();
137 } 138 }
138 139
@@ -170,19 +171,21 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -170,19 +171,21 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
170 throw new ServiceException(ServiceError.ORDER_ORDERS_GOODS_IS_EMPTY); 171 throw new ServiceException(ServiceError.ORDER_ORDERS_GOODS_IS_EMPTY);
171 } 172 }
172 173
173 - OrderDetailInfo orderDetailInfo = buildOrderDetail(buyerOrder, orderStatus, buyerOrderGoods, sellerOrderGoods); 174 + OrderDetailInfo orderDetailInfo = buildOrderDetail(buyerOrder, orderStatus, buyerOrderGoods, sellerOrderGoods, tabType);
174 175
175 return orderDetailInfo; 176 return orderDetailInfo;
176 177
177 } 178 }
178 179
179 - private OrderDetailInfo buildOrderDetail(BuyerOrder buyerOrder, OrderStatus orderStatus, BuyerOrderGoods buyerOrderGoods, SellerOrderGoods sellerOrderGoods) { 180 + private OrderDetailInfo buildOrderDetail(BuyerOrder buyerOrder, OrderStatus orderStatus,
  181 + BuyerOrderGoods buyerOrderGoods, SellerOrderGoods sellerOrderGoods,
  182 + TabType tabType) {
180 OrderDetailInfo orderDetailInfo = new OrderDetailInfo(); 183 OrderDetailInfo orderDetailInfo = new OrderDetailInfo();
181 orderDetailInfo.setUid(buyerOrder.getUid()); 184 orderDetailInfo.setUid(buyerOrder.getUid());
182 orderDetailInfo.setOrderCode(buyerOrder.getOrderCode()); 185 orderDetailInfo.setOrderCode(buyerOrder.getOrderCode());
183 - orderDetailInfo.setButtons(orderStatus.getDetailButtons()); 186 + orderDetailInfo.setButtons(orderStatus.getDetailButtons(tabType));
184 187
185 - OrderDetailInfo.StatusDetail statusDetail = getStatusDetail(buyerOrder, orderStatus); 188 + OrderDetailInfo.StatusDetail statusDetail = getStatusDetail(buyerOrder, orderStatus, tabType);
186 orderDetailInfo.setStatusDetail(statusDetail); 189 orderDetailInfo.setStatusDetail(statusDetail);
187 GoodsInfo goodsInfo = getGoodsInfo(sellerOrderGoods); 190 GoodsInfo goodsInfo = getGoodsInfo(sellerOrderGoods);
188 orderDetailInfo.setGoodsInfo(goodsInfo); 191 orderDetailInfo.setGoodsInfo(goodsInfo);
@@ -225,14 +228,14 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -225,14 +228,14 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
225 * @param orderStatus 228 * @param orderStatus
226 * @return 229 * @return
227 */ 230 */
228 - private OrderDetailInfo.StatusDetail getStatusDetail(BuyerOrder buyerOrder,OrderStatus orderStatus) { 231 + private OrderDetailInfo.StatusDetail getStatusDetail(BuyerOrder buyerOrder,OrderStatus orderStatus, TabType tabType) {
229 OrderDetailInfo.StatusDetail statusDetail = OrderDetailInfo.StatusDetail.builder() 232 OrderDetailInfo.StatusDetail statusDetail = OrderDetailInfo.StatusDetail.builder()
230 .status(orderStatus.getCode()) 233 .status(orderStatus.getCode())
231 - .statuStr(orderStatus.getStatusStr()) 234 + .statuStr(orderStatus.getStatusStr(tabType))
232 .build(); 235 .build();
233 236
234 // TODO 需要查询 时间点 and 物流定位 237 // TODO 需要查询 时间点 and 物流定位
235 - if (OrderConstant.EXPRESS_SENDTIME_TO_QUERY.equals(orderStatus.getDetailDesc())){ 238 + if (OrderConstant.EXPRESS_SENDTIME_TO_QUERY.equals(orderStatus.getDetailDesc(tabType))){
236 239
237 } 240 }
238 241
@@ -254,7 +257,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -254,7 +257,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
254 257
255 // check and init请求参数 258 // check and init请求参数
256 List<Integer> statusQuery = initOrderListRequest(request); 259 List<Integer> statusQuery = initOrderListRequest(request);
257 - 260 + TabType tabType = TabType.getTabType(request.getTabType());
258 int total = buyerOrderMapper.selectCntByUidStatus(request.getUid(), statusQuery); 261 int total = buyerOrderMapper.selectCntByUidStatus(request.getUid(), statusQuery);
259 262
260 int limit = request.getLimit(); 263 int limit = request.getLimit();
@@ -277,7 +280,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -277,7 +280,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
277 List<OrderListInfo> data = Lists.newArrayList(); 280 List<OrderListInfo> data = Lists.newArrayList();
278 281
279 buyerOrderList.stream().forEach(buyerOrder -> { 282 buyerOrderList.stream().forEach(buyerOrder -> {
280 - OrderListInfo orderListInfo = convertOrderInfo(buyerOrderGoodsMap, sellerOrderGoodsMap, buyerOrder); 283 + OrderListInfo orderListInfo = convertOrderInfo(buyerOrderGoodsMap, sellerOrderGoodsMap, buyerOrder, tabType);
281 if (orderListInfo == null) return; 284 if (orderListInfo == null) return;
282 285
283 data.add(orderListInfo); 286 data.add(orderListInfo);
@@ -305,7 +308,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -305,7 +308,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
305 */ 308 */
306 private OrderListInfo convertOrderInfo(Map<Long, BuyerOrderGoods> buyerOrderGoodsMap, 309 private OrderListInfo convertOrderInfo(Map<Long, BuyerOrderGoods> buyerOrderGoodsMap,
307 Map<Integer, SellerOrderGoods> sellerOrderGoodsMap, 310 Map<Integer, SellerOrderGoods> sellerOrderGoodsMap,
308 - BuyerOrder buyerOrder) { 311 + BuyerOrder buyerOrder,
  312 + TabType tabType) {
309 313
310 /** 314 /**
311 * 1.查询 buyer_order 315 * 1.查询 buyer_order
@@ -326,10 +330,10 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -326,10 +330,10 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
326 return null; 330 return null;
327 } 331 }
328 332
329 - orderListInfo.setStatuStr(orderStatus.getStatusStr()); 333 + orderListInfo.setStatuStr(orderStatus.getStatusStr(tabType));
330 334
331 // 按钮显示 335 // 按钮显示
332 - orderListInfo.setButtons(orderStatus.getListButtons()); 336 + orderListInfo.setButtons(orderStatus.getListButtons(tabType));
333 337
334 // 当订单状态是待付款, 显示leftTime 338 // 当订单状态是待付款, 显示leftTime
335 if (orderListInfo.getStatus() == OrderStatus.WAITING_PAY.getCode()){ 339 if (orderListInfo.getStatus() == OrderStatus.WAITING_PAY.getCode()){
@@ -3,6 +3,7 @@ package com.yohoufo.product.controller; @@ -3,6 +3,7 @@ package com.yohoufo.product.controller;
3 import java.util.concurrent.ExecutorService; 3 import java.util.concurrent.ExecutorService;
4 import java.util.concurrent.Executors; 4 import java.util.concurrent.Executors;
5 5
  6 +import com.yohoufo.product.response.*;
6 import org.apache.commons.lang3.StringUtils; 7 import org.apache.commons.lang3.StringUtils;
7 import org.slf4j.Logger; 8 import org.slf4j.Logger;
8 import org.slf4j.LoggerFactory; 9 import org.slf4j.LoggerFactory;
@@ -22,10 +23,6 @@ import com.yohoufo.common.caller.UfoServiceCaller; @@ -22,10 +23,6 @@ import com.yohoufo.common.caller.UfoServiceCaller;
22 import com.yohoufo.common.utils.UfoJsonUtil; 23 import com.yohoufo.common.utils.UfoJsonUtil;
23 import com.yohoufo.dal.product.model.StoragePrice; 24 import com.yohoufo.dal.product.model.StoragePrice;
24 import com.yohoufo.product.request.StoragePriceBo; 25 import com.yohoufo.product.request.StoragePriceBo;
25 -import com.yohoufo.product.response.ProductDetailResp;  
26 -import com.yohoufo.product.response.ProductSeriesTemplateResp;  
27 -import com.yohoufo.product.response.StorageDataResp;  
28 -import com.yohoufo.product.response.StorageLeastPriceResp;  
29 import com.yohoufo.product.service.ProductService; 26 import com.yohoufo.product.service.ProductService;
30 27
31 28
@@ -46,7 +43,7 @@ public class ProductController { @@ -46,7 +43,7 @@ public class ProductController {
46 @RequestMapping(params = "method=ufo.product.data") 43 @RequestMapping(params = "method=ufo.product.data")
47 @Cachable(expire=600) 44 @Cachable(expire=600)
48 public ApiResponse queryProductDetailById( 45 public ApiResponse queryProductDetailById(
49 - @RequestParam(value = "product_id", required = true) Integer productId) { 46 + @RequestParam(value = "product_id") Integer productId) {
50 47
51 if (null == productId) { 48 if (null == productId) {
52 return new ApiResponse(400, "product_id Is Null", null); 49 return new ApiResponse(400, "product_id Is Null", null);
@@ -57,19 +54,33 @@ public class ProductController { @@ -57,19 +54,33 @@ public class ProductController {
57 return new ApiResponse.ApiResponseBuilder().data(resp).code(200).message("product data").build(); 54 return new ApiResponse.ApiResponseBuilder().data(resp).code(200).message("product data").build();
58 } 55 }
59 56
  57 + @ApiOperation(name = "ufo.product.series.template", desc="商品系列列表")
  58 + @IgnoreSignature
  59 + @IgnoreSession
  60 + @RequestMapping(params = "method=ufo.product.series.template")
  61 + //@Cachable(expire=600)
  62 + public ApiResponse querySeriesTemplateData(
  63 + @RequestParam(value = "product_ids") String productIds) {
  64 +
  65 + if (StringUtils.isBlank(productIds)) {
  66 + return new ApiResponse(400, "productIds Is Null", null);
  67 + }
  68 + ProductSeriesTemplateResp resp = productService.querySeriesTemplateData(productIds);
  69 + return new ApiResponse.ApiResponseBuilder().data(resp).code(200).message("product data").build();
  70 + }
  71 +
60 @ApiOperation(name = "ufo.product.sort.template", desc="商品列表") 72 @ApiOperation(name = "ufo.product.sort.template", desc="商品列表")
61 @IgnoreSignature 73 @IgnoreSignature
62 @IgnoreSession 74 @IgnoreSession
63 @RequestMapping(params = "method=ufo.product.sort.template") 75 @RequestMapping(params = "method=ufo.product.sort.template")
64 //@Cachable(expire=600) 76 //@Cachable(expire=600)
65 public ApiResponse querySortTemplateData( 77 public ApiResponse querySortTemplateData(
66 - @RequestParam(value = "skns", required = false) String skns) { 78 + @RequestParam(value = "product_ids") String productIds) {
67 79
68 - if (StringUtils.isBlank(skns)) {  
69 - return new ApiResponse(500, "skns Is Null", null); 80 + if (StringUtils.isBlank(productIds)) {
  81 + return new ApiResponse(400, "productIds Is Null", null);
70 } 82 }
71 -  
72 - ProductSeriesTemplateResp resp = productService.querySortTemplateData(skns); 83 + ProductSortTemplateResp resp = productService.querySortTemplateData(productIds);
73 return new ApiResponse.ApiResponseBuilder().data(resp).code(200).message("product data").build(); 84 return new ApiResponse.ApiResponseBuilder().data(resp).code(200).message("product data").build();
74 } 85 }
75 86
  1 +package com.yohoufo.product.model;
  2 +
  3 +import com.alibaba.fastjson.annotation.JSONField;
  4 +import lombok.Data;
  5 +
  6 +@Data
  7 +public class ProductSortTemplate {
  8 +
  9 + @JSONField(name = "image_url")
  10 + private String imageUrl;
  11 + @JSONField(name = "product_id")
  12 + private Integer productId;
  13 + @JSONField(name = "product_name")
  14 + private String productName;
  15 + @JSONField(name = "product_code")
  16 + private String productCode;
  17 +}
  1 +package com.yohoufo.product.response;
  2 +
  3 +import com.yohoufo.product.model.ProductSortTemplate;
  4 +
  5 +import java.util.List;
  6 +
  7 +public class ProductSortTemplateResp {
  8 +
  9 + private List<ProductSortTemplate> list;
  10 +
  11 +
  12 + public List<ProductSortTemplate> getList() {
  13 + return list;
  14 + }
  15 +
  16 + public void setList(List<ProductSortTemplate> list) {
  17 + this.list = list;
  18 + }
  19 +}
@@ -2,10 +2,7 @@ package com.yohoufo.product.service; @@ -2,10 +2,7 @@ package com.yohoufo.product.service;
2 2
3 import com.yohoufo.dal.product.model.StoragePrice; 3 import com.yohoufo.dal.product.model.StoragePrice;
4 import com.yohoufo.product.request.StoragePriceBo; 4 import com.yohoufo.product.request.StoragePriceBo;
5 -import com.yohoufo.product.response.ProductDetailResp;  
6 -import com.yohoufo.product.response.ProductSeriesTemplateResp;  
7 -import com.yohoufo.product.response.StorageDataResp;  
8 -import com.yohoufo.product.response.StorageLeastPriceResp; 5 +import com.yohoufo.product.response.*;
9 6
10 public interface ProductService { 7 public interface ProductService {
11 8
@@ -23,7 +20,9 @@ public interface ProductService { @@ -23,7 +20,9 @@ public interface ProductService {
23 20
24 StoragePrice getStoragePriceBySkup(Integer skup); 21 StoragePrice getStoragePriceBySkup(Integer skup);
25 22
26 - ProductSeriesTemplateResp querySortTemplateData(String skns); 23 + ProductSeriesTemplateResp querySeriesTemplateData(String skns);
  24 +
  25 + ProductSortTemplateResp querySortTemplateData(String productIds);
27 26
28 27
29 } 28 }
@@ -11,9 +11,7 @@ import com.yohoufo.common.utils.UfoStringUtils; @@ -11,9 +11,7 @@ import com.yohoufo.common.utils.UfoStringUtils;
11 import com.yohoufo.dal.product.*; 11 import com.yohoufo.dal.product.*;
12 import com.yohoufo.dal.product.model.*; 12 import com.yohoufo.dal.product.model.*;
13 import com.yohoufo.product.model.*; 13 import com.yohoufo.product.model.*;
14 -import com.yohoufo.product.response.ProductSeriesTemplateResp;  
15 -import com.yohoufo.product.response.StorageDataResp;  
16 -import com.yohoufo.product.response.StorageLeastPriceResp; 14 +import com.yohoufo.product.response.*;
17 import org.apache.commons.lang3.StringUtils; 15 import org.apache.commons.lang3.StringUtils;
18 import org.slf4j.Logger; 16 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory; 17 import org.slf4j.LoggerFactory;
@@ -22,7 +20,6 @@ import org.springframework.stereotype.Service; @@ -22,7 +20,6 @@ import org.springframework.stereotype.Service;
22 20
23 import com.yoho.error.exception.ServiceException; 21 import com.yoho.error.exception.ServiceException;
24 import com.yohoufo.product.request.StoragePriceBo; 22 import com.yohoufo.product.request.StoragePriceBo;
25 -import com.yohoufo.product.response.ProductDetailResp;  
26 import com.yohoufo.product.service.ProductService; 23 import com.yohoufo.product.service.ProductService;
27 import com.yohoufo.resource.util.DateUtils; 24 import com.yohoufo.resource.util.DateUtils;
28 import org.springframework.util.CollectionUtils; 25 import org.springframework.util.CollectionUtils;
@@ -136,7 +133,34 @@ public class ProductServiceImpl implements ProductService{ @@ -136,7 +133,34 @@ public class ProductServiceImpl implements ProductService{
136 } 133 }
137 134
138 @Override 135 @Override
139 - public ProductSeriesTemplateResp querySortTemplateData(String skns) { 136 + public ProductSortTemplateResp querySortTemplateData(String productIds) {
  137 + ProductSortTemplateResp resp = new ProductSortTemplateResp();
  138 + List<ProductSortTemplate> list = new ArrayList<>();
  139 + resp.setList(list);
  140 + List<Integer> productList = UfoStringUtils.string2IntegerList(productIds);
  141 + if (!CollectionUtils.isEmpty(productList)) {
  142 + List<Product> products = productMapper.selectByIds(productList);
  143 + if (!CollectionUtils.isEmpty(products)) {
  144 + List<Goods> goodsList = goodsMapper.selectByProductIds(productList);
  145 + Map<Integer, List<Goods>> productGoodsMap = goodsList.stream().collect(Collectors.groupingBy(Goods::getProductId));
  146 + for (Product product : products) {
  147 + List<Goods> pgList = productGoodsMap.get(product.getId());
  148 + if (!CollectionUtils.isEmpty(pgList) && pgList.get(0) != null && StringUtils.isNotBlank(pgList.get(0).getColorImage())) {
  149 + ProductSortTemplate productSortTemplate = new ProductSortTemplate();
  150 + productSortTemplate.setProductId(product.getId());
  151 + productSortTemplate.setProductName(product.getProductName());
  152 + productSortTemplate.setProductCode(product.getProductCode());
  153 + productSortTemplate.setImageUrl(pgList.get(0).getColorImage());
  154 + list.add(productSortTemplate);
  155 + }
  156 + }
  157 + }
  158 + }
  159 + return resp;
  160 + }
  161 +
  162 + @Override
  163 + public ProductSeriesTemplateResp querySeriesTemplateData(String skns) {
140 ProductSeriesTemplateResp resp = new ProductSeriesTemplateResp(); 164 ProductSeriesTemplateResp resp = new ProductSeriesTemplateResp();
141 List<Integer> sknlist = UfoStringUtils.string2IntegerList(skns); 165 List<Integer> sknlist = UfoStringUtils.string2IntegerList(skns);
142 if (!CollectionUtils.isEmpty(sknlist)) { 166 if (!CollectionUtils.isEmpty(sknlist)) {
@@ -307,6 +331,7 @@ public class ProductServiceImpl implements ProductService{ @@ -307,6 +331,7 @@ public class ProductServiceImpl implements ProductService{
307 sp.setDepotNum(depotNum); 331 sp.setDepotNum(depotNum);
308 sp.setSkup(skup); 332 sp.setSkup(skup);
309 sp.setCreateTime((int) (System.currentTimeMillis() / 1000)); 333 sp.setCreateTime((int) (System.currentTimeMillis() / 1000));
  334 + sp.setUpdateTime(0);
310 sp.setStatus(1); 335 sp.setStatus(1);
311 return sp; 336 return sp;
312 } 337 }