...
|
...
|
@@ -3,6 +3,8 @@ package com.yohoufo.order.service.impl; |
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.yoho.core.config.ConfigReader;
|
|
|
import com.yoho.core.dal.datasource.annotation.Database;
|
|
|
import com.yoho.error.ServiceError;
|
|
|
import com.yoho.error.exception.ServiceException;
|
|
|
import com.yoho.tools.common.beans.ApiResponse;
|
|
|
import com.yohobuy.ufo.model.order.bo.MerchantOrderAttachInfo;
|
|
|
import com.yohobuy.ufo.model.order.common.EntrySellerType;
|
...
|
...
|
@@ -99,18 +101,12 @@ public class EntrySellerRechargeServiceImpl implements IEntrySellerRechargeServi |
|
|
@Database(ForceMaster = true, DataSource = "ufo_order")
|
|
|
public void againEntry(EntrySellerRecharge entrySellerRecharge){
|
|
|
|
|
|
logger.error("seller entry againEntry {}", entrySellerRecharge);
|
|
|
|
|
|
int uid = entrySellerRecharge.getUid();
|
|
|
BigDecimal amount = entrySellerRecharge.getAmount();
|
|
|
long orderCode = entrySellerRecharge.getOrderCode();
|
|
|
int payment = entrySellerRecharge.getPayment();
|
|
|
|
|
|
// 1. 检查芝麻认证用户
|
|
|
String againEntryCertNo = geytZhiMaCertNo(uid);
|
|
|
|
|
|
if (StringUtils.isBlank(againEntryCertNo)){
|
|
|
logger.error("again_entry geytZhiMaCertNo null ,uid={}", uid);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
SellerWallet sw = sellerWalletMapper.selectByUidAndType(uid, 1);
|
|
|
if (sw == null){
|
...
|
...
|
@@ -118,11 +114,11 @@ public class EntrySellerRechargeServiceImpl implements IEntrySellerRechargeServi |
|
|
return;
|
|
|
}
|
|
|
|
|
|
// 2.检查是否达到了 入驻上线
|
|
|
if (!canRejoin(uid, sw.getJoinTimes(), againEntryCertNo)){
|
|
|
logger.error("again_entry joinTimes maxTimes,uid: {},times: {}", uid, sw.getJoinTimes());
|
|
|
return;
|
|
|
}
|
|
|
// // 2.检查是否达到了 入驻上限 ==> 都已经支付成功回调了,才来检查是否超过入驻上限?
|
|
|
// if (!canRejoin(uid, sw.getJoinTimes(), entrySellerRecharge.getCertNo())){
|
|
|
// logger.error("again_entry joinTimes maxTimes,uid: {},times: {}", uid, sw.getJoinTimes());
|
|
|
// return;
|
|
|
// }
|
|
|
|
|
|
// 3. 更新 钱包总表
|
|
|
int uptCnt = sellerWalletMapper.rejoin(uid, amount, null, TimeUtils.getTimeStampSecond(), sw.getJoinTimes() + 1);
|
...
|
...
|
@@ -135,10 +131,10 @@ public class EntrySellerRechargeServiceImpl implements IEntrySellerRechargeServi |
|
|
clearOldEntryData(orderCode, uid);
|
|
|
|
|
|
// 5. 增加入驻次数
|
|
|
addJoinHistory(uid, againEntryCertNo);
|
|
|
addJoinHistory(uid, entrySellerRecharge.getCertNo());
|
|
|
|
|
|
// 6. 增加明细
|
|
|
addSellerWalletDetail(orderCode, uid, sw.getId(), amount, payment);
|
|
|
addSellerWalletDetail(orderCode, uid, sw.getId(), amount, entrySellerRecharge.getPayment());
|
|
|
}
|
|
|
|
|
|
|
...
|
...
|
@@ -149,24 +145,19 @@ public class EntrySellerRechargeServiceImpl implements IEntrySellerRechargeServi |
|
|
@Database(ForceMaster = true, DataSource = "ufo_order")
|
|
|
public void firstEntry(EntrySellerRecharge entrySellerRecharge){
|
|
|
|
|
|
logger.error("seller entry firstEntry {}", entrySellerRecharge);
|
|
|
|
|
|
int uid = entrySellerRecharge.getUid();
|
|
|
BigDecimal amount = entrySellerRecharge.getAmount();
|
|
|
long orderCode = entrySellerRecharge.getOrderCode();
|
|
|
int payment = entrySellerRecharge.getPayment();
|
|
|
|
|
|
// 1.检查是否是 芝麻认证的用户
|
|
|
String firstEntryCertNo = geytZhiMaCertNo(uid);
|
|
|
|
|
|
if (StringUtils.isBlank(firstEntryCertNo)){
|
|
|
logger.error("frist_entry geytZhiMaCertNo null uid: {}", uid);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
// 2. 增加钱包总表
|
|
|
SellerWallet sw = addSellerWallet(amount, uid);
|
|
|
|
|
|
// 3.入驻次数记录
|
|
|
addJoinHistory(uid, firstEntryCertNo);
|
|
|
addJoinHistory(uid, entrySellerRecharge.getCertNo());
|
|
|
|
|
|
// 4.增加明细
|
|
|
addSellerWalletDetail(orderCode, uid, sw.getId(), amount, payment);
|
...
|
...
|
@@ -190,22 +181,7 @@ public class EntrySellerRechargeServiceImpl implements IEntrySellerRechargeServi |
|
|
}
|
|
|
|
|
|
|
|
|
private String geytZhiMaCertNo(int uid){
|
|
|
|
|
|
ZhiMaCert cert = null;
|
|
|
try {
|
|
|
ApiResponse<?> resp = ufoServiceCaller.call("ufo.user.zhiMaCertInfo", ApiResponse.class, uid);
|
|
|
cert = (ZhiMaCert) resp.getData();
|
|
|
} catch (Exception e) {
|
|
|
logger.error("geytZhiMaCertNo uid {}", uid);
|
|
|
return null;
|
|
|
}
|
|
|
if(cert == null || StringUtils.isBlank(cert.getCertNo())) {
|
|
|
logger.error("geytZhiMaCertNo uid {}", uid);
|
|
|
return null;
|
|
|
}
|
|
|
return cert.getCertNo();
|
|
|
}
|
|
|
|
|
|
|
|
|
private SellerWallet addSellerWallet(BigDecimal amount, Integer uid) {
|
...
|
...
|
|