Commit 39a53070 authored by 董建华's avatar 董建华

增加查询告警

parent de1ad45f
package com.service.report; package com.service.report;
import com.QgException; import com.QgException;
import com.alibaba.fastjson.JSONObject;
import com.emums.BusinessType; import com.emums.BusinessType;
import com.emums.InfoType; import com.emums.InfoType;
import com.entity.FileEntry; import com.entity.FileEntry;
...@@ -49,4 +50,6 @@ public interface ReportService { ...@@ -49,4 +50,6 @@ public interface ReportService {
void insertReportLogAsync(List<Map<String, Object>> list,FileEntry fileEntry,String type); void insertReportLogAsync(List<Map<String, Object>> list,FileEntry fileEntry,String type);
void insertLog(); void insertLog();
//查询共享数据
Map querySharingData(String sname, String stype, String sreason, String sno);
} }
...@@ -11,6 +11,8 @@ import com.emums.InfoType; ...@@ -11,6 +11,8 @@ import com.emums.InfoType;
import com.emums.PathType; import com.emums.PathType;
import com.entity.FileEntry; import com.entity.FileEntry;
import com.entity.report.ReportRecord; import com.entity.report.ReportRecord;
import com.google.common.collect.ImmutableMap;
import com.google.errorprone.annotations.Immutable;
import com.mapper.data.DataMapper; import com.mapper.data.DataMapper;
import com.mapper.report.ReportRecordMapper; import com.mapper.report.ReportRecordMapper;
import com.service.report.ReportService; import com.service.report.ReportService;
...@@ -426,6 +428,9 @@ public class IReportServiceImpl implements ReportService { ...@@ -426,6 +428,9 @@ public class IReportServiceImpl implements ReportService {
quaryReportedStatus(fileEntry); quaryReportedStatus(fileEntry);
} catch (QgException qge) { } catch (QgException qge) {
dingTalk.talk("查询上报状态接口告警", qge); dingTalk.talk("查询上报状态接口告警", qge);
} catch (Exception e){
log.error("查询上报状态接口异常Filename: {} ",record.getFilename(),e);
dingTalk.talk("查询上报状态接口异常", "filename:"+record.getFilename());
} }
}); });
} }
...@@ -734,6 +739,54 @@ public class IReportServiceImpl implements ReportService { ...@@ -734,6 +739,54 @@ public class IReportServiceImpl implements ReportService {
} }
} }
/**
*
* @param sname 名字
* @param stype 证件类型
* @param sreason 查询原因
* @param sno 证件号码
* @return
*/
@Override
public Map querySharingData(String sname, String stype, String sreason, String sno) {
log.info("中互金共享数据查询开始, sname: {} , stype: {} , sreason: {} , sno: {} ", sname, stype, sreason, sno);
// 构造body
Map<String, String> bodyMap = new HashMap();
bodyMap.put("sname", sname);
bodyMap.put("stype",stype);
bodyMap.put("sreason", sreason);
bodyMap.put("sno", sno);
System.out.println("[body]: \n" + JSON.toJSONString(bodyMap));
Map<String, String> infoHeaderMap = getInfoHeaderMap(sname, stype, sreason, sno);
ClientResponse resp = null;
try {
resp = reportJerseyClient.post(infoHeaderMap, bodyMap, reportConfig.getInfoUrl());
}catch (Exception e){
log.error("中互金共享数据查询异常:, sname: {} , stype: {} , sreason: {} , sno: {} ", sname, stype, sreason, sno,e);
return ImmutableMap.of("code","500","msg","调用中互金异常");
}
if (resp.getStatus() == 200) {
System.out.println(resp.getEntity(String.class));
return ImmutableMap.of("code","0","msg","调用中互金异常","data",resp.getEntity(String.class));
/*
* 不修改任何配置时默认返回:
* {"loancount":"58","loanamt":"5800000","outstandcount":"58","loanbal":"5800000",
* "generationcount":"0","generationamount":"0","overduecount":"0","overdueamt":"0",
* "overduemorecount":"0","overduemoreamt":"0",
* "totalorg":"最近1个月被6家机构查询",
* "queryatotalorg":"最近1个月被6家机构以“贷前审批”原因查询",
* "infoquerybean":[{"ordernum":"1","ddate":"2018-10-23","s_value":"贷前审批"},{"ordernum":"2","ddate":"2018-10-23","s_value":"其他"......}],
* "msgCode":"200","msgContent":"成功!"}
*/
}else {
System.out.println("[ERROR] Status: " + resp.getStatus());
System.out.println(resp.getEntity(String.class));
}
return null;
}
public Map<ErrorReson, List<String>> classify(List<String> data) { public Map<ErrorReson, List<String>> classify(List<String> data) {
Map<ErrorReson, List<String>> rsult = new HashMap<>(); Map<ErrorReson, List<String>> rsult = new HashMap<>();
for (String datum : data) { for (String datum : data) {
...@@ -1021,6 +1074,27 @@ public class IReportServiceImpl implements ReportService { ...@@ -1021,6 +1074,27 @@ public class IReportServiceImpl implements ReportService {
headerMap.put("sdatacode", map.get("sdatacode")); headerMap.put("sdatacode", map.get("sdatacode"));
return headerMap; return headerMap;
}
//查询共享信息
private Map<String, String> getInfoHeaderMap(String sname ,String stype,String sreason,String sno) {
//
String scode = utils.getRandomNumber(10); //10位随机数
// 构造签名 用于身份验证
String preparedSign = reportConfig.getCode() // sbankcode
+ scode
+ sname
+ stype
+ sreason
+ sno
+ reportConfig.getInterFaceKey(); //key
String sign = utils.sha256(preparedSign);
// 构造header
Map<String, String> headerMap = new HashMap<String, String>();
headerMap.put("sbankcode", reportConfig.getCode());
headerMap.put("scode", scode);
headerMap.put("sign", sign);
return headerMap;
} }
/** /**
......
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