Authored by caoyan

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

@@ -12,4 +12,6 @@ import com.yoho.order.model.ExpressInfo; @@ -12,4 +12,6 @@ import com.yoho.order.model.ExpressInfo;
12 public interface ExpressInfoMapper { 12 public interface ExpressInfoMapper {
13 13
14 List<ExpressInfo> selectByOrderCodeAndType(@Param("orderCode") String orderCode, @Param("expressTypeList") List<Integer> expressTypeList); 14 List<ExpressInfo> selectByOrderCodeAndType(@Param("orderCode") String orderCode, @Param("expressTypeList") List<Integer> expressTypeList);
  15 +
  16 + List<ExpressInfo> selectExpressInfoListByWaybillCodeAndLogisticsType(@Param("waybillCode") String waybillCode, @Param("logisticsType") Integer logisticsType);
15 } 17 }
@@ -33,4 +33,11 @@ @@ -33,4 +33,11 @@
33 </if> 33 </if>
34 </select> 34 </select>
35 35
  36 + <select id="selectExpressInfoListByWaybillCodeAndLogisticsType" resultMap="BaseResultMap">
  37 + SELECT <include refid="Base_Column_List" />
  38 + FROM express_info
  39 + where waybill_code = #{waybillCode} and logistics_type = #{logisticsType}
  40 + ORDER BY create_time
  41 + </select>
  42 +
36 </mapper> 43 </mapper>
@@ -10,6 +10,7 @@ import java.util.Set; @@ -10,6 +10,7 @@ import java.util.Set;
10 import java.util.concurrent.TimeUnit; 10 import java.util.concurrent.TimeUnit;
11 import java.util.stream.Collectors; 11 import java.util.stream.Collectors;
12 12
  13 +import com.alibaba.fastjson.JSON;
13 import org.apache.commons.collections.CollectionUtils; 14 import org.apache.commons.collections.CollectionUtils;
14 import org.apache.commons.lang3.StringUtils; 15 import org.apache.commons.lang3.StringUtils;
15 import org.elasticsearch.common.collect.Lists; 16 import org.elasticsearch.common.collect.Lists;
@@ -600,7 +601,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -600,7 +601,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
600 601
601 public List<ExpressInfoResp> queryExpressList(String orderCode, String expressType) { 602 public List<ExpressInfoResp> queryExpressList(String orderCode, String expressType) {
602 LOGGER.info("queryExpressList orderCode is {}, expressTypeStr is {}", orderCode, expressType); 603 LOGGER.info("queryExpressList orderCode is {}, expressTypeStr is {}", orderCode, expressType);
603 - List<ExpressInfo> list = expressInfoMapper.selectByOrderCodeAndType(orderCode, convertExpressType(expressType)); 604 + List<ExpressInfo> list = getExpressInfoListByStage(orderCode, expressType);
604 if(CollectionUtils.isEmpty(list)) { 605 if(CollectionUtils.isEmpty(list)) {
605 return Lists.newArrayList(); 606 return Lists.newArrayList();
606 } 607 }
@@ -622,6 +623,40 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -622,6 +623,40 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
622 return respList; 623 return respList;
623 } 624 }
624 625
  626 + private List<ExpressInfo> getExpressInfoListByStage(String orderCode, String expressType){
  627 + LOGGER.info("getExpressInfoListByStage orderCode is {}, expressTypeStr is {}", orderCode, expressType);
  628 + List<String> orderCodeList = Lists.newArrayList();
  629 + orderCodeList.add(orderCode);
  630 + List<ExpressRecord> records = expressRecordMapper.selectByOrderCodeListAndType(orderCodeList,convertExpressType(expressType));
  631 + if(CollectionUtils.isEmpty(records)) {
  632 + LOGGER.info("getExpressInfoListByStage records is empty , orderCode is {}, expressTypeStr is {}", orderCode, expressType);
  633 + return Lists.newArrayList();
  634 + }
  635 +
  636 + ExpressRecord record = records.get(0);
  637 + LOGGER.info("getExpressInfoListByStage begin , orderCode = {} ,expressType = {}, expressRecord = {} ",orderCode,expressType,record);
  638 + String waybillCode = record.getWaybillCode();
  639 + Integer logisticsType = record.getLogisticsType();
  640 +
  641 + //原来的情况,根据订单号直接查询物流,如果存在物流信息,则直接返回,否则有可能是多单一号
  642 + List<ExpressInfo> list = expressInfoMapper.selectByOrderCodeAndType(orderCode, convertExpressType(expressType));
  643 +
  644 + //有可能存在一个订单号,多个物流的情况,比如原来的物流填错了,修改了新的物流,只保留新的物流号的信息
  645 + if(CollectionUtils.isNotEmpty(list)){
  646 + list = list.stream().filter(info -> StringUtils.equals(waybillCode,info.getWaybillCode())).collect(Collectors.toList());
  647 + }
  648 +
  649 + if(CollectionUtils.isNotEmpty(list)) {
  650 + LOGGER.info("getExpressInfoListByStage success have data in express info orderCode = {} ,expressType = {} ",orderCode,expressType);
  651 + return list;
  652 + }
  653 +
  654 + LOGGER.info("getExpressInfoListByStage orderCode is {}, expressTypeStr is {},records size is {} ,records is {}", orderCode, expressType , records.size(),JSON.toJSONString(records));
  655 +
  656 + List<ExpressInfo> expressInfoList = expressInfoMapper.selectExpressInfoListByWaybillCodeAndLogisticsType(waybillCode,logisticsType);
  657 + return expressInfoList;
  658 + }
  659 +
