Showing
8 changed files
with
148 additions
and
83 deletions
@@ -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 | } |
@@ -64,63 +64,132 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | @@ -64,63 +64,132 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | ||
64 | 64 | ||
65 | private static String EXPRESS_MQ_SEND = "logistics.logistics_data"; | 65 | private static String EXPRESS_MQ_SEND = "logistics.logistics_data"; |
66 | 66 | ||
67 | + /** | ||
68 | + * | ||
69 | + * @param uid 卖家的uid | ||
70 | + * @param expressCompanyId 快递公司id | ||
71 | + * @param orderCode 订单号 :一定是买家订单编号 | ||
72 | + * @param wayBillCode 快递单号 | ||
73 | + */ | ||
67 | @Override | 74 | @Override |
68 | public void deliverToDepot(Integer uid,Integer expressCompanyId, Long orderCode, String wayBillCode) { | 75 | 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 | //保存物流信息+更新订单状态; | 76 | //保存物流信息+更新订单状态; |
72 | //本阶段的物流类型和订单状态 | 77 | //本阶段的物流类型和订单状态 |
73 | - Integer expressType = ExpressInfoConstant.EXPRESS_TYPE_1; | ||
74 | OrderStatus orderStatus=OrderStatus.SELLER_SEND_OUT; | 78 | OrderStatus orderStatus=OrderStatus.SELLER_SEND_OUT; |
79 | + Integer expressType = ExpressInfoConstant.EXPRESS_TYPE_1; | ||
75 | 80 | ||
76 | LOGGER.info("deliverToDepot saveExpressAndUpdateBuyerOrderStatus uid={} ,expressCompanyId = {}, orderCode = {}, wayBillCode = {} " + | 81 | LOGGER.info("deliverToDepot saveExpressAndUpdateBuyerOrderStatus uid={} ,expressCompanyId = {}, orderCode = {}, wayBillCode = {} " + |
77 | ",expressType = {} ,orderStatus = {}", new Object[]{uid ,expressCompanyId, orderCode, wayBillCode,expressType,orderStatus}); | 82 | ",expressType = {} ,orderStatus = {}", new Object[]{uid ,expressCompanyId, orderCode, wayBillCode,expressType,orderStatus}); |
78 | BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode); | 83 | BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode); |
79 | 84 | ||
80 | if (buyerOrder == null){ | 85 | if (buyerOrder == null){ |
81 | - LOGGER.warn("getOrderInfo order not exist, orderCode is {}", orderCode); | 86 | + LOGGER.warn("deliverToDepot getOrderInfo order not exist, orderCode is {}", orderCode); |
82 | throw new ServiceException(ServiceError.ORDER_NULL); | 87 | throw new ServiceException(ServiceError.ORDER_NULL); |
83 | } | 88 | } |
84 | 89 | ||
85 | - if(uid!=buyerOrder.getUid()){ | ||
86 | - LOGGER.warn("deliverToDepot saveExpressAndUpdateBuyerOrderStatus uid {} not equal buyer order uid {}",uid, buyerOrder.getUid()); | 90 | + //卖家的uid |
91 | + if(uid!=buyerOrder.getSellerUid()){ | ||
92 | + LOGGER.warn("deliverToDepot saveExpressAndUpdateBuyerOrderStatus uid {} not equal buyer order sellerUid {}",uid, buyerOrder.getSellerUid()); | ||
87 | throw new ServiceException(ServiceError.ORDER_NULL); | 93 | throw new ServiceException(ServiceError.ORDER_NULL); |
88 | } | 94 | } |
89 | 95 | ||
96 | + Integer dealUid=buyerOrder.getSellerUid(); | ||
97 | + | ||
90 | // 保存订单物流信息 | 98 | // 保存订单物流信息 |
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); | 99 | + saveExpress(dealUid,expressCompanyId,orderCode,wayBillCode,expressType); |
102 | 100 | ||
103 | // 更新买家订单状态 | 101 | // 更新买家订单状态 |
104 | buyerOrder.setStatus(orderStatus.getCode()); | 102 | buyerOrder.setStatus(orderStatus.getCode()); |
105 | - buyerOrder.setUpdateTime(ts); | 103 | + buyerOrder.setUpdateTime(DateUtil.getCurrentTimeSecond()); |
106 | LOGGER.info("deliverToDepot update buyer order {} ", buyerOrder); | 104 | LOGGER.info("deliverToDepot update buyer order {} ", buyerOrder); |
107 | buyerOrderMapper.updateByPrimaryKeySelective(buyerOrder); | 105 | buyerOrderMapper.updateByPrimaryKeySelective(buyerOrder); |
108 | 106 | ||
109 | // 发送mq获取物流信息 | 107 | // 发送mq获取物流信息 |
110 | - sendExpressMQ(uid,expressCompanyId,orderCode,wayBillCode); | 108 | + sendExpressMQ(dealUid,expressCompanyId,orderCode,wayBillCode); |
111 | LOGGER.info("deliverToDepot end ! send express to erp "); | 109 | LOGGER.info("deliverToDepot end ! send express to erp "); |
112 | } | 110 | } |
113 | 111 | ||
114 | @Override | 112 | @Override |
115 | public void appraiseFail(Integer expressCompanyId, Long orderCode, String wayBillCode) { | 113 | public void appraiseFail(Integer expressCompanyId, Long orderCode, String wayBillCode) { |
116 | - LOGGER.info("appraiseFail expressCompanyId = {}, orderCode = {}, wayBillCode = {}", new Object[]{expressCompanyId, orderCode, wayBillCode}); | ||
117 | - // TODO | 114 | + OrderStatus orderStatus=OrderStatus.CHECKING_FAKE; |
115 | + Integer expressType = ExpressInfoConstant.EXPRESS_TYPE_3; | ||
116 | + | ||
117 | + LOGGER.info("appraiseFail expressCompanyId = {}, orderCode = {}, wayBillCode = {} " + | ||
118 | + ",expressType = {} ,orderStatus = {}", new Object[]{expressCompanyId, orderCode, wayBillCode,expressType,orderStatus}); | ||
119 | + BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode); | ||
120 | + | ||
121 | + if (buyerOrder == null){ | ||
122 | + LOGGER.warn("appraiseFail getOrderInfo order not exist, orderCode is {}", orderCode); | ||
123 | + throw new ServiceException(ServiceError.ORDER_NULL); | ||
124 | + } | ||
125 | + | ||
126 | + Integer dealUid=buyerOrder.getSellerUid(); | ||
127 | + | ||
128 | + // 保存订单物流信息 | ||
129 | + saveExpress(dealUid,expressCompanyId,orderCode,wayBillCode,expressType); | ||
130 | + | ||
131 | + // 更新买家订单状态 | ||
132 | + buyerOrder.setStatus(orderStatus.getCode()); | ||
133 | + buyerOrder.setUpdateTime(DateUtil.getCurrentTimeSecond()); | ||
134 | + LOGGER.info("appraiseFail update buyer order {} ", buyerOrder); | ||
135 | + buyerOrderMapper.updateByPrimaryKeySelective(buyerOrder); | ||
136 | + | ||
137 | + // 发送mq获取物流信息 | ||
138 | + sendExpressMQ(dealUid,expressCompanyId,orderCode,wayBillCode); | ||
139 | + LOGGER.info("appraiseFail end ! send express to erp "); | ||
118 | } | 140 | } |
119 | 141 | ||
120 | @Override | 142 | @Override |
121 | public void appraiseSuccess(Integer expressCompanyId, Long orderCode, String wayBillCode) { | 143 | public void appraiseSuccess(Integer expressCompanyId, Long orderCode, String wayBillCode) { |
122 | - LOGGER.info("appraiseSuccess expressCompanyId = {}, orderCode = {}, wayBillCode = {}", new Object[]{expressCompanyId, orderCode, wayBillCode}); | ||
123 | - // TODO | 144 | + OrderStatus orderStatus=OrderStatus.WAITING_RECEIVE; |
145 | + Integer expressType = ExpressInfoConstant.EXPRESS_TYPE_2; | ||
146 | + | ||
147 | + LOGGER.info("appraiseSuccess expressCompanyId = {}, orderCode = {}, wayBillCode = {} " + | ||
148 | + ",expressType = {} ,orderStatus = {}", new Object[]{expressCompanyId, orderCode, wayBillCode,expressType,orderStatus}); | ||
149 | + BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode); | ||
150 | + | ||
151 | + if (buyerOrder == null){ | ||
152 | + LOGGER.warn("appraiseSuccess getOrderInfo order not exist, orderCode is {}", orderCode); | ||
153 | + throw new ServiceException(ServiceError.ORDER_NULL); | ||
154 | + } | ||
155 | + | ||
156 | + Integer dealUid=buyerOrder.getUid(); | ||
157 | + | ||
158 | + // 保存订单物流信息 | ||
159 | + saveExpress(dealUid,expressCompanyId,orderCode,wayBillCode,expressType); | ||
160 | + | ||
161 | + // 更新买家订单状态 | ||
162 | + buyerOrder.setStatus(orderStatus.getCode()); | ||
163 | + buyerOrder.setUpdateTime(DateUtil.getCurrentTimeSecond()); | ||
164 | + LOGGER.info("appraiseSuccess update buyer order {} ", buyerOrder); | ||
165 | + buyerOrderMapper.updateByPrimaryKeySelective(buyerOrder); | ||
166 | + | ||
167 | + // 发送mq获取物流信息 | ||
168 | + sendExpressMQ(dealUid,expressCompanyId,orderCode,wayBillCode); | ||
169 | + LOGGER.info("appraiseSuccess end ! send express to erp "); | ||
170 | + } | ||
171 | + | ||
172 | + | ||
173 | + | ||
174 | + /** | ||
175 | + * 保存物流信息 | ||
176 | + * @param uid 卖家到鉴定中心和鉴定失败时,记录卖家的uid,鉴定成功记录买家uid | ||
177 | + * @param expressCompanyId | ||
178 | + * @param orderCode | ||
179 | + * @param wayBillCode | ||
180 | + * @param expressType | ||
181 | + */ | ||
182 | + private void saveExpress(Integer uid,Integer expressCompanyId, Long orderCode, String wayBillCode,Integer expressType ){ | ||
183 | + ExpressInfo expressInfo=new ExpressInfo(); | ||
184 | + expressInfo.setUid(uid);/// 存卖家的uid | ||
185 | + expressInfo.setOrderCode(orderCode); | ||
186 | + expressInfo.setWaybillCode(wayBillCode); | ||
187 | + expressInfo.setLogisticsType(expressCompanyId); | ||
188 | + expressInfo.setCreateTime(DateUtil.getCurrentTimeSecond()); | ||
189 | + expressInfo.setExpressType(expressType.byteValue()); | ||
190 | + expressInfo.setState(0); | ||
191 | + LOGGER.info("deliverToDepot save express info {} ", expressInfo); | ||
192 | + expressInfoMapper.insert(expressInfo); | ||
124 | } | 193 | } |
125 | 194 | ||
126 | /** | 195 | /** |
@@ -148,8 +217,8 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | @@ -148,8 +217,8 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | ||
148 | * @return | 217 | * @return |
149 | */ | 218 | */ |
150 | @Override | 219 | @Override |
151 | - public ExpressInfoRespBo queryExpressDetailInfo(Long orderCode) { | ||
152 | - LOGGER.info("queryExpressDetailInfo orderCode = {}", orderCode); | 220 | + public ExpressInfoRespBo queryExpressDetailInfo(Integer uid,Long orderCode) { |
221 | + LOGGER.info("queryExpressDetailInfo uid={}, orderCode = {}",uid, orderCode); | ||
153 | BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode); | 222 | BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode); |
154 | 223 | ||
155 | if (buyerOrder == null){ | 224 | if (buyerOrder == null){ |
@@ -157,9 +226,8 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | @@ -157,9 +226,8 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | ||
157 | throw new ServiceException(ServiceError.ORDER_NULL); | 226 | throw new ServiceException(ServiceError.ORDER_NULL); |
158 | } | 227 | } |
159 | 228 | ||
160 | - Integer uid=buyerOrder.getUid(); | ||
161 | ExpressInfoRespBo expressInfoRespBo = new ExpressInfoRespBo(); | 229 | ExpressInfoRespBo expressInfoRespBo = new ExpressInfoRespBo(); |
162 | - Integer expressType = getExpressType(orderCode); | 230 | + Integer expressType = getExpressType(buyerOrder); |
163 | LOGGER.info("getExpressType result = {}", expressType); | 231 | LOGGER.info("getExpressType result = {}", expressType); |
164 | List<ExpressInfo> expressInfoList = expressInfoMapper.queryExpressInfo(uid, orderCode, expressType); | 232 | List<ExpressInfo> expressInfoList = expressInfoMapper.queryExpressInfo(uid, orderCode, expressType); |
165 | processExpressInfo(expressInfoList, expressInfoRespBo); | 233 | processExpressInfo(expressInfoList, expressInfoRespBo); |
@@ -192,9 +260,20 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | @@ -192,9 +260,20 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | ||
192 | } | 260 | } |
193 | } | 261 | } |
194 | 262 | ||
195 | - @Override | ||
196 | - public Integer getExpressType(Long orderCode) { | ||
197 | - Integer uid = null; | 263 | + /** |
264 | + * orderCode 一定是买家订单号 | ||
265 | + * @return | ||
266 | + */ | ||
267 | + private Integer getExpressType(BuyerOrder buyerOrder) { | ||
268 | + if(OrderStatus.SELLER_SEND_OUT.getCode()==buyerOrder.getStatus()||OrderStatus.PLATFORM_CHECKING.getCode()==buyerOrder.getStatus()){ | ||
269 | + return ExpressInfoConstant.EXPRESS_TYPE_1; | ||
270 | + }else if(OrderStatus.CHECKING_FAKE.getCode()==buyerOrder.getStatus()){ | ||
271 | + return ExpressInfoConstant.EXPRESS_TYPE_3; | ||
272 | + }else if(OrderStatus.WAITING_RECEIVE.getCode()==buyerOrder.getStatus()||OrderStatus.DONE.getCode()==buyerOrder.getStatus()){ | ||
273 | + return ExpressInfoConstant.EXPRESS_TYPE_2; | ||
274 | + } | ||
275 | + return 0; | ||
276 | + /*Integer uid = null; | ||
198 | boolean buyer = true; | 277 | boolean buyer = true; |
199 | //根据订单号判断是买家还是卖家 | 278 | //根据订单号判断是买家还是卖家 |
200 | CodeMeta codeMeta = orderCodeGenerator.expId(orderCode); | 279 | CodeMeta codeMeta = orderCodeGenerator.expId(orderCode); |
@@ -224,6 +303,6 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | @@ -224,6 +303,6 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { | ||
224 | return ExpressInfoConstant.EXPRESS_TYPE_3; | 303 | return ExpressInfoConstant.EXPRESS_TYPE_3; |
225 | } | 304 | } |
226 | } | 305 | } |
227 | - return 0; | 306 | + return 0;*/ |
228 | } | 307 | } |
229 | } | 308 | } |
@@ -240,7 +240,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi | @@ -240,7 +240,7 @@ public class SellerOrderService implements IOrderListService, IOrderDetailServi | ||
240 | throw new GatewayException(400, "售价错误"); | 240 | throw new GatewayException(400, "售价错误"); |
241 | } | 241 | } |
242 | 242 | ||
243 | - int addressId = AddressUtil.getDecryptStr(req.getAddressId()); | 243 | + int addressId = AddressUtil.getDecryptStr(""); |
244 | if (addressId < 0){ | 244 | if (addressId < 0){ |
245 | log.warn("seller submit order addressId invalidate, uid {}, storageId {}, addressId is {}", | 245 | log.warn("seller submit order addressId invalidate, uid {}, storageId {}, addressId is {}", |
246 | uid, storageId, req.getAddressId()); | 246 | uid, storageId, req.getAddressId()); |
-
Please register or login to post a comment