#chabaodao-5# 集成统一提交
This commit is contained in:
parent
65161e83e0
commit
b0be700da4
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.weaver.seconddev.chapanda.beisen.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.weaver.common.authority.annotation.WeaPermission;
|
||||||
|
import com.weaver.common.base.entity.result.WeaResult;
|
||||||
|
import com.weaver.seconddev.chapanda.beisen.service.ConvertOrganizationService;
|
||||||
|
import com.weaver.seconddev.chapanda.beisen.util.CommonUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/sapi/secondev/cbdhr/hrm")
|
||||||
|
public class ConvertOrganizationController {
|
||||||
|
|
||||||
|
private final Logger log = LoggerFactory.getLogger(ConvertOrganizationController.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ConvertOrganizationService convertOrganizationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CommonUtils CommonUtils;
|
||||||
|
|
||||||
|
@WeaPermission(publicPermission = true)
|
||||||
|
@PostMapping("/convStaffCode")
|
||||||
|
public WeaResult<Object> convStaffCode(@RequestBody JSONObject params){
|
||||||
|
Map<String,Object> recordMap = convertOrganizationService.convStaffCode(params);
|
||||||
|
return WeaResult.success(recordMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@WeaPermission(publicPermission = true)
|
||||||
|
@PostMapping("/convtDepartmentCode")
|
||||||
|
public WeaResult<Object> convtDepartmentCode(@RequestBody JSONObject params){
|
||||||
|
Map<String,Object> recordMap = convertOrganizationService.convtDepartmentCode(params);
|
||||||
|
return WeaResult.success(recordMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
@WeaPermission(publicPermission = true)
|
||||||
|
@PostMapping("/convtPositionCode")
|
||||||
|
public WeaResult<Object> convtPositionCode(@RequestBody JSONObject params){
|
||||||
|
Map<String,Object> recordMap = convertOrganizationService.convtPositionCode(params);
|
||||||
|
return WeaResult.success(recordMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,119 @@
|
||||||
|
package com.weaver.seconddev.chapanda.beisen.dao;
|
||||||
|
|
||||||
|
import com.weaver.ebuilder.datasource.api.entity.SqlParamEntity;
|
||||||
|
import com.weaver.seconddev.chapanda.beisen.constant.Constants;
|
||||||
|
import com.weaver.seconddev.chapanda.beisen.util.DatabaseUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class ConvertOrganizationDao {
|
||||||
|
|
||||||
|
private final static Logger log = LoggerFactory.getLogger(ConvertOrganizationDao.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DatabaseUtils databaseUtils;
|
||||||
|
|
||||||
|
|
||||||
|
public String queryEmployeeByCode(String staffcode){
|
||||||
|
String groupId = "weaver-ebuilder-form-service";
|
||||||
|
String sourceType = "LOGIC";
|
||||||
|
String employeeId = "";
|
||||||
|
try{
|
||||||
|
if(StringUtils.isNotBlank(staffcode)){
|
||||||
|
String dataSql =" select id,username " +
|
||||||
|
" from eteams.employee " +
|
||||||
|
" where job_num = ? \n" +
|
||||||
|
" and delete_type = 0 \n" +
|
||||||
|
" and tenant_key = ? " ;
|
||||||
|
|
||||||
|
log.error("dataSql:" + dataSql);
|
||||||
|
List<String> paramList = new ArrayList<>(100);
|
||||||
|
paramList.add(staffcode);
|
||||||
|
paramList.add(Constants.TENANT_KEY);
|
||||||
|
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||||
|
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||||
|
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||||
|
log.error("recordList:"+recordList.size());
|
||||||
|
if(!recordList.isEmpty()){
|
||||||
|
employeeId =String.valueOf(recordList.get(0).get("id"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error("e:" + e);
|
||||||
|
}
|
||||||
|
return employeeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String queryDepartmentByCode(String departmentcode){
|
||||||
|
String groupId = "weaver-ebuilder-form-service";
|
||||||
|
String sourceType = "LOGIC";
|
||||||
|
String departmentid = "";
|
||||||
|
try{
|
||||||
|
if(StringUtils.isNotBlank(departmentcode)){
|
||||||
|
String dataSql =" select id " +
|
||||||
|
" from eteams.department " +
|
||||||
|
" where code = ? \n" +
|
||||||
|
" and delete_type = 0 \n" +
|
||||||
|
" and tenant_key = ? " ;
|
||||||
|
|
||||||
|
log.error("dataSql:" + dataSql);
|
||||||
|
List<String> paramList = new ArrayList<>(100);
|
||||||
|
paramList.add(departmentcode);
|
||||||
|
paramList.add(Constants.TENANT_KEY);
|
||||||
|
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||||
|
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||||
|
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||||
|
log.error("recordList:"+recordList.size());
|
||||||
|
if(!recordList.isEmpty()){
|
||||||
|
departmentid = String.valueOf(recordList.get(0).get("id"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error("e:" + e);
|
||||||
|
}
|
||||||
|
return departmentid;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String queryPositionByCode(String positioncode){
|
||||||
|
String groupId = "weaver-ebuilder-form-service";
|
||||||
|
String sourceType = "LOGIC";
|
||||||
|
String positionId = "";
|
||||||
|
try{
|
||||||
|
if(StringUtils.isNotBlank(positioncode)){
|
||||||
|
String dataSql =" select id " +
|
||||||
|
" from eteams.POSITION " +
|
||||||
|
" where code = ? \n" +
|
||||||
|
" and delete_type = 0 \n" +
|
||||||
|
" and tenant_key = ? " ;
|
||||||
|
|
||||||
|
log.error("dataSql:" + dataSql);
|
||||||
|
List<String> paramList = new ArrayList<>(100);
|
||||||
|
paramList.add(positioncode);
|
||||||
|
paramList.add(Constants.TENANT_KEY);
|
||||||
|
List<SqlParamEntity> sqlParamList = databaseUtils.querySqlParamEntity(paramList);
|
||||||
|
Map<String, Object> result = databaseUtils.executeForQuery(sourceType, groupId, dataSql, sqlParamList);
|
||||||
|
List<Map<String, Object>> recordList = databaseUtils.getDataSourceList(result);
|
||||||
|
log.error("recordList:"+recordList.size());
|
||||||
|
if(!recordList.isEmpty()){
|
||||||
|
positionId = String.valueOf(recordList.get(0).get("id"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error("e:" + e);
|
||||||
|
}
|
||||||
|
return positionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.weaver.seconddev.chapanda.beisen.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public interface ConvertOrganizationService {
|
||||||
|
Map<String,Object> convStaffCode(JSONObject params);
|
||||||
|
|
||||||
|
Map<String,Object> convtDepartmentCode(JSONObject params);
|
||||||
|
|
||||||
|
Map<String,Object> convtPositionCode(JSONObject params);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.weaver.seconddev.chapanda.beisen.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.weaver.seconddev.chapanda.beisen.dao.ConvertOrganizationDao;
|
||||||
|
import com.weaver.seconddev.chapanda.beisen.service.ConvertOrganizationService;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* author:shil
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ConvertOrganizationServiceImpl implements ConvertOrganizationService {
|
||||||
|
|
||||||
|
private final static Logger log = LoggerFactory.getLogger(ConvertOrganizationServiceImpl.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ConvertOrganizationDao convertOrganizationDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> convStaffCode(JSONObject params) {
|
||||||
|
String staffcode = String.valueOf(params.getString("staffcode"));
|
||||||
|
log.error("staffcode:{}",staffcode);
|
||||||
|
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||||
|
String staffid = convertOrganizationDao.queryEmployeeByCode(staffcode);
|
||||||
|
dataMap.put("staffid",staffid);
|
||||||
|
return dataMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> convtDepartmentCode(JSONObject params) {
|
||||||
|
String departmentcode = String.valueOf(params.getString("departmentcode"));
|
||||||
|
log.error("departmentcode:{}",departmentcode);
|
||||||
|
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||||
|
String departmentid = convertOrganizationDao.queryDepartmentByCode(departmentcode);
|
||||||
|
dataMap.put("departmentid",departmentid);
|
||||||
|
return dataMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> convtPositionCode(JSONObject params) {
|
||||||
|
String positioncode = String.valueOf(params.getString("positioncode"));
|
||||||
|
log.error("positioncode:{}",positioncode);
|
||||||
|
Map<String, Object> dataMap = new HashMap<String, Object>();
|
||||||
|
String positionid = convertOrganizationDao.queryPositionByCode(positioncode);
|
||||||
|
dataMap.put("positionid",positionid);
|
||||||
|
return dataMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -80,7 +80,7 @@ public class SignFlowCallBackDao {
|
||||||
String groupId = "weaver-ebuilder-form-service";
|
String groupId = "weaver-ebuilder-form-service";
|
||||||
String sourceType = "LOGIC";
|
String sourceType = "LOGIC";
|
||||||
try{
|
try{
|
||||||
String dataSql =" update uf_jcl_rshtgl set wjid='"+finishFileKey+"',fj_6pgb='"+String.valueOf(fileid)+"' where form_data_id ='"+form_data_id+"' and tenant_key='"+Constants.TENANT_KEY+"' \n" +
|
String dataSql =" update uf_jcl_rshtgl set wjid='"+finishFileKey+"',fj_6pgb='"+String.valueOf(fileid)+"',htzt='2' where form_data_id ='"+form_data_id+"' and tenant_key='"+Constants.TENANT_KEY+"' \n" +
|
||||||
" and delete_type=0" ;
|
" and delete_type=0" ;
|
||||||
|
|
||||||
log.error("dataSql:{}" , dataSql);
|
log.error("dataSql:{}" , dataSql);
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,9 @@ public class Esb2FeishuSendMessageCardAction implements EsbServerlessRpcRemoteIn
|
||||||
return WeaResult.fail(500,"templateId is null");
|
return WeaResult.fail(500,"templateId is null");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(StringUtils.isBlank(templateVersionName)){
|
// if(StringUtils.isBlank(templateVersionName)){
|
||||||
return WeaResult.fail(500,"templateVersionName is null");
|
// return WeaResult.fail(500,"templateVersionName is null");
|
||||||
}
|
// }
|
||||||
|
|
||||||
if(StringUtils.isBlank(receiveId)){
|
if(StringUtils.isBlank(receiveId)){
|
||||||
return WeaResult.fail(500,"1. is null");
|
return WeaResult.fail(500,"1. is null");
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,9 @@ public class FormFieldDao {
|
||||||
@Autowired
|
@Autowired
|
||||||
private DatabaseUtils databaseUtils;
|
private DatabaseUtils databaseUtils;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param fieldId
|
* @param fieldId
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ public class Esb2QunjieCreateSealApplyAction implements EsbServerlessRpcRemoteIn
|
||||||
log.error("applyCount:{}",applyCount);
|
log.error("applyCount:{}",applyCount);
|
||||||
log.error("applyCrossPageSealCount:{}",applyCrossPageSealCount);
|
log.error("applyCrossPageSealCount:{}",applyCrossPageSealCount);
|
||||||
|
|
||||||
String fileid = (String) params.get("fileid");
|
String fileid = String.valueOf(params.get("fileid"));
|
||||||
String jobNum = (String) params.get("jobNum");
|
String jobNum = (String) params.get("jobNum");
|
||||||
log.error("fileid:{}",fileid);
|
log.error("fileid:{}",fileid);
|
||||||
|
|
||||||
|
|
@ -44,14 +44,16 @@ public class Esb2QunjieCreateSealApplyAction implements EsbServerlessRpcRemoteIn
|
||||||
|
|
||||||
Long longFileId = 0L;
|
Long longFileId = 0L;
|
||||||
try{
|
try{
|
||||||
longFileId = Long.valueOf(fileid);
|
if(StringUtils.isNotBlank(fileid)){
|
||||||
|
longFileId = Long.valueOf(fileid);
|
||||||
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("e:{}",e);
|
log.error("e:{}",e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(longFileId <=0){
|
// if(longFileId <=0){
|
||||||
return WeaResult.fail(500,"用印文件ID转换失败");
|
// return WeaResult.fail(500,"用印文件ID转换失败");
|
||||||
}
|
// }
|
||||||
|
|
||||||
if(StringUtils.isBlank(applyCount) && StringUtils.isBlank(applyCrossPageSealCount)){
|
if(StringUtils.isBlank(applyCount) && StringUtils.isBlank(applyCrossPageSealCount)){
|
||||||
return WeaResult.fail(500,"用印次数和骑缝章次数不能同时为空");
|
return WeaResult.fail(500,"用印次数和骑缝章次数不能同时为空");
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
package com.weaver.seconddev.chapanda.qunjie.esb;
|
||||||
|
|
||||||
|
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.eteams.file.client.file.FileObj;
|
||||||
|
import com.weaver.file.ud.api.FileDownloadService;
|
||||||
|
import com.weaver.seconddev.chapanda.prop.util.ParamConfigUtil;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.net.NetworkInterface;
|
||||||
|
import java.net.SocketException;
|
||||||
|
import java.net.UnknownHostException;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Service("Esb2QunjieTestAttachmentCron")
|
||||||
|
public class Esb2QunjieTestAttachmentCron implements EsbServerlessRpcRemoteInterface {
|
||||||
|
private final static Logger log = LoggerFactory.getLogger(Esb2QunjieTestAttachmentCron.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FileDownloadService fileDownloadService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ParamConfigUtil paramConfigUtil;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WeaResult<Map<String, Object>> execute(Map<String, Object> params) {
|
||||||
|
log.error("Esb2QunjieTestAttachmentCron");
|
||||||
|
|
||||||
|
String value = paramConfigUtil.queryEnvironmentValue("rzlc.esgine.test");
|
||||||
|
log.error("value:{}",value);
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
InetAddress inetAddress = InetAddress.getLocalHost();
|
||||||
|
String ip = inetAddress.getHostAddress();
|
||||||
|
log.error("ip:{}",ip);
|
||||||
|
} catch (UnknownHostException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
|
||||||
|
while (interfaces.hasMoreElements()) {
|
||||||
|
NetworkInterface networkInterface = interfaces.nextElement();
|
||||||
|
// 过滤掉loopback接口(通常是127.0.0.1)
|
||||||
|
if (networkInterface.isLoopback() || !networkInterface.isUp()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Enumeration<InetAddress> addresses = networkInterface.getInetAddresses();
|
||||||
|
while (addresses.hasMoreElements()) {
|
||||||
|
InetAddress addr = addresses.nextElement();
|
||||||
|
log.error("IP Address: " + addr.getHostAddress());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SocketException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
// String fileId = String.valueOf(params.get("fileId"));
|
||||||
|
// log.error("fileId:{}",fileId);
|
||||||
|
// // 获取文件的输入流
|
||||||
|
// InputStream inputStream = null;
|
||||||
|
// log.error("22222");
|
||||||
|
// try{
|
||||||
|
//
|
||||||
|
// FileData fileData = fileDownloadService.downloadFile(Long.valueOf(fileId));
|
||||||
|
// log.error("33333");
|
||||||
|
// FileObj fileObj = fileData.getFileObj();
|
||||||
|
// Long docid = fileObj.getDocId();
|
||||||
|
// String name = fileObj.getName();
|
||||||
|
// String loadUrl = fileData.getLoadUrl();
|
||||||
|
//
|
||||||
|
// log.error("docid:{}",docid);
|
||||||
|
// log.error("name:{}",name);
|
||||||
|
// log.error("loadUrl:{}",loadUrl);
|
||||||
|
//
|
||||||
|
// inputStream = fileData.getInputStream();
|
||||||
|
// log.error("inputStream:{}",inputStream.available());
|
||||||
|
// if(inputStream.available() >0 ){
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// inputStream.close();
|
||||||
|
// }catch (IOException e) {
|
||||||
|
// log.error("e:{}",e);
|
||||||
|
// }finally {
|
||||||
|
// if(inputStream !=null){
|
||||||
|
// try {
|
||||||
|
// inputStream.close();
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// throw new RuntimeException(e);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, Object> actionMap = new HashMap<String, Object>();
|
||||||
|
actionMap.put("code",200);
|
||||||
|
actionMap.put("msg","Esb2QunjieQuerySealBaseCron");
|
||||||
|
|
||||||
|
return WeaResult.success(actionMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -363,5 +363,4 @@ public class DatabaseUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,23 +52,24 @@ public class Esb2QunjieCreateApplySealUtil {
|
||||||
log.error("applySealRequest start");
|
log.error("applySealRequest start");
|
||||||
Map<String, Object> messageMap = new HashMap<String, Object>();
|
Map<String, Object> messageMap = new HashMap<String, Object>();
|
||||||
|
|
||||||
FileData fileData = fileDownloadService.downloadFile(fileid);
|
if(fileid > 0L){
|
||||||
FileObj fileObj = fileData.getFileObj();
|
FileData fileData = fileDownloadService.downloadFile(fileid);
|
||||||
String fileName = fileObj.getName();
|
FileObj fileObj = fileData.getFileObj();
|
||||||
log.error("fileName:{}",fileName);
|
String fileName = fileObj.getName();
|
||||||
InputStream fileInputStream = null;
|
log.error("fileName:{}",fileName);
|
||||||
try{
|
InputStream fileInputStream = null;
|
||||||
fileInputStream = fileData.getInputStream();
|
try{
|
||||||
|
fileInputStream = fileData.getInputStream();
|
||||||
|
|
||||||
if(fileInputStream.available() > 0) {
|
if(fileInputStream.available() > 0) {
|
||||||
|
|
||||||
byte[] fileByte = convertInputStreamToBytes(fileInputStream);
|
byte[] fileByte = convertInputStreamToBytes(fileInputStream);
|
||||||
log.error("fileByte:{}",fileByte.length);
|
log.error("fileByte:{}",fileByte.length);
|
||||||
|
|
||||||
if(fileByte.length > 0){
|
if(fileByte.length > 0){
|
||||||
String token = esb2QunjieTokenUtil.getAccessToken();
|
String token = esb2QunjieTokenUtil.getAccessToken();
|
||||||
log.error("token:"+token);
|
log.error("token:"+token);
|
||||||
if(StringUtils.isNotBlank(token)){
|
if(StringUtils.isNotBlank(token)){
|
||||||
|
|
||||||
|
|
||||||
// {
|
// {
|
||||||
|
|
@ -89,57 +90,122 @@ public class Esb2QunjieCreateApplySealUtil {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
JSONArray usedSealParamList = new JSONArray();
|
JSONArray usedSealParamList = new JSONArray();
|
||||||
JSONObject usedSealParam = new JSONObject();
|
JSONObject usedSealParam = new JSONObject();
|
||||||
usedSealParam.put("sealId",sealId);
|
usedSealParam.put("sealId",sealId);
|
||||||
usedSealParam.put("takeOut","0");
|
usedSealParam.put("takeOut","0");
|
||||||
usedSealParam.put("applyCount",applyCount);
|
usedSealParam.put("applyCount",applyCount);
|
||||||
usedSealParam.put("applyCrossPageSealCount",applyCrossPageSealCount);
|
usedSealParam.put("applyCrossPageSealCount",applyCrossPageSealCount);
|
||||||
usedSealParamList.add(usedSealParam);
|
usedSealParamList.add(usedSealParam);
|
||||||
|
|
||||||
JSONObject optionJson = new JSONObject();
|
JSONObject optionJson = new JSONObject();
|
||||||
optionJson.put("ocr",Constants.ocr);
|
optionJson.put("ocr",Constants.ocr);
|
||||||
optionJson.put("preventOcrCompare",Constants.preventOcrCompare);
|
optionJson.put("preventOcrCompare",Constants.preventOcrCompare);
|
||||||
optionJson.put("watermark",Constants.watermark);
|
optionJson.put("watermark",Constants.watermark);
|
||||||
optionJson.put("preventWaterMark",Constants.preventWaterMark);
|
optionJson.put("preventWaterMark",Constants.preventWaterMark);
|
||||||
optionJson.put("preventPower",Constants.preventPower);
|
optionJson.put("preventPower",Constants.preventPower);
|
||||||
optionJson.put("prevent",Constants.prevent);
|
optionJson.put("prevent",Constants.prevent);
|
||||||
optionJson.put("remoteMonitoringSwitch",Constants.remoteMonitoringSwitch);
|
optionJson.put("remoteMonitoringSwitch",Constants.remoteMonitoringSwitch);
|
||||||
optionJson.put("oneCodeOneUseSwitch",Constants.oneCodeOneUseSwitch);
|
optionJson.put("oneCodeOneUseSwitch",Constants.oneCodeOneUseSwitch);
|
||||||
optionJson.put("compound",Constants.compound);
|
optionJson.put("compound",Constants.compound);
|
||||||
JSONObject bodyJson = new JSONObject();
|
JSONObject bodyJson = new JSONObject();
|
||||||
bodyJson.put("title",requestName);
|
bodyJson.put("title",requestName);
|
||||||
// bodyJson.put("applyerUserName",Constants.applyerUserName);
|
// bodyJson.put("applyerUserName",Constants.applyerUserName);
|
||||||
|
|
||||||
bodyJson.put("applyerUserName",jobNum);
|
bodyJson.put("applyerUserName",jobNum);
|
||||||
|
|
||||||
bodyJson.put("usedSealParamList",usedSealParamList);
|
bodyJson.put("usedSealParamList",usedSealParamList);
|
||||||
bodyJson.put("option",optionJson);
|
bodyJson.put("option",optionJson);
|
||||||
|
|
||||||
log.error("bodyJson:"+bodyJson.toJSONString());
|
log.error("bodyJson:"+bodyJson.toJSONString());
|
||||||
|
|
||||||
String message= doFormDataPost(bodyJson.toJSONString(),token,fileName,fileByte);
|
String message= doFormDataPost(bodyJson.toJSONString(),token,fileName,fileByte);
|
||||||
// String message= doPostReqeustByOkHttp(bodyJson.toJSONString(),token,fileName,fileByte);
|
// String message= doPostReqeustByOkHttp(bodyJson.toJSONString(),token,fileName,fileByte);
|
||||||
log.error("message:{}",message);
|
log.error("message:{}",message);
|
||||||
messageMap = convertBodyDataToMap(message);
|
messageMap = convertBodyDataToMap(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fileInputStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("e:{}",e);
|
||||||
|
}finally {
|
||||||
|
if(fileInputStream !=null){
|
||||||
|
try {
|
||||||
|
fileInputStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("e:{}",e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
try{
|
||||||
|
|
||||||
fileInputStream.close();
|
String token = esb2QunjieTokenUtil.getAccessToken();
|
||||||
} catch (IOException e) {
|
log.error("token:"+token);
|
||||||
throw new RuntimeException(e);
|
if(StringUtils.isNotBlank(token)){
|
||||||
}finally {
|
|
||||||
if(fileInputStream !=null){
|
|
||||||
try {
|
// {
|
||||||
fileInputStream.close();
|
// "title": "测试20250704",
|
||||||
} catch (IOException e) {
|
// "applyerUserName": "admin",
|
||||||
throw new RuntimeException(e);
|
// "callBackUrl": "baidu.com",
|
||||||
|
// "usedSealParamList": [
|
||||||
|
// {
|
||||||
|
// "sealId": "4e22398d-0ab1-4226-8546-7f65f6f8622d",
|
||||||
|
// "takeOut": "0",
|
||||||
|
// "applyCount": "1"
|
||||||
|
// }
|
||||||
|
// ],
|
||||||
|
// "option": {
|
||||||
|
// "watermark": "1",
|
||||||
|
// "preventWaterMark": "1"
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
JSONArray usedSealParamList = new JSONArray();
|
||||||
|
JSONObject usedSealParam = new JSONObject();
|
||||||
|
usedSealParam.put("sealId",sealId);
|
||||||
|
usedSealParam.put("takeOut","0");
|
||||||
|
usedSealParam.put("applyCount",applyCount);
|
||||||
|
usedSealParam.put("applyCrossPageSealCount",applyCrossPageSealCount);
|
||||||
|
usedSealParamList.add(usedSealParam);
|
||||||
|
|
||||||
|
JSONObject optionJson = new JSONObject();
|
||||||
|
optionJson.put("ocr",Constants.ocr);
|
||||||
|
optionJson.put("preventOcrCompare",Constants.preventOcrCompare);
|
||||||
|
optionJson.put("watermark",Constants.watermark);
|
||||||
|
optionJson.put("preventWaterMark",Constants.preventWaterMark);
|
||||||
|
optionJson.put("preventPower",Constants.preventPower);
|
||||||
|
optionJson.put("prevent",Constants.prevent);
|
||||||
|
optionJson.put("remoteMonitoringSwitch",Constants.remoteMonitoringSwitch);
|
||||||
|
optionJson.put("oneCodeOneUseSwitch",Constants.oneCodeOneUseSwitch);
|
||||||
|
optionJson.put("compound",Constants.compound);
|
||||||
|
JSONObject bodyJson = new JSONObject();
|
||||||
|
bodyJson.put("title",requestName);
|
||||||
|
// bodyJson.put("applyerUserName",Constants.applyerUserName);
|
||||||
|
|
||||||
|
bodyJson.put("applyerUserName",jobNum);
|
||||||
|
|
||||||
|
bodyJson.put("usedSealParamList",usedSealParamList);
|
||||||
|
bodyJson.put("option",optionJson);
|
||||||
|
|
||||||
|
log.error("bodyJson:"+bodyJson.toJSONString());
|
||||||
|
|
||||||
|
String message= doFormDataPost(bodyJson.toJSONString(),token,"",new byte[0]);
|
||||||
|
// String message= doPostReqeustByOkHttp(bodyJson.toJSONString(),token,fileName,fileByte);
|
||||||
|
log.error("message:{}",message);
|
||||||
|
messageMap = convertBodyDataToMap(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("e:{}",e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return messageMap;
|
return messageMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -289,8 +355,9 @@ public class Esb2QunjieCreateApplySealUtil {
|
||||||
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||||
builder.setCharset(StandardCharsets.UTF_8);//设置编码,解决中文乱码问题
|
builder.setCharset(StandardCharsets.UTF_8);//设置编码,解决中文乱码问题
|
||||||
builder.setMode(HttpMultipartMode.RFC6532);
|
builder.setMode(HttpMultipartMode.RFC6532);
|
||||||
|
if(StringUtils.isNotBlank(fileName) && fileByte.length>0){
|
||||||
builder.addBinaryBody("file", fileByte,ContentType.MULTIPART_FORM_DATA,fileName);
|
builder.addBinaryBody("file", fileByte,ContentType.MULTIPART_FORM_DATA,fileName);
|
||||||
|
}
|
||||||
ContentType contentType = ContentType.create("multipart/form-data",Charset.forName("UTF-8")); //重新设置UTF-8编码,默认编码是ISO-8859-1
|
ContentType contentType = ContentType.create("multipart/form-data",Charset.forName("UTF-8")); //重新设置UTF-8编码,默认编码是ISO-8859-1
|
||||||
builder.addTextBody("workflowApplyParam", bodyData,contentType);
|
builder.addTextBody("workflowApplyParam", bodyData,contentType);
|
||||||
httpPost.setHeader("Authorization", "Bearer "+token);
|
httpPost.setHeader("Authorization", "Bearer "+token);
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,21 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.nio.file.Path;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
|
@ -52,6 +62,7 @@ public class Esb2QunjieQuerySealUtil {
|
||||||
fieldList.add("sealType");
|
fieldList.add("sealType");
|
||||||
fieldList.add("sealNo");
|
fieldList.add("sealNo");
|
||||||
fieldList.add("yzzl");
|
fieldList.add("yzzl");
|
||||||
|
fieldList.add("yyzt");
|
||||||
try {
|
try {
|
||||||
String msg = doPostReqeustByOkHttp(token);
|
String msg = doPostReqeustByOkHttp(token);
|
||||||
log.error("msg:"+msg);
|
log.error("msg:"+msg);
|
||||||
|
|
@ -67,51 +78,53 @@ public class Esb2QunjieQuerySealUtil {
|
||||||
String id = dataJson.getString("id");
|
String id = dataJson.getString("id");
|
||||||
String sealName = dataJson.getString("sealName");
|
String sealName = dataJson.getString("sealName");
|
||||||
String sealStatus = dataJson.getString("sealStatus");
|
String sealStatus = dataJson.getString("sealStatus");
|
||||||
String sealShape = dataJson.getString("sealShape");
|
// String sealShape = dataJson.getString("sealShape");
|
||||||
String sealMaterial = dataJson.getString("sealMaterial");
|
// String sealMaterial = dataJson.getString("sealMaterial");
|
||||||
String sealType = dataJson.getString("sealType");
|
String sealType = dataJson.getString("sealType");
|
||||||
String createDate = dataJson.getString("createDate");
|
// String createDate = dataJson.getString("createDate");
|
||||||
String picId = dataJson.getString("picId");
|
// String picId = dataJson.getString("picId");
|
||||||
String sealCategory = dataJson.getString("sealCategory");
|
// String sealCategory = dataJson.getString("sealCategory");
|
||||||
String sealCategoryNew = dataJson.getString("sealCategoryNew");
|
// String sealCategoryNew = dataJson.getString("sealCategoryNew");
|
||||||
String adminId = dataJson.getString("adminId");
|
// String adminId = dataJson.getString("adminId");
|
||||||
String addressStatus = dataJson.getString("addressStatus");
|
// String addressStatus = dataJson.getString("addressStatus");
|
||||||
String imgHeader = dataJson.getString("imgHeader");
|
// String imgHeader = dataJson.getString("imgHeader");
|
||||||
String sealNo = dataJson.getString("sealNo");
|
String sealNo = dataJson.getString("sealNo");
|
||||||
String sealSurroundWord = dataJson.getString("sealSurroundWord");
|
// String sealSurroundWord = dataJson.getString("sealSurroundWord");
|
||||||
|
|
||||||
|
String useSealSubject = dataJson.getString("useSealSubject");
|
||||||
|
|
||||||
String orgNo = dataJson.getString("orgNo");
|
String orgNo = dataJson.getString("orgNo");
|
||||||
|
|
||||||
JSONObject deviceJson = dataJson.getJSONObject("device");
|
// JSONObject deviceJson = dataJson.getJSONObject("device");
|
||||||
String blueNo = deviceJson.getString("blueNo");
|
// String blueNo = deviceJson.getString("blueNo");
|
||||||
String deviceTypeValue = deviceJson.getString("deviceTypeValue");
|
// String deviceTypeValue = deviceJson.getString("deviceTypeValue");
|
||||||
String isWarning = deviceJson.getString("isWarning");
|
// String isWarning = deviceJson.getString("isWarning");
|
||||||
String isBind = deviceJson.getString("isBind");
|
// String isBind = deviceJson.getString("isBind");
|
||||||
String warningTime = deviceJson.getString("warningTime");
|
// String warningTime = deviceJson.getString("warningTime");
|
||||||
|
|
||||||
Map<String,Object> sealMap = new HashMap<String,Object>();
|
Map<String,Object> sealMap = new HashMap<String,Object>();
|
||||||
sealMap.put("sealid",id);
|
sealMap.put("sealid",id);
|
||||||
sealMap.put("sealName",sealName);
|
sealMap.put("sealName",sealName);
|
||||||
sealMap.put("sealStatus",sealStatus);
|
sealMap.put("sealStatus",sealStatus);
|
||||||
sealMap.put("sealShape",sealShape);
|
// sealMap.put("sealShape",sealShape);
|
||||||
sealMap.put("sealMaterial",sealMaterial);
|
// sealMap.put("sealMaterial",sealMaterial);
|
||||||
sealMap.put("sealType",sealType);
|
sealMap.put("sealType",sealType);
|
||||||
sealMap.put("createDate",createDate);
|
// sealMap.put("createDate",createDate);
|
||||||
sealMap.put("picId",picId);
|
// sealMap.put("picId",picId);
|
||||||
sealMap.put("sealCategory",sealCategory);
|
// sealMap.put("sealCategory",sealCategory);
|
||||||
sealMap.put("sealCategoryNew",sealCategoryNew);
|
// sealMap.put("sealCategoryNew",sealCategoryNew);
|
||||||
sealMap.put("adminId",adminId);
|
// sealMap.put("adminId",adminId);
|
||||||
sealMap.put("addressStatus",addressStatus);
|
// sealMap.put("addressStatus",addressStatus);
|
||||||
sealMap.put("imgHeader",imgHeader);
|
// sealMap.put("imgHeader",imgHeader);
|
||||||
sealMap.put("sealNo",sealNo);
|
sealMap.put("sealNo",sealNo);
|
||||||
sealMap.put("sealSurroundWord",sealSurroundWord);
|
// sealMap.put("sealSurroundWord",sealSurroundWord);
|
||||||
sealMap.put("orgNo",orgNo);
|
sealMap.put("orgNo",orgNo);
|
||||||
sealMap.put("blueNo",blueNo);
|
sealMap.put("yyzt",useSealSubject);
|
||||||
sealMap.put("deviceTypeValue",deviceTypeValue);
|
// sealMap.put("blueNo",blueNo);
|
||||||
sealMap.put("isWarning",isWarning);
|
// sealMap.put("deviceTypeValue",deviceTypeValue);
|
||||||
sealMap.put("isBind",isBind);
|
// sealMap.put("isWarning",isWarning);
|
||||||
sealMap.put("warningTime",warningTime);
|
// sealMap.put("isBind",isBind);
|
||||||
|
// sealMap.put("warningTime",warningTime);
|
||||||
sealList.add(sealMap);
|
sealList.add(sealMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -239,6 +252,87 @@ public class Esb2QunjieQuerySealUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
List<Map<String,Object>> sealList = new ArrayList<>();
|
||||||
|
String msg = "";
|
||||||
|
try {
|
||||||
|
Path path = Paths.get("/Users/apple/Downloads/222.json");
|
||||||
|
byte[] encoded = Files.readAllBytes(path);
|
||||||
|
msg = new String(encoded, StandardCharsets.UTF_8);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(StringUtils.isNotBlank(msg)){
|
||||||
|
JSONObject msgJson = JSONObject.parseObject(msg);
|
||||||
|
if(msgJson.containsKey("status")){
|
||||||
|
String status = msgJson.getString("status");
|
||||||
|
if("0".equals(status)){
|
||||||
|
JSONArray dataArray = msgJson.getJSONArray("data");
|
||||||
|
System.out.println("dataArray:"+dataArray.size());
|
||||||
|
for (int i = 0; i < dataArray.size(); i++) {
|
||||||
|
JSONObject dataJson = dataArray.getJSONObject(i);
|
||||||
|
System.out.println("i:"+i);
|
||||||
|
String id = dataJson.getString("id");
|
||||||
|
String sealName = dataJson.getString("sealName");
|
||||||
|
String sealStatus = dataJson.getString("sealStatus");
|
||||||
|
String sealShape = dataJson.getString("sealShape");
|
||||||
|
String sealMaterial = dataJson.getString("sealMaterial");
|
||||||
|
String sealType = dataJson.getString("sealType");
|
||||||
|
String createDate = dataJson.getString("createDate");
|
||||||
|
String picId = dataJson.getString("picId");
|
||||||
|
String sealCategory = dataJson.getString("sealCategory");
|
||||||
|
String sealCategoryNew = dataJson.getString("sealCategoryNew");
|
||||||
|
String adminId = dataJson.getString("adminId");
|
||||||
|
String addressStatus = dataJson.getString("addressStatus");
|
||||||
|
String imgHeader = dataJson.getString("imgHeader");
|
||||||
|
String sealNo = dataJson.getString("sealNo");
|
||||||
|
String sealSurroundWord = dataJson.getString("sealSurroundWord");
|
||||||
|
System.out.println("sealSurroundWord:"+sealSurroundWord);
|
||||||
|
|
||||||
|
String orgNo = dataJson.getString("orgNo");
|
||||||
|
|
||||||
|
JSONObject deviceJson = dataJson.getJSONObject("device");
|
||||||
|
// String blueNo = deviceJson.getString("blueNo");
|
||||||
|
// String deviceTypeValue = deviceJson.getString("deviceTypeValue");
|
||||||
|
// String isWarning = deviceJson.getString("isWarning");
|
||||||
|
// String isBind = deviceJson.getString("isBind");
|
||||||
|
// String warningTime = deviceJson.getString("warningTime");
|
||||||
|
|
||||||
|
Map<String,Object> sealMap = new HashMap<String,Object>();
|
||||||
|
sealMap.put("sealid",id);
|
||||||
|
sealMap.put("sealName",sealName);
|
||||||
|
sealMap.put("sealStatus",sealStatus);
|
||||||
|
sealMap.put("sealShape",sealShape);
|
||||||
|
sealMap.put("sealMaterial",sealMaterial);
|
||||||
|
sealMap.put("sealType",sealType);
|
||||||
|
sealMap.put("createDate",createDate);
|
||||||
|
sealMap.put("picId",picId);
|
||||||
|
sealMap.put("sealCategory",sealCategory);
|
||||||
|
sealMap.put("sealCategoryNew",sealCategoryNew);
|
||||||
|
sealMap.put("adminId",adminId);
|
||||||
|
sealMap.put("addressStatus",addressStatus);
|
||||||
|
sealMap.put("imgHeader",imgHeader);
|
||||||
|
sealMap.put("sealNo",sealNo);
|
||||||
|
sealMap.put("sealSurroundWord",sealSurroundWord);
|
||||||
|
sealMap.put("orgNo",orgNo);
|
||||||
|
// sealMap.put("blueNo",blueNo);
|
||||||
|
// sealMap.put("deviceTypeValue",deviceTypeValue);
|
||||||
|
// sealMap.put("isWarning",isWarning);
|
||||||
|
// sealMap.put("isBind",isBind);
|
||||||
|
// sealMap.put("warningTime",warningTime);
|
||||||
|
sealList.add(sealMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("sealList:"+sealList.size());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue