Authored by qinchao

Merge branch 'dev_fix_returnback' into test6.8.2

@@ -126,6 +126,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -126,6 +126,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
126 126
127 private static final Integer EXPRESS_TYPE_JUDGE_TO_SELLER = 3; 127 private static final Integer EXPRESS_TYPE_JUDGE_TO_SELLER = 3;
128 128
  129 + private static final Integer EXPRESS_TYPE_RETURN_BACK_TO_SELLER = 4;
  130 +
129 private static final Integer OPERATE_TYPE_UPDATE_SELLERWAYBILLCODE = 1;//修改卖家物流单号 131 private static final Integer OPERATE_TYPE_UPDATE_SELLERWAYBILLCODE = 1;//修改卖家物流单号
130 132
131 private static final Integer OPERATE_TYPE_UPDATE_RECEIVE_INFO = 2;//修改收货人信息 133 private static final Integer OPERATE_TYPE_UPDATE_RECEIVE_INFO = 2;//修改收货人信息
@@ -207,7 +209,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -207,7 +209,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
207 List<Integer> sellerExpressCompanyIdList = expressRecordList.stream().map(ExpressRecord::getLogisticsType).collect(Collectors.toList()); 209 List<Integer> sellerExpressCompanyIdList = expressRecordList.stream().map(ExpressRecord::getLogisticsType).collect(Collectors.toList());
208 210
209 //查询平台快递单号 211 //查询平台快递单号
210 - List<ExpressRecord> platformExpressList = expressRecordMapper.selectByOrderCodeListAndType(buyerOrderCodeList, Lists.newArrayList(EXPRESS_TYPE_JUDGE_TO_BUYER, EXPRESS_TYPE_JUDGE_TO_SELLER)); 212 + List<ExpressRecord> platformExpressList = expressRecordMapper.selectByOrderCodeListAndType(buyerOrderCodeList, Lists.newArrayList(EXPRESS_TYPE_JUDGE_TO_BUYER, EXPRESS_TYPE_JUDGE_TO_SELLER,EXPRESS_TYPE_RETURN_BACK_TO_SELLER));
211 Map<String, ExpressRecord> platformExpressRecordMap = platformExpressList.stream().collect(Collectors.toMap(ExpressRecord::getOrderCode, e->e)); 213 Map<String, ExpressRecord> platformExpressRecordMap = platformExpressList.stream().collect(Collectors.toMap(ExpressRecord::getOrderCode, e->e));
212 List<Integer> platformExpressCompanyIdList = platformExpressList.stream().map(ExpressRecord::getLogisticsType).collect(Collectors.toList()); 214 List<Integer> platformExpressCompanyIdList = platformExpressList.stream().map(ExpressRecord::getLogisticsType).collect(Collectors.toList());
213 215
@@ -278,6 +280,13 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -278,6 +280,13 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
278 throw new ServiceException(400,"错误:订单状态不合法,不允许寄回商品"); 280 throw new ServiceException(400,"错误:订单状态不合法,不允许寄回商品");
279 } 281 }
280 282
  283 + //查看是否存在寄回的物流信息,如果存在,则不允许再次寄回
  284 + ExpressRecord sellerExpressRecord = expressRecordMapper.selectByOrderCodeAndType(buyerOrder.getOrderCode(),
  285 + buyerOrder.getSellerUid(), EXPRESS_TYPE_RETURN_BACK_TO_SELLER);
  286 + if(null != sellerExpressRecord) {
  287 + throw new ServiceException(400,"错误:订单已存在寄回物流单["+sellerExpressRecord.getWaybillCode()+"]不允许再次寄回");
  288 + }
  289 +
281 //调用前台接口 290 //调用前台接口
282 String args = "orderAppraise.returnBack"; 291 String args = "orderAppraise.returnBack";
283 JSONObject jsonObject = asyncCallAppraise(args, buyerOrder.getOrderCode(), req); 292 JSONObject jsonObject = asyncCallAppraise(args, buyerOrder.getOrderCode(), req);
@@ -343,7 +352,19 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -343,7 +352,19 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
343 if(StringUtils.isEmpty(req.getOrderCode())) { 352 if(StringUtils.isEmpty(req.getOrderCode())) {
344 return result; 353 return result;
345 } 354 }
346 - ExpressRecord record = expressRecordMapper.selectByOrderCodeAndType(req.getOrderCode(), null, EXPRESS_TYPE_JUDGE_TO_SELLER); 355 +
  356 + BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(req.getOrderCode());
  357 + if(buyerOrder==null){
  358 + return result;
  359 + }
  360 +
  361 + Integer expressType=EXPRESS_TYPE_JUDGE_TO_SELLER;
  362 + //已取消的订单,状态不会再变了
  363 + if(buyerOrder.getStatus().byteValue()==Constant.BUYER_ORDER_STATUS_BUYER_CANCEL_AFTER_SELLER_DELIVERY.getByteVal()){
  364 + expressType =EXPRESS_TYPE_RETURN_BACK_TO_SELLER;
  365 + }
  366 +
  367 + ExpressRecord record = expressRecordMapper.selectByOrderCodeAndType(req.getOrderCode(), null, expressType);
