add apply 2 enter seller
Showing
7 changed files
with
322 additions
and
41 deletions
@@ -2,6 +2,8 @@ package com.yohoufo.dal.order; | @@ -2,6 +2,8 @@ package com.yohoufo.dal.order; | ||
2 | 2 | ||
3 | import com.yohoufo.dal.order.model.SellerEnterApply; | 3 | import com.yohoufo.dal.order.model.SellerEnterApply; |
4 | 4 | ||
5 | +import java.util.List; | ||
6 | + | ||
5 | public interface SellerEnterApplyMapper { | 7 | public interface SellerEnterApplyMapper { |
6 | int deleteByPrimaryKey(Integer id); | 8 | int deleteByPrimaryKey(Integer id); |
7 | 9 | ||
@@ -14,4 +16,6 @@ public interface SellerEnterApplyMapper { | @@ -14,4 +16,6 @@ public interface SellerEnterApplyMapper { | ||
14 | int updateByPrimaryKeySelective(SellerEnterApply record); | 16 | int updateByPrimaryKeySelective(SellerEnterApply record); |
15 | 17 | ||
16 | int updateByPrimaryKey(SellerEnterApply record); | 18 | int updateByPrimaryKey(SellerEnterApply record); |
19 | + | ||
20 | + List<SellerEnterApply> selectByUidEnterType(SellerEnterApply condition); | ||
17 | } | 21 | } |
@@ -20,6 +20,14 @@ | @@ -20,6 +20,14 @@ | ||
20 | from seller_enter_apply | 20 | from seller_enter_apply |
21 | where id = #{id,jdbcType=INTEGER} | 21 | where id = #{id,jdbcType=INTEGER} |
22 | </select> | 22 | </select> |
23 | + | ||
24 | + <select id="selectByUidEnterType" parameterType="com.yohoufo.dal.order.model.SellerEnterApply" resultMap="BaseResultMap"> | ||
25 | + select | ||
26 | + <include refid="Base_Column_List" /> | ||
27 | + from seller_enter_apply | ||
28 | + where uid = #{uid,jdbcType=INTEGER} | ||
29 | + enter_type = #{enterType,jdbcType=INTEGER} | ||
30 | + </select> | ||
23 | <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> | 31 | <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> |
24 | delete from seller_enter_apply | 32 | delete from seller_enter_apply |
25 | where id = #{id,jdbcType=INTEGER} | 33 | where id = #{id,jdbcType=INTEGER} |
1 | package com.yohoufo.order.service.impl; | 1 | package com.yohoufo.order.service.impl; |
2 | 2 | ||
3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
4 | +import com.alibaba.fastjson.TypeReference; | ||
4 | import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder; | 5 | import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder; |
6 | +import com.yohobuy.ufo.model.order.common.EntrySellerType; | ||
5 | import com.yohobuy.ufo.model.order.common.MetaConfigKey; | 7 | import com.yohobuy.ufo.model.order.common.MetaConfigKey; |
8 | +import com.yohobuy.ufo.model.order.resp.EntryThreshold; | ||
6 | import com.yohoufo.common.cache.CacheClient; | 9 | import com.yohoufo.common.cache.CacheClient; |
7 | import com.yohoufo.dal.order.MetaConfigMapper; | 10 | import com.yohoufo.dal.order.MetaConfigMapper; |
8 | import com.yohoufo.dal.order.model.MetaConfig; | 11 | import com.yohoufo.dal.order.model.MetaConfig; |
@@ -15,6 +18,9 @@ import org.slf4j.LoggerFactory; | @@ -15,6 +18,9 @@ import org.slf4j.LoggerFactory; | ||
15 | import org.springframework.beans.factory.annotation.Autowired; | 18 | import org.springframework.beans.factory.annotation.Autowired; |
16 | import org.springframework.stereotype.Service; | 19 | import org.springframework.stereotype.Service; |
17 | 20 | ||
21 | +import java.math.BigDecimal; | ||
22 | +import java.util.HashMap; | ||
23 | +import java.util.Map; | ||
18 | import java.util.Objects; | 24 | import java.util.Objects; |
19 | 25 | ||
20 | /** | 26 | /** |
@@ -58,4 +64,36 @@ public class MetaConfigService { | @@ -58,4 +64,36 @@ public class MetaConfigService { | ||
58 | return bp; | 64 | return bp; |
59 | } | 65 | } |
60 | 66 | ||
67 | + private Map<EntrySellerType,EntryThreshold> buildDefaultEntryThreshold(){ | ||
68 | + Map<EntrySellerType,EntryThreshold> map = new HashMap<>(2); | ||
69 | + EntryThreshold commonET = new EntryThreshold(); | ||
70 | + commonET.setEntrySellerType(EntrySellerType.COMMON); | ||
71 | + commonET.setPrepaymentAmount(new BigDecimal(999)); | ||
72 | + map.put(commonET.getEntrySellerType(), commonET); | ||
73 | + | ||
74 | + EntryThreshold superET = new EntryThreshold(); | ||
75 | + superET.setEntrySellerType(EntrySellerType.SUPER_ENTRY); | ||
76 | + superET.setPrepaymentAmount(new BigDecimal(5000)); | ||
77 | + superET.setGoodsOnOffShelveAmount(new BigDecimal(3000)); | ||
78 | + superET.setHiddenGoodsAmount(new BigDecimal(1000)); | ||
79 | + map.put(superET.getEntrySellerType(), superET); | ||
80 | + | ||
81 | + return map; | ||
82 | + } | ||
83 | + | ||
84 | + public Map<EntrySellerType,EntryThreshold> getEntryThreshold(){ | ||
85 | + Map<EntrySellerType,EntryThreshold> map = new HashMap<>(2); | ||
86 | + String key = MetaConfigKey.SELLER_ENTER_THRESHOLD; | ||
87 | + MetaConfig metaConfig = metaConfigMapper.selectByCode(key); | ||
88 | + logger.info("in getEntryThreshold from DB {}", metaConfig); | ||
89 | + String configVal = null; | ||
90 | + try { | ||
91 | + map = JSONObject.parseObject(configVal=metaConfig.getValue(), new TypeReference<Map<EntrySellerType,EntryThreshold>>(){}); | ||
92 | + }catch (Exception ex){ | ||
93 | + map = buildDefaultEntryThreshold(); | ||
94 | + logger.warn("in getEntryThreshold parse value fail,configVal {} use default {}", configVal, map, ex); | ||
95 | + } | ||
96 | + | ||
97 | + return map; | ||
98 | + } | ||
61 | } | 99 | } |
1 | +package com.yohoufo.order.service.impl; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSONObject; | ||
4 | +import com.yohobuy.ufo.model.order.bo.SellerBo; | ||
5 | +import com.yohobuy.ufo.model.order.common.EntrySellerType; | ||
6 | +import com.yohobuy.ufo.model.order.common.SellerEnterApplyStatus; | ||
7 | +import com.yohobuy.ufo.model.order.common.SuperEnterStageLevel; | ||
8 | +import com.yohoufo.common.exception.UfoServiceException; | ||
9 | +import com.yohoufo.common.utils.DateUtil; | ||
10 | +import com.yohoufo.dal.order.SellerEnterApplyMapper; | ||
11 | +import com.yohoufo.dal.order.model.SellerEnterApply; | ||
12 | +import com.yohoufo.dal.order.model.StoredSeller; | ||
13 | +import com.yohoufo.order.utils.LoggerUtils; | ||
14 | +import org.apache.commons.collections.CollectionUtils; | ||
15 | +import org.apache.commons.lang3.StringUtils; | ||
16 | +import org.slf4j.Logger; | ||
17 | +import org.springframework.beans.factory.annotation.Autowired; | ||
18 | +import org.springframework.stereotype.Service; | ||
19 | + | ||
20 | +import java.util.List; | ||
21 | +import java.util.Objects; | ||
22 | + | ||
23 | +/** | ||
24 | + * Created by chao.chen on 2019/1/14. | ||
25 | + */ | ||
26 | +@Service | ||
27 | +public class SellerEnterApplyService { | ||
28 | + | ||
29 | + private static final Logger logger = LoggerUtils.getSellerOrderLogger(); | ||
30 | + | ||
31 | + @Autowired | ||
32 | + private SellerEnterApplyMapper sellerEnterApplyMapper; | ||
33 | + /** | ||
34 | + * 申请成为超级卖家 | ||
35 | + * 对于未支付的某一种身份申请做订单号替换 | ||
36 | + * @param uid | ||
37 | + * @param orderCode | ||
38 | + */ | ||
39 | + public void applySuperEntry(Integer uid, Long orderCode, EntrySellerType targetEST){ | ||
40 | + logger.info("in applySuperEntry uid {} orderCode {} targetEST {}", uid, orderCode, targetEST); | ||
41 | + if (Objects.isNull(orderCode)){ | ||
42 | + logger.warn("in applySuperEntry uid {} orderCode is null targetEST {}", uid, targetEST); | ||
43 | + throw new UfoServiceException(400, "orderCode is null"); | ||
44 | + } | ||
45 | + if (Objects.isNull(targetEST)){ | ||
46 | + logger.warn("in applySuperEntry uid {} orderCode {} targetEST is null", uid, orderCode); | ||
47 | + throw new UfoServiceException(400, "EntrySellerType is null"); | ||
48 | + } | ||
49 | + SellerService.SellerWrapper sellerWrapper = new SellerService().new SellerWrapper(uid).buildBase(); | ||
50 | + SellerBo sellerBo = sellerWrapper.build(); | ||
51 | + StoredSeller storedSeller = sellerWrapper.getStoredSeller(); | ||
52 | + EntrySellerType currentEST = sellerBo.getEntrySellerType(); | ||
53 | + //入驻卖家表没有记录 | ||
54 | + if (Objects.isNull(storedSeller)){ | ||
55 | + SellerEnterApply condition = new SellerEnterApply(); | ||
56 | + condition.setUid(uid); | ||
57 | + condition.setEnterType(targetEST.getCode()); | ||
58 | + List<SellerEnterApply> seaList = sellerEnterApplyMapper.selectByUidEnterType(condition); | ||
59 | + //是否已经申请 | ||
60 | + if (CollectionUtils.isNotEmpty(seaList)){ | ||
61 | + //有记录 | ||
62 | + SellerEnterApply msea = findSellerEnterApply(uid, orderCode, targetEST, seaList); | ||
63 | + if (Objects.isNull(msea)){ | ||
64 | + logger.info("applySuperEntry no one apply of waiting audit then add new, uid {} orderCode {} targetEST {} ", | ||
65 | + uid, orderCode, targetEST); | ||
66 | + //create new apply | ||
67 | + add(uid, orderCode, currentEST, targetEST); | ||
68 | + }else{ | ||
69 | + //update matched one | ||
70 | + logger.info("applySuperEntry one apply waiting audit then update uid {} orderCode {} targetEST {} matched SellerEnterApply {}", | ||
71 | + uid, orderCode, targetEST, msea); | ||
72 | + update(msea.getId(),orderCode, currentEST, targetEST); | ||
73 | + } | ||
74 | + | ||
75 | + }else{ | ||
76 | + //没有申请过 => 第一次申请 | ||
77 | + logger.info("applySuperEntry no one apply of waiting audit then add new, uid {} orderCode {} targetEST {} ", | ||
78 | + uid, orderCode, targetEST); | ||
79 | + //create new apply | ||
80 | + add(uid, orderCode, currentEST, targetEST); | ||
81 | + } | ||
82 | + | ||
83 | + } | ||
84 | + //入驻卖家表有记录 | ||
85 | + //检查合法标识 | ||
86 | + //检查当前身份 | ||
87 | + if (Objects.nonNull(storedSeller)){ | ||
88 | + | ||
89 | + sellerWrapper.buildSuperEnterStageLevel(); | ||
90 | + Integer entryType = sellerBo.getEntryTypeCode(); | ||
91 | + if(Objects.equals(entryType, EntrySellerType.SUPER_ENTRY.getCode())){ | ||
92 | + SuperEnterStageLevel sesl = sellerBo.getSuperEnterStageLevel(); | ||
93 | + | ||
94 | + | ||
95 | + } | ||
96 | + } | ||
97 | + } | ||
98 | + | ||
99 | + | ||
100 | + private SellerEnterApply findSellerEnterApply(Integer uid, Long orderCode, EntrySellerType targetEST,List<SellerEnterApply> seaList){ | ||
101 | + SellerEnterApply msea = null; | ||
102 | + for(SellerEnterApply sea : seaList){ | ||
103 | + // 异常情况:已经通过 | ||
104 | + if (Objects.equals(sea.getStatus(), SellerEnterApplyStatus.PASS.getCode())){ | ||
105 | + logger.warn("findSellerEnterApply pass one apply, uid {} orderCode {} targetEST {} SellerEnterApply {}", | ||
106 | + uid, orderCode, targetEST, sea); | ||
107 | + } | ||
108 | + // 没有通过 | ||
109 | + if (Objects.equals(sea.getStatus(),SellerEnterApplyStatus.WAITING_AUDIT.getCode())){ | ||
110 | + msea = sea; | ||
111 | + logger.info("findSellerEnterApply one apply waiting audit, uid {} orderCode {} targetEST {} matched SellerEnterApply {}", | ||
112 | + uid, orderCode, targetEST, msea); | ||
113 | + break; | ||
114 | + } | ||
115 | + } | ||
116 | + return msea; | ||
117 | + } | ||
118 | + | ||
119 | + public int update(Integer id,Long orderCode, EntrySellerType currentEST, EntrySellerType targetEST){ | ||
120 | + SellerEnterApply wpOfSea = new SellerEnterApply(); | ||
121 | + wpOfSea.setId(id); | ||
122 | + Integer cdt = DateUtil.getCurrentTimeSecond(); | ||
123 | + wpOfSea.setUpdateTime(cdt); | ||
124 | + wpOfSea.setOrderCode(orderCode); | ||
125 | + wpOfSea.setPreEnterType(currentEST.getCode()); | ||
126 | + wpOfSea.setEnterType(targetEST.getCode()); | ||
127 | + return sellerEnterApplyMapper.updateByPrimaryKeySelective(wpOfSea); | ||
128 | + } | ||
129 | + | ||
130 | + | ||
131 | + public int add(int uid, Long orderCode, EntrySellerType currentEST, EntrySellerType targetEST){ | ||
132 | + SellerEnterApply wpOfSea = new SellerEnterApply(); | ||
133 | + wpOfSea.setUid(uid); | ||
134 | + wpOfSea.setOrderCode(orderCode); | ||
135 | + wpOfSea.setPreEnterType(currentEST.getCode()); | ||
136 | + wpOfSea.setEnterType(targetEST.getCode()); | ||
137 | + Integer cdt = DateUtil.getCurrentTimeSecond(); | ||
138 | + wpOfSea.setCreateTime(cdt); | ||
139 | + wpOfSea.setUpdateTime(cdt); | ||
140 | + wpOfSea.setStatus(SellerEnterApplyStatus.WAITING_AUDIT.getCode()); | ||
141 | + return sellerEnterApplyMapper.insertSelective(wpOfSea); | ||
142 | + } | ||
143 | +} |
1 | +package com.yohoufo.order.service.impl; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSONObject; | ||
4 | +import com.yohoufo.dal.order.model.StoredSeller; | ||
5 | +import com.yohoufo.order.utils.LoggerUtils; | ||
6 | +import org.apache.commons.lang3.StringUtils; | ||
7 | +import org.slf4j.Logger; | ||
8 | +import org.springframework.stereotype.Service; | ||
9 | + | ||
10 | +import java.util.List; | ||
11 | + | ||
12 | +/** | ||
13 | + * Created by chao.chen on 2019/1/14. | ||
14 | + */ | ||
15 | +@Service | ||
16 | +public class SellerFuncService { | ||
17 | + private final Logger logger = LoggerUtils.getSellerOrderLogger(); | ||
18 | + | ||
19 | + | ||
20 | + public List getFuncList(StoredSeller pss){ | ||
21 | + Integer uid = pss.getUid(); | ||
22 | + String lflStr = pss.getLevelFuncList(); | ||
23 | + List<Integer> funcIds = null; | ||
24 | + if (StringUtils.isNotBlank(lflStr)){ | ||
25 | + try { | ||
26 | + funcIds = JSONObject.parseArray(lflStr, Integer.class); | ||
27 | + }catch (Exception ex){ | ||
28 | + logger.warn("in getFuncList parse storedSeller.LevelFuncList fail uid {} funcIds {}", | ||
29 | + uid, lflStr); | ||
30 | + } | ||
31 | + } | ||
32 | + return funcIds; | ||
33 | + } | ||
34 | +} |
1 | package com.yohoufo.order.service.impl; | 1 | package com.yohoufo.order.service.impl; |
2 | 2 | ||
3 | import com.yohobuy.ufo.model.enums.StoredSellerStatusEnum; | 3 | import com.yohobuy.ufo.model.enums.StoredSellerStatusEnum; |
4 | +import com.yohobuy.ufo.model.order.bo.SellerBo; | ||
4 | import com.yohobuy.ufo.model.order.common.EntrySellerType; | 5 | import com.yohobuy.ufo.model.order.common.EntrySellerType; |
6 | +import com.yohobuy.ufo.model.order.common.SellerEnterApplyStatus; | ||
7 | +import com.yohobuy.ufo.model.order.common.SuperEnterStageLevel; | ||
5 | import com.yohobuy.ufo.model.order.resp.EntryThreshold; | 8 | import com.yohobuy.ufo.model.order.resp.EntryThreshold; |
6 | import com.yohoufo.common.exception.UfoServiceException; | 9 | import com.yohoufo.common.exception.UfoServiceException; |
10 | +import com.yohoufo.common.utils.DateUtil; | ||
11 | +import com.yohoufo.dal.order.SellerEnterApplyMapper; | ||
12 | +import com.yohoufo.dal.order.SellerLevelFuncMapper; | ||
7 | import com.yohoufo.dal.order.StoredSellerMapper; | 13 | import com.yohoufo.dal.order.StoredSellerMapper; |
8 | import com.yohoufo.dal.order.SuperEntrySellerMapper; | 14 | import com.yohoufo.dal.order.SuperEntrySellerMapper; |
15 | +import com.yohoufo.dal.order.model.SellerEnterApply; | ||
16 | +import com.yohoufo.dal.order.model.SellerLevelFunc; | ||
9 | import com.yohoufo.dal.order.model.StoredSeller; | 17 | import com.yohoufo.dal.order.model.StoredSeller; |
10 | import com.yohoufo.dal.order.model.SuperEntrySeller; | 18 | import com.yohoufo.dal.order.model.SuperEntrySeller; |
11 | import com.yohoufo.order.common.SurperEntrySellerStatus; | 19 | import com.yohoufo.order.common.SurperEntrySellerStatus; |
@@ -14,6 +22,7 @@ import com.yohoufo.order.service.MerchantOrderPaymentService; | @@ -14,6 +22,7 @@ import com.yohoufo.order.service.MerchantOrderPaymentService; | ||
14 | import com.yohoufo.order.service.cache.StoredSellerCacheService; | 22 | import com.yohoufo.order.service.cache.StoredSellerCacheService; |
15 | import com.yohoufo.order.utils.LoggerUtils; | 23 | import com.yohoufo.order.utils.LoggerUtils; |
16 | import com.yohoufo.user.cache.CacheKeyEnum; | 24 | import com.yohoufo.user.cache.CacheKeyEnum; |
25 | +import lombok.Getter; | ||
17 | import org.apache.commons.collections.CollectionUtils; | 26 | import org.apache.commons.collections.CollectionUtils; |
18 | import org.slf4j.Logger; | 27 | import org.slf4j.Logger; |
19 | import org.springframework.beans.factory.annotation.Autowired; | 28 | import org.springframework.beans.factory.annotation.Autowired; |
@@ -35,7 +44,7 @@ import java.util.stream.Collectors; | @@ -35,7 +44,7 @@ import java.util.stream.Collectors; | ||
35 | @Service | 44 | @Service |
36 | public class SellerService { | 45 | public class SellerService { |
37 | 46 | ||
38 | - private final Logger logger = LoggerUtils.getSellerOrderLogger(); | 47 | + private static final Logger logger = LoggerUtils.getSellerOrderLogger(); |
39 | 48 | ||
40 | @Autowired | 49 | @Autowired |
41 | private StoredSellerCacheService storedSellerCacheService; | 50 | private StoredSellerCacheService storedSellerCacheService; |
@@ -51,6 +60,11 @@ public class SellerService { | @@ -51,6 +60,11 @@ public class SellerService { | ||
51 | 60 | ||
52 | @Autowired | 61 | @Autowired |
53 | private MerchantOrderPaymentService merchantOrderPaymentService; | 62 | private MerchantOrderPaymentService merchantOrderPaymentService; |
63 | + | ||
64 | + @Autowired | ||
65 | + private SellerLevelFuncMapper sellerLevelFuncMapper; | ||
66 | + | ||
67 | + | ||
54 | /**更低出价提醒 | 68 | /**更低出价提醒 |
55 | * 1)当有新卖家出价成功或调价成功时,给所有正在出售该sku(尺码)的其他卖家推送一条消息(push+消息盒子) | 69 | * 1)当有新卖家出价成功或调价成功时,给所有正在出售该sku(尺码)的其他卖家推送一条消息(push+消息盒子) |
56 | *2)同一卖家的同一SKU 1小时内仅推送一条提醒(最先推送的那条) | 70 | *2)同一卖家的同一SKU 1小时内仅推送一条提醒(最先推送的那条) |
@@ -115,55 +129,103 @@ public class SellerService { | @@ -115,55 +129,103 @@ public class SellerService { | ||
115 | return false; | 129 | return false; |
116 | } | 130 | } |
117 | 131 | ||
132 | + public class SellerWrapper{ | ||
133 | + @Getter | ||
134 | + StoredSeller storedSeller; | ||
135 | + Integer uid; | ||
136 | + SellerBo sellerBo = new SellerBo(); | ||
118 | 137 | ||
119 | - /** | ||
120 | - * 获取入驻商家类型 | ||
121 | - * @param uid | ||
122 | - * @return | ||
123 | - */ | ||
124 | - public EntrySellerType getEntrySellerType(int uid){ | ||
125 | - logger.info("getEntrySellerType uid {}", uid); | ||
126 | - if (uid<=0){ | ||
127 | - logger.warn("getEntrySellerType illegal uid {}", uid); | 138 | + SellerWrapper(int uid){ |
139 | + this.uid = uid; | ||
140 | + this.sellerBo.setUid(uid); | ||
141 | + } | ||
142 | + | ||
143 | + SellerWrapper buildBase(){ | ||
144 | + logger.info("buildBase uid {}", uid); | ||
145 | + if (uid <= 0){ | ||
146 | + logger.warn("buildBase illegal uid {}", uid); | ||
128 | throw new UfoServiceException(401, "uid is not legal"); | 147 | throw new UfoServiceException(401, "uid is not legal"); |
129 | } | 148 | } |
149 | + | ||
130 | EntrySellerType est = null; | 150 | EntrySellerType est = null; |
131 | //case 1 : not entry | 151 | //case 1 : not entry |
132 | - StoredSeller storedSeller = storedSellerMapper.selectByUid(uid); | 152 | + this.storedSeller = storedSellerMapper.selectByUid(uid); |
133 | if (Objects.isNull(storedSeller)){ | 153 | if (Objects.isNull(storedSeller)){ |
134 | est = EntrySellerType.NOT_ENTRY; | 154 | est = EntrySellerType.NOT_ENTRY; |
135 | - logger.info("getEntrySellerType storedSeller is null uid {} entryType {}", | 155 | + logger.info("buildBase storedSeller is null uid {} entryType {}", |
136 | uid, est); | 156 | uid, est); |
137 | - return est; | ||
138 | - } | 157 | + }else { |
139 | //case 2:exit entry | 158 | //case 2:exit entry |
140 | Integer validStatus = storedSeller.getValidStatus(); | 159 | Integer validStatus = storedSeller.getValidStatus(); |
141 | Integer entryType = storedSeller.getEntryType(); | 160 | Integer entryType = storedSeller.getEntryType(); |
142 | - logger.info("getEntrySellerType uid {} validStatus {} entryType {}", | 161 | + logger.info("buildBase uid {} validStatus {} entryType {}", |
143 | uid, validStatus, entryType); | 162 | uid, validStatus, entryType); |
144 | - if (Objects.equals(StoredSellerStatusEnum.quit.getId(), validStatus)){ | 163 | + if (Objects.equals(StoredSellerStatusEnum.quit.getId(), validStatus)) { |
145 | est = EntrySellerType.NOT_ENTRY; | 164 | est = EntrySellerType.NOT_ENTRY; |
146 | - }else if(isSpecialSuper(uid)){ | 165 | + } else if (isSpecialSuper(uid)) { |
147 | //case 3:valid ok and in white list | 166 | //case 3:valid ok and in white list |
148 | est = EntrySellerType.SPECIAL_SUPER; | 167 | est = EntrySellerType.SPECIAL_SUPER; |
149 | - }else if (Objects.equals(StoredSellerStatusEnum.entered.getId(), validStatus)){ | 168 | + } else if (Objects.equals(StoredSellerStatusEnum.entered.getId(), validStatus)) { |
150 | //case 4: left common or super | 169 | //case 4: left common or super |
151 | est = EntrySellerType.getEntrySellerType(entryType); | 170 | est = EntrySellerType.getEntrySellerType(entryType); |
152 | } | 171 | } |
153 | - logger.info("getEntrySellerType uid {} EntrySellerType {}", uid, est); | ||
154 | - return est; | 172 | + Integer funcId; |
173 | + if (Objects.nonNull(funcId = storedSeller.getLevelFuncId())){ | ||
174 | + sellerBo.setLevelFuncId(funcId); | ||
175 | + } | ||
176 | + } | ||
177 | + logger.info("buildBase uid {} EntrySellerType {}", uid, est); | ||
178 | + | ||
179 | + if (Objects.nonNull(est)) { | ||
180 | + sellerBo.setEntrySellerType(est); | ||
181 | + sellerBo.setEntryTypeCode(est.getCode()); | ||
182 | + } | ||
183 | + return this; | ||
184 | + } | ||
185 | + | ||
186 | + SellerWrapper buildSuperEnterStageLevel(){ | ||
187 | + EntrySellerType entrySellerType = sellerBo.getEntrySellerType(); | ||
188 | + | ||
189 | + if (Objects.nonNull(entrySellerType)){ | ||
190 | + // | ||
191 | + Integer entryType = sellerBo.getEntryTypeCode(); | ||
192 | + if(Objects.equals(entryType, EntrySellerType.SUPER_ENTRY.getCode())){ | ||
193 | + Integer levelFuncId = sellerBo.getLevelFuncId(); | ||
194 | + if(Objects.nonNull(levelFuncId)){ | ||
195 | + SellerLevelFunc slf = sellerLevelFuncMapper.selectByPrimaryKey(levelFuncId); | ||
196 | + logger.info("buildSuperEnterStageLevel SellerLevelFunc uid {} levelFuncId {} SellerLevelFunc {}", | ||
197 | + uid, levelFuncId, slf); | ||
198 | + Integer level = slf.getLevel(); | ||
199 | + SuperEnterStageLevel sesl = SuperEnterStageLevel.getSuperEnterStageLevel(level); | ||
200 | + sellerBo.setSuperEnterStageLevel(sesl); | ||
201 | + } | ||
202 | + } | ||
203 | + } | ||
204 | + return this; | ||
205 | + } | ||
206 | + | ||
207 | + SellerBo build(){ | ||
208 | + return sellerBo; | ||
155 | } | 209 | } |
156 | 210 | ||
211 | + } | ||
212 | + | ||
213 | + | ||
157 | /** | 214 | /** |
158 | - * 申请成为超级卖家 | ||
159 | - * 对于未支付的某一种身份申请做订单号替换 | 215 | + * 获取入驻商家类型 |
160 | * @param uid | 216 | * @param uid |
161 | - * @param orderCode | 217 | + * @return |
162 | */ | 218 | */ |
163 | - public void applySuperEntry(Integer uid, Long orderCode, EntrySellerType targetEST){ | ||
164 | - | 219 | + public EntrySellerType getEntrySellerType(int uid){ |
220 | + logger.info("getEntrySellerType uid {}", uid); | ||
221 | + SellerBo sellerBo = new SellerWrapper(uid).buildBase().build(); | ||
222 | + EntrySellerType est = sellerBo.getEntrySellerType(); | ||
223 | + logger.info("getEntrySellerType uid {} EntrySellerType {}", uid, est); | ||
224 | + return est; | ||
165 | } | 225 | } |
166 | 226 | ||
227 | + | ||
228 | + | ||
167 | /** | 229 | /** |
168 | * 支付成功后回调 | 230 | * 支付成功后回调 |
169 | * (一)用于处理卖家申请, | 231 | * (一)用于处理卖家申请, |
@@ -183,22 +245,11 @@ public class SellerService { | @@ -183,22 +245,11 @@ public class SellerService { | ||
183 | 245 | ||
184 | } | 246 | } |
185 | 247 | ||
186 | - public Map<EntrySellerType,EntryThreshold> getEntryThreshold(){ | ||
187 | - Map<EntrySellerType,EntryThreshold> map = new HashMap<>(2); | ||
188 | - | ||
189 | - EntryThreshold commonET = new EntryThreshold(); | ||
190 | - commonET.setEntrySellerType(EntrySellerType.COMMON); | ||
191 | - commonET.setPrepaymentAmount(new BigDecimal(999)); | ||
192 | - map.put(commonET.getEntrySellerType(), commonET); | ||
193 | - | ||
194 | - EntryThreshold superET = new EntryThreshold(); | ||
195 | - superET.setEntrySellerType(EntrySellerType.SUPER_ENTRY); | ||
196 | - superET.setPrepaymentAmount(new BigDecimal(5000)); | ||
197 | - superET.setGoodsOnOffShelveAmount(new BigDecimal(3000)); | ||
198 | - superET.setHiddenGoodsAmount(new BigDecimal(1000)); | ||
199 | - map.put(superET.getEntrySellerType(), superET); | 248 | + @Autowired |
249 | + private MetaConfigService metaConfigService; | ||
200 | 250 | ||
201 | - return map; | 251 | + public Map<EntrySellerType,EntryThreshold> getEntryThreshold(){ |
252 | + return metaConfigService.getEntryThreshold(); | ||
202 | } | 253 | } |
203 | 254 | ||
204 | public Boolean applySuperEnter(Integer uid){ | 255 | public Boolean applySuperEnter(Integer uid){ |
@@ -78,6 +78,9 @@ public class StoredSellerDepositServiceImpl implements IStoredSellerDepositServi | @@ -78,6 +78,9 @@ public class StoredSellerDepositServiceImpl implements IStoredSellerDepositServi | ||
78 | @Autowired | 78 | @Autowired |
79 | private SellerService sellerService; | 79 | private SellerService sellerService; |
80 | 80 | ||
81 | + @Autowired | ||
82 | + private SellerEnterApplyService sellerEnterApplyService; | ||
83 | + | ||
81 | /** | 84 | /** |
82 | * 充值保证金 | 85 | * 充值保证金 |
83 | */ | 86 | */ |
@@ -195,7 +198,7 @@ public class StoredSellerDepositServiceImpl implements IStoredSellerDepositServi | @@ -195,7 +198,7 @@ public class StoredSellerDepositServiceImpl implements IStoredSellerDepositServi | ||
195 | } | 198 | } |
196 | 199 | ||
197 | private void markAsSuper(long orderCode, Integer uid, EntrySellerType sellerType) { | 200 | private void markAsSuper(long orderCode, Integer uid, EntrySellerType sellerType) { |
198 | - sellerService.applySuperEntry(uid, orderCode, sellerType); | 201 | + sellerEnterApplyService.applySuperEntry(uid, orderCode, sellerType); |
199 | } | 202 | } |
200 | 203 | ||
201 | /** | 204 | /** |
-
Please register or login to post a comment