Commit cd4d4aed by guojuxing

回调调整

parent 708c1753
package com.gic.finance.service.outer.impl;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.alibaba.fastjson.JSONObject;
import com.gic.dubbo.util.DubboContextUtil;
import com.gic.dubbo.util.DubboInvokeUtil;
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.ReferenceConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.utils.ReferenceConfigCache;
import org.apache.dubbo.rpc.service.GenericService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -130,7 +139,7 @@ public class TransferAccountsApprovalApiServiceImpl implements TransferAccountsA
dto.setApprovalTime(new Date());
//todo 审批人等信息获取插入
//callBack(tab, accountAmount, TransferAccountApprovalStatusEnum.AGREE.getCode());
callBack(tab, accountAmount, TransferAccountApprovalStatusEnum.AGREE.getCode());
transferAccountsApprovalService.updateTransferAccountsApproval(dto);
return ServiceResponse.success();
}
......@@ -193,4 +202,46 @@ public class TransferAccountsApprovalApiServiceImpl implements TransferAccountsA
dto.setApprovalStatus(TransferAccountApprovalStatusEnum.CANCEL.getCode());
transferAccountsApprovalService.updateTransferAccountsApproval(dto);
}
private void callBack(TabTransferAccountsApproval tab, Double accountAmount, int status) {
LOGGER.info("回调了");
ApplicationConfig applicationConfig = new ApplicationConfig();
applicationConfig.setName("dubbo-job");
RegistryConfig registryConfig = new RegistryConfig();
registryConfig.setAddress("zookeeper://10.105.220.75:2199");
registryConfig.setProtocol("dubbo");
registryConfig.setId("customRegistry");
registryConfig.setTimeout(30000);
ReferenceConfig<GenericService> reference = new ReferenceConfig<GenericService>();
reference.setApplication(applicationConfig);
reference.setRegistry(registryConfig);
reference.setInterface("com.gic.enterprise.service.BillingPayInfoApiService");
reference.setGeneric(true);
reference.setCheck(false);
reference.setAsync(false);
reference.setTimeout(50000);
reference.setRetries(0);
reference.setGeneric(true);
ReferenceConfigCache cache = ReferenceConfigCache.getCache();
GenericService genericService = cache.get(reference);
boolean isBilling = tab.getOrderType().intValue() == OrderTypeEnum.RECHARGE.getCode() ||
tab.getOrderType().intValue() == OrderTypeEnum.SHORT_MESSAGE_PACKAGE.getCode();
//回调计费中心、短信套餐包
if (isBilling) {
JSONObject param = new JSONObject();
param.put("orderSerialNumber", tab.getOrderNumber());
param.put("buyType", tab.getOrderType());
param.put("totalFeePaid", accountAmount);
param.put("auditStatus", status);
param.put("timeEnd", new SimpleDateFormat("yyyyMMdd").format(new Date()));
//DubboContextUtil.initRegistryConfig("10.105.220.75", 2199);
Object name = genericService.$invoke("offlineCallBack", new String[]{String.class.getName()}, new String[]{param.toJSONString()});
}
}
}
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