...
|
...
|
@@ -6,20 +6,14 @@ import com.google.common.cache.CacheBuilder; |
|
|
import com.yoho.core.common.utils.DateUtil;
|
|
|
import com.yoho.core.rest.client.ServiceCaller;
|
|
|
import com.yoho.error.exception.ServiceException;
|
|
|
import com.yoho.order.dal.SellerOrderGoodsMapper;
|
|
|
import com.yoho.order.dal.SellerWalletDetailMapper;
|
|
|
import com.yoho.order.dal.SellerWalletMapper;
|
|
|
import com.yoho.order.dal.StoredSellerMapper;
|
|
|
import com.yoho.order.dal.TradeBillsMapper;
|
|
|
import com.yoho.order.model.SellerWallet;
|
|
|
import com.yoho.order.model.StoredSeller;
|
|
|
import com.yoho.order.model.StoredSellerReqVo;
|
|
|
import com.yoho.order.model.TradeBills;
|
|
|
import com.yoho.order.model.TradeBillsReq;
|
|
|
import com.yoho.order.dal.*;
|
|
|
import com.yoho.order.model.*;
|
|
|
import com.yoho.ufo.constants.SellerTypeEnum;
|
|
|
import com.yoho.ufo.order.constant.MoneyTypeEnum;
|
|
|
import com.yoho.ufo.order.constant.TradeStatusEnum;
|
|
|
import com.yoho.ufo.order.response.StoredSellerRespVo;
|
|
|
import com.yoho.ufo.order.service.ITradeBillsService;
|
|
|
import com.yoho.ufo.service.IQNDownloadService;
|
|
|
import com.yoho.ufo.service.model.PageResponseBO;
|
|
|
import com.yoho.ufo.util.CollectionUtil;
|
|
|
import com.yoho.ufo.util.KeyWordHiddenUtil;
|
...
|
...
|
@@ -38,6 +32,7 @@ import org.springframework.stereotype.Service; |
|
|
import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
import java.util.concurrent.Callable;
|
|
|
import java.util.concurrent.ExecutionException;
|
|
|
import java.util.concurrent.TimeUnit;
|
...
|
...
|
@@ -77,6 +72,12 @@ public class TradeBillsServiceImpl implements ITradeBillsService { |
|
|
@Autowired
|
|
|
private SellerOrderGoodsMapper sellerOrderGoodsMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private ZhimaCertMapper zhimaCertMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private IQNDownloadService downloadService;
|
|
|
|
|
|
@Override
|
|
|
public PageResponseBO<StoredSellerRespVo> queryStoredSeller(StoredSellerReqVo req){
|
|
|
if(req.getUid()==null&&StringUtils.isNotBlank(req.getMobile())){
|
...
|
...
|
@@ -86,17 +87,29 @@ public class TradeBillsServiceImpl implements ITradeBillsService { |
|
|
}
|
|
|
}
|
|
|
|
|
|
int total = storedSellerMapper.selectCountByCondition(req);
|
|
|
//int total = storedSellerMapper.selectCountByCondition(req);
|
|
|
SellerReqBO sellerReqBO = SellerReqBO.builder().sellerType(req.getEntryType())
|
|
|
.certName(req.getCertName())
|
|
|
.mobile(req.getMobile())
|
|
|
.uid(req.getUid())
|
|
|
.validStatus(req.getValidStatus()).build();
|
|
|
sellerReqBO.setPage(req.getPage());
|
|
|
sellerReqBO.setStart(req.getStart());
|
|
|
sellerReqBO.setSize(req.getSize());
|
|
|
int total = zhimaCertMapper.selectCountByCondition(sellerReqBO);
|
|
|
if(total == 0) {
|
|
|
LOGGER.warn("queryStoredSeller with total is 0, req is {}",req);
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
List<StoredSeller> storedSellerList = storedSellerMapper.selectByConditionWithPage(req);
|
|
|
if(CollectionUtils.isEmpty(storedSellerList)) {
|
|
|
//List<StoredSeller> storedSellerList = storedSellerMapper.selectByConditionWithPage(req);
|
|
|
List<ZhimaCert> zhimaCertList = zhimaCertMapper.selectByConditionPage(sellerReqBO);
|
|
|
|
|
|
if(CollectionUtils.isEmpty(zhimaCertList)) {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
List<StoredSellerRespVo> respList = convertToStoreSellerResp(storedSellerList);
|
|
|
List<StoredSellerRespVo> respList = convertToStoreSellerResp(zhimaCertList);
|
|
|
|
|
|
PageResponseBO<StoredSellerRespVo> result=new PageResponseBO<>();
|
|
|
result.setList(respList);
|
...
|
...
|
@@ -109,43 +122,66 @@ public class TradeBillsServiceImpl implements ITradeBillsService { |
|
|
|
|
|
}
|
|
|
|
|
|
private List<StoredSellerRespVo> convertToStoreSellerResp(List<StoredSeller> ls ){
|
|
|
private List<StoredSellerRespVo> convertToStoreSellerResp(List<ZhimaCert> ls ){
|
|
|
List<StoredSellerRespVo> respList = Lists.newArrayList();
|
|
|
List<SellerWallet> sws = sellerWalletMapper.selectByUidAndMerchantUids(null, CollectionUtil.distinct(ls,StoredSeller::getUid), 0, ls.size());
|
|
|
List<SellerWallet> sws = sellerWalletMapper.selectByUidAndMerchantUids(null, CollectionUtil.distinct(ls,ZhimaCert::getUid), 0, ls.size());
|
|
|
Map<Integer, SellerWallet> swsMap = CollectionUtil.extractMap(sws, SellerWallet::getUid);
|
|
|
for(StoredSeller item : ls) {
|
|
|
StoredSellerRespVo resp=new StoredSellerRespVo();
|
|
|
for(ZhimaCert item : ls) {
|
|
|
StoredSellerRespVo resp = new StoredSellerRespVo();
|
|
|
resp.setUid(item.getUid());
|
|
|
resp.setCertName(item.getCertName());
|
|
|
resp.setCertNo(KeyWordHiddenUtil.hiddenKeyWord(item.getCertNo(), 2, 2));
|
|
|
resp.setValidStatus(item.getValidStatus());
|
|
|
resp.setValidStatusDesc(StoredSellerStatusEnum.getDescriptionByCode(item.getValidStatus()));
|
|
|
resp.setMobile(getMobileByUidFromCache(item.getUid()));
|
|
|
// 之前fore项目有bug,导致enterTime被更新成0了,如果为0,则去createTime作为入驻时间
|
|
|
if(item.getEnterTime()==0){
|
|
|
resp.setEnterTime(1000L * item.getCreateTime());
|
|
|
}else {
|
|
|
resp.setEnterTime(1000L * item.getEnterTime());
|
|
|
}
|
|
|
resp.setQuitTime(1000L * item.getQuitTime());
|
|
|
// 身份等级
|
|
|
resp.setEntryType(item.getEntryType());
|
|
|
resp.setEntryType(item.getEntryType() == null ? SellerTypeEnum.COMMON.getCode() : item.getEntryType());
|
|
|
//卖家类型
|
|
|
resp.setSellerType(item.getEntryType() == null ? SellerTypeEnum.COMMON.getCode() : item.getEntryType());
|
|
|
//处理入驻商家的一些数据
|
|
|
setEnterInfo(item,resp,swsMap);
|
|
|
resp.setValidStatusDesc(Objects.equals(resp.getEntryType(), SellerTypeEnum.COMMON.getCode()) ? "未入驻" :StoredSellerStatusEnum.getDescriptionByCode(item.getsValidStatus()));
|
|
|
// 上架skuP
|
|
|
resp.setSelfSkuNum(sellerOrderGoodsMapper.selectCountCanCell(item.getUid()));
|
|
|
// 违约次数
|
|
|
resp.setBreakRuleTimes(sellerWalletDetailMapper.selectUserBreakRulesCount(item.getUid()));
|
|
|
// 总余额
|
|
|
SellerWallet sw = swsMap.get(item.getUid());
|
|
|
if (sw != null) {
|
|
|
resp.setMoney(sw.getLockAmount().add(sw.getAmount()).setScale(2).toString());
|
|
|
} else {
|
|
|
resp.setMoney("");
|
|
|
//身份证图片
|
|
|
if(StringUtils.isNotEmpty(item.getImageUrl())){
|
|
|
String[] imgArray = item.getImageUrl().split(",");
|
|
|
resp.setIdCardFrontUrl(downloadService.getPrivateImgUrl(imgArray[0]));
|
|
|
resp.setIdCardBackUrl(imgArray.length > 1 ? downloadService.getPrivateImgUrl(imgArray[1]) : "");
|
|
|
}
|
|
|
|
|
|
//招商人
|
|
|
resp.setInvestName(item.getInvestName());
|
|
|
respList.add(resp);
|
|
|
}
|
|
|
return respList;
|
|
|
}
|
|
|
|
|
|
|
|
|
public void setEnterInfo(ZhimaCert item,StoredSellerRespVo resp,Map<Integer, SellerWallet> swsMap){
|
|
|
if(Objects.equals(resp.getSellerType(), SellerTypeEnum.COMMON.getCode())){
|
|
|
return;
|
|
|
}
|
|
|
//入驻状态
|
|
|
resp.setValidStatus(item.getsValidStatus());
|
|
|
// 之前fore项目有bug,导致enterTime被更新成0了,如果为0,则去createTime作为入驻时间
|
|
|
if(item.getEnterTime()==0){
|
|
|
resp.setEnterTime(1000L * item.getsCreateTime());
|
|
|
}else {
|
|
|
resp.setEnterTime(1000L * item.getEnterTime());
|
|
|
}
|
|
|
resp.setQuitTime(1000L * item.getQuitTime());
|
|
|
|
|
|
// 总余额
|
|
|
SellerWallet sw = swsMap.get(item.getUid());
|
|
|
if (sw != null) {
|
|
|
resp.setMoney(sw.getLockAmount().add(sw.getAmount()).setScale(2).toString());
|
|
|
} else {
|
|
|
resp.setMoney("");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public PageResponseBO<TradeBillsResp> queryTradeBillsList(TradeBillsReq req) {
|
|
|
if(req.getMoneyType()!=null){
|
|
|
MoneyTypeEnum moneyTypeClass =MoneyTypeEnum.getMoneyTypeByCode(req.getMoneyType());
|
...
|
...
|
@@ -298,4 +334,21 @@ public class TradeBillsServiceImpl implements ITradeBillsService { |
|
|
return jsonObject.getJSONObject("data").getInteger("uid");
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 招商人员绑定
|
|
|
* @param investUserBO
|
|
|
* @return
|
|
|
*/
|
|
|
public int saveInvestUser(InvestUserBO investUserBO){
|
|
|
LOGGER.info("enter saveInvestUser with req is {}",investUserBO);
|
|
|
if(investUserBO.getUid() == null || StringUtils.isEmpty(investUserBO.getInvestName())){
|
|
|
LOGGER.warn("saveInvestUser with params null");
|
|
|
return 0;
|
|
|
}
|
|
|
int result = zhimaCertMapper.updateInvestNameByUid(investUserBO.getUid(),investUserBO.getInvestName());
|
|
|
LOGGER.info("end saveInvestUser with req is {},result is {}",investUserBO,result);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|