@ -8,7 +8,6 @@ import com.weaver.common.authority.annotation.WeaPermission;
import com.weaver.seconddev.sxjg.util.NccApiUtil ;
import lombok.extern.slf4j.Slf4j ;
import org.springframework.web.bind.annotation.* ;
import org.springframework.web.multipart.MultipartFile ;
import javax.servlet.ServletOutputStream ;
import javax.servlet.http.HttpServletResponse ;
@ -36,6 +35,7 @@ public class EmployeeSelfServiceController {
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 ) ;
@ -64,9 +64,19 @@ public class EmployeeSelfServiceController {
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" ) ;
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" ) ;
@ -84,8 +94,12 @@ public class EmployeeSelfServiceController {
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 ) ;
//将待审核的内容覆盖的原值,前端展示
re5 . put ( "isExamine" , true ) ; //isExamine, true为待审核状态
re5 . put ( "label" , columnLabel ) ;
re5 . put ( "value" , columnValue ) ;
}
}
}
@ -130,6 +144,22 @@ public class EmployeeSelfServiceController {
return resJsonObject ;
}
@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 ;
}
/ * *
* use : 个 人 信 息 授 权 项 查 询 接 口
* /
@ -307,7 +337,10 @@ public class EmployeeSelfServiceController {
String pk_annex_approve = obj2 . getString ( "pk_annex_approve" ) ;
String file_name = obj2 . getString ( "file_name" ) ;
String checkstatus = obj2 . getString ( "checkstatus" ) ;
String type = obj2 . getString ( "type" ) ;
String type = "" ;
if ( obj2 . containsKey ( "type" ) ) {
type = obj2 . getString ( "type" ) ;
}
String file_state = obj2 . getString ( "file_state" ) ;
//仅checkstatus==0待审核时, 才展示
if ( "0" . equals ( checkstatus ) ) {
@ -317,13 +350,26 @@ public class EmployeeSelfServiceController {
y2 . put ( "path" , "" ) ;
y2 . put ( "file_state" , file_state ) ;
y2 . put ( "isExamine" , true ) ;
if ( dataObject . containsKey ( type ) ) {
if ( "0" . equals ( file_state ) ) { //新增
if ( dataObject . containsKey ( type ) ) {
JSONArray b1 = dataObject . getJSONArray ( type ) ;
b1 . add ( y2 ) ;
} else {
JSONArray b2 = new JSONArray ( ) ;
b2 . add ( y2 ) ;
dataObject . put ( type , b2 ) ;
}
} else { //删除
JSONArray b1 = dataObject . getJSONArray ( type ) ;
b1 . add ( y2 ) ;
} else {
JSONArray b2 = new JSONArray ( ) ;
b2 . add ( y2 ) ;
dataObject . put ( type , b2 ) ;
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 ) ;
}
}
}
}
}
@ -336,6 +382,28 @@ public class EmployeeSelfServiceController {
}
}
/ * *
* 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 ) ;
}
}
/ * *