You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
143 lines
7.6 KiB
Java
143 lines
7.6 KiB
Java
1 year ago
|
package com.weaver.seconddev.sxjg.util;
|
||
|
|
||
|
|
||
|
import cn.hutool.json.JSONArray;
|
||
|
import cn.hutool.json.JSONObject;
|
||
|
import cn.hutool.json.JSONUtil;
|
||
|
import org.slf4j.Logger;
|
||
|
import org.slf4j.LoggerFactory;
|
||
|
import org.springframework.stereotype.Component;
|
||
|
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.List;
|
||
|
import java.util.Map;
|
||
|
|
||
|
|
||
|
|
||
|
@Component
|
||
|
public class PersondataQueryUtil {
|
||
|
|
||
|
private final Logger log = LoggerFactory.getLogger(PersondataQueryUtil.class);
|
||
|
|
||
|
public String queryNccloudPersondata(String body){
|
||
|
|
||
|
NccApiUtil nccApiUtil = new NccApiUtil();
|
||
|
JSONObject resJsonObject = new JSONObject();
|
||
|
try{
|
||
|
JSONObject r3 = JSONUtil.parseObj(body);
|
||
|
nccApiUtil.init();
|
||
|
String token = nccApiUtil.getToken();
|
||
|
log.error("nccApiUtil-token:"+token);
|
||
|
|
||
|
String url = nccApiUtil.getBaseUrl()+"nccloud/api/hrtrn/openAPI/persondata/query";
|
||
|
String rs11 = nccApiUtil.doJsonPost(url,token,r3.toString());
|
||
|
log.error("nccApiUtil-rs11:"+rs11);
|
||
|
|
||
|
resJsonObject = JSONUtil.parseObj(rs11);
|
||
|
if("1000000000".equals(resJsonObject.getStr("code"))) {
|
||
|
JSONArray dataArrayOne = resJsonObject.getJSONArray("data");
|
||
|
if(dataArrayOne!=null && dataArrayOne.size() > 0) {
|
||
|
for(int i = 0; i<dataArrayOne.size();i++) {
|
||
|
JSONObject jsonObjectone = dataArrayOne.getJSONObject(i);
|
||
|
JSONArray dataArrayTwo = jsonObjectone.getJSONArray("data");
|
||
|
if(dataArrayTwo!=null && dataArrayTwo.size() >0) {
|
||
|
for(int j = 0; j<dataArrayTwo.size();j++) {
|
||
|
JSONObject re3 = dataArrayTwo.getJSONObject(j);
|
||
|
for(Map.Entry<String, Object> re4 : re3.entrySet()){
|
||
|
String key = re4.getKey();
|
||
|
JSONObject re5 = re3.getJSONObject(key);
|
||
|
re5.put("isExamine",false);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
nccApiUtil = new NccApiUtil();
|
||
|
nccApiUtil.init();
|
||
|
token = nccApiUtil.getToken();
|
||
|
log.error("approveDetailVO-token:"+token);
|
||
|
url = nccApiUtil.getBaseUrl()+"nccloud/api/hrtrn/openAPI/psninfoedit/approveDetailVO";
|
||
|
rs11 = nccApiUtil.doJsonPost(url,token,r3.toString());
|
||
|
|
||
|
log.error("approveDetailVO-rs11:"+rs11);
|
||
|
|
||
|
JSONObject resJsonObject2= JSONUtil.parseObj(rs11);
|
||
|
if("1000000000".equals(resJsonObject2.getStr("code"))) {
|
||
|
JSONObject dataObj2 = resJsonObject2.getJSONObject("data");
|
||
|
if(dataObj2.containsKey("data")) {
|
||
|
JSONObject dataObj21 = dataObj2.getJSONObject("data");
|
||
|
//如果是基本信息查询
|
||
|
if("bd_psndoc".equals(r3.getStr("tableCode"))) {
|
||
|
JSONArray afterdata = null;
|
||
|
if(dataObj21 != null && dataObj21.containsKey("afterData") && dataObj21.get("afterData") != null) {
|
||
|
afterdata = dataObj21.getJSONArray("afterData");
|
||
|
}
|
||
|
if(afterdata != null && afterdata.size() > 0) {
|
||
|
dataArrayOne = resJsonObject.getJSONArray("data");
|
||
|
if(dataArrayOne!=null && dataArrayOne.size() > 0) {
|
||
|
for(int i = 0; i<dataArrayOne.size();i++) {
|
||
|
JSONObject jsonObjectone = dataArrayOne.getJSONObject(i);
|
||
|
JSONArray dataArrayTwo = jsonObjectone.getJSONArray("data");
|
||
|
if(dataArrayTwo!=null && dataArrayTwo.size() >0) {
|
||
|
for(int j = 0; j<dataArrayTwo.size();j++) {
|
||
|
JSONObject re3 = dataArrayTwo.getJSONObject(j);
|
||
|
for(Map.Entry<String, Object> re4 : re3.entrySet()){
|
||
|
String key = re4.getKey();
|
||
|
JSONObject re5 = re3.getJSONObject(key);
|
||
|
for(int x = 0;x < afterdata.size();x ++) {
|
||
|
JSONObject afertObj = afterdata.getJSONObject(x);
|
||
|
String columnValue = afertObj.getStr("columnValue");
|
||
|
String columnKey = afertObj.getStr("columnKey");
|
||
|
if(columnKey!=null && columnKey.length()>0 && columnKey.equals(re5.getStr("key"))) {
|
||
|
re5.put("isExamine",true);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}else {//子级信息查询
|
||
|
if(dataObj21.containsKey("changeTypeMap")){
|
||
|
JSONObject changeData= dataObj21.getJSONObject("changeTypeMap");
|
||
|
List<String> shhs = new ArrayList<>();
|
||
|
for(String key : changeData.keySet()) {
|
||
|
shhs.add(key);
|
||
|
}
|
||
|
if(shhs!=null && shhs.size()>0) {
|
||
|
if(dataArrayOne!=null && dataArrayOne.size() > 0) {
|
||
|
for(int i = 0; i<dataArrayOne.size();i++) {
|
||
|
JSONObject jsonObjectone = dataArrayOne.getJSONObject(i);
|
||
|
String rowDataPk = jsonObjectone.getStr("rowDataPk");
|
||
|
if(shhs.contains(rowDataPk)) {
|
||
|
JSONArray dataArrayTwo = jsonObjectone.getJSONArray("data");
|
||
|
if(dataArrayTwo!=null && dataArrayTwo.size() >0) {
|
||
|
for(int j = 0; j<dataArrayTwo.size();j++) {
|
||
|
JSONObject re3 = dataArrayTwo.getJSONObject(j);
|
||
|
for(Map.Entry<String, Object> re4 : re3.entrySet()){
|
||
|
String key = re4.getKey();
|
||
|
JSONObject re5 = re3.getJSONObject(key);
|
||
|
re5.put("isExamine",true);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}catch (Exception e){
|
||
|
e.printStackTrace();
|
||
|
log.error("queryNccloudPersondata-e:"+e);
|
||
|
}
|
||
|
|
||
|
return resJsonObject.toString();
|
||
|
}
|
||
|
|
||
|
}
|