Authored by caoyan

商品检测不通过

  1 +package com.yoho.order.dal;
  2 +
  3 +import org.apache.ibatis.annotations.Param;
  4 +
  5 +import com.yoho.order.model.BuyerOrderStatusFlow;
  6 +
  7 +/**
  8 + * Created by caoyan on 2019/8/23.
  9 + */
  10 +public interface BuyerOrderStatusFlowMapper {
  11 +
  12 + BuyerOrderStatusFlow selectByOrderCodeAndStatus(@Param("orderCode") String orderCode, @Param("status") Byte status);
  13 +
  14 +}
@@ -139,5 +139,5 @@ public class BuyerOrderReq extends PageRequestBO{ @@ -139,5 +139,5 @@ public class BuyerOrderReq extends PageRequestBO{
139 139
140 private Integer abnormalType;//订单异常类型,1:卖家多发货 2:卖家少发货 3:卖家发错货 140 private Integer abnormalType;//订单异常类型,1:卖家多发货 2:卖家少发货 3:卖家发错货
141 141
142 - 142 + private String detectionNotPassReason;//商品检测不通过原因
143 } 143 }
  1 +package com.yoho.order.model;
  2 +
  3 +import java.io.Serializable;
  4 +
  5 +/**
  6 + * @author caoyan
  7 + * @date 2019/8/23
  8 + */
  9 +public class BuyerOrderStatusFlow implements Serializable {
  10 +
  11 +
  12 + private static final long serialVersionUID = 2607922995706119816L;
  13 +
  14 + private Integer id;
  15 +
  16 + private String orderCode;
  17 +
  18 + private Byte status;
  19 +
  20 + private Integer createTime;
  21 +
  22 + private String remark;
  23 +
  24 + public Integer getId() {
  25 + return id;
  26 + }
  27 +
  28 + public void setId(Integer id) {
  29 + this.id = id;
  30 + }
  31 +
  32 + public String getOrderCode() {
  33 + return orderCode;
  34 + }
  35 +
  36 + public void setOrderCode(String orderCode) {
  37 + this.orderCode = orderCode;
  38 + }
  39 +
  40 + public Byte getStatus() {
  41 + return status;
  42 + }
  43 +
  44 + public void setStatus(Byte status) {
  45 + this.status = status;
  46 + }
  47 +
  48 + public Integer getCreateTime() {
  49 + return createTime;
  50 + }
  51 +
  52 + public void setCreateTime(Integer createTime) {
  53 + this.createTime = createTime;
  54 + }
  55 +
  56 + public String getRemark() {
  57 + return remark;
  58 + }
  59 +
  60 + public void setRemark(String remark) {
  61 + this.remark = remark;
  62 + }
  63 +
  64 + @Override
  65 + public String toString() {
  66 + return "BuyerOrderStatusFlow{" +
  67 + "id=" + id +
  68 + ", orderCode='" + orderCode + '\'' +
  69 + ", status='" + status + '\'' +
  70 + ", createTime='" + createTime + '\'' +
  71 + ", remark='" + remark + '\'' +
  72 + '}';
  73 + }
  74 +}
  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.BuyerOrderStatusFlowMapper">
  4 + <resultMap id="BaseResultMap" type="com.yoho.order.model.BuyerOrderStatusFlow">
  5 + <result column="id" property="id" jdbcType="INTEGER" />
  6 + <result column="order_code" property="orderCode" jdbcType="BIGINT" />
  7 + <result column="status" property="status" jdbcType="TINYINT" />
  8 + <result column="create_time" property="createTime" jdbcType="INTEGER" />
  9 + <result column="remark" property="remark" jdbcType="VARCHAR" />
  10 + </resultMap>
  11 +
  12 + <sql id="Base_Column_List">
  13 + id, order_code, status, create_time, remark
  14 + </sql>
  15 +
  16 + <select id="selectByOrderCodeAndStatus" resultMap="BaseResultMap">
  17 + select <include refid="Base_Column_List" />
  18 + from buyer_order_status_flow where order_code = #{orderCode} and status = #{status}
  19 + </select>
  20 +
  21 +</mapper>
