Commit d6c7359f authored by liwenbin's avatar liwenbin

众邦拒绝需求

parent 66476524
Pipeline #100 failed with stages
...@@ -4,6 +4,7 @@ import java.io.Serializable; ...@@ -4,6 +4,7 @@ import java.io.Serializable;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import com.alibaba.fastjson.JSON;
import com.quantgroup.asset.distribution.service.jpa.entity.Asset; import com.quantgroup.asset.distribution.service.jpa.entity.Asset;
import lombok.Data; import lombok.Data;
...@@ -62,7 +63,7 @@ public class AssetForm implements Serializable{ ...@@ -62,7 +63,7 @@ public class AssetForm implements Serializable{
* 获取通知资金系统FormMap * 获取通知资金系统FormMap
* @return * @return
*/ */
public Map<String, String> transToNotifyMap() { public Map<String, String> transToNotifyMap(Map<String, Object> data) {
Map<String, String> notifyMap = new HashMap<>(); Map<String, String> notifyMap = new HashMap<>();
notifyMap.put("code", this.code); notifyMap.put("code", this.code);
notifyMap.put("msg", this.msg); notifyMap.put("msg", this.msg);
...@@ -76,6 +77,21 @@ public class AssetForm implements Serializable{ ...@@ -76,6 +77,21 @@ public class AssetForm implements Serializable{
notifyMap.put("exData", this.exData); notifyMap.put("exData", this.exData);
notifyMap.put("otherInformation", this.otherInformation); notifyMap.put("otherInformation", this.otherInformation);
notifyMap.put("financeProducts", this.financeProducts); notifyMap.put("financeProducts", this.financeProducts);
Map<String, Object> dataMap = new HashMap<>();
// 目前通知资金方可能有3个模型分
if (data.get("model_exec_data_source#fst_v6_xy_br_dhb_raw_bucket") != null) {
dataMap.put("model_exec_data_source#fst_v6_xy_br_dhb_raw_bucket", data.get("model_exec_data_source#fst_v6_xy_br_dhb_raw_bucket"));
}
if (data.get("td_rules#2022870_result") != null) {
dataMap.put("td_rules#2022870_result", data.get("td_rules#2022870_result"));
}
if (data.get("lxf_score_scale_v2") != null) {
dataMap.put("lxf_score_scale_v2", data.get("lxf_score_scale_v2"));
}
dataMap.put("user_loan_type", data.get("user_loan_type"));
notifyMap.put("dataMap", JSON.toJSONString(dataMap));
return notifyMap; return notifyMap;
} }
......
...@@ -109,15 +109,18 @@ public class AssetAttributeServiceImpl implements IAssetAttributeService { ...@@ -109,15 +109,18 @@ public class AssetAttributeServiceImpl implements IAssetAttributeService {
if (assetAttributeExtendConfigList != null && assetAttributeExtendConfigList.size() > 0) { if (assetAttributeExtendConfigList != null && assetAttributeExtendConfigList.size() > 0) {
for (AssetAttributeExtendConfig config : assetAttributeExtendConfigList) { for (AssetAttributeExtendConfig config : assetAttributeExtendConfigList) {
QGPreconditions.checkArgument(data.get(config.getAssetAttributeCode()) != null, QGExceptionType.ASSET_ATTRIBUTE_IS_EMPTY, config.getAssetAttributeCode()); // 2019-9-11定位扩展属性允许为空
AssetAttributeExtend attributeExtend = new AssetAttributeExtend(); // QGPreconditions.checkArgument(data.get(config.getAssetAttributeCode()) != null, QGExceptionType.ASSET_ATTRIBUTE_IS_EMPTY, config.getAssetAttributeCode());
attributeExtend.setAssetNo(asset.getAssetNo()); if (data.get(config.getAssetAttributeCode()) != null) {
attributeExtend.setAssetAttributeName(config.getAssetAttributeName()); AssetAttributeExtend attributeExtend = new AssetAttributeExtend();
attributeExtend.setAssetAttributeCode(config.getAssetAttributeCode()); attributeExtend.setAssetNo(asset.getAssetNo());
attributeExtend.setAssetAttributeType(config.getAssetAttributeType()); attributeExtend.setAssetAttributeName(config.getAssetAttributeName());
attributeExtend.setAssetAttributeValue(String.valueOf(data.get(config.getAssetAttributeCode()))); attributeExtend.setAssetAttributeCode(config.getAssetAttributeCode());
attributeExtend.setEnable(true); attributeExtend.setAssetAttributeType(config.getAssetAttributeType());
assetAttributeExtendRepository.save(attributeExtend); attributeExtend.setAssetAttributeValue(String.valueOf(data.get(config.getAssetAttributeCode())));
attributeExtend.setEnable(true);
assetAttributeExtendRepository.save(attributeExtend);
}
} }
} }
} }
......
...@@ -92,7 +92,7 @@ public class AssetDistributeServiceImpl implements IAssetDistributeService{ ...@@ -92,7 +92,7 @@ public class AssetDistributeServiceImpl implements IAssetDistributeService{
if (valid) { if (valid) {
// 先创建记录,避免mq里消息来了就还没创建 // 先创建记录,避免mq里消息来了就还没创建
AssetDistributeRecord assetDistributeRecord = assetDistributeRecordService.saveDistributeRecord(asset, record, StatusConstants.WAIT, ruleType); AssetDistributeRecord assetDistributeRecord = assetDistributeRecordService.saveDistributeRecord(asset, record, StatusConstants.WAIT, ruleType);
int distributeStatus = beginDistribute(assetForm, asset, ruleType, assetDistributeRecord); int distributeStatus = beginDistribute(assetForm, asset, ruleType, assetDistributeRecord, data);
// 分发成功 // 分发成功
if (distributeStatus == StatusConstants.SUCCESS || distributeStatus == StatusConstants.WAIT) { if (distributeStatus == StatusConstants.SUCCESS || distributeStatus == StatusConstants.WAIT) {
log.info("用户执行分发节点, uuid : {}, bizNo : {}, assetNo : {}, bizChannel : {}, ruleId : {}, ruleName : {}, distributeStatus : {}", log.info("用户执行分发节点, uuid : {}, bizNo : {}, assetNo : {}, bizChannel : {}, ruleId : {}, ruleName : {}, distributeStatus : {}",
...@@ -112,7 +112,7 @@ public class AssetDistributeServiceImpl implements IAssetDistributeService{ ...@@ -112,7 +112,7 @@ public class AssetDistributeServiceImpl implements IAssetDistributeService{
} else { } else {
log.info("资产分发开关关闭,直接通知资金系统, uuid : {}, bizNo : {}, assetNo : {}, bizType : {}, bizChannel : {}", log.info("资产分发开关关闭,直接通知资金系统, uuid : {}, bizNo : {}, assetNo : {}, bizType : {}, bizChannel : {}",
assetForm.getUuid(), assetForm.getBizNo(), assetForm.getAssetNo(), assetForm.getBizType(), assetForm.getBizChannel()); assetForm.getUuid(), assetForm.getBizNo(), assetForm.getAssetNo(), assetForm.getBizType(), assetForm.getBizChannel());
notifyService.notifyFundServer(assetForm); notifyService.notifyFundServer(assetForm, data);
} }
} }
...@@ -122,14 +122,14 @@ public class AssetDistributeServiceImpl implements IAssetDistributeService{ ...@@ -122,14 +122,14 @@ public class AssetDistributeServiceImpl implements IAssetDistributeService{
* @param ruleType * @param ruleType
* @return 1:成功,2:失败, 3:分配中 * @return 1:成功,2:失败, 3:分配中
*/ */
public int beginDistribute(AssetForm assetForm, Asset asset, int ruleType, AssetDistributeRecord assetDistributeRecord) { public int beginDistribute(AssetForm assetForm, Asset asset, int ruleType, AssetDistributeRecord assetDistributeRecord, Map<String, Object> data) {
try { try {
switch (ruleType) { switch (ruleType) {
case DistributeConstants.RuleType.FUND_ROUTE: case DistributeConstants.RuleType.FUND_ROUTE:
notifyService.notifyFundServer(assetForm); notifyService.notifyFundServer(assetForm, data);
return StatusConstants.WAIT; return StatusConstants.WAIT;
case DistributeConstants.RuleType.AID_FUND_ROUTE: { case DistributeConstants.RuleType.AID_FUND_ROUTE: {
GlobalResponse response = aidFundRouteService.aidFundRoute(assetForm, asset.getUserLoanType()); GlobalResponse response = aidFundRouteService.aidFundRoute(assetForm, asset.getUserLoanType(), data);
int status = response.getCode() == 0 ? StatusConstants.SUCCESS : StatusConstants.FAIL; int status = response.getCode() == 0 ? StatusConstants.SUCCESS : StatusConstants.FAIL;
// 助贷资金路由目前不从mq里接受终态 // 助贷资金路由目前不从mq里接受终态
assetDistributeRecord.setAssetDistributeStatus(status); assetDistributeRecord.setAssetDistributeStatus(status);
...@@ -137,7 +137,7 @@ public class AssetDistributeServiceImpl implements IAssetDistributeService{ ...@@ -137,7 +137,7 @@ public class AssetDistributeServiceImpl implements IAssetDistributeService{
return status; return status;
} }
case DistributeConstants.RuleType.DIVERSION: case DistributeConstants.RuleType.DIVERSION:
notifyService.notifyFundServer(assetForm); notifyService.notifyFundServer(assetForm, data);
return StatusConstants.WAIT; return StatusConstants.WAIT;
default: default:
throw new QGException(QGExceptionType.UNKNOW_RULE_TYPE, ruleType); throw new QGException(QGExceptionType.UNKNOW_RULE_TYPE, ruleType);
......
package com.quantgroup.asset.distribution.service.funding; package com.quantgroup.asset.distribution.service.funding;
import java.util.Map;
import com.quantgroup.asset.distribution.model.form.AssetForm; import com.quantgroup.asset.distribution.model.form.AssetForm;
import com.quantgroup.asset.distribution.model.response.GlobalResponse; import com.quantgroup.asset.distribution.model.response.GlobalResponse;
...@@ -15,6 +17,6 @@ public interface IAidFundRouteService { ...@@ -15,6 +17,6 @@ public interface IAidFundRouteService {
* @param userLoanType * @param userLoanType
* @return * @return
*/ */
GlobalResponse aidFundRoute(AssetForm assetForm,Integer userLoanType); GlobalResponse aidFundRoute(AssetForm assetForm,Integer userLoanType, Map<String, Object> data);
} }
...@@ -57,7 +57,7 @@ public class AidFundRouteServiceImpl implements IAidFundRouteService { ...@@ -57,7 +57,7 @@ public class AidFundRouteServiceImpl implements IAidFundRouteService {
* @return * @return
*/ */
@Override @Override
public GlobalResponse aidFundRoute(AssetForm assetForm,Integer userLoanType) { public GlobalResponse aidFundRoute(AssetForm assetForm,Integer userLoanType, Map<String, Object> data) {
//第一步 查询所有助贷资金 //第一步 查询所有助贷资金
List<AidLoanFundConfig> aidLoanFundConfigList = iAidLoanFundConfigService.findAll(); List<AidLoanFundConfig> aidLoanFundConfigList = iAidLoanFundConfigService.findAll();
...@@ -108,7 +108,7 @@ public class AidFundRouteServiceImpl implements IAidFundRouteService { ...@@ -108,7 +108,7 @@ public class AidFundRouteServiceImpl implements IAidFundRouteService {
iAidFundRouteRecordService.saveAidLoanFundRouteRecord(aidLoanFundRouteRecord); iAidFundRouteRecordService.saveAidLoanFundRouteRecord(aidLoanFundRouteRecord);
//通知资方 //通知资方
Map<String,String> response = iHttpService.postHasResponse(assetForm.getCallbackUrl(), assetForm.transToNotifyMap()); Map<String,String> response = iHttpService.postHasResponse(assetForm.getCallbackUrl(), assetForm.transToNotifyMap(data));
log.info("助贷资金路由-通知资金系统结束,response :{}, uuid : {} , bizNo : {} , callbackUrl:{},params:{}", JSON.toJSONString(response),assetForm.getUuid(),assetForm.getBizNo(),assetForm.getCallbackUrl(), JSON.toJSONString(assetForm)); log.info("助贷资金路由-通知资金系统结束,response :{}, uuid : {} , bizNo : {} , callbackUrl:{},params:{}", JSON.toJSONString(response),assetForm.getUuid(),assetForm.getBizNo(),assetForm.getCallbackUrl(), JSON.toJSONString(assetForm));
if(response==null || response.size()==0 || !"200".equals(response.get("statusCode")) || "error".equals(response.get("response"))) { if(response==null || response.size()==0 || !"200".equals(response.get("statusCode")) || "error".equals(response.get("response"))) {
......
package com.quantgroup.asset.distribution.service.notify; package com.quantgroup.asset.distribution.service.notify;
import java.util.Map;
import com.quantgroup.asset.distribution.model.form.AssetForm; import com.quantgroup.asset.distribution.model.form.AssetForm;
/** /**
...@@ -13,7 +15,7 @@ public interface INotifyService { ...@@ -13,7 +15,7 @@ public interface INotifyService {
* 通知资金系统 * 通知资金系统
* @param assetForm * @param assetForm
*/ */
public void notifyFundServer(AssetForm assetForm); public void notifyFundServer(AssetForm assetForm, Map<String, Object> data);
/** /**
* 通知业务流系统 * 通知业务流系统
......
...@@ -34,15 +34,16 @@ public class NotifyServiceImpl implements INotifyService{ ...@@ -34,15 +34,16 @@ public class NotifyServiceImpl implements INotifyService{
private IAlarmService alarmService; private IAlarmService alarmService;
@Override @Override
public void notifyFundServer(AssetForm assetForm) { public void notifyFundServer(AssetForm assetForm, Map<String, Object> data) {
if (isDebug) { return; } if (isDebug) { return; }
log.info("通知资金系统结果开始, uuid : {}, bizNo : {}, assetNo : {}, callbackUrl : {}, assetForm : {}", assetForm.getUuid(), assetForm.getBizNo(), assetForm.getAssetNo(), assetForm.getCallbackUrl(), JSON.toJSONString(assetForm)); Map<String, String> notifyMap = assetForm.transToNotifyMap(data);
log.info("通知资金系统结果开始, uuid : {}, bizNo : {}, assetNo : {}, callbackUrl : {}, notifyForm : {}", assetForm.getUuid(), assetForm.getBizNo(), assetForm.getAssetNo(), assetForm.getCallbackUrl(), JSON.toJSONString(notifyMap));
if (StringUtils.isEmpty(assetForm.getCallbackUrl())) { if (StringUtils.isEmpty(assetForm.getCallbackUrl())) {
log.info("通知资金系统结果失败,callbackUrl为空, uuid : {}, bizNo : {}, assetNo : {}, assetForm : {}", assetForm.getUuid(), assetForm.getBizNo(), assetForm.getAssetNo(), JSON.toJSONString(assetForm)); log.info("通知资金系统结果失败,callbackUrl为空, uuid : {}, bizNo : {}, assetNo : {}, notifyForm : {}", assetForm.getUuid(), assetForm.getBizNo(), assetForm.getAssetNo(), JSON.toJSONString(notifyMap));
return; return;
} }
Map<String, String> response = httpService.postHasResponse(assetForm.getCallbackUrl(), assetForm.transToNotifyMap()); Map<String, String> response = httpService.postHasResponse(assetForm.getCallbackUrl(), notifyMap);
log.info("通知资金系统结果结束, uuid : {}, bizNo : {}, assetNo : {}, callbackUrl : {}, assetForm : {}, response : {}", assetForm.getUuid(), assetForm.getBizNo(), assetForm.getAssetNo(), assetForm.getCallbackUrl(), JSON.toJSONString(assetForm), JSON.toJSONString(response)); log.info("通知资金系统结果结束, uuid : {}, bizNo : {}, assetNo : {}, callbackUrl : {}, notifyForm : {}, response : {}", assetForm.getUuid(), assetForm.getBizNo(), assetForm.getAssetNo(), assetForm.getCallbackUrl(), JSON.toJSONString(notifyMap), JSON.toJSONString(response));
if(response==null || response.size()==0 || !"200".equals(response.get("statusCode")) || "error".equals(response.get("response"))) { if(response==null || response.size()==0 || !"200".equals(response.get("statusCode")) || "error".equals(response.get("response"))) {
throw new QGException(QGExceptionType.NOTIFY_FUND_SERVER_ERROR, assetForm.getUuid(), assetForm.getBizNo(), assetForm.getAssetNo()); throw new QGException(QGExceptionType.NOTIFY_FUND_SERVER_ERROR, assetForm.getUuid(), assetForm.getBizNo(), assetForm.getAssetNo());
} }
......
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