|
|
|
@ -7,10 +7,11 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.weaver.common.authority.annotation.WeaPermission;
|
|
|
|
|
import com.weaver.seconddev.sxjg.util.NccApiUtil;
|
|
|
|
|
import com.weaver.seconddev.sxjg.util.PersondataQueryUtil;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.ServletOutputStream;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
@ -19,10 +20,9 @@ import java.util.*;
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/papi/secondev/nccloud/api/hrtrn/openAPI")
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class EmployeeSelfServiceController {
|
|
|
|
|
|
|
|
|
|
private final Logger log = LoggerFactory.getLogger(EmployeeSelfServiceController.class);
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private PersondataQueryUtil persondataQueryUtil;
|
|
|
|
@ -33,110 +33,111 @@ public class EmployeeSelfServiceController {
|
|
|
|
|
*/
|
|
|
|
|
@WeaPermission(publicPermission = true)
|
|
|
|
|
@PostMapping("/persondata/query")
|
|
|
|
|
public JSONObject persondataQuery(
|
|
|
|
|
@RequestBody String body
|
|
|
|
|
) throws Exception {
|
|
|
|
|
JSONObject r3 = JSONObject.parseObject(body);
|
|
|
|
|
NccApiUtil nccApiUtil = new NccApiUtil();
|
|
|
|
|
nccApiUtil.init();
|
|
|
|
|
String token = nccApiUtil.getToken();
|
|
|
|
|
String url = nccApiUtil.getBaseUrl()+"nccloud/api/hrtrn/openAPI/persondata/query";
|
|
|
|
|
String rs11 = nccApiUtil.doJsonPost(url,token,r3.toJSONString());
|
|
|
|
|
JSONObject resJsonObject = JSONObject.parseObject(rs11);
|
|
|
|
|
if("1000000000".equals(resJsonObject.getString("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();
|
|
|
|
|
url = nccApiUtil.getBaseUrl()+"nccloud/api/hrtrn/openAPI/psninfoedit/approveDetailVO";
|
|
|
|
|
rs11 = nccApiUtil.doJsonPost(url,token,r3.toJSONString());
|
|
|
|
|
JSONObject resJsonObject2= JSONObject.parseObject(rs11);
|
|
|
|
|
if("1000000000".equals(resJsonObject2.getString("code"))) {
|
|
|
|
|
JSONObject dataObj2 = resJsonObject2.getJSONObject("data");
|
|
|
|
|
if(dataObj2.containsKey("data")) {
|
|
|
|
|
JSONObject dataObj21 = dataObj2.getJSONObject("data");
|
|
|
|
|
//如果是基本信息查询
|
|
|
|
|
if("bd_psndoc".equals(r3.getString("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.getString("columnValue");
|
|
|
|
|
String columnKey = afertObj.getString("columnKey");
|
|
|
|
|
if(columnKey!=null && columnKey.length()>0 && columnKey.equals(re5.getString("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.getString("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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return resJsonObject;
|
|
|
|
|
public String persondataQuery(@RequestBody String body) throws Exception {
|
|
|
|
|
// JSONObject r3 = JSONObject.parseObject(body);
|
|
|
|
|
// NccApiUtil nccApiUtil = new NccApiUtil();
|
|
|
|
|
// nccApiUtil.init();
|
|
|
|
|
// String token = nccApiUtil.getToken();
|
|
|
|
|
// String url = nccApiUtil.getBaseUrl()+"nccloud/api/hrtrn/openAPI/persondata/query";
|
|
|
|
|
// String rs11 = nccApiUtil.doJsonPost(url,token,r3.toJSONString());
|
|
|
|
|
// JSONObject resJsonObject = JSONObject.parseObject(rs11);
|
|
|
|
|
// if("1000000000".equals(resJsonObject.getString("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();
|
|
|
|
|
// url = nccApiUtil.getBaseUrl()+"nccloud/api/hrtrn/openAPI/psninfoedit/approveDetailVO";
|
|
|
|
|
// rs11 = nccApiUtil.doJsonPost(url,token,r3.toJSONString());
|
|
|
|
|
// JSONObject resJsonObject2= JSONObject.parseObject(rs11);
|
|
|
|
|
// if("1000000000".equals(resJsonObject2.getString("code"))) {
|
|
|
|
|
// JSONObject dataObj2 = resJsonObject2.getJSONObject("data");
|
|
|
|
|
// if(dataObj2.containsKey("data")) {
|
|
|
|
|
// JSONObject dataObj21 = dataObj2.getJSONObject("data");
|
|
|
|
|
// //如果是基本信息查询
|
|
|
|
|
// if("bd_psndoc".equals(r3.getString("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.getString("columnValue");
|
|
|
|
|
// String columnKey = afertObj.getString("columnKey");
|
|
|
|
|
// if(columnKey!=null && columnKey.length()>0 && columnKey.equals(re5.getString("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.getString("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);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
String resJsonStr = persondataQueryUtil.queryNccloudPersondata(body);
|
|
|
|
|
|
|
|
|
|
return resJsonStr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -514,7 +515,9 @@ public class EmployeeSelfServiceController {
|
|
|
|
|
*/
|
|
|
|
|
@WeaPermission(publicPermission = true)
|
|
|
|
|
@PostMapping("/attachment/cancel")
|
|
|
|
|
public JSONObject attachmentCancel(@RequestBody String body) throws Exception {
|
|
|
|
|
public JSONObject attachmentCancel(
|
|
|
|
|
@RequestBody String body
|
|
|
|
|
) throws Exception {
|
|
|
|
|
JSONObject requestbody = JSONObject.parseObject(body);
|
|
|
|
|
NccApiUtil nccApiUtil = new NccApiUtil();
|
|
|
|
|
nccApiUtil.init();
|
|
|
|
|