@@ -75,7 +75,8 @@ public enum Constant { @@ -75,7 +75,8 @@ public enum Constant {
75 //无法鉴定 75 //无法鉴定
76 BUYER_ORDER_STATUS_APPRAISE_UNSURE((byte)23,"已取消(无法鉴定)"), 76 BUYER_ORDER_STATUS_APPRAISE_UNSURE((byte)23,"已取消(无法鉴定)"),
77 BUYER_ORDER_STATUS_SETTLE_FAIL_PLATFORM((byte)24,"清关失败(平台原因)"), 77 BUYER_ORDER_STATUS_SETTLE_FAIL_PLATFORM((byte)24,"清关失败(平台原因)"),
78 - BUYER_ORDER_STATUS_SETTLE_FAIL_BUYER((byte)25,"清关失败(买家原因)") 78 + BUYER_ORDER_STATUS_SETTLE_FAIL_BUYER((byte)25,"清关失败(买家原因)"),
  79 + BUYER_ORDER_STATUS_DECETION_NOT_PASS((byte)91, "商品检测不通过"),
79 ; 80 ;
80 81
81 private byte byteVal; 82 private byte byteVal;
@@ -700,4 +700,19 @@ public class BuyerOrderController { @@ -700,4 +700,19 @@ public class BuyerOrderController {
700 700
701 return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(result).build(); 701 return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(result).build();
702 } 702 }
  703 +
  704 + /**
  705 + * 商品检测不通过
  706 + *
  707 + * @param orderCode
  708 + * @return
  709 + */
  710 + @RequestMapping(value = "/detectionNotPass")
  711 + public ApiResponse detectionNotPass(BuyerOrderReq req) {
  712 + if(StringUtils.isEmpty(req.getOrderCode())) {
  713 + return new ApiResponse.ApiResponseBuilder().data("").code(400).message("订单号不能为空").build();
  714 + }
  715 + buyerOrderService.detectionNotpass(req);
  716 + return new ApiResponse.ApiResponseBuilder().code(200).build();
  717 + }
703 } 718 }
@@ -162,4 +162,6 @@ public interface IBuyerOrderService { @@ -162,4 +162,6 @@ public interface IBuyerOrderService {
162 BuyerOrderResp getHiddenReceiveInfoByOrderCode(BuyerOrderReq req); 162 BuyerOrderResp getHiddenReceiveInfoByOrderCode(BuyerOrderReq req);
163 163
164 BuyerOrderResp getHiddenSendBackInfoByOrderCode(BuyerOrderReq req); 164 BuyerOrderResp getHiddenSendBackInfoByOrderCode(BuyerOrderReq req);
  165 +
  166 + void detectionNotpass(BuyerOrderReq req);
165 } 167 }
@@ -58,6 +58,7 @@ import com.yoho.order.dal.AppraiseOrderStorageMapper; @@ -58,6 +58,7 @@ import com.yoho.order.dal.AppraiseOrderStorageMapper;
58 import com.yoho.order.dal.BuyerOrderGoodsMapper; 58 import com.yoho.order.dal.BuyerOrderGoodsMapper;
59 import com.yoho.order.dal.BuyerOrderMapper; 59 import com.yoho.order.dal.BuyerOrderMapper;
60 import com.yoho.order.dal.BuyerOrderMetaMapper; 60 import com.yoho.order.dal.BuyerOrderMetaMapper;
  61 +import com.yoho.order.dal.BuyerOrderStatusFlowMapper;
61 import com.yoho.order.dal.DepositOrderMapper; 62 import com.yoho.order.dal.DepositOrderMapper;
62 import com.yoho.order.dal.ExpressCompanyMapper; 63 import com.yoho.order.dal.ExpressCompanyMapper;
63 import com.yoho.order.dal.ExpressInfoMapper; 64 import com.yoho.order.dal.ExpressInfoMapper;
@@ -89,6 +90,7 @@ import com.yoho.order.model.BuyerOrderFeedback; @@ -89,6 +90,7 @@ import com.yoho.order.model.BuyerOrderFeedback;
89 import com.yoho.order.model.BuyerOrderGoods; 90 import com.yoho.order.model.BuyerOrderGoods;
90 import com.yoho.order.model.BuyerOrderMeta; 91 import com.yoho.order.model.BuyerOrderMeta;
91 import com.yoho.order.model.BuyerOrderReq; 92 import com.yoho.order.model.BuyerOrderReq;
  93 +import com.yoho.order.model.BuyerOrderStatusFlow;
