Authored by chenchao

fix

@@ -55,7 +55,7 @@ public class SellerEnterApplyService { @@ -55,7 +55,7 @@ public class SellerEnterApplyService {
55 logger.info("in applySuperEntry uid {} orderCode {} targetEST {}", uid, orderCode, targetEST); 55 logger.info("in applySuperEntry uid {} orderCode {} targetEST {}", uid, orderCode, targetEST);
56 if (Objects.isNull(orderCode)){ 56 if (Objects.isNull(orderCode)){
57 logger.warn("in applySuperEntry uid {} orderCode is null targetEST {}", uid, targetEST); 57 logger.warn("in applySuperEntry uid {} orderCode is null targetEST {}", uid, targetEST);
58 - throw new UfoServiceException(400, "orderCode is null"); 58 + //throw new UfoServiceException(400, "orderCode is null");
59 } 59 }
60 if (Objects.isNull(targetEST)){ 60 if (Objects.isNull(targetEST)){
61 logger.warn("in applySuperEntry uid {} orderCode {} targetEST is null", uid, orderCode); 61 logger.warn("in applySuperEntry uid {} orderCode {} targetEST is null", uid, orderCode);
@@ -160,16 +160,27 @@ public class SellerEnterApplyService { @@ -160,16 +160,27 @@ public class SellerEnterApplyService {
160 seac.setUid(uid); 160 seac.setUid(uid);
161 seac.setOrderCode(orderCode); 161 seac.setOrderCode(orderCode);
162 List<SellerEnterApply> seaList = sellerEnterApplyMapper.selectByUOCET(seac); 162 List<SellerEnterApply> seaList = sellerEnterApplyMapper.selectByUOCET(seac);
  163 + upgradeLevel(uid, orderCode, left, seaList);
  164 + }
  165 +
  166 +
  167 + public void upgradeLevel(int uid, Long orderCode, BigDecimal left, List<SellerEnterApply> seaList){
163 if (CollectionUtils.isEmpty(seaList)){ 168 if (CollectionUtils.isEmpty(seaList)){
164 - logger.warn("in audit SellerEnterApply no record so that it's only charge order, uid {} orderCode {}", 169 + logger.warn("in upgradeLevel no record so that it's only charge order, uid {} orderCode {}",
165 uid, orderCode); 170 uid, orderCode);
166 return; 171 return;
167 } 172 }
168 if (seaList.size()>1){ 173 if (seaList.size()>1){
169 - logger.warn("in audit SellerEnterApply one orderCode mapped multiple apply,uid {} orderCode {}", uid, orderCode); 174 + logger.warn("in upgradeLevel one orderCode mapped multiple apply,uid {} orderCode {}", uid, orderCode);
170 } 175 }
171 //卖家包装类 176 //卖家包装类
172 SellerService.SellerWrapper sellerWrapper = new SellerService().new SellerWrapper(uid).buildBase(); 177 SellerService.SellerWrapper sellerWrapper = new SellerService().new SellerWrapper(uid).buildBase();
  178 + upgradeLevel(sellerWrapper, orderCode, left, seaList);
  179 + }
  180 +
  181 + public void upgradeLevel(SellerService.SellerWrapper sellerWrapper,
  182 + Long orderCode, BigDecimal left, List<SellerEnterApply> seaList){
  183 + int uid = sellerWrapper.getUid();
173 //持久化的入驻信息 184 //持久化的入驻信息
174 StoredSeller pss = sellerWrapper.getStoredSeller(); 185 StoredSeller pss = sellerWrapper.getStoredSeller();
175 SellerBo sellerBo = sellerWrapper.build(); 186 SellerBo sellerBo = sellerWrapper.build();
@@ -191,7 +202,7 @@ public class SellerEnterApplyService { @@ -191,7 +202,7 @@ public class SellerEnterApplyService {
191 boolean isMatchedET = Objects.equals(preEnterType=msea.getPreEnterType(), currentEnterType); 202 boolean isMatchedET = Objects.equals(preEnterType=msea.getPreEnterType(), currentEnterType);
192 boolean noStoredSeller = Objects.isNull(pss); 203 boolean noStoredSeller = Objects.isNull(pss);
193 204
194 - logger.info("in audit SellerEnterApply ready pass apply and add StoredSeller, uid {} orderCode {} currentEnterType {} PreEnterType {} noStoredSeller {} target Level {} isMatchedET {}", 205 + logger.info("in upgradeLevel ready pass apply and add StoredSeller, uid {} orderCode {} currentEnterType {} PreEnterType {} noStoredSeller {} target Level {} isMatchedET {}",
195 uid, orderCode, currentEnterType,preEnterType, noStoredSeller, level, isMatchedET); 206 uid, orderCode, currentEnterType,preEnterType, noStoredSeller, level, isMatchedET);
196 if(Objects.equals(currentEnterType, EntrySellerType.NOT_ENTRY.getCode())){ 207 if(Objects.equals(currentEnterType, EntrySellerType.NOT_ENTRY.getCode())){
197 //普通卖家 -> 普通入驻 ,1. apply 状态 ,2. enter_seller 从无到有 208 //普通卖家 -> 普通入驻 ,1. apply 状态 ,2. enter_seller 从无到有
@@ -204,7 +215,7 @@ public class SellerEnterApplyService { @@ -204,7 +215,7 @@ public class SellerEnterApplyService {
204 SellerLevelFuncBo slfb = sellerFuncService.getSellerLevelFunc(targetEst.getCode(), level); 215 SellerLevelFuncBo slfb = sellerFuncService.getSellerLevelFunc(targetEst.getCode(), level);
205 storedSellerService.addUserAsStoredSeller(uid, targetEst, slfb); 216 storedSellerService.addUserAsStoredSeller(uid, targetEst, slfb);
206 }else{ 217 }else{
207 - logger.warn("in audit SellerEnterApply add StoredSeller fail, uid {} orderCode {}", 218 + logger.warn("in upgradeLevel add StoredSeller fail, uid {} orderCode {}",
208 uid, orderCode); 219 uid, orderCode);
209 } 220 }
210 221
@@ -216,13 +227,13 @@ public class SellerEnterApplyService { @@ -216,13 +227,13 @@ public class SellerEnterApplyService {
216 SellerLevelFuncBo slfb = sellerFuncService.getSellerLevelFunc(targetEst.getCode(), level); 227 SellerLevelFuncBo slfb = sellerFuncService.getSellerLevelFunc(targetEst.getCode(), level);
217 storedSellerService.addUserAsStoredSeller(uid, targetEst, slfb); 228 storedSellerService.addUserAsStoredSeller(uid, targetEst, slfb);
218 }else{ 229 }else{
219 - logger.warn("in audit SellerEnterApply add StoredSeller fail, uid {} orderCode {}", 230 + logger.warn("in upgradeLevel add StoredSeller fail, uid {} orderCode {}",
220 uid, orderCode); 231 uid, orderCode);
221 } 232 }
222 233
223 }else if (Objects.equals(currentEnterType, EntrySellerType.SPECIAL_SUPER.getCode())){ 234 }else if (Objects.equals(currentEnterType, EntrySellerType.SPECIAL_SUPER.getCode())){
224 //白名单超级卖家 235 //白名单超级卖家
225 - logger.warn("in audit SellerEnterApply SPECIAL_SUPER no need any action, uid {} orderCode {}", 236 + logger.warn("in upgradeLevel SPECIAL_SUPER no need any action, uid {} orderCode {}",
226 uid, orderCode); 237 uid, orderCode);
227 }else if (Objects.equals(currentEnterType, EntrySellerType.SUPER_ENTRY.getCode())){ 238 }else if (Objects.equals(currentEnterType, EntrySellerType.SUPER_ENTRY.getCode())){
228 //超级卖家 239 //超级卖家
@@ -232,15 +243,13 @@ public class SellerEnterApplyService { @@ -232,15 +243,13 @@ public class SellerEnterApplyService {
232 boolean levelNeedUpgrade = Objects.nonNull(sesl) 243 boolean levelNeedUpgrade = Objects.nonNull(sesl)
233 && Objects.nonNull(currentLevel = sesl.getCode()) 244 && Objects.nonNull(currentLevel = sesl.getCode())
234 && !currentLevel.equals(level); 245 && !currentLevel.equals(level);
235 - logger.warn("in audit SellerEnterApply update StoredSeller, uid {} orderCode {} currentLevel {} target level {}", 246 + logger.warn("in upgradeLevel update StoredSeller, uid {} orderCode {} currentLevel {} target level {}",
236 uid, orderCode, currentLevel, level); 247 uid, orderCode, currentLevel, level);
237 if (!noStoredSeller && isMatchedET && levelNeedUpgrade) { 248 if (!noStoredSeller && isMatchedET && levelNeedUpgrade) {
238 SellerLevelFuncBo slfb = sellerFuncService.getSellerLevelFunc(targetEst.getCode(), level); 249 SellerLevelFuncBo slfb = sellerFuncService.getSellerLevelFunc(targetEst.getCode(), level);
239 storedSellerService.updateEnterSeller(uid, targetEst, slfb); 250 storedSellerService.updateEnterSeller(uid, targetEst, slfb);
240 } 251 }
241 } 252 }
242 -  
243 -  
244 } 253 }
245 254
246 /** 255 /**
@@ -67,6 +67,8 @@ public class SellerService { @@ -67,6 +67,8 @@ public class SellerService {
67 @Autowired 67 @Autowired
68 private SellerEnterApplyService sellerEnterApplyService; 68 private SellerEnterApplyService sellerEnterApplyService;
69 69
  70 + private SellerEnterApplyMapper sellerEnterApplyMapper;
  71 +
70 72
71 /**更低出价提醒 73 /**更低出价提醒
72 * 1)当有新卖家出价成功或调价成功时,给所有正在出售该sku(尺码)的其他卖家推送一条消息(push+消息盒子) 74 * 1)当有新卖家出价成功或调价成功时,给所有正在出售该sku(尺码)的其他卖家推送一条消息(push+消息盒子)
@@ -117,7 +119,10 @@ public class SellerService { @@ -117,7 +119,10 @@ public class SellerService {
117 119
118 public boolean isSuperEntrySeller(int uid){ 120 public boolean isSuperEntrySeller(int uid){
119 if(storedSellerService.isStoredSeller(uid)){ 121 if(storedSellerService.isStoredSeller(uid)){
120 - return isSpecialSuper(uid); 122 + EntrySellerType est = getEntrySellerType(uid);
  123 + boolean result = Objects.equals(est.getCode(), EntrySellerType.SPECIAL_SUPER)
  124 + || Objects.equals(est.getCode(), EntrySellerType.SUPER_ENTRY);
  125 + return result;
121 } 126 }
122 return false; 127 return false;
123 } 128 }
@@ -257,14 +262,40 @@ public class SellerService { @@ -257,14 +262,40 @@ public class SellerService {
257 } 262 }
258 263
259 public Boolean applySuperEnter(Integer uid){ 264 public Boolean applySuperEnter(Integer uid){
  265 + SellerService.SellerWrapper sellerWrapper = new SellerService()
  266 + .new SellerWrapper(uid).buildBase();
  267 + SellerBo sellerBo = sellerWrapper.build();
  268 + EntrySellerType currentEST = sellerBo.getEntrySellerType();
  269 + EntrySellerType targetEST = EntrySellerType.SUPER_ENTRY;
  270 + if (Objects.equals(targetEST, currentEST)
  271 + || Objects.equals(EntrySellerType.SPECIAL_SUPER, currentEST)){
  272 + logger.info("applySuperEnter user was {} , uid {}", currentEST , uid);
  273 + return true;
  274 + }
  275 + //普通个人
  276 + if (Objects.equals(targetEST, EntrySellerType.NOT_ENTRY)){
  277 + logger.info("applySuperEnter user was {} , uid {}", currentEST , uid);
  278 + return false;
  279 + }
  280 + //left enter type is 入驻非超级
260 BigDecimal leftInWallet = merchantOrderPaymentService.getWalletLeftAmount(uid); 281 BigDecimal leftInWallet = merchantOrderPaymentService.getWalletLeftAmount(uid);
261 - //TODO 前提:1. 当前卖家是 普通个人 or 入驻非超级 2. 钱包余额大于等于超级的阈值 282 + //前提:1. 当前卖家是 普通个人 or 入驻非超级 2. 钱包余额大于等于超级的阈值
262 Map<EntrySellerType,EntryThreshold> entryThreshold = getEntryThreshold(); 283 Map<EntrySellerType,EntryThreshold> entryThreshold = getEntryThreshold();
263 EntryThreshold set = entryThreshold.get(EntrySellerType.SUPER_ENTRY); 284 EntryThreshold set = entryThreshold.get(EntrySellerType.SUPER_ENTRY);
264 boolean isFatWallet = leftInWallet.compareTo(set.getPrepaymentAmount()) >= 0; 285 boolean isFatWallet = leftInWallet.compareTo(set.getPrepaymentAmount()) >= 0;
265 logger.info("applySuperEnter uid {} leftInWallet {} super EntryThreshold {} isFatWallet {}", 286 logger.info("applySuperEnter uid {} leftInWallet {} super EntryThreshold {} isFatWallet {}",
266 uid, leftInWallet, set, isFatWallet); 287 uid, leftInWallet, set, isFatWallet);
267 - //TODO 申请记录(新增 or 修改) 入驻卖家(enter_type level_func 功能菜单) 288 + //申请记录(新增 or 修改) 入驻卖家(enter_type level_func 功能菜单)
  289 + if (isFatWallet){
  290 + //insert apply
  291 + sellerEnterApplyService.applySuperEntry(uid, null, targetEST);
  292 + //
  293 + SellerEnterApply seac = new SellerEnterApply();
  294 + seac.setUid(uid);
  295 + seac.setEnterType(targetEST.getCode());
  296 + List<SellerEnterApply> seaList = sellerEnterApplyMapper.selectByUOCET(seac);
  297 + sellerEnterApplyService.upgradeLevel(sellerWrapper, null, leftInWallet, seaList);
  298 + }
268 return isFatWallet; 299 return isFatWallet;
269 } 300 }
270 } 301 }