Commit 303ca531 authored by shihuajun's avatar shihuajun

第一次测试完成

parent bf4df0c5
package com.quantgroup.asset.distribution.controller;
import com.quantgroup.asset.distribution.enums.response.AssetResponse;
import com.quantgroup.asset.distribution.enums.response.MiddleOfficeCommonResponseEnum;
import com.quantgroup.asset.distribution.model.response.GlobalResponse;
import com.quantgroup.asset.distribution.service.newrule.CoreFilter;
import com.quantgroup.asset.distribution.service.newrule.pojo.funds.FundCallBackParam;
import com.quantgroup.asset.distribution.service.newrule.third.AuditResponce;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
/**
* @author shihuajun
* @date 2021/9/1 15:09
* @ describing
*/
@Slf4j
@RestController
@RequestMapping("/biz")
public class NewAssertController {
@Resource
private CoreFilter coreFilter;
@RequestMapping("/core/asset_handler")
public GlobalResponse assetsHandler(@RequestBody @Valid AuditResponce auditResponce) {
coreFilter.coreHandle(auditResponce);
return GlobalResponse.create(AssetResponse.SUCCESS);
}
/**
* 之后需要加入竞价的逻辑
* http://open.quantgroups.com/project/181/interface/api/4536
* @param param
* @return
*/
@RequestMapping(value = "/core/select_fund" ,method = {RequestMethod.POST})
public GlobalResponse selectFund(@RequestBody FundCallBackParam param) {
if (CollectionUtils.isEmpty(param.getResult())){
return GlobalResponse.create(MiddleOfficeCommonResponseEnum.REQUEST_PARAMS_ERROR);
}
return GlobalResponse.create(AssetResponse.SUCCESS,param.getResult().get(0).getFundId());
}
}
......@@ -40,6 +40,7 @@ import shaded.com.google.common.collect.Lists;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
......@@ -177,6 +178,10 @@ public class CoreFilter {
Expression compiledExp = AviatorEvaluator.compile(basicRule);
List<ProductRuleEntity> ruleEntityList = productRuleService.getAll();
Map<String,Object> env = Maps.newConcurrentMap();
if (StringUtils.isNotBlank(fundProduct.getTelRule())){
env.put(RuleConstant.NOT_PERMIT_TEL, Lists.newArrayList(Arrays.stream(fundProduct.getTelRule()
.split(CommonConstants.COMMA)).mapToInt(s -> Integer.parseInt(s))));
}
for (ProductRuleEntity pre : ruleEntityList) {
if (pre.getEnable().equals(new Byte("0"))){
continue;
......@@ -186,15 +191,15 @@ public class CoreFilter {
continue;
}
if (currentRuleVal.equals(RuleConstant.AMOUNT)){
env.put(currentRuleVal, auditResponce.getAmount());
env.put(currentRuleVal, new BigDecimal(auditResponce.getAmount()));
}
if (currentRuleVal.equals(RuleConstant.TERM)){
env.put(currentRuleVal, auditResponce.getTerm());
env.put(currentRuleVal, Integer.parseInt(auditResponce.getTerm()));
}
int age = IdCardUtil.getAge(associationBean.getIdNo());
env.put(RuleConstant.AGE, age);
if (currentRuleVal.equals(RuleConstant.NOT_PERMIT_TELS)){
env.put(currentRuleVal,StringUtils.substring(associationBean.getPhoneNo(),0,3));
if (currentRuleVal.equals(RuleConstant.NOT_PERMIT_TEL)){
env.put(RuleConstant.NOT_PERMIT_TELS,Integer.parseInt(StringUtils.substring(associationBean.getPhoneNo(),0,3)));
}
}
Boolean execute = (Boolean) compiledExp.execute(env);
......@@ -215,7 +220,7 @@ public class CoreFilter {
ruleParam.setUuid(auditResponce.getUuid());
ruleParam.setCardExpireEnum(IdCardExpireEnum.parse(fundProduct.getCardLimit()));
if (!ruleService.pass(ruleParam)){
log.info("当前用户区域校验不通过 {}", JSON.toJSONString(associationBean));
log.info("当前用户公共校验不通过 {}", JSON.toJSONString(associationBean));
return Boolean.FALSE;
}
}
......
......@@ -5,7 +5,6 @@ import com.quantgroup.asset.distribution.service.newrule.IRuleVerifyService;
import com.quantgroup.asset.distribution.service.newrule.pojo.enums.SpecialRuleEnum;
import com.quantgroup.asset.distribution.service.newrule.pojo.funds.RuleParam;
import com.quantgroup.asset.distribution.service.newrule.service.IProductRuleService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -14,7 +13,6 @@ import javax.annotation.Resource;
* @date 2021/8/28 12:00
* @ describing
*/
@Service
public class AbstractProductRuleVerifyImpl implements IRuleVerifyService {
@Resource
private IProductRuleService productRuleService;
......
......@@ -31,6 +31,7 @@ import java.util.concurrent.atomic.AtomicInteger;
@Component("commonAreaVerifyImpl")
public class AreaVerifyImpl extends AbstractProductRuleVerifyImpl {
private static final String PROVINCE = "省";
private static final String SHI = "市";
private static final String TEL_ALERM_TEXT = "用户的手机号是 %s";
......@@ -67,7 +68,7 @@ public class AreaVerifyImpl extends AbstractProductRuleVerifyImpl {
List<Integer> residenceList = JacksonUtil.deserializeList(ruleConcrete.getResidenceList(), Integer.class);
SDKUserInfo userExtInfo = userCenterService.getSDKUserExtInfo(userInfo.getPhoneNo(), null);
List<UserAddressInfo> addressList = userExtInfo.getAddressList();
if (CollectionUtils.isEmpty(addressList)){
if (!CollectionUtils.isEmpty(addressList)){
UserAddressInfo userAddressInfo = addressList.get(0);
boolean residenceResult = (userAddressInfo.getDistrictCode() != null && residenceList.contains(userAddressInfo.getDistrictCode()))
|| (userAddressInfo.getCityCode() != null && residenceList.contains(userAddressInfo.getCityCode()))
......@@ -94,7 +95,8 @@ public class AreaVerifyImpl extends AbstractProductRuleVerifyImpl {
return Boolean.TRUE;
}
String province = numberInfo.getProvince() + PROVINCE;
if (telAreaNameList.contains(province)){
String shi = numberInfo.getProvince() + SHI;
if (telAreaNameList.contains(province) || telAreaNameList.contains(shi) || telAreaNameList.contains(numberInfo.getProvince()) ){
hit.incrementAndGet();
}
if (AreaEnum.ALL_DEMAND.equals(param.getAreaNum())
......
......@@ -15,4 +15,6 @@ public class RuleConstant {
public final static String NOT_PERMIT_TELS = "tel";
public final static String IDCARD_EXPIRE = "idcard_expire";
public final static String NOT_PERMIT_TEL = "not_permit_tels";
}
......@@ -43,10 +43,10 @@ public class ContactsNameSameVerifyImpl extends AbstractProductRuleVerifyImpl {
}
if (info.getName().equals(param.getUserInfo().getName())){
log.warn("校验联系人姓名相同时发现当前用户与联系人姓名相同,联系人信息 {}", JSON.toJSONString(info));
return true;
return false;
}
}
return false;
return true;
}
@Override
......
......@@ -44,10 +44,10 @@ public class ContactsTelErrorVerifyImpl extends AbstractProductRuleVerifyImpl {
}
if (this.telVerify(info.getPhoneNo())){
log.warn("联系人手机号校验时发现当前用户手机号有问题,联系人信息 {}", JSON.toJSONString(info));
return true;
return false;
}
}
return false;
return true;
}
@Override
......@@ -62,6 +62,6 @@ public class ContactsTelErrorVerifyImpl extends AbstractProductRuleVerifyImpl {
if (!tel.startsWith("1")){
return false;
}
return !tel.startsWith("170") && !tel.startsWith("171");
return !tel.startsWith("170") || !tel.startsWith("171");
}
}
......@@ -42,10 +42,10 @@ public class ContactsTelSameVerifyImpl extends AbstractProductRuleVerifyImpl {
}
if (info.getPhoneNo().equals(param.getUserInfo().getPhoneNo())){
log.warn("联系人手机号校验发现当前用户与联系人手机号相同,联系人信息 {}", JSON.toJSONString(info));
return true;
return false;
}
}
return false;
return true;
}
@Override
......
......@@ -3,6 +3,7 @@ package com.quantgroup.asset.distribution.service.niwodai.impl;
import cn.qg.ec.hbase.ocr.OCRIdCardDataService;
import cn.quantgroup.motan.bean.UserInfo;
import cn.quantgroup.motan.vo.UserSysResult;
import cn.quantgroup.tech.util.TechEnvironment;
import cn.quantgroup.user.IUserSdkService;
import cn.quantgroup.user.UserSdkServiceFactory;
import com.alibaba.fastjson.JSON;
......@@ -52,7 +53,7 @@ public class NiwodaiAssetServiceImpl implements INiwodaiAssetService {
private CloseableHttpClient httpClient;
@Autowired
private INiwodaiService niwodaiService;
@Value("${user.sdk.url}")
@Value("${passportapi.http}")
private String userSysUrl;
private IUserSdkService userSdkService;
......@@ -60,6 +61,9 @@ public class NiwodaiAssetServiceImpl implements INiwodaiAssetService {
@PostConstruct
private void init() {
if (TechEnvironment.isPro()){
userSysUrl = "http://passportapi2.xyqb.com";
}
userSdkService = UserSdkServiceFactory.generateSDKService(userSysUrl, httpClient);
}
......
......@@ -2,14 +2,12 @@ package com.quantgroup.asset.distribution.service.user.impl;
import cn.quantgroup.motan.bean.UserAssociationBean;
import cn.quantgroup.motan.bean.UserInfo;
import cn.quantgroup.motan.retbean.XUserExtInfo;
import cn.quantgroup.motan.vo.UserSysResult;
import cn.quantgroup.tech.util.TechEnvironment;
import cn.quantgroup.user.IUserSdkService;
import cn.quantgroup.user.UserSdkServiceFactory;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.quantgroup.asset.distribution.exception.QGException;
import com.quantgroup.asset.distribution.exception.QGExceptionType;
import com.quantgroup.asset.distribution.model.entity.user.SDKUserInfo;
import com.quantgroup.asset.distribution.service.httpclient.IHttpService;
import com.quantgroup.asset.distribution.service.redis.IRedisService;
......@@ -36,7 +34,7 @@ import java.util.concurrent.TimeUnit;
@Service
public class UserCenterServiceImpl implements IUserCenterService {
@Value("${user.sdk.url}")
@Value("${passportapi.http}")
private String userSysUrl;
private IUserSdkService userSdkService;
@Autowired
......@@ -62,6 +60,9 @@ public class UserCenterServiceImpl implements IUserCenterService {
@PostConstruct
private void init() {
if (TechEnvironment.isPro()){
userSysUrl = "http://passportapi2.xyqb.com";
}
userSdkService = UserSdkServiceFactory.generateSDKService(userSysUrl, httpClient);
}
......@@ -99,7 +100,7 @@ public class UserCenterServiceImpl implements IUserCenterService {
public UserAssociationBean getUserAssociationBean(String uuid) {
UserSysResult<UserInfo> result = userSdkService.findUserInfoByUuid(uuid);
UserInfo userInfo = new UserInfo();
if (result.isSuccess() && result.getData() != null && result.getData().getId() == null) {
if (result.isSuccess() && result.getData() != null && result.getData().getId() != null) {
userInfo = result.getData();
} else {
log.error("调用用户中心接口findUserInfoByUuid异常 {}",JSON.toJSONString(userInfo));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment