Commit c78fdc51 authored by 郝彦辉's avatar 郝彦辉

非联合贷-实时数据报送sql修改

parent 7af57e87
......@@ -275,7 +275,7 @@ public class ExZhuDaiBaiHangReSendController {
}
//test3.接口测试 手动调用
@RequestMapping("/test/dealWithFileCry")
@RequestMapping("/manual/dealWithFileCry")
public String dealWithFileCry(String filePath, String type) {
try {
//"2019-05-07T00:00:00"
......@@ -284,10 +284,10 @@ public class ExZhuDaiBaiHangReSendController {
}
if ("zip".equalsIgnoreCase(type)) {
baiHangZhuDaiService.fileUploadClient();
return baiHangZhuDaiService.fileUploadClient(filePath);
} else if ("unzip".equalsIgnoreCase(type)) {
baiHangZhuDaiService.fileUploadValidationClient();
return baiHangZhuDaiService.fileUploadValidationClient(filePath);
} else {
return "其他未知类型type=" + type;
......@@ -296,6 +296,5 @@ public class ExZhuDaiBaiHangReSendController {
log.error("dealWithFileCry异常, {} , {} ", e.getMessage(), e);
return e.getMessage();
}
return type + "结束";
}
}
......@@ -510,7 +510,7 @@ public class BaiHangZhuDaiService {
//-----------------------------------------------存量整理---------------------------------------------------------------------
/**
* 描述: http 百行-助贷申请存量数据 整理 <br/>
* 描述: http 百行-助贷申请A1存量数据 整理 <br/>
* 参数: [strStartDate, noEndDate] <br/>
* 返回值: java.lang.String <br/>
* 创建人: yanhui.Hao <br/>
......@@ -589,7 +589,7 @@ public class BaiHangZhuDaiService {
/**
* 描述: http 百行-助贷放款存量数据 整理 <br/>
* 描述: http 百行-助贷放款D2存量数据 整理 <br/>
* 参数: [strStartDate, noEndDate] <br/>
* 返回值: java.lang.String <br/>
* 创建人: yanhui.Hao <br/>
......@@ -686,7 +686,7 @@ public class BaiHangZhuDaiService {
/**
* 描述: http 百行-助贷还款&逾期存量数据 整理 <br/>
* 描述: http 百行-助贷还款&逾期D3存量数据 整理 <br/>
* 参数: [strStartDate, noEndDate] <br/>
* 返回值: java.lang.String <br/>
* 创建人: yanhui.Hao <br/>
......@@ -827,7 +827,6 @@ public class BaiHangZhuDaiService {
// String pid = "CSdFOGhhZS1eX5NnPAIR6/vh3FzgMBRSvJVcgf4WI8d4zStBjXKUf7UfsjGfcdMjPLkPQ93sD0OqkF5XuMWaCSkt1gHkvQCmxvErBYDfaYKI6rMY4QdJ4BPxau/IStAo+hXNdlD9gGBZpIjEtickDIw1YYdLfqRw4mZdNuMkMXI=";//加密后的密文
// String mobile= "B5F2ozIoPbXpv65rk7fStPsVmpF0xoB+wpTc++1EvWqoDYZ5epWGmBdtxCElgvdflBcWDzB0oPPM8PclG0p/EPmJcrbivkFHN65HViTvfk2Xxs+sss9IomhmuWiLS5BTpxyTlMsPnSPjmE8so6S16YiiW3ZVble2CijUKPV+Luk=";//加密后的密文
//datas.add(name);
// datas.add(pid);
// datas.add(mobile);
......@@ -852,53 +851,96 @@ public class BaiHangZhuDaiService {
}
}
//文件方式上报的客户端代码(加密)
public static void fileUploadClient() throws Exception {
/**
* 描述: 文件方式上报的客户端代码(文件加密) <br/>
* 参数: [] <br/>
* 返回值: void <br/>
* 创建人: yanhui.Hao <br/>
* 创建时间: 2019.11.05 <br/>
*/
public static String fileUploadClient(String fileUrl) throws Exception {
//fileUrl = "C:\\Users\\Administrator\\Desktop\\测试\\文件测试\\baihang\\all_data.txt";
if (StringUtils.isBlank(fileUrl)) {
return "fileUrl参数为空";
}
String writeFilePath = "";
if(fileUrl.lastIndexOf("/")!=-1){//linux
writeFilePath = fileUrl.substring(0,fileUrl.lastIndexOf("/"))+"/cry/";
}else{//windows
writeFilePath = fileUrl.substring(0,fileUrl.lastIndexOf("\\"))+"\\cry\\";
}
//RSA公钥文件路径(百行提供公钥文件)
String RSA_PUBLIC_KEY = "/manualTool/rsa_public_key.pem";
////String RSA_PUBLIC_KEY = "/manualTool/rsa_public_key.pem";
String RSA_PUBLIC_KEY = "/baihang/rsa_public_key.pem";
//AES密钥(机构自行设置)
String AES_KEY = "fc4c1cbca5a46840f60";
FileUploadRequest req = new FileUploadRequest();
//设置未作压缩加密前的原始数据文件路径
req.setDataFile("C:\\Users\\Administrator\\Desktop\\测试\\文件测试\\baihang\\all_data.txt");
req.setDataFile(fileUrl);
//设置压缩加密后的密文文件输出路径(为空表示与原始数据文件同目录)
req.setTargetFilePath("C:\\Users\\Administrator\\Desktop\\测试\\文件测试\\baihang");
req.setTargetFilePath(writeFilePath);
BhFileCreditApiClient client = new BhFileCreditApiClient();
//初始化设置AES密钥和RSA公钥
client.init(BHRSAUtils.readRSAPublicKey(RSA_PUBLIC_KEY), AES_KEY);
//执行压缩加密操作
FileUploadResponse response = client.execute(req);
String msg = "";
if (response.isSuccess) {
log.info("zip And encrypt success;fileName = " + response.getEncryptFilePath() + response.getEncryptFileName());
msg = "zip And encrypt success;fileName = " + response.getEncryptFilePath() + response.getEncryptFileName();
} else {
log.info("zip And encrypt fail;errorMessage = " + response.getErrorMessage());
msg = "zip And encrypt fail;errorMessage = " + response.getErrorMessage();
}
log.info(msg);
return msg;
}
//文件方式上报的客户端本地测试代码(解密)
public static void fileUploadValidationClient() throws Exception {
/**
* 描述: 文件方式上报的客户端本地测试代码(文件解密) <br/>
* 参数: [] <br/>
* 返回值: void <br/>
* 创建人: yanhui.Hao <br/>
* 创建时间: 2019.11.05 <br/>
*/
public static String fileUploadValidationClient(String fileUrl) throws Exception {
//fileUrl = "C:\\Users\\Administrator\\Desktop\\测试\\文件测试\\baihang\\all_data.cry";
if (StringUtils.isBlank(fileUrl)) {
return "fileUrl参数为空";
}
String writeFilePath = "";
if(fileUrl.lastIndexOf("/")!=-1){//linux
writeFilePath = fileUrl.substring(0,fileUrl.lastIndexOf("/"))+"/out/";
}else{//windows
writeFilePath = fileUrl.substring(0,fileUrl.lastIndexOf("\\"))+"\\out\\";
}
//RSA私钥文件路径(百行提供测试环境私钥文件)
////String RSA_PRIVATE_KEY = "/baihang/rsa_private_key.pem";
String RSA_PRIVATE_KEY = "/manualTool/rsa_private_key.pem";
String RSA_PRIVATE_KEY = "/baihang/rsa_private_key.pem";
////String RSA_PRIVATE_KEY = "/manualTool/rsa_private_key.pem";
FileUploadValidationRequest req = new FileUploadValidationRequest();
//设置压缩加密后的数据文件路径
req.setDataFile("C:\\Users\\Administrator\\Desktop\\测试\\文件测试\\baihang\\all_data.cry");
req.setTargetFilePath("C:\\Users\\Administrator\\Desktop\\测试\\文件测试\\baihang\\out\\");
req.setDataFile(fileUrl);
req.setTargetFilePath(writeFilePath);
BhFileCreditApiClient client = new BhFileCreditApiClient();
//初始化设置RSA私钥
client.init(BHRSAUtils.readRSAPrivateKey(RSA_PRIVATE_KEY));
//执行解密解压操作
FileUploadValidationResponse response = client.execute(req);
String msg = "";
if (response.isSuccess) {
log.info("decrypt And unzip success;fileName = " + response.getDecryptFilePath() + response.getDecryptFileName());
msg = "decrypt And unzip success;fileName = " + response.getDecryptFilePath() + response.getDecryptFileName();
} else {
log.info("decrypt And unzip fail;errorMessage = " + response.getErrorMessage());
msg = "decrypt And unzip fail;errorMessage = " + response.getErrorMessage();
}
log.info(msg);
return msg;
}
......
......@@ -646,16 +646,33 @@ public class ManualToolService implements CommonSuperService {
System.out.println(id);
}*/
int rr = 1009821800;
List<String> lineList = ReadOrWriteTxt.readTxtList("C:\\Users\\Administrator\\Desktop\\测试\\接口测试\\build\\tmp3.txt");
//修改D3中的reqID
/* DateFormat df_uploadTs = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
int rr = 1009822900;
List<String> lineList = ReadOrWriteTxt.readTxtList("C:\\Users\\Administrator\\Desktop\\测试\\文件测试\\build\\tmp3.txt");
for(int i=0;i<lineList.size();i++){
RepaymentInfoZhuDai repaymentLoanInfo = new Gson().fromJson(lineList.get(i), new TypeToken<RepaymentInfoZhuDai>(){}.getType());
//String id = UUID.randomUUID().toString().replaceAll("-", "");
rr++;
String uploadTs = df_uploadTs.format(new Date());
repaymentLoanInfo.setReqID(rr+"");
repaymentLoanInfo.setUploadTs(uploadTs.replace(" ","T"));
System.out.println(JSON.toJSONString(repaymentLoanInfo));
}
System.err.println(rr);
System.err.println(rr);*/
//将D2中FinTechAgencyBusinessZhuDai变成树形结构
List<String> lineD2List = ReadOrWriteTxt.readTxtList("C:\\Users\\Administrator\\Desktop\\测试\\文件测试\\build\\tmp2.txt");
for(int i=0;i<lineD2List.size();i++){
LoanInfoZhuDaiVo loanInfo = JSONObject.parseObject(lineD2List.get(i), LoanInfoZhuDaiVo.class);
FinTechAgencyBusinessZhuDai finTechAgencyBusiness = JSONObject.parseObject(lineD2List.get(i), FinTechAgencyBusinessZhuDai.class);
loanInfo.setFinTechAgencyBusiness(finTechAgencyBusiness);
System.out.println(JSON.toJSONString(loanInfo));
}
System.err.println("build D2 finTechAgencyBusiness end.");
......
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