Authored by qinchao

Merge branch 'dev_qc691_虚假发货工单' into test6.9.1

... ... @@ -54,6 +54,9 @@ public interface BuyerOrderMapper {
// 修改订单的平台发货状态
int updatePlatformDeliveryStatusByOrderCode(@Param("orderCode")long orderCode, @Param("uid")int uid, @Param("targetPlatformDeliveryStatus")int targetPlatformDeliveryStatus,@Param("currentTime")int currentTime);
// 修改订单的卖家发货状态
int updateSellerDeliveryStatusByOrderCode(@Param("orderCode")long orderCode, @Param("uid")int uid, @Param("targetSellerDeliveryStatus")int targetSellerDeliveryStatus);
// 根据uid查询订单总数
Integer selectOrderNumByUid(@Param("uid")int uid);
... ...
... ... @@ -46,6 +46,12 @@ public class BuyerOrder {
@Getter@Setter
private Integer attributes;
@Getter@Setter
private Integer sellerDeliveryStatus;//卖家的发货物流:1 :已发货且有物流
@Getter@Setter
private Integer sellerDeliveryDeal;//卖家的发货物流,操作员是否已经处理:0:未处理 ,1 :已处理
public Integer getId() {
return id;
}
... ...
... ... @@ -20,10 +20,13 @@
<result column="channel_no" jdbcType="VARCHAR" property="channelNo" />
<result column="attributes" jdbcType="INTEGER" property="attributes" />
<result column="platform_delivery_status" jdbcType="INTEGER" property="platformDeliveryStatus" />
<result column="seller_delivery_status" jdbcType="INTEGER" property="sellerDeliveryStatus" />
<result column="seller_delivery_deal" jdbcType="INTEGER" property="sellerDeliveryDeal" />
</resultMap>
<sql id="Base_Column_List">
id, uid, order_code, seller_uid, client_type, payment, payment_type, is_cancel, amount,
ship_fee, status, create_time, update_time, buyer_order_status, seller_order_status, channel_no, attributes,platform_delivery_status
ship_fee, status, create_time, update_time, buyer_order_status, seller_order_status, channel_no, attributes,platform_delivery_status,
seller_delivery_status,seller_delivery_deal
</sql>
... ... @@ -138,13 +141,15 @@
client_type, payment, payment_type,
is_cancel, amount, ship_fee,
status, create_time, update_time,
buyer_order_status, seller_order_status, channel_no, attributes,platform_delivery_status)
buyer_order_status, seller_order_status, channel_no, attributes,platform_delivery_status,
seller_delivery_status,seller_delivery_deal)
values (#{uid,jdbcType=INTEGER}, #{orderCode,jdbcType=BIGINT}, #{sellerUid,jdbcType=INTEGER},
#{clientType,jdbcType=INTEGER}, #{payment,jdbcType=INTEGER}, #{paymentType,jdbcType=TINYINT},
#{isCancel,jdbcType=TINYINT}, #{amount,jdbcType=DECIMAL}, #{shipFee,jdbcType=DECIMAL},
#{status,jdbcType=INTEGER}, #{createTime,jdbcType=INTEGER}, #{updateTime,jdbcType=INTEGER},
#{buyerOrderStatus,jdbcType=INTEGER}, #{sellerOrderStatus,jdbcType=INTEGER}, #{channelNo,jdbcType=VARCHAR},
#{attributes,jdbcType=INTEGER},#{platformDeliveryStatus,jdbcType=INTEGER})
#{attributes,jdbcType=INTEGER},#{platformDeliveryStatus,jdbcType=INTEGER},
#{sellerDeliveryStatus,jdbcType=INTEGER},#{sellerDeliveryDeal,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.BuyerOrder" useGeneratedKeys="true">
insert into buyer_order
... ... @@ -400,6 +405,12 @@
where uid = #{uid,jdbcType=INTEGER} and order_code = #{orderCode,jdbcType=BIGINT}
</update>
<update id="updateSellerDeliveryStatusByOrderCode">
update buyer_order set
seller_delivery_status = #{targetSellerDeliveryStatus,jdbcType=INTEGER}
where uid = #{uid,jdbcType=INTEGER} and order_code = #{orderCode,jdbcType=BIGINT}
</update>
<select id="selectOrderNumByUid" resultType="java.lang.Integer">
select count(*) from buyer_order where uid = #{uid,jdbcType=INTEGER} and buyer_order_status = 1
</select>
... ...
package com.yohoufo.order.event;
import com.yohoufo.common.alarm.Event;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Builder;
/**
* Created by craig.qin
* 卖家物流检查
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BuyerOrderSellerDeliveryCheckEvent extends Event{
private int uid;
private int sellerUid;
private long orderCode;
}
... ...
... ... @@ -23,7 +23,7 @@ public interface DelayTime {
int MINI_FAULT_CONFIRM_OUTER_TIME_MINUTE=48*60;
//卖家发货后,系统判定虚假发货的超时时间,96小时
int CANCEL_SHAM_DELIVERY_TIME_MINUTE=96*60;
int CANCEL_SHAM_DELIVERY_TIME_MINUTE=48*60;
int MINUTES_120_HOURS = 120 * 60;
}
... ...
... ... @@ -25,6 +25,12 @@ public interface TopicConstants {
*/
String BUYER_ORDER_MINI_FAULT_AUTO_REJECT = "buyerOrder.miniFaultAutoReject";
/**
* 24小时
* 卖家物流揽收检查
*/
String BUYER_ORDER_SELLER_DELIVERY_CHECK = "buyerOrder.sellerDeliveryCheck";
/**
* 96小时
... ...
... ... @@ -2,18 +2,24 @@ package com.yohoufo.order.mq.consumer;
import com.alibaba.fastjson.JSONObject;
import com.yoho.core.rabbitmq.YhConsumer;
import com.yohobuy.ufo.model.order.common.EnumExpressType;
import com.yohobuy.ufo.model.order.common.OperateTypeEnum;
import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohoufo.dal.order.ExpressInfoMapper;
import com.yohoufo.dal.order.model.ExpressInfo;
import com.yohoufo.order.event.BuyerOrderCancelShamDeliveryEvent;
import com.yohoufo.order.mq.TopicConstants;
import com.yohoufo.order.service.impl.AppraiseService;
import com.yohoufo.order.service.impl.BuyerOrderCancelService;
import com.yohoufo.order.service.proxy.OrderOperateRecordService;
import com.yohoufo.order.utils.LoggerUtils;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* 虚假发货取消订单
*/
... ... @@ -23,6 +29,9 @@ public class BuyerOrderCancelShamDeliveryMsgConsumer implements YhConsumer {
final Logger logger = LoggerUtils.getMqConsumerLogger();
@Autowired
private ExpressInfoMapper expressInfoMapper;
@Autowired
private BuyerOrderCancelService buyerOrderCancelService;
@Autowired
... ... @@ -40,6 +49,13 @@ public class BuyerOrderCancelShamDeliveryMsgConsumer implements YhConsumer {
BuyerOrderCancelShamDeliveryEvent event = JSONObject.parseObject(o.toString(), BuyerOrderCancelShamDeliveryEvent.class);
Integer buyerUid = event.getUid();
Long orderCode = event.getOrderCode();
//从物流表查询
List<ExpressInfo> ls = expressInfoMapper.selectByOrderCodeAndExpressType(orderCode, EnumExpressType.EXPRESS_TYPE_1.getCode());
if(CollectionUtils.isNotEmpty(ls)){
logger.info("BuyerOrderCancelShamDeliveryMsgConsumer topic {}, msg {} ,not cancel order because exist express info ", getMessageTopic(), o);
return ;
}
buyerOrderCancelService.cancelForSellerShamSendOut(buyerUid,orderCode, OrderStatus.SELLER_SHAM_SEND_OUT_AUTO);
logger.info("BuyerOrderCancelShamDeliveryMsgConsumer topic {}, msg {} finish", getMessageTopic(), event);
... ...
package com.yohoufo.order.mq.consumer;
import com.alibaba.fastjson.JSONObject;
import com.yoho.core.rabbitmq.YhConsumer;
import com.yohobuy.ufo.model.order.common.EnumExpressType;
import com.yohoufo.common.constant.EnumPlatformDeliveryStatus;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.dal.order.BuyerOrderMapper;
import com.yohoufo.dal.order.ExpressInfoMapper;
import com.yohoufo.dal.order.model.ExpressInfo;
import com.yohoufo.order.event.BuyerOrderSellerDeliveryCheckEvent;
import com.yohoufo.order.mq.TopicConstants;
import com.yohoufo.order.service.impl.BuyerOrderCancelService;
import com.yohoufo.order.service.proxy.OrderOperateRecordService;
import com.yohoufo.order.utils.LoggerUtils;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* 虚假发货取消订单
*/
@Component
public class BuyerOrderSellerDeliveryCheckMsgConsumer implements YhConsumer {
final Logger logger = LoggerUtils.getMqConsumerLogger();
@Autowired
private BuyerOrderMapper buyerOrderMapper;
@Autowired
private ExpressInfoMapper expressInfoMapper;
public String getMessageTopic() {
return TopicConstants.BUYER_ORDER_SELLER_DELIVERY_CHECK;
}
@Override
public void handleMessage(Object o) throws Exception {
logger.info("BuyerOrderSellerDeliveryCheckMsgConsumer topic {}, msg {} ", getMessageTopic(), o);
BuyerOrderSellerDeliveryCheckEvent event = JSONObject.parseObject(o.toString(), BuyerOrderSellerDeliveryCheckEvent.class);
Integer buyerUid = event.getUid();
//Integer sellerUid = event.getSellerUid();
Long orderCode = event.getOrderCode();
//从物流表查询
List<ExpressInfo> ls = expressInfoMapper.selectByOrderCodeAndExpressType(orderCode, EnumExpressType.EXPRESS_TYPE_1.getCode());
if(CollectionUtils.isNotEmpty(ls)){
//存在物流更新成 1
buyerOrderMapper.updateSellerDeliveryStatusByOrderCode(orderCode, buyerUid,
1);
logger.info("BuyerOrderSellerDeliveryCheckMsgConsumer topic {}, msg {} ,update SellerDeliveryStatus with express info ", getMessageTopic(), o);
}
}
}
... ...
... ... @@ -26,10 +26,9 @@ public class BuyerOrderCancelShamDeliveryHandler implements IEventHandler<BuyerO
@Override
@Subscribe
public void handle(BuyerOrderCancelShamDeliveryEvent event) {
logger.info("do nothing and return ! Subscribe Buyer Order Cancel ShamDelivery Event delay msg,event {}" ,event);
//int minutes = DelayTime.CANCEL_SHAM_DELIVERY_TIME_MINUTE ;
//logger.info("Subscribe Buyer Order Cancel ShamDelivery Event delay msg, minutes {} ,event {}", minutes ,event);
int minutes = DelayTime.CANCEL_SHAM_DELIVERY_TIME_MINUTE ;
logger.info("Subscribe Buyer Order Cancel ShamDelivery Event delay msg, minutes {} ,event {}", minutes ,event);
//tradeMqSender.send(TopicConstants.BUYER_ORDER_CANCEL_SHAM_DELIVER, event, minutes);
tradeMqSender.send(TopicConstants.BUYER_ORDER_CANCEL_SHAM_DELIVER, event, minutes);
}
}
... ...
package com.yohoufo.order.service.handler;
import com.google.common.eventbus.Subscribe;
import com.yohoufo.common.alarm.IEventHandler;
import com.yohoufo.order.event.BuyerOrderSellerDeliveryCheckEvent;
import com.yohoufo.order.mq.DelayTime;
import com.yohoufo.order.mq.TopicConstants;
import com.yohoufo.order.mq.producer.TradeMqSender;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Created by craig
* 卖家物流检查
*/
@Component
public class BuyerOrderSellerDeliveryCheckHandler implements IEventHandler<BuyerOrderSellerDeliveryCheckEvent> {
final Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private TradeMqSender tradeMqSender;
@Override
@Subscribe
public void handle(BuyerOrderSellerDeliveryCheckEvent event) {
logger.info("Subscribe Buyer Order Seller Delivery Event delay msg,event {}" ,event);
int minutes = DelayTime.MINUTES_24_HOURS ;
minutes = 20;
tradeMqSender.send(TopicConstants.BUYER_ORDER_SELLER_DELIVERY_CHECK, event, minutes);
}
}
... ...
... ... @@ -22,6 +22,7 @@ import com.yohoufo.dal.order.model.*;
import com.yohoufo.order.common.ExpressForMqSend;
import com.yohoufo.order.constants.MetaKey;
import com.yohoufo.order.event.BuyerOrderCancelShamDeliveryEvent;
import com.yohoufo.order.event.BuyerOrderSellerDeliveryCheckEvent;
import com.yohoufo.order.event.ErpBuyerOrderEvent;
import com.yohoufo.order.model.response.AppraiseAddressResp;
import com.yohoufo.order.mq.DelayTime;
... ... @@ -184,6 +185,10 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
inBoxFacade.sellerDeliver2Depot(buyerUid, orderCode, psog);
//卖家物流检查
BuyerOrderSellerDeliveryCheckEvent sellerDeliveryCheckEvent = BuyerOrderSellerDeliveryCheckEvent.builder().uid(buyerUid).sellerUid(sellerUid).orderCode(orderCode).build();
EventBusPublisher.publishEvent(sellerDeliveryCheckEvent);
//虚假发货的mq
BuyerOrderCancelShamDeliveryEvent shamDeliveryEvent = BuyerOrderCancelShamDeliveryEvent.builder().uid(buyerUid).orderCode(orderCode).build();
EventBusPublisher.publishEvent(shamDeliveryEvent);
... ...
... ... @@ -223,6 +223,8 @@ public class SubmitOrderServiceImpl implements ISubmitOrderService {
buyerOrder.setSellerOrderStatus(DelStatus.NOT_DEL.getCode());
buyerOrder.setAttributes(orderBuilder.getAttributes());
buyerOrder.setPlatformDeliveryStatus(0);//平台发货状态给默认值
buyerOrder.setSellerDeliveryStatus(0);
buyerOrder.setSellerDeliveryDeal(0);
buyerOrderMapper.insert(buyerOrder);
}
... ...
... ... @@ -23,10 +23,16 @@ consumer:
delay:
interval: 1440
#- class: com.yohoufo.order.mq.consumer.BuyerOrderCancelShamDeliveryMsgConsumer
# topic: buyerOrder.cancelShamDeliver
# delay:
# interval: 5760
#卖家物流揽收情况检查 24小时
- class: com.yohoufo.order.mq.consumer.BuyerOrderSellerDeliveryCheckMsgConsumer
topic: buyerOrder.sellerDeliveryCheck
delay:
interval: 1440
- class: com.yohoufo.order.mq.consumer.BuyerOrderCancelShamDeliveryMsgConsumer
topic: buyerOrder.cancelShamDeliver
delay:
interval: 2880
- class: com.yohoufo.order.mq.consumer.NotPaidNoticeDelayMsgConsumer
topic: order.notPaidNotice
... ...
... ... @@ -25,10 +25,16 @@ consumer:
delay:
interval: 2880
#- class: com.yohoufo.order.mq.consumer.BuyerOrderCancelShamDeliveryMsgConsumer
# topic: buyerOrder.cancelShamDeliver
# delay:
# interval: 5760
#卖家物流揽收情况检查 24小时
- class: com.yohoufo.order.mq.consumer.BuyerOrderSellerDeliveryCheckMsgConsumer
topic: buyerOrder.sellerDeliveryCheck
delay:
interval: 20
- class: com.yohoufo.order.mq.consumer.BuyerOrderCancelShamDeliveryMsgConsumer
topic: buyerOrder.cancelShamDeliver
delay:
interval: 2880
#order.notPaidNotice
- class: com.yohoufo.order.mq.consumer.NotPaidNoticeDelayMsgConsumer
... ...