...
|
...
|
@@ -19,6 +19,9 @@ import java.util.stream.Collectors; |
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
import com.yoho.core.rest.client.ServiceCaller;
|
|
|
import com.yoho.service.model.request.AreaReqBO;
|
|
|
import com.yoho.service.model.response.AreaRspBo;
|
|
|
import com.yoho.service.model.union.bo.*;
|
|
|
import com.yoho.service.model.union.request.*;
|
|
|
import com.yoho.service.model.union.response.*;
|
...
|
...
|
@@ -154,6 +157,9 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
@Autowired
|
|
|
private UserServiceHelper userServiceHelper;
|
|
|
|
|
|
@Resource
|
|
|
ServiceCaller serviceCaller;
|
|
|
|
|
|
@Autowired
|
|
|
private RedisHashCache redisHashCache;
|
|
|
|
...
|
...
|
@@ -403,6 +409,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
UnionShareUserBank updateReq = new UnionShareUserBank();
|
|
|
updateReq.setId(req.getId());
|
|
|
updateReq.setBankBranch(req.getBankBranch());
|
|
|
updateReq.setBankCity(req.getBankCity());
|
|
|
updateReq.setUpdateTime(DateUtil.getCurrentTimeSecond());
|
|
|
int result = unionShareUserBankMapper.updateByPrimaryKeySelective(updateReq);
|
|
|
if (result > 0) {
|
...
|
...
|
@@ -1420,14 +1427,19 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
}
|
|
|
//信息格式校验
|
|
|
checkAndBuildBankCard(bo);
|
|
|
//查询该用户是否为特邀用户,checkAndBuildBankCard中已经检查过了
|
|
|
// int count = unionShareUserMapper.selectCountByUid(bo.getUid());
|
|
|
// if (count == 0) {
|
|
|
// //不是特邀用户
|
|
|
// logger.info("bindBankCard end,can not find unionType,bo is {}",bo);
|
|
|
// throw new ServiceException(ServiceError.UNION_UID_ERROR);
|
|
|
// }
|
|
|
|
|
|
UnionShareUserBank insertReq = new UnionShareUserBank();
|
|
|
//查询银行城市
|
|
|
AreaReqBO areaReqBO = new AreaReqBO();
|
|
|
areaReqBO.setCode(bo.getBankCityId()*100);
|
|
|
AreaRspBo area = serviceCaller.call("users.getAreaByCode", areaReqBO, AreaRspBo.class);
|
|
|
logger.info("bindBankCard,bo is {},area is {}",bo,JSONObject.toJSONString(area));
|
|
|
if (area != null && area.getParent() != null) {
|
|
|
insertReq.setBankCity(area.getCaption());
|
|
|
}else {
|
|
|
throw new ServiceException(ServiceError.UNION_VERSION_UPGRADE_ERROR);
|
|
|
}
|
|
|
logger.info("bindBankCard,bo is {},area is {},city is {}",bo,JSONObject.toJSONString(area),insertReq.getBankCity());
|
|
|
BeanUtils.copyProperties(bo, insertReq);
|
|
|
insertReq.setStatus((byte)1);
|
|
|
if (bo.getSource()!=null&&1 == bo.getSource()) {
|
...
|
...
|
@@ -1511,6 +1523,10 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
if (!checkIdCard(bo.getIdCardNo())) {
|
|
|
throw new ServiceException(ServiceError.UNION_IDCARD_ERROR);
|
|
|
}
|
|
|
if ((bo.getSource()==null||1 != bo.getSource())&&(idCardPass(bo.getIdCardNo(),bo.getUid()))) {
|
|
|
//不是ufo的请求,需要校验银行卡身份证是否有重复
|
|
|
throw new ServiceException(ServiceError.UNION_IDCARD_REPEAT_ERROR);
|
|
|
}
|
|
|
// 校验银行卡
|
|
|
if (!checkBankCard(bo.getBankCardNo())) {
|
|
|
throw new ServiceException(ServiceError.UNION_BANK_CARD_ERROR);
|
...
|
...
|
@@ -1519,6 +1535,10 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
if (StringUtils.isBlank(bo.getBankBranch())) {
|
|
|
throw new ServiceException(ServiceError.UNION_BANK_BRANCH_ERROR);
|
|
|
}
|
|
|
// 校验银行卡支行地区
|
|
|
if (bo.getBankCityId()<1) {
|
|
|
throw new ServiceException(ServiceError.UNION_VERSION_UPGRADE_ERROR);
|
|
|
}
|
|
|
// 获取银行名
|
|
|
bo.setBankName(getBankName(bo.getBankCode()));
|
|
|
if (null == bo.getBankName()) {
|
...
|
...
|
@@ -1538,6 +1558,14 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
return bo;
|
|
|
}
|
|
|
|
|
|
private boolean idCardPass(String idcard, int uid) {
|
|
|
List<UnionShareUserBank> banks = unionShareUserBankMapper.selectListByIdCardNo(idcard);
|
|
|
if (CollectionUtils.isEmpty(banks) || (banks.size() == 1 && banks.get(0).getUid() == uid)) {
|
|
|
return true;
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
public void checkUserIdentityCard(UnionShareUserIdentityCardBo bo) {
|
|
|
// 校验身份证图片
|
|
|
if (StringUtils.isEmpty(bo.getCardFrontUrl())) {
|
...
|
...
|
@@ -3265,6 +3293,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
}
|
|
|
|
|
|
// 是否绑定了有效银行卡
|
|
|
//1、校验是否绑了卡
|
|
|
UnionShareUserBank req = new UnionShareUserBank();
|
|
|
req.setUid(uid);
|
|
|
req.setStatus((byte)1);
|
...
|
...
|
@@ -3273,6 +3302,12 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
settlementLog.info("canSettlement end,can not find available bank card,uid is {}",uid);
|
|
|
throw new ServiceException(ServiceError.UNION_HASNOT_AVAILABLE_CARD);
|
|
|
}
|
|
|
//2、校验身份证是否唯一
|
|
|
int idCardNoCount = unionShareUserBankMapper.selectCountByIdCardNo(bankCardList.get(0).getIdCardNo());
|
|
|
if (idCardNoCount > 1) {
|
|
|
settlementLog.info("canSettlement end,idCardNoCount is {},uid is {}",idCardNoCount,uid);
|
|
|
throw new ServiceException(ServiceError.UNION_IDCARD_CONFLICT_ERROR);
|
|
|
}
|
|
|
|
|
|
//查询是否有处理中的提现
|
|
|
if (hasSettlement(uid)) {
|
...
|
...
|
@@ -3438,6 +3473,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
insertReq.setBankCardNo(unionShareUserBank.getBankCardNo());
|
|
|
insertReq.setBankName(unionShareUserBank.getBankName());
|
|
|
insertReq.setBankBranch(unionShareUserBank.getBankBranch());
|
|
|
insertReq.setBankCity(unionShareUserBank.getBankCity());
|
|
|
insertReq.setSettlementCode(settlementCode);
|
|
|
insertReq.setSettlementAmount(totalAmount);
|
|
|
insertReq.setSettlementTime(updateTime);
|
...
|
...
|
@@ -3509,6 +3545,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport |
|
|
mqLog.info("sendSettlementMqToErp start,send mq {} to erp,uid is {},settlementCode is {}", SETTLEMENT_TOPIC, uid, settlementCode);
|
|
|
UnionShareSettlement unionShareSettlement=unionShareSettlementMapper.selectByCode(settlementCode);
|
|
|
if (unionShareSettlement == null) {
|
|
|
mqLog.info("sendSettlementMqToErp end,send mq {} to erp,uid is {},settlementCode is {},selectByCode null", SETTLEMENT_TOPIC, uid, settlementCode);
|
|
|
return 0;
|
|
|
}
|
|
|
if (unionShareSettlement.getPromoteUid().intValue()!=uid) {
|
...
|
...
|
|