Authored by mali

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

  1 +package com.yoho.order.dal;
  2 +
  3 +import org.apache.ibatis.annotations.Param;
  4 +
  5 +import com.yoho.order.model.BuyerOrderMeta;
  6 +
  7 +/**
  8 + * Created by caoyan on 2018/9/12.
  9 + */
  10 +public interface BuyerOrderMetaMapper {
  11 +
  12 + BuyerOrderMeta selectByOrderCodeAndKey(@Param("orderCode") String orderCode, @Param("metaKey") String metaKey);
  13 +}
  1 +package com.yoho.order.model;
  2 +
  3 +import java.io.Serializable;
  4 +
  5 +/**
  6 + * @author caoyan
  7 + * @date 2018/9/13
  8 + */
  9 +public class BuyerOrderMeta implements Serializable {
  10 +
  11 +
  12 + private static final long serialVersionUID = 2607922995706119816L;
  13 +
  14 + private Integer id;
  15 +
  16 + private Integer uid;
  17 +
  18 + private String orderCode;
  19 +
  20 + private String metaKey;
  21 +
  22 + private String metaValue;
  23 +
  24 + public Integer getId() {
  25 + return id;
  26 + }
  27 +
  28 + public void setId(Integer id) {
  29 + this.id = id;
  30 + }
  31 +
  32 + public Integer getUid() {
  33 + return uid;
  34 + }
  35 +
  36 + public void setUid(Integer uid) {
  37 + this.uid = uid;
  38 + }
  39 +
  40 + public String getOrderCode() {
  41 + return orderCode;
  42 + }
  43 +
  44 + public void setOrderCode(String orderCode) {
  45 + this.orderCode = orderCode;
  46 + }
  47 +
  48 + public String getMetaKey() {
  49 + return metaKey;
  50 + }
  51 +
  52 + public void setMetaKey(String metaKey) {
  53 + this.metaKey = metaKey;
  54 + }
  55 +
  56 + public String getMetaValue() {
  57 + return metaValue;
  58 + }
  59 +
  60 + public void setMetaValue(String metaValue) {
  61 + this.metaValue = metaValue;
  62 + }
  63 +
  64 + @Override
  65 + public String toString() {
  66 + return "BuyerOrderMeta{" +
  67 + "id=" + id +
  68 + ", uid='" + uid + '\'' +
  69 + ", orderCode='" + orderCode + '\'' +
  70 + ", metaKey='" + metaKey + '\'' +
  71 + ", metaValue=" + metaValue +
  72 + '}';
  73 + }
  74 +}
