Authored by LUOXC

refactor

@@ -200,27 +200,43 @@ public class AppraiseService { @@ -200,27 +200,43 @@ public class AppraiseService {
200 */ 200 */
201 public void deliveryGoodsToBuyer(AppraiseExpressInfoBo appraiseExpressInfoBo) { 201 public void deliveryGoodsToBuyer(AppraiseExpressInfoBo appraiseExpressInfoBo) {
202 LOGGER.info("deliveryGoodsToBuyer enter req {}", appraiseExpressInfoBo); 202 LOGGER.info("deliveryGoodsToBuyer enter req {}", appraiseExpressInfoBo);
203 - final OrderStatus expectOrderStatus;  
204 - final OrderStatus targetOrderStatus = OrderStatus.WAITING_RECEIVE;  
205 Long orderCode = appraiseExpressInfoBo.getOrderCode(); 203 Long orderCode = appraiseExpressInfoBo.getOrderCode();
206 BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode); 204 BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
207 -  
208 if (buyerOrder == null) { 205 if (buyerOrder == null) {
209 LOGGER.warn("deliveryGoodsToBuyer getOrderInfo order not exist, orderCode is {}", orderCode); 206 LOGGER.warn("deliveryGoodsToBuyer getOrderInfo order not exist, orderCode is {}", orderCode);
210 throw new ServiceException(ServiceError.ORDER_NULL); 207 throw new ServiceException(ServiceError.ORDER_NULL);
211 } 208 }
  209 + // 寄存订单
  210 + if(BuyerOrderUtils.isDeposit(buyerOrder.getAttributes())){
  211 + deliveryDepositGoodsToBuyer(appraiseExpressInfoBo, buyerOrder);
  212 + } else {
  213 + deliveryNonDepositGoodsToBuyer(appraiseExpressInfoBo, buyerOrder);
  214 + }
  215 +
  216 + }
  217 +
  218 + private void deliveryDepositGoodsToBuyer(AppraiseExpressInfoBo appraiseExpressInfoBo, BuyerOrder buyerOrder) {
  219 + if(buyerOrder.getStatus() == OrderStatus.DONE.getCode()){
  220 + expressInfoService.deliverGoods(buyerOrder.getUid(),
  221 + appraiseExpressInfoBo.getExpressCompanyId(),
  222 + buyerOrder.getOrderCode(),
  223 + appraiseExpressInfoBo.getWayBillCode(),
  224 + appraiseExpressInfoBo.getDepotNum(),
  225 + appraiseExpressInfoBo.getMobile());
  226 + }else {
  227 + LOGGER.warn("in deliveryGoodsToBuyer, buyer Deposit Order orderCode {}", buyerOrder.getOrderCode());
  228 + throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE);
  229 + }
  230 + }
  231 +
  232 + private void deliveryNonDepositGoodsToBuyer(AppraiseExpressInfoBo appraiseExpressInfoBo, BuyerOrder buyerOrder) {
  233 + final Long orderCode = buyerOrder.getOrderCode();
  234 + final OrderStatus expectOrderStatus;
  235 + final OrderStatus targetOrderStatus = OrderStatus.WAITING_RECEIVE;
212 if (buyerOrder.getStatus() == OrderStatus.JUDGE_PASS.getCode()) { 236 if (buyerOrder.getStatus() == OrderStatus.JUDGE_PASS.getCode()) {
213 expectOrderStatus = OrderStatus.JUDGE_PASS; 237 expectOrderStatus = OrderStatus.JUDGE_PASS;
214 } else if (buyerOrder.getStatus() == OrderStatus.MINI_FAULT_ACCEPT.getCode()) { 238 } else if (buyerOrder.getStatus() == OrderStatus.MINI_FAULT_ACCEPT.getCode()) {
215 expectOrderStatus = OrderStatus.MINI_FAULT_ACCEPT; 239 expectOrderStatus = OrderStatus.MINI_FAULT_ACCEPT;
216 - }  
217 - // 寄存订单已完成  
218 - else if (BuyerOrderUtils.isDeposit(buyerOrder.getAttributes())  
219 - && buyerOrder.getStatus() == OrderStatus.DONE.getCode()) {  
220 - //记录物流信息  
221 - //发物流  
222 - expressInfoService.deliverGoods(buyerOrder.getUid(), appraiseExpressInfoBo.getExpressCompanyId(), orderCode, appraiseExpressInfoBo.getWayBillCode(), appraiseExpressInfoBo.getDepotNum(), appraiseExpressInfoBo.getMobile());  
223 - return;  
224 } else { 240 } else {
225 LOGGER.warn("in deliveryGoodsToBuyer, buyer Order orderCode {} pstatus {}, expect Order Status JUDGE_PASS or MINI_FAULT_ACCEPT ", 241 LOGGER.warn("in deliveryGoodsToBuyer, buyer Order orderCode {} pstatus {}, expect Order Status JUDGE_PASS or MINI_FAULT_ACCEPT ",
226 orderCode, buyerOrder.getStatus()); 242 orderCode, buyerOrder.getStatus());