Authored by mali

Merge branch 'test6.9.7' of http://git.yoho.cn/ufo/ufo-platform into test6.9.7

@@ -134,4 +134,6 @@ public class BuyerOrderReq extends PageRequestBO{ @@ -134,4 +134,6 @@ public class BuyerOrderReq extends PageRequestBO{
134 private String sortRule; 134 private String sortRule;
135 135
136 private Integer region;//0:大陆 1:香港 136 private Integer region;//0:大陆 1:香港
  137 +
  138 + private String settleFailReason;
137 } 139 }
@@ -71,6 +71,20 @@ public class BuyerOrderController { @@ -71,6 +71,20 @@ public class BuyerOrderController {
71 } 71 }
72 } 72 }
73 73
  74 + @RequestMapping(value = "/settleFail")
  75 + public ApiResponse settleFail(BuyerOrderReq req) {
  76 + LOGGER.info("settleFail in. req is {}", req);
  77 + if (StringUtils.isAnyBlank(req.getOrderCode(), req.getSettleFailReason())) {
  78 + return new ApiResponse.ApiResponseBuilder().code(400).message("订单号或清关失败原因为空!").build();
  79 + }
  80 + JSONObject result = buyerOrderService.settleFail(req);
  81 + if (result != null && result.getIntValue("code") == 200) {
  82 + return new ApiResponse.ApiResponseBuilder().code(200).message("确认收货成功").build();
  83 + } else {
  84 + return new ApiResponse.ApiResponseBuilder().code(500).message(result == null ? "操作失败" : result.getString("message")).build();
  85 + }
  86 + }
  87 +
74 @RequestMapping(value = "/batchConfirmReceive") 88 @RequestMapping(value = "/batchConfirmReceive")
75 public ApiResponse batchConfirmReceive(BuyerOrderReq req) { 89 public ApiResponse batchConfirmReceive(BuyerOrderReq req) {
76 LOGGER.info("batchConfirmReceive in. req is {}", req); 90 LOGGER.info("batchConfirmReceive in. req is {}", req);
@@ -129,4 +129,6 @@ public interface IBuyerOrderService { @@ -129,4 +129,6 @@ public interface IBuyerOrderService {
129 129
130 // 查询鉴定室列表 130 // 查询鉴定室列表
131 List<IdentifyCenterResp> queryIdentifyCenter(); 131 List<IdentifyCenterResp> queryIdentifyCenter();
  132 +
  133 + JSONObject settleFail(BuyerOrderReq req);
132 } 134 }
@@ -40,7 +40,7 @@ public class BuyerOrderFeedbackService { @@ -40,7 +40,7 @@ public class BuyerOrderFeedbackService {
40 throw new ServiceException(400, "订单不存在"); 40 throw new ServiceException(400, "订单不存在");
41 } 41 }
42 UserHelper operator = new UserHelper(); 42 UserHelper operator = new UserHelper();
43 - if (Objects.isNull(operator.getUserId())) { 43 + if (Objects.isNull(operator.getUserId()) || operator.getUserId() < 1) {
44 throw new ServiceException(400, "请登录后操作"); 44 throw new ServiceException(400, "请登录后操作");
45 } 45 }
46 BuyerOrderFeedback feedback = new BuyerOrderFeedback(); 46 BuyerOrderFeedback feedback = new BuyerOrderFeedback();
@@ -914,6 +914,20 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon @@ -914,6 +914,20 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
914 return jsonObject; 914 return jsonObject;
915 } 915 }
916 916
  917 + public JSONObject settleFail(BuyerOrderReq req) {
  918 + BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(req.getOrderCode());
  919 + if (buyerOrder == null || buyerOrder.getStatus() != 4) {
  920 + throw new ServiceException(400, "错误:订单不存在或者订单状态变化,不允许清关失败");
  921 + }
  922 + buyerOrderFeedbackService.submitBuyerOrderFeedback(req.getOrderCode(),req.getSettleFailReason());
  923 + String args = "ufo-gateway.cancelOverseasOrderForBuyerClearFail";
  924 + JSONObject jsonObject = asyncCallSettleFail(args, buyerOrder.getOrderCode());
  925 +
  926 + LOGGER.info("settleFail orderCode is {} ,result json {}", req.getOrderCode(), jsonObject);
  927 +
  928 + return jsonObject;
  929 + }
  930 +
