|
|
package com.yohoufo.user.service.impl;
|
|
|
|
|
|
import com.yoho.error.exception.ServiceException;
|
|
|
import com.yohobuy.ufo.model.enums.StoredSellerStatusEnum;
|
|
|
import com.yohoufo.dal.user.IStoredSellerDao;
|
|
|
import com.yohoufo.dal.user.model.StoredSeller;
|
|
|
import com.yohoufo.dal.user.model.ZhiMaCert;
|
|
|
import com.yohoufo.user.cache.CacheService;
|
|
|
import com.yohoufo.user.service.IRealNameAuthorizeService;
|
|
|
import com.yohoufo.user.service.IStoredSellerService;
|
...
|
...
|
@@ -28,7 +30,29 @@ public class StoredSellerServiceImpl implements IStoredSellerService { |
|
|
@Autowired
|
|
|
private IStoredSellerDao storedSellerDao;
|
|
|
|
|
|
@Override
|
|
|
public void applyQuitStoredSeller(Integer uid){
|
|
|
logger.info("StoredSellerServiceImpl applyQuitStoredSeller uid is {} ",uid);
|
|
|
StoredSeller storedSeller = getValidStoredSeller(uid);
|
|
|
if(null==storedSeller){
|
|
|
logger.error("StoredSellerServiceImpl applyQuitStoredSeller store seller is null,uid is {} ",uid);
|
|
|
throw new ServiceException(400,"未找到入驻信息");
|
|
|
}
|
|
|
|
|
|
if(!StoredSellerStatusEnum.entered.getId().equals(storedSeller.getValidStatus())){
|
|
|
throw new ServiceException(400,"商户入驻状态变化,不允许申请退出!");
|
|
|
}
|
|
|
|
|
|
int num = storedSellerDao.updateStatusByPrimaryKey(storedSeller.getId(),StoredSellerStatusEnum.apply_quit.getId());
|
|
|
//清掉缓存
|
|
|
cacheService.removeStoredSeller(uid);
|
|
|
|
|
|
logger.info("StoredSellerServiceImpl applyQuitStoredSeller end ,uid is {} ,update num ",uid,num);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public boolean isStoredSeller(Integer uid){
|
|
|
logger.info("StoredSellerServiceImpl isStoredSeller uid is {} ",uid);
|
|
|
StoredSeller storedSeller = getValidStoredSeller(uid);
|
|
|
if(storedSeller!=null&&storedSeller.getUid()!=null){
|
|
|
return true;
|
...
|
...
|
@@ -38,7 +62,7 @@ public class StoredSellerServiceImpl implements IStoredSellerService { |
|
|
|
|
|
private StoredSeller getValidStoredSeller(Integer uid){
|
|
|
//从缓存中获取
|
|
|
logger.info("StoredSellerServiceImpl isStoredSeller uid is {} ",uid);
|
|
|
logger.info("StoredSellerServiceImpl getValidStoredSeller uid is {} ",uid);
|
|
|
StoredSeller storedSeller = cacheService.getStoredSeller(uid);
|
|
|
logger.info("StoredSellerServiceImpl valid store seller uid is {} ,redis info is {} ",uid,storedSeller);
|
|
|
if(null != storedSeller){
|
...
|
...
|
@@ -60,7 +84,8 @@ public class StoredSellerServiceImpl implements IStoredSellerService { |
|
|
public void addUserAsStoredSeller(Integer uid){
|
|
|
logger.info("StoredSellerServiceImpl addUserAsStoredSeller enter uid is {} ",uid);
|
|
|
//检查是否已经实名认证
|
|
|
if(null==realNameAuthorizeService.getValidZhiMaCert(uid)){
|
|
|
ZhiMaCert zhiMaCert=realNameAuthorizeService.getValidZhiMaCert(uid);
|
|
|
if(null==zhiMaCert){
|
|
|
logger.error("StoredSellerServiceImpl get zhi ma cert info is null , uid is {} ",uid);
|
|
|
throw new ServiceException(400,"商户没有实名认证,不允许更新为入驻商户");
|
|
|
}
|
...
|
...
|
@@ -73,7 +98,10 @@ public class StoredSellerServiceImpl implements IStoredSellerService { |
|
|
long ts=now.toEpochSecond(ZoneOffset.of("+8"));
|
|
|
StoredSeller storedSeller=new StoredSeller();
|
|
|
storedSeller.setUid(uid);
|
|
|
storedSeller.setValidStatus(1);
|
|
|
storedSeller.setValidStatus(StoredSellerStatusEnum.entered.getId());
|
|
|
storedSeller.setEnterTime(ts);
|
|
|
storedSeller.setCertNo(zhiMaCert.getCertNo());
|
|
|
storedSeller.setCertName(zhiMaCert.getCertName());
|
|
|
storedSeller.setCreateTime(ts);
|
|
|
storedSeller.setUpdateTime(ts);
|
|
|
logger.info("StoredSellerServiceImpl addUserAsStoredSeller insert uid is {} , storedSeller {} ",uid,storedSeller);
|
...
|
...
|
|