@@ -116,7 +116,7 @@ public class ExpressInfo implements Serializable { @@ -116,7 +116,7 @@ public class ExpressInfo implements Serializable {
116 116
117 @Override 117 @Override
118 public String toString() { 118 public String toString() {
119 - return "Brand{" + 119 + return "ExpressInfo{" +
120 "id=" + id + 120 "id=" + id +
121 ", uid='" + uid + '\'' + 121 ", uid='" + uid + '\'' +
122 ", orderCode='" + orderCode + '\'' + 122 ", orderCode='" + orderCode + '\'' +
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3 +<mapper namespace="com.yoho.order.dal.BuyerOrderMetaMapper">
  4 + <resultMap id="BaseResultMap" type="com.yoho.order.model.BuyerOrderMeta">
  5 + <result column="id" property="id" jdbcType="INTEGER" />
  6 + <result column="uid" property="uid" jdbcType="INTEGER" />
  7 + <result column="order_code" property="orderCode" jdbcType="BIGINT" />
  8 + <result column="meta_key" property="metaKey" jdbcType="VARCHAR" />
  9 + <result column="meta_value" property="metaValue" jdbcType="VARCHAR" />
  10 + </resultMap>
  11 +
  12 + <sql id="Base_Column_List">
  13 + id, uid, order_code, meta_key, meta_value
  14 + </sql>
  15 +
  16 + <select id="selectByOrderCodeAndKey" resultMap="BaseResultMap">
  17 + select <include refid="Base_Column_List" />
  18 + from buyer_order_meta where order_code=#{orderCode} and meta_key=#{metaKey}
  19 + </select>
  20 +
  21 +</mapper>
@@ -2,6 +2,7 @@ package com.yoho.ufo.order.controller; @@ -2,6 +2,7 @@ package com.yoho.ufo.order.controller;
2 2
3 import java.util.Map; 3 import java.util.Map;
4 4
  5 +import org.apache.commons.lang3.StringUtils;
5 import org.slf4j.Logger; 6 import org.slf4j.Logger;
6 import org.slf4j.LoggerFactory; 7 import org.slf4j.LoggerFactory;
7 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
@@ -46,6 +47,18 @@ public class BuyerOrderController { @@ -46,6 +47,18 @@ public class BuyerOrderController {
46 }else { 47 }else {
47 return new ApiResponse.ApiResponseBuilder().code(500).message("更新失败").build(); 48 return new ApiResponse.ApiResponseBuilder().code(500).message("更新失败").build();
48 } 49 }
  50 + }
  51 +
  52 + @RequestMapping(value = "/getReceiveInfoByOrderCode")
  53 + public ApiResponse getReceiveInfoByOrderCode(BuyerOrderReq req) {
  54 + if(null == req || StringUtils.isEmpty(req.getOrderCode())) {
  55 + return new ApiResponse.ApiResponseBuilder().code(500).message("参数有误").build();
  56 + }
49 57
  58 + BuyerOrderResp result = buyerOrderService.getReceiveInfoByOrderCode(req);
  59 + if(null == result) {
  60 + return new ApiResponse.ApiResponseBuilder().code(500).message("获取收货信息失败").build();
  61 + }
  62 + return new ApiResponse.ApiResponseBuilder().code(200).message("获取信息成功").data(result).build();
50 } 63 }
51 } 64 }
@@ -16,4 +16,6 @@ public interface IBuyerOrderService { @@ -16,4 +16,6 @@ public interface IBuyerOrderService {
16 PageResponseBO<BuyerOrderResp> queryOrderList(BuyerOrderReq req); 16 PageResponseBO<BuyerOrderResp> queryOrderList(BuyerOrderReq req);
17 17
18 int updateOrderStatus(BuyerOrderReq req); 18 int updateOrderStatus(BuyerOrderReq req);
  19 +
  20 + BuyerOrderResp getReceiveInfoByOrderCode(BuyerOrderReq req);
19 } 21 }
@@ -20,11 +20,13 @@ import com.yoho.core.common.utils.DateUtil; @@ -20,11 +20,13 @@ import com.yoho.core.common.utils.DateUtil;
20 import com.yoho.core.rest.client.ServiceCaller; 20 import com.yoho.core.rest.client.ServiceCaller;
21 import com.yoho.order.dal.BuyerOrderGoodsMapper; 21 import com.yoho.order.dal.BuyerOrderGoodsMapper;
22 import com.yoho.order.dal.BuyerOrderMapper; 22 import com.yoho.order.dal.BuyerOrderMapper;
  23 +import com.yoho.order.dal.BuyerOrderMetaMapper;
23 import com.yoho.order.dal.ExpressInfoMapper; 24 import com.yoho.order.dal.ExpressInfoMapper;
24 import com.yoho.order.dal.SellerOrderGoodsMapper; 25 import com.yoho.order.dal.SellerOrderGoodsMapper;
25 import com.yoho.order.dal.SellerOrderMapper; 26 import com.yoho.order.dal.SellerOrderMapper;
26 import com.yoho.order.model.BuyerOrder; 27 import com.yoho.order.model.BuyerOrder;
27 import com.yoho.order.model.BuyerOrderGoods; 28 import com.yoho.order.model.BuyerOrderGoods;
  29 +import com.yoho.order.model.BuyerOrderMeta;
