package com.tenwa.httpclient.pypafhtml; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.google.common.collect.Lists; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; public class PyHtmlContent { /** * 统计时间段:1-近1年、2-近2年、3-近5年、4-历史 * 数据库表名和列字段对应关系 */ public enum JudicialXZCountTypeEnums{ taxPunishCount("taxPunishCount","税务处罚事件数量"), marketPunishCount("marketPunishCount","市场监管处罚事件数量"), customsPunishCount("customsPunishCount","海关处罚事件数量"), environmentPunishCount("environmentPunishCount","环保处罚事件数量"), otherPunishCount("otherPunishCount","其他行政处罚事件数量"), punishTotalCount("punishTotalCount","(行政处罚事件)合计"); private String code; //类型 private String desc; //描述 private JudicialXZCountTypeEnums(String code, String desc){ this.code=code; this.desc=desc; } public String getDesc() { return desc; } public String getCode() { return this.code; } /** * 根据code 数据库表名的列字段 * @param code * @return */ public static String getValueData(String code){ for(JudicialXZCountTypeEnums data : JudicialXZCountTypeEnums.values()){ if(data.getCode().toLowerCase().equals(code.toLowerCase())){ return data.getDesc(); } } return "无"; } } /** * 统计时间段:1-近1年、2-近2年、3-近5年、4-历史 * 数据库表名和列字段对应关系 */ public enum JudicialSFCountTypeEnums{ civilCaseCount("civilCaseCount","民事案件被告风险事件数量"), criminalCaseCount("criminalCaseCount","刑事案件被告风险事件数量"), judicialCount("judicialCount","司法被执行人风险事件数量"), endCaseCount("endCaseCount","终本案件风险事件数量"), breakFaithCount("breakFaithCount","失信被执行人风险事件数量"), judicialTotalCount("judicialTotalCount","(司法涉诉风险事件)合计"); private String code; //类型 private String desc; //描述 private JudicialSFCountTypeEnums(String code, String desc){ this.code=code; this.desc=desc; } public String getDesc() { return desc; } public String getCode() { return this.code; } /** * 根据code 数据库表名的列字段 * @param code * @return */ public static String getValueData(String code){ for(JudicialSFCountTypeEnums data : JudicialSFCountTypeEnums.values()){ if(data.getCode().toLowerCase().equals(code.toLowerCase())){ return data.getDesc(); } } return "无"; } } /** * 统计时间段:1-近1年、2-近2年、3-近5年、4-历史 * 数据库表名和列字段对应关系 */ public enum JudicialRiskTimeLengthEnums{ Length_1("1","oneYearCount"), Length_2("2","twoYearCount"), Length_3("3","fiveYearCount"), Length_4("4","historyYearCount"); private String code; //类型 private String desc; //描述 private JudicialRiskTimeLengthEnums(String code, String desc){ this.code=code; this.desc=desc; } public String getDesc() { return desc; } public String getCode() { return this.code; } /** * 根据code 数据库表名的列字段 * @param code * @return */ public static String getValueData(String code){ for(JudicialRiskTimeLengthEnums data : JudicialRiskTimeLengthEnums.values()){ if(data.getCode().toLowerCase().equals(code.toLowerCase())){ return data.getDesc(); } } return "无"; } } /** * 1:正常在用 2: 停机 3:未启用 4:已销号 6:预销号该值可能为空 * 数据库表名和列字段对应关系 */ public enum MobileStsEnums{ Sts_1("1","正常在用"), Sts_2("2","停机"), Sts_3("3","未启用"), Sts_4("4","已销号"), Sts_6("6","预销号该值可能为空"); private String code; //类型 private String desc; //描述 private MobileStsEnums(String code, String desc){ this.code=code; this.desc=desc; } public String getDesc() { return desc; } public String getCode() { return this.code; } /** * 根据code 数据库表名的列字段 * @param code * @return */ public static String getValueData(String code){ for(MobileStsEnums data : MobileStsEnums.values()){ if(data.getCode().toLowerCase().equals(code.toLowerCase())){ return data.getDesc(); } } return "无"; } } //1:不足3个月 2:3-6个月 3:6-12个月 4:12-24个月 5:24个月 /** * 数据库表名和列字段对应关系 */ public enum MobileTimeLengthEnums{ Length_1("1","不足3个月"), Length_2("2","3-6个月"), Length_3("3","6-12个月"), Length_4("4","12-24个月"), Length_5("5","24个月"); private String code; //类型 private String desc; //描述 private MobileTimeLengthEnums(String code, String desc){ this.code=code; this.desc=desc; } public String getDesc() { return desc; } public String getCode() { return this.code; } /** * 根据code 数据库表名的列字段 * @param code * @return */ public static String getValueData(String code){ for(MobileTimeLengthEnums data : MobileTimeLengthEnums.values()){ if(data.getCode().toLowerCase().equals(code.toLowerCase())){ return data.getDesc(); } } return "无"; } } /** * 数据库表名和列字段对应关系 */ public enum MobileOperatorEnums{ DX("1","中国电信"), YD("2","中国移动"), LT("3","中国联通"); private String code; //类型 private String desc; //描述 private MobileOperatorEnums(String code, String desc){ this.code=code; this.desc=desc; } public String getDesc() { return desc; } public String getCode() { return this.code; } /** * 根据code 数据库表名的列字段 * @param code * @return */ public static String getValueData(String code){ for(MobileOperatorEnums data : MobileOperatorEnums.values()){ if(data.getCode().toLowerCase().equals(code.toLowerCase())){ return data.getDesc(); } } return "无"; } } /** * 数据库表名和列字段对应关系 */ public enum PafEnums{ personAntiFraudDescInfo("personAntiFraudDescInfo","欺诈风险汇总", PyHtmlContent.personAntiFraudDescInfo), personAntiFraudScoreInfo("personAntiFraudScoreInfo","欺诈风险指数", PyHtmlContent.personAntiFraudScoreInfo), personBaseInfo("personBaseInfo","身份信息校验", PyHtmlContent.personBaseInfo), policeCheckInfo("policeCheckInfo","身份认证结果", PyHtmlContent.policeCheckInfo), mobileCheckInfo("mobileCheckInfo","手机号信息校验", PyHtmlContent.mobileCheckInfo), mobileStatusInfo("mobileStatusInfo","手机号码时长", PyHtmlContent.mobileStatusInfo), personRiskRosterInfo("personRiskRosterInfo","命中名单", PyHtmlContent.personRiskRosterInfo), personJudicialSFRiskInfo("personJudicialSFRiskInfo","司法查询", PyHtmlContent.personJudicialSFRiskInfo), personJudicialXZRiskInfo("personJudicialXZRiskInfo","行政查询", PyHtmlContent.personJudicialXZRiskInfo); private String code; //类型 private String htmlContent; //类型 private String desc; //描述 private PafEnums(String code, String desc, String htmlContent){ this.code=code; this.desc=desc; this.htmlContent=htmlContent; } public String getDesc() { return desc; } public String getHtmlContent() { return htmlContent; } public String getCode() { return this.code; } /** * 根据code 数据库表名的列字段 * @param code * @return */ public static String getValueData(String code){ for(PafEnums data : PafEnums.values()){ if(data.getCode().toLowerCase().equals(code.toLowerCase())){ return data.getHtmlContent(); } } return "无"; } } /** * 数据库表名和列字段对应关系 */ public enum PersonAntiFraudDescInfoEnums{ antiFraudScore("antiFraudScore","欺诈风险指数"), antiFraudScoreRiskLevel("antiFraudScoreRiskLevel","欺诈风险指数风险等级"), policeCheckRiskLevel("policeCheckRiskLevel","身份认证结果风险等级"), policeCheckDesc("policeCheckDesc","身份认证结果"), mobileCheckRiskLevel("mobileCheckRiskLevel","手机号码核查结果风险等级"), mobileCheckDesc("mobileCheckDesc","手机号码核查结果"), mobileStatusRiskLevel("mobileStatusRiskLevel","手机号码状态及在网时长结果风险等级"), mobileStatusDesc("mobileStatusDesc","手机号码状态及在网时长结果"), riskRosterRiskLevel("riskRosterRiskLevel","风险名单结果风险等级"), riskRosterDesc("riskRosterDesc","风险名单结果"), judicialRiskLevel("judicialRiskLevel","司法风险结果风险等级"), judicialRiskDesc("judicialRiskDesc","司法风险结果"); private String code; //类型 private String desc; //描述 private PersonAntiFraudDescInfoEnums(String code, String desc){ this.code=code; this.desc=desc; } public String getDesc() { return desc; } public String getCode() { return this.code; } /** * 根据code 数据库表名的列字段 * @param code * @return */ public static String getValueData(String code){ for(PersonAntiFraudDescInfoEnums data : PersonAntiFraudDescInfoEnums.values()){ if(data.getCode().toLowerCase().equals(code.toLowerCase())){ return data.getDesc(); } } return "无"; } } /** * 数据库表名和列字段对应关系 */ public enum RiskType{ risk_000("000","未命中风险名单"), risk_101("101","疑似欺诈风险"), risk_102("102","疑似营销套利"), risk_201("201","疑似身份造假"), risk_202("202","疑似资料造假"), risk_203("203","疑似盗号风险"), risk_301("301","刑事被告"), risk_302("302","民事被告"), risk_303("303","司法被执行人"), risk_304("304","终本案件人员"), risk_305("305","司法失信人员"), risk_306("306","行政处罚人员"), risk_999("999","其他风险"); private String code; //类型 private String desc; //描述 private RiskType(String code, String desc){ this.code=code; this.desc=desc; } public String getDesc() { return desc; } public String getCode() { return this.code; } /** * 根据code 数据库表名的列字段 * @param code * @return */ public static String getValueData(String code){ for(RiskType data : RiskType.values()){ if(data.getCode().toLowerCase().equals(code.toLowerCase())){ return data.getDesc(); } } return "未命中风险名单"; } } /** * 内容开始部分 * @param obj * @return */ public static String createBodyHead(JSONObject obj) throws ParseException { StringBuilder sb = new StringBuilder(); String bodyTitle = title; bodyTitle = bodyTitle.replace("reportID", obj.getString("reportID")); sb.append(bodyTitle); String bodyQueryConditions = queryConditions; JSONObject queryConditionsObj = obj.getJSONObject("queryConditionsObj"); bodyQueryConditions = bodyQueryConditions.replace("name", queryConditionsObj.getString("name")); bodyQueryConditions = bodyQueryConditions.replace("documentNo", queryConditionsObj.getString("documentNo")); bodyQueryConditions = bodyQueryConditions.replace("unitName", obj.getString("unitName")); bodyQueryConditions = bodyQueryConditions.replace("queryUserID", obj.getString("queryUserID")); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); Date birDate = sdf.parse(obj.getString("receiveTime").substring(0, 8)); SimpleDateFormat sdfRes = new SimpleDateFormat("yyyy年MM月dd日"); String birStr = sdfRes.format(birDate); bodyQueryConditions = bodyQueryConditions.replace("receiveTime", birStr); sb.append(bodyQueryConditions); String bodyBContentPafQuery = bodyContentPafQuery; bodyBContentPafQuery = bodyBContentPafQuery.replace("phone", queryConditionsObj.getString("phone")); sb.append(bodyBContentPafQuery); return sb.toString(); } public static String title = " reportID" + " \n" + " \n" + " \n" + " \n" + " \n" ; public static String queryConditions = " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + // " \n" + " \n" + " \n" + // " \n" + " \n" + " \n" + " \n" + " \n" + // " \n" + " \n" + " \n" + // " \n" + " \n" + " \n" + " \n" + " \n" + // " \n" + " \n" + " \n" + "
姓名name熊海查询时间receiveTime2020年07月28日
证件号码documentNo360123*********978操作员queryUserIDapwsqueryn
查询机构unitName安鹏融资租赁(天津)有限公司
\n" + " \n" ; //反欺诈附件条件 public static String bodyContentPafQuery = " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "
反欺诈分析附加条件
\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "
手机号码phone
\n" + " \n" ; public static String contentError = "errorMessage "; public static String contentEmpty = " errorMessage "; /** * 反欺诈信息汇总 * @param obj * @return */ private static String createBaseContent(String key, String content, JSONObject obj) throws ParseException { String bodyContentError = contentError; String bodyContentEmpty = contentEmpty; String bodyContent = content; String subContent = ""; String jsonKey = key; if("personJudicialSFRiskInfo".equals(key) || "personJudicialXZRiskInfo".equals(key)){ jsonKey = "personJudicialRiskInfo"; } JSONObject keyObj = obj.getJSONObject(jsonKey); String errorMessage = ""; if(keyObj.containsKey("errorMessage")){ errorMessage = keyObj.getString("errorMessage"); } if("3".equals(keyObj.getString("treatResult"))){//系统错误,默认包含细节 if(null == errorMessage || "".equals(errorMessage)){ errorMessage = "系统错误。"; } bodyContentError = bodyContentError.replace("errorMessage", errorMessage); subContent = bodyContentError; }else{//如果包含细节 subContent = createBodyContentDes(key, obj); } if(null == subContent || "".equals(subContent.toString())){ subContent = bodyContentEmpty.replace("errorMessage", "根据已提供的查询条件,未能在系统中查得相关信息。"); } bodyContent = bodyContent.replace("subContent", subContent); return bodyContent; } /** * * @param obj * @return */ public static String createBodyContent(JSONObject obj) throws ParseException { StringBuilder sb = new StringBuilder(); for(PafEnums pe : PafEnums.values()){ String jsonKey = pe.getCode(); if("personJudicialSFRiskInfo".equals(pe.getCode()) || "personJudicialXZRiskInfo".equals(pe.getCode())){ jsonKey = "personJudicialRiskInfo"; } JSONObject keyObj = obj.getJSONObject(jsonKey); String treatResult = keyObj.getString("treatResult"); //是否包含细节内容 boolean addContentB = false; List resKeyArr = Lists.newArrayList("subReportType", "subReportTypeCost", "treatResult", "treatErrorCode", "errorMessage"); for(String keyRes : keyObj.keySet()){ if(!resKeyArr.contains(keyRes) || "3".equals(treatResult)){ addContentB = true; } } if(addContentB){ String content = createBaseContent(pe.getCode(), pe.getHtmlContent(), obj); sb.append(content); } } return sb.toString(); } /** * 反欺诈信息汇总 * @param obj * @return */ private static String createPafDescContent(String key, JSONObject obj){ String bodyPersonAntiFraudDescInfoContent = personAntiFraudDescInfoContent; JSONObject subObj = obj.getJSONObject(key); // TODO: 2020/7/29 增加判断空 antiFraudScore String antiFraudScore = subObj.getString("antiFraudScore"); bodyPersonAntiFraudDescInfoContent = bodyPersonAntiFraudDescInfoContent.replace("antiFraudScore", subObj.getString("antiFraudScore")); StringBuilder sbContent = new StringBuilder(); for(PersonAntiFraudDescInfoEnums pe : PersonAntiFraudDescInfoEnums.values()){ if(null != subObj.getString(pe.getCode()) && !"".equals(subObj.getString(pe.getCode()))){ String subContent = personAntiFraudDescInfoContentItem; String imgStatus = "image_success"; // TODO: 2020/7/29 如果包含 不正常 高风险 则改为 imgage_error String result = subObj.getString(pe.getCode()); if("antiFraudScore".equals(pe.getCode())) { if(Integer.parseInt(result) > 500){ imgStatus = "image_error"; } }else if("policeCheckDesc".equals(pe.getCode())){ String resPre = subObj.getString("policeCheckRiskLevel"); if(resPre.contains("高风险")){ imgStatus = "image_error"; }else if(resPre.contains("中风险")){ imgStatus = "image_warn"; } }else if("mobileCheckDesc".equals(pe.getCode())){ String resPre = subObj.getString("mobileCheckRiskLevel"); if(resPre.contains("高风险")){ imgStatus = "image_error"; }else if(resPre.contains("中风险")){ imgStatus = "image_warn"; } }else if("mobileStatusDesc".equals(pe.getCode())){ String resPre = subObj.getString("mobileStatusRiskLevel"); if(resPre.contains("高风险")){ imgStatus = "image_error"; }else if(resPre.contains("中风险")){ imgStatus = "image_warn"; } }else if("judicialRiskDesc".equals(pe.getCode())){ String resPre = subObj.getString("judicialRiskLevel"); if(resPre.contains("高风险")){ imgStatus = "image_error"; }else if(resPre.contains("中风险")){ imgStatus = "image_warn"; } }else if("riskRosterDesc".equals(pe.getCode())){ if(!"未命中风险名单".equals(result)){ imgStatus = "image_error"; } } if(result.contains("高风险")){ imgStatus = "image_error"; } String pafDesc = pe.getDesc() + ":" + subObj.getString(pe.getCode()); subContent = subContent.replace("image_status", imgStatus); subContent = subContent.replace("pafDesc", pafDesc); sbContent.append(subContent); } } bodyPersonAntiFraudDescInfoContent = bodyPersonAntiFraudDescInfoContent.replace("contentItem", sbContent.toString()); return bodyPersonAntiFraudDescInfoContent; } //反欺诈分析综述 public static String personAntiFraudDescInfoContentItem = "
pafDesc
"; //反欺诈分析综述 public static String personAntiFraudDescInfoContent = " \n" + " 欺诈风险指数为 antiFraudScore 分 \n" + " \n" + " \n" + " contentItem \n" + " \n" ; //反欺诈分析综述 public static String personAntiFraudDescInfo = " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "
反欺诈分析综述
\n" + " \n" + " \n" + " \n" + " \n" + " subContent \n" + "
\n" + " \n" ; /** * 反欺诈指数 * @param obj * @return */ private static String createPersonAntiFraudScoreInfoContent(String key, JSONObject obj){ String bodyPersonAntiFraudScoreInfoContent = personAntiFraudScoreInfoContent; JSONObject subObj = obj.getJSONObject(key); bodyPersonAntiFraudScoreInfoContent = bodyPersonAntiFraudScoreInfoContent.replace("riskScore", subObj.getString("riskScore")); bodyPersonAntiFraudScoreInfoContent = bodyPersonAntiFraudScoreInfoContent.replace("riskLevel", subObj.getString("riskLevel")); bodyPersonAntiFraudScoreInfoContent = bodyPersonAntiFraudScoreInfoContent.replace("hitTypes", subObj.getString("hitTypes")); return bodyPersonAntiFraudScoreInfoContent; } //反欺诈分析指数 public static String personAntiFraudScoreInfoContent = " 欺诈风险指数为 riskScore 分 \n" + "欺诈风险等级为 riskLevel \n" + " 欺诈风险标签为 hitTypes \n" ; //反欺诈分析指数【图片删掉】 public static String personAntiFraudScoreInfo = " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "
欺诈风险指数
\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " subContent \n" + "
\n" + " \n" ; /** * 证件号码校验信息 * @param obj * @return */ private static String createPersonBaseInfoContent(String key, JSONObject obj) throws ParseException { String bodyPersonBaseInfoContent = personBaseInfoContent; JSONObject subObj = obj.getJSONObject(key); bodyPersonBaseInfoContent = bodyPersonBaseInfoContent.replace("docNo", subObj.getString("docNo")); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); Date birDate = sdf.parse(subObj.getString("birthday")); SimpleDateFormat sdfRes = new SimpleDateFormat("yyyy年MM月dd日"); String birStr = sdfRes.format(birDate); bodyPersonBaseInfoContent = bodyPersonBaseInfoContent.replace("birthday", birStr); String genderId = subObj.getString("genderID"); if("1".equals(genderId)){ genderId = "男"; }else if("2".equals(genderId)){ genderId = "女"; }else if("3".equals(genderId)){ genderId = "不详"; } bodyPersonBaseInfoContent = bodyPersonBaseInfoContent.replace("genderID", genderId); bodyPersonBaseInfoContent = bodyPersonBaseInfoContent.replace("age", subObj.getString("age")); bodyPersonBaseInfoContent = bodyPersonBaseInfoContent.replace("originalAddress", subObj.getString("originalAddress")); bodyPersonBaseInfoContent = bodyPersonBaseInfoContent.replace("verifyResult", "1".equals(subObj.getString("verifyResult")) ? "通过" : "未通过"); return bodyPersonBaseInfoContent; } //证件号码校验信息 public static String personBaseInfoContent = " \n" + " 证件号码 \n" + " docNo \n" + " 出生日期 \n" + " birthday \n" + " \n" + " \n" + " 性别 \n" + " genderID \n" + " 年龄 \n" + " age \n" + " \n" + " \n" + " 原始发证地区 \n" + " originalAddress \n" + " \n" + " \n" + " 证件校验结果 \n" + " verifyResult \n" + " \n" ; //证件号码校验信息 public static String personBaseInfo = " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "
证件号码校验信息
\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " subContent \n" + "
\n" + " \n"; /** * 证件号码校验信息 * @param obj * @return */ private static String createPoliceCheckInfoContent(String key, JSONObject obj){ StringBuilder sb = new StringBuilder(); JSONObject arrObj = obj.getJSONObject(key); JSONArray subArr = arrObj.getJSONArray("item"); for(int i = 0; i < subArr.size(); i++){ JSONObject subObj = subArr.getJSONObject(i); String bodyPoliceCheckInfoContent = policeCheckInfoContent; bodyPoliceCheckInfoContent = bodyPoliceCheckInfoContent.replace("result", "1".equals(subObj.getString("result")) ? "一致" : "不一致"); sb.append(bodyPoliceCheckInfoContent); } return sb.toString(); } //证件号码认证结果 public static String policeCheckInfoContent = " \n" + " 身份认证结果 \n" + " result \n" + " \n" ; //证件号码认证结果 public static String policeCheckInfo = " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "
身份认证
\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " subContent \n" + "
\n" + " \n"; /** * 手机号码校验信息结果 * @param obj * @return */ private static String createMobileCheckInfoContent(String key, JSONObject obj){ StringBuilder sb = new StringBuilder(); JSONObject arrObj = obj.getJSONObject(key); JSONArray subArr = arrObj.getJSONArray("item"); for(int i = 0; i < subArr.size(); i++){ JSONObject subObj = subArr.getJSONObject(i); String bodyMobileCheckInfoContent = mobileCheckInfoContent; bodyMobileCheckInfoContent = bodyMobileCheckInfoContent.replace("checkResult", subObj.getString("checkResult")); bodyMobileCheckInfoContent = bodyMobileCheckInfoContent.replace("areaInfo", subObj.getString("areaInfo")); bodyMobileCheckInfoContent = bodyMobileCheckInfoContent.replace("operator", MobileOperatorEnums.getValueData(subObj.getString("operator"))); sb.append(bodyMobileCheckInfoContent); } return sb.toString(); } //手机号码校验信息结果 public static String mobileCheckInfoContent = " \n" + " 运营商名称 \n" + " operator \n" + " \n" + " \n" + " 手机号码归属地 \n" + " areaInfo \n" + " \n" + " \n" + " 手机认证结果 \n" + " checkResult \n" + " \n" ; //手机号码校验信息结果 public static String mobileCheckInfo = " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "
手机认证
\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " subContent \n" + "
\n" + " \n"; /** * 手机号码在线时长 * @param obj * @return */ private static String createMobileStatusInfoContent(String key, JSONObject obj){ StringBuilder sb = new StringBuilder(); JSONObject arrObj = obj.getJSONObject(key); JSONArray subArr = arrObj.getJSONArray("item"); for(int i = 0; i < subArr.size(); i++){ JSONObject subObj = subArr.getJSONObject(i); String bodyMobileStatusInfoContent = mobileStatusInfoContent; bodyMobileStatusInfoContent = bodyMobileStatusInfoContent.replace("timeLength", MobileTimeLengthEnums.getValueData(subObj.getString("timeLength"))); bodyMobileStatusInfoContent = bodyMobileStatusInfoContent.replace("phoneStatus", MobileStsEnums.getValueData(subObj.getString("phoneStatus"))); sb.append(bodyMobileStatusInfoContent); } return sb.toString(); } //手机号码在线时长 public static String mobileStatusInfoContent = " \n" + " 手机号码状态 \n" + " phoneStatus \n" + " \n" + " \n" + " 手机号码在网时长 \n" + " timeLength \n" + " \n" ; //手机号码在线时长 public static String mobileStatusInfo = " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "
手机号码状态时长
\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " subContent \n" + "
\n" + " \n"; /** * 风险名单命中结果 * @param obj * @return */ private static String createPersonRiskRosterInfoContent(String key, JSONObject obj){ String bodyPersonRiskRosterInfoContent = personRiskRosterInfoContent; JSONObject subObj = obj.getJSONObject(key); StringBuilder sb = new StringBuilder(); // TODO: 2020/7/29 判断为空 String[] riskTypes = subObj.getString("riskTypes").split(","); for(String riskType : riskTypes){ sb.append(RiskType.getValueData(riskType) + ", "); } String risk = sb.toString(); risk = risk.substring(0, risk.length() - 2); bodyPersonRiskRosterInfoContent = bodyPersonRiskRosterInfoContent.replace("riskTypes", risk); return bodyPersonRiskRosterInfoContent; } //风险名单命中结果 public static String personRiskRosterInfoContent = " \n" + " 命中风险类型 \n" + " riskTypes \n" + " \n" ; //风险名单命中结果 public static String personRiskRosterInfo = " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "
风险名单
\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " subContent \n" + "
\n" + " \n"; /** * 风险名单命中结果 * @param obj * @return */ private static String createPersonJudicialSFRiskInfoContent(String key, JSONObject obj){ String bodyPersonJudicialRiskInfoContentSFItem = personJudicialRiskInfoContent; String tail = ""; //obj转换 JSONObject resObj = new JSONObject(); JSONObject civilCaseCount = new JSONObject(); JSONObject criminalCaseCount = new JSONObject(); JSONObject judicialCount = new JSONObject(); JSONObject endCaseCount = new JSONObject(); JSONObject breakFaithCount = new JSONObject(); JSONObject judicialTotalCount = new JSONObject(); resObj.put("civilCaseCount", civilCaseCount); resObj.put("criminalCaseCount", criminalCaseCount); resObj.put("judicialCount", judicialCount); resObj.put("endCaseCount", endCaseCount); resObj.put("breakFaithCount", breakFaithCount); resObj.put("judicialTotalCount", judicialTotalCount); JSONObject subObj = obj.getJSONObject("personJudicialRiskInfo"); JSONArray subArr = subObj.getJSONArray("item"); for(int i = 0; i < subArr.size(); i++){ JSONObject subJson = subArr.getJSONObject(i); String resKey = JudicialRiskTimeLengthEnums.getValueData(subJson.getString("timePeriod")); for(String subKey : subJson.keySet()){ for(String resSubKey : resObj.keySet()){ if(subKey.equals(resSubKey)){ JSONObject resSubObj = resObj.getJSONObject(resSubKey); resSubObj.put(resKey, subJson.getString(subKey)); } } } } StringBuilder sb = new StringBuilder(); //循环 for(String resKey : resObj.keySet()){ JSONObject resJson = resObj.getJSONObject(resKey); String content = personJudicialRiskInfoContentSFItem; content = content.replace("judicialSFType", JudicialSFCountTypeEnums.getValueData(resKey)); for(JudicialRiskTimeLengthEnums je : JudicialRiskTimeLengthEnums.values()){ content = content.replace(je.getDesc(), resJson.getString(je.getDesc())); } if("judicialTotalCount".equals(resKey)){//合计放在末尾 tail = content; }else { sb.append(content); } } return bodyPersonJudicialRiskInfoContentSFItem + sb.toString() + tail; } /** * 风险名单命中结果 * @param obj * @return */ private static String createPersonJudicialXZRiskInfoContent(String key, JSONObject obj){ String bodyPersonJudicialRiskInfoContentXZItem = personJudicialRiskInfoContent; String tail = ""; //obj转换 JSONObject resObj = new JSONObject(); JSONObject taxPunishCount = new JSONObject(); JSONObject marketPunishCount = new JSONObject(); JSONObject customsPunishCount = new JSONObject(); JSONObject environmentPunishCount = new JSONObject(); JSONObject otherPunishCount = new JSONObject(); JSONObject punishTotalCount = new JSONObject(); resObj.put("taxPunishCount", taxPunishCount); resObj.put("marketPunishCount", marketPunishCount); resObj.put("customsPunishCount", customsPunishCount); resObj.put("environmentPunishCount", environmentPunishCount); resObj.put("otherPunishCount", otherPunishCount); resObj.put("punishTotalCount", punishTotalCount); JSONObject subObj = obj.getJSONObject("personJudicialRiskInfo"); JSONArray subArr = subObj.getJSONArray("item"); for(int i = 0; i < subArr.size(); i++){ JSONObject subJson = subArr.getJSONObject(i); String resKey = JudicialRiskTimeLengthEnums.getValueData(subJson.getString("timePeriod")); for(String subKey : subJson.keySet()){ for(String resSubKey : resObj.keySet()){ if(subKey.equals(resSubKey)){ JSONObject resSubObj = resObj.getJSONObject(resSubKey); resSubObj.put(resKey, subJson.getString(subKey)); } } } } StringBuilder sb = new StringBuilder(); System.out.println("resObj="+resObj.toJSONString()); //循环 for(String resKey : resObj.keySet()){ JSONObject resJson = resObj.getJSONObject(resKey); String content = personJudicialRiskInfoContentXZItem; content = content.replace("judicialXZType", JudicialXZCountTypeEnums.getValueData(resKey)); for(JudicialRiskTimeLengthEnums je : JudicialRiskTimeLengthEnums.values()){ content = content.replace(je.getDesc(), resJson.getString(je.getDesc())); } if("punishTotalCount".equals(resKey)){//合计放在末尾 tail = content; }else { sb.append(content); } } return bodyPersonJudicialRiskInfoContentXZItem + sb.toString() + tail; } /** * 内容生成 * @param key * @param obj * @return */ private static String createBodyContentDes(String key, JSONObject obj) throws ParseException { if("personAntiFraudDescInfo".equals(key)){ return createPafDescContent(key, obj); }else if("personAntiFraudScoreInfo".equals(key)){ return createPersonAntiFraudScoreInfoContent(key, obj); }else if("personBaseInfo".equals(key)){//证件号码校验信息 return createPersonBaseInfoContent(key, obj); }else if("policeCheckInfo".equals(key)){ return createPoliceCheckInfoContent(key, obj); }else if("mobileCheckInfo".equals(key)){ return createMobileCheckInfoContent(key, obj); }else if("mobileStatusInfo".equals(key)){ return createMobileStatusInfoContent(key, obj); }else if("personRiskRosterInfo".equals(key)){ return createPersonRiskRosterInfoContent(key, obj); }else if("personJudicialSFRiskInfo".equals(key)){ return createPersonJudicialSFRiskInfoContent(key, obj); }else if("personJudicialXZRiskInfo".equals(key)){ return createPersonJudicialXZRiskInfoContent(key, obj); } return null; } public static String personJudicialRiskInfoContentSFItem = " \n" + " judicialSFType \n" + " oneYearCount \n" + " twoYearCount \n" + " fiveYearCount \n" + " historyYearCount \n" + " \n"; public static String personJudicialRiskInfoContentXZItem = " \n" + " judicialXZType \n" + " oneYearCount \n" + " twoYearCount \n" + " fiveYearCount \n" + " historyYearCount \n" + " \n"; public static String personJudicialRiskInfoContent = " \n" + " 风险类型 \n" + " 近1年 \n" + " 近2年 \n" + " 近5年 \n" + " 历史 \n" + " \n" ; public static String personJudicialSFRiskInfo = " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "
司法风险汇总
\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "
司法涉诉
\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " subContent \n" + "
\n" + " \n" ; public static String personJudicialXZRiskInfo = " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "
行政处罚
\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " subContent \n" + "
\n" + " "; }