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

百行每天的重新报送优化成定时任务5

parent 95edfb59
......@@ -64,7 +64,7 @@ public class RoutineWorkTask {
@Async
@Scheduled(cron = "0 30 18 * * ?")
@Scheduled(cron = "0 0 18 * * ?")
public void downloadLog() {
//if (increment(ROUTINE_WORK_BH_LOCK_KEY_1)) {
// redisTemplate.expire(ROUTINE_WORK_BH_LOCK_KEY_1, 10, TimeUnit.SECONDS);
......@@ -77,7 +77,6 @@ public class RoutineWorkTask {
//String beforeDatenyr = LocalDateTime.now().plusDays(-1).format(DateTimeFormatter.ISO_DATE);
String newDatenyr = LocalDateTime.now().format(DateTimeFormatter.ISO_DATE);
newDatenyr = newDatenyr.replace("-", "");
newDatenyr = "20200311";
log.info("下载(众信利民助贷)百行反馈日志开始>>>>>>>>, newTime: {} , newDatenyr: {} ", LocalDateTime.now(), newDatenyr);
......@@ -101,23 +100,26 @@ public class RoutineWorkTask {
Stopwatch stopwatch1 = Stopwatch.createStarted();
Map<String, String> resultMap = manualToolService.sendBaiHangData(p1, p2, p3, p4, p5, secretKey, isSend, errorCode, isProduct, sendIncludeType);
log.info("处理结束, result: {} , 耗时: {} ", JSONObject.toJSONString(resultMap), stopwatch1.stop().elapsed(TimeUnit.MILLISECONDS));
log.info("下载&处理众信利民助贷反馈日志结束, result: {} , 耗时: {} ", JSONObject.toJSONString(resultMap), stopwatch1.stop().elapsed(TimeUnit.MILLISECONDS));
if (resultMap != null) {
String success = resultMap.get("success");
String alarm = resultMap.get("alarm");
String isEmpty = resultMap.get("isEmpty");
if (StringUtils.isNotEmpty(success)) {
if (StringUtils.isNotEmpty(alarm)) {
dingTalk.talk("Info", "下载&处理" + newDatenyr + "(众信利民助贷)百行反馈日志结束", success);
if (StringUtils.isNotEmpty(isEmpty)) {
dingTalk.talk("Info", "下载&处理" + newDatenyr + "(ZXLM助贷)百行反馈日志结束", success);
Thread.sleep(500);
dingTalk.talk_ToUser("下载(众信利民助贷)百行反馈主日志文件不存在", "下载" + newDatenyr + "反馈主日志文件不存在,反馈日志主文件不存在,请注意确认!");
if(StringUtils.isNotEmpty(alarm)){
Thread.sleep(500);
dingTalk.talk_ToUser("下载"+newDatenyr+"(ZXLM助贷)百行反馈主日志文件不存在", "下载反馈主日志文件不存在,请注意确认或和百行联系!");
}
log.info("下载(众信利民助贷)百行反馈日志结束<<<<<<<<, newDatenyr: {}, 耗时: {} ", newDatenyr, stopwatch.stop().elapsed(TimeUnit.MILLISECONDS));
return;
} else {
dingTalk.talk("Info", "下载&处理 (" + newDatenyr + "(众信利民助贷)百行反馈日志结束", success + "————10分钟后将会自动重新报送,若有问题请及时停止!");
dingTalk.talk("Info", "下载&处理" + newDatenyr + "(ZXLM助贷)百行反馈日志结束", success + "——10分钟后将会自动重新报送,若有问题请及时停止!");
String json_sq_A1 = resultMap.get("json_sq_A1");
if (StringUtils.isNotEmpty(json_sq_A1) && "true".equals(json_sq_A1)) {
......@@ -141,8 +143,8 @@ public class RoutineWorkTask {
}
} catch (Exception e) {
log.error("下载(众信利民助贷)百行反馈日志异常<<<<<<<<, newDatenyr: {} ", newDatenyr, e);
dingTalk.talk("Error", "报送服务内部异常", "(" + newDatenyr + ") 异常信息:" + e.toString());
dingTalk.talk_ToUser("数据报送异常", "报送服务内部异常,请尽快手动处理!");
dingTalk.talk("Error", "下载&处理(ZXLM助贷)百行反馈日志系统异常", "(" + newDatenyr + ") 异常信息:" + e.toString());
dingTalk.talk_ToUser("下载&处理(ZXLM助贷)百行反馈日志系统异常", "日常处理ZXLM助贷反馈日志系统异常,请尽快手动处理!!!");
return;
}
......@@ -155,7 +157,7 @@ public class RoutineWorkTask {
@Async
@Scheduled(cron = "0 40 18 * * ?")
@Scheduled(cron = "0 10 18 * * ?")
public void sendBaoSong() {
//if (increment(ROUTINE_WORK_BH_LOCK_KEY_2)) {
// redisTemplate.expire(ROUTINE_WORK_BH_LOCK_KEY_2, 10, TimeUnit.SECONDS);
......@@ -166,7 +168,6 @@ public class RoutineWorkTask {
//yyyy-MM-dd
String newDatenyr = LocalDateTime.now().format(DateTimeFormatter.ISO_DATE);
newDatenyr = newDatenyr.replace("-", "");
newDatenyr = "20200311";
//指定只有172.21.10.8服务器 172.21.10.8:9021
//String send_A1_url = "http://172.21.10.8:9021/zhudai/re_send/manual/buquan/mainApplySend?key=b5140fb2-2c85-4b5a-abcf-3e97528014db";
......@@ -182,13 +183,13 @@ public class RoutineWorkTask {
String result = baiHangZhuDaiService.sendHandApplyToBaiHang(true, null);
log.info("众信利民助贷-百行重新报送A1结束, newTime: {} , newDatenyr: {} , result: {} ", LocalDateTime.now(), newDatenyr, result);
dingTalk.talk("Info", "众信利民助贷-重新报送 A1 结束", "(" + newDatenyr + ")" + result);
dingTalk.talk("Info", "ZXLM助贷-重新报送 A1 结束", "(" + newDatenyr + ")" + result);
Thread.sleep(10 * 1000);//10
Thread.sleep(3 * 1000);//3
} catch (Exception e) {
log.info("(众信利民助贷)重新报送A1异常, newTime: {} , newDatenyr: {} ", LocalDateTime.now(), newDatenyr, e);
dingTalk.talk_ToUser("众信利民助贷-重新报送 A1 异常", "(" + newDatenyr + ") A1报送异常,请尽快查看处理!");
dingTalk.talk_ToUser("ZXLM助贷-重新报送 A1 异常", "(" + newDatenyr + ") A1报送异常,请尽快查看处理!");
}
}
......@@ -200,13 +201,13 @@ public class RoutineWorkTask {
log.info("众信利民助贷-百行重新报送D2结束, newTime: {} , newDatenyr: {} , result: {} ", LocalDateTime.now(), newDatenyr, result);
dingTalk.talk("Info", "众信利民助贷-重新报送 D2 结束", "(" + newDatenyr + ")" + result);
dingTalk.talk("Info", "ZXLM助贷-重新报送 D2 结束", "(" + newDatenyr + ")" + result);
Thread.sleep(10 * 1000);//10秒
} catch (Exception e) {
log.info("(众信利民助贷)重新报送D2异常, newTime: {} , newDatenyr: {} ", LocalDateTime.now(), newDatenyr, e);
dingTalk.talk_ToUser("众信利民助贷-重新报送 D2 异常", "(" + newDatenyr + ") D2报送异常,请尽快查看处理!");
dingTalk.talk_ToUser("ZXLM助贷-重新报送 D2 异常", "(" + newDatenyr + ") D2报送异常,请尽快查看处理!");
}
}
......@@ -217,13 +218,12 @@ public class RoutineWorkTask {
String result = baiHangZhuDaiService.sendHandRepaymentReportToBaiHang1(true, null);
log.info("众信利民助贷-百行重新报送D3结束, newTime: {} , newDatenyr: {} , result: {} ", LocalDateTime.now(), newDatenyr, result);
dingTalk.talk("Info", "众信利民助贷-重新报送 D2 结束", "(" + newDatenyr + ")" + result);
dingTalk.talk("Info", "ZXLM助贷-重新报送 D3 结束", "(" + newDatenyr + ")" + result);
Thread.sleep(10 * 1000);//10秒
} catch (Exception e) {
log.info("(众信利民助贷)重新报送D3异常, newTime: {} , newDatenyr: {} ", LocalDateTime.now(), newDatenyr, e);
dingTalk.talk_ToUser("众信利民助贷-重新报送 D3 异常", "(" + newDatenyr + ") D3报送异常,请尽快查看处理!");
dingTalk.talk_ToUser("ZXLM助贷-重新报送 D3 异常", "(" + newDatenyr + ") D3报送异常,请尽快查看处理!");
}
}
......
......@@ -216,12 +216,12 @@ public class ManualToolService implements CommonSuperService {
log.error("deal with reqIdByRemoteLog error!",e);
}finally {
if(!flag){
resultMsg.append("|##OTHER ERRORCODE:" + jsonObj.toJSONString()+"##");
resultMsg.append(" |##OTHER ERRORCODE:" + jsonObj.toJSONString()+"##");
log.info("ManualToolService OTHER ERRORCODE:" + jsonObj.toJSONString());
}
}
}
resultMsg.append("|reqIDList size=" + reqIDList.size() );
resultMsg.append(" |reqIDList size=" + reqIDList.size() );
if (reqIDList.size() > 0) { //还款D3
String[] recordIdArray = reqIDList.toArray(new String[reqIDList.size()]);
......@@ -244,9 +244,7 @@ public class ManualToolService implements CommonSuperService {
}
repaymentLoanInfoList.add(voBean);
}
resultMsg.append("|");
resultMsg.append("D3 List size=" + repaymentLoanInfoList.size());
resultMsg.append(" |D3 List size=" + repaymentLoanInfoList.size());
boolean lengthIs0 = (json_hk_D3.length()==0);
for (RepaymentInfoZhuDai vo : repaymentLoanInfoList){
......@@ -273,8 +271,7 @@ public class ManualToolService implements CommonSuperService {
//TargetRepayDateList报送时会查
loanInfoVoList.add(loanInfozd_tmp);
}
resultMsg.append("|");
resultMsg.append("D2 List size=" + loanInfoVoList.size());
resultMsg.append(" |D2 List size=" + loanInfoVoList.size());
if (loanInfoVoList.size() > 0) {
boolean lengthIs0 = (json_fk_D2.length()==0);
......@@ -313,11 +310,13 @@ public class ManualToolService implements CommonSuperService {
json_sq_A1.append(JSONObject.toJSONString(vo));
}
}
resultMsg.append(" |A1 List size=" + applyInfoList.size());
}
}
}
resultMsg.append(" >>>> ");
//------------处理--------------
if (StringUtils.isNotBlank(json_sq_A1)) {
log.info("json_sq_A1 DATA:" + json_sq_A1.toString());
......@@ -325,13 +324,10 @@ public class ManualToolService implements CommonSuperService {
if(isProduct2){
ReadOrWriteTxt.writeTxt(base_path + A1_file, json_sq_A1.toString());
log.info("RepaymentLoanInfoDbMapper.sendBaiHangData writ remote file (product By file)...baihang/A1/data.txt END.");
resultMsg.append("|");
resultMsg.append("write A1 end.(product By file)");
resultMsg.append(" |write A1 end.(product By file)");
}else{
String cmd_res = writeJsonFileOnRemote(executeCommand, base_path + A1_url, json_sq_A1.toString());
log.info("RepaymentLoanInfoDbMapper.sendBaiHangData writ remote file (local By shell)...baihang/A1/data.txt END,r:" + cmd_res);
resultMsg.append("|");
resultMsg.append("write A1 end.(local By shell)");
resultMsg.append("| write A1 end.(local By shell)");
}
resultMap.put("json_sq_A1", "true");
......@@ -345,8 +341,7 @@ public class ManualToolService implements CommonSuperService {
resultMsg.append(http_res);
}
}else{
resultMsg.append("|");
resultMsg.append("申请A1 json_sq_A1 isEmpty.");
resultMsg.append(" |申请A1 json_sq_A1 isEmpty.");
}
......@@ -356,13 +351,11 @@ public class ManualToolService implements CommonSuperService {
if(isProduct2){
ReadOrWriteTxt.writeTxt(base_path + D2_file,json_fk_D2.toString());
log.info("RepaymentLoanInfoDbMapper.sendBaiHangData writ remote file (product By file)...baihang/D2/data.txt END.");
resultMsg.append("|");
resultMsg.append("write D2 end.(product By file)");
resultMsg.append(" |write D2 end.(product By file)");
}else{
String cmd_res = writeJsonFileOnRemote(executeCommand, base_path + D2_url, json_fk_D2.toString());
log.info("RepaymentLoanInfoDbMapper.sendBaiHangData writ remote file (local By shell)...baihang/D2/data.txt END,r:" + cmd_res);
resultMsg.append("|");
resultMsg.append("write D2 end.(local By shell)");
resultMsg.append(" |write D2 end.(local By shell)");
}
resultMap.put("json_fk_D2", "true");
......@@ -372,12 +365,11 @@ public class ManualToolService implements CommonSuperService {
params.put("key", "b5140fb2-2c85-4b5a-abcf-3e97528014db");
String http_res = HttpRequestUtil.mySelfDoGet(base_url + "/mainLoanInfoSend", params);
log.info("RepaymentLoanInfoDbMapper.sendBaiHangData http request D2>>>mainLoanInfoSend END,r:" + http_res);
resultMsg.append("|");
resultMsg.append(" |");
resultMsg.append(http_res);
}
}else{
resultMsg.append("|");
resultMsg.append("放款D2 json_fk_D2 isEmpty.");
resultMsg.append(" |放款D2 json_fk_D2 isEmpty.");
}
......@@ -387,13 +379,11 @@ public class ManualToolService implements CommonSuperService {
if(isProduct2){
ReadOrWriteTxt.writeTxt(base_path + D3_file, json_hk_D3.toString());
log.info("RepaymentLoanInfoDbMapper.sendBaiHangData writ remote file (product By file)...baihang/D3/data.txt END.");
resultMsg.append("|");
resultMsg.append("write D3 end.(product By file)");
resultMsg.append(" |write D3 end.(product By file)");
}else{
String cmd_res = writeJsonFileOnRemote(executeCommand, base_path + D3_url, json_hk_D3.toString());
log.info("RepaymentLoanInfoDbMapper.sendBaiHangData writ remote file (local By shell)...baihang/D3/data.txt END,r:" + cmd_res);
resultMsg.append("|");
resultMsg.append("write D3 end.(local By shell)");
resultMsg.append(" |write D3 end.(local By shell)");
}
resultMap.put("json_hk_D3", "true");
......@@ -403,12 +393,11 @@ public class ManualToolService implements CommonSuperService {
params.put("key", "b5140fb2-2c85-4b5a-abcf-3e97528014db");
String http_res = HttpRequestUtil.mySelfDoGet(base_url + "/mainRepaymentLoanInfo", params);
log.info("RepaymentLoanInfoDbMapper.sendBaiHangData http request D3>>>mainRepaymentLoanInfo END,r:" + http_res);
resultMsg.append("|");
resultMsg.append(" |");
resultMsg.append(http_res);
}
}else {
resultMsg.append("|");
resultMsg.append("还款D3 json_hk_D3 isEmpty.");
resultMsg.append(" |还款D3 json_hk_D3 isEmpty.");
}
//退出登录
......@@ -446,6 +435,7 @@ public class ManualToolService implements CommonSuperService {
if(!have_logFile){
resultMap.put("alarm","反馈日志主文件不存在,请注意确认");
}
resultMap.put("isEmpty","isEmpty");
return resultMap;
}
......
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