Authored by mali

Merge branch 'dev'

@@ -28,6 +28,14 @@ public interface ExpressInfoMapper { @@ -28,6 +28,14 @@ public interface ExpressInfoMapper {
28 List<ExpressInfo> queryExpressInfo(@Param("uid") Integer uid, @Param("orderCode") Long orderCode, @Param("expressType") Integer expressType); 28 List<ExpressInfo> queryExpressInfo(@Param("uid") Integer uid, @Param("orderCode") Long orderCode, @Param("expressType") Integer expressType);
29 29
30 /** 30 /**
  31 + * 根据uid、订单号和快递单号查询快递信息查找第一笔订单信息
  32 + * @param uid
  33 + * @param orderCode 订单号
  34 + * @return
  35 + */
  36 + ExpressInfo queryFirstExpressInfo(@Param("uid") Integer uid, @Param("orderCode") Long orderCode, @Param("waybillCode") String waybillCode);
  37 +
  38 + /**
31 * 根据uid、订单号、物流类型和快递状态查询快递信息 39 * 根据uid、订单号、物流类型和快递状态查询快递信息
32 * @param uid 40 * @param uid
33 * @param orderCode 41 * @param orderCode
@@ -152,6 +152,13 @@ @@ -152,6 +152,13 @@
152 ORDER BY create_time DESC 152 ORDER BY create_time DESC
153 </select> 153 </select>
154 154
  155 + <select id="queryFirstExpressInfo" resultMap="BaseResultMap">
  156 + SELECT <include refid="Base_Column_List" />
  157 + FROM express_info
  158 + where uid = #{uid} and order_code = #{orderCode} and waybill_code = #{waybillCode}
  159 + limit 1
  160 + </select>
  161 +
155 <select id="selectByOrderCodeAndStatesAndUidAndExpressType" resultMap="BaseResultMap"> 162 <select id="selectByOrderCodeAndStatesAndUidAndExpressType" resultMap="BaseResultMap">
156 SELECT id, uid, order_code, waybill_code, accept_address, accept_remark, logistics_type, create_time, express_type, state 163 SELECT id, uid, order_code, waybill_code, accept_address, accept_remark, logistics_type, create_time, express_type, state
157 FROM express_info 164 FROM express_info
@@ -73,8 +73,8 @@ public class ExpressInfoController { @@ -73,8 +73,8 @@ public class ExpressInfoController {
73 * @return 73 * @return
74 */ 74 */
75 @RequestMapping(params = "method=ufo.order.expressDetailInfo") 75 @RequestMapping(params = "method=ufo.order.expressDetailInfo")
76 - public ApiResponse queryExpressDetailInfo(@RequestParam("orderCode") Long orderCode) {  
77 - ExpressInfoRespBo expressInfoRespBo = expressInfoService.queryExpressDetailInfo(orderCode); 76 + public ApiResponse queryExpressDetailInfo(@RequestParam("uid") Integer uid,@RequestParam("orderCode") Long orderCode) {
  77 + ExpressInfoRespBo expressInfoRespBo = expressInfoService.queryExpressDetailInfo(uid,orderCode);
78 return new ApiResponse.ApiResponseBuilder().code(200).data(expressInfoRespBo).build(); 78 return new ApiResponse.ApiResponseBuilder().code(200).data(expressInfoRespBo).build();
79 } 79 }
80 } 80 }
@@ -67,7 +67,7 @@ public class SellerOrderController { @@ -67,7 +67,7 @@ public class SellerOrderController {
67 .uid(uid) 67 .uid(uid)
68 .storageId(storage_id) 68 .storageId(storage_id)
69 .price(price) 69 .price(price)
70 - .addressId(address_id) 70 + .addressId(1)
71 .build(); 71 .build();
72 logger.info("in ufo.sellerOrder.publishPrd, req {}", req); 72 logger.info("in ufo.sellerOrder.publishPrd, req {}", req);
73 Long orderCode = sellerOrderService.publishPrd(req); 73 Long orderCode = sellerOrderService.publishPrd(req);
@@ -10,15 +10,9 @@ import com.yohoufo.common.constant.ExpressInfoConstant; @@ -10,15 +10,9 @@ import com.yohoufo.common.constant.ExpressInfoConstant;
10 import com.yohoufo.common.utils.DateUtil; 10 import com.yohoufo.common.utils.DateUtil;
11 import com.yohoufo.dal.order.BuyerOrderMapper; 11 import com.yohoufo.dal.order.BuyerOrderMapper;
12 import com.yohoufo.dal.order.ExpressInfoMapper; 12 import com.yohoufo.dal.order.ExpressInfoMapper;
13 -import com.yohoufo.dal.order.SellerOrderMapper;  
14 import com.yohoufo.dal.order.model.BuyerOrder; 13 import com.yohoufo.dal.order.model.BuyerOrder;
15 import com.yohoufo.dal.order.model.ExpressInfo; 14 import com.yohoufo.dal.order.model.ExpressInfo;
16 -import com.yohoufo.dal.order.model.SellerOrder;  
17 -import com.yohoufo.order.common.OrderCodeType;  
18 import com.yohoufo.order.mq.publisher.ConsumerExceptionPublisher; 15 import com.yohoufo.order.mq.publisher.ConsumerExceptionPublisher;
19 -import com.yohoufo.order.service.IExpressInfoService;  
20 -import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;  
21 -import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta;  
22 import org.apache.commons.collections.CollectionUtils; 16 import org.apache.commons.collections.CollectionUtils;
23 import org.apache.commons.lang3.StringUtils; 17 import org.apache.commons.lang3.StringUtils;
24 import org.slf4j.Logger; 18 import org.slf4j.Logger;
@@ -27,7 +21,6 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -27,7 +21,6 @@ import org.springframework.beans.factory.annotation.Autowired;
27 import org.springframework.stereotype.Component; 21 import org.springframework.stereotype.Component;
28 22
29 import java.util.List; 23 import java.util.List;
30 -import java.util.Objects;  
31 24
32 25
33 @Component 26 @Component
@@ -42,16 +35,8 @@ private static final Logger LOGGER = LoggerFactory.getLogger(ExpressInfoUpdateCo @@ -42,16 +35,8 @@ private static final Logger LOGGER = LoggerFactory.getLogger(ExpressInfoUpdateCo
42 private ExpressInfoMapper expressInfoMapper; 35 private ExpressInfoMapper expressInfoMapper;
43 36
44 @Autowired 37 @Autowired
45 - private SellerOrderMapper sellerOrderMapper;  
46 -  
47 - @Autowired  
48 private BuyerOrderMapper buyerOrderMapper; 38 private BuyerOrderMapper buyerOrderMapper;
49 39
50 - @Autowired  
51 - private IExpressInfoService expressInfoService;  
52 -  
53 - @Autowired  
54 - private OrderCodeGenerator orderCodeGenerator;  
55 40
56 @Autowired 41 @Autowired
57 private ConsumerExceptionPublisher consumerExceptionPublisher; 42 private ConsumerExceptionPublisher consumerExceptionPublisher;
@@ -85,47 +70,34 @@ private static final Logger LOGGER = LoggerFactory.getLogger(ExpressInfoUpdateCo @@ -85,47 +70,34 @@ private static final Logger LOGGER = LoggerFactory.getLogger(ExpressInfoUpdateCo
85 LOGGER.info("handle express info update message, not give me a uid, message is {}.", message); 70 LOGGER.info("handle express info update message, not give me a uid, message is {}.", message);
86 return; 71 return;
87 } 72 }
88 - // 判断是买家订单号还是卖家订单号  
89 - boolean buyer = true;  
90 -  
91 - //根据订单号判断是买家还是卖家  
92 - CodeMeta codeMeta = orderCodeGenerator.expId(orderCode);  
93 - if (Objects.isNull(codeMeta)){  
94 - LOGGER.warn("getExpressType orderCode illegal, req {}", orderCode);  
95 - throw new ServiceException(ServiceError.ORDER_REQUEST_PARM_IS_EMPTY);  
96 - }  
97 73
98 - //卖家  
99 - if(OrderCodeType.SELLER_TYPE.getType() == codeMeta.getType()){  
100 - buyer=false; 74 + BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode);
  75 +
  76 + if (buyerOrder == null){
  77 + LOGGER.warn("getOrderInfo order not exist, orderCode is {}", orderCode);
  78 + throw new ServiceException(ServiceError.ORDER_NULL);
101 } 79 }
102 80
103 - if (buyer) {  
104 - // 买家  
105 - BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCodeSellerUid(orderCode, uid);  
106 - if (Objects.isNull(buyerOrder)) {  
107 - LOGGER.info("handle express info update message, orders not found, message is {}.", message);  
108 - return;  
109 - }  
110 - } else {  
111 - // 卖家  
112 - SellerOrder sellerOrder = sellerOrderMapper.selectByOrderCodeUid(orderCode, uid);  
113 - if (Objects.isNull(sellerOrder)) {  
114 - LOGGER.info("handle express info update message, orders not found, message is {}.", message);  
115 - return;  
116 - } 81 +
  82 + String waybillCode = jsonMsg.getString("waybillCode");
  83 +
  84 + //根据uid,orderCode,waybillCode查状态expressType
  85 + ExpressInfo firstExpressInfo = expressInfoMapper.queryFirstExpressInfo(uid,orderCode,waybillCode);
  86 + if(firstExpressInfo==null){
  87 + LOGGER.warn("updateExpressInfo first express info not exist, uid is {} orderCode is {} waybillCode is {}", uid,orderCode,waybillCode);
  88 + throw new ServiceException(400,"not find express type info");
117 } 89 }
  90 +
118 int createTime = jsonMsg.getIntValue("createTime"); 91 int createTime = jsonMsg.getIntValue("createTime");
119 //int smsType = jsonMsg.getIntValue("businessType"); 92 //int smsType = jsonMsg.getIntValue("businessType");
120 int state = jsonMsg.getIntValue("state"); 93 int state = jsonMsg.getIntValue("state");
121 94
122 // 正常订单,签收消息 95 // 正常订单,签收消息
123 if (state == ExpressInfoConstant.EXPRESS_STATUS_SIGN) { 96 if (state == ExpressInfoConstant.EXPRESS_STATUS_SIGN) {
124 - handleAcceptExpress(jsonMsg); 97 + handleAcceptExpress(jsonMsg,firstExpressInfo.getExpressType().intValue());
125 return; 98 return;
126 } 99 }
127 int logisticsType = jsonMsg.getIntValue("logisticsType"); 100 int logisticsType = jsonMsg.getIntValue("logisticsType");
128 - String waybillCode = jsonMsg.getString("waybillCode");  
129 101
130 // 正常订单,物流调拨消息(获取不到物流信息,标记为未发货) 102 // 正常订单,物流调拨消息(获取不到物流信息,标记为未发货)
131 if (state == ExpressInfoConstant.EXPRESS_STATUS_UNSING 103 if (state == ExpressInfoConstant.EXPRESS_STATUS_UNSING
@@ -148,7 +120,7 @@ private static final Logger LOGGER = LoggerFactory.getLogger(ExpressInfoUpdateCo @@ -148,7 +120,7 @@ private static final Logger LOGGER = LoggerFactory.getLogger(ExpressInfoUpdateCo
148 expressInfo.setAcceptRemark(StringUtils.defaultString(acceptRemark)); 120 expressInfo.setAcceptRemark(StringUtils.defaultString(acceptRemark));
149 expressInfo.setLogisticsType(logisticsType); 121 expressInfo.setLogisticsType(logisticsType);
150 expressInfo.setCreateTime(createTime); 122 expressInfo.setCreateTime(createTime);
151 - expressInfo.setExpressType(expressInfoService.getExpressType(orderCode).byteValue()); 123 + expressInfo.setExpressType(firstExpressInfo.getExpressType());
152 expressInfo.setState(state); 124 expressInfo.setState(state);
153 expressInfoMapper.insert(expressInfo); 125 expressInfoMapper.insert(expressInfo);
154 } 126 }
@@ -174,7 +146,7 @@ private static final Logger LOGGER = LoggerFactory.getLogger(ExpressInfoUpdateCo @@ -174,7 +146,7 @@ private static final Logger LOGGER = LoggerFactory.getLogger(ExpressInfoUpdateCo
174 /** 146 /**
175 * 确认收货处理 147 * 确认收货处理
176 */ 148 */
177 - public void handleAcceptExpress(JSONObject jsonMsg) { 149 + private void handleAcceptExpress(JSONObject jsonMsg,Integer expressType) {
178 int state = jsonMsg.getIntValue("state"); 150 int state = jsonMsg.getIntValue("state");
179 long orderCode = jsonMsg.getLongValue("orderCode"); 151 long orderCode = jsonMsg.getLongValue("orderCode");
180 int logisticsType = jsonMsg.getIntValue("logisticsType"); 152 int logisticsType = jsonMsg.getIntValue("logisticsType");
@@ -184,7 +156,6 @@ private static final Logger LOGGER = LoggerFactory.getLogger(ExpressInfoUpdateCo @@ -184,7 +156,6 @@ private static final Logger LOGGER = LoggerFactory.getLogger(ExpressInfoUpdateCo
184 int uid = jsonMsg.getIntValue("uid"); 156 int uid = jsonMsg.getIntValue("uid");
185 int createTime = DateUtil.getCurrentTimeSecond(); 157 int createTime = DateUtil.getCurrentTimeSecond();
186 158
187 - Integer expressType = expressInfoService.getExpressType(orderCode);  
188 List<ExpressInfo> expressInfos = expressInfoMapper.selectByOrderCodeAndStatesAndUidAndExpressType(uid, orderCode, Lists.newArrayList(ExpressInfoConstant.EXPRESS_STATUS_SIGN), expressType); 159 List<ExpressInfo> expressInfos = expressInfoMapper.selectByOrderCodeAndStatesAndUidAndExpressType(uid, orderCode, Lists.newArrayList(ExpressInfoConstant.EXPRESS_STATUS_SIGN), expressType);
189 processExpressInfo(expressInfos, state, logisticsType, orderCode, waybillCode, acceptAddress, acceptRemark, createTime, uid, expressType); 160 processExpressInfo(expressInfos, state, logisticsType, orderCode, waybillCode, acceptAddress, acceptRemark, createTime, uid, expressType);
190 } 161 }
@@ -42,7 +42,7 @@ public interface IExpressInfoService { @@ -42,7 +42,7 @@ public interface IExpressInfoService {
42 * @param orderCode 42 * @param orderCode
43 * @return 43 * @return
44 */ 44 */
45 - ExpressInfoRespBo queryExpressDetailInfo(Long orderCode); 45 + ExpressInfoRespBo queryExpressDetailInfo(Integer uid,Long orderCode);
46 46
47 47
48 /** 48 /**
@@ -54,5 +54,5 @@ public interface IExpressInfoService { @@ -54,5 +54,5 @@ public interface IExpressInfoService {
54 * @param orderCode 54 * @param orderCode
55 * @return 55 * @return
56 */ 56 */
57 - Integer getExpressType(Long orderCode); 57 + //Integer getExpressType(Long orderCode);
58 } 58 }
@@ -56,71 +56,137 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -56,71 +56,137 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
56 @Autowired 56 @Autowired
57 private BuyerOrderMapper buyerOrderMapper; 57 private BuyerOrderMapper buyerOrderMapper;
58 58
59 - @Autowired  
60 - private OrderCodeGenerator orderCodeGenerator;  
61 -  
62 @Resource( name = "yhProducer") 59 @Resource( name = "yhProducer")
63 private YhProducer yhProducer; 60 private YhProducer yhProducer;
64 61
65 private static String EXPRESS_MQ_SEND = "logistics.logistics_data"; 62 private static String EXPRESS_MQ_SEND = "logistics.logistics_data";
66 63
  64 + /**
  65 + *
  66 + * @param uid 卖家的uid
  67 + * @param expressCompanyId 快递公司id
  68 + * @param orderCode 订单号 :一定是买家订单编号
  69 + * @param wayBillCode 快递单号
  70 + */
67 @Override 71 @Override
68 public void deliverToDepot(Integer uid,Integer expressCompanyId, Long orderCode, String wayBillCode) { 72 public void deliverToDepot(Integer uid,Integer expressCompanyId, Long orderCode, String wayBillCode) {
69 - LOGGER.info("deliverToDepot uid={} ,expressCompanyId = {}, orderCode = {}, wayBillCode = {}", new Object[]{uid ,expressCompanyId, orderCode, wayBillCode});  
70 -  
71 //保存物流信息+更新订单状态; 73 //保存物流信息+更新订单状态;
72 //本阶段的物流类型和订单状态 74 //本阶段的物流类型和订单状态
73 - Integer expressType = ExpressInfoConstant.EXPRESS_TYPE_1;  
74 OrderStatus orderStatus=OrderStatus.SELLER_SEND_OUT; 75 OrderStatus orderStatus=OrderStatus.SELLER_SEND_OUT;
  76 + Integer expressType = ExpressInfoConstant.EXPRESS_TYPE_1;
75 77
76 LOGGER.info("deliverToDepot saveExpressAndUpdateBuyerOrderStatus uid={} ,expressCompanyId = {}, orderCode = {}, wayBillCode = {} " + 78 LOGGER.info("deliverToDepot saveExpressAndUpdateBuyerOrderStatus uid={} ,expressCompanyId = {}, orderCode = {}, wayBillCode = {} " +
77 ",expressType = {} ,orderStatus = {}", new Object[]{uid ,expressCompanyId, orderCode, wayBillCode,expressType,orderStatus}); 79 ",expressType = {} ,orderStatus = {}", new Object[]{uid ,expressCompanyId, orderCode, wayBillCode,expressType,orderStatus});
78 BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode); 80 BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode);
79 81
80 if (buyerOrder == null){ 82 if (buyerOrder == null){
81 - LOGGER.warn("getOrderInfo order not exist, orderCode is {}", orderCode); 83 + LOGGER.warn("deliverToDepot getOrderInfo order not exist, orderCode is {}", orderCode);
82 throw new ServiceException(ServiceError.ORDER_NULL); 84 throw new ServiceException(ServiceError.ORDER_NULL);
83 } 85 }
84 86
85 - if(uid!=buyerOrder.getUid()){  
86 - LOGGER.warn("deliverToDepot saveExpressAndUpdateBuyerOrderStatus uid {} not equal buyer order uid {}",uid, buyerOrder.getUid());  
87 - throw new ServiceException(ServiceError.ORDER_NULL); 87 + //卖家的uid
  88 + if(uid.intValue()!=buyerOrder.getSellerUid().intValue()){
  89 + LOGGER.warn("deliverToDepot saveExpressAndUpdateBuyerOrderStatus uid {} not equal buyer order sellerUid {}",uid, buyerOrder.getSellerUid());
  90 + throw new ServiceException(400,"参数错误,传入的卖家uid与订单卖家uid不一致");
88 } 91 }
89 92
  93 + Integer dealUid=buyerOrder.getSellerUid();
  94 +
90 // 保存订单物流信息 95 // 保存订单物流信息
91 - int ts=DateUtil.getCurrentTimeSecond();  
92 - ExpressInfo expressInfo=new ExpressInfo();  
93 - expressInfo.setUid(uid);  
94 - expressInfo.setOrderCode(orderCode);  
95 - expressInfo.setWaybillCode(wayBillCode);  
96 - expressInfo.setLogisticsType(expressCompanyId);  
97 - expressInfo.setCreateTime(ts);  
98 - expressInfo.setExpressType(expressType.byteValue());  
99 - expressInfo.setState(0);  
100 - LOGGER.info("deliverToDepot save express info {} ", expressInfo);  
101 - expressInfoMapper.insert(expressInfo); 96 + saveExpress(dealUid,expressCompanyId,orderCode,wayBillCode,expressType);
102 97
103 // 更新买家订单状态 98 // 更新买家订单状态
104 buyerOrder.setStatus(orderStatus.getCode()); 99 buyerOrder.setStatus(orderStatus.getCode());
105 - buyerOrder.setUpdateTime(ts); 100 + buyerOrder.setUpdateTime(DateUtil.getCurrentTimeSecond());
106 LOGGER.info("deliverToDepot update buyer order {} ", buyerOrder); 101 LOGGER.info("deliverToDepot update buyer order {} ", buyerOrder);
107 buyerOrderMapper.updateByPrimaryKeySelective(buyerOrder); 102 buyerOrderMapper.updateByPrimaryKeySelective(buyerOrder);
108 103
109 // 发送mq获取物流信息 104 // 发送mq获取物流信息
110 - sendExpressMQ(uid,expressCompanyId,orderCode,wayBillCode); 105 + sendExpressMQ(dealUid,expressCompanyId,orderCode,wayBillCode);
111 LOGGER.info("deliverToDepot end ! send express to erp "); 106 LOGGER.info("deliverToDepot end ! send express to erp ");
112 } 107 }
113 108
114 @Override 109 @Override
115 public void appraiseFail(Integer expressCompanyId, Long orderCode, String wayBillCode) { 110 public void appraiseFail(Integer expressCompanyId, Long orderCode, String wayBillCode) {
116 - LOGGER.info("appraiseFail expressCompanyId = {}, orderCode = {}, wayBillCode = {}", new Object[]{expressCompanyId, orderCode, wayBillCode});  
117 - // TODO 111 + OrderStatus orderStatus=OrderStatus.CHECKING_FAKE;
  112 + Integer expressType = ExpressInfoConstant.EXPRESS_TYPE_3;
  113 +
  114 + LOGGER.info("appraiseFail expressCompanyId = {}, orderCode = {}, wayBillCode = {} " +
  115 + ",expressType = {} ,orderStatus = {}", new Object[]{expressCompanyId, orderCode, wayBillCode,expressType,orderStatus});
  116 + BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode);
  117 +
  118 + if (buyerOrder == null){
  119 + LOGGER.warn("appraiseFail getOrderInfo order not exist, orderCode is {}", orderCode);
  120 + throw new ServiceException(ServiceError.ORDER_NULL);
  121 + }
  122 +
  123 + Integer dealUid=buyerOrder.getSellerUid();
  124 +
  125 + // 保存订单物流信息
  126 + saveExpress(dealUid,expressCompanyId,orderCode,wayBillCode,expressType);
  127 +
  128 + // 更新买家订单状态
  129 + buyerOrder.setStatus(orderStatus.getCode());
  130 + buyerOrder.setUpdateTime(DateUtil.getCurrentTimeSecond());
  131 + LOGGER.info("appraiseFail update buyer order {} ", buyerOrder);
  132 + buyerOrderMapper.updateByPrimaryKeySelective(buyerOrder);
  133 +
  134 + // 发送mq获取物流信息
  135 + sendExpressMQ(dealUid,expressCompanyId,orderCode,wayBillCode);
  136 + LOGGER.info("appraiseFail end ! send express to erp ");
118 } 137 }
119 138
120 @Override 139 @Override
121 public void appraiseSuccess(Integer expressCompanyId, Long orderCode, String wayBillCode) { 140 public void appraiseSuccess(Integer expressCompanyId, Long orderCode, String wayBillCode) {
122 - LOGGER.info("appraiseSuccess expressCompanyId = {}, orderCode = {}, wayBillCode = {}", new Object[]{expressCompanyId, orderCode, wayBillCode});  
123 - // TODO 141 + OrderStatus orderStatus=OrderStatus.WAITING_RECEIVE;
  142 + Integer expressType = ExpressInfoConstant.EXPRESS_TYPE_2;
  143 +
  144 + LOGGER.info("appraiseSuccess expressCompanyId = {}, orderCode = {}, wayBillCode = {} " +
  145 + ",expressType = {} ,orderStatus = {}", new Object[]{expressCompanyId, orderCode, wayBillCode,expressType,orderStatus});
  146 + BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode);
  147 +
  148 + if (buyerOrder == null){
  149 + LOGGER.warn("appraiseSuccess getOrderInfo order not exist, orderCode is {}", orderCode);
  150 + throw new ServiceException(ServiceError.ORDER_NULL);
  151 + }
  152 +
  153 + Integer dealUid=buyerOrder.getUid();
  154 +
  155 + // 保存订单物流信息
  156 + saveExpress(dealUid,expressCompanyId,orderCode,wayBillCode,expressType);
  157 +
  158 + // 更新买家订单状态
  159 + buyerOrder.setStatus(orderStatus.getCode());
  160 + buyerOrder.setUpdateTime(DateUtil.getCurrentTimeSecond());
  161 + LOGGER.info("appraiseSuccess update buyer order {} ", buyerOrder);
  162 + buyerOrderMapper.updateByPrimaryKeySelective(buyerOrder);
  163 +
  164 + // 发送mq获取物流信息
  165 + sendExpressMQ(dealUid,expressCompanyId,orderCode,wayBillCode);
  166 + LOGGER.info("appraiseSuccess end ! send express to erp ");
  167 + }
  168 +
  169 +
  170 +
  171 + /**
  172 + * 保存物流信息
  173 + * @param uid 卖家到鉴定中心和鉴定失败时,记录卖家的uid,鉴定成功记录买家uid
  174 + * @param expressCompanyId
  175 + * @param orderCode
  176 + * @param wayBillCode
  177 + * @param expressType
  178 + */
  179 + private void saveExpress(Integer uid,Integer expressCompanyId, Long orderCode, String wayBillCode,Integer expressType ){
  180 + ExpressInfo expressInfo=new ExpressInfo();
  181 + expressInfo.setUid(uid);/// 存卖家的uid
  182 + expressInfo.setOrderCode(orderCode);
  183 + expressInfo.setWaybillCode(wayBillCode);
  184 + expressInfo.setLogisticsType(expressCompanyId);
  185 + expressInfo.setCreateTime(DateUtil.getCurrentTimeSecond());
  186 + expressInfo.setExpressType(expressType.byteValue());
  187 + expressInfo.setState(0);
  188 + LOGGER.info("deliverToDepot save express info {} ", expressInfo);
  189 + expressInfoMapper.insert(expressInfo);
124 } 190 }
125 191
126 /** 192 /**
@@ -148,8 +214,8 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -148,8 +214,8 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
148 * @return 214 * @return
149 */ 215 */
150 @Override 216 @Override
151 - public ExpressInfoRespBo queryExpressDetailInfo(Long orderCode) {  
152 - LOGGER.info("queryExpressDetailInfo orderCode = {}", orderCode); 217 + public ExpressInfoRespBo queryExpressDetailInfo(Integer uid,Long orderCode) {
  218 + LOGGER.info("queryExpressDetailInfo uid={}, orderCode = {}",uid, orderCode);
153 BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode); 219 BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode);
154 220
155 if (buyerOrder == null){ 221 if (buyerOrder == null){
@@ -157,9 +223,8 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -157,9 +223,8 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
157 throw new ServiceException(ServiceError.ORDER_NULL); 223 throw new ServiceException(ServiceError.ORDER_NULL);
158 } 224 }
159 225
160 - Integer uid=buyerOrder.getUid();  
161 ExpressInfoRespBo expressInfoRespBo = new ExpressInfoRespBo(); 226 ExpressInfoRespBo expressInfoRespBo = new ExpressInfoRespBo();
162 - Integer expressType = getExpressType(orderCode); 227 + Integer expressType = getExpressType(buyerOrder);
163 LOGGER.info("getExpressType result = {}", expressType); 228 LOGGER.info("getExpressType result = {}", expressType);
164 List<ExpressInfo> expressInfoList = expressInfoMapper.queryExpressInfo(uid, orderCode, expressType); 229 List<ExpressInfo> expressInfoList = expressInfoMapper.queryExpressInfo(uid, orderCode, expressType);
165 processExpressInfo(expressInfoList, expressInfoRespBo); 230 processExpressInfo(expressInfoList, expressInfoRespBo);
@@ -192,9 +257,20 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -192,9 +257,20 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
192 } 257 }
193 } 258 }
194 259
195 - @Override  
196 - public Integer getExpressType(Long orderCode) {  
197 - Integer uid = null; 260 + /**
  261 + * orderCode 一定是买家订单号
  262 + * @return
  263 + */
  264 + private Integer getExpressType(BuyerOrder buyerOrder) {
  265 + if(OrderStatus.SELLER_SEND_OUT.getCode()==buyerOrder.getStatus()||OrderStatus.PLATFORM_CHECKING.getCode()==buyerOrder.getStatus()){
  266 + return ExpressInfoConstant.EXPRESS_TYPE_1;
  267 + }else if(OrderStatus.CHECKING_FAKE.getCode()==buyerOrder.getStatus()){
  268 + return ExpressInfoConstant.EXPRESS_TYPE_3;
  269 + }else if(OrderStatus.WAITING_RECEIVE.getCode()==buyerOrder.getStatus()||OrderStatus.DONE.getCode()==buyerOrder.getStatus()){
  270 + return ExpressInfoConstant.EXPRESS_TYPE_2;
  271 + }
  272 + return 0;
  273 + /*Integer uid = null;
198 boolean buyer = true; 274 boolean buyer = true;
199 //根据订单号判断是买家还是卖家 275 //根据订单号判断是买家还是卖家
200 CodeMeta codeMeta = orderCodeGenerator.expId(orderCode); 276 CodeMeta codeMeta = orderCodeGenerator.expId(orderCode);
@@ -224,6 +300,6 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -224,6 +300,6 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
224 return ExpressInfoConstant.EXPRESS_TYPE_3; 300 return ExpressInfoConstant.EXPRESS_TYPE_3;
225 } 301 }
226 } 302 }
227 - return 0; 303 + return 0;*/
228 } 304 }
229 } 305 }
@@ -245,7 +245,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi @@ -245,7 +245,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi
245 throw new GatewayException(400, "售价错误"); 245 throw new GatewayException(400, "售价错误");
246 } 246 }
247 247
248 - int addressId = AddressUtil.getDecryptStr(req.getAddressId()); 248 + int addressId = AddressUtil.getDecryptStr("");
249 if (addressId < 0){ 249 if (addressId < 0){
250 log.warn("seller submit order addressId invalidate, uid {}, storageId {}, addressId is {}", 250 log.warn("seller submit order addressId invalidate, uid {}, storageId {}, addressId is {}",
251 uid, storageId, req.getAddressId()); 251 uid, storageId, req.getAddressId());
@@ -75,14 +75,15 @@ @@ -75,14 +75,15 @@
75 75
76 $(function() { 76 $(function() {
77 var productId = getUrlParam('id'); 77 var productId = getUrlParam('id');
  78 + var ajaxUrl = location.pathname.indexOf('ufo-gateway') > -1 ? '/ufo-gateway' : '/';
78 79
79 - $('.download-go').attr('href', 'https://union.yoho.cn/union/app-downloads.html?openby:yohobuy={action":"go.ufo","params":{"isnavhidden":true,"pagename":"productDetail","productId":' + productId + '}}') 80 + $('.download-go').attr('href', 'https://union.yoho.cn/union/app-downloads.html?openby:yohobuy={"action":"go.ufo","params":{"isnavhidden":1,"pagename":"productDetail","productId":' + productId + '}}')
80 81
81 $('.download-close').on('click', function() { 82 $('.download-close').on('click', function() {
82 $('.top-downloadbar').hide(); 83 $('.top-downloadbar').hide();
83 }); 84 });
84 85
85 - $.get('/', { 86 + $.get(ajaxUrl, {
86 method: 'ufo.product.data', 87 method: 'ufo.product.data',
87 product_id: productId 88 product_id: productId
88 }, function(ret) { 89 }, function(ret) {