|
|
|
@ -8,6 +8,7 @@ import com.biutag.supervisiondata.common.interfaces.CompletableFutureUtil; |
|
|
|
import com.biutag.supervisiondata.common.response.RS; |
|
|
|
import com.biutag.supervisiondata.common.response.RS; |
|
|
|
import com.biutag.supervisiondata.config.cache.RedisDao; |
|
|
|
import com.biutag.supervisiondata.config.cache.RedisDao; |
|
|
|
import com.biutag.supervisiondata.lock.LocalLock; |
|
|
|
import com.biutag.supervisiondata.lock.LocalLock; |
|
|
|
|
|
|
|
import com.biutag.supervisiondata.pojo.constants.Prompt; |
|
|
|
import com.biutag.supervisiondata.pojo.entity.ads.GBaseSYRKXX; |
|
|
|
import com.biutag.supervisiondata.pojo.entity.ads.GBaseSYRKXX; |
|
|
|
import com.biutag.supervisiondata.pojo.entity.dwd.GBaseJJD; |
|
|
|
import com.biutag.supervisiondata.pojo.entity.dwd.GBaseJJD; |
|
|
|
import com.biutag.supervisiondata.pojo.entity.wdpc.WdpcJJDAi; |
|
|
|
import com.biutag.supervisiondata.pojo.entity.wdpc.WdpcJJDAi; |
|
|
|
@ -49,7 +50,6 @@ public class ApiController { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
riskScoreRuleService.runScore(List.of(idCodes.split(","))); |
|
|
|
riskScoreRuleService.runScore(List.of(idCodes.split(","))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("", e); |
|
|
|
log.error("", e); |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
@ -61,7 +61,20 @@ public class ApiController { |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/get/jjd") |
|
|
|
@GetMapping("/get/jjd") |
|
|
|
public String getJJD() { |
|
|
|
public String getJJD() { |
|
|
|
return (String) RedisDao.getInstance().leftPop("jjd"); |
|
|
|
String data = (String) RedisDao.getInstance().leftPop("jjd"); |
|
|
|
|
|
|
|
if(data == null) { |
|
|
|
|
|
|
|
return ""; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
JSONObject obj = JSON.parseObject(data); |
|
|
|
|
|
|
|
List<String> mobiles = obj.getList("mobiles", String.class); |
|
|
|
|
|
|
|
List<String> idCodes = obj.getList("idCodes", String.class); |
|
|
|
|
|
|
|
return String.format(Prompt.CONTENT, obj.getString("name"), |
|
|
|
|
|
|
|
obj.getString("idCode"), |
|
|
|
|
|
|
|
obj.getString("mobile"), |
|
|
|
|
|
|
|
String.join(",", mobiles), |
|
|
|
|
|
|
|
String.join(",", idCodes), |
|
|
|
|
|
|
|
obj.getString("bjnr"), |
|
|
|
|
|
|
|
obj.getString("cjqk")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private final GBaseSYRKXXRepository repository; |
|
|
|
private final GBaseSYRKXXRepository repository; |
|
|
|
@ -78,12 +91,13 @@ public class ApiController { |
|
|
|
GBaseJJD jjd = JSON.parseObject(str, GBaseJJD.class); |
|
|
|
GBaseJJD jjd = JSON.parseObject(str, GBaseJJD.class); |
|
|
|
|
|
|
|
|
|
|
|
String res = data.getString("content"); |
|
|
|
String res = data.getString("content"); |
|
|
|
res = res.replaceFirst("```json","").replaceAll("```", ""); |
|
|
|
res = res.replaceFirst("```json","").replaceAll("```", "").replaceAll("\n",""); |
|
|
|
JSONObject jb = JSON.parseObject(res); |
|
|
|
JSONObject jb = JSON.parseObject(res); |
|
|
|
JSONArray array = jb.getJSONArray("information"); |
|
|
|
JSONArray array = jb.getJSONArray("informations"); |
|
|
|
if(array.isEmpty()) { |
|
|
|
if(array.isEmpty()) { |
|
|
|
return ""; |
|
|
|
return ""; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
log.info("{}", array); |
|
|
|
List<WdpcJJDAi> aiList = new ArrayList<>(); |
|
|
|
List<WdpcJJDAi> aiList = new ArrayList<>(); |
|
|
|
Map<String, Integer> group = new WeakHashMap<>(); |
|
|
|
Map<String, Integer> group = new WeakHashMap<>(); |
|
|
|
List<String> idCodes = new ArrayList<>(); |
|
|
|
List<String> idCodes = new ArrayList<>(); |
|
|
|
@ -91,9 +105,10 @@ public class ApiController { |
|
|
|
for (int i = 0; i < array.size(); i++) { |
|
|
|
for (int i = 0; i < array.size(); i++) { |
|
|
|
WdpcJJDAi ai = new WdpcJJDAi(); |
|
|
|
WdpcJJDAi ai = new WdpcJJDAi(); |
|
|
|
JSONObject obj = array.getJSONObject(i); |
|
|
|
JSONObject obj = array.getJSONObject(i); |
|
|
|
|
|
|
|
log.info("对象:{}", obj); |
|
|
|
ai.setBjsj(jjd.getBjsj()); |
|
|
|
ai.setBjsj(jjd.getBjsj()); |
|
|
|
ai.setJjdbh(ai.getJjdbh()); |
|
|
|
ai.setJjdbh(jjd.getJjdbh()); |
|
|
|
ai.setGroup(Optional.of(group.get(obj.getString("group"))).orElse(group.size())); |
|
|
|
ai.setGroup(Optional.ofNullable(group.get(obj.getString("group"))).orElse(group.size())); |
|
|
|
group.put(obj.getString("group"), group.size()); |
|
|
|
group.put(obj.getString("group"), group.size()); |
|
|
|
ai.setMobile(Optional.ofNullable(obj.getString("mobile")).orElse("")); |
|
|
|
ai.setMobile(Optional.ofNullable(obj.getString("mobile")).orElse("")); |
|
|
|
ai.setName(Optional.ofNullable(obj.getString("name")).orElse("")); |
|
|
|
ai.setName(Optional.ofNullable(obj.getString("name")).orElse("")); |
|
|
|
@ -107,49 +122,49 @@ public class ApiController { |
|
|
|
} |
|
|
|
} |
|
|
|
aiList.add(ai); |
|
|
|
aiList.add(ai); |
|
|
|
} |
|
|
|
} |
|
|
|
LambdaQueryWrapper<GBaseSYRKXX> wrapper = new LambdaQueryWrapper<GBaseSYRKXX>(); |
|
|
|
// LambdaQueryWrapper<GBaseSYRKXX> wrapper = new LambdaQueryWrapper<GBaseSYRKXX>();
|
|
|
|
if(!idCodes.isEmpty()) { |
|
|
|
// if(!idCodes.isEmpty()) {
|
|
|
|
wrapper.in(GBaseSYRKXX::getGmsfhm, idCodes); |
|
|
|
// wrapper.in(GBaseSYRKXX::getGmsfhm, idCodes);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
if(!idCodes.isEmpty() && !mobiles.isEmpty()) { |
|
|
|
// if(!idCodes.isEmpty() && !mobiles.isEmpty()) {
|
|
|
|
wrapper.or().in(GBaseSYRKXX::getLxdh, mobiles); |
|
|
|
// wrapper.or().in(GBaseSYRKXX::getLxdh, mobiles);
|
|
|
|
} else if(!mobiles.isEmpty()) { |
|
|
|
// } else if(!mobiles.isEmpty()) {
|
|
|
|
wrapper.in(GBaseSYRKXX::getLxdh, mobiles); |
|
|
|
// wrapper.in(GBaseSYRKXX::getLxdh, mobiles);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
List<GBaseSYRKXX> xxList = repository.list(wrapper); |
|
|
|
// List<GBaseSYRKXX> xxList = repository.list(wrapper);
|
|
|
|
Map<String, GBaseSYRKXX> xxMap = new WeakHashMap<>(); |
|
|
|
// Map<String, GBaseSYRKXX> xxMap = new WeakHashMap<>();
|
|
|
|
Map<String, List<GBaseSYRKXX>> xxMMap = new WeakHashMap<>(); |
|
|
|
// Map<String, List<GBaseSYRKXX>> xxMMap = new WeakHashMap<>();
|
|
|
|
for (GBaseSYRKXX syrkxx : xxList) { |
|
|
|
// for (GBaseSYRKXX syrkxx : xxList) {
|
|
|
|
xxMap.put(syrkxx.getGmsfhm(), syrkxx); |
|
|
|
// xxMap.put(syrkxx.getGmsfhm(), syrkxx);
|
|
|
|
xxMMap.computeIfAbsent(syrkxx.getLxdh(), k -> new ArrayList<>()).add(syrkxx); |
|
|
|
// xxMMap.computeIfAbsent(syrkxx.getLxdh(), k -> new ArrayList<>()).add(syrkxx);
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
for (WdpcJJDAi ai : aiList) { |
|
|
|
// for (WdpcJJDAi ai : aiList) {
|
|
|
|
GBaseSYRKXX xx = xxMap.get(ai.getIdCode()); |
|
|
|
// GBaseSYRKXX xx = xxMap.get(ai.getIdCode());
|
|
|
|
if(xx != null) { |
|
|
|
// if(xx != null) {
|
|
|
|
ai.setSyrkMobile(xx.getLxdh()); |
|
|
|
// ai.setSyrkMobile(Optional.ofNullable(xx.getLxdh()).orElse(""));
|
|
|
|
ai.setSyrkName(Optional.ofNullable(xx.getXm()).orElse("")); |
|
|
|
// ai.setSyrkName(Optional.ofNullable(xx.getXm()).orElse(""));
|
|
|
|
ai.setSyrkIdCode(Optional.ofNullable(xx.getGmsfhm()).orElse("")); |
|
|
|
// ai.setSyrkIdCode(Optional.ofNullable(xx.getGmsfhm()).orElse(""));
|
|
|
|
continue; |
|
|
|
// continue;
|
|
|
|
} |
|
|
|
// }
|
|
|
|
List<GBaseSYRKXX> tmp = xxMMap.get(ai.getMobile()); |
|
|
|
// List<GBaseSYRKXX> tmp = xxMMap.get(ai.getMobile());
|
|
|
|
if(tmp == null || tmp.isEmpty()) { |
|
|
|
// if(tmp == null || tmp.isEmpty()) {
|
|
|
|
continue; |
|
|
|
// continue;
|
|
|
|
} |
|
|
|
// }
|
|
|
|
for (GBaseSYRKXX syrkxx : tmp) { |
|
|
|
// for (GBaseSYRKXX syrkxx : tmp) {
|
|
|
|
if(xx == null) { |
|
|
|
// if(xx == null) {
|
|
|
|
xx = syrkxx; |
|
|
|
// xx = syrkxx;
|
|
|
|
continue; |
|
|
|
// continue;
|
|
|
|
} |
|
|
|
// }
|
|
|
|
if(syrkxx.getXm().equals(ai.getName())) { |
|
|
|
// if(syrkxx.getXm().equals(ai.getName())) {
|
|
|
|
xx = syrkxx; |
|
|
|
// xx = syrkxx;
|
|
|
|
break; |
|
|
|
// break;
|
|
|
|
} |
|
|
|
// }
|
|
|
|
} |
|
|
|
// }
|
|
|
|
ai.setSyrkMobile(xx.getLxdh()); |
|
|
|
// ai.setSyrkMobile(Optional.ofNullable(xx.getLxdh()).orElse(""));
|
|
|
|
ai.setSyrkName(Optional.ofNullable(xx.getXm()).orElse("")); |
|
|
|
// ai.setSyrkName(Optional.ofNullable(xx.getXm()).orElse(""));
|
|
|
|
ai.setSyrkIdCode(Optional.ofNullable(xx.getGmsfhm()).orElse("")); |
|
|
|
// ai.setSyrkIdCode(Optional.ofNullable(xx.getGmsfhm()).orElse(""));
|
|
|
|
} |
|
|
|
// }
|
|
|
|
if(!aiList.isEmpty()) { |
|
|
|
if(!aiList.isEmpty()) { |
|
|
|
aiRepository.saveBatch(aiList); |
|
|
|
aiRepository.saveBatch(aiList); |
|
|
|
} |
|
|
|
} |
|
|
|
|