|
@@ -89,17 +89,18 @@ public class EnterpriseHealthComputerV2 {
|
|
|
result.healthItems = checkHealthItems(result);
|
|
result.healthItems = checkHealthItems(result);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
public List<JSONObject> getUpdateJSON() {
|
|
public List<JSONObject> getUpdateJSON() {
|
|
|
- if (results.isEmpty())compute();
|
|
|
|
|
|
|
+ if (results.isEmpty()) compute();
|
|
|
List<JSONObject> updateJSON = new ArrayList<>();
|
|
List<JSONObject> updateJSON = new ArrayList<>();
|
|
|
- for (Result result : results){
|
|
|
|
|
|
|
+ for (Result result : results) {
|
|
|
String sourceCQyfx = result.enterprise.getCQyfx();
|
|
String sourceCQyfx = result.enterprise.getCQyfx();
|
|
|
- Set<HealthItem> sourceHealth = HealthItem.fromDmsData(sourceCQyfx);
|
|
|
|
|
|
|
+ Set<HealthItem> sourceHealth = HealthItem.fromDmsData(sourceCQyfx);
|
|
|
Set<HealthItem> targetHealth = result.healthItems;
|
|
Set<HealthItem> targetHealth = result.healthItems;
|
|
|
- if (!sourceHealth.equals(targetHealth)){
|
|
|
|
|
|
|
+ if (!sourceHealth.equals(targetHealth)) {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("id", result.enterprise.getId());
|
|
jsonObject.put("id", result.enterprise.getId());
|
|
|
- jsonObject.put("cQyfx", HealthItem.toDmsData(targetHealth));
|
|
|
|
|
|
|
+ jsonObject.put("c_qyfx", HealthItem.toDmsData(targetHealth));
|
|
|
updateJSON.add(jsonObject);
|
|
updateJSON.add(jsonObject);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -169,7 +170,7 @@ public class EnterpriseHealthComputerV2 {
|
|
|
//租约过期或即将过期(30天)
|
|
//租约过期或即将过期(30天)
|
|
|
if (endTimes.values()
|
|
if (endTimes.values()
|
|
|
.stream()
|
|
.stream()
|
|
|
- .anyMatch(endTime -> endTime.isBefore(LocalDate.now().minusDays(30)))
|
|
|
|
|
|
|
+ .anyMatch(endTime -> endTime.isBefore(LocalDate.now().plusDays(30)))
|
|
|
) {
|
|
) {
|
|
|
healthItems.add(HealthItem.ORANGE_MEDIUM_RISK_LEASE_EXPIRED);
|
|
healthItems.add(HealthItem.ORANGE_MEDIUM_RISK_LEASE_EXPIRED);
|
|
|
}
|
|
}
|
|
@@ -185,42 +186,50 @@ public class EnterpriseHealthComputerV2 {
|
|
|
try {
|
|
try {
|
|
|
lawsuit = JSONObject.parseObject(lawsuitStr);
|
|
lawsuit = JSONObject.parseObject(lawsuitStr);
|
|
|
try {
|
|
try {
|
|
|
- JSONArray justiciaryCases = lawsuit.getJSONObject("司法案件").getJSONArray("table");
|
|
|
|
|
- List<JSONObject> justiciaryCaseList = new ArrayList<>();
|
|
|
|
|
- for (int i = 0; i < justiciaryCases.size(); i++) {
|
|
|
|
|
- JSONObject justiciaryCase = justiciaryCases.getJSONObject(i);
|
|
|
|
|
- justiciaryCaseList.add(justiciaryCase);
|
|
|
|
|
- }
|
|
|
|
|
- List<JSONObject> passiveCases = justiciaryCaseList.stream()
|
|
|
|
|
- .filter(justiciaryCase -> Optional.ofNullable(justiciaryCase.getString("案件身份")).orElse("").contains("被告"))
|
|
|
|
|
- .collect(Collectors.toList());
|
|
|
|
|
- List<JSONObject> passiveCaseCountLastYear = passiveCases.stream()
|
|
|
|
|
- .filter(passiveCase -> {
|
|
|
|
|
- String date = passiveCase.getString("进程日期");
|
|
|
|
|
- if (date != null && date.length() >= 10) {
|
|
|
|
|
- LocalDate processDate = LocalDate.parse(date.substring(0, 10));
|
|
|
|
|
- return processDate.isAfter(LocalDate.now().minusYears(1));
|
|
|
|
|
- } else {
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
- }).collect(Collectors.toList());
|
|
|
|
|
- double maxAmount = passiveCaseCountLastYear.stream()
|
|
|
|
|
- .mapToDouble(passiveCase -> parseAmount(passiveCase.getString("案件金额(元)")))
|
|
|
|
|
- .max().orElse(0);
|
|
|
|
|
- if (maxAmount > 2000000) {
|
|
|
|
|
- healthItems.add(HealthItem.RED_HIGH_RISK_LARGE_LAWSUIT);
|
|
|
|
|
- } else if (maxAmount > 500000) {
|
|
|
|
|
- healthItems.add(HealthItem.ORANGE_MEDIUM_RISK_MIDDLE_LAWSUIT);
|
|
|
|
|
- } else {
|
|
|
|
|
- healthItems.add(HealthItem.YELLOW_GENERAL_RISK_SMALL_LAWSUIT);
|
|
|
|
|
|
|
+ JSONObject judicialCaseObj = lawsuit.getJSONObject("司法案件");
|
|
|
|
|
+ if (judicialCaseObj != null) {
|
|
|
|
|
+ JSONArray justiciaryCases = judicialCaseObj.getJSONArray("table");
|
|
|
|
|
+ if (justiciaryCases != null && !justiciaryCases.isEmpty()) {
|
|
|
|
|
+ List<JSONObject> justiciaryCaseList = new ArrayList<>();
|
|
|
|
|
+ for (int i = 0; i < justiciaryCases.size(); i++) {
|
|
|
|
|
+ JSONObject justiciaryCase = justiciaryCases.getJSONObject(i);
|
|
|
|
|
+ justiciaryCaseList.add(justiciaryCase);
|
|
|
|
|
+ }
|
|
|
|
|
+ List<JSONObject> passiveCases = justiciaryCaseList.stream()
|
|
|
|
|
+ .filter(justiciaryCase -> Optional.ofNullable(justiciaryCase.getString("案件身份")).orElse("").contains("被告"))
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+ List<JSONObject> passiveCaseCountLastYear = passiveCases.stream()
|
|
|
|
|
+ .filter(passiveCase -> {
|
|
|
|
|
+ String date = passiveCase.getString("进程日期");
|
|
|
|
|
+ if (date != null && date.length() >= 10) {
|
|
|
|
|
+ LocalDate processDate = LocalDate.parse(date.substring(0, 10));
|
|
|
|
|
+ return processDate.isAfter(LocalDate.now().minusYears(1));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
|
+ double maxAmount = passiveCaseCountLastYear.stream()
|
|
|
|
|
+ .mapToDouble(passiveCase -> parseAmount(passiveCase.getString("案件金额(元)")))
|
|
|
|
|
+ .max().orElse(0);
|
|
|
|
|
+ if (maxAmount > 2000000) {
|
|
|
|
|
+ healthItems.add(HealthItem.RED_HIGH_RISK_LARGE_LAWSUIT);
|
|
|
|
|
+ } else if (maxAmount > 500000) {
|
|
|
|
|
+ healthItems.add(HealthItem.ORANGE_MEDIUM_RISK_MIDDLE_LAWSUIT);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ healthItems.add(HealthItem.YELLOW_GENERAL_RISK_SMALL_LAWSUIT);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
} catch (JSONException ignore) {
|
|
} catch (JSONException ignore) {
|
|
|
}
|
|
}
|
|
|
//股权冻结
|
|
//股权冻结
|
|
|
try {
|
|
try {
|
|
|
- JSONArray equityFreeze = lawsuit.getJSONObject("股权冻结").getJSONArray("table");
|
|
|
|
|
- if (!equityFreeze.isEmpty()) {
|
|
|
|
|
- healthItems.add(HealthItem.ORANGE_MEDIUM_RISK_EQUITY_FREEZE);
|
|
|
|
|
|
|
+ JSONObject equityFreezeObj = lawsuit.getJSONObject("股权冻结");
|
|
|
|
|
+ if (equityFreezeObj != null) {
|
|
|
|
|
+ JSONArray equityFreeze = equityFreezeObj.getJSONArray("table");
|
|
|
|
|
+ if (equityFreeze != null && !equityFreeze.isEmpty()) {
|
|
|
|
|
+ healthItems.add(HealthItem.ORANGE_MEDIUM_RISK_EQUITY_FREEZE);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
} catch (JSONException ignore) {
|
|
} catch (JSONException ignore) {
|
|
|
|
|
|
|
@@ -238,15 +247,20 @@ public class EnterpriseHealthComputerV2 {
|
|
|
JSONObject operationalRisk = JSONObject.parseObject(operationalRiskStr);
|
|
JSONObject operationalRisk = JSONObject.parseObject(operationalRiskStr);
|
|
|
try {
|
|
try {
|
|
|
//股权质押
|
|
//股权质押
|
|
|
- JSONArray stockFreeze = operationalRisk.getJSONObject("司法案件").getJSONArray("table");
|
|
|
|
|
- double stockFreezeAmount = 0;
|
|
|
|
|
- for (int i = 0; i < stockFreeze.size(); i++) {
|
|
|
|
|
- JSONObject stockFreezeItem = stockFreeze.getJSONObject(i);
|
|
|
|
|
- String amountStr = stockFreezeItem.getString("质押股份市值(元)");
|
|
|
|
|
- stockFreezeAmount += parseMonetaryValue(amountStr);
|
|
|
|
|
- }
|
|
|
|
|
- if (stockFreezeAmount >= 30000000){
|
|
|
|
|
- healthItems.add(HealthItem.ORANGE_MEDIUM_RISK_EQUITY_FREEZE);
|
|
|
|
|
|
|
+ JSONObject judicialCaseObj = operationalRisk.getJSONObject("司法案件");
|
|
|
|
|
+ if (judicialCaseObj != null) {
|
|
|
|
|
+ JSONArray stockFreeze = judicialCaseObj.getJSONArray("table");
|
|
|
|
|
+ if (stockFreeze != null && !stockFreeze.isEmpty()) {
|
|
|
|
|
+ double stockFreezeAmount = 0;
|
|
|
|
|
+ for (int i = 0; i < stockFreeze.size(); i++) {
|
|
|
|
|
+ JSONObject stockFreezeItem = stockFreeze.getJSONObject(i);
|
|
|
|
|
+ String amountStr = stockFreezeItem.getString("质押股份市值(元)");
|
|
|
|
|
+ stockFreezeAmount += parseMonetaryValue(amountStr);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (stockFreezeAmount >= 30000000) {
|
|
|
|
|
+ healthItems.add(HealthItem.ORANGE_MEDIUM_RISK_EQUITY_FREEZE);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (JSONException ignore) {
|
|
} catch (JSONException ignore) {
|