917 @Override 931 @Override
918 public void batchConfirmReceive(BuyerOrderReq req) { 932 public void batchConfirmReceive(BuyerOrderReq req) {
919 String sellerWaybillCode = req.getSellerWaybillCode(); 933 String sellerWaybillCode = req.getSellerWaybillCode();
@@ -1589,6 +1603,15 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon @@ -1589,6 +1603,15 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
1589 return jsonObject; 1603 return jsonObject;
1590 } 1604 }
1591 1605
  1606 + private JSONObject asyncCallSettleFail(String args, String orderCode) {
  1607 + LOGGER.info("asyncCallSettleFail call ufo-gateway enter orderCode is {}, interface is {},result is {}", orderCode, args);
  1608 + OrderRequest request = new OrderRequest();
  1609 + request.setOrderCode(Long.valueOf(orderCode));
  1610 + JSONObject jsonObject = serviceCaller.asyncCall(args, request, JSONObject.class).get(5, TimeUnit.SECONDS);
  1611 + LOGGER.info("asyncCallSettleFail call ufo-gateway orderCode is {}, interface is {},result is {}", orderCode, args, jsonObject);
  1612 + return jsonObject;
  1613 + }
  1614 +
1592 private JSONObject asyncCallAppraise(String args, String orderCode, BuyerOrderReq req) { 1615 private JSONObject asyncCallAppraise(String args, String orderCode, BuyerOrderReq req) {
1593 AppraiseExpressInfoBo bo = new AppraiseExpressInfoBo(); 1616 AppraiseExpressInfoBo bo = new AppraiseExpressInfoBo();
1594 bo.setOrderCode(Long.valueOf(orderCode)); 1617 bo.setOrderCode(Long.valueOf(orderCode));
@@ -149,7 +149,25 @@ @@ -149,7 +149,25 @@
149 <div id="orderList" region="center"> 149 <div id="orderList" region="center">
150 <table id="orderListTable"></table> 150 <table id="orderListTable"></table>
151 </div> 151 </div>
  152 +
  153 +<div id="settle" class="easyui-dialog" style="width:650px;height:300px;padding:10px 20px" closed="true" resizable="true" modal="true" data-options="iconCls: 'icon-delete',buttons: '#dlg-buttons'">
  154 + <div class="settleContentDiv">
  155 + <div class="sIClearFix">
  156 + <table>
  157 + <tr><td>失败原因:</td><td><input class="easyui-textbox" id="settleFailTextbox" data-options="multiline:true" style="width:300px;height:100px"/></td></tr>
  158 + </table>
  159 + </div>
  160 + </div>
  161 + <div class="btn">
  162 + <div style="text-align:right; padding-top:10px">
  163 + <a href="javascript:void(0)" class="easyui-linkbutton" id="settleFailBtn" iconcls="icon-ok">确定</a>
  164 + <a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-cancel" onclick="javascript:$('#settle').dialog('close')">关闭</a>
  165 + </div>
  166 + </div>
  167 +</div>
  168 +
152 <script> 169 <script>
  170 + var settleOrderCode = "";
153 $(function() { 171 $(function() {
154 $("#basicTab li").click(function() { 172 $("#basicTab li").click(function() {
155 $(this).siblings('li').removeClass('selected'); // 删除其他兄弟元素的样式 173 $(this).siblings('li').removeClass('selected'); // 删除其他兄弟元素的样式
@@ -334,6 +352,9 @@ function getOrderList(){ @@ -334,6 +352,9 @@ function getOrderList(){
334 352
335 } 353 }
336 } 354 }
  355 + if(rowData.status == 4 && (rowData.attributesStr=="海外现货" || rowData.attributesStr=="海外预售" )){
  356 + buttons += "<a role='settleFail' dataId='"+ rowData.orderCode +"' style='margin-left:10px;color:white;background-color: #D31225 !important;'>清关失败</a>";
  357 + }
337 return buttons; 358 return buttons;
338 } 359 }
339 }]], 360 }]],
@@ -354,6 +375,15 @@ function getOrderList(){ @@ -354,6 +375,15 @@ function getOrderList(){
354 } 375 }
355 }); 376 });
356 377
  378 + me.datagrid("getPanel").find("a[role='settleFail']").linkbutton({
  379 + onClick: function () {
  380 + var orderCode = $(this).attr("dataId");
  381 + settleOrderCode = orderCode;
  382 + $("#settleFailTextbox").textbox("setValue","");
  383 + $("#settle").dialog('open').dialog('setTitle', '清关失败确认');
  384 + }
  385 + });
  386 +