625 public List<OrderOperateRecordResp> queryOperateRecordList(BuyerOrderReq req){ 660 public List<OrderOperateRecordResp> queryOperateRecordList(BuyerOrderReq req){
626 if(null == req.getOrderCode()) { 661 if(null == req.getOrderCode()) {
627 return Lists.newArrayList(); 662 return Lists.newArrayList();
@@ -83,7 +83,7 @@ public class NFCServiceImpl implements INFCService { @@ -83,7 +83,7 @@ public class NFCServiceImpl implements INFCService {
83 BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode); 83 BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode);
84 if(buyerOrder == null){ 84 if(buyerOrder == null){
85 logger.info("writeIdentify get order is null"); 85 logger.info("writeIdentify get order is null");
86 - return; 86 + throw new PlatformException("订单信息不存在!", 403);
87 } 87 }
88 logger.info("writeIdentify get order success , order is {}", buyerOrder); 88 logger.info("writeIdentify get order success , order is {}", buyerOrder);
89 try{ 89 try{
@@ -97,7 +97,7 @@ public class NFCServiceImpl implements INFCService { @@ -97,7 +97,7 @@ public class NFCServiceImpl implements INFCService {
97 syncBlockChain(tagId, buyerOrder); 97 syncBlockChain(tagId, buyerOrder);
98 }catch (Exception e){ 98 }catch (Exception e){
99 logger.warn("writeIdentify syncBlockChain error , e is {}", e); 99 logger.warn("writeIdentify syncBlockChain error , e is {}", e);
100 - throw new PlatformException("同步数据到区块链写代理失败", 403); 100 +// throw new PlatformException("同步数据到区块链写代理失败", 403);
101 } 101 }
102 102
103 } 103 }
@@ -707,6 +707,10 @@ function addRecordPage(skup, order_code, id) { @@ -707,6 +707,10 @@ function addRecordPage(skup, order_code, id) {
707 modal: true, 707 modal: true,
708 collapsible: true, 708 collapsible: true,
709 cache: false, 709 cache: false,
  710 + onClose : function() {
  711 + timedCount();
  712 + $(this).dialog('destroy');
  713 + },
710 buttons: [{ 714 buttons: [{
711 text: "开始录制", 715 text: "开始录制",
712 id: "recordBtn", 716 id: "recordBtn",
@@ -758,7 +762,8 @@ function addRecordPage(skup, order_code, id) { @@ -758,7 +762,8 @@ function addRecordPage(skup, order_code, id) {
758 text: "取消", 762 text: "取消",
759 iconCls: "icon-cancel", 763 iconCls: "icon-cancel",
760 handler: function () { 764 handler: function () {
761 - $(div).dialog("close"); 765 + timedCount();
  766 + $(div).dialog("destroy");
762 } 767 }
763 }] 768 }]
764 }); 769 });
@@ -5,8 +5,8 @@ @@ -5,8 +5,8 @@
5 <title>Insert title here</title> 5 <title>Insert title here</title>
6 </head> 6 </head>
7 <body> 7 <body>
8 - <input style="display: none" id="startTime" type="text"/>  
9 - <input style="display: none" id="endTime" type="text"/> 8 + <input id="startTime" type="hidden"/>
  9 + <input id="endTime" type="hidden"/>
10 10
11 <ul> 11 <ul>
12 <li style="padding-bottom: 10px;"> 12 <li style="padding-bottom: 10px;">
@@ -37,8 +37,8 @@ @@ -37,8 +37,8 @@
37 var totalVar; 37 var totalVar;
38 38
39 function stopCount() { 39 function stopCount() {
40 - var endTime = $('#endTime').val();  
41 - var startTime = $('#startTime').val(); 40 + var endTime = parseInt($('#endTime').val());
  41 + var startTime = parseInt($('#startTime').val());
42 var secondVar = parseInt((endTime - startTime) % 60); 42 var secondVar = parseInt((endTime - startTime) % 60);
43 if (endTime - startTime > 60) { 43 if (endTime - startTime > 60) {
44 var minuteVar = parseInt((endTime - startTime) / 60); 44 var minuteVar = parseInt((endTime - startTime) / 60);