|
|
package com.weaver.seconddev.sxjg.controller;
|
|
|
/**
|
|
|
* 员工自助接口
|
|
|
*/
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
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 org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.ServletOutputStream;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.util.*;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping("/papi/secondev/nccloud/api/hrtrn/openAPI")
|
|
|
public class EmployeeSelfServiceController {
|
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(EmployeeSelfServiceController.class);
|
|
|
|
|
|
@Autowired
|
|
|
private PersondataQueryUtil persondataQueryUtil;
|
|
|
|
|
|
/**
|
|
|
* use:查询员工个人信息
|
|
|
*/
|
|
|
@WeaPermission(publicPermission = true)
|
|
|
@PostMapping("/persondata/query")
|
|
|
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");
|
|
|
// //先给query接口加字段isExamine,默认false,不审核
|
|
|
// 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 = new JSONArray();
|
|
|
// JSONArray changedataArray = dataObj21.getJSONArray("changedata");
|
|
|
// if(changedataArray!=null && changedataArray.size()>0) {
|
|
|
// for(int i = 0;i<changedataArray.size();i++) {
|
|
|
// JSONObject changeobj = changedataArray.getJSONObject(i);
|
|
|
// JSONArray afterdata1 = changeobj.getJSONArray("afterData");
|
|
|
// if(afterdata1!=null &&afterdata1.size()>0) {
|
|
|
// for(int i1 = 0;i1 < afterdata1.size();i1++) {
|
|
|
// JSONObject jsonObjecti1 = afterdata1.getJSONObject(i1);
|
|
|
// afterdata.add(jsonObjecti1);
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// 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");
|
|
|
// String columnLabel = afertObj.getString("columnLabel");
|
|
|
// if(columnKey!=null && columnKey.length()>0 && columnKey.equals(re5.getString("key"))) {
|
|
|
// //将待审核的内容覆盖的原值,前端展示
|
|
|
// re5.put("isExamine",true);//isExamine,true为待审核状态
|
|
|
// re5.put("label",columnLabel);
|
|
|
// re5.put("value",columnValue);
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }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;
|
|
|
|
|
|
String resJsonStr = persondataQueryUtil.queryNccloudPersondata(body);
|
|
|
|
|
|
return resJsonStr;
|
|
|
}
|
|
|
|
|
|
|
|
|
@WeaPermission(publicPermission = true)
|
|
|
@PostMapping("/persondata/query1")
|
|
|
public JSONObject persondataQuery1(
|
|
|
@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);
|
|
|
return resJsonObject;
|
|
|
}
|
|
|
|
|
|
|
|
|
@WeaPermission(publicPermission = true)
|
|
|
@PostMapping("/persondata/query2")
|
|
|
public JSONObject persondataQuery2(@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/psninfoedit/approvelist";
|
|
|
String rs11 = nccApiUtil.doJsonPost(url,token,r3.toJSONString());
|
|
|
JSONObject resJsonObject = JSONObject.parseObject(rs11);
|
|
|
return resJsonObject;
|
|
|
}
|
|
|
|
|
|
|
|
|
@WeaPermission(publicPermission = true)
|
|
|
@PostMapping("/persondata/query3")
|
|
|
public JSONObject persondataQuery3(@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/psninfoedit/approvelist";
|
|
|
String rs11 = nccApiUtil.doJsonPost(url,token,r3.toJSONString());
|
|
|
JSONObject resJsonObject = JSONObject.parseObject(rs11);
|
|
|
return resJsonObject;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* use:个人信息授权项查询接口
|
|
|
*/
|
|
|
@WeaPermission(publicPermission = true)
|
|
|
@PostMapping("/psninfoconf/list")
|
|
|
public JSONObject psninfoconfList(
|
|
|
@RequestBody String body
|
|
|
) throws Exception {
|
|
|
JSONObject requestbody = JSONObject.parseObject(body);
|
|
|
NccApiUtil nccApiUtil = new NccApiUtil();
|
|
|
nccApiUtil.init();
|
|
|
String token = nccApiUtil.getToken();
|
|
|
String url = nccApiUtil.getBaseUrl()+"nccloud/api/hrtrn/openAPI/psninfoconf/list";
|
|
|
String rs11 = nccApiUtil.doJsonPost(url,token,requestbody.toJSONString());
|
|
|
JSONObject resJsonObject = JSONObject.parseObject(rs11);
|
|
|
return resJsonObject;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* use:个人信息授权控制接口<接口备用>
|
|
|
*/
|
|
|
@WeaPermission(publicPermission = true)
|
|
|
@PostMapping("/psninfoconf/check")
|
|
|
public JSONObject psninfoconfCheck(
|
|
|
@RequestBody String body
|
|
|
) throws Exception {
|
|
|
JSONObject requestbody = JSONObject.parseObject(body);
|
|
|
NccApiUtil nccApiUtil = new NccApiUtil();
|
|
|
nccApiUtil.init();
|
|
|
String token = nccApiUtil.getToken();
|
|
|
String url = nccApiUtil.getBaseUrl()+"nccloud/api/hrtrn/openAPI/psninfoconf/check";
|
|
|
String rs11 = nccApiUtil.doJsonPost(url,token,requestbody.toJSONString());
|
|
|
JSONObject resJsonObject = JSONObject.parseObject(rs11);
|
|
|
return resJsonObject;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* use:个人信息变更-保存接口(包括子集)
|
|
|
*/
|
|
|
@WeaPermission(publicPermission = true)
|
|
|
@PostMapping("/psninfoedit/save")
|
|
|
public JSONObject psninfoeditSave(
|
|
|
@RequestBody String body
|
|
|
) throws Exception {
|
|
|
JSONObject requestbody = JSONObject.parseObject(body);
|
|
|
NccApiUtil nccApiUtil = new NccApiUtil();
|
|
|
nccApiUtil.init();
|
|
|
String token = nccApiUtil.getToken();
|
|
|
String url = nccApiUtil.getBaseUrl()+"nccloud/api/hrtrn/openAPI/psninfoedit/save";
|
|
|
String rs11 = nccApiUtil.doJsonPost(url,token,requestbody.toJSONString());
|
|
|
JSONObject resJsonObject = JSONObject.parseObject(rs11);
|
|
|
return resJsonObject;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* use:个人信息变更待审核列表查询接口
|
|
|
*/
|
|
|
@WeaPermission(publicPermission = true)
|
|
|
@PostMapping("/psninfoedit/approvelist")
|
|
|
public JSONObject psninfoeditApprovelist(
|
|
|
@RequestBody String body
|
|
|
) throws Exception {
|
|
|
JSONObject requestbody = JSONObject.parseObject(body);
|
|
|
NccApiUtil nccApiUtil = new NccApiUtil();
|
|
|
nccApiUtil.init();
|
|
|
String token = nccApiUtil.getToken();
|
|
|
String url = nccApiUtil.getBaseUrl()+"nccloud/api/hrtrn/openAPI/psninfoedit/approvelist";
|
|
|
String rs11 = nccApiUtil.doJsonPost(url,token,requestbody.toJSONString());
|
|
|
JSONObject resJsonObject = JSONObject.parseObject(rs11);
|
|
|
return resJsonObject;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* use:个人信息变更撤销审核接口
|
|
|
*/
|
|
|
@WeaPermission(publicPermission = true)
|
|
|
@PostMapping("/psninfoedit/retractapprove")
|
|
|
public JSONObject psninfoeditRetractapprove(
|
|
|
@RequestBody String body
|
|
|
) throws Exception {
|
|
|
JSONObject requestbody = JSONObject.parseObject(body);
|
|
|
NccApiUtil nccApiUtil = new NccApiUtil();
|
|
|
nccApiUtil.init();
|
|
|
String token = nccApiUtil.getToken();
|
|
|
String url = nccApiUtil.getBaseUrl()+"nccloud/api/hrtrn/openAPI/psninfoedit/retractapprove";
|
|
|
String rs11 = nccApiUtil.doJsonPost(url,token,requestbody.toJSONString());
|
|
|
JSONObject resJsonObject = JSONObject.parseObject(rs11);
|
|
|
return resJsonObject;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* use:个人信息变更审核详情接口
|
|
|
*/
|
|
|
@WeaPermission(publicPermission = true)
|
|
|
@PostMapping("/psninfoedit/approveDetailVO")
|
|
|
public JSONObject psninfoeditApproveDetailVO(
|
|
|
@RequestBody String body
|
|
|
) throws Exception {
|
|
|
JSONObject requestbody = JSONObject.parseObject(body);
|
|
|
NccApiUtil nccApiUtil = new NccApiUtil();
|
|
|
nccApiUtil.init();
|
|
|
String token = nccApiUtil.getToken();
|
|
|
String url = nccApiUtil.getBaseUrl()+"nccloud/api/hrtrn/openAPI/psninfoedit/approveDetailVO";
|
|
|
String rs11 = nccApiUtil.doJsonPost(url,token,requestbody.toJSONString());
|
|
|
JSONObject resJsonObject = JSONObject.parseObject(rs11);
|
|
|
return resJsonObject;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* use:自助人员子集查询权限接口
|
|
|
*/
|
|
|
@WeaPermission(publicPermission = true)
|
|
|
@PostMapping("/psninfoconf/querytablecodeisuserd")
|
|
|
public JSONObject queryTablecodeisuserd(
|
|
|
@RequestBody String body
|
|
|
) throws Exception {
|
|
|
JSONObject requestbody = JSONObject.parseObject(body);
|
|
|
NccApiUtil nccApiUtil = new NccApiUtil();
|
|
|
nccApiUtil.init();
|
|
|
String token = nccApiUtil.getToken();
|
|
|
String url = nccApiUtil.getBaseUrl()+"nccloud/api/hrtrn/openAPI/psninfoconf/querytablecodeisuserd";
|
|
|
String rs11 = nccApiUtil.doJsonPost(url,token,requestbody.toJSONString());
|
|
|
JSONObject resJsonObject = JSONObject.parseObject(rs11);
|
|
|
return resJsonObject;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* use:人员附件相关接口
|
|
|
*/
|
|
|
@WeaPermission(publicPermission = true)
|
|
|
@PostMapping("/attachment/query")
|
|
|
public JSONObject attachmentQuery(@RequestBody String body) throws Exception {
|
|
|
JSONObject requestbody = JSONObject.parseObject(body);
|
|
|
String pk1 = requestbody.getString("pk");
|
|
|
JSONObject inter2 = new JSONObject();
|
|
|
inter2.put("pk_psndoc",pk1);
|
|
|
NccApiUtil nccApiUtil = new NccApiUtil();
|
|
|
nccApiUtil.init();
|
|
|
String token = nccApiUtil.getToken();
|
|
|
String url = nccApiUtil.getBaseUrl()+"nccloud/api/hrtrn/openAPI/attachment/query";
|
|
|
String rs11 = nccApiUtil.doJsonPost(url,token,requestbody.toJSONString());
|
|
|
log.error("attachmentQuery-rs11:"+rs11);
|
|
|
try {
|
|
|
JSONObject resJsonObject = JSONObject.parseObject(rs11);
|
|
|
String code = resJsonObject.getString("code");
|
|
|
if("1000000000".equals(code)) {
|
|
|
JSONObject dataObject = new JSONObject();
|
|
|
if(resJsonObject.containsKey("data")){
|
|
|
dataObject = resJsonObject.getJSONObject("data");
|
|
|
if(dataObject.keySet()!=null && dataObject.keySet().size()>0) {
|
|
|
for(String key1 : dataObject.keySet()) {
|
|
|
JSONArray keysz1 = dataObject.getJSONArray(key1);
|
|
|
for(int i = 0; i<keysz1.size();i++) {
|
|
|
JSONObject one = keysz1.getJSONObject(i);
|
|
|
one.put("isExamine",false);
|
|
|
one.put("file_state","0");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//详情接口合并
|
|
|
NccApiUtil nccApiUtil2 = new NccApiUtil();
|
|
|
nccApiUtil2.init();
|
|
|
String token2 = nccApiUtil2.getToken();
|
|
|
String url2 = nccApiUtil2.getBaseUrl()+"nccloud/api/hrtrn/openAPI/attachment/unreviewed";
|
|
|
String rs12 = nccApiUtil2.doJsonPost(url2,token2,inter2.toJSONString());
|
|
|
log.error("attachmentQuery-rs12:"+rs12);
|
|
|
JSONObject resJsonObject2 = JSONObject.parseObject(rs12);
|
|
|
String code2 = resJsonObject2.getString("code");
|
|
|
|
|
|
//拼接待审核
|
|
|
if("1000000000".equals(code2)) {
|
|
|
JSONArray data2 = new JSONArray();
|
|
|
if(resJsonObject2.containsKey("data")){
|
|
|
String data = resJsonObject2.getString("data");
|
|
|
log.error("data:"+data);
|
|
|
boolean isArray = JSONUtil.isJsonArray(data);
|
|
|
log.error("isArray:"+isArray);
|
|
|
if (isArray) {
|
|
|
data2 = resJsonObject2.getJSONArray("data");
|
|
|
}
|
|
|
}
|
|
|
log.error("data2:"+data2.toJSONString());
|
|
|
|
|
|
// JSONArray data2 = resJsonObject2.getJSONArray("data");
|
|
|
if(data2!=null && data2.size()>0) {
|
|
|
for(int i = 0; i < data2.size(); i++) {
|
|
|
JSONObject obj2 = data2.getJSONObject(i);
|
|
|
JSONObject y2 = new JSONObject();
|
|
|
String pk_annex_approve = obj2.getString("pk_annex_approve");
|
|
|
String file_name = obj2.getString("file_name");
|
|
|
String checkstatus = obj2.getString("checkstatus");
|
|
|
String type = "";
|
|
|
if(obj2.containsKey("type")) {
|
|
|
type = obj2.getString("type");
|
|
|
}
|
|
|
String file_state = obj2.getString("file_state");
|
|
|
//仅checkstatus==0待审核时,才展示
|
|
|
if("0".equals(checkstatus)) {
|
|
|
y2.put("pk",pk_annex_approve);
|
|
|
y2.put("type",type);
|
|
|
y2.put("name",file_name);
|
|
|
y2.put("path","");
|
|
|
y2.put("file_state",file_state);
|
|
|
y2.put("isExamine",true);
|
|
|
if("0".equals(file_state)) {//新增
|
|
|
if(dataObject.containsKey(type)) {
|
|
|
String data = resJsonObject2.getString(type);
|
|
|
log.error("data2:"+data);
|
|
|
boolean isArray = JSONUtil.isJsonArray(data);
|
|
|
log.error("isArray2:"+isArray);
|
|
|
if (isArray) {
|
|
|
JSONArray b1 = dataObject.getJSONArray(type);
|
|
|
b1.add(y2);
|
|
|
}
|
|
|
}else {
|
|
|
JSONArray b2 = new JSONArray();
|
|
|
b2.add(y2);
|
|
|
dataObject.put(type,b2);
|
|
|
}
|
|
|
}else {//删除
|
|
|
JSONArray b1 = new JSONArray();
|
|
|
if(dataObject.containsKey(type)){
|
|
|
String data = resJsonObject2.getString(type);
|
|
|
log.error("data3:"+data);
|
|
|
boolean isArray = JSONUtil.isJsonArray(data);
|
|
|
log.error("isArray3:"+isArray);
|
|
|
if (isArray) {
|
|
|
b1 = dataObject.getJSONArray(type);
|
|
|
for(int u = 0;u<b1.size();u++) {
|
|
|
JSONObject u1 = b1.getJSONObject(u);
|
|
|
String filenameu = u1.getString("name");
|
|
|
if(filenameu.equals(file_name)) {
|
|
|
u1.put("isExamine",true);
|
|
|
u1.put("file_state",file_state);
|
|
|
u1.put("pk",pk_annex_approve);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return resJsonObject;
|
|
|
}catch (Exception e) {
|
|
|
throw new Exception(rs11);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* use:人员附件相关接口
|
|
|
*/
|
|
|
@WeaPermission(publicPermission = true)
|
|
|
@PostMapping("/attachment/query1")
|
|
|
public JSONObject attachmentQuery1(
|
|
|
@RequestBody String body
|
|
|
) throws Exception {
|
|
|
JSONObject requestbody = JSONObject.parseObject(body);
|
|
|
NccApiUtil nccApiUtil = new NccApiUtil();
|
|
|
nccApiUtil.init();
|
|
|
String token = nccApiUtil.getToken();
|
|
|
String url = nccApiUtil.getBaseUrl()+"nccloud/api/hrtrn/openAPI/attachment/query";
|
|
|
String rs11 = nccApiUtil.doJsonPost(url,token,requestbody.toJSONString());
|
|
|
try {
|
|
|
JSONObject resJsonObject = JSONObject.parseObject(rs11);
|
|
|
return resJsonObject;
|
|
|
}catch (Exception e) {
|
|
|
throw new Exception(rs11);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* use:个人附件下载接口
|
|
|
*/
|
|
|
@WeaPermission(publicPermission = true)
|
|
|
@PostMapping("/attachment/download")
|
|
|
public JSONObject attachmentDownload(
|
|
|
@RequestBody String body
|
|
|
) throws Exception {
|
|
|
JSONObject requestbody = JSONObject.parseObject(body);
|
|
|
NccApiUtil nccApiUtil = new NccApiUtil();
|
|
|
nccApiUtil.init();
|
|
|
String token = nccApiUtil.getToken();
|
|
|
String url = nccApiUtil.getBaseUrl()+"nccloud/api/hrtrn/openAPI/attachment/download";
|
|
|
String rs11 = nccApiUtil.doJsonPost(url,token,requestbody.toJSONString());
|
|
|
try {
|
|
|
JSONObject resJsonObject = JSONObject.parseObject(rs11);
|
|
|
return resJsonObject;
|
|
|
}catch (Exception e) {
|
|
|
throw new Exception(rs11);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* use:个人附件下载接口
|
|
|
*/
|
|
|
@WeaPermission(publicPermission = true)
|
|
|
@GetMapping("/attachment/download1")
|
|
|
public void attachmentDownload1(
|
|
|
@RequestParam("fullPath") String fullPath,
|
|
|
HttpServletResponse response
|
|
|
) throws Exception {
|
|
|
JSONObject requestbody = new JSONObject();
|
|
|
requestbody.put("fullPath",fullPath);
|
|
|
NccApiUtil nccApiUtil = new NccApiUtil();
|
|
|
nccApiUtil.init();
|
|
|
String token = nccApiUtil.getToken();
|
|
|
String url = nccApiUtil.getBaseUrl()+"nccloud/api/hrtrn/openAPI/attachment/download";
|
|
|
String rs11 = nccApiUtil.doJsonPost(url,token,requestbody.toJSONString());
|
|
|
try {
|
|
|
JSONObject resJsonObject2 = JSONObject.parseObject(rs11);
|
|
|
if(resJsonObject2.getBoolean("success")) {
|
|
|
JSONObject resJsonObject = resJsonObject2.getJSONObject("data");
|
|
|
String bytes = resJsonObject.getString("bytes");
|
|
|
byte [] liufile = Base64.getDecoder().decode(bytes);
|
|
|
String filenames = resJsonObject.getString("name");
|
|
|
response.setContentType("application/x-download");
|
|
|
String fileName = URLEncoder.encode(filenames, "UTF-8");
|
|
|
response.setCharacterEncoding("UTF-8");
|
|
|
response.addHeader("Content-Disposition", "attachment;filename=" + fileName);
|
|
|
try {
|
|
|
ServletOutputStream out = response.getOutputStream();
|
|
|
out.write(liufile,0,liufile.length);
|
|
|
out.close();
|
|
|
out.flush();
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}catch (Exception e) {
|
|
|
throw new Exception(rs11);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* use:人员附件接收接口
|
|
|
*/
|
|
|
@WeaPermission(publicPermission = true)
|
|
|
@PostMapping("/attachment/receive")
|
|
|
public JSONObject attachmentReceive(
|
|
|
@RequestBody String body
|
|
|
) throws Exception {
|
|
|
JSONObject requestbody = JSONObject.parseObject(body);
|
|
|
NccApiUtil nccApiUtil = new NccApiUtil();
|
|
|
nccApiUtil.init();
|
|
|
String token = nccApiUtil.getToken();
|
|
|
String url = nccApiUtil.getBaseUrl()+"nccloud/api/hrtrn/openAPI/attachment/receive";
|
|
|
String rs11 = nccApiUtil.doJsonPost(url,token,requestbody.toJSONString());
|
|
|
try {
|
|
|
JSONObject resJsonObject = JSONObject.parseObject(rs11);
|
|
|
return resJsonObject;
|
|
|
}catch (Exception e) {
|
|
|
throw new Exception(rs11);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// @WeaPermission(publicPermission = true)
|
|
|
// @PostMapping("/attachment/upload")
|
|
|
// public JSONObject attachmentUpload(
|
|
|
// @RequestParam("file") MultipartFile[] file,
|
|
|
// @RequestParam("pk_psndoc") String pk_psndoc,
|
|
|
// @RequestParam("file_state") String file_state,
|
|
|
// @RequestParam("type") String type,
|
|
|
// @RequestParam("file_type") String file_type,
|
|
|
// @RequestParam("file_name") String file_name
|
|
|
// ) throws Exception {
|
|
|
// JSONObject rs = new JSONObject();
|
|
|
// if (file.isEmpty()) {
|
|
|
// rs.put("status",false);
|
|
|
// rs.put("msg","文件为空,请重新上传");
|
|
|
// return rs;
|
|
|
// }
|
|
|
// // 获取文件名
|
|
|
// String fileName = file.getOriginalFilename();
|
|
|
// // 获取文件的字节内容
|
|
|
// byte[] bytes = file.getBytes();
|
|
|
// String filebase64str = Base64.getEncoder().encodeToString(bytes);
|
|
|
// JSONObject send = new JSONObject();
|
|
|
// send.put("pk_psndoc",pk_psndoc);
|
|
|
// JSONArray data = new JSONArray();
|
|
|
// JSONObject dataObject = new JSONObject();
|
|
|
// dataObject.put("file_name",file_name);
|
|
|
// dataObject.put("file_state",file_state);
|
|
|
// dataObject.put("filebytes",filebase64str);
|
|
|
// dataObject.put("type",type);
|
|
|
// dataObject.put("file_type",file_type);
|
|
|
// data.add(dataObject);
|
|
|
// send.put("data",data);
|
|
|
// NccApiUtil nccApiUtil = new NccApiUtil();
|
|
|
// nccApiUtil.init();
|
|
|
// String token = nccApiUtil.getToken();
|
|
|
// String url = nccApiUtil.getBaseUrl()+"nccloud/api/hrtrn/openAPI/attachment/receive";
|
|
|
// String rs11 = nccApiUtil.doJsonPost(url,token,send.toJSONString());
|
|
|
// try {
|
|
|
// JSONObject resJsonObject = JSONObject.parseObject(rs11);
|
|
|
// return resJsonObject;
|
|
|
// }catch (Exception e) {
|
|
|
// throw new Exception(rs11);
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
/**
|
|
|
* use:个人附件待审核查询接口
|
|
|
*/
|
|
|
@WeaPermission(publicPermission = true)
|
|
|
@PostMapping("/attachment/unreviewed")
|
|
|
public JSONObject attachmentUnreviewed(
|
|
|
@RequestBody String body
|
|
|
) throws Exception {
|
|
|
JSONObject requestbody = JSONObject.parseObject(body);
|
|
|
NccApiUtil nccApiUtil = new NccApiUtil();
|
|
|
nccApiUtil.init();
|
|
|
String token = nccApiUtil.getToken();
|
|
|
String url = nccApiUtil.getBaseUrl()+"nccloud/api/hrtrn/openAPI/attachment/unreviewed";
|
|
|
String rs11 = nccApiUtil.doJsonPost(url,token,requestbody.toJSONString());
|
|
|
try {
|
|
|
JSONObject resJsonObject = JSONObject.parseObject(rs11);
|
|
|
return resJsonObject;
|
|
|
}catch (Exception e) {
|
|
|
throw new Exception(rs11);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* use:人员附件相关接口
|
|
|
*/
|
|
|
@WeaPermission(publicPermission = true)
|
|
|
@PostMapping("/attachment/cancel")
|
|
|
public JSONObject attachmentCancel(
|
|
|
@RequestBody String body
|
|
|
) throws Exception {
|
|
|
JSONObject requestbody = JSONObject.parseObject(body);
|
|
|
NccApiUtil nccApiUtil = new NccApiUtil();
|
|
|
nccApiUtil.init();
|
|
|
String token = nccApiUtil.getToken();
|
|
|
String url = nccApiUtil.getBaseUrl()+"nccloud/api/hrtrn/openAPI/attachment/cancel";
|
|
|
String rs11 = nccApiUtil.doJsonPost(url,token,requestbody.toJSONString());
|
|
|
try {
|
|
|
JSONObject resJsonObject = JSONObject.parseObject(rs11);
|
|
|
return resJsonObject;
|
|
|
}catch (Exception e) {
|
|
|
throw new Exception(rs11);
|
|
|
}
|
|
|
}
|
|
|
} |