347 if(null == record) { 368 if(null == record) {
348 return result; 369 return result;
349 } 370 }
@@ -279,9 +279,16 @@ function getToBeJudgedList(){ @@ -279,9 +279,16 @@ function getToBeJudgedList(){
279 return "<a role='pass' dataId='"+ rowData.id + "'" + " orderCode='"+rowData.orderCode +"' style='margin-left:10px;background-color: #5cb85c !important;'>鉴定通过</a>"+ 279 return "<a role='pass' dataId='"+ rowData.id + "'" + " orderCode='"+rowData.orderCode +"' style='margin-left:10px;background-color: #5cb85c !important;'>鉴定通过</a>"+
280 "<a role='reject' dataId='"+ rowData.id + "'" + " skup='"+rowData.skup +"' style='margin-left:10px;background-color: #d9534f !important;'>鉴定不通过</a>"; 280 "<a role='reject' dataId='"+ rowData.id + "'" + " skup='"+rowData.skup +"' style='margin-left:10px;background-color: #d9534f !important;'>鉴定不通过</a>";
281 } else if (rowData.status == 17) { 281 } else if (rowData.status == 17) {
  282 + if(rowData.platformWaybillCode){
  283 + return "<a role='send_back_rebackAddress' dataId='"+ rowData.orderCode +"' skup='"+ rowData.skup +"' style='margin-left:10px;background-color: #5cb85c !important;'>商品寄回地址</a>"
  284 + +"<a role='send_back_viewExpress' dataId='"+ rowData.orderCode + "' style='margin-left:10px;background-color: #5cb85c !important;'>查看物流</a>"
  285 + //+"<br/><span style='color:darkred;'>已寄回 ["+rowData.platformWaybillCode+"]</span>";
  286 + ;
  287 + }else{
282 return "<a role='reback' dataId='"+ rowData.id + "'" + " skup='"+rowData.skup +"' style='margin-left:10px;background-color: #5cb85c !important;'>寄回</a>"; 288 return "<a role='reback' dataId='"+ rowData.id + "'" + " skup='"+rowData.skup +"' style='margin-left:10px;background-color: #5cb85c !important;'>寄回</a>";
283 } 289 }
284 } 290 }
  291 + }
285 }]], 292 }]],
286 cache: false, 293 cache: false,
287 pagination: true, 294 pagination: true,
@@ -336,6 +343,25 @@ function getToBeJudgedList(){ @@ -336,6 +343,25 @@ function getToBeJudgedList(){
336 } 343 }
337 }); 344 });
338 345
  346 +
  347 + $(this).datagrid("getPanel").find("a[role='send_back_rebackAddress']").linkbutton({
  348 + onClick: function () {
  349 + var buyerOrderCode = $(this).attr("dataId");
  350 + $("#buyerOrderCode").val(buyerOrderCode);
  351 + var skup = $(this).attr("skup");
  352 + $("#skup").val(skup);
  353 + rebackAddressPage();
  354 + }
  355 + });
  356 +
  357 + $(this).datagrid("getPanel").find("a[role='send_back_viewExpress']").linkbutton({
  358 + onClick: function () {
  359 + var buyerOrderCode = $(this).attr("dataId");
  360 + $("#buyerOrderCode").val(buyerOrderCode);
  361 + viewExpressPage(buyerOrderCode);
  362 + }
  363 + });
  364 +
339 } 365 }
340 }); 366 });
341 } 367 }
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 function getExpressInfo(){ 21 function getExpressInfo(){
22 var form = new FormData(); 22 var form = new FormData();
23 form.append("orderCode", document.getElementById("buyerOrderCode").value); 23 form.append("orderCode", document.getElementById("buyerOrderCode").value);
24 - form.append("expressTypeStr", "2,3"); 24 + form.append("expressTypeStr", "2,3,4");
25 //发送请求 25 //发送请求
26 $.ajax({ 26 $.ajax({
27 type: "POST", 27 type: "POST",