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{
private String sortRule;
private Integer region;//0:大陆 1:香港
private String settleFailReason;
}
... ...
... ... @@ -71,6 +71,20 @@ public class BuyerOrderController {
}
}
@RequestMapping(value = "/settleFail")
public ApiResponse settleFail(BuyerOrderReq req) {
LOGGER.info("settleFail in. req is {}", req);
if (StringUtils.isAnyBlank(req.getOrderCode(), req.getSettleFailReason())) {
return new ApiResponse.ApiResponseBuilder().code(400).message("订单号或清关失败原因为空!").build();
}
JSONObject result = buyerOrderService.settleFail(req);
if (result != null && result.getIntValue("code") == 200) {
return new ApiResponse.ApiResponseBuilder().code(200).message("确认收货成功").build();
} else {
return new ApiResponse.ApiResponseBuilder().code(500).message(result == null ? "操作失败" : result.getString("message")).build();
}
}
@RequestMapping(value = "/batchConfirmReceive")
public ApiResponse batchConfirmReceive(BuyerOrderReq req) {
LOGGER.info("batchConfirmReceive in. req is {}", req);
... ...
... ... @@ -129,4 +129,6 @@ public interface IBuyerOrderService {
// 查询鉴定室列表
List<IdentifyCenterResp> queryIdentifyCenter();
JSONObject settleFail(BuyerOrderReq req);
}
... ...
... ... @@ -40,7 +40,7 @@ public class BuyerOrderFeedbackService {
throw new ServiceException(400, "订单不存在");
}
UserHelper operator = new UserHelper();
if (Objects.isNull(operator.getUserId())) {
if (Objects.isNull(operator.getUserId()) || operator.getUserId() < 1) {
throw new ServiceException(400, "请登录后操作");
}
BuyerOrderFeedback feedback = new BuyerOrderFeedback();
... ...
... ... @@ -914,6 +914,20 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
return jsonObject;
}
public JSONObject settleFail(BuyerOrderReq req) {
BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(req.getOrderCode());
if (buyerOrder == null || buyerOrder.getStatus() != 4) {
throw new ServiceException(400, "错误:订单不存在或者订单状态变化,不允许清关失败");
}
buyerOrderFeedbackService.submitBuyerOrderFeedback(req.getOrderCode(),req.getSettleFailReason());
String args = "ufo-gateway.cancelOverseasOrderForBuyerClearFail";
JSONObject jsonObject = asyncCallSettleFail(args, buyerOrder.getOrderCode());
LOGGER.info("settleFail orderCode is {} ,result json {}", req.getOrderCode(), jsonObject);
return jsonObject;
}
@Override
public void batchConfirmReceive(BuyerOrderReq req) {
String sellerWaybillCode = req.getSellerWaybillCode();
... ... @@ -1589,6 +1603,15 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
return jsonObject;
}
private JSONObject asyncCallSettleFail(String args, String orderCode) {
LOGGER.info("asyncCallSettleFail call ufo-gateway enter orderCode is {}, interface is {},result is {}", orderCode, args);
OrderRequest request = new OrderRequest();
request.setOrderCode(Long.valueOf(orderCode));
JSONObject jsonObject = serviceCaller.asyncCall(args, request, JSONObject.class).get(5, TimeUnit.SECONDS);
LOGGER.info("asyncCallSettleFail call ufo-gateway orderCode is {}, interface is {},result is {}", orderCode, args, jsonObject);
return jsonObject;
}
private JSONObject asyncCallAppraise(String args, String orderCode, BuyerOrderReq req) {
AppraiseExpressInfoBo bo = new AppraiseExpressInfoBo();
bo.setOrderCode(Long.valueOf(orderCode));
... ...
... ... @@ -149,7 +149,25 @@
<div id="orderList" region="center">
<table id="orderListTable"></table>
</div>
<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'">
<div class="settleContentDiv">
<div class="sIClearFix">
<table>
<tr><td>失败原因:</td><td><input class="easyui-textbox" id="settleFailTextbox" data-options="multiline:true" style="width:300px;height:100px"/></td></tr>
</table>
</div>
</div>
<div class="btn">
<div style="text-align:right; padding-top:10px">
<a href="javascript:void(0)" class="easyui-linkbutton" id="settleFailBtn" iconcls="icon-ok">确定</a>
<a href="javascript:void(0)" class="easyui-linkbutton" iconcls="icon-cancel" onclick="javascript:$('#settle').dialog('close')">关闭</a>
</div>
</div>
</div>
<script>
var settleOrderCode = "";
$(function() {
$("#basicTab li").click(function() {
$(this).siblings('li').removeClass('selected'); // 删除其他兄弟元素的样式
... ... @@ -334,6 +352,9 @@ function getOrderList(){
}
}
if(rowData.status == 4 && (rowData.attributesStr=="海外现货" || rowData.attributesStr=="海外预售" )){
buttons += "<a role='settleFail' dataId='"+ rowData.orderCode +"' style='margin-left:10px;color:white;background-color: #D31225 !important;'>清关失败</a>";
}
return buttons;
}
}]],
... ... @@ -354,6 +375,15 @@ function getOrderList(){
}
});
me.datagrid("getPanel").find("a[role='settleFail']").linkbutton({
onClick: function () {
var orderCode = $(this).attr("dataId");
settleOrderCode = orderCode;
$("#settleFailTextbox").textbox("setValue","");
$("#settle").dialog('open').dialog('setTitle', '清关失败确认');
}
});
me.datagrid("getPanel").find("a[role='sellerDeliveryDealOrder']").linkbutton({
onClick: function () {
var orderCode = $(this).attr("dataId");
... ... @@ -441,7 +471,6 @@ function switchOrderStatus(navStatus){
}
getOrderList();
}
function getCountByNavStatus(){
//发送请求
$.ajax({
... ... @@ -458,6 +487,7 @@ function getCountByNavStatus(){
$("#num_0").html(result.data.num_0);
$("#num_1").html(result.data.num_1);
$("#num_2").html(result.data.num_2);
$("#num_3").html(result.data.num_3);
$("#num_4").html(result.data.num_4);
$("#num_5").html(result.data.num_5);
... ... @@ -477,6 +507,41 @@ function getCountByNavStatus(){
});
}
$("#settleFailBtn").linkbutton({
text: "确定",
iconCls : "icon-ok",
onClick : function() {
var param = {};
param.orderCode = settleOrderCode;
param.settleFailReason = $("#settleFailTextbox").textbox("getValue");
if(param.settleFailReason == ""){
$.messager.alert("提示消息", "请填写清关失败原因!");
return;
}
if(param.orderCode == ""){
$.messager.alert("提示消息", "订单号为空!");
return;
}
settleFail(param);
}
});
function settleFail(param){
$.post(contextPath + "/buyerOrder/settleFail", param, function(result) {
if(result.code == 200) {
$('#settle').dialog('close');
$.messager.show({
title: "提示",
msg: result.message,
height: 120
});
}
else {
$.messager.alert("失败", result.message, "error");
}
});
}
</script>
</body>
</html>
\ No newline at end of file
... ...