92 import com.yoho.order.model.DepositOrder; 94 import com.yoho.order.model.DepositOrder;
93 import com.yoho.order.model.ExpressCompany; 95 import com.yoho.order.model.ExpressCompany;
94 import com.yoho.order.model.ExpressInfo; 96 import com.yoho.order.model.ExpressInfo;
@@ -308,6 +310,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon @@ -308,6 +310,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
308 @Autowired 310 @Autowired
309 private AppraiseOrderMetaMapper appraiseOrderMetaMapper; 311 private AppraiseOrderMetaMapper appraiseOrderMetaMapper;
310 312
  313 + @Autowired
  314 + private BuyerOrderStatusFlowMapper buyerOrderStatusFlowMapper;
  315 +
311 private static final String BUYER_ORDER_META_KEY_DELIVERY_ADDRESS = "delivery_address"; 316 private static final String BUYER_ORDER_META_KEY_DELIVERY_ADDRESS = "delivery_address";
312 317
313 private static final String BUYER_ORDER_META_KEY_HIDDEN_DELIVER_ADDRESS = "hidden_delivery_address"; 318 private static final String BUYER_ORDER_META_KEY_HIDDEN_DELIVER_ADDRESS = "hidden_delivery_address";
@@ -412,7 +417,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon @@ -412,7 +417,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
412 Constant.BUYER_ORDER_STATUS_JUDGE_PASS.getByteVal(),//平台鉴定通过 417 Constant.BUYER_ORDER_STATUS_JUDGE_PASS.getByteVal(),//平台鉴定通过
413 Constant.BUYER_ORDER_STATUS_JUDGE_NOT_PASS.getByteVal(),//已取消(商品鉴定不通过) 418 Constant.BUYER_ORDER_STATUS_JUDGE_NOT_PASS.getByteVal(),//已取消(商品鉴定不通过)
414 Constant.BUYER_ORDER_STATUS_APPRAISE_UNSURE.getByteVal(),//无法鉴定 419 Constant.BUYER_ORDER_STATUS_APPRAISE_UNSURE.getByteVal(),//无法鉴定
415 - Constant.BUYER_ORDER_STATUS_BUYER_CANCEL_AFTER_SELLER_DELIVERY.getByteVal());//已取消(买家在卖家发货后取消) 420 + Constant.BUYER_ORDER_STATUS_BUYER_CANCEL_AFTER_SELLER_DELIVERY.getByteVal(),//已取消(买家在卖家发货后取消)
  421 + Constant.BUYER_ORDER_STATUS_DECETION_NOT_PASS.getByteVal());//商品检测不通过
416 422
417 //已发货 423 //已发货
418 private static final List<Byte> alreadyDeliverList = Lists.newArrayList(Constant.BUYER_ORDER_STATUS_TO_BE_RECEIVED.getByteVal(),//平台已发货 424 private static final List<Byte> alreadyDeliverList = Lists.newArrayList(Constant.BUYER_ORDER_STATUS_TO_BE_RECEIVED.getByteVal(),//平台已发货
@@ -421,7 +427,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon @@ -421,7 +427,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
421 Constant.CANCEL_MINI_FAULT_REJECT.getByteVal(),//已取消(瑕疵确认不通过) 427 Constant.CANCEL_MINI_FAULT_REJECT.getByteVal(),//已取消(瑕疵确认不通过)
422 Constant.CANCEL_MINI_FAULT_OUT_TIME_REJECT.getByteVal(),//已取消(瑕疵确认超时) 428 Constant.CANCEL_MINI_FAULT_OUT_TIME_REJECT.getByteVal(),//已取消(瑕疵确认超时)
423 Constant.BUYER_ORDER_STATUS_APPRAISE_UNSURE.getByteVal(),//无法鉴定 429 Constant.BUYER_ORDER_STATUS_APPRAISE_UNSURE.getByteVal(),//无法鉴定
424 - Constant.BUYER_ORDER_STATUS_BUYER_CANCEL_AFTER_SELLER_DELIVERY.getByteVal());//已取消(买家在卖家发货后取消) 430 + Constant.BUYER_ORDER_STATUS_BUYER_CANCEL_AFTER_SELLER_DELIVERY.getByteVal(),//已取消(买家在卖家发货后取消)
  431 + Constant.BUYER_ORDER_STATUS_DECETION_NOT_PASS.getByteVal());//商品检测不通过