28 import com.yoho.order.model.BuyerOrderReq; 30 import com.yoho.order.model.BuyerOrderReq;
29 import com.yoho.order.model.ExpressInfo; 31 import com.yoho.order.model.ExpressInfo;
30 import com.yoho.order.model.SellerOrder; 32 import com.yoho.order.model.SellerOrder;
@@ -59,8 +61,13 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -59,8 +61,13 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
59 private SellerOrderGoodsMapper sellerOrderGoodsMapper; 61 private SellerOrderGoodsMapper sellerOrderGoodsMapper;
60 62
61 @Autowired 63 @Autowired
  64 + private BuyerOrderMetaMapper buyerOrderMetaMapper;
  65 +
  66 + @Autowired
62 private ServiceCaller serviceCaller; 67 private ServiceCaller serviceCaller;
63 68
  69 + private static final String BUYER_ORDER_META_KEY_DELIVERY_ADDRESS = "delivery_address";
  70 +
64 public Map<String, Integer> getCountByJudgeStatus(){ 71 public Map<String, Integer> getCountByJudgeStatus(){
65 List<Byte> toBeJudgedList = Lists.newArrayList(); 72 List<Byte> toBeJudgedList = Lists.newArrayList();
66 List<Byte> alreadyJudgedList = Lists.newArrayList(); 73 List<Byte> alreadyJudgedList = Lists.newArrayList();
@@ -130,7 +137,35 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -130,7 +137,35 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
130 } 137 }
131 138
132 return buyerOrderMapper.updateStatusById(req.getId(), req.getStatus()); 139 return buyerOrderMapper.updateStatusById(req.getId(), req.getStatus());
  140 + }
  141 +
  142 + public BuyerOrderResp getReceiveInfoByOrderCode(BuyerOrderReq req) {
  143 + BuyerOrderMeta meta = buyerOrderMetaMapper.selectByOrderCodeAndKey(req.getOrderCode(), BUYER_ORDER_META_KEY_DELIVERY_ADDRESS);
  144 + if(null == meta) {
  145 + return null;
  146 + }
  147 + JSONObject metaValue = JSONObject.parseObject(meta.getMetaValue());
  148 + BuyerOrderResp result = new BuyerOrderResp();
  149 + result.setReceiveName(metaValue.getString("addresseeName"));
  150 + result.setReceiveMobile(metaValue.getString("mobile"));
  151 + result.setReceiveAddress(rebuildReceiveAddress(metaValue.getJSONObject("area")));
133 152
  153 + return result;
  154 + }
  155 +
  156 + private String rebuildReceiveAddress(JSONObject address) {
  157 + String fourthName = address.getString("caption");
  158 + JSONObject thirdObj = address.getJSONObject("parent");
  159 + String thirdName = thirdObj.getString("caption");
  160 + JSONObject secondObj = thirdObj.getJSONObject("parent");
  161 + String secondName = secondObj.getString("caption");
  162 + JSONObject firstObj = secondObj.getJSONObject("parent");
  163 + String firstName = firstObj.getString("caption");
  164 +
  165 + StringBuilder sb = new StringBuilder();
  166 + sb.append(firstName).append(secondName).append(thirdName).append(fourthName);
  167 +
  168 + return sb.toString();
134 } 169 }
135 170
136 private List<BuyerOrderResp> convertToResp(List<BuyerOrder> orderList, Map<String, BuyerOrderGoods> buyerGoodsMap, 171 private List<BuyerOrderResp> convertToResp(List<BuyerOrder> orderList, Map<String, BuyerOrderGoods> buyerGoodsMap,
@@ -147,6 +182,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -147,6 +182,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
147 resp.setSkuStr(sellerGoodsMap.get(skup).getStorageId().toString()); 182 resp.setSkuStr(sellerGoodsMap.get(skup).getStorageId().toString());
148 resp.setDepotNo(sellerGoodsMap.get(skup).getDepotNo()); 183 resp.setDepotNo(sellerGoodsMap.get(skup).getDepotNo());
149 resp.setSellerWaybillCode(expressInfoMap.get(sellerOrder.getOrderCode()).getWaybillCode()); 184 resp.setSellerWaybillCode(expressInfoMap.get(sellerOrder.getOrderCode()).getWaybillCode());
  185 + resp.setSellerOrderCode(sellerOrder.getOrderCode());
  186 + resp.setSkup(skup);
150 resp.setCreateTimeStr(null == item.getCreateTime() ? "" : DateUtil.long2DateStr(item.getCreateTime().longValue()*1000, "yyyy-MM-dd HH:mm:ss")); 187 resp.setCreateTimeStr(null == item.getCreateTime() ? "" : DateUtil.long2DateStr(item.getCreateTime().longValue()*1000, "yyyy-MM-dd HH:mm:ss"));
151 188
152 respList.add(resp); 189 respList.add(resp);
@@ -22,6 +22,7 @@ datasources: @@ -22,6 +22,7 @@ datasources:
22 - com.yoho.order.dal.SellerOrderGoodsMapper 22 - com.yoho.order.dal.SellerOrderGoodsMapper
23 - com.yoho.order.dal.ExpressInfoMapper 23 - com.yoho.order.dal.ExpressInfoMapper
24 - com.yoho.order.dal.BuyerOrderGoodsMapper 24 - com.yoho.order.dal.BuyerOrderGoodsMapper
  25 + - com.yoho.order.dal.BuyerOrderMetaMapper
25 26
26 27
27 readOnlyInSlave: true 28 readOnlyInSlave: true
@@ -22,5 +22,6 @@ datasources: @@ -22,5 +22,6 @@ datasources:
22 - com.yoho.order.dal.SellerOrderGoodsMapper 22 - com.yoho.order.dal.SellerOrderGoodsMapper
23 - com.yoho.order.dal.ExpressInfoMapper 23 - com.yoho.order.dal.ExpressInfoMapper
24 - com.yoho.order.dal.BuyerOrderGoodsMapper 24 - com.yoho.order.dal.BuyerOrderGoodsMapper
  25 + - com.yoho.order.dal.BuyerOrderMetaMapper
25 26
26 readOnlyInSlave: ${readOnlyInSlave} 27 readOnlyInSlave: ${readOnlyInSlave}
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 <script src="/ufoPlatform/js/include.js"></script> 6 <script src="/ufoPlatform/js/include.js"></script>
7 </head> 7 </head>
8 <body class="easyui-layout"> 8 <body class="easyui-layout">
  9 +<input type="hidden" id="buyerOrderCode">
9 <div region="north" style="height:300px;"> 10 <div region="north" style="height:300px;">
10 <script> 11 <script>
11 document.write(addHead('鉴定中心', '列表管理')); 12 document.write(addHead('鉴定中心', '列表管理'));
@@ -261,8 +262,8 @@ function getToBeJudgedList(){ @@ -261,8 +262,8 @@ function getToBeJudgedList(){
261 if (rowData.status == 2) { 262 if (rowData.status == 2) {
262 return "<a role='confirm' dataId='"+ rowData.id +"' style='margin-left:10px;background-color: #5cb85c !important;'>确认收货</a>"; 263 return "<a role='confirm' dataId='"+ rowData.id +"' style='margin-left:10px;background-color: #5cb85c !important;'>确认收货</a>";
263 } else if (rowData.status == 3) { 264 } else if (rowData.status == 3) {
264 - return "<a role='pass' dataId='"+ rowData.id +"' style='margin-left:10px;background-color: #d9534f !important;'>鉴定通过</a>"+  
265 - "<a role='reject' dataId='"+ rowData.id +"' style='margin-left:10px;background-color: #5cb85c !important;'>鉴定不通过</a>"; 265 + return "<a role='pass' dataId='"+ rowData.orderCode +"' style='margin-left:10px;background-color: #5cb85c !important;'>鉴定通过</a>"+
  266 + "<a role='reject' dataId='"+ rowData.skup +"' style='margin-left:10px;background-color: #d9534f !important;'>鉴定不通过</a>";
266 } 267 }
267 } 268 }
268 }]], 269 }]],
@@ -293,51 +294,20 @@ function getToBeJudgedList(){ @@ -293,51 +294,20 @@ function getToBeJudgedList(){
293 }); 294 });
294 } 295 }
295 }); 296 });
296 -  
297 -  
298 } 297 }
299 }); 298 });
300 $(this).datagrid("getPanel").find("a[role='pass']").linkbutton({ 299 $(this).datagrid("getPanel").find("a[role='pass']").linkbutton({
301 onClick: function () { 300 onClick: function () {
302 - var shopsId = $(this).attr("dataId");  
303 - $.post(contextPath + "/couponLimit/shopStartOrStop.do", {  
304 - shopsIdForShop : shopsId,  
305 - shopLimitStatus : 0,  
306 - type : 0  
307 - }, function(data) {  
308 - if (data.code == CODE_SUCCESS) {  
309 - $("#limitListTable").datagrid("reload");  
310 - window.self.$.messager.show({  
311 - title : "提示",  
312 - msg : "关闭成功!"  
313 - });  
314 - } else {  
315 - window.self.$.messager.alert("失败", data.message, "error");  
316 - }  
317 - });  
318 - 301 + var buyerOrderCode = $(this).attr("dataId");
  302 + $("#buyerOrderCode").val(buyerOrderCode);
  303 + addPassPage();
319 } 304 }
320 }); 305 });
321 306
322 $(this).datagrid("getPanel").find("a[role='reject']").linkbutton({ 307 $(this).datagrid("getPanel").find("a[role='reject']").linkbutton({
323 onClick: function () { 308 onClick: function () {
324 - var shopsId = $(this).attr("dataId");  
325 - $.post(contextPath + "/couponLimit/shopStartOrStop.do", {  
326 - shopsIdForShop : shopsId,  
327 - shopLimitStatus : 0,  
328 - type : 0  
329 - }, function(data) {  
330 - if (data.code == CODE_SUCCESS) {  
331 - $("#limitListTable").datagrid("reload");  
332 - window.self.$.messager.show({  
333 - title : "提示",  
334 - msg : "关闭成功!"  
335 - });  
336 - } else {  
337 - window.self.$.messager.alert("失败", data.message, "error");  
338 - }  
339 - });  
340 - 309 + var skup = $(this).attr("dataId");
  310 + addRejectPage(skup);
341 } 311 }
342 }); 312 });
343 313
@@ -416,26 +386,26 @@ function getAlreadyJudgedList(){ @@ -416,26 +386,26 @@ function getAlreadyJudgedList(){
416 }); 386 });
417 } 387 }
418 388
419 -function addConfirmPage() {  
420 - var div = $("<div id='confirmDiv'>").appendTo($(document.body));  
421 - var url = contextPath + "/html/promotion/useCouponLimit/add.html"; 389 +function addPassPage() {
  390 + var div = $("<div id='passDiv'>").appendTo($(document.body));
  391 + var url = contextPath + "/html/judgeCenter/pass.html";
422 $(div).myDialog({ 392 $(div).myDialog({
423 width: "50%", 393 width: "50%",
424 - height: "40%",  
425 - title: "导入商品的用券限制", 394 + height: "60%",
  395 + title: "发货(鉴定通过)",
426 href: url, 396 href: url,
427 modal: true, 397 modal: true,
428 collapsible: true, 398 collapsible: true,
429 cache: false, 399 cache: false,
430 buttons: [{ 400 buttons: [{
431 - text: "保存", 401 + text: "发货",
432 id: "saveBtn", 402 id: "saveBtn",
433 iconCls: "icon-save", 403 iconCls: "icon-save",
434 onClick: function () { 404 onClick: function () {
435 $('#uploadFile').click(); 405 $('#uploadFile').click();
436 } 406 }
437 }, { 407 }, {
438 - text: "关闭", 408 + text: "取消",
439 iconCls: "icon-cancel", 409 iconCls: "icon-cancel",
440 handler: function () { 410 handler: function () {
441 $(div).dialog("close"); 411 $(div).dialog("close");
  1 +<!DOCTYPE html>
  2 +<html lang="en">
  3 +<head>
  4 + <title>main</title>
  5 + <script src="/ufoPlatform/js/include.js"></script>
  6 +</head>
  7 +<body class="easyui-layout" fit="true">
  8 +
  9 +<div id="passDiv" region="center">
  10 + <table id="passTable" border="1px" cellpadding="1" cellspacing="0" align="center"
  11 + style="margin-top: 30px; line-height: 30px;width:95%;border-color: #999999">
  12 + <tr>
  13 + <td>买家地址:</td>
  14 + <td colspan="2" >
  15 + <span id="receiveInfo"></span>
  16 + </td>
  17 + </tr>
  18 + <tr>
  19 + <td>快递公司:</td>
  20 + <td colspan="2">
  21 + <input id="expressCompany" class="easyui-combobox"/>
  22 + </td>
  23 + </tr>
  24 + <tr>
  25 + <td>快递单号:</td>
  26 + <td colspan="2">
  27 + <input type="text" class="easyui-textbox" id="waybillCode" />
  28 + </td>
  29 + </tr>
  30 + </table>
  31 +
  32 +</div>
  33 +<script>
  34 + $(function () {
  35 + //根据买家订单号获取买家收货地址
  36 + var form = new FormData();
  37 + form.append("orderCode", document.getElementById("buyerOrderCode").value);
  38 + //发送请求
  39 + $.ajax({
  40 + type: "POST",
  41 + url: contextPath + '/buyerOrder/getReceiveInfoByOrderCode',
  42 + data: form,
  43 + async: false,
  44 + cache: false,
  45 + contentType: false,
  46 + processData: false,
  47 + dataType: 'json',
  48 + success: function (result) {
  49 + if(result.code == 200) {
  50 + var name = result.data.receiveName;
  51 + var mobile = result.data.receiveMobile;
  52 + var address = result.data.receiveAddress;
  53 + $("#receiveInfo").html("姓名:" + name + "<br>" + "手机号:" + mobile + "<br>" + "地址:" + address);
  54 + }
  55 + else {
  56 + $.messager.alert("失败", result.message, "error");
  57 + }
  58 + }
  59 + });
  60 +
  61 +
  62 + // 快递公司下拉框
  63 + $("#expressCompanySelector").combobox({
  64 + valueField : "activityId",
  65 + textField : "activityName",
  66 + selectOnNavigation : true,
  67 + editable:false,
  68 + selectOnNavigation : true,
  69 + url : contextPath + "/MakePriceController/getActivityMenu.do",
  70 + // 品牌联动
  71 + onChange:function(data){
  72 + if(data == "") {
  73 + $("#name").textbox({disabled:false});
  74 + $("#startTime").datetimebox({disabled:false});
  75 + $("#endTime").datetimebox({disabled:false});
  76 + } else {
  77 + $("#name").textbox({disabled:true});
  78 + $("#startTime").datetimebox({disabled:true});
  79 + $("#endTime").datetimebox({disabled:true});
  80 + //创建formdata
  81 + var form = new FormData();
  82 + form.append("activityId", data);
  83 + //发送请求
  84 + $.ajax({
  85 + type: "POST",
  86 + url: contextPath + '/MakePriceController/getActivity.do',
  87 + data: form,
  88 + async: false,
  89 + cache: false,
  90 + contentType: false,
  91 + processData: false,
  92 + dataType: 'json',
  93 + success: function (result) {
  94 + if(result.code == 200) {
  95 + $("#name").textbox('setValue',result.data.title);
  96 + $("#startTime").datetimebox('setValue',result.data.effectiveTime);
  97 + $("#endTime").datetimebox('setValue',result.data.effectiveTimeEnd);
  98 + }
  99 + else {
  100 + $.messager.alert("失败", result.message, "error");
  101 + }
  102 + }
  103 + });
  104 + }
  105 + },
  106 + loadFilter: function (data) {
  107 + return defaultLoadFilter(data);
  108 + }
  109 + });
  110 + });
  111 +
  112 +</script>
  113 +</body>
  114 +</html>