357 me.datagrid("getPanel").find("a[role='sellerDeliveryDealOrder']").linkbutton({ 387 me.datagrid("getPanel").find("a[role='sellerDeliveryDealOrder']").linkbutton({
358 onClick: function () { 388 onClick: function () {
359 var orderCode = $(this).attr("dataId"); 389 var orderCode = $(this).attr("dataId");
@@ -441,7 +471,6 @@ function switchOrderStatus(navStatus){ @@ -441,7 +471,6 @@ function switchOrderStatus(navStatus){
441 } 471 }
442 getOrderList(); 472 getOrderList();
443 } 473 }
444 -  
445 function getCountByNavStatus(){ 474 function getCountByNavStatus(){
446 //发送请求 475 //发送请求
447 $.ajax({ 476 $.ajax({
@@ -458,6 +487,7 @@ function getCountByNavStatus(){ @@ -458,6 +487,7 @@ function getCountByNavStatus(){
458 $("#num_0").html(result.data.num_0); 487 $("#num_0").html(result.data.num_0);
459 $("#num_1").html(result.data.num_1); 488 $("#num_1").html(result.data.num_1);
460 $("#num_2").html(result.data.num_2); 489 $("#num_2").html(result.data.num_2);
  490 +
461 $("#num_3").html(result.data.num_3); 491 $("#num_3").html(result.data.num_3);
462 $("#num_4").html(result.data.num_4); 492 $("#num_4").html(result.data.num_4);
463 $("#num_5").html(result.data.num_5); 493 $("#num_5").html(result.data.num_5);
@@ -477,6 +507,41 @@ function getCountByNavStatus(){ @@ -477,6 +507,41 @@ function getCountByNavStatus(){
477 }); 507 });
478 } 508 }
479 509
  510 + $("#settleFailBtn").linkbutton({
  511 + text: "确定",
  512 + iconCls : "icon-ok",
  513 + onClick : function() {
  514 + var param = {};
  515 + param.orderCode = settleOrderCode;
  516 + param.settleFailReason = $("#settleFailTextbox").textbox("getValue");
  517 + if(param.settleFailReason == ""){
  518 + $.messager.alert("提示消息", "请填写清关失败原因!");
  519 + return;
  520 + }
  521 + if(param.orderCode == ""){
  522 + $.messager.alert("提示消息", "订单号为空!");
  523 + return;
  524 + }
  525 + settleFail(param);
  526 + }
  527 + });
  528 +
  529 +function settleFail(param){
  530 + $.post(contextPath + "/buyerOrder/settleFail", param, function(result) {
  531 + if(result.code == 200) {
  532 + $('#settle').dialog('close');
  533 + $.messager.show({
  534 + title: "提示",
  535 + msg: result.message,
  536 + height: 120
  537 + });
  538 + }
  539 + else {
  540 + $.messager.alert("失败", result.message, "error");
  541 + }
  542 + });
  543 +}
  544 +
480 </script> 545 </script>
481 </body> 546 </body>
482 </html> 547 </html>