425 432
426 //问题单 433 //问题单
427 private static final List<Byte> problemList = Lists.newArrayList(Constant.BUYER_ORDER_STATUS_MINI_FAULT_WAITING.getByteVal(),//瑕疵确认中 434 private static final List<Byte> problemList = Lists.newArrayList(Constant.BUYER_ORDER_STATUS_MINI_FAULT_WAITING.getByteVal(),//瑕疵确认中
@@ -1569,6 +1576,37 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon @@ -1569,6 +1576,37 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
1569 return jsonObject; 1576 return jsonObject;
1570 } 1577 }
1571 1578
  1579 + @Override
  1580 + public void detectionNotpass(BuyerOrderReq req) {
  1581 + BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(req.getOrderCode());
  1582 + if (null == buyerOrder) {
  1583 + throw new ServiceException(400, "订单不存在");
  1584 + }
  1585 +
  1586 + if (Constant.BUYER_ORDER_STATUS_DECETION_NOT_PASS.getByteVal() == buyerOrder.getStatus().byteValue()) {
  1587 + return;
  1588 + }
  1589 + if (Constant.BUYER_ORDER_STATUS_PLATFORM_RECEIVE.getByteVal() != buyerOrder.getStatus().byteValue()) {
  1590 + throw new ServiceException(400, "错误:订单状态已变化");
  1591 + }
  1592 +
  1593 + ufoLiveService.checkHasLiveVedioTime(Long.valueOf(req.getOrderCode())); // 检查是否有录制视频
  1594 +
  1595 + int operateType = OperateTypeEnum.OPERATE_TYPE_DETECTION_NOT_PASS.getCode();
  1596 + UserHelper userHelper = new UserHelper();
  1597 + saveOrderOperateRecord(buyerOrder.getOrderCode(), userHelper, operateType, "");
  1598 + LOGGER.info("detectionNotpass saveOrderOperateRecord operateType={} ,order code ={} ,userHelper = {}", operateType, buyerOrder.getOrderCode(), userHelper);
  1599 + String args = "orderAppraise.detectNotPass";
  1600 + LOGGER.info("call ufo-gateway enter orderCode is {}, interface is {}", req.getOrderCode(), args);
  1601 + BuyerOrderCancelReq request = new BuyerOrderCancelReq();
  1602 + request.setUid(buyerOrder.getUid());
  1603 + request.setOrderCode(Long.valueOf(req.getOrderCode()));
  1604 + request.setCancelReason(req.getDetectionNotPassReason());
  1605 + request.setCancelType(Constant.BUYER_ORDER_STATUS_DECETION_NOT_PASS.getByteVal());
  1606 + JSONObject result = serviceCaller.asyncCall(args, request, JSONObject.class).get();
  1607 + LOGGER.info("call ufo-gateway orderCode is {}, interface is {},result is {}", req.getOrderCode(), args, result);
  1608 + }
  1609 +
1572 private BuyerOrder checkParam4ExistOrder(BuyerOrderReq req){ 1610 private BuyerOrder checkParam4ExistOrder(BuyerOrderReq req){
1573 LOGGER.info("checkParam4ExistOrder enter ,req = {}",req); 1611 LOGGER.info("checkParam4ExistOrder enter ,req = {}",req);
1574 boolean isBlankOrderCode = StringUtils.isBlank(req.getOrderCode()); 1612 boolean isBlankOrderCode = StringUtils.isBlank(req.getOrderCode());
@@ -2917,6 +2955,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon @@ -2917,6 +2955,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
2917 2955
2918 resp.setAttributesStr(OrderConfigConstant.getOrderAttributeStr(buyerOrder.getAttributes(), sellerGoods.getRegion())); 2956 resp.setAttributesStr(OrderConfigConstant.getOrderAttributeStr(buyerOrder.getAttributes(), sellerGoods.getRegion()));
2919 2957
  2958 + queryDetectionNotPassReason(resp, buyerOrder.getOrderCode());
  2959 +
2920 return resp; 2960 return resp;
2921 } 2961 }
2922 2962
@@ -4451,7 +4491,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon @@ -4451,7 +4491,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
4451 Constant.CANCEL_QUALITY_CHECK_FAKE.getByteVal(), 4491 Constant.CANCEL_QUALITY_CHECK_FAKE.getByteVal(),
4452 Constant.CANCEL_MINI_FAULT_REJECT.getByteVal(), 4492 Constant.CANCEL_MINI_FAULT_REJECT.getByteVal(),
4453 Constant.CANCEL_MINI_FAULT_OUT_TIME_REJECT.getByteVal(), 4493 Constant.CANCEL_MINI_FAULT_OUT_TIME_REJECT.getByteVal(),
4454 - Constant.BUYER_ORDER_STATUS_APPRAISE_UNSURE.getByteVal() 4494 + Constant.BUYER_ORDER_STATUS_APPRAISE_UNSURE.getByteVal(),
  4495 + Constant.BUYER_ORDER_STATUS_DECETION_NOT_PASS.getByteVal()
