Authored by mali

Merge branch 'test6.8.5' of http://git.yoho.cn/ufo/yohoufo-fore into test6.8.5

... ... @@ -15,8 +15,11 @@ public interface StoredSellerMapper {
int updateStatusByUid(@Param("uid") int uid, @Param("validStatus") int validStatus, @Param("expectStatus") int expectStatus, @Param("updateTime") long updateTime);
/*int updateToQuitByPrimaryKey(@Param("id")int id,@Param("validStatus") int validStatus ,@Param("expectStatus") int expectStatus
,@Param("operatorUid") int operatorUid,@Param("operatorName") String operatorName
,@Param("quitTime") long quitTime,@Param("updateTime") long updateTime);*/
int insertSelective(StoredSeller record);
int updateByUidSelective(StoredSeller record);
StoredSeller selectByUid(int uid);
}
... ...
... ... @@ -31,8 +31,6 @@ public class StoredSeller {
//退驻时间
private long quitTime;
private long createTime;
private long updateTime;
... ... @@ -40,4 +38,5 @@ public class StoredSeller {
//是否跳过了芝麻认证,1: 跳过 ,default 0
private Integer breakZhiMaCert;
private Integer entryType;
}
... ...
... ... @@ -14,10 +14,12 @@
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
<result column="break_zhi_ma_cert" property="breakZhiMaCert" jdbcType="TINYINT" />
<result column="entry_type" property="entryType" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
id, uid, valid_status,cert_no,cert_name,operator_uid,operator_name,enter_time,quit_time ,create_time, update_time,break_zhi_ma_cert
id, uid, valid_status,cert_no,cert_name,operator_uid,operator_name,enter_time,quit_time ,
create_time, update_time,break_zhi_ma_cert,entry_type
</sql>
<select id="selectValidByUid" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
... ... @@ -36,12 +38,19 @@
order by id desc limit 1
</select>
<select id="selectByUid" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select <include refid="Base_Column_List" />
from stored_seller where uid = #{uid}
</select>
<insert id="insert" parameterType="com.yohoufo.dal.order.model.StoredSeller" >
insert into stored_seller (uid, valid_status,cert_no,cert_name,operator_uid,operator_name,enter_time,quit_time, create_time, update_time,break_zhi_ma_cert)
insert into stored_seller (uid, valid_status,cert_no,cert_name,operator_uid,operator_name,
enter_time,quit_time, create_time, update_time,break_zhi_ma_cert,entry_type)
values (#{uid},#{validStatus},
#{certNo},#{certName},#{operatorUid},#{operatorName},
#{enterTime},#{quitTime},
#{createTime},#{updateTime},#{breakZhiMaCert})
#{createTime},#{updateTime},#{breakZhiMaCert},#{entryType})
</insert>
<update id="updateStatusByUid">
... ... @@ -50,11 +59,122 @@
where uid = #{uid} and valid_status = #{expectStatus}
</update>
<!-- <update id="updateToQuitByPrimaryKey">
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.StoredSeller" useGeneratedKeys="true">
insert into stored_seller
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="uid != null">
uid,
</if>
<if test="validStatus != null">
valid_status,
</if>
<if test="certName != null">
cert_name,
</if>
<if test="certNo != null">
cert_no,
</if>
<if test="enterTime != null">
enter_time,
</if>
<if test="quitTime != null">
quit_time,
</if>
<if test="operatorUid != null">
operator_uid,
</if>
<if test="operatorName != null">
operator_name,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="breakZhiMaCert != null">
break_zhi_ma_cert,
</if>
<if test="entryType != null">
entry_type,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="uid != null">
#{uid,jdbcType=INTEGER},
</if>
<if test="validStatus != null">
#{validStatus,jdbcType=TINYINT},
</if>
<if test="certName != null">
#{certName,jdbcType=VARCHAR},
</if>
<if test="certNo != null">
#{certNo,jdbcType=VARCHAR},
</if>
<if test="enterTime != null">
#{enterTime,jdbcType=INTEGER},
</if>
<if test="quitTime != null">
#{quitTime,jdbcType=INTEGER},
</if>
<if test="operatorUid != null">
#{operatorUid,jdbcType=INTEGER},
</if>
<if test="operatorName != null">
#{operatorName,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=INTEGER},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=INTEGER},
</if>
<if test="breakZhiMaCert != null">
#{breakZhiMaCert,jdbcType=TINYINT},
</if>
<if test="entryType != null">
#{entryType,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByUidSelective" parameterType="com.yohoufo.dal.order.model.StoredSeller">
update stored_seller
set valid_status = #{validStatus},operator_uid = #{operatorUid},operator_name=#{operatorName},
quit_time = #{quitTime} ,update_time = #{updateTime}
where id = #{id} and valid_status = #{expectStatus}
</update>-->
<set>
<if test="validStatus != null">
valid_status = #{validStatus,jdbcType=TINYINT},
</if>
<if test="certName != null">
cert_name = #{certName,jdbcType=VARCHAR},
</if>
<if test="certNo != null">
cert_no = #{certNo,jdbcType=VARCHAR},
</if>
<if test="enterTime != null">
enter_time = #{enterTime,jdbcType=INTEGER},
</if>
<if test="quitTime != null">
quit_time = #{quitTime,jdbcType=INTEGER},
</if>
<if test="operatorUid != null">
operator_uid = #{operatorUid,jdbcType=INTEGER},
</if>
<if test="operatorName != null">
operator_name = #{operatorName,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=INTEGER},
</if>
<if test="breakZhiMaCert != null">
break_zhi_ma_cert = #{breakZhiMaCert,jdbcType=TINYINT},
</if>
<if test="entryType != null">
entry_type = #{entryType,jdbcType=INTEGER},
</if>
</set>
where uid = #{uid,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
... ...
package com.yohoufo.order.service.impl;
import com.yohobuy.ufo.model.enums.StoredSellerStatusEnum;
import com.yohobuy.ufo.model.order.common.EntrySellerType;
import com.yohoufo.common.exception.UfoServiceException;
import com.yohoufo.dal.order.StoredSellerMapper;
import com.yohoufo.dal.order.SuperEntrySellerMapper;
import com.yohoufo.dal.order.model.StoredSeller;
import com.yohoufo.dal.order.model.SuperEntrySeller;
import com.yohoufo.order.common.SurperEntrySellerStatus;
import com.yohoufo.order.service.IStoredSellerService;
... ... @@ -15,6 +19,7 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
... ... @@ -36,6 +41,9 @@ public class SellerService {
@Autowired
private SuperEntrySellerMapper superEntrySellerMapper;
@Autowired
private StoredSellerMapper storedSellerMapper;
/**更低出价提醒
* 1)当有新卖家出价成功或调价成功时,给所有正在出售该sku(尺码)的其他卖家推送一条消息(push+消息盒子)
*2)同一卖家的同一SKU 1小时内仅推送一条提醒(最先推送的那条)
... ... @@ -84,24 +92,59 @@ public class SellerService {
public boolean isSuperEntrySeller(int uid){
if(storedSellerService.isStoredSeller(uid)){
List<Integer> uidList = getSuperEntrySellerUids();
logger.info("isSuperEntrySeller check uid {} uidList {}", uid, uidList);
if (CollectionUtils.isNotEmpty(uidList)){
//hit or not
return uidList.contains(uid);
}
return isSpecialSuper(uid);
}
return false;
}
private boolean isSpecialSuper(int uid){
List<Integer> uidList = getSuperEntrySellerUids();
logger.info("isSuperEntrySeller check uid {} uidList {}", uid, uidList);
if (CollectionUtils.isNotEmpty(uidList)){
//hit or not
return uidList.contains(uid);
}
return false;
}
/**
* 获取入驻商家类型
* @param uid
* @return
*/
public EntrySellerType getEntrySellerType(int uid){
logger.info("getEntrySellerType uid {}", uid);
return EntrySellerType.getEntrySellerType(null);
if (uid<=0){
logger.warn("getEntrySellerType illegal uid {}", uid);
throw new UfoServiceException(401, "uid is not legal");
}
EntrySellerType est = null;
//case 1 : not entry
StoredSeller storedSeller = storedSellerMapper.selectByUid(uid);
if (Objects.isNull(storedSeller)){
est = EntrySellerType.NOT_ENTRY;
logger.info("getEntrySellerType storedSeller is null uid {} entryType {}",
uid, est);
return est;
}
//case 2:exit entry
Integer validStatus = storedSeller.getValidStatus();
Integer entryType = storedSeller.getEntryType();
logger.info("getEntrySellerType uid {} validStatus {} entryType {}",
uid, validStatus, entryType);
if (Objects.equals(StoredSellerStatusEnum.quit.getId(), validStatus)){
est = EntrySellerType.NOT_ENTRY;
}else if(isSpecialSuper(uid)){
//case 3:valid ok and in white list
est = EntrySellerType.SPECIAL_SUPER;
}else if (Objects.equals(StoredSellerStatusEnum.entered.getId(), validStatus)){
//case 4: left common or super
est = EntrySellerType.getEntrySellerType(entryType);
}
logger.info("getEntrySellerType uid {} EntrySellerType {}", uid, est);
return est;
}
}
... ...
... ... @@ -3,6 +3,7 @@ package com.yohoufo.order.service.impl;
import com.yoho.error.exception.ServiceException;
import com.yoho.tools.common.beans.ApiResponse;
import com.yohobuy.ufo.model.enums.StoredSellerStatusEnum;
import com.yohobuy.ufo.model.order.common.EntrySellerType;
import com.yohoufo.common.caller.UfoServiceCaller;
import com.yohoufo.dal.order.StoredSellerMapper;
import com.yohoufo.dal.order.model.StoredSeller;
... ... @@ -148,8 +149,9 @@ public class StoreSellerServiceImpl implements IStoredSellerService {
storedSeller.setCreateTime(ts);
storedSeller.setUpdateTime(ts);
storedSeller.setBreakZhiMaCert(breakZhiMaCert);
storedSeller.setEntryType(EntrySellerType.COMMON.getCode());
logger.info("StoredSellerServiceImpl addUserAsStoredSeller insert uid is {} , storedSeller {} ",uid,storedSeller);
int num=storedSellerMapper.insert(storedSeller);
int num = storedSellerMapper.insert(storedSeller);
if(num<0){
logger.error("StoredSellerServiceImpl addUserAsStoredSeller error uid is {} , storedSeller {} ,insert num {} ",uid,storedSeller,num);
throw new ServiceException(400,"新增入驻商户信息错误");
... ... @@ -160,7 +162,6 @@ public class StoreSellerServiceImpl implements IStoredSellerService {
//发送消息
inBoxFacade.sendMsg4EntySeller(uid);
}
private ZhiMaCert getZhiMaCertInfo(int targetUid) {
... ...