Authored by caoyan

商品检测不通过

package com.yoho.order.dal;
import org.apache.ibatis.annotations.Param;
import com.yoho.order.model.BuyerOrderStatusFlow;
/**
* Created by caoyan on 2019/8/23.
*/
public interface BuyerOrderStatusFlowMapper {
BuyerOrderStatusFlow selectByOrderCodeAndStatus(@Param("orderCode") String orderCode, @Param("status") Byte status);
}
... ...
... ... @@ -139,5 +139,5 @@ public class BuyerOrderReq extends PageRequestBO{
private Integer abnormalType;//订单异常类型,1:卖家多发货 2:卖家少发货 3:卖家发错货
private String detectionNotPassReason;//商品检测不通过原因
}
... ...
package com.yoho.order.model;
import java.io.Serializable;
/**
* @author caoyan
* @date 2019/8/23
*/
public class BuyerOrderStatusFlow implements Serializable {
private static final long serialVersionUID = 2607922995706119816L;
private Integer id;
private String orderCode;
private Byte status;
private Integer createTime;
private String remark;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getOrderCode() {
return orderCode;
}
public void setOrderCode(String orderCode) {
this.orderCode = orderCode;
}
public Byte getStatus() {
return status;
}
public void setStatus(Byte status) {
this.status = status;
}
public Integer getCreateTime() {
return createTime;
}
public void setCreateTime(Integer createTime) {
this.createTime = createTime;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
@Override
public String toString() {
return "BuyerOrderStatusFlow{" +
"id=" + id +
", orderCode='" + orderCode + '\'' +
", status='" + status + '\'' +
", createTime='" + createTime + '\'' +
", remark='" + remark + '\'' +
'}';
}
}
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.order.dal.BuyerOrderStatusFlowMapper">
<resultMap id="BaseResultMap" type="com.yoho.order.model.BuyerOrderStatusFlow">
<result column="id" property="id" jdbcType="INTEGER" />
<result column="order_code" property="orderCode" jdbcType="BIGINT" />
<result column="status" property="status" jdbcType="TINYINT" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="remark" property="remark" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List">
id, order_code, status, create_time, remark
</sql>
<select id="selectByOrderCodeAndStatus" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from buyer_order_status_flow where order_code = #{orderCode} and status = #{status}
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -75,7 +75,8 @@ public enum Constant {
//无法鉴定
BUYER_ORDER_STATUS_APPRAISE_UNSURE((byte)23,"已取消(无法鉴定)"),
BUYER_ORDER_STATUS_SETTLE_FAIL_PLATFORM((byte)24,"清关失败(平台原因)"),
BUYER_ORDER_STATUS_SETTLE_FAIL_BUYER((byte)25,"清关失败(买家原因)")
BUYER_ORDER_STATUS_SETTLE_FAIL_BUYER((byte)25,"清关失败(买家原因)"),
BUYER_ORDER_STATUS_DECETION_NOT_PASS((byte)91, "商品检测不通过"),
;
private byte byteVal;
... ...
... ... @@ -700,4 +700,19 @@ public class BuyerOrderController {
return new ApiResponse.ApiResponseBuilder().code(200).message("查询成功").data(result).build();
}
/**
* 商品检测不通过
*
* @param orderCode
* @return
*/
@RequestMapping(value = "/detectionNotPass")
public ApiResponse detectionNotPass(BuyerOrderReq req) {
if(StringUtils.isEmpty(req.getOrderCode())) {
return new ApiResponse.ApiResponseBuilder().data("").code(400).message("订单号不能为空").build();
}
buyerOrderService.detectionNotpass(req);
return new ApiResponse.ApiResponseBuilder().code(200).build();
}
}
... ...
... ... @@ -162,4 +162,6 @@ public interface IBuyerOrderService {
BuyerOrderResp getHiddenReceiveInfoByOrderCode(BuyerOrderReq req);
BuyerOrderResp getHiddenSendBackInfoByOrderCode(BuyerOrderReq req);
void detectionNotpass(BuyerOrderReq req);
}
... ...
... ... @@ -58,6 +58,7 @@ import com.yoho.order.dal.AppraiseOrderStorageMapper;
import com.yoho.order.dal.BuyerOrderGoodsMapper;
import com.yoho.order.dal.BuyerOrderMapper;
import com.yoho.order.dal.BuyerOrderMetaMapper;
import com.yoho.order.dal.BuyerOrderStatusFlowMapper;
import com.yoho.order.dal.DepositOrderMapper;
import com.yoho.order.dal.ExpressCompanyMapper;
import com.yoho.order.dal.ExpressInfoMapper;
... ... @@ -89,6 +90,7 @@ import com.yoho.order.model.BuyerOrderFeedback;
import com.yoho.order.model.BuyerOrderGoods;
import com.yoho.order.model.BuyerOrderMeta;
import com.yoho.order.model.BuyerOrderReq;
import com.yoho.order.model.BuyerOrderStatusFlow;
import com.yoho.order.model.DepositOrder;
import com.yoho.order.model.ExpressCompany;
import com.yoho.order.model.ExpressInfo;
... ... @@ -308,6 +310,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
@Autowired
private AppraiseOrderMetaMapper appraiseOrderMetaMapper;
@Autowired
private BuyerOrderStatusFlowMapper buyerOrderStatusFlowMapper;
private static final String BUYER_ORDER_META_KEY_DELIVERY_ADDRESS = "delivery_address";
private static final String BUYER_ORDER_META_KEY_HIDDEN_DELIVER_ADDRESS = "hidden_delivery_address";
... ... @@ -412,7 +417,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
Constant.BUYER_ORDER_STATUS_JUDGE_PASS.getByteVal(),//平台鉴定通过
Constant.BUYER_ORDER_STATUS_JUDGE_NOT_PASS.getByteVal(),//已取消(商品鉴定不通过)
Constant.BUYER_ORDER_STATUS_APPRAISE_UNSURE.getByteVal(),//无法鉴定
Constant.BUYER_ORDER_STATUS_BUYER_CANCEL_AFTER_SELLER_DELIVERY.getByteVal());//已取消(买家在卖家发货后取消)
Constant.BUYER_ORDER_STATUS_BUYER_CANCEL_AFTER_SELLER_DELIVERY.getByteVal(),//已取消(买家在卖家发货后取消)
Constant.BUYER_ORDER_STATUS_DECETION_NOT_PASS.getByteVal());//商品检测不通过
//已发货
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
Constant.CANCEL_MINI_FAULT_REJECT.getByteVal(),//已取消(瑕疵确认不通过)
Constant.CANCEL_MINI_FAULT_OUT_TIME_REJECT.getByteVal(),//已取消(瑕疵确认超时)
Constant.BUYER_ORDER_STATUS_APPRAISE_UNSURE.getByteVal(),//无法鉴定
Constant.BUYER_ORDER_STATUS_BUYER_CANCEL_AFTER_SELLER_DELIVERY.getByteVal());//已取消(买家在卖家发货后取消)
Constant.BUYER_ORDER_STATUS_BUYER_CANCEL_AFTER_SELLER_DELIVERY.getByteVal(),//已取消(买家在卖家发货后取消)
Constant.BUYER_ORDER_STATUS_DECETION_NOT_PASS.getByteVal());//商品检测不通过
//问题单
private static final List<Byte> problemList = Lists.newArrayList(Constant.BUYER_ORDER_STATUS_MINI_FAULT_WAITING.getByteVal(),//瑕疵确认中
... ... @@ -1568,6 +1575,37 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
return jsonObject;
}
@Override
public void detectionNotpass(BuyerOrderReq req) {
BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(req.getOrderCode());
if (null == buyerOrder) {
throw new ServiceException(400, "订单不存在");
}
if (Constant.BUYER_ORDER_STATUS_DECETION_NOT_PASS.getByteVal() == buyerOrder.getStatus().byteValue()) {
return;
}
if (Constant.BUYER_ORDER_STATUS_PLATFORM_RECEIVE.getByteVal() != buyerOrder.getStatus().byteValue()) {
throw new ServiceException(400, "错误:订单状态已变化");
}
ufoLiveService.checkHasLiveVedioTime(Long.valueOf(req.getOrderCode())); // 检查是否有录制视频
int operateType = OperateTypeEnum.OPERATE_TYPE_DETECTION_NOT_PASS.getCode();
UserHelper userHelper = new UserHelper();
saveOrderOperateRecord(buyerOrder.getOrderCode(), userHelper, operateType, "");
LOGGER.info("detectionNotpass saveOrderOperateRecord operateType={} ,order code ={} ,userHelper = {}", operateType, buyerOrder.getOrderCode(), userHelper);
String args = "orderAppraise.detectNotPass";
LOGGER.info("call ufo-gateway enter orderCode is {}, interface is {}", req.getOrderCode(), args);
BuyerOrderCancelReq request = new BuyerOrderCancelReq();
request.setUid(buyerOrder.getUid());
request.setOrderCode(Long.valueOf(req.getOrderCode()));
request.setCancelReason(req.getDetectionNotPassReason());
request.setCancelType(Constant.BUYER_ORDER_STATUS_DECETION_NOT_PASS.getByteVal());
JSONObject result = serviceCaller.asyncCall(args, request, JSONObject.class).get();
LOGGER.info("call ufo-gateway orderCode is {}, interface is {},result is {}", req.getOrderCode(), args, result);
}
private BuyerOrder checkParam4ExistOrder(BuyerOrderReq req){
LOGGER.info("checkParam4ExistOrder enter ,req = {}",req);
... ... @@ -2914,9 +2952,11 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
queryStorageDeposit(resp, buyerOrder.getOrderCode()); //查询寄存信息
queryAbnormalOrder(resp, buyerOrder.getOrderCode());//查询异常订单信息
resp.setAttributesStr(OrderConfigConstant.getOrderAttributeStr(buyerOrder.getAttributes(), sellerGoods.getRegion()));
queryDetectionNotPassReason(resp, buyerOrder.getOrderCode());
return resp;
}
... ... @@ -4451,7 +4491,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
Constant.CANCEL_QUALITY_CHECK_FAKE.getByteVal(),
Constant.CANCEL_MINI_FAULT_REJECT.getByteVal(),
Constant.CANCEL_MINI_FAULT_OUT_TIME_REJECT.getByteVal(),
Constant.BUYER_ORDER_STATUS_APPRAISE_UNSURE.getByteVal()
Constant.BUYER_ORDER_STATUS_APPRAISE_UNSURE.getByteVal(),
Constant.BUYER_ORDER_STATUS_DECETION_NOT_PASS.getByteVal()
);
case 8:
return Lists.newArrayList(Constant.BUYER_ORDER_STATUS_PLATFORM_RECEIVE.getByteVal());
... ... @@ -4616,6 +4657,15 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
resp.setAbnormalTypeStr(OrderAbnormalTypeEnum.convertAbnormalTypeStr(order.getType().byteValue()));
}
private void queryDetectionNotPassReason(QcOrderDetailResp resp, String orderCode) { // 查询异常订单信息
BuyerOrderStatusFlow flow = buyerOrderStatusFlowMapper.selectByOrderCodeAndStatus(orderCode, Constant.BUYER_ORDER_STATUS_DECETION_NOT_PASS.getByteVal());
if(null == flow) {
return;
}
resp.setDetectionNotPassReason(StringUtils.isEmpty(flow.getRemark()) ? "" : flow.getRemark());
}
/**
* 根据订单号查询具体的物流公司
... ...
... ... @@ -68,6 +68,7 @@ datasources:
- com.yoho.order.dal.AppraiseOrderMetaMapper
- com.yoho.order.dal.AppraiseOrderStorageMapper
- com.yoho.order.dal.OrdersPayRefundMapper
- com.yoho.order.dal.BuyerOrderStatusFlowMapper
ufo_resource:
servers:
... ...
... ... @@ -69,6 +69,7 @@ datasources:
- com.yoho.order.dal.AppraiseOrderMetaMapper
- com.yoho.order.dal.AppraiseOrderStorageMapper
- com.yoho.order.dal.OrdersPayRefundMapper
- com.yoho.order.dal.BuyerOrderStatusFlowMapper
ufo_resource:
servers:
... ...
... ... @@ -79,6 +79,7 @@
<option value="23">已取消(商品无法鉴定)</option>
<option value="24">清关失败(平台原因)</option>
<option value="25">清关失败(买家原因)</option>
<option value="91">商品检测不通过</option>
</select>
<br><br>
... ...