4455 ); 4496 );
4456 case 8: 4497 case 8:
4457 return Lists.newArrayList(Constant.BUYER_ORDER_STATUS_PLATFORM_RECEIVE.getByteVal()); 4498 return Lists.newArrayList(Constant.BUYER_ORDER_STATUS_PLATFORM_RECEIVE.getByteVal());
@@ -4617,6 +4658,15 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon @@ -4617,6 +4658,15 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
4617 resp.setAbnormalTypeStr(OrderAbnormalTypeEnum.convertAbnormalTypeStr(order.getType().byteValue())); 4658 resp.setAbnormalTypeStr(OrderAbnormalTypeEnum.convertAbnormalTypeStr(order.getType().byteValue()));
4618 } 4659 }
4619 4660
  4661 + private void queryDetectionNotPassReason(QcOrderDetailResp resp, String orderCode) { // 查询异常订单信息
  4662 + BuyerOrderStatusFlow flow = buyerOrderStatusFlowMapper.selectByOrderCodeAndStatus(orderCode, Constant.BUYER_ORDER_STATUS_DECETION_NOT_PASS.getByteVal());
  4663 + if(null == flow) {
  4664 + return;
  4665 + }
  4666 +
  4667 + resp.setDetectionNotPassReason(StringUtils.isEmpty(flow.getRemark()) ? "" : flow.getRemark());
  4668 + }
  4669 +
4620 /** 4670 /**
4621 * 根据订单号查询具体的物流公司 4671 * 根据订单号查询具体的物流公司
4622 * @return 4672 * @return
@@ -68,6 +68,7 @@ datasources: @@ -68,6 +68,7 @@ datasources:
68 - com.yoho.order.dal.AppraiseOrderMetaMapper 68 - com.yoho.order.dal.AppraiseOrderMetaMapper
69 - com.yoho.order.dal.AppraiseOrderStorageMapper 69 - com.yoho.order.dal.AppraiseOrderStorageMapper
70 - com.yoho.order.dal.OrdersPayRefundMapper 70 - com.yoho.order.dal.OrdersPayRefundMapper
  71 + - com.yoho.order.dal.BuyerOrderStatusFlowMapper
71 72
72 ufo_resource: 73 ufo_resource:
73 servers: 74 servers:
@@ -69,6 +69,7 @@ datasources: @@ -69,6 +69,7 @@ datasources:
69 - com.yoho.order.dal.AppraiseOrderMetaMapper 69 - com.yoho.order.dal.AppraiseOrderMetaMapper
70 - com.yoho.order.dal.AppraiseOrderStorageMapper 70 - com.yoho.order.dal.AppraiseOrderStorageMapper
71 - com.yoho.order.dal.OrdersPayRefundMapper 71 - com.yoho.order.dal.OrdersPayRefundMapper
  72 + - com.yoho.order.dal.BuyerOrderStatusFlowMapper
72 73
73 ufo_resource: 74 ufo_resource:
74 servers: 75 servers:
@@ -79,6 +79,7 @@ @@ -79,6 +79,7 @@
79 <option value="23">已取消(商品无法鉴定)</option> 79 <option value="23">已取消(商品无法鉴定)</option>
80 <option value="24">清关失败(平台原因)</option> 80 <option value="24">清关失败(平台原因)</option>
81 <option value="25">清关失败(买家原因)</option> 81 <option value="25">清关失败(买家原因)</option>
  82 + <option value="91">商品检测不通过</option>
82 </select> 83 </select>
83 84
84 <br><br> 85 <br><br>