2024/01/09
parent
3b27c315c3
commit
fa4952e46d
@ -0,0 +1,48 @@
|
||||
package com.weaver.seconddev.sxjg.controller;
|
||||
/**
|
||||
* 工资条获取接口开发
|
||||
*/
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.authority.annotation.WeaPermission;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.seconddev.sxjg.util.NccApiUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/papi/secondev/sxjg")
|
||||
@Slf4j
|
||||
public class PayslipPageController {
|
||||
|
||||
@WeaPermission(publicPermission = true)
|
||||
@PostMapping("/getPayslipageInfo")
|
||||
public WeaResult<Map<String,String>> check(
|
||||
@RequestParam("talentId") String talentId,
|
||||
@RequestParam("userId") String userId,
|
||||
@RequestParam("userName") String userName,
|
||||
@RequestParam("resumeId") String resumeId,
|
||||
@RequestParam("positionId") String positionId
|
||||
) throws Exception {
|
||||
Map<String,String> rs = new HashMap<>();
|
||||
JSONObject r1 = new JSONObject();
|
||||
JSONArray r2 = new JSONArray();
|
||||
JSONObject r3 = new JSONObject();
|
||||
r3.put("pk_psndoc","0001A2100000003FMWBU");
|
||||
r2.add(r3);
|
||||
r1.put("data",r2);
|
||||
|
||||
NccApiUtil nccApiUtil = new NccApiUtil();
|
||||
nccApiUtil.init();
|
||||
String token = nccApiUtil.getToken();
|
||||
String url = nccApiUtil.getBaseUrl()+"nccloud/api/hrtrn/openAPI/payslipSync/entry";
|
||||
String rs11 = nccApiUtil.doJsonPost(url,token,r1.toJSONString());
|
||||
return WeaResult.success(rs);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,417 @@
|
||||
/**
|
||||
* @use附件重发
|
||||
* @author 刘浩
|
||||
*/
|
||||
package com.weaver.seconddev.sxjg.esb;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.eteams.file.client.file.FileData;
|
||||
import com.weaver.file.ud.api.FileDownloadService;
|
||||
import com.weaver.seconddev.sxjg.config.EbDbDataSourceConfig;
|
||||
import com.weaver.seconddev.sxjg.config.EbDbDataSourceConfigResp;
|
||||
import com.weaver.seconddev.sxjg.util.NccApiUtil;
|
||||
import com.weaver.seconddev.sxjg.util.NccResultUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("esb_errorresend_howe")
|
||||
public class ErrorfjResendToNcc implements EsbServerlessRpcRemoteInterface {
|
||||
private static final Logger log = LoggerFactory.getLogger(ErrorfjResendToNcc.class);
|
||||
private JdbcTemplate jdbcTemplate = new JdbcTemplate(EbDbDataSourceConfig.dbDataSource());
|
||||
private JdbcTemplate jdbcTemplateresp = new JdbcTemplate(EbDbDataSourceConfigResp.dbDataSource());
|
||||
|
||||
@Autowired
|
||||
private FileDownloadService fileDownloadService;
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
Map<String, Object> finresult = new HashMap<>();
|
||||
finresult.put("code",200);
|
||||
String idtype = (String) params.get("idtype");//证件类型
|
||||
String id = (String) params.get("id");//证件号码
|
||||
String rzid = (String) params.get("rzid");//入职id
|
||||
String collectid = (String) params.get("collectid");
|
||||
if (collectid == null || collectid.length() == 0) {
|
||||
finresult.put("code",500);
|
||||
finresult.put("msg","当前人员并未进行信息采集");
|
||||
return WeaResult.success(finresult);
|
||||
}
|
||||
String sql = "select ncc_pk from ft_ncczjlx where ncc_name = '"+idtype+"'";
|
||||
Map<String, Object> srrr = jdbcTemplateresp.queryForMap(sql);
|
||||
String idtypePk =(String) srrr.get("ncc_pk");
|
||||
try {
|
||||
//传附件
|
||||
log.error("howec:::::::传附件");
|
||||
JSONObject jsonObject2 = new JSONObject();
|
||||
jsonObject2.put("id",id);
|
||||
jsonObject2.put("idtype",idtypePk);
|
||||
JSONArray r11 = getFjByCollectId(collectid);
|
||||
if(r11.size() == 0) {
|
||||
return WeaResult.success(finresult);
|
||||
}
|
||||
jsonObject2.put("data",r11);
|
||||
NccApiUtil nccApiUtil = new NccApiUtil();
|
||||
nccApiUtil.init();
|
||||
String token = nccApiUtil.getToken();
|
||||
String url = nccApiUtil.getBaseUrl()+"nccloud/api/hrhi/openAPI/attachment/upload";
|
||||
String rs11 = nccApiUtil.doJsonPost(url,token,jsonObject2.toJSONString());
|
||||
NccResultUtil rs = new NccResultUtil(rs11);
|
||||
if(rs.getResult()){
|
||||
sql = "update uf_rcrt_entry_manage set fjtbsfyc = '0' where id = "+rzid;
|
||||
jdbcTemplate.execute(sql);
|
||||
return WeaResult.success(finresult);
|
||||
}else {
|
||||
finresult.put("code",500);
|
||||
finresult.put("msg",rs.getDescription());
|
||||
return WeaResult.success(finresult);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
finresult.put("code",500);
|
||||
finresult.put("msg",e.getMessage());
|
||||
return WeaResult.success(finresult);
|
||||
}
|
||||
}
|
||||
|
||||
private JSONArray getFjByCollectId(String collectid) {
|
||||
JSONArray array1 = new JSONArray();
|
||||
String sql = "select dyxlxlzxwz,dexlxlzxwz,dsxlxlzxwz,dsixlxlzxwz,gwz,zcz,zyzgz,aqsckhz,jqmgzp,sfzzp from uf_rcrt_entry_collect where id = "+collectid;
|
||||
Map<String, Object> map = jdbcTemplate.queryForMap(sql);
|
||||
String dyxlxlzxwz = map.get("dyxlxlzxwz") == null ? "0" : (String)map.get("dyxlxlzxwz");
|
||||
String dexlxlzxwz = map.get("dexlxlzxwz") == null ? "0" : (String)map.get("dexlxlzxwz");
|
||||
String dsxlxlzxwz = map.get("dsxlxlzxwz") == null ? "0" : (String)map.get("dsxlxlzxwz");
|
||||
String dsixlxlzxwz = map.get("dsixlxlzxwz") == null ? "0" : (String)map.get("dsixlxlzxwz");
|
||||
String gwz = map.get("gwz") == null ? "0" : (String)map.get("gwz");
|
||||
String zcz = map.get("zcz") == null ? "0" : (String)map.get("zcz");
|
||||
String zyzgz = map.get("zyzgz") == null ? "0" : (String)map.get("zyzgz");
|
||||
String aqsckhz = map.get("aqsckhz") == null ? "0" : (String)map.get("aqsckhz");
|
||||
String sfzzp = map.get("sfzzp") == null ? "0" : (String)map.get("sfzzp");
|
||||
String jqmgzp = map.get("jqmgzp") == null ? "0" : (String)map.get("jqmgzp");
|
||||
List<FileData> file1 = getDxDt(dyxlxlzxwz);//第一学历学历证学位证
|
||||
List<FileData> file2 =getDxDt(dexlxlzxwz);//第二学历学历证学位证
|
||||
List<FileData> file3 = getDxDt(dsxlxlzxwz);//第三学历学历证学位证
|
||||
List<FileData> file4 = getDxDt(dsixlxlzxwz);//第四学历学历证学位证
|
||||
List<FileData> file5 = getDxDt(gwz);//岗位证
|
||||
List<FileData> file6 = getDxDt(zcz);//职称证
|
||||
List<FileData> file7 = getDxDt(zyzgz);//执业资格证
|
||||
List<FileData> file8 = getDxDt(aqsckhz);//安全生产考核证
|
||||
List<FileData> file9 = getDxDt(sfzzp);//身份证
|
||||
List<FileData> file10 = getDxDt(jqmgzp);//近期免冠照片
|
||||
if(CollectionUtil.isNotEmpty(file1)) {
|
||||
JSONObject rs1 = new JSONObject();
|
||||
rs1.put("file_name","第一学历学历证学位证");
|
||||
JSONArray json1 = new JSONArray();
|
||||
for(FileData f : file1) {
|
||||
JSONObject r1 = new JSONObject();
|
||||
String filename = "";
|
||||
String name1 = f.getFileObj().getName();
|
||||
log.error("name::::::"+name1);
|
||||
if(name1.contains(".")) {
|
||||
filename = name1.split("\\.")[1];
|
||||
}
|
||||
if(filename.length() > 0) {
|
||||
r1.put("file_type",filename.toLowerCase());
|
||||
}else{
|
||||
r1.put("file_type",f.getFileObj().getType());
|
||||
}
|
||||
log.error("howec:::::::::xxxxx21:"+f.getFileObj().getName());
|
||||
log.error("howec:::::::::xxxxx1:"+f.getFileObj().getType());
|
||||
log.error("howec:::::::::xxxxx2:"+f.getLoadUrl());
|
||||
InputStream stream1 = f.getInputStream();
|
||||
byte[] a = getByteData(stream1);
|
||||
r1.put("filebytes",a);
|
||||
json1.add(r1);
|
||||
}
|
||||
rs1.put("filebytes_array",json1);
|
||||
array1.add(rs1);
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(file2)) {
|
||||
JSONObject rs1 = new JSONObject();
|
||||
rs1.put("file_name","第二学历学历证学位证");
|
||||
JSONArray json1 = new JSONArray();
|
||||
for(FileData f : file2) {
|
||||
JSONObject r1 = new JSONObject();
|
||||
String filename = "";
|
||||
String name1 = f.getFileObj().getName();
|
||||
if(name1.contains(".")) {
|
||||
filename = name1.split("\\.")[1];
|
||||
}
|
||||
if(filename.length() > 0) {
|
||||
r1.put("file_type",filename.toLowerCase());
|
||||
}else{
|
||||
r1.put("file_type",f.getFileObj().getType());
|
||||
}
|
||||
log.error("howec:::::::::xxxxx21:"+f.getFileObj().getName());
|
||||
log.error("howec:::::::::xxxxx1:"+f.getFileObj().getType());
|
||||
log.error("howec:::::::::xxxxx2:"+f.getLoadUrl());
|
||||
InputStream stream1 = f.getInputStream();
|
||||
byte[] a = getByteData(stream1);
|
||||
r1.put("filebytes",a);
|
||||
json1.add(r1);
|
||||
}
|
||||
rs1.put("filebytes_array",json1);
|
||||
array1.add(rs1);
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(file3)) {
|
||||
JSONObject rs1 = new JSONObject();
|
||||
rs1.put("file_name","第三学历学历证学位证");
|
||||
JSONArray json1 = new JSONArray();
|
||||
for(FileData f : file3) {
|
||||
JSONObject r1 = new JSONObject();
|
||||
String filename = "";
|
||||
String name1 = f.getFileObj().getName();
|
||||
if(name1.contains(".")) {
|
||||
filename = name1.split("\\.")[1];
|
||||
}
|
||||
if(filename.length() > 0) {
|
||||
r1.put("file_type",filename.toLowerCase());
|
||||
}else{
|
||||
r1.put("file_type",f.getFileObj().getType());
|
||||
}
|
||||
log.error("howec:::::::::xxxxx21:"+f.getFileObj().getName());
|
||||
log.error("howec:::::::::xxxxx1:"+f.getFileObj().getType());
|
||||
log.error("howec:::::::::xxxxx2:"+f.getLoadUrl());
|
||||
InputStream stream1 = f.getInputStream();
|
||||
byte[] a = getByteData(stream1);
|
||||
r1.put("filebytes",a);
|
||||
json1.add(r1);
|
||||
}
|
||||
rs1.put("filebytes_array",json1);
|
||||
array1.add(rs1);
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(file4)) {
|
||||
JSONObject rs1 = new JSONObject();
|
||||
rs1.put("file_name","第四学历学历证学位证");
|
||||
JSONArray json1 = new JSONArray();
|
||||
for(FileData f : file4) {
|
||||
JSONObject r1 = new JSONObject();
|
||||
String filename = "";
|
||||
String name1 = f.getFileObj().getName();
|
||||
if(name1.contains(".")) {
|
||||
filename = name1.split("\\.")[1];
|
||||
}
|
||||
if(filename.length() > 0) {
|
||||
r1.put("file_type",filename.toLowerCase());
|
||||
}else{
|
||||
r1.put("file_type",f.getFileObj().getType());
|
||||
}
|
||||
log.error("howec:::::::::xxxxx21:"+f.getFileObj().getName());
|
||||
log.error("howec:::::::::xxxxx1:"+f.getFileObj().getType());
|
||||
log.error("howec:::::::::xxxxx2:"+f.getLoadUrl());
|
||||
InputStream stream1 = f.getInputStream();
|
||||
byte[] a = getByteData(stream1);
|
||||
r1.put("filebytes",a);
|
||||
json1.add(r1);
|
||||
}
|
||||
rs1.put("filebytes_array",json1);
|
||||
array1.add(rs1);
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(file5)) {
|
||||
JSONObject rs1 = new JSONObject();
|
||||
rs1.put("file_name","岗位证");
|
||||
JSONArray json1 = new JSONArray();
|
||||
for(FileData f : file5) {
|
||||
JSONObject r1 = new JSONObject();
|
||||
String filename = "";
|
||||
String name1 = f.getFileObj().getName();
|
||||
if(name1.contains(".")) {
|
||||
filename = name1.split("\\.")[1];
|
||||
}
|
||||
if(filename.length() > 0) {
|
||||
r1.put("file_type",filename.toLowerCase());
|
||||
}else{
|
||||
r1.put("file_type",f.getFileObj().getType());
|
||||
}
|
||||
log.error("howec:::::::::xxxxx21:"+f.getFileObj().getName());
|
||||
log.error("howec:::::::::xxxxx1:"+f.getFileObj().getType());
|
||||
log.error("howec:::::::::xxxxx2:"+f.getLoadUrl());
|
||||
InputStream stream1 = f.getInputStream();
|
||||
byte[] a = getByteData(stream1);
|
||||
r1.put("filebytes",a);
|
||||
json1.add(r1);
|
||||
}
|
||||
rs1.put("filebytes_array",json1);
|
||||
array1.add(rs1);
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(file6)) {
|
||||
JSONObject rs1 = new JSONObject();
|
||||
rs1.put("file_name","职称证");
|
||||
JSONArray json1 = new JSONArray();
|
||||
for(FileData f : file6) {
|
||||
JSONObject r1 = new JSONObject();
|
||||
String filename = "";
|
||||
String name1 = f.getFileObj().getName();
|
||||
if(name1.contains(".")) {
|
||||
filename = name1.split("\\.")[1];
|
||||
}
|
||||
if(filename.length() > 0) {
|
||||
r1.put("file_type",filename.toLowerCase());
|
||||
}else{
|
||||
r1.put("file_type",f.getFileObj().getType());
|
||||
}
|
||||
log.error("howec:::::::::xxxxx21:"+f.getFileObj().getName());
|
||||
log.error("howec:::::::::xxxxx1:"+f.getFileObj().getType());
|
||||
log.error("howec:::::::::xxxxx2:"+f.getLoadUrl());
|
||||
InputStream stream1 = f.getInputStream();
|
||||
byte[] a = getByteData(stream1);
|
||||
r1.put("filebytes",a);
|
||||
json1.add(r1);
|
||||
}
|
||||
rs1.put("filebytes_array",json1);
|
||||
array1.add(rs1);
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(file7)) {
|
||||
JSONObject rs1 = new JSONObject();
|
||||
rs1.put("file_name","执业资格证");
|
||||
JSONArray json1 = new JSONArray();
|
||||
for(FileData f : file7) {
|
||||
JSONObject r1 = new JSONObject();
|
||||
String filename = "";
|
||||
String name1 = f.getFileObj().getName();
|
||||
if(name1.contains(".")) {
|
||||
filename = name1.split("\\.")[1];
|
||||
}
|
||||
if(filename.length() > 0) {
|
||||
r1.put("file_type",filename.toLowerCase());
|
||||
}else{
|
||||
r1.put("file_type",f.getFileObj().getType());
|
||||
}
|
||||
log.error("howec:::::::::xxxxx21:"+f.getFileObj().getName());
|
||||
log.error("howec:::::::::xxxxx1:"+f.getFileObj().getType());
|
||||
log.error("howec:::::::::xxxxx2:"+f.getLoadUrl());
|
||||
InputStream stream1 = f.getInputStream();
|
||||
byte[] a = getByteData(stream1);
|
||||
r1.put("filebytes",a);
|
||||
json1.add(r1);
|
||||
}
|
||||
rs1.put("filebytes_array",json1);
|
||||
array1.add(rs1);
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(file8)) {
|
||||
JSONObject rs1 = new JSONObject();
|
||||
rs1.put("file_name","安全生产考核证");
|
||||
JSONArray json1 = new JSONArray();
|
||||
for(FileData f : file8) {
|
||||
JSONObject r1 = new JSONObject();
|
||||
String filename = "";
|
||||
String name1 = f.getFileObj().getName();
|
||||
if(name1.contains(".")) {
|
||||
filename = name1.split("\\.")[1];
|
||||
}
|
||||
if(filename.length() > 0) {
|
||||
r1.put("file_type",filename.toLowerCase());
|
||||
}else{
|
||||
r1.put("file_type",f.getFileObj().getType());
|
||||
}
|
||||
log.error("howec:::::::::xxxxx21:"+f.getFileObj().getName());
|
||||
log.error("howec:::::::::xxxxx1:"+f.getFileObj().getType());
|
||||
log.error("howec:::::::::xxxxx2:"+f.getLoadUrl());
|
||||
InputStream stream1 = f.getInputStream();
|
||||
byte[] a = getByteData(stream1);
|
||||
r1.put("filebytes",a);
|
||||
json1.add(r1);
|
||||
}
|
||||
rs1.put("filebytes_array",json1);
|
||||
array1.add(rs1);
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(file9)) {
|
||||
JSONObject rs1 = new JSONObject();
|
||||
rs1.put("file_name","身份证");
|
||||
JSONArray json1 = new JSONArray();
|
||||
for(FileData f : file9) {
|
||||
JSONObject r1 = new JSONObject();
|
||||
String filename = "";
|
||||
String name1 = f.getFileObj().getName();
|
||||
if(name1.contains(".")) {
|
||||
filename = name1.split("\\.")[1];
|
||||
}
|
||||
if(filename.length() > 0) {
|
||||
r1.put("file_type",filename.toLowerCase());
|
||||
}else{
|
||||
r1.put("file_type",f.getFileObj().getType());
|
||||
}
|
||||
log.error("howec:::::::::xxxxx21:"+f.getFileObj().getName());
|
||||
log.error("howec:::::::::xxxxx1:"+f.getFileObj().getType());
|
||||
log.error("howec:::::::::xxxxx2:"+f.getLoadUrl());
|
||||
InputStream stream1 = f.getInputStream();
|
||||
byte[] a = getByteData(stream1);
|
||||
r1.put("filebytes",a);
|
||||
json1.add(r1);
|
||||
}
|
||||
rs1.put("filebytes_array",json1);
|
||||
array1.add(rs1);
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(file10)) {
|
||||
JSONObject rs1 = new JSONObject();
|
||||
rs1.put("file_name","近期免冠照片");
|
||||
JSONArray json1 = new JSONArray();
|
||||
for(FileData f : file10) {
|
||||
JSONObject r1 = new JSONObject();
|
||||
String filename = "";
|
||||
String name1 = f.getFileObj().getName();
|
||||
if(name1.contains(".")) {
|
||||
filename = name1.split("\\.")[1];
|
||||
}
|
||||
if(filename.length() > 0) {
|
||||
r1.put("file_type",filename.toLowerCase());
|
||||
}else{
|
||||
r1.put("file_type",f.getFileObj().getType());
|
||||
}
|
||||
log.error("howec:::::::::xxxxx21:"+f.getFileObj().getName());
|
||||
log.error("howec:::::::::xxxxx1:"+f.getFileObj().getType());
|
||||
log.error("howec:::::::::xxxxx2:"+f.getLoadUrl());
|
||||
InputStream stream1 = f.getInputStream();
|
||||
byte[] a = getByteData(stream1);
|
||||
r1.put("filebytes",a);
|
||||
json1.add(r1);
|
||||
}
|
||||
rs1.put("filebytes_array",json1);
|
||||
array1.add(rs1);
|
||||
}
|
||||
return array1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public byte[] getByteData(InputStream input) {
|
||||
try {
|
||||
return org.apache.commons.io.IOUtils.toByteArray(input);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<FileData> getDxDt(String id) {
|
||||
List<FileData> rs = new ArrayList<>();
|
||||
try {
|
||||
if(!"0".equals(id)) {
|
||||
String ids[] = id.split(",");
|
||||
for(String s1 : ids) {
|
||||
FileData file1 = fileDownloadService.downloadFile(Long.parseLong(s1));
|
||||
if(file1.getFileObj()!=null && file1.getInputStream()!=null) {
|
||||
rs.add(file1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("获取附件错误:"+e.getMessage());
|
||||
}
|
||||
return rs;
|
||||
}
|
||||
}
|
@ -0,0 +1,417 @@
|
||||
/**
|
||||
* @use附件重发 ---其他入职
|
||||
* @author 刘浩
|
||||
*/
|
||||
package com.weaver.seconddev.sxjg.esb;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.eteams.file.client.file.FileData;
|
||||
import com.weaver.file.ud.api.FileDownloadService;
|
||||
import com.weaver.seconddev.sxjg.config.EbDbDataSourceConfig;
|
||||
import com.weaver.seconddev.sxjg.config.EbDbDataSourceConfigResp;
|
||||
import com.weaver.seconddev.sxjg.util.NccApiUtil;
|
||||
import com.weaver.seconddev.sxjg.util.NccResultUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service("esb_errorresendqt_howe")
|
||||
public class ErrorfjResendToNccQt implements EsbServerlessRpcRemoteInterface {
|
||||
private static final Logger log = LoggerFactory.getLogger(ErrorfjResendToNccQt.class);
|
||||
private JdbcTemplate jdbcTemplate = new JdbcTemplate(EbDbDataSourceConfig.dbDataSource());
|
||||
private JdbcTemplate jdbcTemplateresp = new JdbcTemplate(EbDbDataSourceConfigResp.dbDataSource());
|
||||
|
||||
@Autowired
|
||||
private FileDownloadService fileDownloadService;
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
Map<String, Object> finresult = new HashMap<>();
|
||||
finresult.put("code",200);
|
||||
String idtype = (String) params.get("idtype");//证件类型
|
||||
String id = (String) params.get("id");//证件号码
|
||||
String rzid = (String) params.get("rzid");//入职id
|
||||
String collectid = (String) params.get("collectid");
|
||||
if (collectid == null || collectid.length() == 0) {
|
||||
finresult.put("code",500);
|
||||
finresult.put("msg","当前人员并未进行信息采集");
|
||||
return WeaResult.success(finresult);
|
||||
}
|
||||
String sql = "select ncc_pk from ft_ncczjlx where ncc_name = '"+idtype+"'";
|
||||
Map<String, Object> srrr = jdbcTemplateresp.queryForMap(sql);
|
||||
String idtypePk =(String) srrr.get("ncc_pk");
|
||||
try {
|
||||
//传附件
|
||||
log.error("howec:::::::传附件");
|
||||
JSONObject jsonObject2 = new JSONObject();
|
||||
jsonObject2.put("id",id);
|
||||
jsonObject2.put("idtype",idtypePk);
|
||||
JSONArray r11 = getFjByCollectId(collectid);
|
||||
if(r11.size() == 0) {
|
||||
return WeaResult.success(finresult);
|
||||
}
|
||||
jsonObject2.put("data",r11);
|
||||
NccApiUtil nccApiUtil = new NccApiUtil();
|
||||
nccApiUtil.init();
|
||||
String token = nccApiUtil.getToken();
|
||||
String url = nccApiUtil.getBaseUrl()+"nccloud/api/hrhi/openAPI/attachment/upload";
|
||||
String rs11 = nccApiUtil.doJsonPost(url,token,jsonObject2.toJSONString());
|
||||
NccResultUtil rs = new NccResultUtil(rs11);
|
||||
if(rs.getResult()){
|
||||
sql = "update uf_rcrt_entry_manage_qtry set fjtbsfyc = '0' where id = "+rzid;
|
||||
jdbcTemplate.execute(sql);
|
||||
return WeaResult.success(finresult);
|
||||
}else {
|
||||
finresult.put("code",500);
|
||||
finresult.put("msg",rs.getDescription());
|
||||
return WeaResult.success(finresult);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
finresult.put("code",500);
|
||||
finresult.put("msg",e.getMessage());
|
||||
return WeaResult.success(finresult);
|
||||
}
|
||||
}
|
||||
|
||||
private JSONArray getFjByCollectId(String collectid) {
|
||||
JSONArray array1 = new JSONArray();
|
||||
String sql = "select dyxlxlzxwz,dexlxlzxwz,dsxlxlzxwz,dsixlxlzxwz,gwz,zcz,zyzgz,aqsckhz,jqmgzp,sfzzp from uf_rcrt_entry_collect_qtry where id = "+collectid;
|
||||
Map<String, Object> map = jdbcTemplate.queryForMap(sql);
|
||||
String dyxlxlzxwz = map.get("dyxlxlzxwz") == null ? "0" : (String)map.get("dyxlxlzxwz");
|
||||
String dexlxlzxwz = map.get("dexlxlzxwz") == null ? "0" : (String)map.get("dexlxlzxwz");
|
||||
String dsxlxlzxwz = map.get("dsxlxlzxwz") == null ? "0" : (String)map.get("dsxlxlzxwz");
|
||||
String dsixlxlzxwz = map.get("dsixlxlzxwz") == null ? "0" : (String)map.get("dsixlxlzxwz");
|
||||
String gwz = map.get("gwz") == null ? "0" : (String)map.get("gwz");
|
||||
String zcz = map.get("zcz") == null ? "0" : (String)map.get("zcz");
|
||||
String zyzgz = map.get("zyzgz") == null ? "0" : (String)map.get("zyzgz");
|
||||
String aqsckhz = map.get("aqsckhz") == null ? "0" : (String)map.get("aqsckhz");
|
||||
String sfzzp = map.get("sfzzp") == null ? "0" : (String)map.get("sfzzp");
|
||||
String jqmgzp = map.get("jqmgzp") == null ? "0" : (String)map.get("jqmgzp");
|
||||
List<FileData> file1 = getDxDt(dyxlxlzxwz);//第一学历学历证学位证
|
||||
List<FileData> file2 =getDxDt(dexlxlzxwz);//第二学历学历证学位证
|
||||
List<FileData> file3 = getDxDt(dsxlxlzxwz);//第三学历学历证学位证
|
||||
List<FileData> file4 = getDxDt(dsixlxlzxwz);//第四学历学历证学位证
|
||||
List<FileData> file5 = getDxDt(gwz);//岗位证
|
||||
List<FileData> file6 = getDxDt(zcz);//职称证
|
||||
List<FileData> file7 = getDxDt(zyzgz);//执业资格证
|
||||
List<FileData> file8 = getDxDt(aqsckhz);//安全生产考核证
|
||||
List<FileData> file9 = getDxDt(sfzzp);//身份证
|
||||
List<FileData> file10 = getDxDt(jqmgzp);//近期免冠照片
|
||||
if(CollectionUtil.isNotEmpty(file1)) {
|
||||
JSONObject rs1 = new JSONObject();
|
||||
rs1.put("file_name","第一学历学历证学位证");
|
||||
JSONArray json1 = new JSONArray();
|
||||
for(FileData f : file1) {
|
||||
JSONObject r1 = new JSONObject();
|
||||
String filename = "";
|
||||
String name1 = f.getFileObj().getName();
|
||||
log.error("name::::::"+name1);
|
||||
if(name1.contains(".")) {
|
||||
filename = name1.split("\\.")[1];
|
||||
}
|
||||
if(filename.length() > 0) {
|
||||
r1.put("file_type",filename.toLowerCase());
|
||||
}else{
|
||||
r1.put("file_type",f.getFileObj().getType());
|
||||
}
|
||||
log.error("howec:::::::::xxxxx21:"+f.getFileObj().getName());
|
||||
log.error("howec:::::::::xxxxx1:"+f.getFileObj().getType());
|
||||
log.error("howec:::::::::xxxxx2:"+f.getLoadUrl());
|
||||
InputStream stream1 = f.getInputStream();
|
||||
byte[] a = getByteData(stream1);
|
||||
r1.put("filebytes",a);
|
||||
json1.add(r1);
|
||||
}
|
||||
rs1.put("filebytes_array",json1);
|
||||
array1.add(rs1);
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(file2)) {
|
||||
JSONObject rs1 = new JSONObject();
|
||||
rs1.put("file_name","第二学历学历证学位证");
|
||||
JSONArray json1 = new JSONArray();
|
||||
for(FileData f : file2) {
|
||||
JSONObject r1 = new JSONObject();
|
||||
String filename = "";
|
||||
String name1 = f.getFileObj().getName();
|
||||
if(name1.contains(".")) {
|
||||
filename = name1.split("\\.")[1];
|
||||
}
|
||||
if(filename.length() > 0) {
|
||||
r1.put("file_type",filename.toLowerCase());
|
||||
}else{
|
||||
r1.put("file_type",f.getFileObj().getType());
|
||||
}
|
||||
log.error("howec:::::::::xxxxx21:"+f.getFileObj().getName());
|
||||
log.error("howec:::::::::xxxxx1:"+f.getFileObj().getType());
|
||||
log.error("howec:::::::::xxxxx2:"+f.getLoadUrl());
|
||||
InputStream stream1 = f.getInputStream();
|
||||
byte[] a = getByteData(stream1);
|
||||
r1.put("filebytes",a);
|
||||
json1.add(r1);
|
||||
}
|
||||
rs1.put("filebytes_array",json1);
|
||||
array1.add(rs1);
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(file3)) {
|
||||
JSONObject rs1 = new JSONObject();
|
||||
rs1.put("file_name","第三学历学历证学位证");
|
||||
JSONArray json1 = new JSONArray();
|
||||
for(FileData f : file3) {
|
||||
JSONObject r1 = new JSONObject();
|
||||
String filename = "";
|
||||
String name1 = f.getFileObj().getName();
|
||||
if(name1.contains(".")) {
|
||||
filename = name1.split("\\.")[1];
|
||||
}
|
||||
if(filename.length() > 0) {
|
||||
r1.put("file_type",filename.toLowerCase());
|
||||
}else{
|
||||
r1.put("file_type",f.getFileObj().getType());
|
||||
}
|
||||
log.error("howec:::::::::xxxxx21:"+f.getFileObj().getName());
|
||||
log.error("howec:::::::::xxxxx1:"+f.getFileObj().getType());
|
||||
log.error("howec:::::::::xxxxx2:"+f.getLoadUrl());
|
||||
InputStream stream1 = f.getInputStream();
|
||||
byte[] a = getByteData(stream1);
|
||||
r1.put("filebytes",a);
|
||||
json1.add(r1);
|
||||
}
|
||||
rs1.put("filebytes_array",json1);
|
||||
array1.add(rs1);
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(file4)) {
|
||||
JSONObject rs1 = new JSONObject();
|
||||
rs1.put("file_name","第四学历学历证学位证");
|
||||
JSONArray json1 = new JSONArray();
|
||||
for(FileData f : file4) {
|
||||
JSONObject r1 = new JSONObject();
|
||||
String filename = "";
|
||||
String name1 = f.getFileObj().getName();
|
||||
if(name1.contains(".")) {
|
||||
filename = name1.split("\\.")[1];
|
||||
}
|
||||
if(filename.length() > 0) {
|
||||
r1.put("file_type",filename.toLowerCase());
|
||||
}else{
|
||||
r1.put("file_type",f.getFileObj().getType());
|
||||
}
|
||||
log.error("howec:::::::::xxxxx21:"+f.getFileObj().getName());
|
||||
log.error("howec:::::::::xxxxx1:"+f.getFileObj().getType());
|
||||
log.error("howec:::::::::xxxxx2:"+f.getLoadUrl());
|
||||
InputStream stream1 = f.getInputStream();
|
||||
byte[] a = getByteData(stream1);
|
||||
r1.put("filebytes",a);
|
||||
json1.add(r1);
|
||||
}
|
||||
rs1.put("filebytes_array",json1);
|
||||
array1.add(rs1);
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(file5)) {
|
||||
JSONObject rs1 = new JSONObject();
|
||||
rs1.put("file_name","岗位证");
|
||||
JSONArray json1 = new JSONArray();
|
||||
for(FileData f : file5) {
|
||||
JSONObject r1 = new JSONObject();
|
||||
String filename = "";
|
||||
String name1 = f.getFileObj().getName();
|
||||
if(name1.contains(".")) {
|
||||
filename = name1.split("\\.")[1];
|
||||
}
|
||||
if(filename.length() > 0) {
|
||||
r1.put("file_type",filename.toLowerCase());
|
||||
}else{
|
||||
r1.put("file_type",f.getFileObj().getType());
|
||||
}
|
||||
log.error("howec:::::::::xxxxx21:"+f.getFileObj().getName());
|
||||
log.error("howec:::::::::xxxxx1:"+f.getFileObj().getType());
|
||||
log.error("howec:::::::::xxxxx2:"+f.getLoadUrl());
|
||||
InputStream stream1 = f.getInputStream();
|
||||
byte[] a = getByteData(stream1);
|
||||
r1.put("filebytes",a);
|
||||
json1.add(r1);
|
||||
}
|
||||
rs1.put("filebytes_array",json1);
|
||||
array1.add(rs1);
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(file6)) {
|
||||
JSONObject rs1 = new JSONObject();
|
||||
rs1.put("file_name","职称证");
|
||||
JSONArray json1 = new JSONArray();
|
||||
for(FileData f : file6) {
|
||||
JSONObject r1 = new JSONObject();
|
||||
String filename = "";
|
||||
String name1 = f.getFileObj().getName();
|
||||
if(name1.contains(".")) {
|
||||
filename = name1.split("\\.")[1];
|
||||
}
|
||||
if(filename.length() > 0) {
|
||||
r1.put("file_type",filename.toLowerCase());
|
||||
}else{
|
||||
r1.put("file_type",f.getFileObj().getType());
|
||||
}
|
||||
log.error("howec:::::::::xxxxx21:"+f.getFileObj().getName());
|
||||
log.error("howec:::::::::xxxxx1:"+f.getFileObj().getType());
|
||||
log.error("howec:::::::::xxxxx2:"+f.getLoadUrl());
|
||||
InputStream stream1 = f.getInputStream();
|
||||
byte[] a = getByteData(stream1);
|
||||
r1.put("filebytes",a);
|
||||
json1.add(r1);
|
||||
}
|
||||
rs1.put("filebytes_array",json1);
|
||||
array1.add(rs1);
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(file7)) {
|
||||
JSONObject rs1 = new JSONObject();
|
||||
rs1.put("file_name","执业资格证");
|
||||
JSONArray json1 = new JSONArray();
|
||||
for(FileData f : file7) {
|
||||
JSONObject r1 = new JSONObject();
|
||||
String filename = "";
|
||||
String name1 = f.getFileObj().getName();
|
||||
if(name1.contains(".")) {
|
||||
filename = name1.split("\\.")[1];
|
||||
}
|
||||
if(filename.length() > 0) {
|
||||
r1.put("file_type",filename.toLowerCase());
|
||||
}else{
|
||||
r1.put("file_type",f.getFileObj().getType());
|
||||
}
|
||||
log.error("howec:::::::::xxxxx21:"+f.getFileObj().getName());
|
||||
log.error("howec:::::::::xxxxx1:"+f.getFileObj().getType());
|
||||
log.error("howec:::::::::xxxxx2:"+f.getLoadUrl());
|
||||
InputStream stream1 = f.getInputStream();
|
||||
byte[] a = getByteData(stream1);
|
||||
r1.put("filebytes",a);
|
||||
json1.add(r1);
|
||||
}
|
||||
rs1.put("filebytes_array",json1);
|
||||
array1.add(rs1);
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(file8)) {
|
||||
JSONObject rs1 = new JSONObject();
|
||||
rs1.put("file_name","安全生产考核证");
|
||||
JSONArray json1 = new JSONArray();
|
||||
for(FileData f : file8) {
|
||||
JSONObject r1 = new JSONObject();
|
||||
String filename = "";
|
||||
String name1 = f.getFileObj().getName();
|
||||
if(name1.contains(".")) {
|
||||
filename = name1.split("\\.")[1];
|
||||
}
|
||||
if(filename.length() > 0) {
|
||||
r1.put("file_type",filename.toLowerCase());
|
||||
}else{
|
||||
r1.put("file_type",f.getFileObj().getType());
|
||||
}
|
||||
log.error("howec:::::::::xxxxx21:"+f.getFileObj().getName());
|
||||
log.error("howec:::::::::xxxxx1:"+f.getFileObj().getType());
|
||||
log.error("howec:::::::::xxxxx2:"+f.getLoadUrl());
|
||||
InputStream stream1 = f.getInputStream();
|
||||
byte[] a = getByteData(stream1);
|
||||
r1.put("filebytes",a);
|
||||
json1.add(r1);
|
||||
}
|
||||
rs1.put("filebytes_array",json1);
|
||||
array1.add(rs1);
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(file9)) {
|
||||
JSONObject rs1 = new JSONObject();
|
||||
rs1.put("file_name","身份证");
|
||||
JSONArray json1 = new JSONArray();
|
||||
for(FileData f : file9) {
|
||||
JSONObject r1 = new JSONObject();
|
||||
String filename = "";
|
||||
String name1 = f.getFileObj().getName();
|
||||
if(name1.contains(".")) {
|
||||
filename = name1.split("\\.")[1];
|
||||
}
|
||||
if(filename.length() > 0) {
|
||||
r1.put("file_type",filename.toLowerCase());
|
||||
}else{
|
||||
r1.put("file_type",f.getFileObj().getType());
|
||||
}
|
||||
log.error("howec:::::::::xxxxx21:"+f.getFileObj().getName());
|
||||
log.error("howec:::::::::xxxxx1:"+f.getFileObj().getType());
|
||||
log.error("howec:::::::::xxxxx2:"+f.getLoadUrl());
|
||||
InputStream stream1 = f.getInputStream();
|
||||
byte[] a = getByteData(stream1);
|
||||
r1.put("filebytes",a);
|
||||
json1.add(r1);
|
||||
}
|
||||
rs1.put("filebytes_array",json1);
|
||||
array1.add(rs1);
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(file10)) {
|
||||
JSONObject rs1 = new JSONObject();
|
||||
rs1.put("file_name","近期免冠照片");
|
||||
JSONArray json1 = new JSONArray();
|
||||
for(FileData f : file10) {
|
||||
JSONObject r1 = new JSONObject();
|
||||
String filename = "";
|
||||
String name1 = f.getFileObj().getName();
|
||||
if(name1.contains(".")) {
|
||||
filename = name1.split("\\.")[1];
|
||||
}
|
||||
if(filename.length() > 0) {
|
||||
r1.put("file_type",filename.toLowerCase());
|
||||
}else{
|
||||
r1.put("file_type",f.getFileObj().getType());
|
||||
}
|
||||
log.error("howec:::::::::xxxxx21:"+f.getFileObj().getName());
|
||||
log.error("howec:::::::::xxxxx1:"+f.getFileObj().getType());
|
||||
log.error("howec:::::::::xxxxx2:"+f.getLoadUrl());
|
||||
InputStream stream1 = f.getInputStream();
|
||||
byte[] a = getByteData(stream1);
|
||||
r1.put("filebytes",a);
|
||||
json1.add(r1);
|
||||
}
|
||||
rs1.put("filebytes_array",json1);
|
||||
array1.add(rs1);
|
||||
}
|
||||
return array1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public byte[] getByteData(InputStream input) {
|
||||
try {
|
||||
return org.apache.commons.io.IOUtils.toByteArray(input);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<FileData> getDxDt(String id) {
|
||||
List<FileData> rs = new ArrayList<>();
|
||||
try {
|
||||
if(!"0".equals(id)) {
|
||||
String ids[] = id.split(",");
|
||||
for(String s1 : ids) {
|
||||
FileData file1 = fileDownloadService.downloadFile(Long.parseLong(s1));
|
||||
if(file1.getFileObj()!=null && file1.getInputStream()!=null) {
|
||||
rs.add(file1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("获取附件错误:"+e.getMessage());
|
||||
}
|
||||
return rs;
|
||||
}
|
||||
}
|
@ -0,0 +1,142 @@
|
||||
package com.weaver.seconddev.sxjg.esb;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.sxjg.config.EbDbDataSourceConfig;
|
||||
import com.weaver.seconddev.sxjg.config.EbDbDataSourceConfigResp;
|
||||
import com.weaver.seconddev.sxjg.util.NccApiUtil;
|
||||
import com.weaver.seconddev.sxjg.util.NccResultUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 法人单位报道定调薪
|
||||
*/
|
||||
@Service("esb_Frcompanyapply_howe")
|
||||
public class FrCompanyApplyToNcc implements EsbServerlessRpcRemoteInterface {
|
||||
private static final Logger log = LoggerFactory.getLogger(FrCompanyApplyToNcc.class);
|
||||
private JdbcTemplate jdbcTemplateresp = new JdbcTemplate(EbDbDataSourceConfigResp.dbDataSource());
|
||||
|
||||
private JdbcTemplate jdbcTemplate = new JdbcTemplate(EbDbDataSourceConfig.dbDataSource());
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
Map<String, Object> finresult = new HashMap<>();
|
||||
finresult.put("code",200);
|
||||
String pk_dept = (String) params.get("pk_dept");
|
||||
String pk_jobgrade = (String) params.get("pk_jobgrade");
|
||||
String jobglbdef1 = (String) params.get("jobglbdef1");
|
||||
String joinworkdate = (String) params.get("joinworkdate");
|
||||
String pk_org = (String) params.get("pk_org");
|
||||
String bsid = (String)params.get("bsid");
|
||||
String username = (String)params.get("username");
|
||||
String usercode = (String)params.get("usercode");
|
||||
String applyer = (String) params.get("applyer");
|
||||
String usedate = (String) params.get("usedate");
|
||||
String zryda = (String) params.get("zryda");
|
||||
try {
|
||||
|
||||
//同步明细
|
||||
JSONObject r1 = new JSONObject();
|
||||
String state = "1";
|
||||
JSONArray array = getDataArray(bsid,username,usercode,usedate);
|
||||
if(array == null || array.size() == 0) {
|
||||
state = "0";
|
||||
}
|
||||
if(zryda.equals("是")) {
|
||||
if(array == null || array.size() == 0) {
|
||||
return WeaResult.success(finresult);
|
||||
}
|
||||
state = "2";
|
||||
}
|
||||
r1.put("pk_psndoc",applyer);
|
||||
r1.put("state",state);
|
||||
r1.put("pk_dept",pk_dept);
|
||||
r1.put("pk_jobgrade",pk_jobgrade);
|
||||
r1.put("jobglbdef1",jobglbdef1);
|
||||
r1.put("joinworkdate",joinworkdate);
|
||||
r1.put("pk_org",pk_org);
|
||||
r1.put("data",array);
|
||||
NccApiUtil nccApiUtil = new NccApiUtil();
|
||||
nccApiUtil.init();
|
||||
String token = nccApiUtil.getToken();
|
||||
String url = nccApiUtil.getBaseUrl()+"nccloud/api/hrwa/customermanage/adjust/import";
|
||||
String rs11 = nccApiUtil.doJsonPost(url,token,r1.toJSONString());
|
||||
NccResultUtil rs = new NccResultUtil(rs11);
|
||||
if(rs.getResult()) {
|
||||
return WeaResult.success(finresult);
|
||||
}else {
|
||||
finresult.put("code",500);
|
||||
finresult.put("msg",rs.getDescription());
|
||||
return WeaResult.success(finresult);
|
||||
}
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
finresult.put("code",500);
|
||||
finresult.put("msg",e.getMessage());
|
||||
log.error("howec:::::::::1:"+e.getMessage());
|
||||
return WeaResult.success(finresult);
|
||||
}
|
||||
}
|
||||
|
||||
private JSONArray getDataArray(String bsid,String username,String usercode,String usedate) {
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
String sql = "select dataid from wfc_form_data wfd where requestid = "+bsid;
|
||||
Map<String, Object> rs = jdbcTemplateresp.queryForMap(sql);
|
||||
long dataid = (long)rs.get("dataid");
|
||||
sql = "select waitem,xzxmmc,pk_wa_crt,negotiation,wa_seclv,money,memo from ft_frdw_bddtx where FORM_DATA_ID = "+dataid+" and tbddzwh = '1'";
|
||||
log.error("howec::::::::3"+sql);
|
||||
List<Map<String, Object>> rs1 = jdbcTemplateresp.queryForList(sql);
|
||||
if(CollectionUtil.isNotEmpty(rs1)) {
|
||||
for(Map<String,Object> r : rs1) {
|
||||
String xzxmmc = (String)r.get("xzxmmc");//薪资项目名称
|
||||
long negotiation = (long)r.get("negotiation");//谈判工资
|
||||
String xbdb = "";
|
||||
if(r.get("wa_seclv")!=null) {
|
||||
long id1 = (long)r.get("wa_seclv");
|
||||
if(id1 != 0l) {
|
||||
sql = "select levelname from uf_wa_prmlv where id = "+id1;
|
||||
Map<String,Object> rso= jdbcTemplate.queryForMap(sql);
|
||||
xbdb = (String)rso.get("levelname");
|
||||
}
|
||||
}
|
||||
String nmoney = "";
|
||||
if(r.get("waitem")!=null) {
|
||||
nmoney = (String)r.get("waitem");//金额
|
||||
}
|
||||
String memo=(String)r.get("memo");//备注
|
||||
//通过薪资标准表id获取薪资标准名称
|
||||
String pk_wa_crt_name = "";
|
||||
if(r.get("pk_wa_crt") != null) {
|
||||
long pk_wa_crt = (long)r.get("pk_wa_crt");//薪资标准表
|
||||
sql = "select name from uf_wa_grade where id = "+pk_wa_crt;
|
||||
Map<String,Object> rso= jdbcTemplate.queryForMap(sql);
|
||||
pk_wa_crt_name = (String)rso.get("name");
|
||||
}
|
||||
String negotiation_wage = negotiation == 0l ? "N" : "Y";
|
||||
JSONObject dataobj = new JSONObject();
|
||||
dataobj.put("negotiation_wage",negotiation_wage);
|
||||
dataobj.put("begindate",usedate);
|
||||
dataobj.put("wa_prmlv",xbdb);//薪资级别
|
||||
// dataobj.put("wa_seclv","");//薪档级别
|
||||
dataobj.put("nmoney",nmoney);
|
||||
dataobj.put("waflag","Y");
|
||||
dataobj.put("pk_wa_item_showname",xzxmmc);
|
||||
dataobj.put("pk_wa_grd_showname",pk_wa_crt_name);
|
||||
dataobj.put("psnCode",usercode);
|
||||
dataobj.put("psnName",username);
|
||||
dataobj.put("vnote",memo);
|
||||
jsonArray.add(dataobj);
|
||||
}
|
||||
}
|
||||
return jsonArray;
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.weaver.seconddev.sxjg.esb;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.sxjg.util.NccApiUtil;
|
||||
import com.weaver.seconddev.sxjg.util.NccResultUtil;
|
||||
import org.junit.Test;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 工资条查询ncc
|
||||
*/
|
||||
@Service("payslippagequery_howe")
|
||||
public class PayslipPageQuery implements EsbServerlessRpcRemoteInterface {
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void Test() throws Exception {
|
||||
JSONObject r1 = new JSONObject();
|
||||
JSONArray r2 = new JSONArray();
|
||||
JSONObject r3 = new JSONObject();
|
||||
r3.put("pk_psndoc","0001A2100000003FMWBU");
|
||||
r2.add(r3);
|
||||
r1.put("data",r2);
|
||||
|
||||
NccApiUtil nccApiUtil = new NccApiUtil();
|
||||
nccApiUtil.init();
|
||||
String token = nccApiUtil.getToken();
|
||||
String url = nccApiUtil.getBaseUrl()+"nccloud/api/hrtrn/openAPI/payslipSync/entry";
|
||||
String rs11 = nccApiUtil.doJsonPost(url,token,r1.toJSONString());
|
||||
System.out.println(rs11);
|
||||
}
|
||||
}
|
@ -0,0 +1,174 @@
|
||||
package com.weaver.seconddev.sxjg.esb;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.sxjg.config.EbDbDataSourceConfig;
|
||||
import com.weaver.seconddev.sxjg.config.EbDbDataSourceConfigResp;
|
||||
import com.weaver.seconddev.sxjg.util.NccApiUtil;
|
||||
import com.weaver.seconddev.sxjg.util.NccResultUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 人员调动流程toncc
|
||||
*/
|
||||
@Service("esb_PersonDdToNcc_howe")
|
||||
public class PersonDdToNcc implements EsbServerlessRpcRemoteInterface {
|
||||
private static final Logger log = LoggerFactory.getLogger(PersonDdToNcc.class);
|
||||
private JdbcTemplate jdbcTemplateresp = new JdbcTemplate(EbDbDataSourceConfigResp.dbDataSource());
|
||||
private JdbcTemplate jdbcTemplate = new JdbcTemplate(EbDbDataSourceConfig.dbDataSource());
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
Map<String, Object> finresult = new HashMap<>();
|
||||
finresult.put("code",200);
|
||||
String pk_org = (String) params.get("pk_org");//所属组织(调配后的组织)
|
||||
String pk_psndoc = (String) params.get("pk_psndoc");//员工pk值
|
||||
String begindate = (String) params.get("begindate");//开始时间
|
||||
String pk_psncl = (String) params.get("pk_psncl");//人员类别
|
||||
if(pk_psncl.contains("_")) {
|
||||
pk_psncl = pk_psncl.split("_")[1];
|
||||
}
|
||||
String pk_dept = (String) params.get("pk_dept");//部门pk
|
||||
String pk_post = (String) params.get("pk_post");//岗位
|
||||
String pk_postseries = (String) params.get("pk_postseries");//岗位序列
|
||||
String pk_job = (String) params.get("pk_job");//职务
|
||||
String pk_jobgrade = (String) params.get("pk_jobgrade");//职级
|
||||
String jobglbdef1 = (String) params.get("jobglbdef1");//职级开始时间
|
||||
String trnsreason = (String) params.get("trnsreason");//异动原因
|
||||
String memo = (String) params.get("memo");//备注
|
||||
String isSyncResume = (String) params.get("isSyncResume");//同步履历
|
||||
String isSyncPartTime = (String) params.get("isSyncPartTime");//结束兼职
|
||||
isSyncResume = "1".equals(isSyncResume) ? "Y" : "N";
|
||||
isSyncPartTime = "1".equals(isSyncPartTime) ? "Y" : "N";
|
||||
String bsid = (String)params.get("bsid");
|
||||
String username = (String)params.get("username");
|
||||
String usercode = (String)params.get("usercode");
|
||||
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
JSONObject obj1 = new JSONObject();
|
||||
obj1.put("pk_org",pk_org);
|
||||
obj1.put("pk_psndoc",pk_psndoc);
|
||||
obj1.put("begindate",begindate);
|
||||
obj1.put("pk_psncl",pk_psncl);
|
||||
obj1.put("pk_dept",pk_dept);
|
||||
obj1.put("pk_post",pk_post);
|
||||
obj1.put("pk_postseries",pk_postseries);
|
||||
obj1.put("pk_job",pk_job);
|
||||
obj1.put("pk_jobgrade",pk_jobgrade);
|
||||
obj1.put("jobglbdef1",jobglbdef1);
|
||||
obj1.put("trnsreason",trnsreason);
|
||||
obj1.put("memo",memo);
|
||||
obj1.put("isSyncResume",isSyncResume);
|
||||
obj1.put("isSyncPartTime",isSyncPartTime);
|
||||
jsonArray.add(obj1);
|
||||
jsonObject.put("data",jsonArray);
|
||||
try {
|
||||
NccApiUtil nccApiUtil = new NccApiUtil();
|
||||
nccApiUtil.init();
|
||||
String token = nccApiUtil.getToken();
|
||||
String url = nccApiUtil.getBaseUrl()+"nccloud/api/hrtrn/openAPI/transfer/sync";
|
||||
String rs11 = nccApiUtil.doJsonPost(url,token,jsonObject.toJSONString());
|
||||
NccResultUtil rs = new NccResultUtil(rs11);
|
||||
if(rs.getResult()) {
|
||||
//同步明细
|
||||
JSONObject r1 = new JSONObject();
|
||||
String state = "2";
|
||||
r1.put("state",state);
|
||||
r1.put("pk_org",pk_org);
|
||||
JSONArray array = getDataArray(bsid,username,usercode);
|
||||
if(array == null || array.size() == 0) {
|
||||
return WeaResult.success(finresult);
|
||||
}
|
||||
r1.put("data",array);
|
||||
nccApiUtil = new NccApiUtil();
|
||||
nccApiUtil.init();
|
||||
token = nccApiUtil.getToken();
|
||||
url = nccApiUtil.getBaseUrl()+"nccloud/api/hrwa/customermanage/adjust/import";
|
||||
rs11 = nccApiUtil.doJsonPost(url,token,r1.toJSONString());
|
||||
rs = new NccResultUtil(rs11);
|
||||
if(rs.getResult()) {
|
||||
return WeaResult.success(finresult);
|
||||
}else {
|
||||
finresult.put("code",500);
|
||||
finresult.put("msg",rs.getDescription());
|
||||
return WeaResult.success(finresult);
|
||||
}
|
||||
}else {
|
||||
finresult.put("code",500);
|
||||
finresult.put("msg",rs.getDescription());
|
||||
return WeaResult.success(finresult);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
finresult.put("code",500);
|
||||
finresult.put("msg",e.getMessage());
|
||||
log.error("howec:::::::::1:"+e.getMessage());
|
||||
return WeaResult.success(finresult);
|
||||
}
|
||||
}
|
||||
|
||||
private JSONArray getDataArray(String bsid,String username,String usercode) {
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
String sql = "select dataid from wfc_form_data wfd where requestid = "+bsid;
|
||||
Map<String, Object> rs = jdbcTemplateresp.queryForMap(sql);
|
||||
long dataid = (long)rs.get("dataid");
|
||||
sql = "select waitem,xzxmmc,pk_wa_crt,usedate,negotiation,wa_seclv,money,memo from hi_stapply_mxb2 where FORM_DATA_ID = "+dataid;
|
||||
log.error("howec::::::::3"+sql);
|
||||
List<Map<String, Object>> rs1 = jdbcTemplateresp.queryForList(sql);
|
||||
if(CollectionUtil.isNotEmpty(rs1)) {
|
||||
for(Map<String,Object> r : rs1) {
|
||||
String xzxmmc = (String)r.get("xzxmmc");//薪资项目名称
|
||||
String usedate = (String)r.get("usedate");//起薪日期
|
||||
long negotiation = (long)r.get("negotiation");//谈判工资
|
||||
String xbdb = "";
|
||||
if(r.get("wa_seclv")!=null) {
|
||||
long id1 = (long)r.get("wa_seclv");
|
||||
if(id1 != 0l) {
|
||||
sql = "select levelname from uf_wa_prmlv where id = "+id1;
|
||||
Map<String,Object> rso= jdbcTemplate.queryForMap(sql);
|
||||
xbdb = (String)rso.get("levelname");
|
||||
}
|
||||
}
|
||||
String nmoney = "";
|
||||
if(r.get("waitem")!=null) {
|
||||
nmoney = (String)r.get("waitem");//金额
|
||||
}
|
||||
String memo=(String)r.get("memo");//备注
|
||||
//通过薪资标准表id获取薪资标准名称
|
||||
String pk_wa_crt_name = "";
|
||||
if(r.get("pk_wa_crt") != null) {
|
||||
long pk_wa_crt = (long)r.get("pk_wa_crt");//薪资标准表
|
||||
sql = "select name from uf_wa_grade where id = "+pk_wa_crt;
|
||||
Map<String,Object> rso= jdbcTemplate.queryForMap(sql);
|
||||
pk_wa_crt_name = (String)rso.get("name");
|
||||
}
|
||||
String negotiation_wage = negotiation == 0l ? "N" : "Y";
|
||||
JSONObject dataobj = new JSONObject();
|
||||
dataobj.put("negotiation_wage",negotiation_wage);
|
||||
dataobj.put("begindate",usedate);
|
||||
dataobj.put("wa_prmlv",xbdb);//薪资级别
|
||||
// dataobj.put("wa_seclv","");//薪档级别
|
||||
dataobj.put("nmoney",nmoney);
|
||||
dataobj.put("waflag","Y");
|
||||
dataobj.put("pk_wa_item_showname",xzxmmc);
|
||||
dataobj.put("pk_wa_grd_showname",pk_wa_crt_name);
|
||||
dataobj.put("psnCode",usercode);
|
||||
dataobj.put("psnName",username);
|
||||
dataobj.put("vnote",memo);
|
||||
jsonArray.add(dataobj);
|
||||
}
|
||||
}
|
||||
return jsonArray;
|
||||
}
|
||||
}
|
@ -0,0 +1,159 @@
|
||||
package com.weaver.seconddev.sxjg.esb;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.sxjg.config.EbDbDataSourceConfig;
|
||||
import com.weaver.seconddev.sxjg.config.EbDbDataSourceConfigResp;
|
||||
import com.weaver.seconddev.sxjg.util.NccApiUtil;
|
||||
import com.weaver.seconddev.sxjg.util.NccResultUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 人员见习流程toncc
|
||||
*/
|
||||
@Service("esb_PersonJxToNcc_howe")
|
||||
public class PersonJxToNcc implements EsbServerlessRpcRemoteInterface {
|
||||
private static final Logger log = LoggerFactory.getLogger(PersonJxToNcc.class);
|
||||
private JdbcTemplate jdbcTemplateresp = new JdbcTemplate(EbDbDataSourceConfigResp.dbDataSource());
|
||||
private JdbcTemplate jdbcTemplate = new JdbcTemplate(EbDbDataSourceConfig.dbDataSource());
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
Map<String, Object> finresult = new HashMap<>();
|
||||
finresult.put("code",200);
|
||||
String pk_psndoc = (String) params.get("pk_psndoc");//人员主键
|
||||
String glbdef1 = (String) params.get("glbdef1");//是否见习
|
||||
String glbdef2 = (String) params.get("glbdef2");//见习期时长(月)
|
||||
String glbdef3 = (String) params.get("glbdef3");//转正日期
|
||||
String bsid = (String)params.get("bsid");
|
||||
String username = (String)params.get("username");
|
||||
String usercode = (String)params.get("usercode");
|
||||
String pk_org = (String) params.get("pk_org");
|
||||
|
||||
glbdef1 = glbdef1.equals("0") ? "N" : "Y";
|
||||
glbdef3 = formatTime(glbdef3);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("pk_psndoc",pk_psndoc);
|
||||
jsonObject.put("glbdef1",glbdef1);
|
||||
jsonObject.put("glbdef2",glbdef2);
|
||||
jsonObject.put("glbdef3",glbdef3);
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
jsonArray.add(jsonObject);
|
||||
try {
|
||||
NccApiUtil nccApiUtil = new NccApiUtil();
|
||||
nccApiUtil.init();
|
||||
String token = nccApiUtil.getToken();
|
||||
String url = nccApiUtil.getBaseUrl()+"nccloud/api/hrhi/openAPI/userinf/internshipinf";
|
||||
String rs11 = nccApiUtil.doJsonPost(url,token,jsonArray.toJSONString());
|
||||
NccResultUtil rs = new NccResultUtil(rs11);
|
||||
if(rs.getResult()) {
|
||||
//同步明细
|
||||
JSONObject r1 = new JSONObject();
|
||||
String state = "2";
|
||||
r1.put("state",state);
|
||||
r1.put("pk_org",pk_org);
|
||||
JSONArray array = getDataArray(bsid,username,usercode);
|
||||
if(array == null || array.size() == 0) {
|
||||
return WeaResult.success(finresult);
|
||||
}
|
||||
r1.put("data",array);
|
||||
nccApiUtil = new NccApiUtil();
|
||||
nccApiUtil.init();
|
||||
token = nccApiUtil.getToken();
|
||||
url = nccApiUtil.getBaseUrl()+"nccloud/api/hrwa/customermanage/adjust/import";
|
||||
rs11 = nccApiUtil.doJsonPost(url,token,r1.toJSONString());
|
||||
rs = new NccResultUtil(rs11);
|
||||
if(rs.getResult()) {
|
||||
return WeaResult.success(finresult);
|
||||
}else {
|
||||
finresult.put("code",500);
|
||||
finresult.put("msg",rs.getDescription());
|
||||
return WeaResult.success(finresult);
|
||||
}
|
||||
}else {
|
||||
finresult.put("code",500);
|
||||
finresult.put("msg",rs.getDescription());
|
||||
return WeaResult.success(finresult);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
finresult.put("code",500);
|
||||
finresult.put("msg",e.getMessage());
|
||||
log.error("howec:::::::::1:"+e.getMessage());
|
||||
return WeaResult.success(finresult);
|
||||
}
|
||||
}
|
||||
|
||||
private JSONArray getDataArray(String bsid, String username, String usercode) {
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
String sql = "select dataid from wfc_form_data wfd where requestid = "+bsid;
|
||||
Map<String, Object> rs = jdbcTemplateresp.queryForMap(sql);
|
||||
long dataid = (long)rs.get("dataid");
|
||||
sql = "select waitem,xzxmmc,pk_wa_crt,usedate,negotiation,wa_seclv,money,memo from hi_regapply_mxb1 where FORM_DATA_ID = "+dataid;
|
||||
log.error("howec::::::::3"+sql);
|
||||
List<Map<String, Object>> rs1 = jdbcTemplateresp.queryForList(sql);
|
||||
if(CollectionUtil.isNotEmpty(rs1)) {
|
||||
for(Map<String,Object> r : rs1) {
|
||||
String xzxmmc = (String)r.get("xzxmmc");//薪资项目名称
|
||||
String usedate = (String)r.get("usedate");//起薪日期
|
||||
long negotiation = (long)r.get("negotiation");//谈判工资
|
||||
String xbdb = "";
|
||||
if(r.get("wa_seclv")!=null) {
|
||||
long id1 = (long)r.get("wa_seclv");
|
||||
if(id1 != 0l) {
|
||||
sql = "select levelname from uf_wa_prmlv where id = "+id1;
|
||||
Map<String,Object> rso= jdbcTemplate.queryForMap(sql);
|
||||
xbdb = (String)rso.get("levelname");
|
||||
}
|
||||
}
|
||||
String nmoney = "";
|
||||
if(r.get("waitem")!=null) {
|
||||
nmoney = (String)r.get("waitem");//金额
|
||||
}
|
||||
String memo=(String)r.get("memo");//备注
|
||||
//通过薪资标准表id获取薪资标准名称
|
||||
String pk_wa_crt_name = "";
|
||||
if(r.get("pk_wa_crt") != null) {
|
||||
long pk_wa_crt = (long)r.get("pk_wa_crt");//薪资标准表
|
||||
sql = "select name from uf_wa_grade where id = "+pk_wa_crt;
|
||||
Map<String,Object> rso= jdbcTemplate.queryForMap(sql);
|
||||
pk_wa_crt_name = (String)rso.get("name");
|
||||
}
|
||||
String negotiation_wage = negotiation == 0l ? "N" : "Y";
|
||||
JSONObject dataobj = new JSONObject();
|
||||
dataobj.put("negotiation_wage",negotiation_wage);
|
||||
dataobj.put("begindate",usedate);
|
||||
dataobj.put("wa_prmlv",xbdb);//薪资级别
|
||||
dataobj.put("nmoney",nmoney);
|
||||
dataobj.put("waflag","Y");
|
||||
dataobj.put("pk_wa_item_showname",xzxmmc);
|
||||
dataobj.put("pk_wa_grd_showname",pk_wa_crt_name);
|
||||
dataobj.put("psnCode",usercode);
|
||||
dataobj.put("psnName",username);
|
||||
dataobj.put("vnote",memo);
|
||||
jsonArray.add(dataobj);
|
||||
}
|
||||
}
|
||||
return jsonArray;
|
||||
}
|
||||
|
||||
private String formatTime(String s) {
|
||||
if(s.length() == 0) {
|
||||
return "";
|
||||
}
|
||||
if(s.contains("-")) {
|
||||
s = s.replaceAll("-","");
|
||||
return s;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
package com.weaver.seconddev.sxjg.esb;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.weaver.common.base.entity.result.WeaResult;
|
||||
import com.weaver.esb.api.rpc.EsbServerlessRpcRemoteInterface;
|
||||
import com.weaver.seconddev.sxjg.util.NccApiUtil;
|
||||
import com.weaver.seconddev.sxjg.util.NccResultUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 人员离职同步ncc
|
||||
*/
|
||||
@Service("esb_PersonLzToNcc_howe")
|
||||
public class PersonLzToNcc implements EsbServerlessRpcRemoteInterface {
|
||||
private static final Logger log = LoggerFactory.getLogger(PersonLzToNcc.class);
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||
Map<String, Object> finresult = new HashMap<>();
|
||||
finresult.put("code",200);
|
||||
String pk_psndoc = (String) params.get("pk_psndoc");//人员主键
|
||||
String pk_org = (String) params.get("pk_org");//所属组织(调配后的组织)
|
||||
String begindate = (String) params.get("begindate");//开始时间
|
||||
String pk_psncl = (String) params.get("pk_psncl");//人员类别
|
||||
if(pk_psncl.contains("_")) {
|
||||
pk_psncl = pk_psncl.split("_")[1];
|
||||
}
|
||||
|
||||
String pk_dept = (String) params.get("pk_dept");//部门
|
||||
String pk_post = (String) params.get("pk_post");//岗位
|
||||
String pk_postseries = (String) params.get("pk_postseries");//岗位序列
|
||||
String pk_job = (String) params.get("pk_job");//职务
|
||||
String pk_jobgrade = (String) params.get("pk_jobgrade");//职级
|
||||
String jobglbdef1 = (String) params.get("jobglbdef1");//职级开始时间
|
||||
String trnsreason = (String) params.get("trnsreason");//异动原因
|
||||
String memo = (String) params.get("memo");//备注
|
||||
JSONArray array = new JSONArray();
|
||||
JSONObject rs = new JSONObject();
|
||||
rs.put("pk_psndoc",pk_psndoc);
|
||||
rs.put("pk_org",pk_org);
|
||||
rs.put("begindate",begindate);
|
||||
rs.put("pk_psncl",pk_psncl);
|
||||
rs.put("pk_dept",pk_dept);
|
||||
rs.put("pk_post",pk_post);
|
||||
rs.put("pk_postseries",pk_postseries);
|
||||
rs.put("pk_job",pk_job);
|
||||
rs.put("pk_jobgrade",pk_jobgrade);
|
||||
rs.put("jobglbdef1",jobglbdef1);
|
||||
rs.put("trnsreason",trnsreason);
|
||||
rs.put("memo",memo);
|
||||
array.add(rs);
|
||||
JSONObject finalrs = new JSONObject();
|
||||
finalrs.put("data",array);
|
||||
try {
|
||||
NccApiUtil nccApiUtil = new NccApiUtil();
|
||||
nccApiUtil.init();
|
||||
String token = nccApiUtil.getToken();
|
||||
String url = nccApiUtil.getBaseUrl()+"nccloud/api/hrtrn/openAPI/dimissionSync/entry";
|
||||
String rs11 = nccApiUtil.doJsonPost(url,token,finalrs.toJSONString());
|
||||
NccResultUtil rs2 = new NccResultUtil(rs11);
|
||||
if(rs2.getResult()) {
|
||||
return WeaResult.success(finresult);
|
||||
}else {
|
||||
finresult.put("code",500);
|
||||
finresult.put("msg",rs2.getDescription());
|
||||
return WeaResult.success(finresult);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
finresult.put("code",500);
|
||||
finresult.put("msg",e.getMessage());
|
||||
log.error("howec:::::::::1:"+e.getMessage());
|
||||
return WeaResult.success(finresult);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.weaver.seconddev.sxjg.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
public class NccResultUtil {
|
||||
private Boolean result;
|
||||
private String description;
|
||||
|
||||
public NccResultUtil(String rs) {
|
||||
JSONObject rs1 = JSONObject.parseObject(rs);
|
||||
if(rs1.getBoolean("success")) {
|
||||
if("1000000000".equals(rs1.getString("code"))) {
|
||||
this.setResult(true);
|
||||
}else {
|
||||
this.setResult(false);
|
||||
this.setDescription(rs1.getString("message"));
|
||||
}
|
||||
}else {
|
||||
this.setResult(false);
|
||||
this.setDescription(rs1.getString("message"));
|
||||
}
|
||||
}
|
||||
|
||||
public Boolean getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(Boolean result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package com.weaver.seconddev.sxjg.util;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Base64;
|
||||
|
||||
import cn.com.infosec.netsign.agent.util.IOUtils;
|
||||
import com.google.gson.Gson;
|
||||
public class Test {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
System.out.println(1);
|
||||
InputStream inputStream = getInputStreamByUrl("http://10.73.4.5:20600/papi/file/local/download/897827c9a77c4199b629cc1d7b848b52?tenantKey=tl2qvzz346&response-expires=V2VkIERlYyAyNyAxNDo0NzozOSBDU1QgMjAyMw==&response-content-disposition=YXR0YWNobWVudDtmaWxlbmFtZT0i5paw5bu6IOaWh-acrOaWh-ahoyAoNCkudHh0Ig==&download=MA==");
|
||||
System.out.println("2222222222222222222222222222");
|
||||
byte[] fileBytesArray = null;
|
||||
fileBytesArray = readBytesFromInputStream(inputStream);
|
||||
System.out.println("3333333333333");
|
||||
String jsonResult = convertToJson("filename", fileBytesArray);
|
||||
System.out.println(jsonResult);
|
||||
}
|
||||
|
||||
public static InputStream getInputStreamByUrl(String strUrl) {
|
||||
System.out.println("11111111");
|
||||
HttpURLConnection conn = null;
|
||||
try {
|
||||
URL url = new URL(strUrl);
|
||||
conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("GET");
|
||||
conn.setConnectTimeout(20 * 1000);
|
||||
final ByteArrayOutputStream output = new ByteArrayOutputStream();
|
||||
IOUtils.copy(conn.getInputStream(), output);
|
||||
return new ByteArrayInputStream(output.toByteArray());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (conn != null) {
|
||||
conn.disconnect();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static byte[] readBytesFromInputStream(InputStream input) {
|
||||
System.out.println("111111111111111");
|
||||
try {
|
||||
System.out.println("2222222222222222");
|
||||
return org.apache.commons.io.IOUtils.toByteArray(input);
|
||||
} catch (IOException e) {
|
||||
System.out.println("2222222");
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static String convertToJson(String fileName, byte[] fileBytesArray) {
|
||||
Gson gson = new Gson();
|
||||
String jsonResult = gson.toJson(new FileData(fileName, fileBytesArray));
|
||||
return jsonResult;
|
||||
}
|
||||
|
||||
static class FileData {
|
||||
private String file_name;
|
||||
private byte[] filebytes_array;
|
||||
|
||||
public FileData(String file_name, byte[] filebytes_array) {
|
||||
this.file_name = file_name;
|
||||
this.filebytes_array = filebytes_array;
|
||||
}
|
||||
|
||||
public String getFile_name() {
|
||||
return file_name;
|
||||
}
|
||||
|
||||
public void setFile_name(String file_name) {
|
||||
this.file_name = file_name;
|
||||
}
|
||||
|
||||
public byte[] getFilebytes_array() {
|
||||
return filebytes_array;
|
||||
}
|
||||
|
||||
public void setFilebytes_array(byte[] filebytes_array) {
|
||||
this.filebytes_array = filebytes_array;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
#测试
|
||||
sxjgncc.url=http://10.72.2.28:7000/
|
||||
sxjgncc.biz_center=NCC0826
|
||||
sxjgncc.client_id=webfw
|
||||
sxjgncc.client_secret=0169ae6c2ac54591b324
|
||||
sxjgncc.public_key=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnzizIsSZFLi/Z14ah/GztvQgRpdxAi5+u8dgXfXFQuOgC0r1a0d3Mol6BOYqTDqE7zHGl45iglRasZ0i87/DJ5PaDq5aP0hA5oTLaOSWg2Ux94sVPzBP3xd4Vpij57hIg2t11Uku8VqhuHPM4DY1nDZEzfJwIDSpkcrlLGQKoQaCVduZzNm6uZR0Q0EcGjhi3EeT2wgSVsxzaw3UHUO9cKh4Bf9Yb1cy+yvRj8SyOveCqtYbBWzuxXERESPKS6ftTbCqh7dkx2CqXsoPCo5a0Yobikz/6Bdw3qk0sEU4A04Y4hYZPslNzzqzY7snn5KsQRd2vcYKtsyOxTMuM5HoAQIDAQAB
|
||||
sxjgncc.b1=uf_rcrt_entry1098
|
||||
sxjgncc.b2=uf_rcrt_entry1154
|
||||
sxjgncc.b3=uf_rcrt_entry1252
|
||||
sxjgncc.b4=uf_rcrt_entry1297
|
||||
sxjgncc.b5=uf_rcrt_entry1354
|
||||
sxjgncc.b6=uf_rcrt_entry1404
|
||||
sxjgncc.b7=uf_rcrt_entry1452
|
||||
sxjgncc.b8=uf_rcrt_entry1498
|
||||
sxjgncc.b9=uf_rcrt_entry1561
|
||||
sxjgncc.b10=uf_rcrt_entry1615
|
||||
sxjgncc.b11=uf_rcrt_entry1662
|
||||
#子企业内部调配报到联系单定薪表
|
||||
sxjgncc.b12=ft_zqynbdpbdl6098
|
||||
#职工报到联系单-总部定薪表
|
||||
sxjgncc.b13=ft_staff_bdlxd_t1
|
||||
#职工内部调配联系单-总部定薪表
|
||||
sxjgncc.b14=ft_staff_nbbdlxd_t1
|
||||
#生产
|
||||
#sxjgncc.url=http://10.71.2.46:6007/
|
||||
#sxjgncc.biz_center=NCC0826
|
||||
#sxjgncc.client_id=webfw
|
||||
#sxjgncc.client_secret=0169ae6c2ac54591b324
|
||||
#sxjgncc.public_key=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnzizIsSZFLi/Z14ah/GztvQgRpdxAi5+u8dgXfXFQuOgC0r1a0d3Mol6BOYqTDqE7zHGl45iglRasZ0i87/DJ5PaDq5aP0hA5oTLaOSWg2Ux94sVPzBP3xd4Vpij57hIg2t11Uku8VqhuHPM4DY1nDZEzfJwIDSpkcrlLGQKoQaCVduZzNm6uZR0Q0EcGjhi3EeT2wgSVsxzaw3UHUO9cKh4Bf9Yb1cy+yvRj8SyOveCqtYbBWzuxXERESPKS6ftTbCqh7dkx2CqXsoPCo5a0Yobikz/6Bdw3qk0sEU4A04Y4hYZPslNzzqzY7snn5KsQRd2vcYKtsyOxTMuM5HoAQIDAQAB
|
||||
#sxjgncc.b1=uf_rcrt_entry0210
|
||||
#sxjgncc.b2=uf_rcrt_entry0277
|
||||
#sxjgncc.b3=uf_rcrt_entry0430
|
||||
#sxjgncc.b4=uf_rcrt_entry0520
|
||||
#sxjgncc.b5=uf_rcrt_entry0594
|
||||
#sxjgncc.b6=uf_rcrt_entry0672
|
||||
#sxjgncc.b7=uf_rcrt_entry0745
|
||||
#sxjgncc.b8=uf_rcrt_entry0814
|
||||
#sxjgncc.b9=uf_rcrt_entry0880
|
||||
#sxjgncc.b10=uf_rcrt_entry0948
|
||||
#sxjgncc.b11=uf_rcrt_entry1024
|
Loading…
Reference in New Issue