合规风险
This commit is contained in:
File diff suppressed because one or more lines are too long
@ -0,0 +1,111 @@
|
|||||||
|
package com.chinaunicom.mall.ebtp.extend.rm.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
||||||
|
import com.chinaunicom.mall.ebtp.extend.rm.client.RmClient;
|
||||||
|
import com.chinaunicom.mall.ebtp.extend.rm.entity.RmBaseResponseDTO;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@Api(tags = "合规风险系统接口")
|
||||||
|
@RequestMapping("/rm/api")
|
||||||
|
@Slf4j
|
||||||
|
public class RmController {
|
||||||
|
|
||||||
|
@Value("${spring.rm.username}")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
@Value("${spring.rm.password}")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RmClient rmClient;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合规风险系统精确查询
|
||||||
|
* @param search 查询条件
|
||||||
|
* @return 合规风险系统响应数据
|
||||||
|
*/
|
||||||
|
@GetMapping("/queryRiskInfo")
|
||||||
|
public BaseResponse<List<RmBaseResponseDTO.DataItem>> queryRiskInfo(@RequestParam("search") String search){
|
||||||
|
// public BaseResponse<IPage<RmBaseResponseDTO.DataItem>> queryRiskInfo(@RequestParam("search") String search){
|
||||||
|
RmBaseResponseDTO rmBaseResponseDTO = rmClient.queryRiskInfo(search, username, password);
|
||||||
|
// IPage<RmBaseResponseDTO.DataItem> page = new Page<>(1, 10);
|
||||||
|
// page.setRecords(rmBaseResponseDTO.getData());
|
||||||
|
// page.setTotal(rmBaseResponseDTO.getDatasize());
|
||||||
|
return BaseResponse.success(rmBaseResponseDTO.getData());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合规风险系统精确查询详细
|
||||||
|
* @param search 查询条件
|
||||||
|
* @return 合规风险系统响应数据
|
||||||
|
*/
|
||||||
|
@GetMapping("/queryRiskInfoDetails")
|
||||||
|
public BaseResponse<List<RmBaseResponseDTO.DataItem>> queryRiskInfoDetails(@RequestParam("search") String search){
|
||||||
|
// public BaseResponse<IPage<RmBaseResponseDTO.DataItem>> queryRiskInfoDetails(@RequestParam("search") String search){
|
||||||
|
RmBaseResponseDTO rmBaseResponseDTO = rmClient.queryAllRiskInfo(search, username, password);
|
||||||
|
// IPage<RmBaseResponseDTO.DataItem> page = new Page<>(1, 10);
|
||||||
|
// page.setRecords(rmBaseResponseDTO.getData());
|
||||||
|
// page.setTotal(rmBaseResponseDTO.getDatasize());
|
||||||
|
return BaseResponse.success(rmBaseResponseDTO.getData());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 风险系统判断逻辑
|
||||||
|
*/
|
||||||
|
@GetMapping("/riskLevel")
|
||||||
|
public String riskLevel(RmBaseResponseDTO dto) {
|
||||||
|
if (dto == null || dto.getDatasize() == 0 || dto.getData() == null || dto.getData().isEmpty()) {
|
||||||
|
return "无风险";
|
||||||
|
}
|
||||||
|
for (RmBaseResponseDTO.DataItem item : dto.getData()) {
|
||||||
|
String activestatus = item.getActivestatus();
|
||||||
|
if (activestatus == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ("Inactive".equalsIgnoreCase(activestatus)) {
|
||||||
|
return "低风险";
|
||||||
|
}
|
||||||
|
if ("Active".equalsIgnoreCase(activestatus)) {
|
||||||
|
String d1 = item.getD1();
|
||||||
|
List<String> d2 = item.getD2();
|
||||||
|
List<String> d3 = item.getD3();
|
||||||
|
// d1存在才继续判断
|
||||||
|
if (d1 != null && !d1.isEmpty()) {
|
||||||
|
if (d2 != null && !d2.isEmpty()) {
|
||||||
|
if (d2.contains("Other Official Lists")) {
|
||||||
|
return "中风险";
|
||||||
|
}
|
||||||
|
if (d2.contains("Sanctions Lists") || d2.contains("Sanctions Control and Ownership")) {
|
||||||
|
return "高风险";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (d3 != null && !d3.isEmpty()) {
|
||||||
|
if (d3.contains("Attention")) {
|
||||||
|
return "中风险";
|
||||||
|
}
|
||||||
|
if (d3.contains("Prohibited transactions and interactions")
|
||||||
|
|| d3.contains("Prohibition")
|
||||||
|
|| d3.contains("Prohibited transactions and cooperation")) {
|
||||||
|
return "高风险";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "无风险";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,159 @@
|
|||||||
|
package com.chinaunicom.mall.ebtp.extend.rm.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*{"code":200,"message":"成功","datasize":3,"data":[{"hit":"11111","hitlight":"11111","similar":100,"hittype":"OFAC Unique ID","activestatus":"Inactive","d1":"Special Interest Entity (SIE)","d2":["Sanctions Lists"],"d3":["Ship"],"countries":["Iran"],"docid":"1016852","systemdate":"2025-02-26 14:31:24.201","nameDetails":{"name":[{"nameType":"Primary Name","nameValue":[{"entityName":["Iran Mahallati"],"firstName":[],"maidenName":[],"middleName":[],"originalScriptName":[],"singleStringName":[],"suffix":[],"surname":[],"titleHonorific":[]}]}]},"idNumberTypes":{"ID":[{"IDType":"OFAC Program ID","IDValue":[{"value":"NPWMD"}]},{"IDType":"OFAC Unique ID","IDValue":[{"value":"11111"}]},{"IDType":"International Maritime Organization (IMO) Ship No.","IDValue":[{"IDnotes":"Vessel Registration Identification","value":"7428823"}]}]},"sanctionsReferences":{"reference":[{"sinceDay":"10","sinceMonth":"Sep","sinceYear":"2008","toDay":"31","toMonth":"Mar","toYear":"2011","value":14}]}},{"hit":"11111","hitlight":"11111","similar":100,"hittype":"HM Treasury Group ID","activestatus":"Inactive","d1":"Politically Exposed Person (PEP)","d2":["Sanctions Lists"],"d3":[],"countries":["Myanmar"],"docid":"1356752","systemdate":"2025-02-26 14:31:24.201","nameDetails":{"name":[{"nameType":"Primary Name","nameValue":[{"entityName":[],"firstName":["Soe"],"maidenName":[],"middleName":[],"originalScriptName":["စိုးမင်း"],"singleStringName":["Soe Min"],"suffix":[],"surname":["Min"],"titleHonorific":[]}]}]},"idNumberTypes":{"ID":[{"IDType":"National ID","IDValue":[{"value":"12/BaTaHta (N) 021423"}]},{"IDType":"EU Sanctions Programme Indicator","IDValue":[{"value":"MMR"}]},{"IDType":"EU Consolidated Electronic List ID","IDValue":[{"value":"5633"}]},{"IDType":"HM Treasury Group ID","IDValue":[{"value":"11111"}]}]},"sanctionsReferences":{"reference":[{"sinceDay":"14","sinceMonth":"May","sinceYear":"2010","toDay":"16","toMonth":"May","toYear":"2012","value":275},{"sinceDay":"03","sinceMonth":"Dec","sinceYear":"2010","toDay":"10","toMonth":"May","toYear":"2012","value":299},{"sinceDay":"18","sinceMonth":"May","sinceYear":"2010","toDay":"14","toMonth":"May","toYear":"2012","value":507},{"sinceDay":"17","sinceMonth":"Jun","sinceYear":"2010","toDay":"08","toMonth":"Jun","toYear":"2012","value":1326},{"sinceDay":"26","sinceMonth":"Apr","sinceYear":"2010","toDay":"12","toMonth":"Apr","toYear":"2011","value":1440},{"sinceDay":"10","sinceMonth":"May","sinceYear":"2010","toDay":"18","toMonth":"Apr","toYear":"2011","value":1446},{"sinceDay":"12","sinceMonth":"Apr","sinceYear":"2011","toDay":"16","toMonth":"Aug","toYear":"2011","value":1694},{"sinceDay":"18","sinceMonth":"Apr","sinceYear":"2011","toDay":"01","toMonth":"Sep","toYear":"2011","value":1696},{"sinceDay":"16","sinceMonth":"Aug","sinceYear":"2011","toDay":"26","toMonth":"Apr","toYear":"2012","value":1802},{"sinceDay":"01","sinceMonth":"Sep","sinceYear":"2011","toDay":"14","toMonth":"May","toYear":"2012","value":1816}]}},{"hit":"11111","hitlight":"11111","similar":100,"hittype":"NSDC Unique ID","activestatus":"Inactive","d1":"Politically Exposed Person (PEP)","d2":["Sanctions Lists"],"d3":[],"countries":["Russia"],"docid":"1659749","systemdate":"2025-04-04 12:10:11.458","nameDetails":{"name":[{"nameType":"Primary Name","nameValue":[{"entityName":[],"firstName":["Vladimir"],"maidenName":[],"middleName":["Leonidovich"],"originalScriptName":["Владимир Леонидович Шемякин"],"singleStringName":[],"suffix":[],"surname":["Shemyakin"],"titleHonorific":[]}]},{"nameType":"Also Known As","nameValue":[{"entityName":[],"firstName":["Volodymyr"],"maidenName":[],"middleName":["Leonidovych"],"originalScriptName":["Володимир Леонідович Шемякін"],"singleStringName":[],"suffix":[],"surname":["Shemyakin"],"titleHonorific":[]},{"entityName":[],"firstName":["Volodymyr"],"maidenName":[],"middleName":[],"originalScriptName":[],"singleStringName":[],"suffix":[],"surname":["Shemiakin"],"titleHonorific":[]}]},{"nameType":"Spelling Variation","nameValue":[{"entityName":[],"firstName":["Vladimir"],"maidenName":[],"middleName":["Leonidovich"],"originalScriptName":[],"singleStringName":[],"suffix":[],"surname":["Shemiakin"],"titleHonorific":[]},{"entityName":[],"firstName":["Volodymyr"],"maidenName":[],"middleName":["Leonidovych"],"originalScriptName":[],"singleStringName":[],"suffix":[],"surname":["Shemiakin"],"titleHonorific":[]}]}]},"idNumberTypes":{"ID":[{"IDType":"Others","IDValue":[{"value":"1045207050712"}]},{"IDType":"National Tax No.","IDValue":[{"value":"5256050056"},{"value":"710600916016"}]},{"IDType":"NSDC Unique ID","IDValue":[{"value":"11111"}]}]},"sanctionsReferences":{"reference":[{"sinceDay":"17","sinceMonth":"Oct","sinceYear":"2016","toDay":"15","toMonth":"May","toYear":"2017","value":2966},{"sinceDay":"15","sinceMonth":"May","sinceYear":"2017","toDay":"24","toMonth":"Jun","toYear":"2024","value":4114}]}}]}
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class RmBaseResponseDTO {
|
||||||
|
private int code;
|
||||||
|
private String message;
|
||||||
|
private int datasize;
|
||||||
|
private List<DataItem> data;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class DataItem {
|
||||||
|
private String hit;
|
||||||
|
private String hitlight;
|
||||||
|
private int similar;
|
||||||
|
private String hittype;
|
||||||
|
private String activestatus;
|
||||||
|
private String d1;
|
||||||
|
private List<String> d2;
|
||||||
|
private List<String> d3;
|
||||||
|
private List<String> countries;
|
||||||
|
private String docid;
|
||||||
|
private String systemdate;
|
||||||
|
private NameDetails nameDetails;
|
||||||
|
private IdNumberTypes idNumberTypes;
|
||||||
|
private SanctionsReferences sanctionsReferences;
|
||||||
|
|
||||||
|
// 精确查询 - details字段
|
||||||
|
private Details details;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class NameDetails {
|
||||||
|
private List<Name> name;
|
||||||
|
@Data
|
||||||
|
public static class Name {
|
||||||
|
private String nameType;
|
||||||
|
private List<NameValue> nameValue;
|
||||||
|
@Data
|
||||||
|
public static class NameValue {
|
||||||
|
private List<String> entityName;
|
||||||
|
private List<String> firstName;
|
||||||
|
private List<String> maidenName;
|
||||||
|
private List<String> middleName;
|
||||||
|
private List<String> originalScriptName;
|
||||||
|
private List<String> singleStringName;
|
||||||
|
private List<String> suffix;
|
||||||
|
private List<String> surname;
|
||||||
|
private List<String> titleHonorific;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class IdNumberTypes {
|
||||||
|
private List<ID> ID;
|
||||||
|
@Data
|
||||||
|
public static class ID {
|
||||||
|
private String IDType;
|
||||||
|
private List<IDValue> IDValue;
|
||||||
|
@Data
|
||||||
|
public static class IDValue {
|
||||||
|
private String value;
|
||||||
|
private String IDnotes; // 可选
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class SanctionsReferences {
|
||||||
|
private List<Reference> reference;
|
||||||
|
@Data
|
||||||
|
public static class Reference {
|
||||||
|
private String sinceDay;
|
||||||
|
private String sinceMonth;
|
||||||
|
private String sinceYear;
|
||||||
|
private String toDay;
|
||||||
|
private String toMonth;
|
||||||
|
private String toYear;
|
||||||
|
private int value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
// 新增 details 对象
|
||||||
|
public static class Details {
|
||||||
|
private String date;
|
||||||
|
private String gender;
|
||||||
|
private String deceased;
|
||||||
|
private Descriptions descriptions;
|
||||||
|
private Map<String, List<String>> nameDetails; // 如 "Primary Name": [...]
|
||||||
|
private Map<String, List<String>> idNumberTypes; // 如 "OFAC Unique ID": [...]
|
||||||
|
private Map<String, List<String>> dateDetails; // 如 "Inactive as of (PEP)": [...]
|
||||||
|
private List<String> birthPlace;
|
||||||
|
private SanctionsReferencesMap sanctionsReferences;
|
||||||
|
private Map<String, List<String>> countryDetails; // 如 "Resident of": [...]
|
||||||
|
private String profileNotes;
|
||||||
|
private List<String> sourceDescription;
|
||||||
|
private List<String> images;
|
||||||
|
private List<Associate> associate;
|
||||||
|
private List<CompanyDetails> companyDetails;
|
||||||
|
private List<VesselDetails> vesselDetails;
|
||||||
|
@Data
|
||||||
|
public static class Descriptions {
|
||||||
|
private List<Description> description;
|
||||||
|
@Data
|
||||||
|
public static class Description {
|
||||||
|
private String description1;
|
||||||
|
private String description2;
|
||||||
|
private String description3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class SanctionsReferencesMap {
|
||||||
|
// 如 "Sanctions Lists": [{"date":"...","value":"..."}]
|
||||||
|
private Map<String, List<SanctionReference>> sanctionsLists;
|
||||||
|
@Data
|
||||||
|
public static class SanctionReference {
|
||||||
|
private String date;
|
||||||
|
private String value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class Associate {
|
||||||
|
private String activestatus;
|
||||||
|
private String d1;
|
||||||
|
private String d2;
|
||||||
|
private String docid;
|
||||||
|
private String ex;
|
||||||
|
private String primaryName;
|
||||||
|
private List<String> primaryNameOriginalScriptName;
|
||||||
|
private String relationship;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class CompanyDetails {
|
||||||
|
private String companyDetails;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class VesselDetails {
|
||||||
|
private String vesselFlag;
|
||||||
|
private String vesselGRT;
|
||||||
|
private String vesselOwner;
|
||||||
|
private String vesselTonnage;
|
||||||
|
private String vesselType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user