Authored by mali

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

package com.yoho.order.dal;
import org.apache.ibatis.annotations.Param;
import com.yoho.order.model.BuyerOrderMeta;
/**
* Created by caoyan on 2018/9/12.
*/
public interface BuyerOrderMetaMapper {
BuyerOrderMeta selectByOrderCodeAndKey(@Param("orderCode") String orderCode, @Param("metaKey") String metaKey);
}
... ...
package com.yoho.order.model;
import java.io.Serializable;
/**
* @author caoyan
* @date 2018/9/13
*/
public class BuyerOrderMeta implements Serializable {
private static final long serialVersionUID = 2607922995706119816L;
private Integer id;
private Integer uid;
private String orderCode;
private String metaKey;
private String metaValue;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
public String getOrderCode() {
return orderCode;
}
public void setOrderCode(String orderCode) {
this.orderCode = orderCode;
}
public String getMetaKey() {
return metaKey;
}
public void setMetaKey(String metaKey) {
this.metaKey = metaKey;
}
public String getMetaValue() {
return metaValue;
}
public void setMetaValue(String metaValue) {
this.metaValue = metaValue;
}
@Override
public String toString() {
return "BuyerOrderMeta{" +
"id=" + id +
", uid='" + uid + '\'' +
", orderCode='" + orderCode + '\'' +
", metaKey='" + metaKey + '\'' +
", metaValue=" + metaValue +
'}';
}
}
... ...
... ... @@ -116,7 +116,7 @@ public class ExpressInfo implements Serializable {
@Override
public String toString() {
return "Brand{" +
return "ExpressInfo{" +
"id=" + id +
", uid='" + uid + '\'' +
", orderCode='" + orderCode + '\'' +
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.order.dal.BuyerOrderMetaMapper">
<resultMap id="BaseResultMap" type="com.yoho.order.model.BuyerOrderMeta">
<result column="id" property="id" jdbcType="INTEGER" />
<result column="uid" property="uid" jdbcType="INTEGER" />
<result column="order_code" property="orderCode" jdbcType="BIGINT" />
<result column="meta_key" property="metaKey" jdbcType="VARCHAR" />
<result column="meta_value" property="metaValue" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List">
id, uid, order_code, meta_key, meta_value
</sql>
<select id="selectByOrderCodeAndKey" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from buyer_order_meta where order_code=#{orderCode} and meta_key=#{metaKey}
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -2,6 +2,7 @@ package com.yoho.ufo.order.controller;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -46,6 +47,18 @@ public class BuyerOrderController {
}else {
return new ApiResponse.ApiResponseBuilder().code(500).message("更新失败").build();
}
}
@RequestMapping(value = "/getReceiveInfoByOrderCode")
public ApiResponse getReceiveInfoByOrderCode(BuyerOrderReq req) {
if(null == req || StringUtils.isEmpty(req.getOrderCode())) {
return new ApiResponse.ApiResponseBuilder().code(500).message("参数有误").build();
}
BuyerOrderResp result = buyerOrderService.getReceiveInfoByOrderCode(req);
if(null == result) {
return new ApiResponse.ApiResponseBuilder().code(500).message("获取收货信息失败").build();
}
return new ApiResponse.ApiResponseBuilder().code(200).message("获取信息成功").data(result).build();
}
}
... ...
... ... @@ -16,4 +16,6 @@ public interface IBuyerOrderService {
PageResponseBO<BuyerOrderResp> queryOrderList(BuyerOrderReq req);
int updateOrderStatus(BuyerOrderReq req);
BuyerOrderResp getReceiveInfoByOrderCode(BuyerOrderReq req);
}
... ...
... ... @@ -20,11 +20,13 @@ import com.yoho.core.common.utils.DateUtil;
import com.yoho.core.rest.client.ServiceCaller;
import com.yoho.order.dal.BuyerOrderGoodsMapper;
import com.yoho.order.dal.BuyerOrderMapper;
import com.yoho.order.dal.BuyerOrderMetaMapper;
import com.yoho.order.dal.ExpressInfoMapper;
import com.yoho.order.dal.SellerOrderGoodsMapper;
import com.yoho.order.dal.SellerOrderMapper;
import com.yoho.order.model.BuyerOrder;
import com.yoho.order.model.BuyerOrderGoods;
import com.yoho.order.model.BuyerOrderMeta;
import com.yoho.order.model.BuyerOrderReq;
import com.yoho.order.model.ExpressInfo;
import com.yoho.order.model.SellerOrder;
... ... @@ -59,8 +61,13 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
private SellerOrderGoodsMapper sellerOrderGoodsMapper;
@Autowired
private BuyerOrderMetaMapper buyerOrderMetaMapper;
@Autowired
private ServiceCaller serviceCaller;
private static final String BUYER_ORDER_META_KEY_DELIVERY_ADDRESS = "delivery_address";
public Map<String, Integer> getCountByJudgeStatus(){
List<Byte> toBeJudgedList = Lists.newArrayList();
List<Byte> alreadyJudgedList = Lists.newArrayList();
... ... @@ -130,7 +137,35 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
}
return buyerOrderMapper.updateStatusById(req.getId(), req.getStatus());
}
public BuyerOrderResp getReceiveInfoByOrderCode(BuyerOrderReq req) {
BuyerOrderMeta meta = buyerOrderMetaMapper.selectByOrderCodeAndKey(req.getOrderCode(), BUYER_ORDER_META_KEY_DELIVERY_ADDRESS);
if(null == meta) {
return null;
}
JSONObject metaValue = JSONObject.parseObject(meta.getMetaValue());
BuyerOrderResp result = new BuyerOrderResp();
result.setReceiveName(metaValue.getString("addresseeName"));
result.setReceiveMobile(metaValue.getString("mobile"));
result.setReceiveAddress(rebuildReceiveAddress(metaValue.getJSONObject("area")));
return result;
}
private String rebuildReceiveAddress(JSONObject address) {
String fourthName = address.getString("caption");
JSONObject thirdObj = address.getJSONObject("parent");
String thirdName = thirdObj.getString("caption");
JSONObject secondObj = thirdObj.getJSONObject("parent");
String secondName = secondObj.getString("caption");
JSONObject firstObj = secondObj.getJSONObject("parent");
String firstName = firstObj.getString("caption");
StringBuilder sb = new StringBuilder();
sb.append(firstName).append(secondName).append(thirdName).append(fourthName);
return sb.toString();
}
private List<BuyerOrderResp> convertToResp(List<BuyerOrder> orderList, Map<String, BuyerOrderGoods> buyerGoodsMap,
... ... @@ -147,6 +182,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
resp.setSkuStr(sellerGoodsMap.get(skup).getStorageId().toString());
resp.setDepotNo(sellerGoodsMap.get(skup).getDepotNo());
resp.setSellerWaybillCode(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"));
respList.add(resp);
... ...
... ... @@ -22,6 +22,7 @@ datasources:
- com.yoho.order.dal.SellerOrderGoodsMapper
- com.yoho.order.dal.ExpressInfoMapper
- com.yoho.order.dal.BuyerOrderGoodsMapper
- com.yoho.order.dal.BuyerOrderMetaMapper
readOnlyInSlave: true
... ...
... ... @@ -22,5 +22,6 @@ datasources:
- com.yoho.order.dal.SellerOrderGoodsMapper
- com.yoho.order.dal.ExpressInfoMapper
- com.yoho.order.dal.BuyerOrderGoodsMapper
- com.yoho.order.dal.BuyerOrderMetaMapper
readOnlyInSlave: ${readOnlyInSlave}
... ...
... ... @@ -6,6 +6,7 @@
<script src="/ufoPlatform/js/include.js"></script>
</head>
<body class="easyui-layout">
<input type="hidden" id="buyerOrderCode">
<div region="north" style="height:300px;">
<script>
document.write(addHead('鉴定中心', '列表管理'));
... ... @@ -261,8 +262,8 @@ function getToBeJudgedList(){
if (rowData.status == 2) {
return "<a role='confirm' dataId='"+ rowData.id +"' style='margin-left:10px;background-color: #5cb85c !important;'>确认收货</a>";
} else if (rowData.status == 3) {
return "<a role='pass' dataId='"+ rowData.id +"' style='margin-left:10px;background-color: #d9534f !important;'>鉴定通过</a>"+
"<a role='reject' dataId='"+ rowData.id +"' style='margin-left:10px;background-color: #5cb85c !important;'>鉴定不通过</a>";
return "<a role='pass' dataId='"+ rowData.orderCode +"' style='margin-left:10px;background-color: #5cb85c !important;'>鉴定通过</a>"+
"<a role='reject' dataId='"+ rowData.skup +"' style='margin-left:10px;background-color: #d9534f !important;'>鉴定不通过</a>";
}
}
}]],
... ... @@ -293,51 +294,20 @@ function getToBeJudgedList(){
});
}
});
}
});
$(this).datagrid("getPanel").find("a[role='pass']").linkbutton({
onClick: function () {
var shopsId = $(this).attr("dataId");
$.post(contextPath + "/couponLimit/shopStartOrStop.do", {
shopsIdForShop : shopsId,
shopLimitStatus : 0,
type : 0
}, function(data) {
if (data.code == CODE_SUCCESS) {
$("#limitListTable").datagrid("reload");
window.self.$.messager.show({
title : "提示",
msg : "关闭成功!"
});
} else {
window.self.$.messager.alert("失败", data.message, "error");
}
});
var buyerOrderCode = $(this).attr("dataId");
$("#buyerOrderCode").val(buyerOrderCode);
addPassPage();
}
});
$(this).datagrid("getPanel").find("a[role='reject']").linkbutton({
onClick: function () {
var shopsId = $(this).attr("dataId");
$.post(contextPath + "/couponLimit/shopStartOrStop.do", {
shopsIdForShop : shopsId,
shopLimitStatus : 0,
type : 0
}, function(data) {
if (data.code == CODE_SUCCESS) {
$("#limitListTable").datagrid("reload");
window.self.$.messager.show({
title : "提示",
msg : "关闭成功!"
});
} else {
window.self.$.messager.alert("失败", data.message, "error");
}
});
var skup = $(this).attr("dataId");
addRejectPage(skup);
}
});
... ... @@ -416,26 +386,26 @@ function getAlreadyJudgedList(){
});
}
function addConfirmPage() {
var div = $("<div id='confirmDiv'>").appendTo($(document.body));
var url = contextPath + "/html/promotion/useCouponLimit/add.html";
function addPassPage() {
var div = $("<div id='passDiv'>").appendTo($(document.body));
var url = contextPath + "/html/judgeCenter/pass.html";
$(div).myDialog({
width: "50%",
height: "40%",
title: "导入商品的用券限制",
height: "60%",
title: "发货(鉴定通过)",
href: url,
modal: true,
collapsible: true,
cache: false,
buttons: [{
text: "保存",
text: "发货",
id: "saveBtn",
iconCls: "icon-save",
onClick: function () {
$('#uploadFile').click();
}
}, {
text: "关闭",
text: "取消",
iconCls: "icon-cancel",
handler: function () {
$(div).dialog("close");
... ...
<!DOCTYPE html>
<html lang="en">
<head>
<title>main</title>
<script src="/ufoPlatform/js/include.js"></script>
</head>
<body class="easyui-layout" fit="true">
<div id="passDiv" region="center">
<table id="passTable" border="1px" cellpadding="1" cellspacing="0" align="center"
style="margin-top: 30px; line-height: 30px;width:95%;border-color: #999999">
<tr>
<td>买家地址:</td>
<td colspan="2" >
<span id="receiveInfo"></span>
</td>
</tr>
<tr>
<td>快递公司:</td>
<td colspan="2">
<input id="expressCompany" class="easyui-combobox"/>
</td>
</tr>
<tr>
<td>快递单号:</td>
<td colspan="2">
<input type="text" class="easyui-textbox" id="waybillCode" />
</td>
</tr>
</table>
</div>
<script>
$(function () {
//根据买家订单号获取买家收货地址
var form = new FormData();
form.append("orderCode", document.getElementById("buyerOrderCode").value);
//发送请求
$.ajax({
type: "POST",
url: contextPath + '/buyerOrder/getReceiveInfoByOrderCode',
data: form,
async: false,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function (result) {
if(result.code == 200) {
var name = result.data.receiveName;
var mobile = result.data.receiveMobile;
var address = result.data.receiveAddress;
$("#receiveInfo").html("姓名:" + name + "<br>" + "手机号:" + mobile + "<br>" + "地址:" + address);
}
else {
$.messager.alert("失败", result.message, "error");
}
}
});
// 快递公司下拉框
$("#expressCompanySelector").combobox({
valueField : "activityId",
textField : "activityName",
selectOnNavigation : true,
editable:false,
selectOnNavigation : true,
url : contextPath + "/MakePriceController/getActivityMenu.do",
// 品牌联动
onChange:function(data){
if(data == "") {
$("#name").textbox({disabled:false});
$("#startTime").datetimebox({disabled:false});
$("#endTime").datetimebox({disabled:false});
} else {
$("#name").textbox({disabled:true});
$("#startTime").datetimebox({disabled:true});
$("#endTime").datetimebox({disabled:true});
//创建formdata
var form = new FormData();
form.append("activityId", data);
//发送请求
$.ajax({
type: "POST",
url: contextPath + '/MakePriceController/getActivity.do',
data: form,
async: false,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function (result) {
if(result.code == 200) {
$("#name").textbox('setValue',result.data.title);
$("#startTime").datetimebox('setValue',result.data.effectiveTime);
$("#endTime").datetimebox('setValue',result.data.effectiveTimeEnd);
}
else {
$.messager.alert("失败", result.message, "error");
}
}
});
}
},
loadFilter: function (data) {
return defaultLoadFilter(data);
}
});
});
</script>
</body>
</html>
\ No newline at end of file
... ...