Compare commits

...

2 Commits

Author SHA1 Message Date
jingwei.tao a9835d1cdf 添加文件 2023-06-28 17:42:23 +08:00
jingwei.tao 9ad2ce7943 shanchu time util 2023-06-28 17:41:19 +08:00
314 changed files with 55443 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/jinweiLib/model16.jar Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
lib/jinweiLib/util16.jar Normal file

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,101 @@
package com.api.taojw.boge.api;
import com.alibaba.fastjson.JSONObject;
import com.api.taojw.boge.webservice.ERPIServiceLocator;
import com.api.taojw.boge.webservice.ERPIServiceSoap11BindingStub;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.taojw.common.CommonSqlUtil;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.ModelDataToJsonUtil;
import weaver.taojw.common.TjwModelUtil;
import weaver.taojw.common.logging.MyLogger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* webservice
*/
@Path("/bogetjw")
public class CreateBomApi {
Logger logger = MyLogger.getLogger();
//接口调用成功后,将建模的是否成功推送字段改为是
private String updateModeStatusSql = "update uf_js03 set sfcgts = 0,spph = ? where id = ?";
@POST
@Path("/createBom")
@Produces(MediaType.APPLICATION_JSON)
public String createBom(@Context HttpServletRequest request, @Context HttpServletResponse response){
JSONObject result = new JSONObject();
try{
RecordSet rs = new RecordSet();
result.put("success","1");
String errMsg = "";
List<String> errIds = new ArrayList<>();
//勾选的记录id
String selectedIds = request.getParameter("selectedIds");
String configId = CommonSqlUtil.getSystemParamValue("modedatatojson_bom",rs);
String url = CommonSqlUtil.getSystemParamValue("bomurl",rs);
String getStatusSql = "select id from uf_js03 where sfcgts = 0 and id in (" + selectedIds + ")";
List<Map<String, String>> data = DaoUtil.getData(rs, getStatusSql);
if(data.size() > 0){
for(Map<String, String> m : data){
String id = m.get("id");
errIds.add(id);
}
result.put("success","0");
errMsg = "数据id为:" + errIds + "的记录已成功调用过接口,请取消勾选后再提交!";
result.put("errMsg",errMsg);
logger.info("CreateBomApi.createBom end;result:" + result.toJSONString());
return result.toJSONString();
}
URL wbUrl = new URL(url);
//根据配置将建模转json
String[] selectedIdArr = selectedIds.split(",");
for(String id : selectedIdArr){
JSONObject o = ModelDataToJsonUtil.getJsonByModelData(id,configId);
ERPIServiceLocator locator = new ERPIServiceLocator();
ERPIServiceSoap11BindingStub stub = new ERPIServiceSoap11BindingStub(wbUrl,locator);
String product4OA = stub.createProduct4OA(o.toJSONString());
JSONObject msg = JSONObject.parseObject(product4OA);
String code = msg.getString("code");
String phData = msg.getString("data");
JSONObject loggerInfo = new JSONObject();
if(!"0".equals(code)){
result.put("success","0");
errIds.add(id);
loggerInfo.put("cgbz",1);
}else{
DaoUtil.updateData(rs,updateModeStatusSql,phData,id);
loggerInfo.put("cgbz",0);
}
loggerInfo.put("sjid",id);
loggerInfo.put("qqbw",o.toJSONString());
loggerInfo.put("xybw",product4OA);
TjwModelUtil.addModelData(rs,"uf_bomjkrz",loggerInfo);
}
errMsg = "数据id为:" + errIds + "的记录接口调用失败!";
result.put("errMsg",errMsg);
logger.info("CreateBomApi.createBom end;result:" + result.toJSONString());
return result.toJSONString();
}catch(Exception e){
logger.error("CreateBomApi.createBom end;message:" + e.getMessage() + ";e:" + e);
return result.toJSONString();
}
}
}

View File

@ -0,0 +1,21 @@
/**
* ERPIService.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.api.taojw.boge.webservice;
public interface ERPIService extends javax.xml.rpc.Service {
public java.lang.String getERPIServiceHttpSoap12EndpointAddress();
public com.api.taojw.boge.webservice.ERPIServicePortType getERPIServiceHttpSoap12Endpoint() throws javax.xml.rpc.ServiceException;
public com.api.taojw.boge.webservice.ERPIServicePortType getERPIServiceHttpSoap12Endpoint(java.net.URL portAddress) throws javax.xml.rpc.ServiceException;
public java.lang.String getERPIServiceHttpSoap11EndpointAddress();
public com.api.taojw.boge.webservice.ERPIServicePortType getERPIServiceHttpSoap11Endpoint() throws javax.xml.rpc.ServiceException;
public com.api.taojw.boge.webservice.ERPIServicePortType getERPIServiceHttpSoap11Endpoint(java.net.URL portAddress) throws javax.xml.rpc.ServiceException;
}

View File

@ -0,0 +1,202 @@
/**
* ERPIServiceLocator.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.api.taojw.boge.webservice;
public class ERPIServiceLocator extends org.apache.axis.client.Service implements com.api.taojw.boge.webservice.ERPIService {
public ERPIServiceLocator() {
}
public ERPIServiceLocator(org.apache.axis.EngineConfiguration config) {
super(config);
}
public ERPIServiceLocator(java.lang.String wsdlLoc, javax.xml.namespace.QName sName) throws javax.xml.rpc.ServiceException {
super(wsdlLoc, sName);
}
// Use to get a proxy class for ERPIServiceHttpSoap12Endpoint
private java.lang.String ERPIServiceHttpSoap12Endpoint_address = "http://58.211.172.10:88/axis2/services/ERPIService.ERPIServiceHttpSoap12Endpoint/";
public java.lang.String getERPIServiceHttpSoap12EndpointAddress() {
return ERPIServiceHttpSoap12Endpoint_address;
}
// The WSDD service name defaults to the port name.
private java.lang.String ERPIServiceHttpSoap12EndpointWSDDServiceName = "ERPIServiceHttpSoap12Endpoint";
public java.lang.String getERPIServiceHttpSoap12EndpointWSDDServiceName() {
return ERPIServiceHttpSoap12EndpointWSDDServiceName;
}
public void setERPIServiceHttpSoap12EndpointWSDDServiceName(java.lang.String name) {
ERPIServiceHttpSoap12EndpointWSDDServiceName = name;
}
public com.api.taojw.boge.webservice.ERPIServicePortType getERPIServiceHttpSoap12Endpoint() throws javax.xml.rpc.ServiceException {
java.net.URL endpoint;
try {
endpoint = new java.net.URL(ERPIServiceHttpSoap12Endpoint_address);
}
catch (java.net.MalformedURLException e) {
throw new javax.xml.rpc.ServiceException(e);
}
return getERPIServiceHttpSoap12Endpoint(endpoint);
}
public com.api.taojw.boge.webservice.ERPIServicePortType getERPIServiceHttpSoap12Endpoint(java.net.URL portAddress) throws javax.xml.rpc.ServiceException {
try {
com.api.taojw.boge.webservice.ERPIServiceSoap12BindingStub _stub = new com.api.taojw.boge.webservice.ERPIServiceSoap12BindingStub(portAddress, this);
_stub.setPortName(getERPIServiceHttpSoap12EndpointWSDDServiceName());
return _stub;
}
catch (org.apache.axis.AxisFault e) {
return null;
}
}
public void setERPIServiceHttpSoap12EndpointEndpointAddress(java.lang.String address) {
ERPIServiceHttpSoap12Endpoint_address = address;
}
// Use to get a proxy class for ERPIServiceHttpSoap11Endpoint
private java.lang.String ERPIServiceHttpSoap11Endpoint_address = "http://58.211.172.10:88/axis2/services/ERPIService.ERPIServiceHttpSoap11Endpoint/";
public java.lang.String getERPIServiceHttpSoap11EndpointAddress() {
return ERPIServiceHttpSoap11Endpoint_address;
}
// The WSDD service name defaults to the port name.
private java.lang.String ERPIServiceHttpSoap11EndpointWSDDServiceName = "ERPIServiceHttpSoap11Endpoint";
public java.lang.String getERPIServiceHttpSoap11EndpointWSDDServiceName() {
return ERPIServiceHttpSoap11EndpointWSDDServiceName;
}
public void setERPIServiceHttpSoap11EndpointWSDDServiceName(java.lang.String name) {
ERPIServiceHttpSoap11EndpointWSDDServiceName = name;
}
public com.api.taojw.boge.webservice.ERPIServicePortType getERPIServiceHttpSoap11Endpoint() throws javax.xml.rpc.ServiceException {
java.net.URL endpoint;
try {
endpoint = new java.net.URL(ERPIServiceHttpSoap11Endpoint_address);
}
catch (java.net.MalformedURLException e) {
throw new javax.xml.rpc.ServiceException(e);
}
return getERPIServiceHttpSoap11Endpoint(endpoint);
}
public com.api.taojw.boge.webservice.ERPIServicePortType getERPIServiceHttpSoap11Endpoint(java.net.URL portAddress) throws javax.xml.rpc.ServiceException {
try {
com.api.taojw.boge.webservice.ERPIServiceSoap11BindingStub _stub = new com.api.taojw.boge.webservice.ERPIServiceSoap11BindingStub(portAddress, this);
_stub.setPortName(getERPIServiceHttpSoap11EndpointWSDDServiceName());
return _stub;
}
catch (org.apache.axis.AxisFault e) {
return null;
}
}
public void setERPIServiceHttpSoap11EndpointEndpointAddress(java.lang.String address) {
ERPIServiceHttpSoap11Endpoint_address = address;
}
/**
* For the given interface, get the stub implementation.
* If this service has no port for the given interface,
* then ServiceException is thrown.
* This service has multiple ports for a given interface;
* the proxy implementation returned may be indeterminate.
*/
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
try {
if (com.api.taojw.boge.webservice.ERPIServicePortType.class.isAssignableFrom(serviceEndpointInterface)) {
com.api.taojw.boge.webservice.ERPIServiceSoap12BindingStub _stub = new com.api.taojw.boge.webservice.ERPIServiceSoap12BindingStub(new java.net.URL(ERPIServiceHttpSoap12Endpoint_address), this);
_stub.setPortName(getERPIServiceHttpSoap12EndpointWSDDServiceName());
return _stub;
}
if (com.api.taojw.boge.webservice.ERPIServicePortType.class.isAssignableFrom(serviceEndpointInterface)) {
com.api.taojw.boge.webservice.ERPIServiceSoap11BindingStub _stub = new com.api.taojw.boge.webservice.ERPIServiceSoap11BindingStub(new java.net.URL(ERPIServiceHttpSoap11Endpoint_address), this);
_stub.setPortName(getERPIServiceHttpSoap11EndpointWSDDServiceName());
return _stub;
}
}
catch (java.lang.Throwable t) {
throw new javax.xml.rpc.ServiceException(t);
}
throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface: " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
}
/**
* For the given interface, get the stub implementation.
* If this service has no port for the given interface,
* then ServiceException is thrown.
*/
public java.rmi.Remote getPort(javax.xml.namespace.QName portName, Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
if (portName == null) {
return getPort(serviceEndpointInterface);
}
java.lang.String inputPortName = portName.getLocalPart();
if ("ERPIServiceHttpSoap12Endpoint".equals(inputPortName)) {
return getERPIServiceHttpSoap12Endpoint();
}
else if ("ERPIServiceHttpSoap11Endpoint".equals(inputPortName)) {
return getERPIServiceHttpSoap11Endpoint();
}
else {
java.rmi.Remote _stub = getPort(serviceEndpointInterface);
((org.apache.axis.client.Stub) _stub).setPortName(portName);
return _stub;
}
}
public javax.xml.namespace.QName getServiceName() {
return new javax.xml.namespace.QName("http://service.dcis", "ERPIService");
}
private java.util.HashSet ports = null;
public java.util.Iterator getPorts() {
if (ports == null) {
ports = new java.util.HashSet();
ports.add(new javax.xml.namespace.QName("http://service.dcis", "ERPIServiceHttpSoap12Endpoint"));
ports.add(new javax.xml.namespace.QName("http://service.dcis", "ERPIServiceHttpSoap11Endpoint"));
}
return ports.iterator();
}
/**
* Set the endpoint address for the specified port name.
*/
public void setEndpointAddress(java.lang.String portName, java.lang.String address) throws javax.xml.rpc.ServiceException {
if ("ERPIServiceHttpSoap12Endpoint".equals(portName)) {
setERPIServiceHttpSoap12EndpointEndpointAddress(address);
}
else
if ("ERPIServiceHttpSoap11Endpoint".equals(portName)) {
setERPIServiceHttpSoap11EndpointEndpointAddress(address);
}
else
{ // Unknown Port Name
throw new javax.xml.rpc.ServiceException(" Cannot set Endpoint Address for Unknown Port" + portName);
}
}
/**
* Set the endpoint address for the specified port name.
*/
public void setEndpointAddress(javax.xml.namespace.QName portName, java.lang.String address) throws javax.xml.rpc.ServiceException {
setEndpointAddress(portName.getLocalPart(), address);
}
}

View File

@ -0,0 +1,19 @@
/**
* ERPIServicePortType.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.api.taojw.boge.webservice;
public interface ERPIServicePortType extends java.rmi.Remote {
public java.lang.String invokeSrv(java.lang.String paramXML) throws java.rmi.RemoteException;
public java.lang.String setT100JobStatus(java.lang.String xmlContext) throws java.rmi.RemoteException;
public java.lang.String createFileData(java.lang.String paramXML) throws java.rmi.RemoteException;
public java.lang.String exportDataToErp(java.lang.String endPoint, java.lang.String xml) throws java.rmi.RemoteException;
public java.lang.String createProduct4OA(java.lang.String requestJson) throws java.rmi.RemoteException;
public java.lang.String setERPJobStatus(java.lang.String xmlContext) throws java.rmi.RemoteException;
public java.lang.String syncProd(java.lang.String paramXML) throws java.rmi.RemoteException;
public java.lang.String callbackSrv(java.lang.String paramXML) throws java.rmi.RemoteException;
}

View File

@ -0,0 +1,459 @@
/**
* ERPIServiceSoap11BindingStub.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.api.taojw.boge.webservice;
public class ERPIServiceSoap11BindingStub extends org.apache.axis.client.Stub implements com.api.taojw.boge.webservice.ERPIServicePortType {
private java.util.Vector cachedSerClasses = new java.util.Vector();
private java.util.Vector cachedSerQNames = new java.util.Vector();
private java.util.Vector cachedSerFactories = new java.util.Vector();
private java.util.Vector cachedDeserFactories = new java.util.Vector();
static org.apache.axis.description.OperationDesc [] _operations;
static {
_operations = new org.apache.axis.description.OperationDesc[8];
_initOperationDesc1();
}
private static void _initOperationDesc1(){
org.apache.axis.description.OperationDesc oper;
org.apache.axis.description.ParameterDesc param;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("invokeSrv");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("http://service.dcis", "paramXML"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
param.setOmittable(true);
param.setNillable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
oper.setReturnClass(java.lang.String.class);
oper.setReturnQName(new javax.xml.namespace.QName("http://service.dcis", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
_operations[0] = oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("setT100JobStatus");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("http://service.dcis", "xmlContext"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
param.setOmittable(true);
param.setNillable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
oper.setReturnClass(java.lang.String.class);
oper.setReturnQName(new javax.xml.namespace.QName("http://service.dcis", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
_operations[1] = oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("createFileData");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("http://service.dcis", "paramXML"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
param.setOmittable(true);
param.setNillable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
oper.setReturnClass(java.lang.String.class);
oper.setReturnQName(new javax.xml.namespace.QName("http://service.dcis", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
_operations[2] = oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("exportDataToErp");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("http://service.dcis", "endPoint"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
param.setOmittable(true);
param.setNillable(true);
oper.addParameter(param);
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("http://service.dcis", "xml"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
param.setOmittable(true);
param.setNillable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
oper.setReturnClass(java.lang.String.class);
oper.setReturnQName(new javax.xml.namespace.QName("http://service.dcis", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
_operations[3] = oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("createProduct4OA");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("http://service.dcis", "requestJson"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
param.setOmittable(true);
param.setNillable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
oper.setReturnClass(java.lang.String.class);
oper.setReturnQName(new javax.xml.namespace.QName("http://service.dcis", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
_operations[4] = oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("setERPJobStatus");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("http://service.dcis", "xmlContext"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
param.setOmittable(true);
param.setNillable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
oper.setReturnClass(java.lang.String.class);
oper.setReturnQName(new javax.xml.namespace.QName("http://service.dcis", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
_operations[5] = oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("syncProd");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("http://service.dcis", "paramXML"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
param.setOmittable(true);
param.setNillable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
oper.setReturnClass(java.lang.String.class);
oper.setReturnQName(new javax.xml.namespace.QName("http://service.dcis", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
_operations[6] = oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("callbackSrv");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("http://service.dcis", "paramXML"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
param.setOmittable(true);
param.setNillable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
oper.setReturnClass(java.lang.String.class);
oper.setReturnQName(new javax.xml.namespace.QName("http://service.dcis", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
_operations[7] = oper;
}
public ERPIServiceSoap11BindingStub() throws org.apache.axis.AxisFault {
this(null);
}
public ERPIServiceSoap11BindingStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
this(service);
super.cachedEndpoint = endpointURL;
}
public ERPIServiceSoap11BindingStub(javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
if (service == null) {
super.service = new org.apache.axis.client.Service();
} else {
super.service = service;
}
((org.apache.axis.client.Service)super.service).setTypeMappingVersion("1.2");
}
protected org.apache.axis.client.Call createCall() throws java.rmi.RemoteException {
try {
org.apache.axis.client.Call _call = super._createCall();
if (super.maintainSessionSet) {
_call.setMaintainSession(super.maintainSession);
}
if (super.cachedUsername != null) {
_call.setUsername(super.cachedUsername);
}
if (super.cachedPassword != null) {
_call.setPassword(super.cachedPassword);
}
if (super.cachedEndpoint != null) {
_call.setTargetEndpointAddress(super.cachedEndpoint);
}
if (super.cachedTimeout != null) {
_call.setTimeout(super.cachedTimeout);
}
if (super.cachedPortName != null) {
_call.setPortName(super.cachedPortName);
}
java.util.Enumeration keys = super.cachedProperties.keys();
while (keys.hasMoreElements()) {
java.lang.String key = (java.lang.String) keys.nextElement();
_call.setProperty(key, super.cachedProperties.get(key));
}
return _call;
}
catch (java.lang.Throwable _t) {
throw new org.apache.axis.AxisFault("Failure trying to get the Call object", _t);
}
}
public java.lang.String invokeSrv(java.lang.String paramXML) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[0]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("urn:invokeSrv");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://service.dcis", "invokeSrv"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {paramXML});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (java.lang.String) _resp;
} catch (java.lang.Exception _exception) {
return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
throw axisFaultException;
}
}
public java.lang.String setT100JobStatus(java.lang.String xmlContext) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[1]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("urn:setT100JobStatus");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://service.dcis", "setT100JobStatus"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {xmlContext});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (java.lang.String) _resp;
} catch (java.lang.Exception _exception) {
return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
throw axisFaultException;
}
}
public java.lang.String createFileData(java.lang.String paramXML) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[2]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("urn:createFileData");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://service.dcis", "createFileData"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {paramXML});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (java.lang.String) _resp;
} catch (java.lang.Exception _exception) {
return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
throw axisFaultException;
}
}
public java.lang.String exportDataToErp(java.lang.String endPoint, java.lang.String xml) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[3]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("urn:exportDataToErp");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://service.dcis", "exportDataToErp"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {endPoint, xml});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (java.lang.String) _resp;
} catch (java.lang.Exception _exception) {
return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
throw axisFaultException;
}
}
public java.lang.String createProduct4OA(java.lang.String requestJson) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[4]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("urn:createProduct4OA");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://service.dcis", "createProduct4OA"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {requestJson});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (java.lang.String) _resp;
} catch (java.lang.Exception _exception) {
return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
throw axisFaultException;
}
}
public java.lang.String setERPJobStatus(java.lang.String xmlContext) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[5]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("urn:setERPJobStatus");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://service.dcis", "setERPJobStatus"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {xmlContext});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (java.lang.String) _resp;
} catch (java.lang.Exception _exception) {
return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
throw axisFaultException;
}
}
public java.lang.String syncProd(java.lang.String paramXML) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[6]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("urn:syncProd");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://service.dcis", "syncProd"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {paramXML});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (java.lang.String) _resp;
} catch (java.lang.Exception _exception) {
return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
throw axisFaultException;
}
}
public java.lang.String callbackSrv(java.lang.String paramXML) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[7]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("urn:callbackSrv");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://service.dcis", "callbackSrv"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {paramXML});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (java.lang.String) _resp;
} catch (java.lang.Exception _exception) {
return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
throw axisFaultException;
}
}
}

View File

@ -0,0 +1,459 @@
/**
* ERPIServiceSoap12BindingStub.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.api.taojw.boge.webservice;
public class ERPIServiceSoap12BindingStub extends org.apache.axis.client.Stub implements com.api.taojw.boge.webservice.ERPIServicePortType {
private java.util.Vector cachedSerClasses = new java.util.Vector();
private java.util.Vector cachedSerQNames = new java.util.Vector();
private java.util.Vector cachedSerFactories = new java.util.Vector();
private java.util.Vector cachedDeserFactories = new java.util.Vector();
static org.apache.axis.description.OperationDesc [] _operations;
static {
_operations = new org.apache.axis.description.OperationDesc[8];
_initOperationDesc1();
}
private static void _initOperationDesc1(){
org.apache.axis.description.OperationDesc oper;
org.apache.axis.description.ParameterDesc param;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("invokeSrv");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("http://service.dcis", "paramXML"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
param.setOmittable(true);
param.setNillable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
oper.setReturnClass(java.lang.String.class);
oper.setReturnQName(new javax.xml.namespace.QName("http://service.dcis", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
_operations[0] = oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("setT100JobStatus");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("http://service.dcis", "xmlContext"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
param.setOmittable(true);
param.setNillable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
oper.setReturnClass(java.lang.String.class);
oper.setReturnQName(new javax.xml.namespace.QName("http://service.dcis", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
_operations[1] = oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("createFileData");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("http://service.dcis", "paramXML"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
param.setOmittable(true);
param.setNillable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
oper.setReturnClass(java.lang.String.class);
oper.setReturnQName(new javax.xml.namespace.QName("http://service.dcis", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
_operations[2] = oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("exportDataToErp");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("http://service.dcis", "endPoint"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
param.setOmittable(true);
param.setNillable(true);
oper.addParameter(param);
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("http://service.dcis", "xml"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
param.setOmittable(true);
param.setNillable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
oper.setReturnClass(java.lang.String.class);
oper.setReturnQName(new javax.xml.namespace.QName("http://service.dcis", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
_operations[3] = oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("createProduct4OA");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("http://service.dcis", "requestJson"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
param.setOmittable(true);
param.setNillable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
oper.setReturnClass(java.lang.String.class);
oper.setReturnQName(new javax.xml.namespace.QName("http://service.dcis", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
_operations[4] = oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("setERPJobStatus");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("http://service.dcis", "xmlContext"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
param.setOmittable(true);
param.setNillable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
oper.setReturnClass(java.lang.String.class);
oper.setReturnQName(new javax.xml.namespace.QName("http://service.dcis", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
_operations[5] = oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("syncProd");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("http://service.dcis", "paramXML"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
param.setOmittable(true);
param.setNillable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
oper.setReturnClass(java.lang.String.class);
oper.setReturnQName(new javax.xml.namespace.QName("http://service.dcis", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
_operations[6] = oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("callbackSrv");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("http://service.dcis", "paramXML"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, false, false);
param.setOmittable(true);
param.setNillable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
oper.setReturnClass(java.lang.String.class);
oper.setReturnQName(new javax.xml.namespace.QName("http://service.dcis", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
_operations[7] = oper;
}
public ERPIServiceSoap12BindingStub() throws org.apache.axis.AxisFault {
this(null);
}
public ERPIServiceSoap12BindingStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
this(service);
super.cachedEndpoint = endpointURL;
}
public ERPIServiceSoap12BindingStub(javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
if (service == null) {
super.service = new org.apache.axis.client.Service();
} else {
super.service = service;
}
((org.apache.axis.client.Service)super.service).setTypeMappingVersion("1.2");
}
protected org.apache.axis.client.Call createCall() throws java.rmi.RemoteException {
try {
org.apache.axis.client.Call _call = super._createCall();
if (super.maintainSessionSet) {
_call.setMaintainSession(super.maintainSession);
}
if (super.cachedUsername != null) {
_call.setUsername(super.cachedUsername);
}
if (super.cachedPassword != null) {
_call.setPassword(super.cachedPassword);
}
if (super.cachedEndpoint != null) {
_call.setTargetEndpointAddress(super.cachedEndpoint);
}
if (super.cachedTimeout != null) {
_call.setTimeout(super.cachedTimeout);
}
if (super.cachedPortName != null) {
_call.setPortName(super.cachedPortName);
}
java.util.Enumeration keys = super.cachedProperties.keys();
while (keys.hasMoreElements()) {
java.lang.String key = (java.lang.String) keys.nextElement();
_call.setProperty(key, super.cachedProperties.get(key));
}
return _call;
}
catch (java.lang.Throwable _t) {
throw new org.apache.axis.AxisFault("Failure trying to get the Call object", _t);
}
}
public java.lang.String invokeSrv(java.lang.String paramXML) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[0]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("urn:invokeSrv");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP12_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://service.dcis", "invokeSrv"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {paramXML});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (java.lang.String) _resp;
} catch (java.lang.Exception _exception) {
return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
throw axisFaultException;
}
}
public java.lang.String setT100JobStatus(java.lang.String xmlContext) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[1]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("urn:setT100JobStatus");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP12_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://service.dcis", "setT100JobStatus"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {xmlContext});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (java.lang.String) _resp;
} catch (java.lang.Exception _exception) {
return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
throw axisFaultException;
}
}
public java.lang.String createFileData(java.lang.String paramXML) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[2]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("urn:createFileData");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP12_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://service.dcis", "createFileData"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {paramXML});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (java.lang.String) _resp;
} catch (java.lang.Exception _exception) {
return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
throw axisFaultException;
}
}
public java.lang.String exportDataToErp(java.lang.String endPoint, java.lang.String xml) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[3]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("urn:exportDataToErp");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP12_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://service.dcis", "exportDataToErp"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {endPoint, xml});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (java.lang.String) _resp;
} catch (java.lang.Exception _exception) {
return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
throw axisFaultException;
}
}
public java.lang.String createProduct4OA(java.lang.String requestJson) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[4]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("urn:createProduct4OA");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP12_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://service.dcis", "createProduct4OA"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {requestJson});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (java.lang.String) _resp;
} catch (java.lang.Exception _exception) {
return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
throw axisFaultException;
}
}
public java.lang.String setERPJobStatus(java.lang.String xmlContext) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[5]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("urn:setERPJobStatus");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP12_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://service.dcis", "setERPJobStatus"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {xmlContext});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (java.lang.String) _resp;
} catch (java.lang.Exception _exception) {
return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
throw axisFaultException;
}
}
public java.lang.String syncProd(java.lang.String paramXML) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[6]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("urn:syncProd");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP12_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://service.dcis", "syncProd"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {paramXML});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (java.lang.String) _resp;
} catch (java.lang.Exception _exception) {
return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
throw axisFaultException;
}
}
public java.lang.String callbackSrv(java.lang.String paramXML) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[7]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("urn:callbackSrv");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP12_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://service.dcis", "callbackSrv"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {paramXML});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (java.lang.String) _resp;
} catch (java.lang.Exception _exception) {
return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
throw axisFaultException;
}
}
}

View File

@ -0,0 +1,74 @@
package com.api.taojw.bomei;
import com.alibaba.fastjson.JSONObject;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.logging.MyLogger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.Map;
/**
*
*/
@Path("/bmfzckb")
public class FzcKbApi {
Logger logger = MyLogger.getLogger();
//获取下一条提醒
@GET
@Path("/getNextSfkTx")
@Produces(MediaType.APPLICATION_JSON)
public String getNextSfkTx(@Context HttpServletRequest request, @Context HttpServletResponse response){
//响应数据
JSONObject result = new JSONObject();
try{
//当前展示的是第几条数据
String currentId = request.getParameter("currentId");
if("".equals(currentId) || currentId == null){
currentId = "0";
}
//当前用户
User user = HrmUserVarify.getUser(request, response);
logger.info("FzcKbApi.getNextSfkTx begin;currentId:" + currentId + ";user:" + user.getUID() + ";name:" + user.getLastname());
//查询比currentId大的下一条数据进行展示
RecordSet rs = new RecordSet();
String getNextTxSql =
"select " +
"top 1 " +
"t1.id,t4.khmc,t5.xmmc,t2.bcsqskje,t2.yskje," +
"case when t2.htzje is null or t2.htzje = 0 then '1.00' else FORMAT(t2.bcsqskje/t2.htzje,'N') end as bl," +
"t1.skrq " +
"from " +
"uf_skqd t1 " +
"inner join uf_skqd_dt1 t2 on t2.mainid = t1.id " +
"left join Modeviewlog_90 t3 on t3.operateuserid = ? and t3.relatedid = t1.id and t3.operatetype = 4 " +
"inner join uf_kh t4 on t4.id = t1.khmc " +
"inner join formtable_main_151 t5 on t5.id = t2.cwxm " +
"where " +
"t3.id is null " +
"and t1.id > ? " +
"order by " +
"t1.id ";
Map<String, String> txData = DaoUtil.getFirstData(rs, getNextTxSql, user.getUID(), currentId);
for(String key:txData.keySet()){
result.put(key,txData.get(key));
}
logger.info("FzcKbApi.getNextSfkTx end;result:" + result.toJSONString());
return result.toJSONString();
}catch(Exception e){
logger.error("FzcKbApi.getNextSfkTx exception;message:" + e.getMessage() + ";e:" + e);
return result.toJSONString();
}
}
}

View File

@ -0,0 +1,51 @@
package com.api.taojw.bomei.cronjob;
import com.alibaba.fastjson.JSONObject;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.interfaces.schedule.BaseCronJob;
import weaver.taojw.common.TjwModelUtil;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.logging.MyLogger;
import java.util.Map;
public class MakeDataCronJob extends BaseCronJob {
Logger logger = MyLogger.getLogger();
@Override
public void execute() {
try{
logger.info("MakeDataCronJob.execute() begin");
RecordSet rs = new RecordSet();
String getCountSql =
"select " +
"sum(case when xmzt in (31,38,39,40,48) then 1 else 0 end) as zjxms," +
"sum(case when xmzt in (41,42,43) then 1 else 0 end) as ysxms," +
"sum(case when mqsjscjd not in (9,10) then 1 else 0 end) as gzxms," +
"format(DATEADD(YEAR,-1,GETDATE()),'yyyy') as nf " +
"from " +
"uf_xm t1 " +
"where " +
"substring(t1.modedatacreatedate,1,4) = format(DATEADD(YEAR,-1,GETDATE()),'yyyy') ";
Map<String, String> firstData = DaoUtil.getFirstData(rs, getCountSql);
String zjxms = firstData.get("zjxms");
String ysxms = firstData.get("ysxms");
String gzxms = firstData.get("gzxms");
String nf = firstData.get("nf");
JSONObject json = new JSONObject();
json.put("zjxms",zjxms);
json.put("ysxms",ysxms);
json.put("gzxms",gzxms);
json.put("nf",nf);
TjwModelUtil.addModelData(rs,"uf_zjxms",json);
logger.info("MakeDataCronJob.execute() end");
}catch(Throwable e){
logger.error("MakeDataCronJob.execute() exception;message:" + e.getMessage() + ";e:" + e);
}
}
}

View File

@ -0,0 +1,206 @@
package com.api.taojw.bozhongjgj;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.api.doc.detail.util.DocDownloadCheckUtil;
import org.apache.log4j.Logger;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.rendering.PDFRenderer;
import sun.misc.BASE64Encoder;
import weaver.conn.RecordSet;
import weaver.file.ImageFileManager;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.taojw.common.CommonSqlUtil;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.TjwDocumentUtil;
import weaver.taojw.common.logging.MyLogger;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@Path("/fpdy")
public class GetFpImageApi {
static Logger logger = MyLogger.getLogger();
@GET
@Path("/getImageDataById")
@Produces(MediaType.APPLICATION_JSON)
public String getImageDataById(@Context HttpServletRequest request, @Context HttpServletResponse response){
JSONObject result = new JSONObject();
try{
RecordSet rs = new RecordSet();
//发票台账id
String requestId = request.getParameter("requestId");
String fieldNames = request.getParameter("fieldNames");
/*String workFlowIds = request.getParameter("workFlowIds");
String[] workFlowIdArr = workFlowIds.split(",");
String nodeIds = request.getParameter("nodeIds");
String[] nodeIdArr = nodeIds.split(",");
String requestIds = request.getParameter("requestIds");
List<String> requestIdList = new ArrayList<>();*/
String getBaseInfoSql =
"select workflowid,currentnodeid from workflow_requestbase where requestid = ?";
/*for(String requestIdInArr : requestIds.split(",")){
boolean requestIdInWorkflow = false;
boolean requestIdInNode = false;
Map<String, String> firstData = DaoUtil.getFirstData(rs, getBaseInfoSql, requestIdInArr);
String workflowid = firstData.get("firstData");
String currentnodeid = firstData.get("currentnodeid");
if(workflowid != null && !"".equals(workflowid) && currentnodeid != null && !"".equals(currentnodeid)){
for(String workFlowId : workFlowIdArr){
if(workFlowId.equals(workflowid)){
requestIdInWorkflow = true;
break;
}
}
for(String nodeid : nodeIdArr){
if(nodeid.equals(currentnodeid)){
requestIdInNode = true;
break;
}
}
}
if(requestIdInWorkflow && requestIdInNode){
requestIdList.add(requestIdInArr);
}
}*/
String tableName = CommonSqlUtil.getTableNameByRequetId(requestId,rs);
List<String> fpIdList = new ArrayList<>();
if(!"".equals(requestId) && requestId != null){
if(!"".equals(fieldNames) && fieldNames != null){
String[] fieldNameArr = fieldNames.split(",");
for(String fieldName : fieldNameArr){
String getTableNameSql = "select t1." + fieldName + " from " + tableName + "_dt1 t1 inner join " + tableName + " t2 on t2.id = t1.mainid where t2.requestid = ?";
List<Map<String, String>> data = DaoUtil.getData(rs, getTableNameSql, requestId);
for(Map<String, String> m : data){
String fpIds = m.get(fieldName.toLowerCase(Locale.ROOT));
if(fpIds != null && !"".equals(fpIds)){
String[] fpIdArr = fpIds.split(",");
for(String fpId : fpIdArr){
fpIdList.add(fpId);
}
}
}
}
}
}
/*for(String requestIdInArr : requestIdList){
if(!"".equals(fieldNames) && fieldNames != null){
String[] fieldNameArr = fieldNames.split(",");
for(String fieldName : fieldNameArr){
String getTableNameSql = "select t1." + fieldName + " from " + tableName + "_dt1 t1 inner join " + tableName + " t2 on t2.id = t1.mainid where t2.requestid = ?";
List<Map<String, String>> data = DaoUtil.getData(rs, getTableNameSql, requestIdInArr);
for(Map<String, String> m : data){
String fpIds = m.get(fieldName.toLowerCase(Locale.ROOT));
if(fpIds != null && !"".equals(fpIds)){
String[] fpIdArr = fpIds.split(",");
for(String fpId : fpIdArr){
fpIdList.add(fpId);
}
}
}
}
}
}*/
JSONArray res = new JSONArray();
User user = HrmUserVarify.getUser(request, response);
for(String id : fpIdList){
JSONObject o = new JSONObject();
//获取发票imageFileId
String imageFileId = "";
String imageFileType = "";
String fileSize = "";
String getImageFileIdSql = "select t1.imageid,t2.imagefilename,t2.filesize from fnainvoiceledger t1 inner join imagefile t2 on t2.imageFileId = t1.imageid where t1.id = ?";
Map<String, String> firstData = DaoUtil.getFirstData(rs, getImageFileIdSql, id);
if(firstData.size() > 0){
imageFileId = firstData.get("imageid");
String imageFileName = firstData.get("imagefilename");
fileSize = firstData.get("filesize");
imageFileType = imageFileName.substring(imageFileName.lastIndexOf(".")+1);
}
String newImageFileId = "";
try{
logger.info("DocDownloadCheckUtil.checkPermission begin;imageFileId:" + imageFileId + ";user:" + user.getUID());
newImageFileId = DocDownloadCheckUtil.checkPermission(imageFileId,user);
}catch (Exception e){
logger.error("DocDownloadCheckUtil.checkPermission exception;imageFileId:" + imageFileId + ";user:"+user.getUID()+";message:" + e.getMessage() + ";e:" + e);
}
o.put("imageFileType",imageFileType);
o.put("imageFileId",imageFileId);
o.put("newImageFileId",newImageFileId);
String imageImageFileId = pdfToImage(imageFileId);
o.put("base64",imageToBase64(imageImageFileId,fileSize));
res.add(o);
}
result.put("data",res);
}catch(Exception e){
logger.error("getImageDataById exception;message:" + e.getMessage() + ";e:" + e);
}
return result.toJSONString();
}
// 将图片文件转化为字节数组字符串并对其进行Base64编码处理
public static String imageToBase64(String imageFileId,String fileSize) {
byte[] data = null;
// 读取图片字节数组
try {
ImageFileManager imageFileManager = new ImageFileManager();
InputStream in = imageFileManager.getInputStreamById(Integer.parseInt(imageFileId));
data = new byte[Integer.parseInt(fileSize)*12];
in.read(data);
in.close();
} catch (Exception e) {
logger.error("imageToBase64 exception;message:" + e.getMessage() + ";e:" + e);
}
// 对字节数组Base64编码
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(data);// 返回Base64编码过的字节数组字符串
}
public String pdfToImage(String pdfImageFileId){
try {
ImageFileManager imageFileManager = new ImageFileManager();
InputStream in = imageFileManager.getInputStreamById(Integer.parseInt(pdfImageFileId));
PDDocument doc = PDDocument.load(in);
PDFRenderer renderer = new PDFRenderer(doc);
int pageCount = doc.getNumberOfPages();
int fileByInputSteam = 0;
for(int i=0;i<pageCount;i++){
BufferedImage image = renderer.renderImageWithDPI(i, 296);
//BufferedImage image = renderer.renderImage(i, 2.5f);
File imageFile = new File(pdfImageFileId+"image.png");
ImageIO.write(image, "PNG", imageFile);
fileByInputSteam = TjwDocumentUtil.createFileByInputSteam(new FileInputStream(imageFile), pdfImageFileId + "image.png");
}
return fileByInputSteam + "";
} catch (Exception e) {
logger.error("pdfToImage exception;message:" + e.getMessage() + ";id:" + pdfImageFileId);
return pdfImageFileId;
}
}
}

View File

@ -0,0 +1,70 @@
package com.api.taojw.chuanbo.api;
import com.alibaba.fastjson.JSONObject;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.taojw.common.CommonSqlUtil;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.TjwWorkFlowUtil;
import weaver.taojw.common.logging.MyLogger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.HashMap;
import java.util.Map;
/**
*
* api
*/
@Path("/zctjw")
public class StartWorkFlowApi {
Logger logger = MyLogger.getLogger();
@GET
@Path("/startWorkFlowApi")
@Produces(MediaType.APPLICATION_JSON)
public String startWorkFlowApi(@Context HttpServletRequest request, @Context HttpServletResponse response){
//响应数据
JSONObject result = new JSONObject();
try{
logger.info("StartWorkFlowApi.multiSubmitApi begin;");
User user = HrmUserVarify.getUser(request, response);
RecordSet rs = new RecordSet();
//发起的流程workFlowId
String workFlowId = Util.null2String(request.getParameter("workFlowId"));
//建模id
String modeId = Util.null2String(request.getParameter("modeId"));
String modeTableName = CommonSqlUtil.getTableNameByModeId(modeId,rs);
//勾选的id
String selectedIds = Util.null2String(request.getParameter("selectedIds"));
if(selectedIds == null || "".equals(selectedIds)){
result.put("flag","3");
return result.toJSONString();
}
String[] selectedIdArr = selectedIds.split(",");
String getModeDataSql = "select * from " + modeTableName + " where id = ?";
for(String id : selectedIdArr){
Map<String, String> firstData = DaoUtil.getFirstData(rs, getModeDataSql, id);
Map<String, String> mainTable = new HashMap<>();
mainTable.put("xgya",firstData.get("xgyt"));
String requestName = firstData.get("dbmc");
TjwWorkFlowUtil.createWorkFlow(requestName,user.getUID()+"",workFlowId,"1",mainTable,null);
}
result.put("flag","1");
return result.toJSONString();
}catch(Exception e){
logger.error("MultiSubmitApi.multiSubmitApi exception;message:" + e.getMessage() + ";e:" + e);
return result.toJSONString();
}
}
}

View File

@ -0,0 +1,88 @@
package com.api.taojw.chuanbo.servlet;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.taojw.common.CommonSqlUtil;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.TjwDocumentUtil;
import weaver.taojw.common.logging.MyLogger;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.*;
public class FileDownloadServlet extends HttpServlet{
Logger logger = MyLogger.getLogger();
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
this.doGet(req, res);
}
public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
RecordSet rs = new RecordSet();
//获取参数
String modeId = Util.null2String(req.getParameter("modeId"));
String tableName = CommonSqlUtil.getTableNameByModeId(modeId,rs);
String columns = Util.null2String(req.getParameter("columns"));
String ids = Util.null2String(req.getParameter("ids"));
String fileName = Util.null2String(req.getParameter("ids"));
logger.info("FileDownloadServlet.param: modeId:" + modeId + ";columns:" + columns + ";ids:" + ids);
if("".equals(ids) || ids == null || columns == null || "".equals(columns)){
return;
}
String[] idArr = ids.split(",");
String[] columnArr = columns.split(",");
String getDocIdSql = "SELECT " + columns + " from " + tableName + " where id = ?";
String getImageFileInfoSql = "select imagefilename,imagefileid from docimagefile where docid = ? order by versionid desc";
List<String> docIdList = new ArrayList<>();
for(String id : idArr){
Map<String, String> firstData = DaoUtil.getFirstData(rs, getDocIdSql, id);
for(String column : columnArr){
String docId = firstData.get(column.toLowerCase(Locale.ROOT));
if(docId != null && !"".equals(docId)){
docIdList.add(firstData.get(column.toLowerCase(Locale.ROOT)));
}
}
}
List<Map<String,String>> imageFileInfos = new ArrayList<>();
for(String docId : docIdList){
Map<String, String> firstData = DaoUtil.getFirstData(rs, getImageFileInfoSql, docId);
Map<String, String> m = new HashMap<>();
m.put("imageFileId",firstData.get("imagefileid"));
m.put("imageFileName",firstData.get("imagefilename"));
imageFileInfos.add(m);
}
//响应文件
downloadExcel(res,imageFileInfos,fileName);
}
public void downloadExcel(HttpServletResponse res,List<Map<String,String>> imageFileInfos,String fileName){
try {
res.setContentType("application/octet-stream");
res.setHeader("Content-Disposition", "attachment; filename="+ URLEncoder.encode(fileName,"UTF-8"));
//res.setHeader("Content-Length", String.valueOf(fis.getChannel().size()));
ServletOutputStream servletOutputStream = res.getOutputStream();
try{
TjwDocumentUtil.toZip(imageFileInfos,servletOutputStream);
//关闭资源
servletOutputStream.close();
}catch(Throwable e){
logger.error("FileDownloadServlet.return file exception;exception:" + e.getMessage() + ";e:" + e);
}finally {
servletOutputStream.close();
}
} catch (Exception e) {
logger.error("FileDownloadServlet exception;e:" + e.getMessage() + ";e:" + e);
}
logger.info("FileDownloadServlet done");
}
}

View File

@ -0,0 +1,460 @@
package com.api.taojw.common;
import com.alibaba.fastjson.JSONObject;
import com.api.taojw.common.logging.MyLogger;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.conn.RecordSetTrans;
import weaver.general.Util;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CommonSqlUtil {
static Logger logger = MyLogger.getLogger();
public static List<Map<String, String>> getDoneInfo(String userId){
try {
RecordSet rs = new RecordSet();
String getDoneInfoSql =
"select " +
"a.requestId as id, a.requestId as requestId, " +
"a.workflowId, a.requestName, a.requestnamenew,a.creater, a.creatertype, a.createDate, a.createTime, " +
"c.workflowname,b.viewtype,b.nodeid,b.isremark,b.agentorbyagentid,b.agenttype,b.isprocessed ,b.viewDate," +
"b.viewTime,a.lastFeedBackDate,a.lastFeedBackTime,b.needwfback,a.lastFeedBackOperator,b.userid," +
"(case WHEN b.operatedate IS NULL THEN b.receivedate ELSE b.operatedate END) operatedatenew,(case WHEN b.operatetime IS NULL THEN b.receivetime ELSE b.operatetime END) operatetimenew " +
"FROM " +
"Workflow_CurrentOperator b " +
"inner join Workflow_RequestBase a on a.requestId = b.requestId " +
"inner join workflow_base c on a.workflowid = c.id " +
"WHERE " +
"b.userId = ? " +
"AND (b.isRemark in ('2', '4') or (b.isremark=0 and b.takisremark =-2)) " +
"AND b.userType = 0 " +
"AND b.isLastTimes = 1 " +
"and (a.deleted<>1 or a.deleted is null or a.deleted='') " +
"AND (b.isComplete = 1 OR b.agenttype<>1)";
List<Map<String, String>> data = DaoUtil.getData(rs, getDoneInfoSql, userId);
return data;
}catch(Throwable e){
logger.error("CommonSqlUtil.getDoneInfo error;message:" + e.getMessage() + ";e:" + e);
return new ArrayList<>();
}
}
public static List<Map<String, String>> getWorkFlowCurrentUser(String requestId){
RecordSet rs = new RecordSet();
//数据库类型
String dbType = rs.getDBType();
//查询人员待办数量、邮箱地址、人员id
String sql = "";
if("mysql".equalsIgnoreCase(dbType)){
sql =
"select " +
"t3.id " +
"from " +
"workflow_requestbase t1 " +
"inner join workflow_currentoperator t2 on t1.requestid = t2.requestid " +
"inner join workflow_nodebase t5 on t5.id = t1.currentnodeid " +
"inner join hrmresource t3 on t3.id = t2.userid " +
"where " +
"((isremark='0' and (takisremark is null or takisremark=0)) or isremark in ('1','5','7','8','9','11')) " +
"and islasttimes = 1 " +
"and (ifnull(t1.currentstatus,-1) = -1 or (ifnull(t1.currentstatus,-1)=0 and t1.creater in (1))) " +
"and (t1.deleted<>1 or t1.deleted is null or t1.deleted='') " +
"and (t2.isprocessing = '' or t2.isprocessing is null) " +
"and ((t2.isremark not in('1','8','9','11') or (t2.isremark='1' and t2.takisremark='2'))) " +
"and t1.requestid = ?";
}
if("sqlserver".equalsIgnoreCase(dbType)){
sql =
"select " +
"t3.id " +
"from " +
"workflow_currentoperator t2 " +
"inner join workflow_requestbase t1 on t1.requestid = t2.requestid " +
"inner join hrmresource t3 on t3.id = t2.userid " +
"where " +
"((isremark='0'and (takisremark is null or takisremark=0)) or isremark in ('1','5','7','8','9','11')) " +
"and islasttimes=1 " +
"and (isnull(t1.currentstatus,-1) = -1 or (isnull(t1.currentstatus,-1)=0 and t1.creater in (1))) " +
"and (t1.deleted<>1 or t1.deleted is null or t1.deleted='') " +
"and (t2.isprocessing = '' or t2.isprocessing is null) " +
"and ((t2.isremark not in('1','8','9','11') or (t2.isremark='1' and t2.takisremark='2'))) " +
"and t1.requestid = ?";
}
if("oracle".equalsIgnoreCase(dbType)){
sql =
"select " +
"t3.id " +
"from " +
"workflow_currentoperator t2," +
"workflow_requestbase t1," +
"hrmresource t3 " +
"where " +
"t1.requestid = t2.requestid " +
"and t3.id = t2.userid " +
"and ((isremark='0'and (takisremark is null or takisremark=0)) or isremark in ('1','5','7','8','9','11')) " +
"and islasttimes=1 " +
"and (NVL(t1.currentstatus,-1) = -1 or (NVL(t1.currentstatus,-1)=0 and t1.creater in (1))) " +
"and (t1.deleted<>1 or t1.deleted is null or t1.deleted='') " +
"and (t2.isprocessing = '' or t2.isprocessing is null) " +
"and ((t2.isremark not in('1','8','9','11') or (t2.isremark='1' and t2.takisremark='2'))) " +
"and t1.requestid = ?";
}
List<Map<String, String>> data = DaoUtil.getData(rs, sql, requestId);
return data;
}
public static List<Map<String, String>> getTodoInfo(String userId){
RecordSet rs = new RecordSet();
//数据库类型
String dbType = rs.getDBType();
//查询人员待办数量、邮箱地址、人员id
String sql = "";
if("mysql".equalsIgnoreCase(dbType)){
sql =
"select " +
"t1.requestid,t1.workflowid " +
"from " +
"workflow_requestbase t1 " +
"inner join workflow_currentoperator t2 on t1.requestid = t2.requestid " +
"inner join workflow_nodebase t5 on t5.id = t1.currentnodeid " +
"inner join hrmresource t3 on t3.id = t2.userid " +
"where " +
"((isremark='0' and (takisremark is null or takisremark=0)) or isremark in ('1','5','7','8','9','11')) " +
"and islasttimes = 1 " +
"and (ifnull(t1.currentstatus,-1) = -1 or (ifnull(t1.currentstatus,-1)=0 and t1.creater in (1))) " +
"and (t1.deleted<>1 or t1.deleted is null or t1.deleted='') " +
"and (t2.isprocessing = '' or t2.isprocessing is null) " +
"and ((t2.isremark not in('1','8','9','11') or (t2.isremark='1' and t2.takisremark='2'))) " +
"and t3.id = ?";
}
if("sqlserver".equalsIgnoreCase(dbType)){
sql =
"select " +
"t1.requestid,t1.workflowid " +
"from " +
"workflow_currentoperator t2 " +
"inner join workflow_requestbase t1 on t1.requestid = t2.requestid " +
"inner join hrmresource t3 on t3.id = t2.userid " +
"where " +
"((isremark='0'and (takisremark is null or takisremark=0)) or isremark in ('1','5','7','8','9','11')) " +
"and islasttimes=1 " +
"and (isnull(t1.currentstatus,-1) = -1 or (isnull(t1.currentstatus,-1)=0 and t1.creater in (1))) " +
"and (t1.deleted<>1 or t1.deleted is null or t1.deleted='') " +
"and (t2.isprocessing = '' or t2.isprocessing is null) " +
"and ((t2.isremark not in('1','8','9','11') or (t2.isremark='1' and t2.takisremark='2'))) " +
"and t3.id = ?";
}
if("oracle".equalsIgnoreCase(dbType)){
sql =
"select " +
"t1.requestid,t1.workflowid " +
"from " +
"workflow_currentoperator t2," +
"workflow_requestbase t1," +
"hrmresource t3 " +
"where " +
"t1.requestid = t2.requestid " +
"and t3.id = t2.userid " +
"and ((isremark='0'and (takisremark is null or takisremark=0)) or isremark in ('1','5','7','8','9','11')) " +
"and islasttimes=1 " +
"and (NVL(t1.currentstatus,-1) = -1 or (NVL(t1.currentstatus,-1)=0 and t1.creater in (1))) " +
"and (t1.deleted<>1 or t1.deleted is null or t1.deleted='') " +
"and (t2.isprocessing = '' or t2.isprocessing is null) " +
"and ((t2.isremark not in('1','8','9','11') or (t2.isremark='1' and t2.takisremark='2'))) " +
"and t3.id = ?";
}
List<Map<String, String>> data = DaoUtil.getData(rs, sql, userId);
return data;
}
/**
* id
* @param id
* @return
*/
public static void getAllParentDepartment(List<String> result,String id){
RecordSet rs = new RecordSet();
String getParentDepartmentSql = "select supdepid from hrmdepartment where id = ?";
Map<String, String> firstData = DaoUtil.getFirstData(rs, getParentDepartmentSql, id);
String parentId = Util.null2String(firstData.get("supdepid"));
if("".equals(parentId)){
return ;
}else{
result.add(parentId);
getAllParentDepartment(result,parentId);
}
}
/**
* id
* @param id
* @return
*/
public static void getAllSonDepartment(List<String> result,String id){
RecordSet rs = new RecordSet();
String getParentDepartmentSql = "select id from hrmdepartment where supdepid = ?";
List<Map<String, String>> data = DaoUtil.getData(rs, getParentDepartmentSql, id);
if(data.size() == 0){
return ;
}else{
for(Map<String, String> m : data){
result.add(m.get("id"));
getAllSonDepartment(result,m.get("id"));
}
}
}
/**
*
* @param uuid
* @return
*/
public static String getSystemParamValue(String uuid,RecordSet rs){
String result = "";
try{
String getDataByUuidSql =
"select paramvalue as result from uf_systemconfig where uuid = ?";
if(rs.executeQuery(getDataByUuidSql,uuid)){
if(rs.next()){
result = Util.null2String(rs.getString("result"));
}
}else{
logger.error("CommonSqlUtil.getSystemParamValue.getDataByUuidSql execute error;sql:" + getDataByUuidSql);
}
}catch (Exception e){
logger.error("CommonSqlUtil.getSystemParamValue exception;uuid:" + uuid);
}
return result;
}
/**
* ID
* @param workFlowId ID
* @return
*/
public static String getTableNameByWorkflowId(String workFlowId,RecordSet rs){
String tableName = "";
try{
String getTableNameByWorkFlowIdSql =
"select tablename from workflow_bill where id in (select formid from workflow_base where id = ?)";
if(rs.executeQuery(getTableNameByWorkFlowIdSql,workFlowId)){
if(rs.next()){
tableName = Util.null2String(rs.getString("tablename"));
}else{
logger.error("CommonSqlUtil.getTableNameByWorkflowId.getTableNameByWorkFlowIdSql execute success but found nothing;sql:" + getTableNameByWorkFlowIdSql);
}
}else{
logger.error("CommonSqlUtil.getTableNameByWorkflowId.getTableNameByWorkFlowIdSql execute error;sql:" + getTableNameByWorkFlowIdSql);
}
}catch (Exception e){
logger.error("CommonSqlUtil.getTableNameByWorkflowId exception;workFlowId:" + workFlowId);
}
return tableName;
}
/**
* requestId
* @param requestId
* @param rs
* @return
*/
public static String getTableNameByRequetId(String requestId, RecordSet rs){
String tableName = "";
try{
String getTableNameByRequetIdSql =
"select tablename from workflow_bill where id = (Select formid from workflow_base where id = (select workflowid from workflow_requestbase where requestid = ? ))";
if(rs.executeQuery(getTableNameByRequetIdSql,requestId)){
if(rs.next()){
tableName = Util.null2String(rs.getString("tablename"));
}else{
logger.error("CommonSqlUtil.getTableNameByRequetId.getTableNameByRequetIdSql execute success but found nothing;sql:" + getTableNameByRequetIdSql);
}
}else{
logger.error("CommonSqlUtil.getTableNameByRequetId.getTableNameByRequetIdSql execute error;sql:" + getTableNameByRequetIdSql);
}
}catch (Exception e){
logger.error("CommonSqlUtil.getTableNameByRequetId exception;requestId:" + requestId);
}
return tableName;
}
/**
* modeId
* @param modeId
* @param rs
* @return
*/
public static String getTableNameByModeId(String modeId, RecordSet rs){
String tableName = "";
try{
String getTableNameSql =
"select t2.tablename from modeinfo t1 inner join workflow_bill t2 on t2.id = t1.formid where t1.id = ?";
if(rs.executeQuery(getTableNameSql,modeId)){
if(rs.next()){
tableName = Util.null2String(rs.getString("tablename"));
}else{
logger.error("CommonSqlUtil.getTableNameByModeId.getTableNameSql execute success but found nothing;sql:" + getTableNameSql + ";modeId:" + modeId);
}
}else{
logger.error("CommonSqlUtil.getTableNameByModeId.getTableNameSql execute error;sql:" + getTableNameSql+ ";modeId:" + modeId);
}
}catch (Exception e){
logger.error("CommonSqlUtil.getTableNameByModeId.getTableNameSql exception;modeId:" + modeId);
}
return tableName;
}
/**
* modeId
* @param tableName
* @param rs
* @return
*/
public static int getModeIdByTableName(String tableName, RecordSet rs){
int modeId = -1;
try{
String getModeIdSql =
"select t1.id from modeinfo t1 inner join workflow_bill t2 on t2.id = t1.formid where t2.tablename = '" + tableName + "' and t1.isdelete = 0";
if(rs.executeQuery(getModeIdSql)){
if(rs.next()){
modeId = Util.getIntValue(rs.getString("id"),0);
}else{
logger.error("CommonSqlUtil.getModeIdByTableName.getModeIdSql execute success but found nothing;sql:" + getModeIdSql);
}
}else{
logger.error("CommonSqlUtil.getModeIdByTableName.getModeIdSql execute error;sql:" + getModeIdSql);
}
}catch (Exception e){
logger.error("CommonSqlUtil.getModeIdByTableName.getModeIdSql exception;tableName:" + tableName);
}
return modeId;
}
/**
* requestId
* @param requestId
* @return
*/
public static List<Map<String,String>> getProcessInfoList(String requestId,RecordSet rs){
List<Map<String,String>> result = new ArrayList<>();
try{
if(rs == null){
rs = new RecordSet();
}
String selectSQL =
"Select " +
"t2.departmentid as deptid," +
"t3.departmentname as deptname," +
"t1.operator as createuserid," +
"t2.lastname as createusername," +
"t1.operatedate as operatedate," +
"t1.operatetime as operatetime," +
"t1.logtype as serviceactioncode," +
"t1.remark as suggestion " +
"from " +
"workflow_requestlog t1 " +
"left join Hrmresource t2 on t2.id= t1.operator " +
"left join hrmdepartment t3 on t3.id= t2.departmentid " +
"where " +
"t1.requestid = ? " +
"order by " +
"t1.operatedate asc,t1.operatetime asc";
if(rs.executeQuery(selectSQL,requestId)){
while(rs.next()){
Map<String,String> processInfo = new HashMap<>();
processInfo.put("deptid",Util.null2String(rs.getString("deptid")));
processInfo.put("deptname",Util.null2String(rs.getString("deptname")));
processInfo.put("createuserid",Util.null2String(rs.getString("createuserid")));
processInfo.put("createusername",Util.null2String(rs.getString("createusername")));
processInfo.put("serviceactiontime",Util.null2String(rs.getString("operatedate")) + " " + Util.null2String(rs.getString("operatetime")));
String serviceactioncode = Util.null2String(rs.getString("serviceactioncode"));
String serviceaction = "";
switch (serviceactioncode){
case "0": serviceaction = "批准"; break;
case "1": serviceaction = "保存"; break;
case "2": serviceaction = "提交"; break;
case "3": serviceaction = "退回"; break;
case "4": serviceaction = "重新打开"; break;
case "5": serviceaction = "删除"; break;
case "6": serviceaction = "激活"; break;
case "7": serviceaction = "转发"; break;
case "9": serviceaction = "批注"; break;
case "a": serviceaction = "意见征询"; break;
case "b": serviceaction = "意见征询回复"; break;
case "e": serviceaction = "强制归档"; break;
case "h": serviceaction = "转办"; break;
case "i": serviceaction = "干预"; break;
case "j": serviceaction = "转办反馈"; break;
case "s": serviceaction = "督办"; break;
case "t": serviceaction = "抄送"; break;
default: serviceaction = "其他"; break;
}
processInfo.put("serviceaction",serviceaction);
String suggestion = Util.null2String(rs.getString("suggestion"));
if(!"".equals(suggestion)){
suggestion = CommonUtil.delHTMLTag(suggestion);
}
processInfo.put("suggestion",suggestion);
result.add(processInfo);
}
}else{
logger.error("CommonSqlUtil.getProcessInfoList.sql error;sql:" + selectSQL + ";requestId:" + requestId);
}
}catch(Exception e){
logger.error("CommonSqlUtil.getProcessInfoList exception;requestId:" + requestId + ";message:" + e.getMessage() + ";e:" + e);
}
return result;
}
/**
* requestid
* @param rs
* @param requestId
* @return
*/
public static String getWorkFlowSuggestion(RecordSetTrans rs, String requestId){
String result = "";
String getWorkFlowSuggestionSql =
"Select " +
"t2.departmentid as deptid," +
"t3.departmentname as deptname," +
"t1.operator as createuserid," +
"t2.lastname as createusername," +
"t1.operatedate as operatedate," +
"t1.operatetime as operatetime," +
"t1.logtype as logtype," +
"t1.remark as suggestion " +
"from " +
"workflow_requestlog t1 " +
"left join Hrmresource t2 on t2.id= t1.operator " +
"left join hrmdepartment t3 on t3.id= t2.departmentid " +
"where " +
"requestid = ? " +
"order by " +
"t1.operatedate desc,t1.operatetime desc";
try{
if(rs.executeQuery(getWorkFlowSuggestionSql,requestId)){
if(rs.next()){
result = Util.null2String(rs.getString("suggestion"));
}
}else{
logger.error("CommonSqlUtil.getWorkFlowSuggestion execute error;getWorkFlowSuggestionSql:" + getWorkFlowSuggestionSql);
}
}catch (Exception e){
logger.error("CommonSqlUtil.getFormatTimeByTimeMillis execute error;getWorkFlowSuggestionSql:" + getWorkFlowSuggestionSql + "exception:" + e.getMessage() + ";e:" + e);
}
return result;
}
}

View File

@ -0,0 +1,318 @@
package com.api.taojw.common;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.api.taojw.common.logging.MyLogger;
import org.apache.log4j.Logger;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class CommonUtil {
static Logger logger = MyLogger.getLogger();
static SimpleDateFormat sdfDateAndTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
static DecimalFormat jeFormat = new DecimalFormat("###,##0.00");
static DecimalFormat twoXsFormat = new DecimalFormat("0.00");
/**
*
* @return
*/
public static JSONObject getLastMonthDate(){
JSONObject result = new JSONObject();
try{
SimpleDateFormat df =new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MONTH, -1);
calendar.set(Calendar.DAY_OF_MONTH, 1);
String berforeFirstDay = df.format(calendar.getTime());
result.put("lastMonthBegin",berforeFirstDay);
Calendar calendar1 = Calendar.getInstance();
calendar1.set(Calendar.DAY_OF_MONTH, 1);
calendar1.add(Calendar.DATE, -1);
String berforeLastDay = df.format(calendar1.getTime());
result.put("berforeLastDay",berforeLastDay);
//logger.error("CommonUtil.getLastMonthDate done;result:" + result.toJSONString());
}catch(Exception e){
logger.error("CommonUtil.getLastMonthDate exception;message:" + e.getMessage() + ";e:" + e);
}
return result;
}
/**
*
* @param js
* @param bjs
* @return
*/
public static String minusString(String js,String bjs) {
try{
Float jsFloat;
try {
jsFloat = Float.parseFloat(js);
} catch (Exception e) {
logger.error("CommonUtil.minusString.parseFloat data error;js:" + js);
return "0.00";
}
Float bjsFloat;
try {
bjsFloat = Float.parseFloat(bjs);
} catch (Exception e) {
logger.error("CommonUtil.minusString.parseFloat data error;bjs:" + bjs);
return "0.00";
}
return twoXsFormat.format(bjsFloat - jsFloat);
}catch(Exception e){
logger.error("CommonUtil.multiplyHundred exception;js:" + js + ";bjs:" + bjs + ";message:" + e.getMessage() + ";e:" + e);
return "0.00";
}
}
/**
* 100
* @param data
* @return
*/
public static String multiplyHundred(String data) {
try{
Float dataFloat;
try {
dataFloat = Float.parseFloat(data);
} catch (Exception e) {
logger.error("CommonUtil.multiplyHundred.parseFloat data error;data:" + data);
return "0.00";
}
dataFloat = dataFloat * 100;
return twoXsFormat.format(dataFloat);
}catch(Exception e){
logger.error("CommonUtil.multiplyHundred exception;data:" + data + ";message:" + e.getMessage() + ";e:" + e);
return "0.00";
}
}
/**
*
* @param data
* @return
*/
public static String formatMoney(String data) {
try{
Float dataFloat;
try {
dataFloat = Float.parseFloat(data);
} catch (Exception e) {
logger.error("CommonUtil.formatMoney.parseFloat data error;data:" + data);
return "0.00";
}
return jeFormat.format(dataFloat);
}catch(Exception e){
logger.error("CommonUtil.formatMoney exception;data:" + data + ";message:" + e.getMessage() + ";e:" + e);
return "0.00";
}
}
/**
*
* 100
* @param fz
* @param fm
* @return
*/
public static String getBl(String fz,String fm,String needMultiplyHundred) {
try {
String result = "";
Float fzFloat;
Float fmFloat;
try {
fzFloat = Float.parseFloat(fz);
} catch (Exception e) {
logger.error("CommonUtil.getBl.parseFloat fz error;fz:" + fz);
return "0.00";
}
try {
fmFloat = Float.parseFloat(fm);
} catch (Exception e) {
logger.error("CommonUtil.getBl.parseFloat fm error;fm:" + fm);
return "0.00";
}
BigDecimal oldDataBd = new BigDecimal(fm);
if(oldDataBd.compareTo(BigDecimal.ZERO)==0){
return "0.00";
}
if("1".equals(needMultiplyHundred)){
result = twoXsFormat.format(100 * fzFloat / fmFloat);
}else{
result = twoXsFormat.format(fzFloat / fmFloat);
}
return result;
} catch (Exception e) {
logger.error("CommonUtil.getBl exception;fz:" + fz + ";fm:"+ fm + ";message:" + e.getMessage() + ";e:" + e);
return "0.00";
}
}
/**
*
* 100
* @param oldData
* @param newData
* @return
*/
public static String getGrowthRate(String oldData,String newData) {
try {
String result = "";
Float oldDataFloat;
Float newDataFloat;
try {
oldDataFloat = Float.parseFloat(oldData);
} catch (Exception e) {
logger.error("CommonUtil.getGrowthRate.parseFloat oldData error;oldData:" + oldData);
return "100.00";
}
try {
newDataFloat = Float.parseFloat(newData);
} catch (Exception e) {
logger.error("CommonUtil.getGrowthRate.parseFloat newData error;newData:" + newData);
return "-100.00";
}
BigDecimal oldDataBd = new BigDecimal(oldData);
if(oldDataBd.compareTo(BigDecimal.ZERO)==0){
return "100.00";
}
result = twoXsFormat.format(100*(newDataFloat - oldDataFloat) / oldDataFloat);
return result;
} catch (Exception e) {
logger.error("CommonUtil.getGrowthRate exception;oldData:" + oldData + ";newData:"+ newData + ";message:" + e.getMessage() + ";e:" + e);
return "0.00";
}
}
/**
* html
* @param htmlStr
* @return
*/
public static String delHTMLTag(String htmlStr){
String regEx_script="<script[^>]*?>[\\s\\S]*?<\\/script>"; //定义script的正则表达式
String regEx_style="<style[^>]*?>[\\s\\S]*?<\\/style>"; //定义style的正则表达式
String regEx_html="<[^>]+>"; //定义HTML标签的正则表达式
Pattern p_script=Pattern.compile(regEx_script,Pattern.CASE_INSENSITIVE);
Matcher m_script=p_script.matcher(htmlStr);
htmlStr=m_script.replaceAll(""); //过滤script标签
Pattern p_style=Pattern.compile(regEx_style,Pattern.CASE_INSENSITIVE);
Matcher m_style=p_style.matcher(htmlStr);
htmlStr=m_style.replaceAll(""); //过滤style标签
Pattern p_html=Pattern.compile(regEx_html,Pattern.CASE_INSENSITIVE);
Matcher m_html=p_html.matcher(htmlStr);
htmlStr=m_html.replaceAll(""); //过滤html标签
return htmlStr.trim(); //返回文本字符串
}
/**
* jsonJSONArray
* @param obj JSONObject
* @param path a/b/c
* @return JSONArray
*/
public static JSONArray getJsonArrayByPath(JSONObject obj, String path){
try{
int index = path.indexOf("/");
if(index > -1){
JSONObject son;
Object sons = obj.get(path.substring(0,index));
if(sons instanceof JSONArray){
son = (JSONObject) ((JSONArray) sons).get(0);
}else{
son = obj.getJSONObject(path.substring(0,index));
}
return getJsonArrayByPath(son,path.substring(index+1));
}else{
return obj.getJSONArray(path);
}
}catch(Exception e){
logger.error("CommonUtil.getJsonArrayByPath error;exception:" + e.getMessage() + ";e:" + e);
return new JSONArray();
}
}
/**
* json
* @param obj JSONObject
* @param path a/b/c
* @return
*/
public static String getJsonValueByPath(JSONObject obj, String path){
try{
int index = path.indexOf("/");
if(index > -1){
JSONObject son;
Object sons = obj.get(path.substring(0,index));
if(sons instanceof JSONArray){
son = (JSONObject) ((JSONArray) sons).get(0);
}else{
son = obj.getJSONObject(path.substring(0,index));
}
return getJsonValueByPath(son,path.substring(index+1));
}else{
return obj.get(path).toString();
}
}catch(Exception e){
logger.error("CommonUtil.getJsonValueByPath error;path:" + path + ";obj" + obj + "exception:" + e.getMessage() + ";e:" + e);
return "";
}
}
/**
* <br>&nbsp;
* @param input
* @return
*/
public static String manyLineToString(String input) {
if("".equals(input) || input == null){
return "";
}
String result = "";
input = input.replaceAll("<br>"," ");
input = input.replaceAll("&nbsp;"," ");
result = fullToHalfAngle(input);
char c[] = input.toCharArray();
for (int i = 0; i < c.length; i++) {
if (c[i] == '\u3000') {
c[i] = ' ';
} else if (c[i] > '\uFF00' && c[i] < '\uFF5F') {
c[i] = (char) (c[i] - 65248);
}
}
return result;
}
/**
*
* @param input
* @return
*/
public static String fullToHalfAngle(String input) {
char c[] = input.toCharArray();
for (int i = 0; i < c.length; i++) {
if (c[i] == '\u3000') {
c[i] = ' ';
} else if (c[i] > '\uFF00' && c[i] < '\uFF5F') {
c[i] = (char) (c[i] - 65248);
}
}
String returnString = new String(c);
return returnString;
}
}

View File

@ -0,0 +1,118 @@
package com.api.taojw.common;
/**
*
*/
public class Constant {
//action接口调用配置表名称
public static String CONFIG_TABLE_NAME = "uf_lcdyjkpzxxbd";
//------------------------------------------------------------------------------接口请求日志表名及字段
//action调用接口日志记录表表名
public static String LOG_TABLE_NAME = "uf_lcdyjkrzjlbd";
//action调用接口日志记录表requestId字段名称
public static String LOG_REQUESTID_COLUMN = "lcrequestid";
//action调用接口日志记录表请求正文字段名称
public static String LOG_REQUEST_COLUMN = "qqbw";
//action调用接口日志记录表响应文字段名称
public static String LOG_RESPONSE_COLUMN = "xybw";
//action调用接口日志记录表响应码字段名称
public static String LOG_RESPONSECODE_COLUMN = "xym";
//action调用接口日志记录表请求地址字段名称
public static String LOG_REQUEST_ADDRESS_COLUMN = "qqdz";
//action调用接口日志记录表请求头字段名称
public static String LOG_REQUEST_HEADER_COLUMN = "qqt";
//action调用接口日志记录表请求头字段名称
public static String LOG_REQUEST_RESULT_COLUMN = "qqjg";
//------------------------------------------------------------------------------自定义sql、接口地址中参数的开始标志
public static final String PARAM_BEGIN = "{";
public static final String PARAM_END = "}";
//------------------------------------------------------------------------------接口调用成功失败标识 0-失败 1-成功
public static final String CALL_SUCCESS = "1";
public static final String CALL_FAILED = "0";
//------------------------------------------------------------------------------选择框 0-否 1-是
public static final String SELECT_TYPE_IS = "1";
public static final String SELECT_TYPE_NOT = "0";
//------------------------------------------------------------------------------接口调用类型 0-仅调用一次 1-每条明细调用一次
public static final String CALL_TYPE_ONLY_ONE = "0";
public static final String CALL_TYPE_EVERY_DETAIL = "1";
//------------------------------------------------------------------------------接口请求类型 0-get 1-post
//GET
public static final String REQUEST_METHOD_GET = "0";
//POST
public static final String REQUEST_METHOD_POST = "1";
//------------------------------------------------------------------------------接口报文类型 0-xml 1-json 2-键值对
//xml
public static final String REQUEST_DATA_TYPE_XML = "0";
//json
public static final String REQUEST_DATA_TYPE_JSON = "1";
//键值对
public static final String REQUEST_DATA_TYPE_PAIR = "2";
//MultipartFile
public static final String REQUEST_DATA_TYPE_MULTIPARTFILE = "3";
//------------------------------------------------------------------------------接口响应报文类型 0-xml 1-json
//xml
public static final String RESPONSE_DATA_TYPE_XML = "0";
//json
public static final String RESPONSE_DATA_TYPE_JSON = "1";
//------------------------------------------------------------------------------节点类型
//文本
public static final String NODE_TYPE_STRING = "0";
//对象
public static final String NODE_TYPE_OBJECT = "1";
//文本数组
public static final String NODE_TYPE_STRING_ARRAY = "2";
//数组
public static final String NODE_TYPE_ARRAY = "3";
//json对象字符串
public static final String NODE_TYPE_JSONSTRING = "4";
//数字
public static final String NODE_TYPE_NUMBER = "5";
//布尔
public static final String NODE_TYPE_BOOLEAN = "6";
//浮点数
public static final String NODE_TYPE_FLOAT = "7";
//辅助核算项
public static final String NODE_TYPE_FZHSX = "8";
//------------------------------------------------------------------------------转换规则
//不转换
public static final String CHANGE_TYPE_NONE = "0";
//固定值
public static final String CHANGE_TYPE_FIXED = "1";
//自定义sql
public static final String CHANGE_TYPE_SQL = "2";
//字段求和
public static final String CHANGE_TYPE_SUM = "3";
//文本数组
public static final String CHANGE_TYPE_STRING_ARRAY = "4";
//明细序号
public static final String CHANGE_TYPE_ROW_NUMBER = "5";
//流程审批意见
public static final String CHANGE_TYPE_SUGGESTION = "6";
//加密处理
public static final String CHANGE_TYPE_MD5 = "7";
//requestId
public static final String CHANGE_TYPE_REQUEST_ID = "8";
//流程标题
public static final String CHANGE_TYPE_REQUEST_NAME = "9";
//------------------------------------------------------------------------------sql转义
//默认换行符
public static final String Default_Line_Break = "<br>";
//默认空格HTML代码
public static final String Default_Html_Blank = "&nbsp;";
//默认空格字符
public static final String Default_Blank_Char = " ";
}

View File

@ -0,0 +1,218 @@
package com.api.taojw.common;
import com.api.taojw.common.logging.MyLogger;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.general.Util;
import java.util.*;
/**
* try catch
*/
public class DaoUtil {
static Logger logger = MyLogger.getLogger();
/**
* map
* @param rs
* @return
*/
public static Map<String,String> setRsToMap(RecordSet rs){
try{
Map<String,String> result = new HashMap<>();
for(String name:rs.getColumnName()){
result.put(name.toLowerCase(Locale.ROOT),Util.null2String(rs.getString(name)));
}
return result;
}catch(Exception e){
logger.error("DaoUtil.setRsToMap execute error;exception:" + e.getMessage() + ";e:" + e);
return new HashMap<>();
}
}
/**
*
* @param sql
* @param params
* @return
*/
public static boolean isDataExists(String sql,Object...params) {
try{
RecordSet rs = new RecordSet();
return isDataExists(rs,sql,params);
}catch(Exception e){
logger.error("DaoUtil.isDataExists Exception;sql:" + sql + ";params:" + Arrays.toString(params) + ";message:" + e.getMessage() + ";e:" + e);
return false;
}
}
/**
*
* @param rs
* @param sql
* @param params
* @return
*/
public static boolean isDataExists(RecordSet rs,String sql,Object...params) {
try{
int count = 0;
if(rs.executeQuery(sql,params)){
if(rs.next()){
count = Util.getIntValue(rs.getString(1),0);
}
}else{
logger.error("DaoUtil.isDataExists sql error;sql:" + sql + ";params:" + Arrays.toString(params));
}
if(count > 0){
return true;
}else{
return false;
}
}catch(Exception e){
logger.error("DaoUtil.isDataExists Exception;sql:" + sql + ";params:" + Arrays.toString(params) + ";message:" + e.getMessage() + ";e:" + e);
return false;
}
}
/**
*
* @param rs
* @param sql
* @param params
* @return
*/
public static Map<String,String> getFirstData(RecordSet rs, String sql, Object...params){
Map<String,String> result = new HashMap<>();
try{
if(rs.executeQuery(sql,params)){
if(rs.next()){
for(String name:rs.getColumnName()){
result.put(name.toLowerCase(Locale.ROOT),Util.null2String(rs.getString(name)));
}
}else{
logger.error("DaoUtil.getFirstData sql found nothing;sql:" + sql + ";params:" + Arrays.toString(params));
}
}else{
logger.error("DaoUtil.getFirstData sql error;sql:" + sql + ";params:" + Arrays.toString(params));
}
return result;
}catch(Exception e){
logger.error("DaoUtil.getFirstData Exception;sql:" + sql + ";params:" + Arrays.toString(params) + ";message:" + e.getMessage() + ";e:" + e);
return result;
}
}
/**
*
* @param sql
* @param params
* @return
*/
public static Map<String,String> getFirstData(String sql, Object...params){
Map<String,String> result = new HashMap<>();
try{
RecordSet rs = new RecordSet();
result = getFirstData(rs,sql,params);
return result;
}catch(Exception e){
logger.error("DaoUtil.getFirstData Exception;sql:" + sql + ";params:" + Arrays.toString(params) + ";message:" + e.getMessage() + ";e:" + e);
return result;
}
}
/**
*
* @param rs
* @param sql
* @param params
* @return
*/
public static List<Map<String,String>> getData(RecordSet rs, String sql, Object...params){
List<Map<String,String>> result = new ArrayList<>();
try{
if(rs.executeQuery(sql,params)){
while(rs.next()){
Map<String,String> m = new HashMap<>();
for(String name:rs.getColumnName()){
if("zdysql".equalsIgnoreCase(name) || Util.null2String(name).toLowerCase(Locale.ROOT).indexOf("zdysql") > -1){
String zdysql = Util.null2String(rs.getString(name));
if(!"".equals(zdysql)){
zdysql = zdysql.replace(Constant.Default_Line_Break, Constant.Default_Blank_Char);
zdysql = zdysql.replace(Constant.Default_Html_Blank, Constant.Default_Blank_Char);
zdysql = CommonUtil.fullToHalfAngle(zdysql);
}
m.put(name.toLowerCase(Locale.ROOT),zdysql);
}else{
m.put(name.toLowerCase(Locale.ROOT),Util.null2String(rs.getString(name)));
}
}
result.add(m);
}
}else{
logger.error("DaoUtil.getData sql error;sql:" + sql + ";params:" + Arrays.toString(params));
}
return result;
}catch(Exception e){
logger.error("DaoUtil.getData Exception;sql:" + sql + ";params:" + Arrays.toString(params) + ";message:" + e.getMessage() + ";e:" + e);
return result;
}
}
/**
*
* @param sql
* @param params
* @return
*/
public static List<Map<String,String>> getData(String sql, Object...params){
List<Map<String,String>> result = new ArrayList<>();
try{
RecordSet rs = new RecordSet();
result = getData(rs,sql,params);
return result;
}catch(Exception e){
logger.error("DaoUtil.getData Exception;sql:" + sql + ";params:" + Arrays.toString(params) + ";message:" + e.getMessage() + ";e:" + e);
return result;
}
}
/**
*
* @param rs
* @param sql
* @param params
* @return
*/
public static boolean updateData(RecordSet rs,String sql, Object...params){
try{
if(!rs.executeUpdate(sql,params)){
logger.error("DaoUtil.updateData sql error;sql:" + sql + ";params:" + Arrays.toString(params));
return false;
}else{
return true;
}
}catch(Exception e){
logger.error("DaoUtil.updateData Exception;sql:" + sql + ";params:" + Arrays.toString(params) + e.getMessage() + ";e:" + e);
return false;
}
}
/**
*
* @param sql
* @param params
*/
public static boolean updateData(String sql, Object...params){
try{
RecordSet rs = new RecordSet();
return updateData(rs,sql,params);
}catch(Exception e){
logger.error("DaoUtil.updateData Exception;sql:" + sql + ";params:" + Arrays.toString(params) + ";message:" + e.getMessage() + ";e:" + e);
return false;
}
}
}

View File

@ -0,0 +1,77 @@
package com.api.taojw.common;
import com.api.taojw.common.logging.MyLogger;
import com.weaver.general.Util;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.hrm.finance.SalaryManager;
import weaver.hrm.resource.ResourceComInfo;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
public class HrmCommonUtil {
static Logger logger = MyLogger.getLogger();
public static Map<String,String> addUser(Map<String,String> userInfo,RecordSet rsSch){
Map<String,String> result = new HashMap<>();
try{
if(rsSch == null){
rsSch = new RecordSet();
}
char separator = Util.getSeparator();
Calendar todaycal = Calendar.getInstance();
String today = Util.add0(todaycal.get(Calendar.YEAR), 4) + "-" +
Util.add0(todaycal.get(Calendar.MONTH) + 1, 2) + "-" +
Util.add0(todaycal.get(Calendar.DAY_OF_MONTH), 2);
String userpara = "" + 1 + separator + today;
rsSch.executeProc("HrmResourceMaxId_Get", "");
rsSch.next();
//新增的人员id
String newId = "" + rsSch.getInt(1);
//使用sql新增人员
String insertSql =
"insert into HrmResource(" +
"id,systemlanguage,workcode,departmentid,subcompanyid1," +
"jobtitle,status,createrid,createdate,lastmodid," +
"lastmoddate,lastname,sex,loginid,password," +
"managerid,seclevel,dsporder) " +
"values(" +
"?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
boolean addUser = DaoUtil.updateData(insertSql,
newId, userInfo.get("systemlanguage"), userInfo.get("workcode"), userInfo.get("departmentid"), userInfo.get("subcompanyid1"),
userInfo.get("jobtitle"), userInfo.get("status"), userInfo.get("createrid"), userInfo.get("createdate"), userInfo.get("lastmodid"),
userInfo.get("lastmoddate"), userInfo.get("lastname"), userInfo.get("sex"), userInfo.get("loginid"), userInfo.get("password"),
userInfo.get("managerid"), userInfo.get("seclevel"), userInfo.get("dsporder"));
if(addUser){
rsSch.executeProc("HrmResource_CreateInfo", "" + newId + separator + userpara + separator + userpara);
ResourceComInfo resourceComInfo = new ResourceComInfo();
resourceComInfo.addResourceInfoCache(newId);
SalaryManager salaryManager = new SalaryManager();
salaryManager.initResourceSalary(newId);
String para1 = "" + newId + separator + "" + separator + userInfo.get("departmentid") + separator + userInfo.get("subcompanyid1") + separator + "0" + separator + "0";
rsSch.executeProc("HrmResource_Trigger_Insert", para1);
String sql_1 = ("insert into HrmInfoStatus (itemid,hrmid) values(1," + newId + ")");
rsSch.execute(sql_1);
String sql_2 = ("insert into HrmInfoStatus (itemid,hrmid) values(2," + newId + ")");
rsSch.execute(sql_2);
String sql_3 = ("insert into HrmInfoStatus (itemid,hrmid) values(3," + newId + ")");
rsSch.execute(sql_3);
String sql_10 = ("insert into HrmInfoStatus (itemid,hrmid) values(10," + newId + ")");
rsSch.execute(sql_10);
resourceComInfo.updateResourceInfoCache(newId);
result.put("newId",newId);
}else{
logger.error("HrmCommonUtil.addUser.addUserSql error;userInfo:" + userInfo);
}
}catch(Exception e){
logger.error("HrmCommonUtil.addUser exception;userInfo:" + userInfo + "message:" + e.getMessage() + ";e:" + e);
}
return result;
}
}

View File

@ -0,0 +1,29 @@
package com.api.taojw.common;
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
import java.net.URI;
public class HttpGetWithEntity extends HttpEntityEnclosingRequestBase {
private final static String METHOD_NAME = "GET";
@Override
public String getMethod() {
return METHOD_NAME;
}
public HttpGetWithEntity() {
super();
}
public HttpGetWithEntity(final URI uri) {
super();
setURI(uri);
}
HttpGetWithEntity(final String uri) {
super();
setURI(URI.create(uri));
}
}

View File

@ -0,0 +1,32 @@
package com.api.taojw.common;
import com.alibaba.fastjson.JSONObject;
import weaver.conn.RecordSet;
import java.util.List;
import java.util.Map;
public class JsonConvertUtil {
public static JSONObject convertJsonByConfig(JSONObject oldJson,String configId){
RecordSet rs = new RecordSet();
//获取配置信息
String getConfigSql =
"select " +
"t2.zhgz,t2.zdysql,t2.xzdmc,t2.yzdmc " +
"from " +
"uf_jsontojson t1 " +
"inner join uf_jsontojson_dt1 t2 on t2.mainid = t1.id " +
"where " +
"t1.id = ?";
List<Map<String, String>> configData = DaoUtil.getData(rs, getConfigSql, configId);
JSONObject result = new JSONObject();
for(Map<String, String> configMap : configData){
String oldValue = oldJson.getString(configMap.get("yzdmc"));
String newValue = WorkFlowDataToJsonUtil.convertDataByZhgz(oldValue,configMap);
result.put(configMap.get("xzdmc"),newValue);
}
return result;
}
}

View File

@ -0,0 +1,77 @@
package com.api.taojw.common;
import com.api.taojw.common.logging.MyLogger;
import com.weaverboot.tools.logTools.LogTools;
import org.apache.log4j.Logger;
import javax.xml.bind.DatatypeConverter;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.security.MessageDigest;
public class Md5Util {
static Logger logger = MyLogger.getLogger();
public static String MD5Encode(String originalString) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(originalString.getBytes());
byte[] digest = md.digest();
String hash = DatatypeConverter.printHexBinary(digest).toUpperCase();
return hash;
} catch (Exception var5) {
logger.error("");
return "";
}
}
/**
* MD5
*
* @param file
*
* @return MD5
*/
public static String getMD5OfFile(final File file) throws IOException {
FileInputStream fis = null;
try {
final MessageDigest md = MessageDigest.getInstance("MD5");
fis = new FileInputStream(file);
final byte[] buffer = new byte[2048];
int length = -1;
final long s = System.currentTimeMillis();
while ((length = fis.read(buffer)) != -1) {
md.update(buffer, 0, length);
}
final byte[] b = md.digest();
return byteToHexStringSingle(b);
} catch (final Exception ex) {
LogTools.error(file.getName()+"生成md5码时发生异常:"+ex.getMessage());
return null;
} finally {
fis.close();
}
}
/**
* byte[]
*
* @param byteArray
*
* @return String
*/
public static String byteToHexStringSingle(final byte[] byteArray) {
final StringBuffer md5StrBuff = new StringBuffer();
for (int i = 0; i < byteArray.length; i++) {
if (Integer.toHexString(0xFF & byteArray[i]).length() == 1) {
md5StrBuff.append("0").append(Integer.toHexString(0xFF & byteArray[i]));
} else {
md5StrBuff.append(Integer.toHexString(0xFF & byteArray[i]));
}
}
return md5StrBuff.toString();
}
}

View File

@ -0,0 +1,498 @@
package com.api.taojw.common;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.api.taojw.common.logging.MyLogger;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.general.Util;
import java.text.SimpleDateFormat;
import java.util.*;
public class ModelDataToJsonUtil {
static Logger logger = MyLogger.getLogger();
public static JSONObject getJsonByModelData(String billId,String configId){
JSONObject result = new JSONObject();
try{
logger.info("ModelDataToJsonUtil.getJsonByModelData begin;billId:" + billId + ";configId:" + configId);
RecordSet rs = new RecordSet();
//-----------------------根据配置id获取配置信息
//根节点配置信息
List<Map<String,String>> rootJsonConfigInfo = new ArrayList<>();
//明细配置信息
List<Map<String,String>> requestBodyConfigList = new ArrayList<>();
getConfigInfo(rs,configId,requestBodyConfigList,rootJsonConfigInfo);
String modeId = "";
String getModeIdSql = "select mkid from uf_jmsjzjson where id = ?";
if(rs.executeQuery(getModeIdSql,configId)){
if(rs.next()){
modeId = Util.null2String(rs.getString("mkid"));
}
}
String[] base_array = new String[5];
base_array[0] = "";
base_array[1] = "";
base_array[2] = "";
base_array[3] = CommonSqlUtil.getTableNameByModeId(modeId,rs);
base_array[4] = billId;
//-----------------------获取主表数据 用于拼装json
Map<String,String> mainTableData = new HashMap<>();
String getMainTableDataSql = "select * from " + base_array[3] + " where id = " + base_array[4];
if(rs.executeQuery(getMainTableDataSql)) {
if (rs.next()) {
mainTableData = DaoUtil.setRsToMap(rs);
}
}
//-----------------------生成json
logger.info("recursionGenerateJson begin;");
recursionGenerateJson(null,rs,rs,0,result,rootJsonConfigInfo,base_array,mainTableData,requestBodyConfigList,"","");
}catch(Throwable e){
logger.error("WorkFlowDataToJsonUtil.getJsonByWorkFlowData exception;message:" + e.getMessage() + ";e:" + e);
}
return result;
}
/**
*
*/
public static String convertDataByZhgz(String oldValue,Map<String,String> configMap){
//函数返回值
String result = "";
try{
//转换规则
String zhgz = configMap.get("zhgz");
//自定义sql
String zdysql = configMap.get("zdysql");
String requestId = Util.null2String(configMap.get("requestId"));
//不同转换规则处理
switch(zhgz){
//不转换
case "0":
result = oldValue;
break;
//固定值
case "1":
result = zdysql;
break;
//自定义sql
case "2":
zdysql = zdysql.replaceAll("\\{\\?}",oldValue);
zdysql = zdysql.replaceAll("\\{\\?requestId}",requestId);
Map<String, String> firstData = DaoUtil.getFirstData(zdysql);
for(String key : firstData.keySet()){
result = firstData.get(key);
}
break;
//日期格式化
case "3":
result = new SimpleDateFormat(zdysql).format(new SimpleDateFormat("yyyy-MM-dd").parse(oldValue));
break;
//日期时间格式化
case "4":
result = new SimpleDateFormat(zdysql).format(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(oldValue));
break;
//当前日期
case "5":
result = new SimpleDateFormat(zdysql).format(new Date());
break;
default:
result = "";
break;
}
return result;
}catch(Exception e){
result = "";
logger.error("DealWorkFlowDataToRequestUtil.convertDataByZhgz error;configMap:" + configMap + ";info:" + e.getMessage() + ";e:" + e);
}
return result;
}
/**
* configId
* @param rs
* @param configId id
* @param requestBodyConfigList
* @param rootJsonConfigInfo
*/
public static void getConfigInfo(RecordSet rs,String configId,List<Map<String,String>> requestBodyConfigList,List<Map<String,String>> rootJsonConfigInfo){
//获取明细表 请求体字段详细配置信息
String selectDetailSQL = "select dt.*,wb.fieldName,wb.viewType,wb.detailtable from uf_jmsjzjson_dt1 dt left join workflow_billField wb on dt.lcbdzd = wb.id where dt.mainId = ?";
if(rs.executeQuery(selectDetailSQL,configId)){
while(rs.next()){
//节点序号
String xmljdxh = Util.null2String(rs.getString("jdxh"));
//xml节点名称
String xmljdmc = Util.null2String(rs.getString("jdmc"));
//字段归属
String zdgz = Util.null2String(rs.getString("zdgz"));
//xml节点类型
String xmljdlx = Util.null2String(rs.getString("jdlx"));
//父节点序号
String fjdxh = Util.null2String(rs.getString("fjdxh"));
//流程表单字段
String lcbdzd = Util.null2String(rs.getString("lcbdzd"));
//流程表单字段类型
String viewType = Util.null2String(rs.getString("viewType"));
//流程表单字段
String fieldName = Util.null2String(rs.getString("fieldName"));
//字段所属明细表表名
String detailtable = Util.null2String(rs.getString("detailtable"));
//转换规则
String zhgz = Util.null2String(rs.getString("zhgz"));
//自定义sql
String zdysql = Util.null2String(rs.getString("zdysql"));
if(!"".equals(zdysql)){
zdysql = zdysql.replace(Constant.Default_Line_Break, Constant.Default_Blank_Char);
zdysql = zdysql.replace(Constant.Default_Html_Blank, Constant.Default_Blank_Char);
zdysql = CommonUtil.fullToHalfAngle(zdysql);
}
//数据条件
String sjtj = Util.null2String(rs.getString("sjtj"));
if(!"".equals(sjtj)){
sjtj = sjtj.replace(Constant.Default_Line_Break, Constant.Default_Blank_Char);
sjtj = sjtj.replace(Constant.Default_Html_Blank, Constant.Default_Blank_Char);
sjtj = CommonUtil.fullToHalfAngle(sjtj);
}
Map<String,String> dtMap = new HashMap<>();
dtMap.put("jdxh",xmljdxh);
dtMap.put("jdmc",xmljdmc);
dtMap.put("jdlx",xmljdlx);
dtMap.put("fjdxh",fjdxh);
dtMap.put("lcbdzd",lcbdzd);
dtMap.put("viewType",viewType);
dtMap.put("zhgz",zhgz);
dtMap.put("zdysql",zdysql);
dtMap.put("sjtj",sjtj);
dtMap.put("zdgz",zdgz);
dtMap.put("detailtable",detailtable);
dtMap.put("fieldName",fieldName.toLowerCase());
if("".equals(fjdxh)){
rootJsonConfigInfo.add(dtMap);
}
requestBodyConfigList.add(dtMap);
}
}else{
logger.error("WorkFlowDataToJsonUtil.getConfigInfo.selectDetailSQL sql execute error;sql:" + selectDetailSQL);
}
logger.info("WorkFlowDataToJsonUtil.getConfigInfo.selectDetailSQL done;requestBodyConfigList:" + requestBodyConfigList);
}
/**
* json
*/
public static Object recursionGenerateJson(Map<String,String> configMap,RecordSet rs,
RecordSet detailRs,int sequence,JSONObject jsonDoc,
List<Map<String,String>> rootJsonConfigInfo,
String[] baseArray,Map<String,String> mainTableData,
List<Map<String,String>> requestBodyConfigList,String currentTableIndex,String currentDetailDataId){
String getMainDataByConditionSql = "select count(1) as c from " + baseArray[3] + " t1 where ";
String getDetailDataByConditionSql = "select count(1) as c from " + baseArray[3] + " t1 inner join " + baseArray[3] + "_dt" + currentTableIndex + " t2 where t2.id = ? and ";
if(configMap == null){
for(Map<String,String> configInfo:rootJsonConfigInfo){
String sjtj = configInfo.get("sjtj");
if(!"".equals(sjtj) && sjtj != null && !Constant.NODE_TYPE_ARRAY.equals(configInfo.get("jdlx"))){
getMainDataByConditionSql = getMainDataByConditionSql + sjtj;
if(DaoUtil.isDataExists(getMainDataByConditionSql)){
jsonDoc.put(configInfo.get("jdmc"),recursionGenerateJson(configInfo,rs,detailRs,sequence,jsonDoc,rootJsonConfigInfo,baseArray,mainTableData,requestBodyConfigList,"",""));
}
}else{
jsonDoc.put(configInfo.get("jdmc"),recursionGenerateJson(configInfo,rs,detailRs,sequence,jsonDoc,rootJsonConfigInfo,baseArray,mainTableData,requestBodyConfigList,"",""));
}
}
}else{
switch(configMap.get("jdlx")){
case Constant.NODE_TYPE_STRING:
configMap.put("detailRowNum", String.valueOf(sequence));
return getFieldValue(configMap,rs,detailRs,baseArray,mainTableData);
case Constant.NODE_TYPE_BOOLEAN:
configMap.put("detailRowNum", String.valueOf(sequence));
return "true".equals(getFieldValue(configMap,rs,detailRs,baseArray,mainTableData));
case Constant.NODE_TYPE_NUMBER:
configMap.put("detailRowNum", String.valueOf(sequence));
int r = 0;
try{
r = Integer.parseInt(getFieldValue(configMap,rs,detailRs,baseArray,mainTableData));
}catch(Exception e){
logger.error("change data to int error;configMap:" + configMap + ";e:" + e);
}
return r;
case Constant.NODE_TYPE_FLOAT:
double d = 0;
try{
configMap.put("detailRowNum", String.valueOf(sequence));
String f = getFieldValue(configMap,rs,detailRs,baseArray,mainTableData);
d = Double.parseDouble(f);
}catch(Exception e){
logger.error("change data to float error;configMap:" + configMap + ";e:" + e);
}
return d;
case Constant.NODE_TYPE_OBJECT:
JSONObject json = new JSONObject();
for(Map<String,String> m : requestBodyConfigList) {
if (m.get("fjdxh").equals(configMap.get("jdxh"))) {
String sjtj = m.get("sjtj");
if(!"".equals(sjtj) && sjtj != null){
//若当前currentTableIndex不为空用明细校验
if("".equals(currentTableIndex)){
getMainDataByConditionSql = getMainDataByConditionSql + sjtj;
if(DaoUtil.isDataExists(getMainDataByConditionSql)){
json.put(m.get("jdmc"),recursionGenerateJson(m,rs,detailRs,sequence,jsonDoc,rootJsonConfigInfo,baseArray,mainTableData,requestBodyConfigList,currentTableIndex,currentDetailDataId));
}
}else{
getDetailDataByConditionSql = getDetailDataByConditionSql + sjtj;
if(DaoUtil.isDataExists(getDetailDataByConditionSql,currentDetailDataId)){
json.put(m.get("jdmc"),recursionGenerateJson(m,rs,detailRs,sequence,jsonDoc,rootJsonConfigInfo,baseArray,mainTableData,requestBodyConfigList,currentTableIndex,currentDetailDataId));
}
}
}else{
json.put(m.get("jdmc"),recursionGenerateJson(m,rs,detailRs,sequence,jsonDoc,rootJsonConfigInfo,baseArray,mainTableData,requestBodyConfigList,currentTableIndex,currentDetailDataId));
}
}
}
return json;
case Constant.NODE_TYPE_JSONSTRING:
JSONObject jsonObj = new JSONObject();
for(Map<String,String> m : requestBodyConfigList) {
if (m.get("fjdxh").equals(configMap.get("jdxh"))) {
String sjtj = m.get("sjtj");
if(!"".equals(sjtj) && sjtj != null){
//若当前currentTableIndex不为空用明细校验
if("".equals(currentTableIndex)){
getMainDataByConditionSql = getMainDataByConditionSql + sjtj;
if(DaoUtil.isDataExists(getMainDataByConditionSql)){
jsonObj.put(m.get("jdmc"),recursionGenerateJson(m,rs,detailRs,sequence,jsonDoc,rootJsonConfigInfo,baseArray,mainTableData,requestBodyConfigList,currentTableIndex,currentDetailDataId));
}
}else{
getDetailDataByConditionSql = getDetailDataByConditionSql + sjtj;
if(DaoUtil.isDataExists(getDetailDataByConditionSql,currentDetailDataId)){
jsonObj.put(m.get("jdmc"),recursionGenerateJson(m,rs,detailRs,sequence,jsonDoc,rootJsonConfigInfo,baseArray,mainTableData,requestBodyConfigList,currentTableIndex,currentDetailDataId));
}
}
}else{
jsonObj.put(m.get("jdmc"),recursionGenerateJson(m,rs,detailRs,sequence,jsonDoc,rootJsonConfigInfo,baseArray,mainTableData,requestBodyConfigList,currentTableIndex,currentDetailDataId));
}
}
}
return jsonObj.toString();
case Constant.NODE_TYPE_STRING_ARRAY:
String stringArrayValue = getFieldValue(configMap,rs,detailRs,baseArray,mainTableData);
JSONArray stringArray = new JSONArray();
stringArray.addAll(Arrays.asList(stringArrayValue.split(",")));
return stringArray;
case Constant.NODE_TYPE_ARRAY:
JSONArray array = new JSONArray();
if("".equals(configMap.get("zdgz")) && Constant.CHANGE_TYPE_FIXED.equals(configMap.get("zhgz"))){
for(Map<String,String> son : requestBodyConfigList) {
if (son.get("fjdxh").equals(configMap.get("jdxh"))) {
String sjtj = son.get("sjtj");
if(!"".equals(sjtj) && sjtj != null){
//若当前currentTableIndex不为空用明细校验
if("".equals(currentTableIndex)){
getMainDataByConditionSql = getMainDataByConditionSql + sjtj;
if(DaoUtil.isDataExists(getMainDataByConditionSql)){
array.add(recursionGenerateJson(son,rs,detailRs,sequence,jsonDoc,rootJsonConfigInfo,baseArray,mainTableData,requestBodyConfigList,currentTableIndex,currentDetailDataId));
}
}else{
getDetailDataByConditionSql = getDetailDataByConditionSql + sjtj;
if(DaoUtil.isDataExists(getDetailDataByConditionSql,currentDetailDataId)){
array.add(recursionGenerateJson(son,rs,detailRs,sequence,jsonDoc,rootJsonConfigInfo,baseArray,mainTableData,requestBodyConfigList,currentTableIndex,currentDetailDataId));
}
}
}else{
array.add(recursionGenerateJson(son,rs,detailRs,sequence,jsonDoc,rootJsonConfigInfo,baseArray,mainTableData,requestBodyConfigList,currentTableIndex,currentDetailDataId));
}
}
}
return array;
}
if("".equals(configMap.get("zdgz"))){
JSONObject o = new JSONObject();
for(Map<String,String> son : requestBodyConfigList) {
if (son.get("fjdxh").equals(configMap.get("jdxh"))) {
String sjtj = son.get("sjtj");
if(!"".equals(sjtj) && sjtj != null){
//若当前currentTableIndex不为空用明细校验
if("".equals(currentTableIndex)){
getMainDataByConditionSql = getMainDataByConditionSql + sjtj;
if(DaoUtil.isDataExists(getMainDataByConditionSql)){
o.put(son.get("jdmc"),recursionGenerateJson(son,rs,detailRs,sequence,jsonDoc,rootJsonConfigInfo,baseArray,mainTableData,requestBodyConfigList,currentTableIndex,currentDetailDataId));
}
}else{
getDetailDataByConditionSql = getDetailDataByConditionSql + sjtj;
if(DaoUtil.isDataExists(getDetailDataByConditionSql,currentDetailDataId)){
o.put(son.get("jdmc"),recursionGenerateJson(son,rs,detailRs,sequence,jsonDoc,rootJsonConfigInfo,baseArray,mainTableData,requestBodyConfigList,currentTableIndex,currentDetailDataId));
}
}
}else{
o.put(son.get("jdmc"),recursionGenerateJson(son,rs,detailRs,sequence,jsonDoc,rootJsonConfigInfo,baseArray,mainTableData,requestBodyConfigList,currentTableIndex,currentDetailDataId));
}
}
}
array.add(o);
return array;
}
//查询明细表数据
String getDetailDataSql = "select t2.id as detailid,* from " + baseArray[3] + "_dt" + configMap.get("zdgz") + " t2 inner join " + baseArray[3] + " t1 on t1.id = t2.mainid where t2.mainid = " + baseArray[4] + " and ";
if(!"".equals(configMap.get("sjtj"))){
getDetailDataSql = getDetailDataSql + " " + configMap.get("sjtj");
}
RecordSet detailDataRs = new RecordSet();
if(detailDataRs.executeQuery(getDetailDataSql)){
sequence = 0;
while(detailDataRs.next()){
JSONObject o = new JSONObject();
sequence = sequence + 1;
for(Map<String,String> son : requestBodyConfigList) {
if (son.get("fjdxh").equals(configMap.get("jdxh"))) {
String sjtj = son.get("sjtj");
if(!"".equals(sjtj) && sjtj != null){
//若当前currentTableIndex不为空用明细校验
if("".equals(currentTableIndex)){
getMainDataByConditionSql = getMainDataByConditionSql + sjtj;
if(DaoUtil.isDataExists(getMainDataByConditionSql)){
o.put(son.get("jdmc"),recursionGenerateJson(son,rs,detailDataRs,sequence,jsonDoc,rootJsonConfigInfo,baseArray,mainTableData,requestBodyConfigList,configMap.get("zdgz"),detailDataRs.getString("detailid")));
}
}else{
getDetailDataByConditionSql = getDetailDataByConditionSql + sjtj;
if(DaoUtil.isDataExists(getDetailDataByConditionSql,currentDetailDataId)){
o.put(son.get("jdmc"),recursionGenerateJson(son,rs,detailDataRs,sequence,jsonDoc,rootJsonConfigInfo,baseArray,mainTableData,requestBodyConfigList,configMap.get("zdgz"),detailDataRs.getString("detailid")));
}
}
}else{
o.put(son.get("jdmc"),recursionGenerateJson(son,rs,detailDataRs,sequence,jsonDoc,rootJsonConfigInfo,baseArray,mainTableData,requestBodyConfigList,configMap.get("zdgz"),detailDataRs.getString("detailid")));
}
}
}
array.add(o);
}
}
return array;
default:
break;
}
}
return null;
}
/**
*
* @param configMap
* @param rs
* @param detailRs
*/
public static String getFieldValue(Map<String,String> configMap,RecordSet rs,RecordSet detailRs,String[] baseArray,Map<String,String> mainTableData){
//函数返回值
StringBuilder result = new StringBuilder();
try{
Map<String,String> detailDataMap = DaoUtil.setRsToMap(detailRs);
//字段类型 0-主表 1-明细表
String viewType = configMap.get("viewType");
//转换规则
String zhgz = configMap.get("zhgz");
//字段名称
String fieldName = configMap.get("fieldName");
//自定义sql
String zdysql = configMap.get("zdysql");
//字段所属明细表表名
String detailtable = configMap.get("detailtable");
//不同转换规则处理
switch(zhgz){
case Constant.CHANGE_TYPE_REQUEST_ID:
result = new StringBuilder(baseArray[0]);
break;
case Constant.CHANGE_TYPE_REQUEST_NAME:
result = new StringBuilder(baseArray[1]);
break;
case Constant.CHANGE_TYPE_MD5:
result = new StringBuilder("Basic " + Base64.getUrlEncoder().encodeToString(zdysql.getBytes()));
break;
case Constant.CHANGE_TYPE_SUGGESTION:
result = new StringBuilder(baseArray[2]);
break;
case Constant.CHANGE_TYPE_ROW_NUMBER:
result = new StringBuilder(configMap.get("detailRowNum"));
break;
case Constant.CHANGE_TYPE_FIXED:
result = new StringBuilder(configMap.get("zdysql"));
break;
case Constant.CHANGE_TYPE_NONE:
if("0".equals(viewType)){
result = new StringBuilder(mainTableData.get(fieldName));
}else{
result = new StringBuilder(detailDataMap.get(fieldName));
}
break;
case Constant.CHANGE_TYPE_SQL:
String oldValue;
if(!"".equals(viewType) && !"".equals(fieldName)){
if("0".equals(viewType)){
oldValue = mainTableData.get(fieldName);
}else{
oldValue = detailDataMap.get(fieldName);
}
zdysql = zdysql.replaceAll("\\{\\?}",oldValue);
}
zdysql = zdysql.replaceAll("\\{\\?requestId}",baseArray[0]);
if(rs.executeQuery(zdysql)){
if(rs.next()){
result = new StringBuilder(Util.null2String(rs.getString(1)));
}
}
break;
case Constant.CHANGE_TYPE_SUM:
if("0".equals(viewType)){
logger.error("want sum but config main field");
break;
}
String getSumSql = "select sum(" + fieldName + ") as val from " + detailtable + " where mainid = " + baseArray[4];
if(rs.executeQuery(getSumSql)){
if(rs.next()){
result = new StringBuilder(Util.null2String(rs.getString("val")));
}
}
break;
case Constant.CHANGE_TYPE_STRING_ARRAY:
if("0".equals(viewType)){
logger.error("want array but config main field");
break;
}
String getArraySql = "select " + fieldName + " as val from " + detailtable + " where mainid = " + baseArray[4];
if(rs.executeQuery(getArraySql)){
int i = 0;
while(rs.next()){
if(i == 0){
result = new StringBuilder(Util.null2String(rs.getString(1)));
}else{
result.append(",").append(Util.null2String(rs.getString(1)));
}
i = i + 1;
}
}
break;
default:
result = new StringBuilder();
break;
}
return result.toString();
}catch(Exception e){
result = new StringBuilder();
logger.error("DealWorkFlowDataToRequestUtil.getFieldValue error;configMap:" + configMap + ";info:" + e.getMessage() + ";e:" + e);
}
return result.toString();
}
}

View File

@ -0,0 +1,51 @@
package com.api.taojw.common;
import com.api.taojw.common.logging.MyLogger;
import oauth.signpost.OAuthConsumer;
import oauth.signpost.commonshttp.CommonsHttpOAuthConsumer;
import oauth.signpost.http.HttpParameters;
import oauth.signpost.signature.AuthorizationHeaderSigningStrategy;
import oauth.signpost.signature.HmacSha1MessageSigner;
import oauth.signpost.signature.HmacSha256MessageSigner;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.log4j.Logger;
/**
* OAuth1.0
* jar
* signpost-commonshttp4-1.2.jar
* signpost-core-2.1.1.jar
*/
public class OauthOneHttpUtil {
Logger logger = MyLogger.getLogger();
public String consumerKey = "";
public String consumerSecret = "";
public String accessToken = "";
public String accessTokenSecret = "";
public String realmID = "";
public String encryption = "";
public void authorize(HttpRequestBase httpRequest){
try {
OAuthConsumer oAuthConsumer = new CommonsHttpOAuthConsumer(consumerKey, consumerSecret);
if("HMAC-SHA256".equalsIgnoreCase(encryption)){
oAuthConsumer.setMessageSigner(new HmacSha256MessageSigner());
}else if("HMAC-SHA1".equalsIgnoreCase(encryption)){
oAuthConsumer.setMessageSigner(new HmacSha1MessageSigner());
}
if(realmID != null && !"".equals(realmID)){
HttpParameters parameters = new HttpParameters();
parameters.put("realm", realmID);
oAuthConsumer.setAdditionalParameters(parameters);
}
oAuthConsumer.setTokenWithSecret(accessToken, accessTokenSecret);
oAuthConsumer.setSigningStrategy(new AuthorizationHeaderSigningStrategy());
oAuthConsumer.sign(httpRequest);
}catch(Throwable e) {
logger.info("OauthOneHttpUtil.authorize error;message:" + e.getMessage() + ";e:" + e);
}
}
}

View File

@ -0,0 +1,66 @@
package com.api.taojw.common;
import com.api.taojw.common.logging.MyLogger;
import org.apache.log4j.Logger;
import weaver.file.AESCoder;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
public class TjwAesUtil {
static Logger logger = MyLogger.getLogger();
public static String aesEncrypt(String param,String key){
String result = "";
try{
result = AESCoder.encrypt(param,key);
}catch (Exception e){
logger.error("AesUtil.aesEncrypt error;message" + e.getMessage() + ";e:" + e);
}
logger.info("aesEncrypt result:" + result);
return result;
}
// 加密
public static String Encrypt(String sKey, String sSrc) throws Exception {
byte[] raw = sKey.getBytes("utf-8");
SecretKeySpec sks = new SecretKeySpec(raw, "AES");
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");//"算法/模式/补码方式"
cipher.init(Cipher.ENCRYPT_MODE, sks);
byte[] encrypted = cipher.doFinal(sSrc.getBytes("utf-8"));
return bytesToHexString(encrypted);
}
// 解密
public static String Decrypt(String sKey, String sSrc) throws Exception {
byte[] raw = sKey.getBytes("utf-8");
SecretKeySpec sks = new SecretKeySpec(raw, "AES");
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, sks);
byte[] encrypted1 = hexStringToBytes(sSrc); //new BASE64Decoder().decodeBuffer(sSrc);//先用base64解密
byte[] original = cipher.doFinal(encrypted1);
String originalString = new String(original,"utf-8");
return originalString;
}
//字节数组转16进制字符串
public static String bytesToHexString(byte[] b){
StringBuffer result = new StringBuffer();
for(int i = 0;i < b.length;i++){
result.append(String.format("%02X",b[i]));
}
return result.toString();
}
//16进制字符串转字节数组
public static byte[] hexStringToBytes(String src){
int l = src.length()/2;
byte[] ret = new byte[l];
for(int i = 0;i<l;i++){
ret[i] = Integer.valueOf(src.substring(i*2,i*2+2),16).byteValue();
}
return ret;
}
}

View File

@ -0,0 +1,382 @@
package com.api.taojw.common;
import com.api.taojw.common.logging.MyLogger;
import org.apache.log4j.Logger;
import sun.misc.BASE64Encoder;
import weaver.conn.RecordSet;
import weaver.docs.docs.DocComInfo;
import weaver.docs.docs.DocImageManager;
import weaver.docs.docs.DocManager;
import weaver.docs.docs.DocViewer;
import weaver.docs.webservices.DocInfo;
import weaver.docs.webservices.DocServiceImpl;
import weaver.file.ImageFileManager;
import weaver.general.IOUtils;
import weaver.general.Util;
import weaver.hrm.User;
import java.io.*;
import java.util.List;
import java.util.Map;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
public class TjwDocumentUtil {
static Logger logger = MyLogger.getLogger();
/**
* pdf
* jar
*/
/*public static void convertFileToPdf(InputStream docxInputStream,OutputStream outputStream,String fileType){
try {
logger.info(fileType + " begin convertFileToPdf");
IConverter converter = LocalConverter.builder().build();
if("doc".equalsIgnoreCase(fileType)){
converter.convert(docxInputStream).as(DocumentType.DOC).to(outputStream).as(DocumentType.PDF).execute();
}
if("docx".equalsIgnoreCase(fileType)){
converter.convert(docxInputStream).as(DocumentType.DOCX).to(outputStream).as(DocumentType.PDF).execute();
}
outputStream.close();
System.out.println("success");
logger.info(fileType + " convertFileToPdf success");
} catch (Throwable e) {
logger.error(fileType + " convertFileToPdf error;message:" + e.getMessage() + ";e:" + e);
}
}*/
public static void copyInputStreamToFile(InputStream inputStream, File file) {
try (FileOutputStream outputStream = new FileOutputStream(file)) {
int read;
byte[] bytes = new byte[1024];
while ((read = inputStream.read(bytes)) != -1) {
outputStream.write(bytes, 0, read);
}
}catch (Throwable e){
logger.error("copyInputStreamToFile error;message:" + e.getMessage() + ";e:" + e);
}
}
/**
* ZIP
* @param srcFiles
* @param out
* @throws RuntimeException
*/
public static void toZip(List<Map<String,String>> srcFiles , OutputStream out) {
ZipOutputStream zos = null;
try{
zos = new ZipOutputStream(out);
for (Map<String,String> imageFileInfo : srcFiles) {
String imageFileId = imageFileInfo.get("imageFileId");
String imageFileName = imageFileInfo.get("imageFileName");
byte[] buf = new byte[2 * 1024];
zos.putNextEntry(new ZipEntry(imageFileName));
int len;
ImageFileManager imageFileManager = new ImageFileManager();
InputStream in = imageFileManager.getInputStreamById(Integer.parseInt(imageFileId));
while ((len = in.read(buf)) != -1){
zos.write(buf, 0, len);
}
zos.closeEntry();
in.close();
}
}catch (Throwable e){
logger.error("TjwDocumentUtil.toZip error;message:" + e.getMessage() + ";e:" + e);
}finally{
if(zos != null){
try {
zos.close();
} catch (IOException e) {
logger.error("TjwDocumentUtil.toZip zos close error;message:" + e.getMessage() + ";e:" + e);
}
}
}
}
public static String getBase64StringByImageFileId(String imageFileId){
String base64 = "";
InputStream is = null;
try {
ImageFileManager imageFileManager = new ImageFileManager();
is = imageFileManager.getInputStreamById(Integer.parseInt(imageFileId));
String getFileSizeSql = "select filesize from imagefile where imagefileid = ?";
String filesize = DaoUtil.getFirstData(new RecordSet(), getFileSizeSql, imageFileId).get("filesize");
byte[] bytes = new byte[Integer.parseInt(filesize)];
is.read(bytes);
BASE64Encoder encoder = new BASE64Encoder();
base64 = encoder.encode(bytes);
} catch (Exception e) {
logger.error("TjwDocumentUtil.getBase64StringByImageFileId exception;imageFileId:" + imageFileId + ";message:" + e.getMessage() + ";e:" + e);
} finally {
if (is != null) {
try {
is.close();
} catch (Exception e) {
logger.error("TjwDocumentUtil.getBase64StringByImageFileId io close exception;imageFileId:" + imageFileId + ";message:" + e.getMessage() + ";e:" + e);
}
}
}
return base64;
}
/**
* docIddocId
* @param olddocid docId
* @param userid
* @param docsubject
* @param seccategory id
* @return
*/
public static int copyDocToNewDoc(int olddocid, int userid,String docsubject,int seccategory){
int newdocid = -1;
try {
logger.info("TjwDocumentUtil.copyDocToNewDoc begin;olddocid:" + olddocid + ";userid:" + userid + ";docsubject:" + docsubject + ";seccategory:" + seccategory);
//复制文档
DocComInfo dc = new DocComInfo();
DocViewer dv = new DocViewer();
DocManager docManager = new DocManager();
docManager.setId(olddocid);
docManager.setUserid(userid);
docManager.setUsertype("0");
docManager.setDocsubject(docsubject);
docManager.setClientAddress("127.0.0.1");
docManager.setSeccategory(seccategory);
docManager.copyDoc();
newdocid = docManager.getId();
// 文档赋权操作
DocManager docNewManager = new DocManager();
docNewManager.setIsreply("0");
docNewManager.setId(newdocid);
docNewManager.setSeccategory(seccategory);
docNewManager.setUserid(userid);
docNewManager.setUsertype("1");
docManager.AddShareInfo();
dc.addDocInfoCache("" + newdocid);
dv.setDocShareByDoc("" + newdocid);
//TODO 据我观察 上面虽然传了docsubject但代码并未更新文件名称因此在下面更新文件名称
RecordSet rs = new RecordSet();
String oldname = "";
String docfiletype = "";
String getExtendSql = "select imagefilename,docfiletype from DocImageFile where docid = ?";
if(rs.executeQuery(getExtendSql,olddocid)){
if(rs.next()){
oldname = Util.null2String(rs.getString("imagefilename"));
docfiletype = Util.null2String(rs.getString("docfiletype"));
}
}
logger.info("oldname:" + oldname + ";docfiletype:" + docfiletype);
String extend = "";
switch (docfiletype){
case "7":
extend = ".docx";
break;
case "3":
extend = ".doc";
break;
case "4":
extend = ".xls";
break;
case "5":
extend = ".ppt";
break;
case "6":
extend = ".wps";
break;
case "8":
extend = ".xlsx";
break;
case "9":
extend = ".pptx";
break;
default:
break;
}
String newName = docsubject + extend;
String updateDocImageFileNameSql = "update DocImageFile set imagefilename = ? where docid = ?";
if(!rs.executeUpdate(updateDocImageFileNameSql,newName,newdocid)){
logger.error("updateDocImageFileNameSql error");
}
String updateImagefileName2Sql = "update imagefile set imagefilename = ? where imagefileid in (select imagefileid from DocImageFile where docid = ?)";
if(!rs.executeUpdate(updateImagefileName2Sql,newName,newdocid)){
logger.error("updateImagefileName2Sql error");
}
String updateDocdetailSql = "update docdetail set docsubject = ?,keyword = ? where id = ?";
if(!rs.executeUpdate(updateDocdetailSql,docsubject,docsubject,newdocid)){
logger.error("updateDocdetailSql error");
}
} catch (Exception e) {
logger.error("TjwDocumentUtil.copyDocToNewDoc exception;message:" + e.getMessage() + ";e:" + e);
}
return newdocid;
}
public static int addDocImageInfo(int docId,String fileName, int imageFileId) {
try{
DocImageManager imgManger = new DocImageManager();
imgManger.resetParameter();
imgManger.setDocid(docId);
imgManger.setImagefileid(imageFileId);
imgManger.setImagefilename(fileName);
imgManger.setIsextfile("1");
String ext = fileName.substring(fileName.lastIndexOf(".") + 1);
if ("doc".equalsIgnoreCase(ext)) {
imgManger.setDocfiletype("3");
} else if ("xls".equalsIgnoreCase(ext)) {
imgManger.setDocfiletype("4");
} else if ("ppt".equalsIgnoreCase(ext)) {
imgManger.setDocfiletype("5");
} else if ("wps".equalsIgnoreCase(ext)) {
imgManger.setDocfiletype("6");
} else if ("docx".equalsIgnoreCase(ext)) {
imgManger.setDocfiletype("7");
} else if ("xlsx".equalsIgnoreCase(ext)) {
imgManger.setDocfiletype("8");
} else if ("pptx".equalsIgnoreCase(ext)) {
imgManger.setDocfiletype("9");
} else {
imgManger.setDocfiletype("2");
}
imgManger.AddDocImageInfo();
return docId;
}catch(Exception e){
logger.error("CommonUtil.createDocByImageFileId exception;fileName:" + fileName + ";imageFileId" + imageFileId + ";docId:" + docId + ";message:" + e.getMessage() + ";e:" + e);
return 0;
}
}
/**
* imageFileIddocId
* @param fileName
* @param seccategory
* @param imageFileId ID
* @param userId ID
* @return docId
*/
public static int createDocByImageFileId(String docSubject, String fileName, int seccategory, int imageFileId, Integer userId) {
try{
DocInfo docInfo = new DocInfo();
docInfo.setImagefileId(imageFileId);
docInfo.setSeccategory(seccategory);
docInfo.setDocSubject(docSubject);
docInfo.setDoccontent("");
DocServiceImpl docService = new DocServiceImpl();
int docId = docService.createDocByUser(docInfo, new User(userId));
DocImageManager imgManger = new DocImageManager();
imgManger.resetParameter();
imgManger.setDocid(docId);
imgManger.setImagefileid(imageFileId);
imgManger.setImagefilename(fileName);
imgManger.setIsextfile("1");
String ext = fileName.substring(fileName.lastIndexOf(".") + 1);
if ("doc".equalsIgnoreCase(ext)) {
imgManger.setDocfiletype("3");
} else if ("xls".equalsIgnoreCase(ext)) {
imgManger.setDocfiletype("4");
} else if ("ppt".equalsIgnoreCase(ext)) {
imgManger.setDocfiletype("5");
} else if ("wps".equalsIgnoreCase(ext)) {
imgManger.setDocfiletype("6");
} else if ("docx".equalsIgnoreCase(ext)) {
imgManger.setDocfiletype("7");
} else if ("xlsx".equalsIgnoreCase(ext)) {
imgManger.setDocfiletype("8");
} else if ("pptx".equalsIgnoreCase(ext)) {
imgManger.setDocfiletype("9");
} else {
imgManger.setDocfiletype("2");
}
imgManger.AddDocImageInfo();
return docId;
}catch(Exception e){
logger.error("CommonUtil.createDocByImageFileId exception;fileName:" + fileName + ";seccategory:" + seccategory + ";imageFileId" + imageFileId + ";userId:" + userId + ";message:" + e.getMessage() + ";e:" + e);
return 0;
}
}
/**
* imageFileIddocId
* @param fileName
* @param seccategory
* @param imageFileId ID
* @param userId ID
* @return docId
*/
public static int createDocByImageFileId(String fileName, int seccategory, int imageFileId, Integer userId) {
try{
DocInfo docInfo = new DocInfo();
docInfo.setImagefileId(imageFileId);
docInfo.setSeccategory(seccategory);
docInfo.setDocSubject(fileName);
docInfo.setDoccontent("");
DocServiceImpl docService = new DocServiceImpl();
int docId = docService.createDocByUser(docInfo, new User(userId));
DocImageManager imgManger = new DocImageManager();
imgManger.resetParameter();
imgManger.setDocid(docId);
imgManger.setImagefileid(imageFileId);
imgManger.setImagefilename(fileName);
imgManger.setIsextfile("1");
String ext = fileName.substring(fileName.lastIndexOf(".") + 1);
if ("doc".equalsIgnoreCase(ext)) {
imgManger.setDocfiletype("3");
} else if ("xls".equalsIgnoreCase(ext)) {
imgManger.setDocfiletype("4");
} else if ("ppt".equalsIgnoreCase(ext)) {
imgManger.setDocfiletype("5");
} else if ("wps".equalsIgnoreCase(ext)) {
imgManger.setDocfiletype("6");
} else if ("docx".equalsIgnoreCase(ext)) {
imgManger.setDocfiletype("7");
} else if ("xlsx".equalsIgnoreCase(ext)) {
imgManger.setDocfiletype("8");
} else if ("pptx".equalsIgnoreCase(ext)) {
imgManger.setDocfiletype("9");
} else {
imgManger.setDocfiletype("2");
}
imgManger.AddDocImageInfo();
return docId;
}catch(Exception e){
logger.error("CommonUtil.createDocByImageFileId exception;fileName:" + fileName + ";seccategory:" + seccategory + ";imageFileId" + imageFileId + ";userId:" + userId + ";message:" + e.getMessage() + ";e:" + e);
return 0;
}
}
/**
*
*
* @param content
* @param fileName
* @return id
*/
public static int createFileByInputSteam(InputStream content, String fileName) {
try{
/*byte[] bytes = IOUtils.toBytes(content);
logger.info("bytes.size:" + bytes.length);*/
ImageFileManager imageFileManager = new ImageFileManager();
int imgFileId = -1;
try {
ImageFileManager.class.getMethod("saveImageFileByInputStream", InputStream.class, String.class);
imgFileId = imageFileManager.saveImageFileByInputStream(content, fileName);
}catch (NoSuchMethodException e) {
logger.error("createFileByInputSteam.NoSuchMethodException");
imageFileManager.setImagFileName(fileName);
try {
imageFileManager.setData(IOUtils.toBytes(content));
} catch (Exception ex) {
logger.error("CommonUtil.createFileByInputSteam toBytes exception;fileName:" + fileName + ";message:" + e.getMessage() + ";e:" + e);
throw new Exception("创建文件失败,文件流转换失败", e);
}
imgFileId = imageFileManager.saveImageFile();
}
return imgFileId;
}catch (Exception e){
logger.error("CommonUtil.createFileByInputSteam exception;fileName:" + fileName + ";message:" + e.getMessage() + ";e:" + e);
return -1;
}
}
}

View File

@ -0,0 +1,249 @@
package com.api.taojw.common;
import com.api.taojw.common.logging.MyLogger;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.fna.invoice.utils.InvoiceCloudUtil;
import weaver.general.Util;
import weaver.hrm.User;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*;
public class TjwFpUtil {
static Logger logger = MyLogger.getLogger();
public static String getTimestamp(String date){
String timestamp = "";
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date d = sdf.parse(date);
timestamp = Util.null2String(d.getTime()/1000);
}catch (Throwable e){
logger.error("TjwFpUtil.getTimestamp error;message:" + e.getMessage() + ";e:" + e);
}
return timestamp;
}
/**
* @param cloudIdParam cloudid
* @param user
* @param sreim 0- 1- 2-
* @param je
* @param requestId
* @param requestmark
* @param requestName
*/
public static void updateFpStatusInCloudCommon(User user,String cloudIdParam,String sreim,String je,String requestId,String requestmark,String requestName){
try{
RecordSet rs = new RecordSet();
String getTimeSql = "select CREATEDATE,CREATETIME from workflow_requestbase where requestid = ?";
Map<String, String> firstData1 = DaoUtil.getFirstData(rs, getTimeSql, requestId);
String CREATEDATE = firstData1.get("createdate");
String CREATETIME = firstData1.get("createtime");
String tableName = CommonSqlUtil.getTableNameByRequetId(requestId,rs);
String getdjbhSql = "select djbh from " + tableName + " where requestid = ?";
Map<String, String> firstData2 = DaoUtil.getFirstData(rs, getdjbhSql, requestId);
requestmark = Util.null2String(firstData2.get("djbh"));
String getDataSql = "select * from fnainvoiceledger where cloudid = ?";
Map<String, String> firstData = DaoUtil.getFirstData(rs, getDataSql, cloudIdParam);
String userId = firstData.get("userid_new");
//其中key为userid_new value为的List
Map<String,List<String>> mapCloud = new HashMap<>();
List<String> cloudIds = new ArrayList<>();
cloudIds.add(cloudIdParam);
mapCloud.put(userId,cloudIds);
//发票云报销修改发票云数据
for(Map.Entry<String, List<String>> entry : mapCloud.entrySet()){
String userid_new = entry.getKey();
int userid_newInt = Util.getIntValue(Util.null2String(userid_new),0);
JSONObject interfaceInfo = InvoiceCloudUtil.getInterfaceInfo(new User(userid_newInt), false, false, true);
JSONObject cloudInfo = interfaceInfo.getJSONObject("cloud");
String cid = Util.null2String(cloudInfo.getString("cid"));
String userName = Util.null2String(cloudInfo.getString("userName"));
String password = Util.null2String(cloudInfo.getString("password"));
String aesKey = Util.null2String(cloudInfo.getString("aesKey"));
String reimburseUrl = Util.null2String(cloudInfo.getString("reimburseUrl"));
JSONObject bodyJson = new JSONObject();
bodyJson.put("cid",cid);
bodyJson.put("userId",user.getUID());
//2表示修改状态 3表示校验
bodyJson.put("flag","2");
JSONArray fnaInvoiceReimburseInfoJa = new JSONArray();
JSONObject fnaInvoiceReimburseInfoJo = new JSONObject();
fnaInvoiceReimburseInfoJo.put("dataid", requestId);
fnaInvoiceReimburseInfoJo.put("number", requestmark);
DecimalFormat df = new DecimalFormat("#####################0.00");
fnaInvoiceReimburseInfoJo.put("amount", df.format(Util.getDoubleValue(je, 0.00)));
fnaInvoiceReimburseInfoJo.put("uid", user.getUID());
//fnaInvoiceReimburseInfoJo.put("date", getTimestamp(Util.date(2)));
fnaInvoiceReimburseInfoJo.put("date", getTimestamp(CREATEDATE+" "+CREATETIME));
fnaInvoiceReimburseInfoJo.put("name", requestName);
fnaInvoiceReimburseInfoJo.put("fid", cloudIdParam);
fnaInvoiceReimburseInfoJo.put("cid", cid);
fnaInvoiceReimburseInfoJa.add(fnaInvoiceReimburseInfoJo);
//1表示报销中 2表示已报销
bodyJson.put("sreim",sreim);
JSONArray reimburseInfoJa = new JSONArray();
reimburseInfoJa.add(fnaInvoiceReimburseInfoJo);
bodyJson.put("infos", reimburseInfoJa);
JSONObject reimburseJson = InvoiceCloudUtil.reimburseInvoice(reimburseUrl, aesKey, bodyJson, userName, password, "锁定报销修改数据");
logger.info("reimburseJson:" + reimburseJson);
}
}catch (Throwable e){
logger.error("TjwFpUtil.updateFpStatusInCloud error;message:" + e.getMessage() + ";e:" + e);
}
}
/**
* @param cloudIdParam cloudid
* @param user
*/
public static void updateFpStatusInCloud3(User user,String cloudIdParam,String flag,String je,String requestId,String requestmark,String requestName){
try{
RecordSet rs = new RecordSet();
String getDataSql = "select * from fnainvoiceledger where cloudid = ?";
Map<String, String> firstData = DaoUtil.getFirstData(rs, getDataSql, cloudIdParam);
String userId = firstData.get("userid_new");
DecimalFormat df = new DecimalFormat("#####################0.00");
//其中key为userid_new value为的List
Map<String,List<String>> mapCloud = new HashMap<>();
List<String> cloudIds = new ArrayList<>();
cloudIds.add(cloudIdParam);
mapCloud.put(userId,cloudIds);
//发票云报销修改发票云数据
RecordSet rs5= new RecordSet();
for(Map.Entry<String, List<String>> entry : mapCloud.entrySet()){
String userid_new = entry.getKey();
int userid_newInt = Util.getIntValue(Util.null2String(userid_new),0);
JSONObject interfaceInfo = InvoiceCloudUtil.getInterfaceInfo(new User(userid_newInt), false, false, true);
JSONObject cloudInfo = interfaceInfo.getJSONObject("cloud");
boolean existEffectCloud = cloudInfo.getBoolean("existEffectCloud");
logger.info("existEffectCloud:" + existEffectCloud);
String cid = Util.null2String(cloudInfo.getString("cid"));
String userName = Util.null2String(cloudInfo.getString("userName"));
String password = Util.null2String(cloudInfo.getString("password"));
String aesKey = Util.null2String(cloudInfo.getString("aesKey"));
String reimburseUrl = Util.null2String(cloudInfo.getString("reimburseUrl"));
JSONObject bodyJson = new JSONObject();
bodyJson.put("cid",cid);
bodyJson.put("userId",user.getUID());
bodyJson.put("flag",flag);
JSONArray fnaInvoiceReimburseInfoJa = new JSONArray();
logger.info("requestid:" + requestId);
logger.info("requestmark:" + requestmark);
logger.info("je:" + je);
JSONObject fnaInvoiceReimburseInfoJo = new JSONObject();
fnaInvoiceReimburseInfoJo.put("dataid", requestId);//requestid
fnaInvoiceReimburseInfoJo.put("number", requestmark);//requestmark
fnaInvoiceReimburseInfoJo.put("amount", df.format(Util.getDoubleValue(je, 0.00)));
fnaInvoiceReimburseInfoJo.put("uid", user.getUID());
fnaInvoiceReimburseInfoJo.put("date", getTimestamp(Util.date(2)));
fnaInvoiceReimburseInfoJo.put("name", requestName);
fnaInvoiceReimburseInfoJo.put("fid", cloudIdParam);
fnaInvoiceReimburseInfoJo.put("cid", cid);
fnaInvoiceReimburseInfoJa.add(fnaInvoiceReimburseInfoJo);
bodyJson.put("sreim","2");
JSONArray reimburseInfoJa = new JSONArray();
reimburseInfoJa.add(fnaInvoiceReimburseInfoJo);
bodyJson.put("infos", reimburseInfoJa);
JSONObject reimburseJson = InvoiceCloudUtil.reimburseInvoice(reimburseUrl, aesKey, bodyJson, userName, password, "锁定报销修改数据");
logger.info("reimburseJson:" + reimburseJson);
}
}catch (Throwable e){
logger.error("TjwFpUtil.updateFpStatusInCloud error;message:" + e.getMessage() + ";e:" + e);
}
}
/**
* @param cloudIdParam cloudid
* @param user
*/
public static void updateFpStatusInCloud(User user,String cloudIdParam,String flag,String je,String requestId,String requestmark,String requestName){
try{
RecordSet rs = new RecordSet();
String getDataSql = "select * from fnainvoiceledger where cloudid = ?";
Map<String, String> firstData = DaoUtil.getFirstData(rs, getDataSql, cloudIdParam);
String userId = firstData.get("userid_new");
DecimalFormat df = new DecimalFormat("#####################0.00");
//其中key为userid_new value为的List
Map<String,List<String>> mapCloud = new HashMap<>();
List<String> cloudIds = new ArrayList<>();
cloudIds.add(cloudIdParam);
mapCloud.put(userId,cloudIds);
//发票云报销修改发票云数据
RecordSet rs5= new RecordSet();
for(Map.Entry<String, List<String>> entry : mapCloud.entrySet()){
String userid_new = entry.getKey();
int userid_newInt = Util.getIntValue(Util.null2String(userid_new),0);
JSONObject interfaceInfo = InvoiceCloudUtil.getInterfaceInfo(new User(userid_newInt), false, false, true);
JSONObject cloudInfo = interfaceInfo.getJSONObject("cloud");
boolean existEffectCloud = cloudInfo.getBoolean("existEffectCloud");
logger.info("existEffectCloud:" + existEffectCloud);
String cid = Util.null2String(cloudInfo.getString("cid"));
String userName = Util.null2String(cloudInfo.getString("userName"));
String password = Util.null2String(cloudInfo.getString("password"));
String aesKey = Util.null2String(cloudInfo.getString("aesKey"));
String reimburseUrl = Util.null2String(cloudInfo.getString("reimburseUrl"));
JSONObject bodyJson = new JSONObject();
bodyJson.put("cid",cid);
bodyJson.put("userId",user.getUID());
bodyJson.put("flag",flag);
JSONArray fnaInvoiceReimburseInfoJa = new JSONArray();
logger.info("requestid:" + requestId);
logger.info("requestmark:" + requestmark);
logger.info("je:" + je);
JSONObject fnaInvoiceReimburseInfoJo = new JSONObject();
fnaInvoiceReimburseInfoJo.put("dataid", requestId);//requestid
fnaInvoiceReimburseInfoJo.put("number", requestmark);//requestmark
fnaInvoiceReimburseInfoJo.put("amount", df.format(Util.getDoubleValue(je, 0.00)));
fnaInvoiceReimburseInfoJo.put("uid", user.getUID());
fnaInvoiceReimburseInfoJo.put("date", getTimestamp(Util.date(2)));
fnaInvoiceReimburseInfoJo.put("name", requestName);
fnaInvoiceReimburseInfoJo.put("fid", cloudIdParam);
fnaInvoiceReimburseInfoJo.put("cid", cid);
fnaInvoiceReimburseInfoJa.add(fnaInvoiceReimburseInfoJo);
bodyJson.put("sreim","1");
JSONArray reimburseInfoJa = new JSONArray();
reimburseInfoJa.add(fnaInvoiceReimburseInfoJo);
bodyJson.put("infos", reimburseInfoJa);
JSONObject reimburseJson = InvoiceCloudUtil.reimburseInvoice(reimburseUrl, aesKey, bodyJson, userName, password, "锁定报销修改数据");
logger.info("reimburseJson:" + reimburseJson);
}
}catch (Throwable e){
logger.error("TjwFpUtil.updateFpStatusInCloud error;message:" + e.getMessage() + ";e:" + e);
}
}
}

View File

@ -0,0 +1,272 @@
package com.api.taojw.common;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.Principal;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Locale;
import java.util.Map;
public class TjwHttpServletRequest implements HttpServletRequest {
@Override
public String getMethod() {
return null;
}
@Override
public String getRequestURI() {
return null;
}
@Override
public StringBuffer getRequestURL() {
return null;
}
@Override
public String getContextPath() {
return null;
}
@Override
public String getServletPath() {
return null;
}
@Override
public String getPathInfo() {
return null;
}
@Override
public String getPathTranslated() {
return null;
}
@Override
public String getQueryString() {
return null;
}
@Override
public String getHeader(String s) {
return null;
}
@Override
public Enumeration getHeaders(String s) {
return null;
}
@Override
public Enumeration getHeaderNames() {
return null;
}
@Override
public int getIntHeader(String s) {
return 0;
}
@Override
public long getDateHeader(String s) {
return 0;
}
@Override
public Cookie[] getCookies() {
return new Cookie[0];
}
@Override
public HttpSession getSession(boolean b) {
return null;
}
@Override
public HttpSession getSession() {
return null;
}
@Override
public String getRequestedSessionId() {
return null;
}
@Override
public boolean isRequestedSessionIdValid() {
return false;
}
@Override
public boolean isRequestedSessionIdFromCookie() {
return false;
}
@Override
public boolean isRequestedSessionIdFromURL() {
return false;
}
@Override
public String getAuthType() {
return null;
}
@Override
public String getRemoteUser() {
return null;
}
@Override
public boolean isUserInRole(String s) {
return false;
}
@Override
public Principal getUserPrincipal() {
return null;
}
/**
* @deprecated
*/
@Override
public boolean isRequestedSessionIdFromUrl() {
return false;
}
@Override
public String getProtocol() {
return null;
}
@Override
public String getScheme() {
return null;
}
@Override
public String getServerName() {
return null;
}
@Override
public int getServerPort() {
return 0;
}
@Override
public String getRemoteAddr() {
return null;
}
@Override
public String getRemoteHost() {
return null;
}
@Override
public void setCharacterEncoding(String s) throws UnsupportedEncodingException {
}
@Override
public String getParameter(String s) {
return null;
}
@Override
public String[] getParameterValues(String s) {
return new String[0];
}
@Override
public Enumeration getParameterNames() {
return null;
}
@Override
public Map getParameterMap() {
return null;
}
@Override
public ServletInputStream getInputStream() throws IOException {
return null;
}
@Override
public BufferedReader getReader() throws IOException, IllegalStateException {
return null;
}
@Override
public String getCharacterEncoding() {
return null;
}
@Override
public int getContentLength() {
return 0;
}
@Override
public String getContentType() {
return null;
}
@Override
public Locale getLocale() {
return null;
}
@Override
public Enumeration getLocales() {
return null;
}
@Override
public boolean isSecure() {
return false;
}
@Override
public Object getAttribute(String s) {
return null;
}
@Override
public void setAttribute(String s, Object o) {
}
@Override
public Enumeration getAttributeNames() {
return null;
}
@Override
public void removeAttribute(String s) {
}
@Override
public RequestDispatcher getRequestDispatcher(String s) {
return null;
}
/**
* @param s
* @deprecated
*/
@Override
public String getRealPath(String s) {
return null;
}
}

View File

@ -0,0 +1,119 @@
package com.api.taojw.common;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.Principal;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Locale;
import java.util.Map;
public class TjwHttpSession implements HttpSession {
@Override
public String getId() {
return null;
}
@Override
public boolean isNew() {
return false;
}
@Override
public long getCreationTime() {
return 0;
}
@Override
public long getLastAccessedTime() {
return 0;
}
@Override
public void setMaxInactiveInterval(int i) {
}
@Override
public int getMaxInactiveInterval() {
return 0;
}
@Override
public Object getAttribute(String s) {
return null;
}
@Override
public Enumeration<String> getAttributeNames() {
return null;
}
@Override
public void setAttribute(String s, Object o) {
}
@Override
public void removeAttribute(String s) {
}
@Override
public void invalidate() {
}
/**
* @deprecated
*/
@Override
public HttpSessionContext getSessionContext() {
return null;
}
@Override
public ServletContext getServletContext() {
return null;
}
/**
* @param s
* @deprecated
*/
@Override
public Object getValue(String s) {
return null;
}
/**
* @deprecated
*/
@Override
public String[] getValueNames() {
return new String[0];
}
/**
* @param s
* @param o
* @deprecated
*/
@Override
public void putValue(String s, Object o) {
}
/**
* @param s
* @deprecated
*/
@Override
public void removeValue(String s) {
}
}

View File

@ -0,0 +1,679 @@
package com.api.taojw.common;
import com.alibaba.fastjson.JSONObject;
import com.api.taojw.common.logging.MyLogger;
import org.apache.commons.io.IOUtils;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.*;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.TrustStrategy;
import org.apache.http.entity.BufferedHttpEntity;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.HttpMultipartMode;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContextBuilder;
import org.apache.http.util.EntityUtils;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.file.ImageFileManager;
import weaver.general.Util;
import javax.net.ssl.*;
import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.security.cert.X509Certificate;
import java.util.*;
public class TjwHttpUtil {
static Logger logger = MyLogger.getLogger();
/**
*
*/
public static JSONObject uploadFileUtil(String url, String imageFileIds, Map<String,String> headers,Map<String,String> textParams,String fileParamName){
JSONObject result = new JSONObject();
try{
logger.info("TjwHttpUtil.uploadFileUtil begin;url:" + url + ";imageFileIds:" + imageFileIds);
//根据docIds获取文件信息
String[] imageFileIdsArray = imageFileIds.split(",");
if(imageFileIdsArray == null || imageFileIdsArray.length == 0){
return result;
}
List<Map<String,String>> fileInfos = new ArrayList<>();
RecordSet rs = new RecordSet();
String getFileInfoSql = "select t2.imagefilename,t2.imagefileid from docimagefile t1 inner join imagefile t2 on t2.imagefileid = t1.imagefileid where t2.imagefileid = ?";
for(String imageFileId:imageFileIdsArray){
if(rs.executeQuery(getFileInfoSql,imageFileId)){
while(rs.next()){
Map<String,String> file = new HashMap<>();
file.put("imagefileid", Util.null2String(rs.getString("imagefileid")));
file.put("imagefilename", Util.null2String(rs.getString("imagefilename")));
fileInfos.add(file);
}
}
}
CloseableHttpClient httpClient = createSSLClientDefault(url);
HttpPost httpPost = new HttpPost(url);
MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create();
multipartEntityBuilder.setCharset(StandardCharsets.UTF_8);
multipartEntityBuilder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
ImageFileManager imageFileManager = new ImageFileManager();
for(Map<String,String> file:fileInfos){
String fileName = file.get("imagefilename");
fileName = fileName.replaceAll("&amp;","&");
fileName = fileName.replaceAll("&gt;",">");
fileName = fileName.replaceAll("&lt;","<");
fileName = fileName.replaceAll("&apos;","'");
fileName = fileName.replaceAll("&quot;","\"");
InputStream imagefileid = imageFileManager.getInputStreamById(Integer.parseInt(file.get("imagefileid")));
multipartEntityBuilder.addBinaryBody(fileParamName,imagefileid, ContentType.MULTIPART_FORM_DATA,fileName);
}
ContentType contentType = ContentType.create("text/plain", StandardCharsets.UTF_8);
for(String key : textParams.keySet()){
StringBody stringBody = new StringBody(String.valueOf(textParams.get(key)), contentType);
multipartEntityBuilder.addPart(key, stringBody);
}
HttpEntity httpEntity = multipartEntityBuilder.build();
httpPost.setEntity(httpEntity);
//请求头设置
if(headers != null && headers.size() > 0){
for(String key:headers.keySet()){
if(!"Content-Type".equals(key)){
httpPost.setHeader(key,headers.get(key));
}
}
}
logger.info("FilePostUtil.uploadFileUtil.httpClient.execute begin;imageFileIds:" + imageFileIds + ";url:" + url);
CloseableHttpResponse httpResponse = httpClient.execute(httpPost);
HttpEntity responseEntity = httpResponse.getEntity();
int statusCode= httpResponse.getStatusLine().getStatusCode();
BufferedReader reader = new BufferedReader(new InputStreamReader(responseEntity.getContent()));
StringBuffer buffer = new StringBuffer();
String str = "";
while((str = reader.readLine()) != null) {
buffer.append(str);
}
logger.info("FilePostUtil.uploadFileUtil.httpClient.execute done;statusCode:" + statusCode + ";message:" + buffer);
result = JSONObject.parseObject(buffer.toString());
httpClient.close();
if(httpResponse!=null){
httpResponse.close();
}
}catch(Throwable e){
logger.error("FilePostUtil.uploadFileUtil exception;url:" + url + ";imageFileIds:" + imageFileIds);
}
return result;
}
public static void addLogInMode(String url,int code,String requestParam,String responseData){
try{
RecordSet rs = new RecordSet();
JSONObject loggerJson = new JSONObject();
loggerJson.put("qqdz",url);
loggerJson.put("qqxx",requestParam);
loggerJson.put("xyxx",responseData);
loggerJson.put("xym",code);
TjwModelUtil.addModelData(rs,"uf_tjwhttplog",loggerJson);
}catch (Throwable e){
logger.error("TjwHttpUtil.addLogInMode error;message:" + e.getMessage() + ";e:" + e);
}
}
public static void addLogInModeWithCusLog(String url,int code,String requestParam,String responseData,Map<String,String> cusLogInfo){
try{
if(responseData.length() > 1000){
responseData = "报文长度过长,请在日志文件中查看!";
}
RecordSet rs = new RecordSet();
JSONObject loggerJson = new JSONObject();
loggerJson.put("qqdz",url);
loggerJson.put("qqxx",requestParam);
loggerJson.put("xyxx",responseData);
loggerJson.put("xym",code);
if(cusLogInfo != null && cusLogInfo.size() > 0){
for(String key : cusLogInfo.keySet()){
loggerJson.put(key,cusLogInfo.get(cusLogInfo));
}
}
TjwModelUtil.addModelData(rs,"uf_tjwhttplog",loggerJson);
}catch (Throwable e){
logger.error("TjwHttpUtil.addLogInMode error;message:" + e.getMessage() + ";e:" + e);
}
}
/**
*
* @param url
* @param headMap
* @param fileName
*/
public static InputStream httpGetDownloadFile(String url,Map<String, String> headMap,String fileName) {
CloseableHttpClient httpclient = createSSLClientDefault(url);
try {
HttpGet httpGet = new HttpGet(url);
if (headMap != null && headMap.size() > 0) {
Set<String> keySet = headMap.keySet();
for (String key : keySet) {
httpGet.addHeader(key, headMap.get(key));
}
}
CloseableHttpResponse response = httpclient.execute(httpGet);
try {
int statusCode = response.getStatusLine().getStatusCode();
logger.info("url:" + url + ";download file end;code:" + statusCode);
HttpEntity httpEntity = response.getEntity();
InputStream is = httpEntity.getContent();
// 根据InputStream 下载文件
ByteArrayOutputStream output = new ByteArrayOutputStream();
byte[] buffer = new byte[4096];
int r = 0;
while ((r = is.read(buffer)) > 0) {
output.write(buffer, 0, r);
}
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(output.toByteArray());
output.flush();
output.close();
EntityUtils.consume(httpEntity);
logger.info("url:" + url + ";download file success");
return byteArrayInputStream;
} finally {
response.close();
}
} catch (Throwable e) {
logger.error("httpGetDownloadFile exception;message:" + e.getMessage() + ";e:" + e);
} finally {
try {
httpclient.close();
} catch (Throwable e) {
logger.error("httpGetDownloadFile httpclient close exception;message:" + e.getMessage() + ";e:" + e);
}
}
return null;
}
public static void oauthOneSignHeader(HttpRequestBase httpRequest,Map<String,String> oauthConfigMap){
OauthOneHttpUtil oAuthUtil = new OauthOneHttpUtil();
oAuthUtil.consumerKey = oauthConfigMap.get("consumerKey");
oAuthUtil.consumerSecret = oauthConfigMap.get("consumerSecret");
oAuthUtil.accessToken = oauthConfigMap.get("accessToken");
oAuthUtil.accessTokenSecret = oauthConfigMap.get("accessTokenSecret");
oAuthUtil.realmID = oauthConfigMap.get("realmID");
oAuthUtil.encryption = oauthConfigMap.get("encryption");
oAuthUtil.authorize(httpRequest);
}
/**
* http
* @param url
* @param param
* @param method
* @param contentType
* @return
* @throws Exception
*/
public static Map<String,String> sendHttpOAuthRequest(String url, String param, String method, ContentType contentType,Map<String,String> headers,Map<String,String> oauthConfigMap){
Map<String,String> result = new HashMap<>();
CloseableHttpClient client = createSSLClientDefault(url);
try{
logger.info("sendHttpRequest begin;url:" + url + ";param:" + param + ";method:" + method);
if("post".equalsIgnoreCase(method)){
HttpPost post=new HttpPost(url);
oauthOneSignHeader(post,oauthConfigMap);
StringEntity entity = new StringEntity(param, contentType);
//StringEntity entity = new StringEntity(param, ContentType.APPLICATION_JSON);
post.setEntity(entity);
for(String key : headers.keySet()){
post.setHeader(key,headers.get(key));
}
CloseableHttpResponse response = client.execute(post);
int statusCode = response.getStatusLine().getStatusCode();
HttpEntity en = response.getEntity();
en = new BufferedHttpEntity(en);
result.put("code", String.valueOf(statusCode));
result.put("data",EntityUtils.toString(en, "utf-8"));
addLogInMode(url,statusCode,param,EntityUtils.toString(en, "utf-8"));
logger.info("sendHttpRequest done;code:" + String.valueOf(statusCode) + ";data:" + EntityUtils.toString(en, "utf-8"));
}else if("get".equalsIgnoreCase(method)){
HttpGet get=new HttpGet(url);
oauthOneSignHeader(get,oauthConfigMap);
CloseableHttpResponse response = client.execute(get);
int statusCode = response.getStatusLine().getStatusCode();
HttpEntity en = response.getEntity();
en = new BufferedHttpEntity(en);
result.put("code", String.valueOf(statusCode));
result.put("data",EntityUtils.toString(en, "utf-8"));
addLogInMode(url,statusCode,param,EntityUtils.toString(en, "utf-8"));
logger.info("sendHttpRequest done;code:" + String.valueOf(statusCode) + ";data:" + EntityUtils.toString(en, "utf-8"));
}else if("put".equalsIgnoreCase(method)){
HttpPut put = new HttpPut(url);
for(String key : headers.keySet()){
put.setHeader(key,headers.get(key));
}
CloseableHttpResponse response = client.execute(put);
int statusCode = response.getStatusLine().getStatusCode();
HttpEntity en = response.getEntity();
en = new BufferedHttpEntity(en);
result.put("code", String.valueOf(statusCode));
result.put("data",EntityUtils.toString(en, "utf-8"));
addLogInMode(url,statusCode,param,EntityUtils.toString(en, "utf-8"));
logger.info("sendHttpRequest done;code:" + statusCode + ";data:" + EntityUtils.toString(en, "utf-8"));
}
}catch(Throwable e){
logger.error("sendHttpRequest exception;url:" + url + ";param:" + param + ";message:" + e.getMessage() + ";e:" + e);
}finally {
try {
client.close();
} catch (IOException e) {
logger.error("sendHttpRequest client.close;url:" + url + ";param:" + param + ";message:" + e.getMessage() + ";e:" + e);
throw new RuntimeException(e);
}
}
return result;
}
/**
* http
* @param url
* @param param
* @param method
* @param contentType
* @return
* @throws Exception
*/
public static Map<String,String> sendHttpRequest(String url, String param, String method, ContentType contentType,Map<String,String> headers,int imageFileId){
Map<String,String> result = new HashMap<>();
CloseableHttpClient client = createSSLClientDefault(url);
try{
logger.info("sendHttpRequest begin;url:" + url + ";param:" + param + ";method:" + method);
if("post".equalsIgnoreCase(method)){
HttpPost post=new HttpPost(url);
StringEntity entity = new StringEntity(param, contentType);
//StringEntity entity = new StringEntity(param, ContentType.APPLICATION_JSON);
post.setEntity(entity);
if(imageFileId > 0){
ImageFileManager ifm = new ImageFileManager();
InputStream is = ifm.getInputStreamById(imageFileId);
ByteArrayEntity byteArrayEntity = new ByteArrayEntity(IOUtils.toByteArray(is));
post.setEntity(byteArrayEntity);
}
for(String key : headers.keySet()){
post.setHeader(key,headers.get(key));
}
CloseableHttpResponse response = client.execute(post);
int statusCode = response.getStatusLine().getStatusCode();
HttpEntity en = response.getEntity();
en = new BufferedHttpEntity(en);
result.put("code", String.valueOf(statusCode));
result.put("data",EntityUtils.toString(en, "utf-8"));
addLogInMode(url,statusCode,param,EntityUtils.toString(en, "utf-8"));
logger.info("sendHttpRequest done;code:" + String.valueOf(statusCode) + ";data:" + EntityUtils.toString(en, "utf-8"));
}else if("get".equalsIgnoreCase(method)){
HttpGet get=new HttpGet(url);
CloseableHttpResponse response = client.execute(get);
int statusCode = response.getStatusLine().getStatusCode();
HttpEntity en = response.getEntity();
en = new BufferedHttpEntity(en);
result.put("code", String.valueOf(statusCode));
result.put("data",EntityUtils.toString(en, "utf-8"));
addLogInMode(url,statusCode,param,EntityUtils.toString(en, "utf-8"));
logger.info("sendHttpRequest done;code:" + String.valueOf(statusCode) + ";data:" + EntityUtils.toString(en, "utf-8"));
}else if("put".equalsIgnoreCase(method)){
HttpPut put = new HttpPut(url);
for(String key : headers.keySet()){
put.setHeader(key,headers.get(key));
}
if(imageFileId > 0){
ImageFileManager ifm = new ImageFileManager();
InputStream is = ifm.getInputStreamById(imageFileId);
ByteArrayEntity byteArrayEntity = new ByteArrayEntity(IOUtils.toByteArray(is));
put.setEntity(byteArrayEntity);
}
CloseableHttpResponse response = client.execute(put);
int statusCode = response.getStatusLine().getStatusCode();
HttpEntity en = response.getEntity();
en = new BufferedHttpEntity(en);
result.put("code", String.valueOf(statusCode));
result.put("data",EntityUtils.toString(en, "utf-8"));
addLogInMode(url,statusCode,param,EntityUtils.toString(en, "utf-8"));
logger.info("sendHttpRequest done;code:" + statusCode + ";data:" + EntityUtils.toString(en, "utf-8"));
}
}catch(Exception e){
logger.error("sendHttpRequest exception;url:" + url + ";param:" + param + ";message:" + e.getMessage() + ";e:" + e);
}finally {
try {
client.close();
} catch (IOException e) {
logger.error("sendHttpRequest client.close;url:" + url + ";param:" + param + ";message:" + e.getMessage() + ";e:" + e);
throw new RuntimeException(e);
}
}
return result;
}
/**
* http
* @param url
* @param param
* @param method
* @param contentType
* @return
* @throws Exception
*/
public static Map<String,Object> sendHttpRequestWithCusLog(String url, String param, String method, ContentType contentType,Map<String,String> headers,Map<String,String> cusLogInfo){
Map<String,Object> result = new HashMap<>();
CloseableHttpClient client = createSSLClientDefault(url);
try{
logger.info("sendHttpRequest begin;url:" + url + ";param:" + param + ";method:" + method);
if("post".equalsIgnoreCase(method)){
HttpPost post=new HttpPost(url);
StringEntity entity = new StringEntity(param, contentType);
//StringEntity entity = new StringEntity(param, ContentType.APPLICATION_JSON);
post.setEntity(entity);
for(String key : headers.keySet()){
post.setHeader(key,headers.get(key));
}
CloseableHttpResponse response = client.execute(post);
int statusCode = response.getStatusLine().getStatusCode();
HttpEntity en = response.getEntity();
en = new BufferedHttpEntity(en);
result.put("code", String.valueOf(statusCode));
result.put("data",EntityUtils.toString(en, "utf-8"));
addLogInModeWithCusLog(url,statusCode,param,EntityUtils.toString(en, "utf-8"),cusLogInfo);
logger.info("sendHttpRequest done;code:" + String.valueOf(statusCode) + ";data:" + EntityUtils.toString(en, "utf-8"));
}else if("get".equalsIgnoreCase(method)){
HttpGet get=new HttpGet(url);
if(headers != null && headers.size() > 0){
for(String key : headers.keySet()){
get.setHeader(key,headers.get(key));
}
}
CloseableHttpResponse response = client.execute(get);
int statusCode = response.getStatusLine().getStatusCode();
HttpEntity en = response.getEntity();
en = new BufferedHttpEntity(en);
JSONObject responseHeaders = new JSONObject();
Header[] allHeaders = response.getAllHeaders();
for(Header header:allHeaders){
responseHeaders.put(header.getName(),header.getValue());
}
result.put("responseHeaders",responseHeaders.toJSONString());
result.put("code", String.valueOf(statusCode));
result.put("data",EntityUtils.toString(en, "utf-8"));
addLogInModeWithCusLog(url,statusCode,param,EntityUtils.toString(en, "utf-8"),cusLogInfo);
logger.info("sendHttpRequest done;code:" + String.valueOf(statusCode) + ";data:" + EntityUtils.toString(en, "utf-8"));
}else if("put".equalsIgnoreCase(method)){
HttpPut put = new HttpPut(url);
for(String key : headers.keySet()){
put.setHeader(key,headers.get(key));
}
CloseableHttpResponse response = client.execute(put);
int statusCode = response.getStatusLine().getStatusCode();
HttpEntity en = response.getEntity();
en = new BufferedHttpEntity(en);
result.put("code", String.valueOf(statusCode));
result.put("data",EntityUtils.toString(en, "utf-8"));
addLogInModeWithCusLog(url,statusCode,param,EntityUtils.toString(en, "utf-8"),cusLogInfo);
logger.info("sendHttpRequest done;code:" + statusCode + ";data:" + EntityUtils.toString(en, "utf-8"));
}else if("getWithEntity".equalsIgnoreCase(method)){
HttpGetWithEntity get=new HttpGetWithEntity(url);
if(headers != null && headers.size() > 0){
for(String key : headers.keySet()){
get.setHeader(key,headers.get(key));
}
}
HttpEntity httpEntity = new StringEntity(param, contentType);
get.setEntity(httpEntity);
CloseableHttpResponse response = client.execute(get);
int statusCode = response.getStatusLine().getStatusCode();
HttpEntity en = response.getEntity();
en = new BufferedHttpEntity(en);
Header[] allHeaders = response.getAllHeaders();
Header[] clone = allHeaders.clone();
result.put("responseHeaders",clone);
result.put("code", String.valueOf(statusCode));
result.put("data",EntityUtils.toString(en, "utf-8"));
addLogInModeWithCusLog(url,statusCode,param,EntityUtils.toString(en, "utf-8"),cusLogInfo);
logger.info("sendHttpRequest done;code:" + String.valueOf(statusCode) + ";data:" + EntityUtils.toString(en, "utf-8"));
}
}catch(Exception e){
logger.error("sendHttpRequest exception;url:" + url + ";param:" + param + ";message:" + e.getMessage() + ";e:" + e);
}finally {
try {
client.close();
} catch (IOException e) {
logger.error("sendHttpRequest client.close;url:" + url + ";param:" + param + ";message:" + e.getMessage() + ";e:" + e);
throw new RuntimeException(e);
}
}
return result;
}
/**
* http
* @param url
* @param param
* @param method
* @param contentType
* @return
* @throws Exception
*/
public static Map<String,Object> sendHttpRequest(String url, String param, String method, ContentType contentType,Map<String,String> headers){
Map<String,Object> result = new HashMap<>();
CloseableHttpClient client = createSSLClientDefault(url);
try{
logger.info("sendHttpRequest begin;url:" + url + ";param:" + param + ";method:" + method);
if("post".equalsIgnoreCase(method)){
HttpPost post=new HttpPost(url);
StringEntity entity = new StringEntity(param, contentType);
//StringEntity entity = new StringEntity(param, ContentType.APPLICATION_JSON);
post.setEntity(entity);
for(String key : headers.keySet()){
post.setHeader(key,headers.get(key));
}
CloseableHttpResponse response = client.execute(post);
int statusCode = response.getStatusLine().getStatusCode();
HttpEntity en = response.getEntity();
en = new BufferedHttpEntity(en);
result.put("code", String.valueOf(statusCode));
result.put("data",EntityUtils.toString(en, "utf-8"));
addLogInMode(url,statusCode,param,EntityUtils.toString(en, "utf-8"));
logger.info("sendHttpRequest done;code:" + String.valueOf(statusCode) + ";data:" + EntityUtils.toString(en, "utf-8"));
}else if("get".equalsIgnoreCase(method)){
HttpGet get=new HttpGet(url);
if(headers != null && headers.size() > 0){
for(String key : headers.keySet()){
get.setHeader(key,headers.get(key));
}
}
CloseableHttpResponse response = client.execute(get);
int statusCode = response.getStatusLine().getStatusCode();
HttpEntity en = response.getEntity();
en = new BufferedHttpEntity(en);
JSONObject responseHeaders = new JSONObject();
Header[] allHeaders = response.getAllHeaders();
for(Header header:allHeaders){
responseHeaders.put(header.getName(),header.getValue());
}
result.put("responseHeaders",responseHeaders.toJSONString());
result.put("code", String.valueOf(statusCode));
result.put("data",EntityUtils.toString(en, "utf-8"));
addLogInMode(url,statusCode,param,EntityUtils.toString(en, "utf-8"));
logger.info("sendHttpRequest done;code:" + String.valueOf(statusCode) + ";data:" + EntityUtils.toString(en, "utf-8"));
}else if("put".equalsIgnoreCase(method)){
HttpPut put = new HttpPut(url);
for(String key : headers.keySet()){
put.setHeader(key,headers.get(key));
}
CloseableHttpResponse response = client.execute(put);
int statusCode = response.getStatusLine().getStatusCode();
HttpEntity en = response.getEntity();
en = new BufferedHttpEntity(en);
result.put("code", String.valueOf(statusCode));
result.put("data",EntityUtils.toString(en, "utf-8"));
addLogInMode(url,statusCode,param,EntityUtils.toString(en, "utf-8"));
logger.info("sendHttpRequest done;code:" + statusCode + ";data:" + EntityUtils.toString(en, "utf-8"));
}else if("getWithEntity".equalsIgnoreCase(method)){
HttpGetWithEntity get=new HttpGetWithEntity(url);
if(headers != null && headers.size() > 0){
for(String key : headers.keySet()){
get.setHeader(key,headers.get(key));
}
}
HttpEntity httpEntity = new StringEntity(param, contentType);
get.setEntity(httpEntity);
CloseableHttpResponse response = client.execute(get);
int statusCode = response.getStatusLine().getStatusCode();
HttpEntity en = response.getEntity();
en = new BufferedHttpEntity(en);
Header[] allHeaders = response.getAllHeaders();
Header[] clone = allHeaders.clone();
result.put("responseHeaders",clone);
result.put("code", String.valueOf(statusCode));
result.put("data",EntityUtils.toString(en, "utf-8"));
addLogInMode(url,statusCode,param,EntityUtils.toString(en, "utf-8"));
logger.info("sendHttpRequest done;code:" + String.valueOf(statusCode) + ";data:" + EntityUtils.toString(en, "utf-8"));
}
}catch(Exception e){
logger.error("sendHttpRequest exception;url:" + url + ";param:" + param + ";message:" + e.getMessage() + ";e:" + e);
}finally {
try {
client.close();
} catch (IOException e) {
logger.error("sendHttpRequest client.close;url:" + url + ";param:" + param + ";message:" + e.getMessage() + ";e:" + e);
throw new RuntimeException(e);
}
}
return result;
}
/**
* http
* @param url
* @param param
* @param method
* @param contentType
* @return
* @throws Exception
*/
public static Map<String,String> sendHttpRequest(String url, String param, String method, ContentType contentType){
Map<String,String> result = new HashMap<>();
CloseableHttpClient client = createSSLClientDefault(url);
try{
logger.info("sendHttpRequest begin;url:" + url + ";param:" + param + ";method:" + method);
if("post".equalsIgnoreCase(method)){
HttpPost post=new HttpPost(url);
StringEntity entity = new StringEntity(param, contentType);
//StringEntity entity = new StringEntity(param, ContentType.APPLICATION_JSON);
post.setEntity(entity);
CloseableHttpResponse response = client.execute(post);
int statusCode = response.getStatusLine().getStatusCode();
HttpEntity en = response.getEntity();
en = new BufferedHttpEntity(en);
result.put("code", String.valueOf(statusCode));
result.put("data",EntityUtils.toString(en, "utf-8"));
addLogInMode(url,statusCode,param,EntityUtils.toString(en, "utf-8"));
logger.info("sendHttpRequest done;code:" + String.valueOf(statusCode) + ";data:" + EntityUtils.toString(en, "utf-8"));
}else if("get".equalsIgnoreCase(method)){
HttpGet get=new HttpGet(url);
CloseableHttpResponse response = client.execute(get);
int statusCode = response.getStatusLine().getStatusCode();
HttpEntity en = response.getEntity();
en = new BufferedHttpEntity(en);
result.put("code", String.valueOf(statusCode));
result.put("data",EntityUtils.toString(en, "utf-8"));
addLogInMode(url,statusCode,param,EntityUtils.toString(en, "utf-8"));
logger.info("sendHttpRequest done;code:" + String.valueOf(statusCode) + ";data:" + EntityUtils.toString(en, "utf-8"));
}
}catch(Exception e){
logger.error("sendHttpRequest exception;url:" + url + ";param:" + param + ";message:" + e.getMessage() + ";e:" + e);
}finally {
try {
client.close();
} catch (IOException e) {
logger.error("sendHttpRequest client.close;url:" + url + ";param:" + param + ";message:" + e.getMessage() + ";e:" + e);
throw new RuntimeException(e);
}
}
return result;
}
/**
* CloseableHttpClient https
* @return
* @throws MalformedURLException
*/
public static CloseableHttpClient createSSLClientDefault(String urlString){
URL url = null;
try {
url = new URL(urlString);
} catch (Exception e) {
logger.error("url error;urlString:" + urlString);
}
String protocol = url.getProtocol();
if("https".equals(protocol)){
try {
//使用 loadTrustMaterial() 方法实现一个信任策略,信任所有证书
SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, new TrustStrategy() {
@Override
public boolean isTrusted(X509Certificate[] x509Certificates, String s) throws java.security.cert.CertificateException {
return true;
}
}).build();
//NoopHostnameVerifier类: 作为主机名验证工具,实质上关闭了主机名验证,它接受任何
//有效的SSL会话并匹配到目标主机。
HostnameVerifier hostnameVerifier = NoopHostnameVerifier.INSTANCE;
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext, hostnameVerifier);
CloseableHttpClient build = HttpClients.custom().setSSLSocketFactory(sslsf).build();
return build;
} catch (Exception e) {
logger.error("createSSLClientDefault error;exception:" + e.getMessage() + ";e:" + e);
CloseableHttpClient aDefault = HttpClients.createDefault();
return aDefault;
}
}else{
CloseableHttpClient aDefault = HttpClients.createDefault();
return aDefault;
}
}
private static final TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(X509Certificate[] certs, String authType) {
}
public void checkServerTrusted(X509Certificate[] certs, String authType) {
}
}
};
private static final HostnameVerifier NOT_VERYFY = new HostnameVerifier() {
@Override
public boolean verify(String s, SSLSession sslSession) {
return true;
}
};
}

View File

@ -0,0 +1,159 @@
package com.api.taojw.common;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.api.taojw.common.logging.MyLogger;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.workflow.webservices.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class TjwJsonToWorkflowByConfigUtil {
static Logger logger = MyLogger.getLogger();
public static String getValueByConfig(Map<String, String> configMap, JSONObject jsonData, RecordSet rs){
String result = "";
try{
String path = configMap.get("jsonbwzdlj");
String zhgz = configMap.get("zhgz");
String zdysql = configMap.get("zdysql");
String oldValue = CommonUtil.getJsonValueByPath(jsonData,path);
switch(zhgz){
case "0":
result = oldValue;
break;
case "1":
zdysql = zdysql.replaceAll("\\{\\?}",oldValue);
if(rs.executeQuery(zdysql)){
if(rs.next()){
result = Util.null2String(rs.getString(1));
}else{
logger.error("zdysql execute but find nothing;sql:" + zdysql);
}
}else{
logger.error("zdysql execute error;sql:" + zdysql);
}
break;
case "2":
result = zdysql;
break;
default:
break;
}
}catch(Exception e){
logger.error("TjwJsonToWorkflowByConfigUtil.getValueByConfig exception;configMap:" + configMap + ";jsonData:" + jsonData + ";message:" + e.getMessage() + ";e:" + e);
}
return result;
}
public static void dealWorkflowRequestInfoByConfigId(String configId, WorkflowRequestInfo info,JSONObject jsonData){
try{
logger.info("dealWorkflowRequestInfoByConfigId begin;configId:" + configId + ";jsonData:" + jsonData.toJSONString());
RecordSet rs = new RecordSet();
String getConfigDataSql =
"select " +
"t1.lclx," +
"t2.bdzd," +
"t2.zdgz," +
"t2.jsonbwzdlj," +
"t2.zhgz," +
"t2.zdysql," +
"wb.fieldName," +
"wb.viewType," +
"wb.detailtable " +
"from " +
"uf_jsonzlcbdsj t1 " +
"inner join uf_jsonzlcbdsj_dt1 t2 on t2.mainid = t1.id " +
"inner join workflow_billField wb on t2.bdzd = wb.id " +
"where " +
"t1.id = ?";
List<Map<String, String>> configData = DaoUtil.getData(rs, getConfigDataSql, configId);
//主表字段数量
int mainTableFieldCount = 0;
//主表字段配置信息
List<Map<String, String>> mainFieldConfigInfoList = new ArrayList<>();
//明细表字段配置信息
Map<String,List<Map<String, String>>> detailFieldConfigInfo = new HashMap<>();
for(Map<String, String> m : configData){
String zdgz = m.get("zdgz");
if("".equals(zdgz) || "0".equals(zdgz)){
mainTableFieldCount = mainTableFieldCount + 1;
mainFieldConfigInfoList.add(m);
}else{
List<Map<String, String>> detailFieldConfigInfoList = detailFieldConfigInfo.get(zdgz);
if(detailFieldConfigInfoList == null){
detailFieldConfigInfoList = new ArrayList<>();
detailFieldConfigInfoList.add(m);
detailFieldConfigInfo.put(zdgz,detailFieldConfigInfoList);
}else{
detailFieldConfigInfoList.add(m);
}
}
}
////////////处理主表字段
WorkflowRequestTableField[] wrti = new WorkflowRequestTableField[mainTableFieldCount];
for(int i = 0; i < mainTableFieldCount; i ++){
String fieldName = mainFieldConfigInfoList.get(i).get("fieldName");
String value = getValueByConfig(mainFieldConfigInfoList.get(i),jsonData,rs);
wrti[i]=new WorkflowRequestTableField();
wrti[i].setFieldName(fieldName);
wrti[i].setFieldValue(value);
wrti[i].setEdit(true);//是否能编辑
wrti[i].setView(true);//是否可以查看
wrti[i].setMand(false);//是否必填
}
WorkflowRequestTableRecord[] tablre = new WorkflowRequestTableRecord[1]; //主字段只有一行数据
tablre[0]=new WorkflowRequestTableRecord();
tablre[0].setWorkflowRequestTableFields(wrti);
WorkflowMainTableInfo maininfo=new WorkflowMainTableInfo();
maininfo.setRequestRecords(tablre);
info.setWorkflowMainTableInfo(maininfo);
/////////////处理明细表字段
WorkflowDetailTableInfo[] WorkflowDetailTableInfo = new WorkflowDetailTableInfo[detailFieldConfigInfo.size()];
for(int i = 0;i<detailFieldConfigInfo.size();i++){
List<Map<String, String>> detailFieldConfigInfoList = detailFieldConfigInfo.get(i);
//根据path查询有多少行明细
String path = detailFieldConfigInfoList.get(0).get("jsonbwzdlj");
path = path.substring(0,path.lastIndexOf("/"));
JSONArray array = CommonUtil.getJsonArrayByPath(jsonData,path);
if(array == null || array.size() == 0){
continue;
}
WorkflowRequestTableRecord[] tablre1 = new WorkflowRequestTableRecord[array.size()];
for(int j = 0;j< array.size();j++){
wrti = new WorkflowRequestTableField[detailFieldConfigInfoList.size()];
for(int k = 0;j<detailFieldConfigInfoList.size();j++){
String fieldName = detailFieldConfigInfoList.get(i).get("fieldName");
String value = getValueByConfig(detailFieldConfigInfoList.get(i),jsonData,rs);
wrti[k] = new WorkflowRequestTableField();
wrti[k].setFieldName(fieldName);
wrti[k].setFieldValue(value);
wrti[k].setView(true);
wrti[k].setEdit(true);
}
tablre1[j] = new WorkflowRequestTableRecord();
tablre1[j].setWorkflowRequestTableFields(wrti);
}
WorkflowDetailTableInfo[i] = new WorkflowDetailTableInfo();
WorkflowDetailTableInfo[i].setWorkflowRequestTableRecords(tablre1);
}
info.setWorkflowDetailTableInfos(WorkflowDetailTableInfo);
logger.info("dealWorkflowRequestInfoByConfigId done");
}catch(Exception e){
logger.error("dealWorkflowRequestInfoByConfigId exception;message:" + e.getMessage() + ";e:" + e);
}
}
}

View File

@ -0,0 +1,194 @@
package com.api.taojw.common;
import com.alibaba.fastjson.JSONObject;
import com.api.taojw.common.logging.MyLogger;
import com.engine.common.util.ServiceUtil;
import com.engine.cube.service.ModeAppService;
import com.engine.cube.service.impl.ModeAppServiceImpl;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.formmode.data.ModeDataIdUpdate;
import weaver.formmode.setup.ModeRightInfo;
import weaver.general.TimeUtil;
import weaver.hrm.User;
import javax.jms.Session;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class TjwModelUtil {
static Logger logger = MyLogger.getLogger();
public static ModeDataIdUpdate mdu = ModeDataIdUpdate.getInstance();
public static ModeRightInfo MODE_RIGHT_INFO = new ModeRightInfo();
public static ModeAppService modeAppService = ServiceUtil.getService(ModeAppServiceImpl .class, new User(1));
public static void rebuildRight(String modeId){
Map<String,Object> param = new HashMap<>();
param.put("rebulidFlag","1");
param.put("righttype","1");
param.put("modeid",modeId);
param.put("rebulidFlag","1");
param.put("showProgress","0");
param.put("operation","resetAllRight");
param.put("session",new TjwHttpSession());
modeAppService.saveModeRightList(param,new User(1));
}
/**
*
* @param rs
* @param tableName
* @param dataInfo
* @return
*/
public static int addModelData(RecordSet rs,String tableName, JSONObject dataInfo){
try{
logger.info("dataInfo:" + dataInfo.toJSONString());
String currentDate = TimeUtil.getCurrentDateString();
String currentTime = TimeUtil.getOnlyCurrentTimeString();
int modelId = CommonSqlUtil.getModeIdByTableName(tableName,rs);
int newDataId = mdu.getModeDataNewId(tableName, modelId, 1, 0, currentDate, currentTime);
//拼接字段名称
String setString = "";
Object[] data = new Object[dataInfo.size()+1];
int index = 0;
for(Object key : dataInfo.keySet()){
setString = setString + key + " = ? ,";
data[index] = dataInfo.get(key);
index++;
}
data[index] = newDataId;
setString = setString.substring(0,setString.length() - 1);
String updateDataSql =
"update " + tableName + " set " + setString + " where id = ?";
DaoUtil.updateData(rs,updateDataSql,data);
//权限重构
MODE_RIGHT_INFO.rebuildModeDataShareByEdit(1, modelId,newDataId);
return newDataId;
}catch(Exception e){
logger.error("TjwModelUtil addModelData;tableName:" + tableName + ";dataInfo:" + dataInfo.toJSONString() + ";messahe:" + e.getMessage() + ";e:" + e);
return -1;
}
}
/**
*
*/
public static int addOrUpdateModelData(RecordSet rs, String tableName, JSONObject dataInfo, List<String> keyList){
try{
//根据dataKey判断数据是否存在有则更新 无则新增
String idWhere = " 1 = 1 ";
Object[] keyData = new Object[keyList.size()];
for(int i = 0;i < keyList.size(); i++){
keyData[i] = dataInfo.get(keyList.get(i));
}
for(String key:keyList){
idWhere = idWhere + " and " + key + " = ?";
}
String getDataSql = "select id from " + tableName + " where " + idWhere;
Map<String, String> firstData = DaoUtil.getFirstData(rs, getDataSql, keyData);
String id = firstData.get("id");
if("".equals(id) || id == null){
String currentDate = TimeUtil.getCurrentDateString();
String currentTime = TimeUtil.getOnlyCurrentTimeString();
int modelId = CommonSqlUtil.getModeIdByTableName(tableName,rs);
int newDataId = mdu.getModeDataNewId(tableName, modelId, 1, 0, currentDate, currentTime);
//拼接字段名称
String setString = "";
Object[] data = new Object[dataInfo.size()+1];
int index = 0;
for(Object key : dataInfo.keySet()){
setString = setString + key + " = ? ,";
data[index] = dataInfo.get(key);
index++;
}
data[index] = newDataId;
setString = setString.substring(0,setString.length() - 1);
String updateDataSql =
"update " + tableName + " set " + setString + " where id = ?";
DaoUtil.updateData(rs,updateDataSql,data);
//权限重构
MODE_RIGHT_INFO.rebuildModeDataShareByEdit(1, modelId,newDataId);
return newDataId;
}else{
//拼接字段名称
String setString = "";
Object[] data = new Object[dataInfo.size()+1];
int index = 0;
for(Object key : dataInfo.keySet()){
setString = setString + key + " = ? ,";
data[index] = dataInfo.get(key);
index++;
}
data[index] = id;
setString = setString.substring(0,setString.length() - 1);
String updateDataSql =
"update " + tableName + " set " + setString + " where id = ?";
DaoUtil.updateData(rs,updateDataSql,data);
return Integer.parseInt(id);
}
}catch(Exception e){
logger.error("TjwModelUtil addOrUpdateModelData;tableName:" + tableName + ";dataInfo:" + dataInfo + ";messahe:" + e.getMessage() + ";e:" + e);
return -1;
}
}
/**
*
*/
public static int addOrUpdateModelData(RecordSet rs, String tableName, JSONObject dataInfo,String dataKey){
try{
//根据dataKey判断数据是否存在有则更新 无则新增
String getDataSql = "select id from " + tableName + " where " + dataKey + " = ?";
Map<String, String> firstData = DaoUtil.getFirstData(rs, getDataSql, dataInfo.get(dataKey));
String id = firstData.get("id");
if("".equals(id) || id == null){
String currentDate = TimeUtil.getCurrentDateString();
String currentTime = TimeUtil.getOnlyCurrentTimeString();
int modelId = CommonSqlUtil.getModeIdByTableName(tableName,rs);
int newDataId = mdu.getModeDataNewId(tableName, modelId, 1, 0, currentDate, currentTime);
//拼接字段名称
String setString = "";
Object[] data = new Object[dataInfo.size()+1];
int index = 0;
for(Object key : dataInfo.keySet()){
setString = setString + key + " = ? ,";
data[index] = dataInfo.get(key);
index++;
}
data[index] = newDataId;
setString = setString.substring(0,setString.length() - 1);
String updateDataSql =
"update " + tableName + " set " + setString + " where id = ?";
DaoUtil.updateData(rs,updateDataSql,data);
//权限重构
MODE_RIGHT_INFO.rebuildModeDataShareByEdit(1, modelId,newDataId);
return newDataId;
}else{
//拼接字段名称
String setString = "";
Object[] data = new Object[dataInfo.size()+1];
int index = 0;
for(Object key : dataInfo.keySet()){
setString = setString + key + " = ? ,";
data[index] = dataInfo.get(key);
index++;
}
data[index] = id;
setString = setString.substring(0,setString.length() - 1);
String updateDataSql =
"update " + tableName + " set " + setString + " where id = ?";
DaoUtil.updateData(rs,updateDataSql,data);
return Integer.parseInt(id);
}
}catch(Exception e){
logger.error("TjwModelUtil addOrUpdateModelData;tableName:" + tableName + ";dataInfo:" + dataInfo + ";messahe:" + e.getMessage() + ";e:" + e);
return -1;
}
}
}

View File

@ -0,0 +1,52 @@
package com.api.taojw.common;
import com.alibaba.fastjson.JSONObject;
import com.api.taojw.common.logging.MyLogger;
import com.engine.hrm.cmd.permissiontoadjust.ProcessDataCmd;
import org.apache.log4j.Logger;
import weaver.hrm.User;
import javax.servlet.ServletContext;
import javax.servlet.http.*;
import java.util.*;
public class TjwRightMoveUtil {
static Logger logger = MyLogger.getLogger();
public static JSONObject moveRight(JSONObject param){
try{
logger.info("TjwRightMoveUtil.moveRight begin;param:" + param.toJSONString());
Map<String, Object> params = new HashMap<>();
for(Object key : param.keySet()){
params.put(key.toString(),param.get(key));
}
HttpServletRequest request = new TjwHttpServletRequest(){
@Override
public String getParameter(String s) {
return param.getString(s);
}
@Override
public HttpSession getSession(boolean b) {
HttpSession session = new TjwHttpSession(){
@Override
public Object getAttribute(String s) {
return new User(1);
}
};
return session;
}
};
ProcessDataCmd cmd = new ProcessDataCmd(params,request,new User(1));
Map<String, Object> execute = cmd.execute(null);
logger.info("moveRight.result:" + execute.toString());
return null;
}catch (Throwable e){
logger.error("TjwRightMoveUtil.moveRight error;message:" + e.getMessage() + ";e:" + e);
return null;
}
}
}

View File

@ -0,0 +1,52 @@
package com.api.taojw.common;
import com.api.taojw.common.logging.MyLogger;
import org.apache.log4j.Logger;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class TjwTimeUtil {
static Logger logger = MyLogger.getLogger();
static SimpleDateFormat sdfDateAndTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public static String getLastDay(){
//获取今天的日期
Date today = new Date();
Calendar c = Calendar.getInstance();
c.setTime(today);
c.add(Calendar.DAY_OF_MONTH, -1);
//这是昨天
Date yesterday = c.getTime();
String lastDay = new SimpleDateFormat("yyyy-MM-dd").format(yesterday);
return lastDay;
}
/**
*
* @param format
* @param time
* @return
*/
public static String getFormatTimeByTimeMillis(String format, long time){
try{
String result = "";
Date date= new Date(time);
switch (format){
case "yyyy-MM-dd HH:mm:ss":
result = sdfDateAndTime.format(date);
break;
default:
break;
}
return result;
}catch(Exception e){
logger.error("CommonUtil.getFormatTimeByTimeMillis execute error;exception:" + e.getMessage() + ";e:" + e);
return "";
}
}
}

View File

@ -0,0 +1,176 @@
package com.api.taojw.common;
import com.api.taojw.common.logging.MyLogger;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.formmode.interfaces.action.WorkflowToMode;
import weaver.hrm.User;
import weaver.soa.workflow.request.RequestInfo;
import weaver.soa.workflow.request.RequestService;
import weaver.workflow.request.RequestManager;
import weaver.workflow.webservices.*;
import java.lang.reflect.Field;
import java.util.List;
import java.util.Map;
public class TjwWorkFlowUtil {
static Logger logger = MyLogger.getLogger();
public static String createWorkFlow(String requestName, String creator, String workFlowId, String isNextFlow, Map<String,String> mainTableData, List<List<Map<String,String>>> detailTableData){
try{
logger.info("TjwWorkFlowUtil.createWorkFlow begin;requestName:" + requestName);
WorkflowService service = new WorkflowServiceImpl();
WorkflowRequestInfo info = new WorkflowRequestInfo();
info.setRequestName(requestName);
//创建人
info.setCreatorId(creator);
//0正常1重要2紧急
info.setRequestLevel("0");
WorkflowBaseInfo base = new WorkflowBaseInfo();
//流程id
RecordSet rs = new RecordSet();
base.setWorkflowId(workFlowId);
info.setWorkflowBaseInfo(base);
//流转到下一个节点
info.setIsnextflow(isNextFlow);
WorkflowRequestTableField[] wrti = new WorkflowRequestTableField[mainTableData.size()];
int i = 0;
for(String key : mainTableData.keySet()){
wrti[i]=new WorkflowRequestTableField();
wrti[i].setFieldName(key);
wrti[i].setFieldValue(mainTableData.get(key));
wrti[i].setEdit(true);//是否能编辑
wrti[i].setView(true);//是否可以查看
wrti[i].setMand(true);//是否必填
i = i + 1;
}
WorkflowRequestTableRecord[] tablre = new WorkflowRequestTableRecord[1]; //主字段只有一行数据
tablre[0]=new WorkflowRequestTableRecord();
tablre[0].setWorkflowRequestTableFields(wrti);
WorkflowMainTableInfo mainInfo=new WorkflowMainTableInfo();
mainInfo.setRequestRecords(tablre);
//添加主字段数据
info.setWorkflowMainTableInfo(mainInfo);
//添加到明细表中
if(detailTableData != null && detailTableData.size() > 0){
WorkflowDetailTableInfo WorkflowDetailTableInfo[] = new WorkflowDetailTableInfo[detailTableData.size()];
for(int j = 0; j<detailTableData.size(); j++){
List<Map<String,String>> tableData = detailTableData.get(j);
if(tableData != null && tableData.size() > 0){
WorkflowRequestTableRecord[] detailTablre = new WorkflowRequestTableRecord[tableData.size()];
for(int m = 0;m < tableData.size();m ++){
Map<String,String> datas = tableData.get(m);
WorkflowRequestTableField[] d = new WorkflowRequestTableField[datas.size()];
int n = 0;
for(String key : datas.keySet()){
d[n] = new WorkflowRequestTableField();
d[n].setFieldName(key);
d[n].setFieldValue(datas.get(key));
d[n].setView(true);//字段是否可见
d[n].setEdit(true);//字段是否可编辑
}
detailTablre[n] = new WorkflowRequestTableRecord();
detailTablre[n].setWorkflowRequestTableFields(d);
}
WorkflowDetailTableInfo[j] = new WorkflowDetailTableInfo();
WorkflowDetailTableInfo[j].setWorkflowRequestTableRecords(detailTablre);
}
}
info.setWorkflowDetailTableInfos(WorkflowDetailTableInfo);//添加明细数据
}
//发起流程
String returnMsg = service.doCreateWorkflowRequest(info, Integer.parseInt(creator));
logger.info("TjwWorkFlowUtil.createWorkFlow end;returnMsg:" + returnMsg);
return returnMsg;
}catch (Throwable e){
logger.error("TjwWorkFlowUtil.createWorkFlow error;requestName:" + requestName);
return "";
}
}
/**
*
* @param requestId
* @param userId
*/
public static boolean submitWorkFlow(int requestId,int userId){
try{
WorkflowService service = new WorkflowServiceImpl();
String message = service.submitWorkflowRequest(null, requestId, userId,"submit","");
if("success".equals(message)){
return true;
}else{
logger.error("TjwWorkFlowUtil.submitWorkFlow false;requestId:" + requestId + ";userId:" + userId + ";message:" + message);
return false;
}
}catch (Exception e){
logger.error("TjwWorkFlowUtil.submitWorkFlow exception;requestId:" + requestId + ";userId:" + userId + ";message:" + e.getMessage() + ";e:" + e);
return false;
}
}
/**
*
* @param requestId id
* @param configId id
* @param rs
* @return 1-
*/
public static String doWorkFlowToMode(int requestId,int configId,RecordSet rs){
try{
if(rs == null){
rs = new RecordSet();
}
//获取流程转数据的配置信息
String getWorkFlowToModeSetInfoSql = "select triggernodeid,actionid from mode_workflowtomodeset where id = ?";
Map<String,String> configInfo = DaoUtil.getFirstData(rs,getWorkFlowToModeSetInfoSql,configId);
int nodeId = Integer.parseInt(configInfo.get("triggernodeid"));
int actionId = Integer.parseInt(configInfo.get("actionid"));
//获取流程基本信息
String getRequestBaseInfoSql = "select t1.workflowid,t2.formid,t1.creater,t1.requestname from workflow_requestbase t1 inner join workflow_base t2 on t2.id = t1.workflowid where t1.requestid = ?";
Map<String,String> requestBaseInfo = DaoUtil.getFirstData(rs,getRequestBaseInfoSql,requestId);
int workFlowId = Integer.parseInt(requestBaseInfo.get("workflowid"));
int formId = Integer.parseInt(requestBaseInfo.get("formid"));
int creater = Integer.parseInt(requestBaseInfo.get("creater"));
User user = new User(creater);
String requestName = requestBaseInfo.get("requestname");
//构造请求参数
RequestService x = new RequestService();
RequestInfo requestInfo = x.getRequest(requestId);
//只记录日志 triggerType
requestInfo.setIspreadd("0");
RequestManager requestManager = new RequestManager();
requestManager.setNodeid(nodeId);
//只记录日志
requestManager.setNextNodeid(0);
requestManager.setWorkflowid(workFlowId);
requestManager.setFormid(formId);
requestManager.setRequestid(requestId);
requestManager.setCreater(creater);
//用于区分流程类型
requestManager.setIsbill(1);
requestManager.setUser(user);
requestManager.setRequestname(requestName);
requestInfo.setRequestManager(requestManager);
WorkflowToMode wtm = new WorkflowToMode();
Class classType = WorkflowToMode.class;
Field field = classType.getDeclaredField("actionid");
field.setAccessible(true);
field.set(wtm, actionId);
String result = wtm.execute(requestInfo);
logger.info("doWorkFlowToMode done;requestId:" + requestId + ";configId:" + configId + ";result:" + result);
return result;
}catch(Exception e){
logger.error("doWorkFlowToMode exception;requestId:" + requestId + ";configId:" + configId + ";messahe:" + e.getMessage() + ";e:" + e);
return "error";
}
}
}

View File

@ -0,0 +1,404 @@
package com.api.taojw.common;
import com.api.taojw.common.logging.MyLogger;
import org.apache.log4j.Logger;
import weaver.conn.ConnStatementDataSource;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.GCONST;
import weaver.general.TimeUtil;
import weaver.general.Util;
import java.io.*;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
/**
* -
* @author bleach
* @date 2018-01-18
* @version 2.0 Modify By Weilin.Zhu 2018-12-05
* @version 3.0 Modify By Weilin.Zhu 使log4j 2020-03-10
* @version 4.0 Modify By Weilin.Zhu 2021-06-29
*/
public class ToolUtil extends BaseBean {
Logger logger = MyLogger.getLogger();
private RecordSet rs = new RecordSet();
/**
*
*/
public ToolUtil() {
//logger = LoggerFactory.getLogger("cus");
}
/**
* ID
* @param workflowid ID
* @return
*/
public String getBillTableNameByWorkflowId(String workflowid){
String tablename = "";
if(!"".equals(workflowid)){
String select_data = "select tablename from workflow_bill where id in (select formid from workflow_base where id = ?)";
if(rs.executeQuery(select_data, workflowid)){
if(rs.next()){
tablename = Util.null2String(rs.getString(1));
}
}
}
return tablename;
}
/**
*
* @param likestr
* @return
*/
public Map<String,String> getSystemParamValueMap(String likestr){
return getSystemParamList(likestr);
}
/**
*
* @return
*/
public Map<String,String> getAllSystemParamValue(){
return getSystemParamList("");
}
/**
*
* @param likestr
* @return
*/
private Map<String,String> getSystemParamList(String likestr){
Map<String,String> param_map = new HashMap<String, String>();
String select_sql = "select uuid,paramvalue from uf_systemconfig";
RecordSet rs = new RecordSet();
if(!"".equals(likestr)){
select_sql += " where uuid like '%" + likestr + "%'";
}
if(rs.execute(select_sql)){
while(rs.next()){
String uuid = Util.null2String(rs.getString(1));
String paramvalue = Util.null2String(rs.getString(2));
param_map.put(uuid, paramvalue);
}
}
return param_map;
}
/**
*
* @param uuid
* @return
*/
public static String getSystemParamValue(String uuid){
String paramvalue = "";
if(!"".equals(uuid)){
String select_sql = "select paramvalue from uf_systemconfig where uuid = ?";
RecordSet rs = new RecordSet();
rs.executeQuery(select_sql,uuid);
if(rs.next()){
paramvalue = Util.null2String(rs.getString(1));
}
}
return paramvalue;
}
/**
*
* @param cus_sql SQL
* @param value
* @return
*/
public String getValueByChangeRule(String userId,String cus_sql,String value){
return getValueByChangeRule(userId,cus_sql,value,"");
}
/**
*
* @param cus_sql SQL
* @param value
* @param requestid ID
* @return
*/
public String getValueByChangeRule(String userId,String cus_sql,String value,String requestid){
return getValueByChangeRule(userId,cus_sql,value,requestid,0);
}
/**
*
* @param cus_sql SQL
* @param value
* @param requestid ID
* @param detailKeyvalue
* @return
*/
public String getValueByChangeRule(String userId,String cus_sql,String value,String requestid,int detailKeyvalue){
return getValueByChangeRule(userId,cus_sql,value,requestid,detailKeyvalue,null);
}
/**
*
* @param cus_sql SQL
* @param value
* @param requestid ID
* @param detailKeyvalue
* @pram datasourceid ID
* @return
*/
public String getValueByChangeRule(String userId,String cus_sql,String value,String requestid,int detailKeyvalue,String datasourceid){
String endValue = "";
cus_sql = ToDBC(cus_sql);
cus_sql = cus_sql.replace("&nbsp;", " ");
cus_sql = cus_sql.replace("{?dt.id}", String.valueOf(detailKeyvalue));
cus_sql = cus_sql.replace("{?currentUserId}", String.valueOf(userId));
//参数进行替换
String sqlString = cus_sql.replace("{?requestid}", requestid);
sqlString = sqlString.replace("?", value);
try {
if(datasourceid != null && !"".equals(datasourceid)){
ConnStatementDataSource csds = new ConnStatementDataSource(datasourceid);
csds.setStatementSql(sqlString);
csds.executeQuery();
if(csds.next()){
endValue = Util.null2String(csds.getString(1));
}
csds.close();
}else{
RecordSet rs = new RecordSet();
if(rs.executeQuery(sqlString)){
rs.next();
endValue = Util.null2String(rs.getString(1));
}
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return endValue;
}
/**
*
* @param cus_sql SQL
* @param value
* @return
*/
public String getValueByChangeRule_SingleParam(String cus_sql,String value){
String endValue = "";
cus_sql = cus_sql.replace("&nbsp;", " ");
RecordSet rs = new RecordSet();
if(rs.executeQuery(cus_sql,value)){
rs.next();
endValue = Util.null2String(rs.getString(1));
}
return endValue;
}
/**
*
* @param input
* @return
*/
public static String ToDBC(String input) {
char c[] = input.toCharArray();
for (int i = 0; i < c.length; i++) {
if (c[i] == '\u3000') {
c[i] = ' ';
} else if (c[i] > '\uFF00' && c[i] < '\uFF5F') {
c[i] = (char) (c[i] - 65248);
}
}
String returnString = new String(c);
return returnString;
}
/**
* ID
* @param fieldid
* @return
*/
public String getFieldNameByFieldid(int fieldid){
if(fieldid > 0){
return getFieldNameByFieldid(String.valueOf(fieldid));
}else{
return "";
}
}
/**
* ID
* @param fieldid
* @return
*/
public String getFieldNameByFieldid(String fieldid){
String fieldname = "";
if(!"".equals(fieldid)){
if(fieldid.startsWith(",")){
fieldid = fieldid.substring(1);
}
if(fieldid.endsWith(",")){
fieldid =fieldid.substring(0,fieldid.length() - 1);
}
String select_sql = "select fieldname from workflow_billfield where id in (" + fieldid + ")";
RecordSet rs = new RecordSet();
if(rs.execute(select_sql)){
while(rs.next()){
fieldname += "," + Util.null2String(rs.getString(1));
}
}
}
if(fieldname.startsWith(",")){
fieldname = fieldname.substring(1);
}
return fieldname;
}
/**
*
* @param className
* @param logstr
*/
public void writeDebuggerLog(String className,String logstr){
logger.info(logstr);
}
/**
*
* @param className
* @param logstr
*/
public void writeWarningLog(String className,String logstr){
logger.warn(logstr);
}
/**
*
* @param className
* @param logstr
*/
public void writeErrorLog(String className,String logstr){
logger.error(logstr);
}
/**
*
* @param logstr
*/
public void writeDebugLog(Object logstr){
logger.info(logstr);
}
/**
*
* @param logstr
*/
public void writeErrorLog(Object logstr){
logger.error(logstr);
}
/**
*
* @param logstr
*/
public void writeNewDebuggerLog(Object o,Object logstr){
logger.info(logstr);
}
/**
*
* @param o
* @param s
* @deprecated
*/
protected void writeNewLog(String o,String s){
try {
String filename = "cus_" + TimeUtil.getCurrentDateString() + "_ecology.log";
String folder = GCONST.getRootPath() + "log" + File.separatorChar + "cus";
//this.writeDebugLog("folder:[" + folder + "]");
File f = new File(folder);
// 创建文件夹
if (!f.exists()) {
f.mkdirs();
}
f = new File(folder + File.separatorChar + filename);
//文件不存在,则直接创建
if(!f.exists()){
f.createNewFile();
}
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(f, true)));
out.write("[" + o + "][" + TimeUtil.getCurrentTimeString() + "]:"+ s + "\r\n");
//关闭写入流
out.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
writeDebugLog("创建日志文件存在异常:[" + e.getMessage() + "/" + e.toString() + "]");
}
}
}

View File

@ -0,0 +1,67 @@
package com.api.taojw.common;
import com.api.taojw.common.logging.MyLogger;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.common.BitMatrix;
import org.apache.log4j.Logger;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class TwoDimensionalCodeUtil {
private static final int BLACK = 0xFF000000;
private static final int WHITE = 0xFFFFFFFF;
static Logger logger = MyLogger.getLogger();
/**
*
* @param content eg:https://www.baidu.com
* @param path eg:F:/
* @param codeName eg:UUID.randomUUID().toString()
* @param imageType eg:jpg
*/
public static void getImage(String content,String path,String codeName,String imageType) {
try {
MultiFormatWriter multiFormatWriter = new MultiFormatWriter();
Map<EncodeHintType, String> hints = new HashMap<>();
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
BitMatrix bitMatrix = multiFormatWriter.encode(content, BarcodeFormat.QR_CODE, 400, 400, hints);
File file = new File(path, codeName + "." + imageType);
writeToFile(bitMatrix, imageType, file);
} catch (Exception e) {
logger.error("TwoDimensionalCodeUtil.getImage exception;content:" + content + "message:" + e.getMessage() + ";e:" + e);
}
}
public static void writeToFile(BitMatrix matrix, String format, File file) throws IOException {
BufferedImage image = toBufferedImage(matrix);
if (!ImageIO.write(image, format, file)) {
throw new IOException("Could not write an image of format " + format + " to " + file);
}
}
public static BufferedImage toBufferedImage(BitMatrix matrix) {
int width = matrix.getWidth();
int height = matrix.getHeight();
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
image.setRGB(x, y, matrix.get(x, y) ? BLACK : WHITE);
}
}
return image;
}
}

View File

@ -0,0 +1,434 @@
package com.api.taojw.common;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.api.taojw.common.logging.MyLogger;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.conn.RecordSetTrans;
import weaver.general.Util;
import java.text.SimpleDateFormat;
import java.util.*;
public class WorkFlowDataToJsonUtil {
static Logger logger = MyLogger.getLogger();
public static String[] getRequestBaseInfo(String requestId,RecordSetTrans rsts,String requestMark,String billTableName){
//--------------------------------------基于文件发起签署
//流程基础数据数组[流程请求ID\流程标题\签字意见\表单名称\主表主键值]
String[] base_array = new String[5];
//获取请求中的数据库链接
try {
if(rsts == null){
rsts = new RecordSetTrans();
}
String select_base_sql = "select * from workflow_requestBase where requestId = ?";
String requestName = "";
if(rsts.executeQuery(select_base_sql,requestId)){
while(rsts.next()){
requestName = Util.null2String(rsts.getString("requestName"));
}
}
base_array[0] = requestId;
base_array[1] = requestName;
base_array[2] = requestMark;
base_array[3] = billTableName;
String getBaseInfoSql = "select id from " + billTableName + " where requestid = ?";
Map<String, String> firstData = DaoUtil.getFirstData(new RecordSet(), getBaseInfoSql, requestId);
if(firstData.size() > 0){
base_array[4] = firstData.get("id");
}
return base_array;
} catch (Throwable e) {
logger.error("WorkFlowDataToJsonUtil getRequestBaseInfo error;requestId:" + requestId + "exception:" + e.getMessage() + ";e:" + e);
return null;
}
}
/**
*
*/
public static String convertDataByZhgz(String oldValue,Map<String,String> configMap){
//函数返回值
String result = "";
try{
//转换规则
String zhgz = configMap.get("zhgz");
//自定义sql
String zdysql = configMap.get("zdysql");
String requestId = Util.null2String(configMap.get("requestId"));
//不同转换规则处理
switch(zhgz){
//不转换
case "0":
result = oldValue;
break;
//固定值
case "1":
result = zdysql;
break;
//自定义sql
case "2":
zdysql = zdysql.replaceAll("\\{\\?}",oldValue);
zdysql = zdysql.replaceAll("\\{\\?requestId}",requestId);
Map<String, String> firstData = DaoUtil.getFirstData(zdysql);
for(String key : firstData.keySet()){
result = firstData.get(key);
}
break;
//日期格式化
case "3":
result = new SimpleDateFormat(zdysql).format(new SimpleDateFormat("yyyy-MM-dd").parse(oldValue));
break;
//日期时间格式化
case "4":
result = new SimpleDateFormat(zdysql).format(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(oldValue));
break;
//当前日期
case "5":
result = new SimpleDateFormat(zdysql).format(new Date());
break;
default:
result = "";
break;
}
return result;
}catch(Exception e){
result = "";
logger.error("DealWorkFlowDataToRequestUtil.convertDataByZhgz error;configMap:" + configMap + ";info:" + e.getMessage() + ";e:" + e);
}
return result;
}
public static JSONObject getJsonByWorkFlowData(String requestId,String configId,String[] base_array){
JSONObject result = new JSONObject();
try{
logger.info("WorkFlowDataToJsonUtil.getJsonByWorkFlowData begin;requestId:" + requestId + ";configId:" + configId);
RecordSet rs = new RecordSet();
//-----------------------根据配置id获取配置信息
//根节点配置信息
List<Map<String,String>> rootJsonConfigInfo = new ArrayList<>();
//明细配置信息
List<Map<String,String>> requestBodyConfigList = new ArrayList<>();
getConfigInfo(rs,configId,requestBodyConfigList,rootJsonConfigInfo);
//-----------------------获取主表数据 用于拼装json
Map<String,String> mainTableData = new HashMap<>();
String getMainTableDataSql = "select * from " + base_array[3] + " where id = " + base_array[4];
if(rs.executeQuery(getMainTableDataSql)) {
if (rs.next()) {
mainTableData = DaoUtil.setRsToMap(rs);
}
}
//-----------------------生成json
logger.info("recursionGenerateJson begin;");
recursionGenerateJson(null,rs,rs,0,result,rootJsonConfigInfo,base_array,mainTableData,requestBodyConfigList);
}catch(Throwable e){
logger.error("WorkFlowDataToJsonUtil.getJsonByWorkFlowData exception;message:" + e.getMessage() + ";e:" + e);
}
return result;
}
/**
* configId
* @param rs
* @param configId id
* @param requestBodyConfigList
* @param rootJsonConfigInfo
*/
public static void getConfigInfo(RecordSet rs,String configId,List<Map<String,String>> requestBodyConfigList,List<Map<String,String>> rootJsonConfigInfo){
//获取明细表 请求体字段详细配置信息
String selectDetailSQL = "select dt.*,wb.fieldName,wb.viewType,wb.detailtable from uf_lcsjzjson_dt1 dt left join workflow_billField wb on dt.lcbdzd = wb.id where dt.mainId = ?";
if(rs.executeQuery(selectDetailSQL,configId)){
while(rs.next()){
//节点序号
String xmljdxh = Util.null2String(rs.getString("jdxh"));
//xml节点名称
String xmljdmc = Util.null2String(rs.getString("jdmc"));
//字段归属
String zdgz = Util.null2String(rs.getString("zdgz"));
//xml节点类型
String xmljdlx = Util.null2String(rs.getString("jdlx"));
//父节点序号
String fjdxh = Util.null2String(rs.getString("fjdxh"));
//流程表单字段
String lcbdzd = Util.null2String(rs.getString("lcbdzd"));
//流程表单字段类型
String viewType = Util.null2String(rs.getString("viewType"));
//流程表单字段
String fieldName = Util.null2String(rs.getString("fieldName"));
//字段所属明细表表名
String detailtable = Util.null2String(rs.getString("detailtable"));
//转换规则
String zhgz = Util.null2String(rs.getString("zhgz"));
//自定义sql
String zdysql = Util.null2String(rs.getString("zdysql"));
if(!"".equals(zdysql)){
zdysql = zdysql.replace(Constant.Default_Line_Break, Constant.Default_Blank_Char);
zdysql = zdysql.replace(Constant.Default_Html_Blank, Constant.Default_Blank_Char);
zdysql = CommonUtil.fullToHalfAngle(zdysql);
}
//数据条件
String sjtj = Util.null2String(rs.getString("sjtj"));
if(!"".equals(sjtj)){
sjtj = sjtj.replace(Constant.Default_Line_Break, Constant.Default_Blank_Char);
sjtj = sjtj.replace(Constant.Default_Html_Blank, Constant.Default_Blank_Char);
sjtj = CommonUtil.fullToHalfAngle(sjtj);
}
Map<String,String> dtMap = new HashMap<>();
dtMap.put("jdxh",xmljdxh);
dtMap.put("jdmc",xmljdmc);
dtMap.put("jdlx",xmljdlx);
dtMap.put("fjdxh",fjdxh);
dtMap.put("lcbdzd",lcbdzd);
dtMap.put("viewType",viewType);
dtMap.put("zhgz",zhgz);
dtMap.put("zdysql",zdysql);
dtMap.put("sjtj",sjtj);
dtMap.put("zdgz",zdgz);
dtMap.put("detailtable",detailtable);
dtMap.put("fieldName",fieldName.toLowerCase());
if("".equals(fjdxh)){
rootJsonConfigInfo.add(dtMap);
}
requestBodyConfigList.add(dtMap);
}
}else{
logger.error("WorkFlowDataToJsonUtil.getConfigInfo.selectDetailSQL sql execute error;sql:" + selectDetailSQL);
}
logger.info("WorkFlowDataToJsonUtil.getConfigInfo.selectDetailSQL done;requestBodyConfigList:" + requestBodyConfigList);
}
/**
* json
*/
public static Object recursionGenerateJson(Map<String,String> configMap,RecordSet rs,
RecordSet detailRs,int sequence,JSONObject jsonDoc,
List<Map<String,String>> rootJsonConfigInfo,
String[] baseArray,Map<String,String> mainTableData,
List<Map<String,String>> requestBodyConfigList){
if(configMap == null){
for(Map<String,String> configInfo:rootJsonConfigInfo){
jsonDoc.put(configInfo.get("jdmc"),recursionGenerateJson(configInfo,rs,detailRs,sequence,jsonDoc,rootJsonConfigInfo,baseArray,mainTableData,requestBodyConfigList));
}
}else{
switch(configMap.get("jdlx")){
case Constant.NODE_TYPE_STRING:
configMap.put("detailRowNum", String.valueOf(sequence));
return getFieldValue(configMap,rs,detailRs,baseArray,mainTableData);
case Constant.NODE_TYPE_BOOLEAN:
configMap.put("detailRowNum", String.valueOf(sequence));
return "true".equals(getFieldValue(configMap,rs,detailRs,baseArray,mainTableData));
case Constant.NODE_TYPE_NUMBER:
configMap.put("detailRowNum", String.valueOf(sequence));
int r = 0;
try{
r = Integer.parseInt(getFieldValue(configMap,rs,detailRs,baseArray,mainTableData));
}catch(Exception e){
logger.error("change data to int error;configMap:" + configMap + ";e:" + e);
}
return r;
case Constant.NODE_TYPE_FLOAT:
double d = 0;
try{
configMap.put("detailRowNum", String.valueOf(sequence));
String f = getFieldValue(configMap,rs,detailRs,baseArray,mainTableData);
d = Double.parseDouble(f);
}catch(Exception e){
logger.error("change data to float error;configMap:" + configMap + ";e:" + e);
}
return d;
case Constant.NODE_TYPE_OBJECT:
JSONObject json = new JSONObject();
for(Map<String,String> m : requestBodyConfigList) {
if (m.get("fjdxh").equals(configMap.get("jdxh"))) {
json.put(m.get("jdmc"),recursionGenerateJson(m,rs,detailRs,sequence,jsonDoc,rootJsonConfigInfo,baseArray,mainTableData,requestBodyConfigList));
}
}
return json;
case Constant.NODE_TYPE_JSONSTRING:
JSONObject jsonObj = new JSONObject();
for(Map<String,String> m : requestBodyConfigList) {
if (m.get("fjdxh").equals(configMap.get("jdxh"))) {
jsonObj.put(m.get("jdmc"),recursionGenerateJson(m,rs,detailRs,sequence,jsonDoc,rootJsonConfigInfo,baseArray,mainTableData,requestBodyConfigList));
}
}
return jsonObj.toString();
case Constant.NODE_TYPE_STRING_ARRAY:
String stringArrayValue = getFieldValue(configMap,rs,detailRs,baseArray,mainTableData);
JSONArray stringArray = new JSONArray();
stringArray.addAll(Arrays.asList(stringArrayValue.split(",")));
return stringArray;
case Constant.NODE_TYPE_ARRAY:
JSONArray array = new JSONArray();
if("".equals(configMap.get("zdgz")) && Constant.CHANGE_TYPE_FIXED.equals(configMap.get("zhgz"))){
for(Map<String,String> son : requestBodyConfigList) {
if (son.get("fjdxh").equals(configMap.get("jdxh"))) {
array.add(recursionGenerateJson(son,rs,detailRs,sequence,jsonDoc,rootJsonConfigInfo,baseArray,mainTableData,requestBodyConfigList));
}
}
return array;
}
if("".equals(configMap.get("zdgz"))){
JSONObject o = new JSONObject();
for(Map<String,String> son : requestBodyConfigList) {
if (son.get("fjdxh").equals(configMap.get("jdxh"))) {
o.put(son.get("jdmc"),recursionGenerateJson(son,rs,detailRs,sequence,jsonDoc,rootJsonConfigInfo,baseArray,mainTableData,requestBodyConfigList));
}
}
array.add(o);
return array;
}
//查询明细表数据
String getDetailDataSql = "select * from " + baseArray[3] + "_dt" + configMap.get("zdgz") + " where mainid = " + baseArray[4];
if(!"".equals(configMap.get("sjtj"))){
getDetailDataSql = getDetailDataSql + " " + configMap.get("sjtj");
}
RecordSet detailDataRs = new RecordSet();
if(detailDataRs.executeQuery(getDetailDataSql)){
sequence = 0;
while(detailDataRs.next()){
JSONObject o = new JSONObject();
sequence = sequence + 1;
for(Map<String,String> son : requestBodyConfigList) {
if (son.get("fjdxh").equals(configMap.get("jdxh"))) {
o.put(son.get("jdmc"),recursionGenerateJson(son,rs,detailDataRs,sequence,jsonDoc,rootJsonConfigInfo,baseArray,mainTableData,requestBodyConfigList));
}
}
array.add(o);
}
}
for(Map<String,String> son : requestBodyConfigList) {
if (son.get("fjdxh").equals(configMap.get("jdxh")) && Constant.NODE_TYPE_OBJECT.equals(son.get("jdlx"))) {
array.add(recursionGenerateJson(son,rs,detailRs,sequence,jsonDoc,rootJsonConfigInfo,baseArray,mainTableData,requestBodyConfigList));
}
}
return array;
default:
break;
}
}
return null;
}
/**
*
* @param configMap
* @param rs
* @param detailRs
*/
public static String getFieldValue(Map<String,String> configMap,RecordSet rs,RecordSet detailRs,String[] baseArray,Map<String,String> mainTableData){
//函数返回值
StringBuilder result = new StringBuilder();
try{
Map<String,String> detailDataMap = DaoUtil.setRsToMap(detailRs);
//字段类型 0-主表 1-明细表
String viewType = configMap.get("viewType");
//转换规则
String zhgz = configMap.get("zhgz");
//字段名称
String fieldName = configMap.get("fieldName");
//自定义sql
String zdysql = configMap.get("zdysql");
//数据条件
String sjtj = configMap.get("sjtj");
//字段所属明细表表名
String detailtable = configMap.get("detailtable");
//不同转换规则处理
switch(zhgz){
case Constant.CHANGE_TYPE_REQUEST_ID:
result = new StringBuilder(baseArray[0]);
break;
case Constant.CHANGE_TYPE_REQUEST_NAME:
result = new StringBuilder(baseArray[1]);
break;
case Constant.CHANGE_TYPE_MD5:
result = new StringBuilder("Basic " + Base64.getUrlEncoder().encodeToString(zdysql.getBytes()));
break;
case Constant.CHANGE_TYPE_SUGGESTION:
result = new StringBuilder(baseArray[2]);
break;
case Constant.CHANGE_TYPE_ROW_NUMBER:
result = new StringBuilder(configMap.get("detailRowNum"));
break;
case Constant.CHANGE_TYPE_FIXED:
result = new StringBuilder(configMap.get("zdysql"));
break;
case Constant.CHANGE_TYPE_NONE:
if("0".equals(viewType)){
result = new StringBuilder(mainTableData.get(fieldName));
}else{
result = new StringBuilder(detailDataMap.get(fieldName));
}
break;
case Constant.CHANGE_TYPE_SQL:
String oldValue;
if(!"".equals(viewType) && !"".equals(fieldName)){
if("0".equals(viewType)){
oldValue = mainTableData.get(fieldName);
}else{
oldValue = detailDataMap.get(fieldName);
}
zdysql = zdysql.replaceAll("\\{\\?}",oldValue);
}
zdysql = zdysql.replaceAll("\\{\\?requestId}",baseArray[0]);
if(rs.executeQuery(zdysql)){
if(rs.next()){
result = new StringBuilder(Util.null2String(rs.getString(1)));
}
}
break;
case Constant.CHANGE_TYPE_SUM:
if("0".equals(viewType)){
logger.error("want sum but config main field");
break;
}
String getSumSql = "select sum(" + fieldName + ") as val from " + detailtable + " where mainid = " + baseArray[4];
if(!"".equals(sjtj)){
getSumSql = getSumSql + " " + sjtj;
}
if(rs.executeQuery(getSumSql)){
if(rs.next()){
result = new StringBuilder(Util.null2String(rs.getString("val")));
}
}
break;
case Constant.CHANGE_TYPE_STRING_ARRAY:
if("0".equals(viewType)){
logger.error("want array but config main field");
break;
}
String getArraySql = "select " + fieldName + " as val from " + detailtable + " where mainid = " + baseArray[4];
if(!"".equals(sjtj)){
getArraySql = getArraySql + " " + sjtj;
}
if(rs.executeQuery(getArraySql)){
int i = 0;
while(rs.next()){
if(i == 0){
result = new StringBuilder(Util.null2String(rs.getString(1)));
}else{
result.append(",").append(Util.null2String(rs.getString(1)));
}
i = i + 1;
}
}
break;
default:
result = new StringBuilder();
break;
}
return result.toString();
}catch(Exception e){
result = new StringBuilder();
logger.error("DealWorkFlowDataToRequestUtil.getFieldValue error;configMap:" + configMap + ";info:" + e.getMessage() + ";e:" + e);
}
return result.toString();
}
}

View File

@ -0,0 +1,107 @@
package com.api.taojw.common.action;
import com.api.taojw.common.action.util.CallApiByWorkFlowDataUtil;
import com.api.taojw.common.logging.MyLogger;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.conn.RecordSetTrans;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import java.util.Map;
/**
* taojingwei @2022-05-26
* 1
* 2http
*/
public class RequestDataToApiAction implements Action {
//自定义参数值
private String cusParam = "";
Logger logger = MyLogger.getLogger();
/**
*
*
* @param requestInfo
* @return
*/
@Override
public String execute(RequestInfo requestInfo) {
//流程请求ID
String requestId = "";
try {
logger.info("----------------------" + this.getClass() + " action begin ----------------------");
//流程请求ID
requestId = requestInfo.getRequestid();
//流程类型ID
String workflowId = requestInfo.getWorkflowid();
//流程表单名称
String billTableName = requestInfo.getRequestManager().getBillTableName();
//流程基础数据数组[流程请求ID\流程标题\流程编号\表单名称\主表主键值]
String[] base_array = new String[5];
//获取请求中的数据库链接
RecordSetTrans rsts = requestInfo.getRsTrans();
try {
if(rsts == null){
rsts = new RecordSetTrans();
}
String select_base_sql = "select * from workflow_requestBase where requestId = ?";
String requestName = "";
String requestMark = "";
if(rsts.executeQuery(select_base_sql,requestId)){
while(rsts.next()){
requestName = Util.null2String(rsts.getString("requestName"));
requestMark = Util.null2String(rsts.getString("requestMark"));
}
}
base_array[0] = requestId;
base_array[1] = requestName;
base_array[2] = requestMark;
base_array[3] = billTableName;
logger.info("requestName:[" + requestName + "],requestMark:[" + requestMark + "],workflowId:["+workflowId+"],requestId:[" + requestId + "],billTableName:[" + billTableName + "],cusParam[" + cusParam + "]");
} catch (Exception e) {
requestInfo.getRequestManager().setMessageid("2022052791002");
requestInfo.getRequestManager().setMessagecontent("Action接口发生异常,requestId:"+ requestId +",请联系管理员!");
logger.error("VoucherAction.select * from workflow_requestBase error;requestId:" + requestId + "exception:" + e.getMessage() + ";e:" + e);
return Action.FAILURE_AND_CONTINUE;
}
//获取当前流程信息
String selectData = "select * from " + billTableName + " where requestId = ?";
RecordSet rs = new RecordSet();
if(rs.executeQuery(selectData,requestId)){
rs.next();
base_array[4] = Util.null2String(rs.getString("id"));
}
CallApiByWorkFlowDataUtil callApiByWorkFlowDataUtil = new CallApiByWorkFlowDataUtil();
callApiByWorkFlowDataUtil.setBaseArray(base_array);
callApiByWorkFlowDataUtil.setRsts(rsts);
Map<String, String> result = callApiByWorkFlowDataUtil.execute(workflowId, cusParam);
if("CALL_FAILED".equals(result.get("code"))){
requestInfo.getRequestManager().setMessageid("2022052791402");
requestInfo.getRequestManager().setMessagecontent("Action接口发生异常,requestId:"+ requestId +",接口响应:" + result.get("message"));
return Action.FAILURE_AND_CONTINUE;
}
return Action.SUCCESS;
}catch (Throwable e) {
requestInfo.getRequestManager().setMessageid(TimeUtil.getCurrentTimeString()+requestId);
requestInfo.getRequestManager().setMessagecontent("Action接口发生异常,requestId:"+ requestId +";" + "请联系管理员TJW!异常信息:" + e.getMessage());
logger.error("Action Exception;requestId:" + requestId + "exception:" + e.getMessage() + ";e:" + e);
return Action.FAILURE_AND_CONTINUE;
}
}
public String getCusParam() {
return cusParam;
}
public void setCusParam(String cusParam) {
this.cusParam = cusParam;
}
}

View File

@ -0,0 +1,107 @@
package com.api.taojw.common.action.constant;
/**
*
*/
public class Constant {
//action接口调用配置表名称
public static String CONFIG_TABLE_NAME = "uf_lcdyjkpzxxbd";
//action调用接口日志记录表表名
public static String LOG_TABLE_NAME = "uf_lcdyjkrzjlbd";
//action调用接口日志记录表requestId字段名称
public static String LOG_REQUESTID_COLUMN = "lcrequestid";
//action调用接口日志记录表请求正文字段名称
public static String LOG_REQUEST_COLUMN = "qqbw";
//action调用接口日志记录表响应文字段名称
public static String LOG_RESPONSE_COLUMN = "xybw";
//action调用接口日志记录表响应码字段名称
public static String LOG_RESPONSECODE_COLUMN = "xym";
//action调用接口日志记录表请求地址字段名称
public static String LOG_REQUESTURL_COLUMN = "qqdz";
//action调用接口日志记录表请求头字段名称
public static String LOG_REQUESTHEADER_COLUMN = "qqt";
//------------------------------------------------------------------------------自定义sql、接口地址中参数的开始标志
public static final String PARAM_BEGIN = "{";
public static final String PARAM_END = "}";
//------------------------------------------------------------------------------接口调用成功失败标识 0-失败 1-成功
public static final String CALL_SUCCESS = "1";
public static final String CALL_FAILED = "0";
//------------------------------------------------------------------------------选择框 0-否 1-是
public static final String SELECT_TYPE_IS = "1";
public static final String SELECT_TYPE_NOT = "0";
//------------------------------------------------------------------------------接口调用类型 0-仅调用一次 1-每条明细调用一次
public static final String CALL_TYPE_ONLY_ONE = "0";
public static final String CALL_TYPE_EVERY_DETAIL = "1";
//------------------------------------------------------------------------------接口请求类型 0-get 1-post
//GET
public static final String REQUEST_METHOD_GET = "0";
//POST
public static final String REQUEST_METHOD_POST = "1";
//------------------------------------------------------------------------------接口报文类型 0-xml 1-json 2-键值对
//xml
public static final String REQUEST_DATA_TYPE_XML = "0";
//json
public static final String REQUEST_DATA_TYPE_JSON = "1";
//键值对
public static final String REQUEST_DATA_TYPE_PAIR = "2";
//MultipartFile
public static final String REQUEST_DATA_TYPE_MULTIPARTFILE = "3";
//------------------------------------------------------------------------------接口响应报文类型 0-xml 1-json
//xml
public static final String RESPONSE_DATA_TYPE_XML = "0";
//json
public static final String RESPONSE_DATA_TYPE_JSON = "1";
//------------------------------------------------------------------------------节点类型
//文本
public static final String NODE_TYPE_STRING = "0";
//对象
public static final String NODE_TYPE_OBJECT = "1";
//文本数组
public static final String NODE_TYPE_STRING_ARRAY = "2";
//数组
public static final String NODE_TYPE_ARRAY = "3";
//json对象字符串
public static final String NODE_TYPE_JSONSTRING = "4";
//数字
public static final String NODE_TYPE_NUMBER = "5";
//布尔
public static final String NODE_TYPE_BOOLEAN = "6";
//浮点数
public static final String NODE_TYPE_FLOAT = "7";
//------------------------------------------------------------------------------转换规则
//不转换
public static final String CHANGE_TYPE_NONE = "0";
//固定值
public static final String CHANGE_TYPE_FIXED = "1";
//自定义sql
public static final String CHANGE_TYPE_SQL = "2";
//字段求和
public static final String CHANGE_TYPE_SUM = "3";
//文本数组
public static final String CHANGE_TYPE_STRING_ARRAY = "4";
//明细序号
public static final String CHANGE_TYPE_ROW_NUMBER = "5";
//流程审批意见
public static final String CHANGE_TYPE_SUGGESTION = "6";
//加密处理
public static final String CHANGE_TYPE_MD5 = "7";
//------------------------------------------------------------------------------sql转义
//默认换行符
public static final String Default_Line_Break = "<br>";
//默认空格HTML代码
public static final String Default_Html_Blank = "&nbsp;";
//默认空格字符
public static final String Default_Blank_Char = " ";
}

View File

@ -0,0 +1,54 @@
package com.api.taojw.common.action.entity;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class ConfigInfoEntity {
//接口调用类型 0-仅调用一次 1-每条明细调用一次
public String callType;
//请求方式 0-get 1-post
public String requestMethod;
//失败是否阻止流程提交
public String failedAndReturn;
//明细表下标 值为1时表示对明细表1中的每条记录都调用一次接口
public String detailTableIndex;
//数据条件
public String sqlCondition;
//接口报文类型 0-xml 1-json 2-键值对
public String requestDataType;
//响应报文类型 0-xml 1-json
public String responseDataType;
//接口地址
public String callAddress;
//日志记录表名称
public String logTableName;
//日志记录表requestid字段名称
public String logRequestIdFieldName;
//日志记录表接口地址字段名称
public String logRequestUrlFieldName;
//日志记录表请求头字段名称
public String logRequestHeaderFieldName;
//日志记录表请求报文字段名称
public String logRequestBodyFieldName;
//日志记录表响应报文字段名称
public String logResponseBodyFieldName;
//日志记录表响应码字段名称
public String logResponseStatusFieldName;
//接口地址参数配置详情
public List<Map<String,String>> requestAddressConfigList = new ArrayList<>();
//请求头参数配置详情
public List<Map<String,String>> requestHeaderConfigList = new ArrayList<>();
//请求体字段详细配置
public List<Map<String,String>> requestBodyConfigList = new ArrayList<>();
//xml节点属性详细配置
public List<Map<String,String>> xmlNodeAttrConfigList = new ArrayList<>();
//响应信息详细配置
public List<Map<String,String>> responseConfigList = new ArrayList<>();
//json请求报文根节点配置信息
public List<Map<String,String>> rootJsonConfigInfo = new ArrayList<>();
//xml请求报文根节点配置信息
public Map<String,String> rootXmlConfigInfo;
}

View File

@ -0,0 +1,40 @@
package com.api.taojw.common.action.entity;
import com.alibaba.fastjson.JSONObject;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.message.BasicNameValuePair;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class RequestAndResponseInfoEntity {
//请求头参数
public Map<String,String> headers = new HashMap<>();
//生成的xml请求报文对象
public Document xmlDoc = DocumentHelper.createDocument();
//生成的json请求报文对象
public JSONObject jsonDoc = new JSONObject();
//生成的键值对参数
public List<BasicNameValuePair> pairList = new ArrayList<>();
//文件信息参数
public List<Map<String,String>> multiPartFileInfos = new ArrayList<>();
//接口响应信息
public CloseableHttpResponse response;
//接口响应体
public String responseString;
//接口响应码
public int responseCode;
//JSON类型响应体
public JSONObject responseJson;
//XML类型响应体
public Document responseXml;
//响应的成功失败标识值
public String resultValue = "";
//接口调用提示信息
public String responseMessage = "";
}

View File

@ -0,0 +1,89 @@
package com.api.taojw.common.logging;
/**
* log4j
* @date 2020-03-10
* @version 1.0
*/
public class Log4JLogger implements Logger {
private org.apache.log4j.Logger log;
//类名
private String classname;
@Override
public String getClassname() {
return classname;
}
@Override
public void setClassname(String classname) {
this.classname = classname;
}
@Override
public boolean isDebugEnabled() {
return log.isDebugEnabled();
}
@Override
public boolean isInfoEnabled() {
return log.isInfoEnabled();
}
@Override
public void debug(Object message) {
String method = Thread.currentThread().getStackTrace()[2].getMethodName();
log.debug(classname+"."+method+"() - "+message);
}
@Override
public void debug(Object message, Throwable exception) {
String method = Thread.currentThread().getStackTrace()[2].getMethodName();
log.debug(classname+"."+method+"() - "+message, exception);
}
@Override
public void info(Object message) {
String method = Thread.currentThread().getStackTrace()[2].getMethodName();
log.info(classname+"."+method+"() - "+message);
}
@Override
public void info(Object message, Throwable exception) {
String method = Thread.currentThread().getStackTrace()[2].getMethodName();
log.info(classname+"."+method+"() - "+message, exception);
}
@Override
public void warn(Object message) {
String method = Thread.currentThread().getStackTrace()[2].getMethodName();
log.warn(classname+"."+method+"() - "+message);
}
@Override
public void warn(Object message, Throwable exception) {
String method = Thread.currentThread().getStackTrace()[2].getMethodName();
log.warn(classname+"."+method+"() - "+message, exception);
}
@Override
public void error(Object message) {
String method = Thread.currentThread().getStackTrace()[2].getMethodName();
log.error(classname+"."+method+"() - "+message);
}
@Override
public void error(Object message, Throwable exception) {
String method = Thread.currentThread().getStackTrace()[2].getMethodName();
log.error(classname+"."+method+"() - "+message, exception);
}
@Override
public void init(String name) {
if("".equals(name)) {
name = "cuslog";
}
log = org.apache.log4j.Logger.getLogger(name);
}
}

View File

@ -0,0 +1,78 @@
package com.api.taojw.common.logging;
/**
*
*
* @author zwl
* @date 2020-03-10
*/
public interface Logger extends weaver.integration.logging.Logger {
public boolean isDebugEnabled();
/**
* debug
* @param message
*/
public void debug(Object message);
/**
* debug
* @param message
* @param exception
*/
public void debug(Object message, Throwable exception);
public boolean isInfoEnabled();
/**
* info
* @param message
*/
public void info(Object message);
/**
* info
* @param message
* @param exception
*/
public void info(Object message, Throwable exception);
/**
* warn
* @param message
*/
public void warn(Object message);
/**
* warn
* @param message
* @param exception
*/
public void warn(Object message, Throwable exception);
/**
* error
* @param message
*/
public void error(Object message);
/**
* error
* @param message
* @param exception
*/
public void error(Object message, Throwable exception);
public String getClassname();
public void setClassname(String classname);
/**
*
*
* @param name logger
*/
public void init(String name);
}

View File

@ -0,0 +1,50 @@
package com.api.taojw.common.logging;
/**
*
*
* @author zwl
* @date 2020-03-10
* @version 1.0
*/
public class LoggerFactory {
private static final String loggerName = "cus";
public static Logger getLogger(String LogName, String clazz) {
if("".equals(LogName)) {
LogName = loggerName;
}
Logger logger = new Log4JLogger();
logger.setClassname(clazz);
logger.init(LogName);
return logger;
}
/**
* logger
* @param clazz
* @return
*/
public static Logger getLogger(Class clazz) {
return getLogger(loggerName,clazz.getCanonicalName());
}
/**
* logger
* @param className
* @return
*/
public static Logger getLogger(String className) {
return getLogger(loggerName,className);
}
/**
* logger
* @param
* @return
*/
public static Logger getLogger() {
String className = Thread.currentThread().getStackTrace()[2].getClassName();
return getLogger(loggerName, className);
}
}

View File

@ -0,0 +1,38 @@
package com.api.taojw.common.logging;
import org.apache.log4j.Logger;
import org.apache.log4j.*;
import java.io.File;
public class MyLogger {
private static volatile Logger log = null;
/**
*
*
* @return
*/
public static Logger getLogger() {
if (log == null) {
synchronized (MyLogger.class) {
if (log == null) {
DailyRollingFileAppender appender = new DailyRollingFileAppender();
log = Logger.getLogger("tjw_cus");
appender.setName("tjw_cus");
appender.setEncoding("UTF-8");
appender.setDatePattern("'_'yyyyMMdd'.log'");
appender.setFile(weaver.general.GCONST.getLogPath() + "cus" + File.separator + "tjw_cus" + File.separator + "cus.log");
appender.setThreshold(Priority.DEBUG);
appender.setLayout(new PatternLayout("[%-5p][%d{yyyy-MM-dd HH:mm:ss,SSS}][Thread:%t][%F.%M:%L] ==> : %m %x %n"));
appender.setAppend(true);
appender.activateOptions();
log.addAppender(appender);
log.setLevel(Level.INFO);
}
}
}
return log;
}
}

View File

@ -0,0 +1,85 @@
package com.api.taojw.dianzhuang.cronjob;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.interfaces.schedule.BaseCronJob;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.logging.MyLogger;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
*
* uf_ylfjebzb
* 111
* /*1 使=0ysyje
* 2frzxid=0id=1
* frrq
*
* 1id=1=12ys=1000je
* =1000hj
* 3frzxid=2
* frrq
* jzfrydr
*
* 1id=2=12ys=4000je
* =4000hj
* */
public class DealYlfCronJob extends BaseCronJob {
Logger logger = MyLogger.getLogger();
@Override
public void execute() {
try{
logger.info("DealYlfCronJob.execute start;");
String currentDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
RecordSet rs = new RecordSet();
String updateMainDataSql = "update uf_ylfjebzb set ysyje = 0 ";
DaoUtil.updateData(rs,updateMainDataSql);
String updateMinDetailDataSql =
"update " +
"uf_ylfjebzb_dt1 " +
"set " +
"ys = 12," +
"je = 1000 " +
"where " +
"id in (select min(t1.id) as id from uf_ylfjebzb_dt1 t1 inner join uf_ylfjebzb t2 on t2.id = t1.mainid where (t2.frzx = 0 or t2.frzx = 1) and t2.frrq < ? )";
DaoUtil.updateData(rs,updateMinDetailDataSql,currentDate);
updateMainDataSql =
"update " +
"uf_ylfjebzb " +
"set " +
"hj = ? " +
"where " +
"(frzx = 0 or frzx = 1) and frrq < ?";
DaoUtil.updateData(rs,updateMainDataSql,1000,currentDate);
String updateMaxDetailDataSql =
"update " +
"uf_ylfjebzb_dt1 " +
"set " +
"ys = 12," +
"je = 4000 " +
"where " +
"id in (select max(t1.id) as id from uf_ylfjebzb_dt1 t1 inner join uf_ylfjebzb t2 on t2.id = t1.mainid where t2.frzx = 2 and t2.frrq < ? and t2.jzfrydr < ?)";
DaoUtil.updateData(rs,updateMaxDetailDataSql,currentDate,currentDate);
updateMainDataSql =
"update " +
"uf_ylfjebzb " +
"set " +
"hj = ? " +
"where " +
"frzx = 2 and frrq < ? and jzfrydr < ?";
DaoUtil.updateData(rs,updateMainDataSql,4000,currentDate,currentDate);
logger.info("DealYlfCronJob end.");
}catch(Throwable e){
logger.error("DealYlfCronJob exception:" + e.getMessage() + ";e:" + e);
}
}
}

View File

@ -0,0 +1,146 @@
package com.api.taojw.fute.action;
import com.alibaba.fastjson.JSONObject;
import com.api.taojw.fute.util.FuteHttpUtil;
import org.apache.http.Header;
import org.apache.http.entity.ContentType;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.general.TimeUtil;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import weaver.taojw.common.CommonSqlUtil;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.TjwHttpUtil;
import weaver.taojw.common.WorkFlowDataToJsonUtil;
import weaver.taojw.common.logging.MyLogger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* action
* NC
*/
public class CallNcAction implements Action {
Logger logger = MyLogger.getLogger();
private String hjndColumnName = "";
private String pzhColumnName = "";
private String type = "";
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
private String configId = "";
public String getConfigId() {
return configId;
}
public void setConfigId(String configId) {
this.configId = configId;
}
public String getHjndColumnName() {
return hjndColumnName;
}
public void setHjndColumnName(String hjndColumnName) {
this.hjndColumnName = hjndColumnName;
}
public String getPzhColumnName() {
return pzhColumnName;
}
public void setPzhColumnName(String pzhColumnName) {
this.pzhColumnName = pzhColumnName;
}
@Override
public String execute(RequestInfo requestInfo) {
String requestId = requestInfo.getRequestid();
try{
logger.info("----------------------" + this.getClass() + " action begin ----------------------");
String billTableName = requestInfo.getRequestManager().getBillTableName();
RecordSet rs = new RecordSet();
//String configId = CommonSqlUtil.getSystemParamValue("sapNcJsonConfigId",rs);
String[] baseInfo = WorkFlowDataToJsonUtil.getRequestBaseInfo(requestId,requestInfo.getRsTrans(),"",requestInfo.getRequestManager().getBillTableName());
JSONObject param = WorkFlowDataToJsonUtil.getJsonByWorkFlowData(requestId,configId,baseInfo);
JSONObject requestParameter = param.getJSONObject("REQUEST_PARAMETER");
requestParameter.put("TYPE",type);
requestParameter.put("SIMU_POST","2");
param.put("REQUEST_PARAMETER",requestParameter);
//调用sap接口
String token = FuteHttpUtil.getToken();
String sapNcUrl = CommonSqlUtil.getSystemParamValue("sapTempNcUrl",rs);
Map<String,String> headers = new HashMap<>();
headers.put("Authorization","Bearer " + token);
String ncCheckSign = CommonSqlUtil.getSystemParamValue("ncCheckSign",rs);
if("1".equals(ncCheckSign)){
Map<String,String> getHeaders = new HashMap<>();
getHeaders.put("Authorization","Bearer " + token);
String saptokenheader = CommonSqlUtil.getSystemParamValue("saptokenheader",rs);
getHeaders.put("X-CSRF-Token",saptokenheader);
Map<String, Object> get = TjwHttpUtil.sendHttpRequest(sapNcUrl, param.toJSONString(), "getWithEntity", ContentType.APPLICATION_JSON, getHeaders);
Header[] responseHeaders = (Header[]) get.get("responseHeaders");
Header[] allHeaders = responseHeaders;
String thing = "";
for(Header header : allHeaders){
if("x-csrf-token".equals(header.getName())){
thing = header.getValue();
}
}
List<String> cookies = new ArrayList<>();
for(int i = 0;i < allHeaders.length;i ++){
Header h = allHeaders[i];
if("set-cookie".equalsIgnoreCase(h.getName())){
cookies.add(h.getValue());
}
}
logger.info("thing:" + thing);
headers.put("X-CSRF-Token",thing);
StringBuffer cookisStr = new StringBuffer("");
for (String str : cookies) {
cookisStr.append(str.substring(0, str.indexOf(";"))).append(";");
}
String endCookie = cookisStr.substring(0, cookisStr.length());
logger.info("endCookie:" + endCookie);
headers.put("Cookie", endCookie);
}
Map<String, Object> post = TjwHttpUtil.sendHttpRequest(sapNcUrl, param.toJSONString(), "POST", ContentType.APPLICATION_JSON, headers);
String resData = (String) post.get("data");
JSONObject result = JSONObject.parseObject(resData);
if("S".equals(result.getString("RETURN_CODE"))){
String updateSql = "update " + billTableName + " set "+hjndColumnName+" = ?,"+pzhColumnName+" = ? where requestid = ?";
JSONObject returnResult = result.getJSONObject("RETURN_RESULT");
String hjnd = returnResult.getString("GJAHR");
String pzh = returnResult.getString("BELNR");
DaoUtil.updateData(rs,updateSql,hjnd,pzh,requestId);
return Action.SUCCESS;
}else{
requestInfo.getRequestManager().setMessageid(TimeUtil.getCurrentTimeString() + requestId);
requestInfo.getRequestManager().setMessagecontent("接口响应异常;对方接口响应RETURN_MESSAGE:" + result.getString("RETURN_MESSAGE"));
return Action.FAILURE_AND_CONTINUE;
}
}catch(Throwable e){
requestInfo.getRequestManager().setMessageid(TimeUtil.getCurrentTimeString() + requestId);
requestInfo.getRequestManager().setMessagecontent(this.getClass() + "Action接口发生异常,requestId:"+ requestId +",请联系管理员!");
logger.error(this.getClass() + " error;requestId:" + requestId + "exception:" + e.getMessage() + ";e:" + e);
return Action.FAILURE_AND_CONTINUE;
}
}
}

View File

@ -0,0 +1,162 @@
package com.api.taojw.fute.action;
import com.alibaba.fastjson.JSONObject;
import com.api.taojw.fute.util.FuteHttpUtil;
import org.apache.http.Header;
import org.apache.http.entity.ContentType;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.conn.RecordSetTrans;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.taojw.common.CommonSqlUtil;
import weaver.soa.workflow.request.RequestInfo;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.TjwHttpUtil;
import weaver.taojw.common.WorkFlowDataToJsonUtil;
import weaver.taojw.common.logging.MyLogger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* action
*
*/
public class FkAction implements Action {
Logger logger = MyLogger.getLogger();
private String configId = "";
public String getConfigId() {
return configId;
}
public void setConfigId(String configId) {
this.configId = configId;
}
private String url = "";
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
private String condition = "";
public String getCondition() {
return condition;
}
public void setCondition(String condition) {
this.condition = condition;
}
@Override
public String execute(RequestInfo requestInfo) {
String requestId = requestInfo.getRequestid();
try{
logger.info("----------------------" + this.getClass() + " action begin ----------------------");
RecordSet rs = new RecordSet();
String getWorkFlowIdSql = "select workflowid from workflow_requestbase where requestid = ?";
Map<String, String> data = DaoUtil.getFirstData(rs, getWorkFlowIdSql, requestId);
String workFlowId = data.get("workflowid");
String getSapChSql = "select sapch from " + requestInfo.getRequestManager().getBillTableName() + " where requestid = ?";
Map<String, String> firstData2 = DaoUtil.getFirstData(rs, getSapChSql, requestId);
String sapch = firstData2.get("sapch");
//sap撤回时不走action
if("1".equals(sapch)){
return Action.SUCCESS;
}
if(condition != null && !"".equals(condition)){
String src = requestInfo.getRequestManager().getSrc();
if(!src.equals(condition)){
return Action.SUCCESS;
}
}
String remark = "";
if("withdraw".equals(condition)){
String getRemarkSql = "select remark from workflow_requestlog where requestid = ? order by operatedate desc,operatetime desc";
RecordSetTrans rsTrans = requestInfo.getRsTrans();
if(rsTrans == null){
rsTrans = new RecordSetTrans();
if(rsTrans.executeQuery(getRemarkSql,requestId)){
if(rsTrans.next()){
remark = Util.null2String(rsTrans.getString("remark"));
}
}
}
}else{
remark = requestInfo.getRequestManager().getRemark();
}
String token = FuteHttpUtil.getToken();
String[] baseInfo = WorkFlowDataToJsonUtil.getRequestBaseInfo(requestId,requestInfo.getRsTrans(),remark,requestInfo.getRequestManager().getBillTableName());
JSONObject param = WorkFlowDataToJsonUtil.getJsonByWorkFlowData(requestId,configId,baseInfo);
Map<String,String> headers = new HashMap<>();
String checkSign = CommonSqlUtil.getSystemParamValue("sfkqtosapsign",rs);
if("1".equals(checkSign)){
Map<String,String> getHeaders = new HashMap<>();
getHeaders.put("Authorization","Bearer " + token);
String saptokenheader = CommonSqlUtil.getSystemParamValue("saptokenheader",rs);
getHeaders.put("X-CSRF-Token",saptokenheader);
Map<String, Object> get = TjwHttpUtil.sendHttpRequest(url, param.toJSONString(), "getWithEntity", ContentType.APPLICATION_JSON, getHeaders);
Header[] responseHeaders = (Header[]) get.get("responseHeaders");
Header[] allHeaders = responseHeaders;
String thing = "";
for(Header header : allHeaders){
if("x-csrf-token".equals(header.getName())){
thing = header.getValue();
}
}
List<String> cookies = new ArrayList<>();
for(int i = 0;i < allHeaders.length;i ++){
Header h = allHeaders[i];
if("set-cookie".equalsIgnoreCase(h.getName())){
cookies.add(h.getValue());
}
}
logger.info("thing:" + thing);
headers.put("X-CSRF-Token",thing);
StringBuffer cookisStr = new StringBuffer("");
for (String str : cookies) {
cookisStr.append(str.substring(0, str.indexOf(";"))).append(";");
}
String endCookie = cookisStr.substring(0, cookisStr.length());
logger.info("endCookie:" + endCookie);
headers.put("Cookie", endCookie);
}
headers.put("Authorization","Bearer " + token);
Map<String,String> cusLogInfo = new HashMap<>();
cusLogInfo.put("lclx",workFlowId);
logger.info("workFlowId:" + workFlowId);
Map<String, Object> post = TjwHttpUtil.sendHttpRequestWithCusLog(url, param.toJSONString(), "post", ContentType.APPLICATION_JSON, headers,cusLogInfo);
JSONObject result = JSONObject.parseObject((String) post.get("data"));
if("S".equals(result.getString("RETURN_CODE"))){
return Action.SUCCESS;
}else{
requestInfo.getRequestManager().setMessageid(TimeUtil.getCurrentTimeString() + requestId);
requestInfo.getRequestManager().setMessagecontent("接口响应异常;对方接口响应RETURN_MESSAGE:" + result.getString("RETURN_MESSAGE"));
return Action.FAILURE_AND_CONTINUE;
}
}catch(Throwable e){
requestInfo.getRequestManager().setMessageid(TimeUtil.getCurrentTimeString() + requestId);
requestInfo.getRequestManager().setMessagecontent(this.getClass() + "Action接口发生异常,requestId:"+ requestId +",请联系管理员!");
logger.error(this.getClass() + " error;requestId:" + requestId + "exception:" + e.getMessage() + ";e:" + e);
return Action.FAILURE_AND_CONTINUE;
}
}
}

View File

@ -0,0 +1,220 @@
package com.api.taojw.fute.api;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.api.taojw.fute.util.SignUtil;
import com.engine.common.util.ServiceUtil;
import com.engine.workflow.entity.publicApi.PAResponseEntity;
import com.engine.workflow.entity.publicApi.ReqOperateRequestEntity;
import com.engine.workflow.publicApi.WorkflowRequestOperatePA;
import com.engine.workflow.publicApi.impl.WorkflowRequestOperatePAImpl;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.taojw.common.CommonSqlUtil;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.logging.MyLogger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
/**
*
*
*/
@Path("/futetjw")
public class CusCreateWorkFlowApi {
Logger logger = MyLogger.getLogger();
public static WorkflowRequestOperatePA WRO = null;
static {
WRO = getRequestOperatePA();
}
private static WorkflowRequestOperatePA getRequestOperatePA() {
return (WorkflowRequestOperatePAImpl) ServiceUtil.getService(WorkflowRequestOperatePAImpl.class);
}
@POST
@Path("/createWorkFlow")
@Produces(MediaType.APPLICATION_JSON)
public String createWorkFlow(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody String objParam){
logger.info("CusCreateWorkFlowApi.createWorkFlow begin;objParam:" + objParam);
JSONObject obj = JSONObject.parseObject(objParam);
logger.info("param:" + obj.toJSONString());
try{
RecordSet rs = new RecordSet();
String workCode = Util.null2String(obj.getString("cusWorkCode"));
String title = Util.null2String(obj.getString("requestName"));
String logId = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + workCode + Util.getRandom();
logger.info("logId:" + logId);
String checkSign = CommonSqlUtil.getSystemParamValue("sfkqsign",rs);
if("1".equals(checkSign)){
String headerString = request.getHeader("SAPSignatureValue");
//String bodyString = obj.toString();
boolean b = SignUtil.checkSign(objParam, headerString);
if(!b){
JSONObject jsonObject = new JSONObject();
jsonObject.put("code","ERROR");
jsonObject.put("cusErrMsg","流程创建失败,验签失败!logId:"+logId);
return jsonObject.toJSONString();
}
}
String workFlowId = Util.null2String(obj.getString("workflowId"));
String tableName = CommonSqlUtil.getTableNameByWorkflowId(workFlowId,rs);
JSONArray mainData = obj.getJSONArray("mainData");
String theirRequestId = "";
for(int i = 0;i < mainData.size();i++){
JSONObject o = mainData.getJSONObject(i);
if("SAPrequestid".equalsIgnoreCase(o.getString("fieldName")) || "pvrequestid".equalsIgnoreCase(o.getString("fieldName")) || "qvrequestid".equalsIgnoreCase(o.getString("fieldName"))){
theirRequestId = o.getString("fieldValue");
}
}
String checkSql1 = "select count(1) as c,max(requestid) as requestid from " + tableName + " where SAPrequestid = ? ";
String checkSql2 = "select count(1) as c,max(requestid) as requestid from " + tableName + " where pvrequestid = ? ";
String checkSql3 = "select count(1) as c,max(requestid) as requestid from " + tableName + " where qvrequestid = ? ";
String oldRequestId = "";
String getIdSql1 = "select requestid from " + tableName + " where SAPrequestid = ? ";
String getIdSql2 = "select requestid from " + tableName + " where pvrequestid = ? ";
String getIdSql3 = "select requestid from " + tableName + " where qvrequestid = ? ";
Map<String, String> firstData2 = DaoUtil.getFirstData(rs, getIdSql1, theirRequestId);
if(firstData2.get("requestid") != null && !"".equals(firstData2.get("requestid"))){
oldRequestId = firstData2.get("requestid");
}
firstData2 = DaoUtil.getFirstData(rs, getIdSql2, theirRequestId);
if(firstData2.get("requestid") != null && !"".equals(firstData2.get("requestid"))){
oldRequestId = firstData2.get("requestid");
}
firstData2 = DaoUtil.getFirstData(rs, getIdSql3, theirRequestId);
if(firstData2.get("requestid") != null && !"".equals(firstData2.get("requestid"))){
oldRequestId = firstData2.get("requestid");
}
if(DaoUtil.isDataExists(rs,checkSql1,theirRequestId) || DaoUtil.isDataExists(rs,checkSql2,theirRequestId) || DaoUtil.isDataExists(rs,checkSql3,theirRequestId)){
JSONObject jsonObject = new JSONObject();
jsonObject.put("code","C");
JSONObject o = new JSONObject();
o.put("requestid",oldRequestId);
jsonObject.put("data",o);
jsonObject.put("cusErrMsg","流程已创建,请勿重复提交!logId:"+logId);
return jsonObject.toJSONString();
}
String getUserIdSql = "select id,departmentid from hrmresource where workcode = ?";
Map<String, String> firstData = DaoUtil.getFirstData(new RecordSet(), getUserIdSql, workCode);
int userId = Integer.parseInt(firstData.get("id"));
String departmentid = firstData.get("departmentid");
User user = new User(userId);
ReqOperateRequestEntity entity = JSONObject.parseObject(String.valueOf(obj), ReqOperateRequestEntity.class);
entity.setUserId(userId);
PAResponseEntity paResponseEntity = WRO.doCreateRequest(user, entity);
String result = JSONObject.toJSONString(paResponseEntity);
JSONObject jsonObject = JSONObject.parseObject(result);
String code = jsonObject.getString("code");
if(!"SUCCESS".equals(code)){
jsonObject.put("cusErrMsg","流程创建失败!logId:"+logId);
}else{
String requestId = jsonObject.getJSONObject("data").getString("requestid");
//更新主表 申请人、申请部门、申请时间字段
//String workFlowId = obj.getString("workflowId");
String getTableSql = "select tablename from workflow_bill where id = (select formid from workflow_base where id = ?)";
Map<String, String> firstData1 = DaoUtil.getFirstData(rs, getTableSql, workFlowId);
String tablename = firstData1.get("tablename");
String updateDataSql = "update " + tablename + " set Title = ?,Applicant = ?,ApplicationDepartment = ?,ApplicationDate = ?,cusWorkCode = ? where requestid = ?";
DaoUtil.updateData(rs,updateDataSql,title,userId,departmentid,new SimpleDateFormat("yyyy-MM-dd").format(new Date()),workCode,requestId);
}
logger.info("result:"+jsonObject.toJSONString());
return jsonObject.toJSONString();
}catch(Throwable e){
logger.error("CusCreateWorkFlowApi.createWorkFlow exception;message:" + e.getMessage() + ";e:" + e);
}
return "";
}
@POST
@Path("/withDrawWorkFlow")
@Produces(MediaType.APPLICATION_JSON)
public String withDrawWorkFlow(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody String objParam){
logger.info("CusCreateWorkFlowApi.withDrawWorkFlow begin;");
JSONObject obj = JSONObject.parseObject(objParam);
logger.info("param:" + obj.toJSONString());
try{
RecordSet rs = new RecordSet();
String workCode = Util.null2String(obj.getString("cusWorkCode"));
String logId = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + workCode + Util.getRandom();
logger.info("logId:" + logId);
String checkSign = CommonSqlUtil.getSystemParamValue("sfkqsign",rs);
if("1".equals(checkSign)){
String headerString = request.getHeader("SAPSignatureValue");
String bodyString = obj.toString();
boolean b = SignUtil.checkSign(objParam, headerString);
if(!b){
JSONObject jsonObject = new JSONObject();
jsonObject.put("code","ERROR");
jsonObject.put("cusErrMsg","流程创建失败,验签失败!logId:"+logId);
return jsonObject.toJSONString();
}
}
String requestId = Util.null2String(obj.getString("requestId"));
//若当前是在撤回状态 则返回一个C
String getCurrentNodeTypeSql =
"select currentnodetype from workflow_requestbase where requestid = ?";
Map<String, String> firstData1 = DaoUtil.getFirstData(rs, getCurrentNodeTypeSql, requestId);
String currentnodetype = Util.null2String(firstData1.get("currentnodetype"));
if("0".equals(currentnodetype)){
JSONObject jsonObject = new JSONObject();
jsonObject.put("code","C");
jsonObject.put("cusErrMsg","流程当前已被撤回,请勿重复撤回!");
logger.info("result:"+jsonObject);
return jsonObject.toJSONString();
}
String tableName = CommonSqlUtil.getTableNameByRequetId(requestId,rs);
String getUserIdSql = "select id from hrmresource where workcode = ?";
Map<String, String> firstData = DaoUtil.getFirstData(new RecordSet(), getUserIdSql, workCode);
int userId = Integer.parseInt(firstData.get("id"));
User user = new User(userId);
ReqOperateRequestEntity entity = JSONObject.parseObject(String.valueOf(obj), ReqOperateRequestEntity.class);
entity.setUserId(userId);
String updateSql = "update " + tableName + " set sapch = 1 where requestid = ?";
DaoUtil.updateData(rs,updateSql,requestId);
PAResponseEntity paResponseEntity = WRO.withdrawRequest(user, entity);
String result = JSONObject.toJSONString(paResponseEntity);
JSONObject jsonObject = JSONObject.parseObject(result);
String code = jsonObject.getString("code");
if(!"SUCCESS".equals(code)){
jsonObject.put("cusErrMsg","流程撤回失败!logId:"+logId);
}
String updateSql2 = "update " + tableName + " set sapch = 2 where requestid = ?";
DaoUtil.updateData(rs,updateSql2,requestId);
logger.info("result:"+result);
return jsonObject.toJSONString();
}catch(Throwable e){
logger.error("CusCreateWorkFlowApi.withDrawWorkFlow exception;message:" + e.getMessage() + ";e:" + e);
}
return "";
}
}

View File

@ -0,0 +1,118 @@
package com.api.taojw.fute.api;
import com.alibaba.fastjson.JSONObject;
import com.api.taojw.fute.util.FuteHttpUtil;
import org.apache.http.Header;
import org.apache.http.entity.ContentType;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.taojw.common.CommonSqlUtil;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.TjwHttpUtil;
import weaver.taojw.common.WorkFlowDataToJsonUtil;
import weaver.taojw.common.logging.MyLogger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
*
*/
@Path("/futetjwnc")
public class FuteTjwApi {
Logger logger = MyLogger.getLogger();
//流程中点击按钮 调用前置NC接口
@POST
@Path("/callNccFirst")
@Produces(MediaType.APPLICATION_JSON)
public String callNccFirst(@Context HttpServletRequest request, @Context HttpServletResponse response){
JSONObject result = new JSONObject();
JSONObject param = new JSONObject();
try{
RecordSet rs = new RecordSet();
String configId = request.getParameter("configId");
String requestId = request.getParameter("requestId");
String type = request.getParameter("type");
logger.info("FuteTjwApi.callNccFirst begin;requestId:" + requestId + ";configId:" + configId);
String tableName = CommonSqlUtil.getTableNameByRequetId(requestId,rs);
//流程基础数据数组[流程请求ID\流程标题\流程编号\表单名称\主表主键值]
String[] base_array = new String[5];
base_array[0] = requestId;
base_array[1] = "";
base_array[2] = "";
base_array[3] = tableName;
String getIdSql = "select id from " + tableName + " where requestid = ?";
Map<String, String> firstData3 = DaoUtil.getFirstData(rs, getIdSql, requestId);
String id = Util.null2String(firstData3.get("id"));
base_array[4] = id;
param = WorkFlowDataToJsonUtil.getJsonByWorkFlowData(requestId,configId,base_array);
JSONObject requestParameter = param.getJSONObject("REQUEST_PARAMETER");
requestParameter.put("TYPE",type);
param.put("REQUEST_PARAMETER",requestParameter);
//param.put("SIMU_POST","1");
//调用sap接口
String token = FuteHttpUtil.getToken();
String sapNcUrl = CommonSqlUtil.getSystemParamValue("sapTempNcUrl",rs);
Map<String,String> headers = new HashMap<>();
headers.put("Authorization","Bearer " + token);
String ncCheckSign = CommonSqlUtil.getSystemParamValue("ncCheckSign",rs);
if("1".equals(ncCheckSign)){
Map<String,String> getHeaders = new HashMap<>();
getHeaders.put("Authorization","Bearer " + token);
String saptokenheader = CommonSqlUtil.getSystemParamValue("saptokenheader",rs);
getHeaders.put("X-CSRF-Token",saptokenheader);
Map<String, Object> get = TjwHttpUtil.sendHttpRequest(sapNcUrl, param.toJSONString(), "getWithEntity", ContentType.APPLICATION_JSON, getHeaders);
Header[] responseHeaders = (Header[]) get.get("responseHeaders");
Header[] allHeaders = responseHeaders;
String thing = "";
for(Header header : allHeaders){
if("x-csrf-token".equals(header.getName())){
thing = header.getValue();
}
}
List<String> cookies = new ArrayList<>();
for(int i = 0;i < allHeaders.length;i ++){
Header h = allHeaders[i];
if("set-cookie".equalsIgnoreCase(h.getName())){
cookies.add(h.getValue());
}
}
logger.info("thing:" + thing);
headers.put("X-CSRF-Token",thing);
StringBuffer cookisStr = new StringBuffer("");
for (String str : cookies) {
cookisStr.append(str.substring(0, str.indexOf(";"))).append(";");
}
String endCookie = cookisStr.substring(0, cookisStr.length());
logger.info("endCookie:" + endCookie);
headers.put("Cookie", endCookie);
}
Map<String, Object> post = TjwHttpUtil.sendHttpRequest(sapNcUrl, param.toJSONString(), "POST", ContentType.APPLICATION_JSON, headers);
String resData = (String) post.get("data");
JSONObject resJson = JSONObject.parseObject(resData);
result.put("result",resJson);
}catch(Throwable e){
logger.error("FuteTjwApi.callNccFirst exception;message:" + e.getMessage() + ";e:" + e);
}
result.put("param",param.getJSONObject("REQUEST_PARAMETER"));
return result.toJSONString();
}
}

View File

@ -0,0 +1,390 @@
package com.api.taojw.fute.cronjob;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.api.taojw.common.*;
import com.api.taojw.common.logging.MyLogger;
import com.api.taojw.fute.util.FuteHttpUtil;
import org.apache.http.Header;
import org.apache.http.entity.ContentType;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.interfaces.schedule.BaseCronJob;
import java.text.SimpleDateFormat;
import java.util.*;
/**
*
*
*/
public class CallSapGetDataToMode extends BaseCronJob {
Logger logger = MyLogger.getLogger();
private String SYSID = "";
private String objectId = "";
private String posid = "";
private String extendby1 = "";
private String extendby2 = "";
private String ktopl = "";
private String bukrs = "";
private String lifnr = "";
private String kokrs = "";
private String auart = "";
private String saknr = "";
private String prctr = "";
private String kostl = "";
private String dateStringMode = "";
private String modeKeyName = "";
private String modeTableName = "";
private String jsonConfigId = "";
public String getObjectId() {
return objectId;
}
public void setObjectId(String objectId) {
this.objectId = objectId;
}
public String getPosid() {
return posid;
}
public void setPosid(String posid) {
this.posid = posid;
}
public String getExtendby1() {
return extendby1;
}
public void setExtendby1(String extendby1) {
this.extendby1 = extendby1;
}
public String getExtendby2() {
return extendby2;
}
public void setExtendby2(String extendby2) {
this.extendby2 = extendby2;
}
public String getKtopl() {
return ktopl;
}
public void setKtopl(String ktopl) {
this.ktopl = ktopl;
}
public String getBukrs() {
return bukrs;
}
public void setBukrs(String bukrs) {
this.bukrs = bukrs;
}
public String getLifnr() {
return lifnr;
}
public void setLifnr(String lifnr) {
this.lifnr = lifnr;
}
public String getKokrs() {
return kokrs;
}
public void setKokrs(String kokrs) {
this.kokrs = kokrs;
}
public String getAuart() {
return auart;
}
public void setAuart(String auart) {
this.auart = auart;
}
public String getSaknr() {
return saknr;
}
public void setSaknr(String saknr) {
this.saknr = saknr;
}
public String getPrctr() {
return prctr;
}
public void setPrctr(String prctr) {
this.prctr = prctr;
}
public String getKostl() {
return kostl;
}
public void setKostl(String kostl) {
this.kostl = kostl;
}
public String getDateStringMode() {
return dateStringMode;
}
public void setDateStringMode(String dateStringMode) {
this.dateStringMode = dateStringMode;
}
public String getModeTableName() {
return modeTableName;
}
public void setModeTableName(String modeTableName) {
this.modeTableName = modeTableName;
}
public String getJsonConfigId() {
return jsonConfigId;
}
public void setJsonConfigId(String jsonConfigId) {
this.jsonConfigId = jsonConfigId;
}
public String getModeKeyName() {
return modeKeyName;
}
public void setModeKeyName(String modeKeyName) {
this.modeKeyName = modeKeyName;
}
public String getSYSID() {
return SYSID;
}
public void setSYSID(String SYSID) {
this.SYSID = SYSID;
}
@Override
public void execute() {
try{
logger.info(this.getClass() + " begin;" );
RecordSet rs = new RecordSet();
String token = FuteHttpUtil.getToken();
//调用sap接口时是否开启加签
String sapCronjobCheckSign = CommonSqlUtil.getSystemParamValue("sapCronjobCheckSign",rs);
//sap接口地址
String sapDataUrl = CommonSqlUtil.getSystemParamValue("sapDataUrl",rs);
//sap接口入参
JSONObject param = new JSONObject();
param.put("REQUEST_CODE","IF0280");
JSONObject requestParameter = new JSONObject();
if(objectId != null && !"".equals(objectId)){
requestParameter.put("OBJECTID",objectId);
}
if(SYSID != null && !"".equals(SYSID)){
requestParameter.put("SYSID",SYSID);
}
if("01".equals(objectId)){
if(bukrs != null && !"".equals(bukrs)){
requestParameter.put("BUKRS",bukrs);
}else{
requestParameter.put("BUKRS","");
}
if(lifnr != null && !"".equals(lifnr)){
requestParameter.put("LIFNR",lifnr);
}else{
requestParameter.put("LIFNR","");
}
}
if("02".equals(objectId)){
if(kokrs != null && !"".equals(kokrs)){
requestParameter.put("KOKRS",kokrs);
}else{
requestParameter.put("KOKRS","");
}
if(auart != null && !"".equals(auart)){
requestParameter.put("AUART",auart);
}else{
requestParameter.put("AUART","");
}
}
if("03".equals(objectId)){
if(posid != null && !"".equals(posid)){
requestParameter.put("POSID",posid);
}else{
requestParameter.put("POSID","");
}
}
if("04".equals(objectId)){
if(ktopl != null && !"".equals(ktopl)){
requestParameter.put("KTOPL",ktopl);
}else{
requestParameter.put("KTOPL","");
}
if(saknr != null && !"".equals(saknr)){
requestParameter.put("SAKNR",saknr);
}else{
requestParameter.put("SAKNR","");
}
if(bukrs != null && !"".equals(bukrs)){
requestParameter.put("BUKRS",bukrs);
}else{
requestParameter.put("BUKRS","");
}
}
if("05".equals(objectId)){
if(kokrs != null && !"".equals(kokrs)){
requestParameter.put("KOKRS",kokrs);
}else{
requestParameter.put("KOKRS","");
}
if(prctr != null && !"".equals(prctr)){
requestParameter.put("PRCTR",prctr);
}else{
requestParameter.put("PRCTR","");
}
}
if("06".equals(objectId)){
if(kokrs != null && !"".equals(kokrs)){
requestParameter.put("KOKRS",kokrs);
}else{
requestParameter.put("KOKRS","");
}
if(kostl != null && !"".equals(kostl)){
requestParameter.put("KOSTL",kostl);
}else{
requestParameter.put("KOSTL","");
}
}
String _extendby1 = "";
if("".equals(extendby1) || extendby1 == null){
//extendby1为空时 传入昨天的日期
//_extendby1 = new SimpleDateFormat(dateStringMode).format(new SimpleDateFormat("yyyy-MM-dd").parse(TjwTimeUtil.getLastDay()));
//extendby1为空时 传入上次同步的结束日期
String getLastDateSql = "select max(sjjsrq) as rq from uf_updatelog where lx = ?";
Map<String, String> firstData = DaoUtil.getFirstData(rs, getLastDateSql, objectId);
_extendby1 = firstData.get("rq");
if(_extendby1 == null || "".equals(_extendby1)){
//定时任务不配参数 之前也没执行过 那就传昨天的日期
_extendby1 = new SimpleDateFormat(dateStringMode).format(new SimpleDateFormat("yyyy-MM-dd").parse(TjwTimeUtil.getLastDay()));
}
requestParameter.put("extendby1",_extendby1);
}else{
_extendby1 = extendby1;
requestParameter.put("extendby1",extendby1);
}
String _extendby2 = "";
if("".equals(extendby2) || extendby2 == null){
//extendby2为空时 传入今天的日期
_extendby2 = new SimpleDateFormat(dateStringMode).format(new Date());
requestParameter.put("extendby2",_extendby2);
}else{
_extendby2 = extendby2;
requestParameter.put("extendby2",extendby2);
}
param.put("REQUEST_PARAMETER",requestParameter);
//sap请求头参数
Map<String,String> headers = new HashMap<>();
if("1".equals(sapCronjobCheckSign)){
Map<String,String> getHeaders = new HashMap<>();
getHeaders.put("Authorization","Bearer " + token);
String saptokenheader = CommonSqlUtil.getSystemParamValue("saptokenheader",rs);
getHeaders.put("X-CSRF-Token",saptokenheader);
Map<String, Object> get = TjwHttpUtil.sendHttpRequest(sapDataUrl, param.toJSONString(), "getWithEntity", ContentType.APPLICATION_JSON, getHeaders);
Header[] responseHeaders = (Header[]) get.get("responseHeaders");
Header[] allHeaders = responseHeaders;
String thing = "";
for(Header header : allHeaders){
if("x-csrf-token".equals(header.getName())){
thing = header.getValue();
}
}
List<String> cookies = new ArrayList<>();
for(int i = 0;i < allHeaders.length;i ++){
Header h = allHeaders[i];
if("set-cookie".equalsIgnoreCase(h.getName())){
cookies.add(h.getValue());
}
}
logger.info("thing:" + thing);
headers.put("X-CSRF-Token",thing);
StringBuffer cookisStr = new StringBuffer("");
for (String str : cookies) {
cookisStr.append(str.substring(0, str.indexOf(";"))).append(";");
}
String endCookie = cookisStr.substring(0, cookisStr.length());
logger.info("endCookie:" + endCookie);
headers.put("Cookie", endCookie);
}
headers.put("Authorization","Bearer " + token);
String[] keyArr = modeKeyName.split(",");
List<String> keys = new ArrayList<>();
for(String key : keyArr){
keys.add(key);
}
Map<String,String> cusLogInfo = new HashMap<>();
Map<String, Object> post = TjwHttpUtil.sendHttpRequestWithCusLog(sapDataUrl, param.toJSONString(), "post", ContentType.APPLICATION_JSON, headers,cusLogInfo);
JSONObject result = JSONObject.parseObject((String) post.get("data"));
JSONArray RETURN_RESULT = new JSONArray();
try{
RETURN_RESULT = result.getJSONArray("RETURN_RESULT");
}catch (Throwable e){
RETURN_RESULT = new JSONArray();
}
String returnMessage = result.getString("RETURN_MESSAGE");
String returnCode = result.getString("RETURN_CODE");
if(RETURN_RESULT != null && RETURN_RESULT.size() > 0 && "S".equals(returnCode)){
for(int i = 0;i < RETURN_RESULT.size();i++){
JSONObject o = (JSONObject) RETURN_RESULT.get(i);
JSONObject jsonObject = JsonConvertUtil.convertJsonByConfig(o, jsonConfigId);
if(jsonObject.containsKey("name1") || jsonObject.containsKey("name2") || jsonObject.containsKey("name3") || jsonObject.containsKey("name4")){
jsonObject.put("gysms", Util.null2String(jsonObject.getString("name1"))+Util.null2String(jsonObject.getString("name2"))+Util.null2String(jsonObject.getString("name3"))+Util.null2String(jsonObject.getString("name4")));
jsonObject.remove("name1");
jsonObject.remove("name2");
jsonObject.remove("name3");
jsonObject.remove("name4");
}
TjwModelUtil.addOrUpdateModelData(rs,modeTableName,jsonObject,keys);
}
}
//若接口调用成功 则向uf_updatelog中添加记录
if("S".equals(returnCode) || "No data".equalsIgnoreCase(returnMessage)){
JSONObject o = new JSONObject();
o.put("lx",objectId);
o.put("jhrwzxsj", TimeUtil.getCurrentTimeString());
o.put("sjksrq",_extendby1);
o.put("sjjsrq",_extendby2);
if("No data".equalsIgnoreCase(returnMessage)){
o.put("bchqjls","0");
}else{
o.put("bchqjls",RETURN_RESULT.size());
}
TjwModelUtil.addModelData(rs,"uf_updatelog",o);
}
logger.info(this.getClass() + " end");
}catch (Throwable e){
logger.error(this.getClass() + " exception;message:" + e.getMessage() + ";e:" + e);
}
}
}

View File

@ -0,0 +1,192 @@
package com.api.taojw.fute.cronjob;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.api.taojw.common.*;
import com.api.taojw.common.logging.MyLogger;
import com.api.taojw.fute.util.FuteHttpUtil;
import org.apache.http.Header;
import org.apache.http.entity.ContentType;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.interfaces.schedule.BaseCronJob;
import java.util.*;
/**
*
*
*/
public class CallSapGetDataToWorkFlow extends BaseCronJob {
Logger logger = MyLogger.getLogger();
private String tableName = "";
private String fkrqColumnName = "";
private String hjndColumnName = "";
private String pzhColumnName = "";
private String gsdmColumnName = "";
private String fkpzhColumnName = "";
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
public String getFkrqColumnName() {
return fkrqColumnName;
}
public void setFkrqColumnName(String fkrqColumnName) {
this.fkrqColumnName = fkrqColumnName;
}
public String getHjndColumnName() {
return hjndColumnName;
}
public void setHjndColumnName(String hjndColumnName) {
this.hjndColumnName = hjndColumnName;
}
public String getPzhColumnName() {
return pzhColumnName;
}
public void setPzhColumnName(String pzhColumnName) {
this.pzhColumnName = pzhColumnName;
}
public String getGsdmColumnName() {
return gsdmColumnName;
}
public void setGsdmColumnName(String gsdmColumnName) {
this.gsdmColumnName = gsdmColumnName;
}
public String getFkpzhColumnName() {
return fkpzhColumnName;
}
public void setFkpzhColumnName(String fkpzhColumnName) {
this.fkpzhColumnName = fkpzhColumnName;
}
private String configId = "";
public String getConfigId() {
return configId;
}
public void setConfigId(String configId) {
this.configId = configId;
}
private String sqlWhere = "";
public String getSqlWhere() {
return sqlWhere;
}
public void setSqlWhere(String sqlWhere) {
this.sqlWhere = sqlWhere;
}
@Override
public void execute() {
try{
logger.info(this.getClass() + " begin;" );
RecordSet rs = new RecordSet();
//sap接口入参
JSONObject param = new JSONObject();
param.put("REQUEST_CODE","IF0282");
JSONArray REQUEST_PARAMETER = new JSONArray();
String getDataSql =
"select * from " + tableName + " where ("+fkrqColumnName+" = '' or "+fkrqColumnName+" is null) and "+hjndColumnName+" is not null and "+pzhColumnName+" is not null";
if(sqlWhere != null && !"".equals(sqlWhere)){
getDataSql = "select * from " + tableName + " where " + sqlWhere;
}
logger.info("sql :" + getDataSql);
List<Map<String, String>> data = DaoUtil.getData(rs, getDataSql);
logger.info("size:" + data.size());
int number = 1;
for(Map<String, String> m : data){
JSONObject oldJson = new JSONObject();
for(String key : m.keySet()){
oldJson.put(key,m.get(key));
}
JSONObject newJson = JsonConvertUtil.convertJsonByConfig(oldJson,configId);
newJson.put("NUMBER",number);
number = number + 1;
REQUEST_PARAMETER.add(newJson);
logger.info("REQUEST_PARAMETER add:" +newJson.toJSONString() );
}
param.put("REQUEST_PARAMETER",REQUEST_PARAMETER);
logger.info("REQUEST_PARAMETER size :" + REQUEST_PARAMETER.size());
//调用sap接口
String token = FuteHttpUtil.getToken();
String sap0282Url = CommonSqlUtil.getSystemParamValue("sap0282Url",rs);
Map<String,String> headers = new HashMap<>();
headers.put("Authorization","Bearer " + token);
String ncCheckSign = CommonSqlUtil.getSystemParamValue("sapCronjobCheckSign",rs);
if("1".equals(ncCheckSign)){
Map<String,String> getHeaders = new HashMap<>();
getHeaders.put("Authorization","Bearer " + token);
String saptokenheader = CommonSqlUtil.getSystemParamValue("saptokenheader",rs);
getHeaders.put("X-CSRF-Token",saptokenheader);
Map<String, Object> get = TjwHttpUtil.sendHttpRequest(sap0282Url, param.toJSONString(), "getWithEntity", ContentType.APPLICATION_JSON, getHeaders);
Header[] responseHeaders = (Header[]) get.get("responseHeaders");
Header[] allHeaders = responseHeaders;
String thing = "";
for(Header header : allHeaders){
if("x-csrf-token".equals(header.getName())){
thing = header.getValue();
}
}
List<String> cookies = new ArrayList<>();
for(int i = 0;i < allHeaders.length;i ++){
Header h = allHeaders[i];
if("set-cookie".equalsIgnoreCase(h.getName())){
cookies.add(h.getValue());
}
}
logger.info("thing:" + thing);
headers.put("X-CSRF-Token",thing);
StringBuffer cookisStr = new StringBuffer("");
for (String str : cookies) {
cookisStr.append(str.substring(0, str.indexOf(";"))).append(";");
}
String endCookie = cookisStr.substring(0, cookisStr.length());
logger.info("endCookie:" + endCookie);
headers.put("Cookie", endCookie);
}
Map<String, Object> post = TjwHttpUtil.sendHttpRequest(sap0282Url, param.toJSONString(), "POST", ContentType.APPLICATION_JSON, headers);
String resData = (String) post.get("data");
JSONObject result = JSONObject.parseObject(resData);
String code = result.getString("RETURN_CODE");
if("S".equals(code)){
String updateSql = "update " + tableName + " set "+fkpzhColumnName+"= ?,"+fkrqColumnName+" = ? where "+hjndColumnName+" = ? and "+pzhColumnName+" = ? and "+gsdmColumnName+" = ?";
JSONArray RETURN_RESULT = result.getJSONArray("RETURN_RESULT");
for(int x = 0;x < RETURN_RESULT.size(); x++){
JSONObject oo = RETURN_RESULT.getJSONObject(x);
String GJAHR = oo.getString("GJAHR");
String BUKRS = oo.getString("BUKRS");
String BELNR = oo.getString("BELNR");
String EXTENDBY1 = oo.getString("EXTENDBY1");
String EXTENDBY2 = oo.getString("EXTENDBY2");
DaoUtil.updateData(rs,updateSql,EXTENDBY2,EXTENDBY1,GJAHR,BELNR,BUKRS);
}
}
logger.info(this.getClass() + " end");
}catch (Throwable e){
logger.error(this.getClass() + " exception;message:" + e.getMessage() + ";e:" + e);
}
}
}

View File

@ -0,0 +1,35 @@
package com.api.taojw.fute.util;
import com.alibaba.fastjson.JSONObject;
import org.apache.http.entity.ContentType;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.taojw.common.CommonSqlUtil;
import weaver.taojw.common.TjwHttpUtil;
import weaver.taojw.common.logging.MyLogger;
import java.util.HashMap;
import java.util.Map;
public class FuteHttpUtil {
static Logger logger = MyLogger.getLogger();
//福特获取token
public static String getToken(){
RecordSet rs = new RecordSet();
String tokenUrl = CommonSqlUtil.getSystemParamValue("tokenUrl",rs);
String client_id = CommonSqlUtil.getSystemParamValue("client_id",rs);
String grant_type = CommonSqlUtil.getSystemParamValue("grant_type",rs);
String client_secret = CommonSqlUtil.getSystemParamValue("client_secret",rs);
Map<String,String> headers = new HashMap<>();
headers.put("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
Map<String, Object> post = TjwHttpUtil.sendHttpRequest(tokenUrl, "client_id=" + client_id + "&grant_type=" + grant_type + "&client_secret=" + client_secret, "POST", ContentType.APPLICATION_FORM_URLENCODED, headers);
String data = (String) post.get("data");
JSONObject result = JSONObject.parseObject(data);
String access_token = result.getString("access_token");
logger.info("token:" + access_token);
return access_token;
}
}

View File

@ -0,0 +1,70 @@
package com.api.taojw.fute.util;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.taojw.common.CommonSqlUtil;
import weaver.taojw.common.logging.MyLogger;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.security.PublicKey;
import java.security.Signature;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.Base64;
public class SignUtil {
static Logger logger = MyLogger.getLogger();
public static boolean checkSign(String body,String headerString){
try{
logger.info("SignUtil.checkSign begin;body:" + body + ";headerString:" + headerString);
RecordSet rs = new RecordSet();
String publicKeyPath = CommonSqlUtil.getSystemParamValue("sapPublicKeyPath",rs);
//CertificateFactory certificatefactory= CertificateFactory.getInstance("X.509");
//FileInputStream fis = new FileInputStream(publicKeyPath);
//X509Certificate Cert = (X509Certificate)certificatefactory.generateCertificate(fis);
//PublicKey pk = Cert.getPublicKey();
PublicKey pk = readPublic(publicKeyPath);
Signature sign = Signature.getInstance("SHA256withRSA");
sign.initVerify(pk);
sign.update(body.getBytes("UTF-8"));
boolean result = sign.verify(Base64.getDecoder().decode(headerString));
logger.info("SignUtil.checkSign end;result:" + result);
return result;
}catch (Throwable e){
logger.error("SignUtil.checkSign exception;body:" + body + ";headerString:" + headerString + ";message:" + e.getMessage() + ";e:" + e);
return false;
}
}
public static PublicKey readPublic(String publicKeyPath){
if(publicKeyPath==null){
return null;
}
PublicKey pk = null;
FileInputStream bais = null;
try {
CertificateFactory certificatefactory = CertificateFactory.getInstance("X.509");
bais = new FileInputStream(publicKeyPath);
X509Certificate cert = (X509Certificate)certificatefactory.generateCertificate(bais);
pk = cert.getPublicKey();
} catch (CertificateException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
} finally{
if(bais != null){
try {
bais.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return pk;
}
}

View File

@ -0,0 +1,67 @@
package com.api.taojw.huifeng;
import java.util.HashMap;
import java.util.Map;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.logging.MyLogger;
/**
*
*
*
* class
* class
* java
* @author Administrator
*
*/
public class CusModeExpand extends AbstractModeExpandJavaCodeNew {
Logger logger = MyLogger.getLogger();
/**
*
* @param param
* param()
* user
* importtype () 1 2,3(int)param.get("importtype")
* ()a=1param.get("a")
* b=2,param.get("b")
* @return
*/
public Map<String, String> doModeExpand(Map<String, Object> param) {
Map<String, String> result = new HashMap<String, String>();
try{
RecordSet rs = new RecordSet();
String sql =
"update " +
"uf_deposit_pricing a," +
"uf_Daily_VOF b " +
"set " +
"a.lossmakingcontrol = " +
"case when a.customergroupgbcmb='CMB' then " +
"(case when b.allin1-a.pricing<0 then 0 else 1 end) " +
"else " +
"(case when b. allin-a.pricing<0 then 0 else 1 end) end," +
"a.dailynimupdate = " +
"case a.customergroupgbcmb " +
"when 'CMB' then b.allin1-a.pricing " +
"else b.allin-a.pricing end " +
"where " +
"a.depositcurrency = b.depositcurrency " +
"and a.vofdy=b.deposittype " +
"and a.pricingstatus not in (0,3,4) " +
"and a.pricingvaluedate != curdate()";
DaoUtil.updateData(rs,sql);
}catch(Exception e){
logger.error("DealDailyVofCronJob exception;message:" + e.getMessage() + ";e:" + e);
}
return result;
}
}

View File

@ -0,0 +1,100 @@
package com.api.taojw.huifeng;
import com.alibaba.fastjson.JSONObject;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.TjwWorkFlowUtil;
import weaver.taojw.common.logging.MyLogger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
*
* api
*/
@Path("/huifengtjw")
public class MultiSubmitApi {
Logger logger = MyLogger.getLogger();
@GET
@Path("/multiSubmitApi")
@Produces(MediaType.APPLICATION_JSON)
public String multiSubmitApi(@Context HttpServletRequest request, @Context HttpServletResponse response){
//响应数据
JSONObject result = new JSONObject();
try{
logger.info("MultiSubmitApi.multiSubmitApi begin;");
//建模表名
String tableName = Util.null2String(request.getParameter("tableName"));
//字段名称
String requestIdColumnName = Util.null2String(request.getParameter("requestIdColumnName"));
//勾选的id
String selectedIds = Util.null2String(request.getParameter("selectedIds"));
logger.info("MultiSubmitApi.multiSubmitApi begin;tableName:" + tableName + ";requestIdColumnName:" + requestIdColumnName + ";selectedIds:" + selectedIds);
RecordSet rs = new RecordSet();
String getRequestIdSql =
"select " +
requestIdColumnName + " as requestid " +
"from " +
tableName + " " +
"where " +
"id = ?";
String[] selectedIdArr = selectedIds.split(",");
if(selectedIdArr == null || selectedIdArr.length == 0){
result.put("code","0");
result.put("message","未勾选记录");
return result.toJSONString();
}
int successCount = 0;
int failCount = 0;
List<String> failedRequestIdList = new ArrayList<>();
User user = HrmUserVarify.getUser(request, response);
for(String selectedId : selectedIdArr){
String requestId = "";
try{
Map<String, String> firstData = DaoUtil.getFirstData(rs, getRequestIdSql, selectedId);
requestId = firstData.get("requestid");
boolean submitSuccess = TjwWorkFlowUtil.submitWorkFlow(Integer.parseInt(requestId), user.getUID());
if(submitSuccess){
successCount++;
}else{
failedRequestIdList.add(requestId);
failCount++;
}
}catch(Exception e){
failCount++;
logger.error("MultiSubmitApi.multiSubmitApi.submitWorkFlow exception;requestId:" + requestId + "message:" + e.getMessage() + ";e:" + e);
}
}
if(failCount > 0){
result.put("code","1");
//result.put("message","批量提交完成;其中"+failCount+"条流程提交失败requestId分别为:" + failedRequestIdList);
result.put("message","批量提交完成;其中"+failCount+"条流程提交失败,请联系管理员!");
}else{
result.put("code","2");
result.put("message","批量提交完成;共"+successCount+"条流程全部提交成功。");
}
logger.info("MultiSubmitApi.multiSubmitApi done;result:" + result.toJSONString());
return result.toJSONString();
}catch(Exception e){
logger.error("MultiSubmitApi.multiSubmitApi exception;message:" + e.getMessage() + ";e:" + e);
return result.toJSONString();
}
}
}

View File

@ -0,0 +1,154 @@
package com.api.taojw.huifeng;
import com.alibaba.fastjson.JSONObject;
import org.apache.log4j.Logger;
import weaver.general.Util;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.logging.MyLogger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.Map;
/**
*
*/
@Path("/huifengtjwcheck")
public class WorkFlowCheckApi {
Logger logger = MyLogger.getLogger();
@GET
@Path("/getCountData")
@Produces(MediaType.APPLICATION_JSON)
public String getCountData(@Context HttpServletRequest request, @Context HttpServletResponse response){
//响应数据
JSONObject result = new JSONObject();
try{
logger.info("WorkFlowCheckApi.getData begin;");
String customerid = Util.null2String(request.getParameter("customerid"));
String deposittype = Util.null2String(request.getParameter("deposittype"));
String depositcurrency = Util.null2String(request.getParameter("depositcurrency"));
String accounttype = Util.null2String(request.getParameter("accounttype"));
String customertype = Util.null2String(request.getParameter("customertype"));
logger.info("customerid:" + customerid + ";deposittype:" + deposittype + ";depositcurrency:" + depositcurrency + ";accounttype:" + accounttype + ";customertype:" + customertype);
String getDataSql =
"select count(1) as c from uf_deposit_pricing where customerid = ? and deposittype = ? and depositcurrency = ? and accounttype = ? and customertype = ? and status != 0";
Map<String, String> firstData = DaoUtil.getFirstData(getDataSql, customerid, deposittype, depositcurrency, accounttype, customertype);
String count = firstData.get("c");
result.put("count",count);
logger.info("WorkFlowCheckApi.getData done;result:" + result.toJSONString());
return result.toJSONString();
}catch(Exception e){
logger.error("WorkFlowCheckApi.getData exception;message:" + e.getMessage() + ";e:" + e);
return result.toJSONString();
}
}
@GET
@Path("/getBaseRate")
@Produces(MediaType.APPLICATION_JSON)
public String getBaseRate(@Context HttpServletRequest request, @Context HttpServletResponse response){
//响应数据
JSONObject result = new JSONObject();
try{
logger.info("WorkFlowCheckApi.getData begin;");
String customerid = Util.null2String(request.getParameter("customerid"));
String deposittype = Util.null2String(request.getParameter("deposittype"));
String depositcurrency = Util.null2String(request.getParameter("depositcurrency"));
String period = Util.null2String(request.getParameter("period"));
logger.info("customerid:" + customerid + ";depositcurrency:" + depositcurrency + ";deposittype:" + deposittype);
if(customerid != null && !"".equals(customerid)){
customerid = customerid.substring(0,3); //292
}
String getIdFromBranchMappingSql =
"select branch from uf_branch_mapping where customerid = ?";
Map<String, String> idFromBranchMapping = DaoUtil.getFirstData(getIdFromBranchMappingSql, customerid);
String idFromBranch = idFromBranchMapping.get("branch"); //58
String getPbocfhFromBranchBankSql =
"select pbocfh from uf_branch_bank where id = ?";
Map<String, String> pbocfhMapping = DaoUtil.getFirstData(getPbocfhFromBranchBankSql, idFromBranch);
String pbocfh = pbocfhMapping.get("pbocfh"); //1
String getPbocSql =
"select pboc from uf_pboclistrmb where convert(depositcurrency,char) = ? and convert(deposittype,char) = ? and convert(timedeposit,char) = ?";
Map<String, String> pbocMapping = DaoUtil.getFirstData(getPbocSql, depositcurrency,deposittype,period);
String pboc = Util.null2String(pbocMapping.get("pboc")); //2
String column = "";
switch (pboc){
case "0":
column = "casa";
break;
case "1":
column = "contractsavings";
break;
case "2":
column = "normal7daycall";
break;
case "3":
column = "daycallplus";
break;
case "4":
column = "mtmd3";
break;
case "5":
column = "mtmd6";
break;
case "6":
column = "ytmd1";
break;
case "7":
column = "ytmd2";
break;
case "8":
column = "ytmd3";
break;
case "9":
column = "mcd1";
break;
case "10":
column = "mcd3";
break;
case "11":
column = "mcd6";
break;
case "12":
column = "mcd9";
break;
case "13":
column = "ycd1";
break;
case "14":
column = "mcd18";
break;
case "15":
column = "ycd2";
break;
case "16":
column = "ycd3";
break;
default:
break;
}
String baseRate = "";
if(!"".equals(column)){ //normal7daycall
String getBaseRateSql =
"select " + column + " from uf_pboc_base_rate where branch = ?";
Map<String, String> firstData = DaoUtil.getFirstData(getBaseRateSql, pbocfh);
baseRate = firstData.get(column);
}
result.put("baseRate",baseRate);
logger.info("WorkFlowCheckApi.getData done;result:" + result.toJSONString());
return result.toJSONString();
}catch(Exception e){
logger.error("WorkFlowCheckApi.getData exception;message:" + e.getMessage() + ";e:" + e);
return result.toJSONString();
}
}
}

View File

@ -0,0 +1,235 @@
package com.api.taojw.huifeng.action;
import freemarker.template.Configuration;
import freemarker.template.Template;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.email.EmailWorkRunnable;
import weaver.general.TimeUtil;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.TjwDocumentUtil;
import weaver.taojw.common.WorkFlowDataToJsonUtil;
import weaver.taojw.common.logging.MyLogger;
import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* word
*/
public class CreateDocAction implements Action {
public String getIsTest() {
return isTest;
}
public void setIsTest(String isTest) {
this.isTest = isTest;
}
private String isTest = "";
private String condition = "";
private String pzbss = "";
private String eamilPersonColumn = "";
private String mailTitle = "";
private String mailTitleColumns = "";
public String getMailTitleColumns() {
return mailTitleColumns;
}
public void setMailTitleColumns(String mailTitleColumns) {
this.mailTitleColumns = mailTitleColumns;
}
private String mailContent = "";
public String getPzbss() {
return pzbss;
}
public void setPzbss(String pzbss) {
this.pzbss = pzbss;
}
public String getEamilPersonColumn() {
return eamilPersonColumn;
}
public void setEamilPersonColumn(String eamilPersonColumn) {
this.eamilPersonColumn = eamilPersonColumn;
}
public String getMailTitle() {
return mailTitle;
}
public void setMailTitle(String mailTitle) {
this.mailTitle = mailTitle;
}
public String getMailContent() {
return mailContent;
}
public void setMailContent(String mailContent) {
this.mailContent = mailContent;
}
public String getCondition() {
return condition;
}
public void setCondition(String condition) {
this.condition = condition;
}
Logger logger = MyLogger.getLogger();
@Override
public String execute(RequestInfo requestInfo) {
String requestId = requestInfo.getRequestid();
String currentDate = TimeUtil.getCurrentDateString();
String currentTime = TimeUtil.getOnlyCurrentTimeString();
String tableName = requestInfo.getRequestManager().getBillTableName();
RecordSet rs = new RecordSet();
try{
logger.info("CreateDocAction begin;requestId:" + requestId + ";pzbss:" + pzbss);
String getMainTableDataSql =
"select * from " + tableName + " where requestid = ?";
Map<String,String> mainTableData = DaoUtil.getFirstData(rs,getMainTableDataSql,requestId);
//获取明细行
String getDetailDataSql =
"select * from " + tableName + "_dt1 where mainid = (select id from " + tableName + " where requestid = ? )";
if(condition != null && !"".equals(condition)){
getDetailDataSql = getDetailDataSql + condition;
}
List<Map<String, String>> data = DaoUtil.getData(rs, getDetailDataSql, requestId);
//配置id
String[] pzbsArr = pzbss.split(",");
//邮件人员字段
String[] eamilPersonColumnArr = eamilPersonColumn.split(",");
EmailWorkRunnable emailSender = new EmailWorkRunnable();
//遍历明细行 每行数据生成两个文件 将生成的文件以附件形式发送邮件给明细行里的用户
for(Map<String, String> detailData : data){
//生成文件
String imageFileIds = "";
for(String pzbs : pzbsArr){
Map<String, Object> docFile = createDocFile(pzbs, mainTableData, detailData);
String imageFileId = docFile.get("imageFileId") + "";
imageFileIds = imageFileIds + imageFileId + ",";
}
imageFileIds = imageFileIds.substring(0,imageFileIds.length() - 1);
//右键标题处理
logger.info("mailTitle:" + mailTitle);
String thisMailTitle = new String(mailTitle);
logger.info("thisMailTitle begin:" + thisMailTitle);
if(mailTitleColumns != null && !"".equals(mailTitleColumns)){
String[] mailTitleColumnsArr = mailTitleColumns.split(",");
for(String col : mailTitleColumnsArr){
thisMailTitle = thisMailTitle.replaceAll(col,detailData.get(col));
}
}
logger.info("thisMailTitle end:" + thisMailTitle);
//获取要发送邮件的email
List<String> emails = new ArrayList<>();
for(String eamilPersonCol : eamilPersonColumnArr){
String emailPerson = detailData.get(eamilPersonCol);
String getPersonEmailSql = "select email from hrmresource where id = ?";
String email = DaoUtil.getFirstData(getPersonEmailSql,emailPerson).get("email");
emails.add(email);
}
//发送邮件
logger.info("send email begin;email:" + StringUtils.join(emails, ",") + ";imageFileIds:" + imageFileIds);
emailSender.threadModeReminder(StringUtils.join(emails, ","),"","", thisMailTitle, mailContent,imageFileIds);
}
}catch(Exception e){
logger.error("CreateDocAction exception;message:" + e.getMessage() + ";e:" + e);
//阻止流程提交,提示语句
requestInfo.getRequestManager().setMessageid(currentDate + currentTime);
requestInfo.getRequestManager().setMessagecontent("send email exception;requestId:"+ requestInfo.getRequestid() +"!");
return Action.FAILURE_AND_CONTINUE;
}
return Action.SUCCESS;
}
private Map<String,Object> createDocFile(String pzbs,Map<String,String> mainTableData,Map<String, String> detailTableData){
Map<String,Object> result = new HashMap<>();
try{
//获取配置信息
String getConfigDataSql =
"select id,scdwordwjmc,ftlmbwjcflj,ftlmbwjmc,wordwjmccs from uf_hfyhmxsjscwordpz where pzbs = ?";
Map<String, String> mainConfigData = DaoUtil.getFirstData(getConfigDataSql, pzbs);
String configId = mainConfigData.get("id");
String fileName = mainConfigData.get("scdwordwjmc");
String wordwjmccs = mainConfigData.get("wordwjmccs");
if(wordwjmccs != null && !"".equals(wordwjmccs)){
String[] wordwjmccsArr = wordwjmccs.split(",");
for(String col : wordwjmccsArr){
fileName = fileName.replaceAll(col,detailTableData.get(col));
}
}
String getDetailConfigDataSql =
"select mbbqbs,bdzdsjkmc,bdzdgz,zhgz,zdysql from uf_hfyhmxsjscwordpz_dt1 where mainid = ?";
List<Map<String, String>> data = DaoUtil.getData(getDetailConfigDataSql, configId);
//根据配置信息将明细表中的数据封装为map 用于生成doc文件
HashMap<String, Object> paramsMap = new HashMap<>();
for(Map<String, String> configData : data){
String mbbqbs = configData.get("mbbqbs");
String bdzdgz = configData.get("bdzdgz");
String bdzdsjkmc = configData.get("bdzdsjkmc");
configData.put("requestId",mainTableData.get("requestid"));
String oldValue = "";
if("".equals(bdzdgz) || bdzdgz == null || "0".equals(bdzdgz)){
oldValue = mainTableData.get(bdzdsjkmc);
}else{
oldValue = detailTableData.get(bdzdsjkmc);
}
String value = WorkFlowDataToJsonUtil.convertDataByZhgz(oldValue,configData);
paramsMap.put(mbbqbs,value);
}
//生产word
File templateFile = null;
Template template4CN = null;
Configuration cfg = new Configuration();
File docFile = new File(fileName);
OutputStream ops = new FileOutputStream(docFile);
Writer writer = new OutputStreamWriter(ops, "utf-8");
cfg.setDefaultEncoding("UTF-8");
templateFile = new File(mainConfigData.get("ftlmbwjcflj"));
cfg.setDirectoryForTemplateLoading(templateFile);
template4CN = cfg.getTemplate(mainConfigData.get("ftlmbwjmc"));
template4CN.process(paramsMap, writer);
ops.close();
writer.close();
//返回
FileInputStream fis = new FileInputStream(docFile);
int imageFileId = TjwDocumentUtil.createFileByInputSteam(fis, fileName);
result.put("fileName",fileName);
result.put("imageFileId",imageFileId);
try{
fis.close();
}catch(Exception e){
logger.error("createDocFile close file exception;message:" + e.getMessage() + ";e:" + e);
}
try {
docFile.delete();
} catch (Exception e) {
logger.error("createDocFile delete file exception;message:" + e.getMessage() + ";e:" + e);
}
return result;
}catch (Exception e){
logger.error("createDocFile exception;message:" + e.getMessage() + ";e:" + e);
return result;
}
}
}

View File

@ -0,0 +1,260 @@
package com.api.taojw.huifeng.action;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.general.TimeUtil;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.logging.MyLogger;
import java.util.List;
import java.util.Map;
/**
*
* 1uf_deposit_pricingpricingstatus !=0
* 1.1 customerid+accounttype+customertype+deposittype+depositcurrency
* pricingvaluedatepricingvaluedatepricingstatus=3,
*
* 1.2 1.1pricingstatuspricingstatus !=0 or 3
* -pricingvaluedate>365,pricingstatus=2,
* -pricingvaluedate<=365,pricingstatus=1
*/
public class DealModelDataAction implements Action {
Logger logger = MyLogger.getLogger();
@Override
public String execute(RequestInfo requestInfo) {
String requestId = requestInfo.getRequestid();
String currentDate = TimeUtil.getCurrentDateString();
String currentTime = TimeUtil.getOnlyCurrentTimeString();
RecordSet rs = new RecordSet();
try{
logger.info("DealModelDataAction begin;requestId:" + requestId);
String getMoreThenOneByFiveColumnsSql =
"select customerid,accounttype,customertype,deposittype,depositcurrency,max(pricingvaluedate) as pricingvaluedate from uf_deposit_pricing where ((pricingstatus !=0 and pricingstatus != 3) or pricingstatus is null) group by customerid,accounttype,customertype,deposittype,depositcurrency having count(1) > 1 ";
List<Map<String, String>> data = DaoUtil.getData(rs, getMoreThenOneByFiveColumnsSql);
logger.info("data.count:" + data.size());
String updateOnlyOneMaxDateToThreeSql =
"update uf_deposit_pricing set " +
"pricingstatus = ? " +
"where " +
"customerid = ? " +
"and accounttype = ? " +
"and customertype = ? " +
"and deposittype = ? " +
"and depositcurrency = ? " +
"and pricingvaluedate != ? ";
//
String updateMoreThenOneMaxDateToThreeSql =
"update uf_deposit_pricing set " +
"pricingstatus = ? " +
"where " +
"customerid = ? " +
"and accounttype = ? " +
"and customertype = ? " +
"and deposittype = ? " +
"and depositcurrency = ? " +
"and gxsj != ?";
String getMaxDateCountSql =
"select " +
"count(1) as c,MAX(gxsj) AS gxsj " +
"from " +
"uf_deposit_pricing " +
"where " +
"customerid = ? " +
"and accounttype = ? " +
"and customertype = ? " +
"and deposittype = ? " +
"and depositcurrency = ? " +
"and pricingvaluedate = ? ";
//建模表中customerid+accounttype+customertype+deposittype+depositcurrency相同的数据中如果只有多条数据将除了pricingvaluedate最新的一条之外的所有数据赋值pricingstatus=3
for(Map<String, String> m : data){
Map<String, String> firstData = DaoUtil.getFirstData(rs, getMaxDateCountSql,
m.get("customerid"),
m.get("accounttype"),
m.get("customertype"),
m.get("deposittype"),
m.get("depositcurrency"),
m.get("pricingvaluedate"));
String c = firstData.get("c");
String gxsj = firstData.get("gxsj");
logger.info("c:" + c + ";gxsj:" + gxsj +
";customerid:" + m.get("customerid") +
";accounttype:" + m.get("accounttype") +
";customertype:" + m.get("customertype") +
";deposittype:" + m.get("deposittype") +
";depositcurrency:" + m.get("depositcurrency") +
";pricingvaluedate:" + m.get("pricingvaluedate")
);
if(Integer.parseInt(c) == 1){
DaoUtil.updateData(rs,updateOnlyOneMaxDateToThreeSql,"3",
m.get("customerid"),
m.get("accounttype"),
m.get("customertype"),
m.get("deposittype"),
m.get("depositcurrency"),
m.get("pricingvaluedate")
);
}else{
DaoUtil.updateData(rs,updateMoreThenOneMaxDateToThreeSql,"3",
m.get("customerid"),
m.get("accounttype"),
m.get("customertype"),
m.get("deposittype"),
m.get("depositcurrency"),
gxsj
);
}
}
//建模表中customerid+accounttype+customertype+deposittype+depositcurrency相同的数据中如果只有多条数据pricingvaluedate最新的一条的数据
//当前日期-pricingvaluedate<=365,赋值pricingstatus=1 当前日期-pricingvaluedate>365,赋值pricingstatus=2
String updateOnlyOneMaxDateMaxSql =
"update uf_deposit_pricing set " +
"pricingstatus = case when expirationdate <= curdate() then 2 else 1 end " +
"where " +
"customerid = ? " +
"and accounttype = ? " +
"and customertype = ? " +
"and deposittype = ? " +
"and depositcurrency = ? " +
"and pricingvaluedate = ? ";
String updateMoreThenOneMaxDateMaxSql =
"update uf_deposit_pricing set " +
"pricingstatus = case when expirationdate <= curdate() then 2 else 1 end " +
"where " +
"customerid = ? " +
"and accounttype = ? " +
"and customertype = ? " +
"and deposittype = ? " +
"and depositcurrency = ? " +
"and pricingvaluedate = ? " +
"and gxsj = ?";
for(Map<String, String> m : data){
Map<String, String> firstData = DaoUtil.getFirstData(rs, getMaxDateCountSql,
m.get("customerid"),
m.get("accounttype"),
m.get("customertype"),
m.get("deposittype"),
m.get("depositcurrency"),
m.get("pricingvaluedate"));
String c = firstData.get("c");
String gxsj = firstData.get("gxsj");
if(Integer.parseInt(c) == 1){
if(!DaoUtil.updateData(rs,updateOnlyOneMaxDateMaxSql,
m.get("customerid"),
m.get("accounttype"),
m.get("customertype"),
m.get("deposittype"),
m.get("depositcurrency"),
m.get("pricingvaluedate")
)){
logger.error("updateOnlyOneMaxDateMaxSql error:" + updateOnlyOneMaxDateMaxSql + ";" +
"customerid:" + m.get("customerid") +
";accounttype:" + m.get("accounttype") +
";customertype:" + m.get("customertype") +
";deposittype:" + m.get("deposittype") +
";depositcurrency:" + m.get("depositcurrency") +
";pricingvaluedate:" + m.get("pricingvaluedate")
);
}
}else{
if(!DaoUtil.updateData(rs,updateMoreThenOneMaxDateMaxSql,
m.get("customerid"),
m.get("accounttype"),
m.get("customertype"),
m.get("deposittype"),
m.get("depositcurrency"),
m.get("pricingvaluedate"),
gxsj
)){
logger.error("updateMoreThenOneMaxDateMaxSql error:" + updateMoreThenOneMaxDateMaxSql + ";" +
"customerid:" + m.get("customerid") +
";accounttype:" + m.get("accounttype") +
";customertype:" + m.get("customertype") +
";deposittype:" + m.get("deposittype") +
";depositcurrency:" + m.get("depositcurrency") +
";pricingvaluedate:" + m.get("pricingvaluedate")
);
}
}
}
//建模表中customerid+accounttype+customertype+deposittype+depositcurrency相同的数据中中只有一条数据
//当前日期-pricingvaluedate<=365,赋值pricingstatus=1 当前日期-pricingvaluedate>365,赋值pricingstatus=2
String getUnSetDataSql =
"select customerid,accounttype,customertype,deposittype,depositcurrency from uf_deposit_pricing group by customerid,accounttype,customertype,deposittype,depositcurrency having count(1) = 1 ";
String updateDataSql2 =
"update uf_deposit_pricing set " +
"pricingstatus = case when expirationdate <= curdate() then 2 else 1 end " +
"where " +
"customerid = ? " +
"and accounttype = ? " +
"and customertype = ? " +
"and deposittype = ? " +
"and depositcurrency = ? ";
List<Map<String, String>> data1 = DaoUtil.getData(rs, getUnSetDataSql);
for(Map<String, String> m : data1){
if(!DaoUtil.updateData(rs,updateDataSql2,
m.get("customerid"),
m.get("accounttype"),
m.get("customertype"),
m.get("deposittype"),
m.get("depositcurrency")
)){
logger.info("updateDataSql2 error:" + updateDataSql2 + ";" +
"customerid:" + m.get("customerid") +
";accounttype:" + m.get("accounttype") +
";customertype:" + m.get("customertype") +
";deposittype:" + m.get("deposittype") +
";depositcurrency:" + m.get("depositcurrency")
);
}
}
//pricingstatus !=0 or 3的数据
//当前日期-pricingvaluedate>365,赋值pricingstatus=2, 当前日期-pricingvaluedate<=365,赋值pricingstatus=1
String updateByStatusSql =
/*"update uf_deposit_pricing set " +
"pricingstatus = case when DATEDIFF(NOW(), pricingvaluedate) <= 365 then 1 else 2 end " +
"where " +
"((pricingstatus !=0 and pricingstatus != 3 and pricingstatus != 4 and pricingstatus != 5) or pricingstatus is null)";*/
"update uf_deposit_pricing set " +
"pricingstatus = case when expirationdate <= curdate() then 2 else 1 end " +
"where " +
"((pricingstatus !=0 and pricingstatus != 3 and pricingstatus != 4 and pricingstatus != 5 and pricingstatus != 6) or pricingstatus is null)";
if(!DaoUtil.updateData(rs,updateByStatusSql)){
logger.error("updateByStatusSql error:" + updateByStatusSql + ";");
}
//
String updateSql1 = "update uf_deposit_pricing set pricingstatus=6 where lossmakingcontrol=0 and pricingstatus=1 and pricingvaluedate != curdate()";
String updateSql2 = "update uf_deposit_pricing set pricingstatus=1 where lossmakingcontrol=1 and pricingstatus=6 and pricingvaluedate != curdate()";
DaoUtil.updateData(rs,updateSql1);
DaoUtil.updateData(rs,updateSql2);
logger.info("updateSql1:" + updateSql1);
logger.info("updateSql2:" + updateSql2);
logger.info("updateOnlyOneMaxDateToThreeSql:" + updateOnlyOneMaxDateToThreeSql);
logger.info("updateMoreThenOneMaxDateToThreeSql:" + updateMoreThenOneMaxDateToThreeSql);
logger.info("getMaxDateCountSql:" + getMaxDateCountSql);
logger.info("updateOnlyOneMaxDateMaxSql:" + updateOnlyOneMaxDateMaxSql);
logger.info("updateMoreThenOneMaxDateMaxSql:" + updateMoreThenOneMaxDateMaxSql);
logger.info("getUnSetDataSql:" + getUnSetDataSql);
logger.info("updateDataSql2:" + updateDataSql2);
logger.info("updateByStatusSql:" + updateByStatusSql);
logger.info("getMoreThenOneByFiveColumnsSql:" + getMoreThenOneByFiveColumnsSql);
}catch(Exception e){
logger.error("DealModelDataAction exception;message:" + e.getMessage() + ";e:" + e);
//阻止流程提交,提示语句
requestInfo.getRequestManager().setMessageid(currentDate + currentTime);
requestInfo.getRequestManager().setMessagecontent("DealModelDataAction exception;requestId:"+ requestId +"!");
return Action.FAILURE_AND_CONTINUE;
}
return Action.SUCCESS;
}
}

View File

@ -0,0 +1,80 @@
package com.api.taojw.huifeng.cronjob;
import org.apache.log4j.Logger;
import weaver.taojw.common.logging.MyLogger;
import java.io.*;
import java.util.List;
public class CreateCsvUtil {
static Logger logger = MyLogger.getLogger();
/**
* CSV
* @param head
* @param dataList
* @param outPutPath
* @param filename
* @return
*/
public static File createCSVFile(List<Object> head, List<List<Object>> dataList, String outPutPath, String filename) {
File csvFile = null;
BufferedWriter csvWtriter = null;
try {
csvFile = new File(outPutPath + File.separator + filename + ".csv");
File parent = csvFile.getParentFile();
if (parent != null && !parent.exists()) {
parent.mkdirs();
}
csvFile.createNewFile();
csvWtriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(csvFile), "UTF-8"), 1024);
// 写入文件头部
writeRow(head, csvWtriter);
csvWtriter.newLine();
// 写入文件内容
for(int i = 0;i < dataList.size() ;i ++){
if(i == 0){
writeRow(dataList.get(i), csvWtriter);
}else{
csvWtriter.newLine();
writeRow(dataList.get(i), csvWtriter);
}
}
csvWtriter.flush();
} catch (Exception e) {
logger.error("CreateCsvUtil.createCSVFile exception;fileName:" + filename + ";message:" + e.getMessage() + ";e:" + e);
} finally {
try {
csvWtriter.close();
} catch (IOException e) {
logger.error("CreateCsvUtil.createCSVFile.close exception;fileName:" + filename + ";message:" + e.getMessage() + ";e:" + e);
}
}
return csvFile;
}
/**
*
* @param row
* @param csvWriter
* @throws IOException
*/
public static void writeRow(List<Object> row, BufferedWriter csvWriter) throws IOException {
for(int i = 0;i < row.size(); i ++){
Object data = row.get(i);
if(i == row.size() - 1){
StringBuffer sb = new StringBuffer();
/*String rowStr = sb.append("\"").append(data).append("\"|").toString();*/
String rowStr = sb.append(data).toString();
csvWriter.write(rowStr);
}else{
StringBuffer sb = new StringBuffer();
/*String rowStr = sb.append("\"").append(data).append("\"|").toString();*/
String rowStr = sb.append(data).append("|").toString();
csvWriter.write(rowStr);
}
}
}
}

View File

@ -0,0 +1,44 @@
package com.api.taojw.huifeng.cronjob;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.interfaces.schedule.BaseCronJob;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.logging.MyLogger;
public class DealDailyVofCronJob extends BaseCronJob {
Logger logger = MyLogger.getLogger();
@Override
public void execute() {
try{
RecordSet rs = new RecordSet();
String sql =
"update " +
"uf_deposit_pricing a," +
"uf_Daily_VOF b " +
"set " +
"a.lossmakingcontrol = " +
"case when a.customergroupgbcmb='CMB' then " +
"(case when b.allin1-a.pricing<0 then 0 else 1 end) " +
"else " +
"(case when b. allin-a.pricing<0 then 0 else 1 end) end," +
"a.dailynimupdate = " +
"case a.customergroupgbcmb " +
"when 'CMB' then b.allin1-a.pricing " +
"else b.allin-a.pricing end " +
"where " +
"a.depositcurrency = b.depositcurrency " +
"and a.vofdy=b.deposittype " +
"and a.pricingstatus not in (0,3,4) " +
"and a.pricingvaluedate != curdate()";
DaoUtil.updateData(rs,sql);
}catch(Exception e){
logger.error("DealDailyVofCronJob exception;message:" + e.getMessage() + ";e:" + e);
}
}
}

View File

@ -0,0 +1,244 @@
package com.api.taojw.huifeng.cronjob;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.general.TimeUtil;
import weaver.interfaces.schedule.BaseCronJob;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.logging.MyLogger;
import java.util.*;
public class DealModelDataCronJob extends BaseCronJob {
Logger logger = MyLogger.getLogger();
@Override
public void execute() {
String currentDate = TimeUtil.getCurrentDateString();
String currentTime = TimeUtil.getOnlyCurrentTimeString();
RecordSet rs = new RecordSet();
try{
logger.info("DealModelDataCronJob begin;");
String getMoreThenOneByFiveColumnsSql =
"select customerid,accounttype,customertype,deposittype,depositcurrency,max(pricingvaluedate) as pricingvaluedate from uf_deposit_pricing where ((pricingstatus !=0 and pricingstatus != 3) or pricingstatus is null) group by customerid,accounttype,customertype,deposittype,depositcurrency having count(1) > 1 ";
List<Map<String, String>> data = DaoUtil.getData(rs, getMoreThenOneByFiveColumnsSql);
logger.info("data.count:" + data.size());
String updateOnlyOneMaxDateToThreeSql =
"update uf_deposit_pricing set " +
"pricingstatus = ? " +
"where " +
"customerid = ? " +
"and accounttype = ? " +
"and customertype = ? " +
"and deposittype = ? " +
"and depositcurrency = ? " +
"and pricingvaluedate != ? ";
//
String updateMoreThenOneMaxDateToThreeSql =
"update uf_deposit_pricing set " +
"pricingstatus = ? " +
"where " +
"customerid = ? " +
"and accounttype = ? " +
"and customertype = ? " +
"and deposittype = ? " +
"and depositcurrency = ? " +
"and gxsj != ?";
String getMaxDateCountSql =
"select " +
"count(1) as c,MAX(gxsj) AS gxsj " +
"from " +
"uf_deposit_pricing " +
"where " +
"customerid = ? " +
"and accounttype = ? " +
"and customertype = ? " +
"and deposittype = ? " +
"and depositcurrency = ? " +
"and pricingvaluedate = ? ";
//建模表中customerid+accounttype+customertype+deposittype+depositcurrency相同的数据中如果只有多条数据将除了pricingvaluedate最新的一条之外的所有数据赋值pricingstatus=3
for(Map<String, String> m : data){
Map<String, String> firstData = DaoUtil.getFirstData(rs, getMaxDateCountSql,
m.get("customerid"),
m.get("accounttype"),
m.get("customertype"),
m.get("deposittype"),
m.get("depositcurrency"),
m.get("pricingvaluedate"));
String c = firstData.get("c");
String gxsj = firstData.get("gxsj");
logger.info("c:" + c + ";gxsj:" + gxsj +
";customerid:" + m.get("customerid") +
";accounttype:" + m.get("accounttype") +
";customertype:" + m.get("customertype") +
";deposittype:" + m.get("deposittype") +
";depositcurrency:" + m.get("depositcurrency") +
";pricingvaluedate:" + m.get("pricingvaluedate")
);
if(Integer.parseInt(c) == 1){
DaoUtil.updateData(rs,updateOnlyOneMaxDateToThreeSql,"3",
m.get("customerid"),
m.get("accounttype"),
m.get("customertype"),
m.get("deposittype"),
m.get("depositcurrency"),
m.get("pricingvaluedate")
);
}else{
DaoUtil.updateData(rs,updateMoreThenOneMaxDateToThreeSql,"3",
m.get("customerid"),
m.get("accounttype"),
m.get("customertype"),
m.get("deposittype"),
m.get("depositcurrency"),
gxsj
);
}
}
//建模表中customerid+accounttype+customertype+deposittype+depositcurrency相同的数据中如果只有多条数据pricingvaluedate最新的一条的数据
//当前日期-pricingvaluedate<=365,赋值pricingstatus=1 当前日期-pricingvaluedate>365,赋值pricingstatus=2
String updateOnlyOneMaxDateMaxSql =
"update uf_deposit_pricing set " +
"pricingstatus = case when expirationdate <= curdate() then 2 else 1 end " +
"where " +
"customerid = ? " +
"and accounttype = ? " +
"and customertype = ? " +
"and deposittype = ? " +
"and depositcurrency = ? " +
"and pricingvaluedate = ? ";
String updateMoreThenOneMaxDateMaxSql =
"update uf_deposit_pricing set " +
"pricingstatus = case when expirationdate <= curdate() then 2 else 1 end " +
"where " +
"customerid = ? " +
"and accounttype = ? " +
"and customertype = ? " +
"and deposittype = ? " +
"and depositcurrency = ? " +
"and pricingvaluedate = ? " +
"and gxsj = ?";
for(Map<String, String> m : data){
Map<String, String> firstData = DaoUtil.getFirstData(rs, getMaxDateCountSql,
m.get("customerid"),
m.get("accounttype"),
m.get("customertype"),
m.get("deposittype"),
m.get("depositcurrency"),
m.get("pricingvaluedate"));
String c = firstData.get("c");
String gxsj = firstData.get("gxsj");
if(Integer.parseInt(c) == 1){
if(!DaoUtil.updateData(rs,updateOnlyOneMaxDateMaxSql,
m.get("customerid"),
m.get("accounttype"),
m.get("customertype"),
m.get("deposittype"),
m.get("depositcurrency"),
m.get("pricingvaluedate")
)){
logger.error("updateOnlyOneMaxDateMaxSql error:" + updateOnlyOneMaxDateMaxSql + ";" +
"customerid:" + m.get("customerid") +
";accounttype:" + m.get("accounttype") +
";customertype:" + m.get("customertype") +
";deposittype:" + m.get("deposittype") +
";depositcurrency:" + m.get("depositcurrency") +
";pricingvaluedate:" + m.get("pricingvaluedate")
);
}
}else{
if(!DaoUtil.updateData(rs,updateMoreThenOneMaxDateMaxSql,
m.get("customerid"),
m.get("accounttype"),
m.get("customertype"),
m.get("deposittype"),
m.get("depositcurrency"),
m.get("pricingvaluedate"),
gxsj
)){
logger.error("updateMoreThenOneMaxDateMaxSql error:" + updateMoreThenOneMaxDateMaxSql + ";" +
"customerid:" + m.get("customerid") +
";accounttype:" + m.get("accounttype") +
";customertype:" + m.get("customertype") +
";deposittype:" + m.get("deposittype") +
";depositcurrency:" + m.get("depositcurrency") +
";pricingvaluedate:" + m.get("pricingvaluedate")
);
}
}
}
//建模表中customerid+accounttype+customertype+deposittype+depositcurrency相同的数据中中只有一条数据
//当前日期-pricingvaluedate<=365,赋值pricingstatus=1 当前日期-pricingvaluedate>365,赋值pricingstatus=2
String getUnSetDataSql =
"select customerid,accounttype,customertype,deposittype,depositcurrency from uf_deposit_pricing group by customerid,accounttype,customertype,deposittype,depositcurrency having count(1) = 1 ";
String updateDataSql2 =
"update uf_deposit_pricing set " +
"pricingstatus = case when expirationdate <= curdate() then 2 else 1 end " +
"where " +
"customerid = ? " +
"and accounttype = ? " +
"and customertype = ? " +
"and deposittype = ? " +
"and depositcurrency = ? ";
List<Map<String, String>> data1 = DaoUtil.getData(rs, getUnSetDataSql);
for(Map<String, String> m : data1){
if(!DaoUtil.updateData(rs,updateDataSql2,
m.get("customerid"),
m.get("accounttype"),
m.get("customertype"),
m.get("deposittype"),
m.get("depositcurrency")
)){
logger.info("updateDataSql2 error:" + updateDataSql2 + ";" +
"customerid:" + m.get("customerid") +
";accounttype:" + m.get("accounttype") +
";customertype:" + m.get("customertype") +
";deposittype:" + m.get("deposittype") +
";depositcurrency:" + m.get("depositcurrency")
);
}
}
//pricingstatus !=0 or 3的数据
//当前日期-pricingvaluedate>365,赋值pricingstatus=2, 当前日期-pricingvaluedate<=365,赋值pricingstatus=1
String updateByStatusSql =
/*"update uf_deposit_pricing set " +
"pricingstatus = case when DATEDIFF(NOW(), pricingvaluedate) <= 365 then 1 else 2 end " +
"where " +
"((pricingstatus !=0 and pricingstatus != 3 and pricingstatus != 4 and pricingstatus != 5) or pricingstatus is null)";*/
"update uf_deposit_pricing set " +
"pricingstatus = case when expirationdate <= curdate() then 2 else 1 end " +
"where " +
"((pricingstatus !=0 and pricingstatus != 3 and pricingstatus != 4 and pricingstatus != 5 and pricingstatus != 6) or pricingstatus is null)";
if(!DaoUtil.updateData(rs,updateByStatusSql)){
logger.error("updateByStatusSql error:" + updateByStatusSql + ";");
}
//
String updateSql1 = "update uf_deposit_pricing set pricingstatus=6 where lossmakingcontrol=0 and pricingstatus=1 and pricingvaluedate != curdate()";
String updateSql2 = "update uf_deposit_pricing set pricingstatus=1 where lossmakingcontrol=1 and pricingstatus=6 and pricingvaluedate != curdate()";
DaoUtil.updateData(rs,updateSql1);
DaoUtil.updateData(rs,updateSql2);
logger.info("updateSql1:" + updateSql1);
logger.info("updateSql2:" + updateSql2);
logger.info("updateOnlyOneMaxDateToThreeSql:" + updateOnlyOneMaxDateToThreeSql);
logger.info("updateMoreThenOneMaxDateToThreeSql:" + updateMoreThenOneMaxDateToThreeSql);
logger.info("getMaxDateCountSql:" + getMaxDateCountSql);
logger.info("updateOnlyOneMaxDateMaxSql:" + updateOnlyOneMaxDateMaxSql);
logger.info("updateMoreThenOneMaxDateMaxSql:" + updateMoreThenOneMaxDateMaxSql);
logger.info("getUnSetDataSql:" + getUnSetDataSql);
logger.info("updateDataSql2:" + updateDataSql2);
logger.info("updateByStatusSql:" + updateByStatusSql);
logger.info("getMoreThenOneByFiveColumnsSql:" + getMoreThenOneByFiveColumnsSql);
}catch(Exception e){
logger.error("DealModelDataCronJob exception;message:" + e.getMessage() + ";e:" + e);
}
}
}

View File

@ -0,0 +1,127 @@
package com.api.taojw.huifeng.cronjob;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.formmode.setup.ModeRightInfo;
import weaver.interfaces.schedule.BaseCronJob;
import weaver.taojw.common.CommonSqlUtil;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.logging.MyLogger;
import java.util.List;
import java.util.Map;
public class DealPositCronJob extends BaseCronJob {
Logger logger = MyLogger.getLogger();
public static ModeRightInfo MODE_RIGHT_INFO = new ModeRightInfo();
@Override
public void execute() {
try{
RecordSet rs = new RecordSet();
int modeId = CommonSqlUtil.getModeIdByTableName("uf_deposit_pricing", rs);
String sql =
"update " +
"uf_deposit_pricing a," +
"(" +
"select " +
"b.id as hrmid," +
"c.id as customerid " +
"from " +
"hrmresource b " +
"left join uf_customer c on c.relationshipmanagerstaffid=b.loginid " +
"where " +
"c.relationshipmanagerstaffid is not null" +
") hm " +
"set " +
"a.rmname=hm.hrmid " +
"where " +
"a.customerid=hm.customerid";
sql =
"select " +
"a.id,hm.hrmid " +
"from " +
"uf_deposit_pricing a " +
"(" +
"select " +
"b.id as hrmid," +
"c.id as customerid " +
"from " +
"hrmresource b " +
"left join uf_customer c on c.relationshipmanagerstaffid=b.loginid " +
"where " +
"c.relationshipmanagerstaffid is not null " +
") hm " +
"where " +
"a.customerid=hm.customerid";
String updateSql = "update uf_deposit_pricing set rmname = ? where id = ?";
List<Map<String, String>> data = DaoUtil.getData(rs, sql);
for(Map<String, String> m : data){
String id = m.get("id");
String hrmid = m.get("hrmid");
DaoUtil.updateData(rs,updateSql,hrmid,id);
MODE_RIGHT_INFO.rebuildModeDataShareByEdit(1, modeId, Integer.parseInt(id));
}
sql =
"update " +
"uf_deposit_pricing a," +
"(select b.id as hrmid,c.id as customerid from hrmresource b left join uf_customer c on c.crosssellmanagername =substring_index(b.jobactivitydesc,'/',1) where c.crosssellmanagername is not null) hm " +
"set " +
"a.csmname=hm.hrmid " +
"where " +
"a.customerid=hm.customerid";
sql =
"select " +
"a.id,hm.hrmid " +
"from " +
"uf_deposit_pricing a," +
"(select b.id as hrmid,c.id as customerid from hrmresource b left join uf_customer c on c.crosssellmanagername =substring_index(b.jobactivitydesc,'/',1) where c.crosssellmanagername is not null) hm " +
"where " +
"a.customerid=hm.customerid";
updateSql = "update uf_deposit_pricing set csmname = ? where id = ?";
List<Map<String, String>> data1 = DaoUtil.getData(rs, sql);
for(Map<String, String> m : data1){
String id = m.get("id");
String hrmid = m.get("hrmid");
DaoUtil.updateData(rs,updateSql,hrmid,id);
MODE_RIGHT_INFO.rebuildModeDataShareByEdit(1, modeId, Integer.parseInt(id));
}
sql =
"update " +
"uf_deposit_pricing a, " +
"uf_customer b " +
"set " +
"a.customergroupgbcmb=case b.customertypecode when ' CMB ' then 'CMB' else 'GB' end " +
"where " +
"a.customerid = b.id";
sql =
"select " +
"a.id ,b.id as ccid " +
"from" +
"uf_deposit_pricing a, " +
"uf_customer b " +
"where " +
"a.customerid = b.id";
updateSql = "update uf_deposit_pricing set customerid = ? where id = ?";
List<Map<String, String>> data2 = DaoUtil.getData(rs, sql);
for(Map<String, String> m : data2){
String id = m.get("id");
String ccid = m.get("ccid");
DaoUtil.updateData(rs,updateSql,ccid,id);
MODE_RIGHT_INFO.rebuildModeDataShareByEdit(1, modeId, Integer.parseInt(id));
}
}catch(Exception e){
logger.error("DealPositCronJob exception;message:" + e.getMessage() + ";e:" + e);
}
}
}

View File

@ -0,0 +1,219 @@
package com.api.taojw.huifeng.cronjob;
import com.api.taojw.huifeng.cronjob.util.FileSyncImpl;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.interfaces.schedule.BaseCronJob;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.logging.MyLogger;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.*;
/**
*
* CSV OSS
* jar
* aliyun-sdk-oss-2.8.3.jar
* aliyun-sdk-oss-3.10.2.jar
* joss-0.9.14.jar
*/
public class UploadCsvCronJob extends BaseCronJob {
Logger logger = MyLogger.getLogger();
private String tableName = "";
private String configTableName = "";
private String pzbs = "";
private String requestIdColumnName = "";
private String fileName = "";
private String okFileName = "";
private String ossFilePath = "";
private String filePath = "";
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
public String getConfigTableName() {
return configTableName;
}
public void setConfigTableName(String configTableName) {
this.configTableName = configTableName;
}
public String getPzbs() {
return pzbs;
}
public void setPzbs(String pzbs) {
this.pzbs = pzbs;
}
public String getRequestIdColumnName() {
return requestIdColumnName;
}
public void setRequestIdColumnName(String requestIdColumnName) {
this.requestIdColumnName = requestIdColumnName;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getOkFileName() {
return okFileName;
}
public void setOkFileName(String okFileName) {
this.okFileName = okFileName;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public String getOssFilePath() {
return ossFilePath;
}
public void setOssFilePath(String ossFilePath) {
this.ossFilePath = ossFilePath;
}
@Override
public void execute() {
try{
logger.info("UploadCsvCronJob.execute start,fileName:" + fileName + ";okFileName:" + okFileName + "date:" + new Date() + ";formatDate:" + new SimpleDateFormat("yyyyMMdd").format(new Date()));
String _fileName = fileName;
_fileName = _fileName.replaceAll("yyyy",new SimpleDateFormat("yyyy").format(new Date()));
_fileName = _fileName.replaceAll("MM",new SimpleDateFormat("MM").format(new Date()));
_fileName = _fileName.replaceAll("dd",new SimpleDateFormat("dd").format(new Date()));
logger.info("_fileName:" + _fileName);
String _okFileName = okFileName;
_okFileName = _okFileName.replaceAll("yyyy",new SimpleDateFormat("yyyy").format(new Date()));
_okFileName = _okFileName.replaceAll("MM",new SimpleDateFormat("MM").format(new Date()));
_okFileName = _okFileName.replaceAll("dd",new SimpleDateFormat("dd").format(new Date()));
logger.info("_okFileName:" + _okFileName);
RecordSet rs = new RecordSet();
//读取配置
String getConfigDataSql =
"select " +
"t2.lm,t2.lczd,t2.zhgz,t2.zdysql " +
"from " +
configTableName + " t1 " +
"inner join " + configTableName + "_dt1 t2 on t2.mainid = t1.id " +
"where " +
"t1.pzbs = ? " +
"order by " +
"t2.zdpx asc ";
List<Map<String, String>> configData = DaoUtil.getData(rs, getConfigDataSql, pzbs);
Map<String,Map<String,String>> lmConfigMap = new HashMap<>();
for(Map<String, String> m : configData){
lmConfigMap.put(m.get("lm"),m);
}
//查询建模中需要生成csv的数据 即在特定节点的流程
String getDataSql =
"select " +
"t1.* " +
"from " +
tableName + " t1 " +
"inner join workflow_requestbase t2 on t2.requestid = t1." + requestIdColumnName + " " +
"inner join workflow_nodebase t3 on t3.id = t2.currentnodeid " +
"where " +
"t2.currentnodetype = ?";
List<Map<String, String>> data = DaoUtil.getData(rs, getDataSql, 3);
//根据配置获取列名
List<Object> columns = new ArrayList<>();
Map<String,String> lmColumnMap = new HashMap<>();
for(Map<String, String> m : configData){
columns.add(m.get("lm"));
lmColumnMap.put(m.get("lm"),m.get("lczd"));
}
//根据配置获取数据
List<List<Object>> csvDatas = new ArrayList<>();
for(Map<String, String> dataMap : data){
List<Object> csvData = new ArrayList<>();
for(int i = 0;i< columns.size(); i++){
String oldValue = dataMap.get(lmColumnMap.get(columns.get(i)));
String newValue = dealValue(oldValue,lmConfigMap.get(columns.get(i)),rs);
csvData.add(newValue);
}
csvDatas.add(csvData);
}
//删除 fileName+".csv" okFileName
try{
File directory = new File(filePath);
for (File f : directory.listFiles()) {
if (f.isFile()) {
f.delete();
}
}
}catch (Exception e){
logger.error("delete file exception;message:" + e.getMessage() + ";e:" + e);
}
File csvFile = CreateCsvUtil.createCSVFile(columns, csvDatas, filePath, _fileName);
logger.info("create csv done;fileName:" + _fileName);
File okFile = new File(filePath + File.separator + _okFileName);
okFile.createNewFile();
logger.info("create okfile done;fileName:" + _okFileName);
//上传OSS服务器
FileSyncImpl impl = new FileSyncImpl();
impl.uploadFile(csvFile.getAbsolutePath(),ossFilePath,_fileName+".csv");
impl.uploadFile(okFile.getAbsolutePath(),ossFilePath,_okFileName);
//OSSOperation.uploadFile(FileSyncImpl.getInstance().);
logger.info("create ok file done");
logger.info("SendMailCronJob.sendToDoCount end.");
}catch(Exception e){
logger.error("SendMailCronJob.sendToDoCount exception:" + e.getMessage() + ";e:" + e);
}
}
private String dealValue(String oldValue,Map<String,String> configMap,RecordSet rs){
String result = "";
try{
String zhgz = configMap.get("zhgz");
String zdysql = configMap.get("zdysql");
switch(zhgz){
case "0":
result = zdysql;
break;
case "1":
result = oldValue;
break;
case "2":
zdysql = zdysql.replaceAll("\\{\\?}",oldValue);
if(rs.executeQuery(zdysql)){
if(rs.next()){
result = Util.null2String(rs.getString(1));
}
}
break;
default:
break;
}
}catch(Exception e){
logger.error("dealValue exception;message:" + e.getMessage() + ";e:" + e);
}
return result;
}
}

View File

@ -0,0 +1,123 @@
package com.api.taojw.huifeng.cronjob.util;
import com.aliyun.oss.OSS;
import org.apache.log4j.Logger;
import weaver.file.Prop;
import weaver.general.BaseBean;
import weaver.sync.FileSync;
import weaver.taojw.common.logging.MyLogger;
import java.io.File;
/**
* @author why
* @classname FileSyncImpl
* @description TODO
* @date 2021/9/22 9:49
**/
public class FileSyncImpl implements FileSync {
private static String endpoint;
private static String accessKeyId;
private static String accessKeySecret;
private static String bucketName;
private static String objectName;
private static OSS ossClient;
BaseBean baseBean = null;
Logger logger = MyLogger.getLogger();
public FileSyncImpl() {
this.baseBean = new BaseBean();;
}
private static class FileSyncImplHolder {
private static final FileSyncImpl FILE_SYNC_IMPL = new FileSyncImpl();
}
public static FileSyncImpl getInstance() {
return FileSyncImplHolder.FILE_SYNC_IMPL;
}
static {
try {
endpoint = Prop.getPropValue("syncFileForOSSnew", "endpointnew");
accessKeyId = Prop.getPropValue("syncFileForOSSnew", "accessKeyIdnew");
accessKeySecret = Prop.getPropValue("syncFileForOSSnew", "accessKeySecretnew");
bucketName = Prop.getPropValue("syncFileForOSSnew", "bucketNamenew");
objectName = Prop.getPropValue("syncFileForOSSnew", "objectNamenew");
ossClient = OSSOperation.getOSS(endpoint,accessKeyId,accessKeySecret);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
*
* @param file
* @return fileId "0"
*/
@Override
public String uploadFile(String file) {
try{
logger.info("FileSyncImpl.uploadFile begin;file:" + file);
String fileId = getFileId(file);
String path = new File(file).getAbsolutePath();
//path = objectName + path;
logger.info("FileSyncImpl.uploadFile ossClient:" + ossClient + ";bucketName:" + bucketName + ";fileId:" + fileId + ";path:" + path + ";objectName:" + objectName);
String res = OSSOperation.uploadFile(ossClient, bucketName, path, fileId);
logger.info("FileSyncImpl.uploadFile res:" + res);
if("0".equals(res)){
return "0";
}
return fileId;
}catch(Exception e){
logger.error("FileSyncImpl.uploadFile exception;message:" + e.getMessage() + ";e:" + e);
return "-1";
}
}
/**
*
* @param file
* @return fileId "0"
*/
public String uploadFile(String file,String ossFilePath,String fileName) {
try{
logger.info("FileSyncImpl.uploadFile begin;file:" + file);
//String fileId = getFileId(file);
String fileId = objectName + ossFilePath + fileName;
String path = new File(file).getAbsolutePath();
//path = objectName + path;
logger.info("FileSyncImpl.uploadFile ossClient:" + ossClient + ";bucketName:" + bucketName + ";fileId:" + fileId + ";path:" + path + ";objectName:" + objectName);
String res = OSSOperation.uploadFile(ossClient, bucketName, path, fileId);
logger.info("FileSyncImpl.uploadFile res:" + res);
if("0".equals(res)){
return "0";
}
return fileId;
}catch(Exception e){
logger.error("FileSyncImpl.uploadFile exception;message:" + e.getMessage() + ";e:" + e);
return "-1";
}
}
/**
*
* @param file
* @return 1 0
*/
@Override
public int downFile(String file) {
baseBean.writeLog("【集群文件同步】下载文件方法");
return OSSOperation.downloadFile(ossClient,bucketName,file,getFileId(file));
}
private String getFileId(String file) {
String fileTemp = file;
if (fileTemp.startsWith("/") || fileTemp.startsWith("\\")) {
fileTemp = objectName + fileTemp;
} else {
fileTemp = objectName + "/" + fileTemp;
}
return fileTemp;
}
}

View File

@ -0,0 +1,84 @@
package com.api.taojw.huifeng.cronjob.util;
import com.weaver.file.Prop;
import org.javaswift.joss.client.factory.AccountConfig;
import org.javaswift.joss.client.factory.AccountFactory;
import org.javaswift.joss.client.factory.AuthenticationMethod;
import org.javaswift.joss.model.Account;
import org.javaswift.joss.model.Container;
import org.javaswift.joss.model.StoredObject;
import java.io.File;
/**
* Hello world!
*
*/
public class JossUtil
{
private Container container = null;
private JossUtil() {
}
private void initJossUtil() {
if(container == null) {
String yourUserName = Prop.getPropValue("sanxiajoss.properties", "yourUserName");
String yourPassword = Prop.getPropValue("sanxiajoss.properties", "yourPassword");
String yourAuthUrl = Prop.getPropValue("sanxiajoss.properties", "yourAuthUrl");
String yourContainerName = Prop.getPropValue("sanxiajoss.properties", "yourContainerName");
AccountConfig config = new AccountConfig();
//配置你的用户名(一般是租户和用户名的组合)
config.setUsername(yourUserName);
//配置你的密码
config.setPassword(yourPassword);
//配置你的认证地址
config.setAuthUrl(yourAuthUrl);
//配置你的认证方式
config.setAuthenticationMethod(AuthenticationMethod.BASIC);
//通过初始化配置来创建你的帐户
Account account = new AccountFactory(config).createAccount();
//通过帐户来获取你的容器
container = account.getContainer(yourContainerName);
}
}
private static class JossUtilHolder{
private static final JossUtil jossUtil = new JossUtil();
}
public static JossUtil getInstance(){
return JossUtilHolder.jossUtil;
}
//下载文件
public int downFile(String fileid,String file) {
try {
initJossUtil();
//下载到本地
StoredObject object = container.getObject(fileid);
//下载到本地
object.downloadObject(new File(file));
return 1;
}catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
return 0;
}
//上传文件
public String uploadFile(String file) {
try {
String fileid = System.currentTimeMillis()+"";
//获取你的对象
StoredObject object = container.getObject(fileid);
//上传本地文件
object.uploadObject(new File(file));
return fileid;
}catch (Exception e) {
e.printStackTrace();
}
return "0";
}
}

View File

@ -0,0 +1,64 @@
package com.api.taojw.huifeng.cronjob.util;
import com.caucho.server.webapp.WebApp;
import com.weaver.general.BaseBean;
import weaver.file.Prop;
import weaver.general.GCONST;
import weaver.sync.ClusterFileSync;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* @author why
* @classname OsFileFilter
* @description
* @date 2022/5/17 15:20
**/
public class OSFileFilter extends BaseBean implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws ServletException, IOException {
HttpServletRequest request = (HttpServletRequest) servletRequest;
String path = request.getRequestURI();
if (path.contains(".")) {
String staticFiles = Prop.getPropValue("OSStaticFile", "staticFiles");
if (staticFiles != null && !"".equals(staticFiles.trim())) {
List<String> staticFileList = new ArrayList<String>(Arrays.asList(staticFiles.split(",")));
for (String staticFile : staticFileList) {
if (staticFile != null && !"".equals(staticFile.trim())) {
if (path.startsWith(staticFile)) {
String suffix = path.substring(path.lastIndexOf("."));
boolean isStaticFile = false;
//判断是否静态资源
String type = WebApp.getLocal().getMimeTypeImpl(suffix);
if (type != null) {
isStaticFile = true;
}
if (isStaticFile) {
ClusterFileSync.getInstance().downloadFile(new File(GCONST.getRootPath(),path).getAbsolutePath());
break;
}
}
}
}
}
}
filterChain.doFilter(servletRequest, servletResponse);
}
@Override
public void destroy() {
}
}

View File

@ -0,0 +1,75 @@
package com.api.taojw.huifeng.cronjob.util;
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.aliyun.oss.model.GetObjectRequest;
import com.aliyun.oss.model.PutObjectResult;
import org.apache.log4j.Logger;
import weaver.taojw.common.logging.MyLogger;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
public class OSSOperation {
static Logger logger = MyLogger.getLogger();
public static String deleteBucket(OSS ossClient, String expiredBucketName) {
ossClient.deleteBucket(expiredBucketName);
return null;
}
private static class OSSOperationHolder {
private static final OSSOperation ossoperation = new OSSOperation();
}
public static OSSOperation getInstance() {
return OSSOperationHolder.ossoperation;
}
public static String uploadFile(OSS ossClient, String bucketName, String fileName, String objectName) {
InputStream inputStream = null;
try {
logger.info("OSSOperation.uploadFile begin;fileName:" + fileName);
inputStream = new FileInputStream(fileName);
// <yourObjectName>表示上传文件到OSS时需要指定包含文件后缀在内的完整路径例如abc/efg/123.jpg。
PutObjectResult putObjectResult = ossClient.putObject(bucketName, objectName, inputStream);
logger.info("OSSOperation.uploadFile end;tag:" + putObjectResult.getETag() + ";requestId:" + putObjectResult.getRequestId() + ";message:" + putObjectResult.getResponse());
return fileName;
} catch (Exception e) {
logger.error("OSSOperation.uploadFile exception;message:" + e.getMessage() + ";e:" + e);
} finally {
try {
inputStream.close();
} catch (IOException e) {
logger.error("OSSOperation.uploadFile close exception;message:" + e.getMessage() + ";e:" + e);
}
}
return "0";
}
public static int downloadFile(OSS ossClient, String bucketName, String pathName, String objectName){
try {
if(!new File(pathName).getParentFile().exists()){
new File(pathName).getParentFile().mkdirs();
}
ossClient.getObject(new GetObjectRequest(bucketName, objectName), new File(pathName));
return 1;
}catch (Exception e){
e.printStackTrace();
}
return 0;
}
public static OSS getOSS(String endpoint, String accessKeyId, String accessKeySecret) {
OSS ossClient = null;
try {
ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
} catch (Exception e) {
System.out.println("BackupRule:OSS密钥验证错误" + e.getMessage());
}
return ossClient;
}
}

View File

@ -0,0 +1,90 @@
package com.api.taojw.jkzcdemo;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.logging.MyLogger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.List;
import java.util.Map;
@Path("/jkzcdemo")
public class GetDetailDataApi {
Logger logger = MyLogger.getLogger();
private JSONObject mapToJson(Map<String, String> m){
JSONObject o = new JSONObject();
for(String key: m.keySet()){
o.put(key,m.get(key));
}
return o;
}
@GET
@Path("/getDetailData")
@Produces(MediaType.APPLICATION_JSON)
public String getDetailData(@Context HttpServletRequest request, @Context HttpServletResponse response){
JSONObject result = new JSONObject();
try{
JSONArray dataArray = new JSONArray();
RecordSet rs = new RecordSet();
String glyIds = request.getParameter("glyIds");
String ztIds = request.getParameter("ztIds");
String type = request.getParameter("type");
if(type != null && !"".equals(type) && glyIds != null && !"".equals(glyIds)){
String[] glyIdArr = glyIds.split(",");
String getDetailSql = "select t1.id,t1.zcmc from uf_zcxxjmbd t1 where t1.glry = ? or t1.syry = ? or t1.zczrr = ?";
for(String glyId : glyIdArr){
List<Map<String, String>> data = DaoUtil.getData(rs,getDetailSql, glyId,glyId,glyId);
for(Map<String, String> m : data){
JSONObject o = mapToJson(m);
dataArray.add(o);
}
}
result.put("data",dataArray);
}
if(glyIds != null && !"".equals(glyIds)){
String[] glyIdArr = glyIds.split(",");
String getDetailSql = "select t1.id,t1.zcmc from uf_zcxxjmbd t1 where t1.glry = ?";
for(String glyId : glyIdArr){
List<Map<String, String>> data = DaoUtil.getData(rs,getDetailSql, glyId);
for(Map<String, String> m : data){
JSONObject o = mapToJson(m);
dataArray.add(o);
}
}
result.put("data",dataArray);
}
if(ztIds != null && !"".equals(ztIds)){
String[] glyIdArr = ztIds.split(",");
String getDetailSql = "select t1.id,t1.zcmc from uf_zcxxjmbd t1 where t1.zt1 = ?";
for(String glyId : glyIdArr){
List<Map<String, String>> data = DaoUtil.getData(rs,getDetailSql, glyId);
for(Map<String, String> m : data){
JSONObject o = mapToJson(m);
dataArray.add(o);
}
}
result.put("data",dataArray);
}
}catch(Exception e){
logger.error("getDetailData exception;message:" + e.getMessage() + ";e:" + e);
}
return result.toJSONString();
}
}

View File

@ -0,0 +1,180 @@
package com.api.taojw.jkzcdemo;
import com.alibaba.fastjson.JSONObject;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.formmode.data.ModeDataIdUpdate;
import weaver.formmode.setup.ModeRightInfo;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.logging.MyLogger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
/**
*
*/
@Path("/jkzcscan")
public class ScanZcApi {
Logger logger = MyLogger.getLogger();
public static ModeDataIdUpdate mdu = ModeDataIdUpdate.getInstance();
public static ModeRightInfo MODE_RIGHT_INFO = new ModeRightInfo();
@GET
@Path("/zcPk")
@Produces(MediaType.APPLICATION_JSON)
public String zcPk(@Context HttpServletRequest request, @Context HttpServletResponse response){
String zxId = request.getParameter("zxId");
String planId = request.getParameter("planId");
String planTableName = "uf_PDJHGL";
logger.info("zcpk begin;zcid:" + zxId);
String updateStatusSql = "update uf_PDZXGL set pdzt = 1,sfpd = 0 where id = ?";
DaoUtil.updateData(updateStatusSql,zxId);
//更新计划的盘点总数、已盘点数量
String updateCountSql = "update " + planTableName + " t1 set t1.zcpdzs = (select count(1) from uf_PDZXGL t2 where t2.jhbh = ? ),t1.ypdsl = (select count(1) from uf_PDZXGL t2 where t2.jhbh = ? and t2.sfpd = 0) where t1.lcbh = ?";
DaoUtil.updateData(updateCountSql,planId,planId,planId);
String updateRateSql = "update " + planTableName + " t1 set t1.pdjd = t1.ypdsl/t1.zcpdzs where t1.lcbh = ?";
DaoUtil.updateData(updateRateSql,planId);
return "";
}
@POST
@Path("/scanzc")
@Produces(MediaType.APPLICATION_JSON)
public String scanZc(@Context HttpServletRequest request, @Context HttpServletResponse response){
JSONObject result = new JSONObject();
//更新计划的已盘点数量、进度
String updatePlanSql = "update uf_PDJHGL set ypdsl = isnull(ypdsl,0) + 1 ";
DaoUtil.updateData(updatePlanSql);
String updateRateSql = "update uf_PDJHGL set pdjd = CAST(ypdsl AS FLOAT)/zcpdzs";
DaoUtil.updateData(updateRateSql);
result.put("code","1");
User user = HrmUserVarify.getUser(request, response);
int userId = user.getUID();
String zcId = request.getParameter("zcId");
//更新资产盘点明细 盘点状态 为 相符 是否盘点改为已盘点 地点改为当前人的所在部门的地点
String updateDetailStatusSql = "update uf_PDZXGL set pdzt = 2,sfpd = 0,cfdd = (select bmdz from hrmdepartmentdefined where deptid = (select departmentid from hrmresource where id = ?)) where and zc = ?";
if(DaoUtil.updateData(updateDetailStatusSql,userId,zcId)){
logger.info("ScanZcApi.scanZc.updateDetailStatus execute");
}else{
logger.error("ScanZcApi.scanZc.updateDetailStatus error;updateDetailStatus:" + updateDetailStatusSql);
}
return result.toString();
/*
//当前用户
User user = HrmUserVarify.getUser(request, response);
int userId = user.getUID();
//获取盘点计划编号参数
String planId = request.getParameter("planId");
//获取资产id
String zcId = request.getParameter("zcId");
//当前用户
String currentUser = request.getParameter("currentUser");
//资产盘点计划、明细计划、计划明细表名
String planTableName = "uf_PDJHGL";
String detailTableName = "uf_PDZXGL";
//-1表示资产不在本次计划中 -2表示这个资产已盘点 其余值表示盘点人
String pdr = checkZcInPlan(planId,detailTableName,zcId);
*//*if("-2".equals(pdr)){
result.put("code",pdr);
return result.toString();
}*//*
//如果不在本次计划内 做盘赢处理
if("-1".equals(pdr)){
String getPlanInfoSql = "select * from uf_PDJHGL where lcbh = ?";
Map<String, String> planInfo = DaoUtil.getFirstData(getPlanInfoSql, planId);
String getZcInfoSql = "select * from uf_zcxxjmbd where id = ?";
Map<String, String> zcInfo = DaoUtil.getFirstData(getZcInfoSql, zcId);
//向执行台账新增记录
int newDataId = -1;
String currentDate = TimeUtil.getCurrentDateString();
String currentTime = TimeUtil.getOnlyCurrentTimeString();
newDataId = mdu.getModeDataNewId("uf_PDZXGL", 1488, 1, 0, currentDate, currentTime);
//权限重构
MODE_RIGHT_INFO.rebuildModeDataShareByEdit(1, 1488,newDataId);
//更新数据
String updateDateSql =
"update uf_PDZXGL set " +
"jhbh = ?, " +
"pdksrq = ?,pdjsrq = ?,zc = ?,zcbm = ?," +
"zcmc = ?,ggxh= ?,zczt = ?,cfdd = ?,syr = ?," +
"sybm = ?,pdry = ?,pdxbry= ?,sfpd = 0,pdzt = 0,sjpdrq = ? " +
"where " +
"id = ?";
DaoUtil.updateData(updateDateSql,
planId,planInfo.get("pdksrq"),planInfo.get("pdjsrq"),zcId,zcInfo.get("zcbm"),
zcInfo.get("zcmc"),zcInfo.get("ggxh"),zcInfo.get("zczt"),zcInfo.get("cfdd"),zcInfo.get("syry"),
zcInfo.get("sybm"),userId,userId,new SimpleDateFormat("yyyy-MM-dd").format(new Date()),
newDataId);
//更新计划的盘点总数、已盘点数量
String updateCountSql = "update " + planTableName + " t1 set t1.zcpdzs = (select count(1) from uf_PDZXGL t2 where t2.jhbh = ? ),t1.ypdsl = (select count(1) from uf_PDZXGL t2 where t2.jhbh = ? and t2.sfpd = 0) where t1.lcbh = ?";
DaoUtil.updateData(updateCountSql,planId,planId,planId);
String updateRateSql = "update " + planTableName + " t1 set t1.pdjd = t1.ypdsl/t1.zcpdzs where t1.lcbh = ?";
DaoUtil.updateData(updateRateSql,planId);
}
if(!currentUser.equals(pdr)){
result.put("code","4");
return result.toString();
}
try{
//更新资产盘点明细 盘点状态 为 相符 是否盘点改为已盘点 地点改为当前人的所在部门的地点
String updateDetailStatusSql = "update " + detailTableName + " set pdzt = 2,sfpd = 0,cfdd = (select bmdz from hrmdepartmentdefined where deptid = (select departmentid from hrmresource where id = ?)) where jhbh = ? and zc = ?";
if(DaoUtil.updateData(updateDetailStatusSql,userId,planId,zcId)){
logger.info("ScanZcApi.scanZc.updateDetailStatus execute");
}else{
logger.error("ScanZcApi.scanZc.updateDetailStatus error;updateDetailStatus:" + updateDetailStatusSql);
}
//更新计划的已盘点数量、进度
String updatePlanSql = "update " + planTableName + " t1 set t1.ypdsl = (select count(1) from uf_PDZXGL t2 where t2.jhbh = ? and t2.sfpd = 0) where t1.lcbh = ?";
DaoUtil.updateData(updatePlanSql,planId,planId);
String updateRateSql = "update " + planTableName + " t1 set t1.pdjd = t1.ypdsl/t1.zcpdzs where t1.lcbh = ?";
DaoUtil.updateData(updateRateSql,planId);
result.put("code","1");
return result.toString();
}catch(Exception e){
logger.error("ScanZcApi.scanZc error,planId:"+planId+";message:"+e.getMessage()+";e:"+e);
result.put("code","0");
return result.toString();
}*/
}
/**
* @param planId
* @param detailTableName
* @param zcId id
* @return -1 -2
*/
private String checkZcInPlan(String planId,String detailTableName,String zcId){
String status = "-1";
RecordSet rs = new RecordSet();
String checkSql = "select pdry,pdzt from " + detailTableName + " where jhbh = '" + planId + "' and zc = "+zcId;
logger.info("ZcpdSubmitInfo checkZcInPlan sql:"+checkSql);
if(rs.executeQuery(checkSql)){
if(rs.next()){
if("2".equals(Util.null2String(rs.getString("pdzt"))) || "0".equals(Util.null2String(rs.getString("pdzt")))){
status = "-2";
}else{
status = Util.null2String(rs.getString("pdry"));
}
}
}
logger.info("ZcpdSubmitInfo checkZcInPlan status:"+status);
return status;
}
}

View File

@ -0,0 +1,81 @@
package com.api.taojw.leimi.action;
import com.api.taojw.leimi.action.util.BhUtil;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.general.TimeUtil;
import weaver.general.Util;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.logging.MyLogger;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* action
* -
* FY
*
*/
public class CreateBhAction implements Action {
private String bmColumn = "";
public String getBmColumn() {
return bmColumn;
}
public void setBmColumn(String bmColumn) {
this.bmColumn = bmColumn;
}
Logger logger = MyLogger.getLogger();
@Override
public String execute(RequestInfo requestInfo) {
String requestId = requestInfo.getRequestid();
try{
logger.info("----------------------" + this.getClass() + " action begin ----------------------");
RecordSet rs = new RecordSet();
String billTableName = requestInfo.getRequestManager().getBillTableName();
//获取流程表单中的部门缩写
String getBmSql = "select " + bmColumn + " from " + billTableName + " where requestid = ?";
Map<String, String> firstData = DaoUtil.getFirstData(rs, getBmSql, requestId);
String bmId = Util.null2String(firstData.get(bmColumn.toLowerCase(Locale.ROOT)));
String[] bmIdArray = bmId.split(",");
String getBmJcSql = "select bmsx from hrmdepartmentdefined where deptid = ?";
String bmString = "";
for(int i=0;i <bmIdArray.length; i++){
String id = bmIdArray[i];
Map<String, String> firstData1 = DaoUtil.getFirstData(rs, getBmJcSql, id);
String bmsx = Util.null2String(firstData1.get("bmsx"));
bmIdArray[i] = bmsx;
}
Arrays.sort(bmIdArray);
for(int i=0;i <bmIdArray.length; i++){
if(i == 0){
bmString = bmIdArray[i];
}else{
bmString = bmString + "-" + bmIdArray[i];
}
}
//当前年
String currentYear = new SimpleDateFormat("yyyy").format(new Date());
//维护建模表中的流水记录
String bh = BhUtil.getBh(bmString,currentYear);
//更新流程表单编号字段
String updateSql = "update " + billTableName + " set uniquecode = ? where requestid = ?";
DaoUtil.updateData(rs,updateSql,bh,requestId);
logger.info("----------------------" + this.getClass() + " action end ----------------------");
return Action.SUCCESS;
}catch(Throwable e){
requestInfo.getRequestManager().setMessageid(TimeUtil.getCurrentTimeString() + requestId);
requestInfo.getRequestManager().setMessagecontent("BackPrAction接口发生异常,requestId:"+ requestId +",请联系管理员!");
logger.error("----------------------" + this.getClass() + " action error ----------------------requestId:" + requestId + "exception:" + e.getMessage() + ";e:" + e);
return Action.FAILURE_AND_CONTINUE;
}
}
}

View File

@ -0,0 +1,49 @@
package com.api.taojw.leimi.action;
import com.api.taojw.leimi.action.util.DealJeUtil;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.general.TimeUtil;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.logging.MyLogger;
import java.util.List;
import java.util.Map;
/**
* action
*
*/
public class FnaBackAction implements Action {
Logger logger = MyLogger.getLogger();
@Override
public String execute(RequestInfo requestInfo) {
String requestId = requestInfo.getRequestid();
try{
logger.info("----------------------" + this.getClass() + " action begin ----------------------");
RecordSet rs = new RecordSet();
String billTableName = requestInfo.getRequestManager().getBillTableName();
String getDetailSql = "select t1.vendor as vendorname,t1.TotalActual,t2.uniquecode,t2.uniquecodename from " + billTableName + "_dt1 t1 inner join " + billTableName + " t2 on t2.id = t1.mainid where t2.requestid = ?";
List<Map<String, String>> data = DaoUtil.getData(rs, getDetailSql, requestId);
for(Map<String, String> m : data){
String uniquecode = m.get("uniquecode");
String uniquecodename = m.get("uniquecodename");
String VendorName = m.get("vendorname");
String amount = m.get("totalactual");
DealJeUtil.free(uniquecode,uniquecodename,VendorName,amount);
}
logger.info("----------------------" + this.getClass() + " action end ----------------------");
return Action.SUCCESS;
}catch(Throwable e){
requestInfo.getRequestManager().setMessageid(TimeUtil.getCurrentTimeString() + requestId);
requestInfo.getRequestManager().setMessagecontent("Action接口发生异常,requestId:"+ requestId +",请联系管理员!");
logger.error("----------------------" + this.getClass() + " action error ----------------------requestId:" + requestId + "exception:" + e.getMessage() + ";e:" + e);
return Action.FAILURE_AND_CONTINUE;
}
}
}

View File

@ -0,0 +1,49 @@
package com.api.taojw.leimi.action;
import com.api.taojw.leimi.action.util.DealJeUtil;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.general.TimeUtil;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.logging.MyLogger;
import java.util.List;
import java.util.Map;
/**
* action
*
*/
public class FnaDoneAction implements Action {
Logger logger = MyLogger.getLogger();
@Override
public String execute(RequestInfo requestInfo) {
String requestId = requestInfo.getRequestid();
try{
logger.info("----------------------" + this.getClass() + " action begin ----------------------");
RecordSet rs = new RecordSet();
String billTableName = requestInfo.getRequestManager().getBillTableName();
String getDetailSql = "select t1.vendor as vendorname,t1.TotalActual,t2.uniquecode,t2.uniquecodename from " + billTableName + "_dt1 t1 inner join " + billTableName + " t2 on t2.id = t1.mainid where t2.requestid = ?";
List<Map<String, String>> data = DaoUtil.getData(rs, getDetailSql, requestId);
for(Map<String, String> m : data){
String uniquecode = m.get("uniquecode");
String uniquecodename = m.get("uniquecodename");
String VendorName = m.get("vendorname");
String amount = m.get("totalactual");
DealJeUtil.minus(uniquecode,uniquecodename,VendorName,amount);
}
logger.info("----------------------" + this.getClass() + " action end ----------------------");
return Action.SUCCESS;
}catch(Throwable e){
requestInfo.getRequestManager().setMessageid(TimeUtil.getCurrentTimeString() + requestId);
requestInfo.getRequestManager().setMessagecontent("Action接口发生异常,requestId:"+ requestId +",请联系管理员!");
logger.error("----------------------" + this.getClass() + " action error ----------------------requestId:" + requestId + "exception:" + e.getMessage() + ";e:" + e);
return Action.FAILURE_AND_CONTINUE;
}
}
}

View File

@ -0,0 +1,49 @@
package com.api.taojw.leimi.action;
import com.api.taojw.leimi.action.util.DealJeUtil;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.general.TimeUtil;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.logging.MyLogger;
import java.util.List;
import java.util.Map;
/**
* action
*
*/
public class FnaIceAction implements Action {
Logger logger = MyLogger.getLogger();
@Override
public String execute(RequestInfo requestInfo) {
String requestId = requestInfo.getRequestid();
try{
logger.info("----------------------" + this.getClass() + " action begin ----------------------");
RecordSet rs = new RecordSet();
String billTableName = requestInfo.getRequestManager().getBillTableName();
String getDetailSql = "select t1.vendor as vendorname,t1.TotalActual,t2.uniquecode,t2.uniquecodename from " + billTableName + "_dt1 t1 inner join " + billTableName + " t2 on t2.id = t1.mainid where t2.requestid = ?";
List<Map<String, String>> data = DaoUtil.getData(rs, getDetailSql, requestId);
for(Map<String, String> m : data){
String uniquecode = m.get("uniquecode");
String uniquecodename = m.get("uniquecodename");
String VendorName = m.get("vendorname");
String amount = m.get("totalactual");
DealJeUtil.freeze(uniquecode,uniquecodename,VendorName,amount);
}
logger.info("----------------------" + this.getClass() + " action end ----------------------");
return Action.SUCCESS;
}catch(Throwable e){
requestInfo.getRequestManager().setMessageid(TimeUtil.getCurrentTimeString() + requestId);
requestInfo.getRequestManager().setMessagecontent("Action接口发生异常,requestId:"+ requestId +",请联系管理员!");
logger.error("----------------------" + this.getClass() + " action error ----------------------requestId:" + requestId + "exception:" + e.getMessage() + ";e:" + e);
return Action.FAILURE_AND_CONTINUE;
}
}
}

View File

@ -0,0 +1,41 @@
package com.api.taojw.leimi.action.util;
import com.alibaba.fastjson.JSONObject;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.TjwModelUtil;
import java.util.Map;
public class BhUtil {
public static synchronized String getBh(String bm,String year){
String thisYear = year.substring(2,4);
int nextYear = Integer.parseInt(thisYear) + 1;
year = thisYear + "" + nextYear;
String result = bm + "-FY" + year;
//查询建模中是否有
RecordSet rs = new RecordSet();
String getDataSql = "select dqls from uf_lmbhtz where bm = ? and nf = ?";
String updateSql = "update uf_lmbhtz set dqls = dqls + 1 where bm = ? and nf = ?";
Map<String, String> firstData = DaoUtil.getFirstData(rs, getDataSql, bm, year);
String dqls = Util.null2String(firstData.get("dqls"));
if("".equals(dqls)){
//建模插入数据
JSONObject o = new JSONObject();
o.put("bm",bm);
o.put("nf",year);
o.put("dqls","1");
TjwModelUtil.addModelData(rs,"uf_lmbhtz",o);
result = result + "-0001";
}else{
int currentLs = Integer.parseInt(dqls) + 1;
String replace = String.format("%4s", currentLs + "").replace(" ", "0");
result = result + "-" + replace;
DaoUtil.updateData(rs,updateSql, bm, year);
}
return result;
}
}

View File

@ -0,0 +1,61 @@
package com.api.taojw.leimi.action.util;
import com.alibaba.fastjson.JSONObject;
import weaver.conn.RecordSet;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.TjwModelUtil;
public class DealJeUtil {
public static String tableName = "uf_ucvnjy";
public static String uniqueCodeColumn = "uniqueCode";
public static String uniqueCodeNameColumn = "uniqueCodeName";
public static String vendorNameColumn = "vendorName";
public static String yxpoje = "yxpoje";
public static String ztje = "ztje";
public static String lcljje = "lcljje";
//冻结
//在途增加 累计增加
public static synchronized void freeze(String uniqueCode,String uniqueCodeName, String vendorName,String amount){
RecordSet rs = new RecordSet();
String checkExistsSql = "select count(1) as c from " + tableName + " where " + uniqueCodeColumn + " = ? and " + vendorNameColumn + " = ?";
if(!DaoUtil.isDataExists(rs,checkExistsSql,uniqueCode,vendorName)){
JSONObject o = new JSONObject();
o.put(uniqueCodeColumn,uniqueCode);
o.put(uniqueCodeNameColumn,uniqueCodeName);
o.put(vendorNameColumn,vendorName);
o.put(ztje,amount);
o.put(lcljje,amount);
TjwModelUtil.addModelData(rs,tableName,o);
return;
}
String updateSql =
"update " + tableName + " set " + ztje + " = isnull(" + ztje + ",0) + " + amount + "," + lcljje + " = isnull(" + lcljje + ",0) + " + amount + " where "+
uniqueCodeColumn+" = '" + uniqueCode + "' and " + vendorNameColumn + " = '" + vendorName + "'";
DaoUtil.updateData(new RecordSet(),updateSql);
}
//扣减
//在途减少 已下PO增加
public static synchronized void minus(String uniqueCode,String uniqueCodeName, String vendorName,String amount){
String updateSql =
"update " + tableName + " set " + yxpoje + " = isnull(" + yxpoje + ",0) + " + amount + "," + ztje + " = isnull(" + ztje + ",0) - " + amount + " where "+
uniqueCodeColumn+" = '" + uniqueCode + "' and " + vendorNameColumn + " = '" + vendorName + "'";
DaoUtil.updateData(new RecordSet(),updateSql);
}
//释放
//在途减少 累计减少
public static synchronized void free(String uniqueCode,String uniqueCodeName, String vendorName,String amount){
String updateSql =
"update " + tableName + " set " + ztje + " = isnull(" + ztje + ",0) - " + amount + "," + lcljje + " = isnull(" + lcljje + ",0) - " + amount + " where "+
uniqueCodeColumn+" = '" + uniqueCode + "' and " + vendorNameColumn + " = '" + vendorName + "'";
DaoUtil.updateData(new RecordSet(),updateSql);
}
}

View File

@ -0,0 +1,92 @@
package com.api.taojw.leimi.api;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.taojw.common.CommonSqlUtil;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.logging.MyLogger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.List;
import java.util.Map;
/**
* NCC
* action
* json NCC
* jar OpenAPIUtil-1.0.1.jar
*/
@Path("/lmtjw")
public class LmTjwApi {
private String cusparam = "";
public String getCusparam() {
return cusparam;
}
public void setCusparam(String cusparam) {
this.cusparam = cusparam;
}
Logger logger = MyLogger.getLogger();
@POST
@Path("/getJe")
@Produces(MediaType.APPLICATION_JSON)
public String getJe(@Context HttpServletRequest request, @Context HttpServletResponse response){
JSONObject result = new JSONObject();
try{
logger.info("----------------------" + this.getClass() + " getJe begin");
RecordSet rs = new RecordSet();
String requestId = request.getParameter("requestId");
String tableName = CommonSqlUtil.getTableNameByRequetId(requestId,rs);
String getDataSql =
"select " +
"t1.uniquecode ,t1.uniquecodename, t2.vendor as vendorname ,t4.VendorNameCN as vendornamename,t5.uniquecode as uniquecodeid " +
"from " +
tableName + " t1 " +
"inner join " + tableName + "_dt1 t2 on t2.mainid = t1.id " +
"inner join uf_Vendor t4 on t4.id = t2.vendor " +
"left join uf_uctz t5 on t5.id = t1.uniquecode " +
"where " +
"t1.requestid = ?";
String getJeSql = "select lcljje from uf_ucvnjy where uniqueCode = ? and vendorName = ?";
List<Map<String, String>> data = DaoUtil.getData(rs, getDataSql, requestId);
JSONArray res = new JSONArray();
for(Map<String, String> m : data){
JSONObject o = new JSONObject();
String uniquecode = m.get("uniquecode");
String uniquecodename = m.get("uniquecodename");
String VendorName = m.get("vendorname");
String vendornamename = m.get("vendornamename");
String uniquecodeid = m.get("uniquecodeid");
Map<String, String> firstData = DaoUtil.getFirstData(rs, getJeSql, uniquecode, VendorName);
String je = firstData.get("lcljje");
o.put("VendorName",VendorName);
o.put("uniquecodename",uniquecodename);
o.put("uniquecode",uniquecode);
o.put("vendornamename",vendornamename);
o.put("uniquecodeid",uniquecodeid);
o.put("je",je);
res.add(o);
}
result.put("arr",res);
result.put("flag","success");
return result.toJSONString();
}catch(Throwable e){
logger.error("getJe error;message:" + e.getMessage());
result.put("flag","fail");
return result.toJSONString();
}
}
}

View File

@ -0,0 +1,31 @@
package com.api.taojw.leimi.cronjob;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.interfaces.schedule.BaseCronJob;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.logging.MyLogger;
/**
*
* FY2223 23331
*
*/
public class UpdateModeStatusCronjob extends BaseCronJob {
Logger logger = MyLogger.getLogger();
@Override
public void execute() {
try{
logger.info("UpdateModeStatusCronjob begin");
RecordSet rs = new RecordSet();
String updateStatusSql = "UPDATE uf_uctz SET sfyx = 1 where '20'+SUBSTRING(UNIQUECODE,LEN(UNIQUECODE) - 6,2)+'-03-31' <= CONVERT(varchar,GETDATE(),23)";
DaoUtil.updateData(rs,updateStatusSql);
logger.info("UpdateModeStatusCronjob end");
}catch (Throwable e){
logger.error("UpdateModeStatusCronjob exception;message:" + e.getMessage() + ";e:" + e);
}
}
}

View File

@ -0,0 +1,134 @@
package com.api.taojw.leimi.modecussearch;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.formmode.customjavacode.AbstractCustomSqlConditionJavaCode;
import weaver.hrm.User;
import weaver.taojw.common.CommonSqlUtil;
import weaver.taojw.common.logging.MyLogger;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class LeimiModeCusSearch extends AbstractCustomSqlConditionJavaCode {
Logger logger = MyLogger.getLogger();
/**
* SQL
* @param param
* param()
* user
*
* @return
* : t1.a = '1' and t1.b = '3' and t1.c like '%22%'
* t1
*/
public String generateSqlCondition(Map<String, Object> param) throws Exception {
logger.info("LeimiModeCusSearch.generateSqlCondition begin;");
try{
User user = (User)param.get("user");
logger.info("user:" + user.getLastname() + ";id:" + user.getUID());
RecordSet rs = new RecordSet();
//当前用户所在部门
int userDepartment = user.getUserDepartment();
//用户未某个特殊部门下的 他能看到所有数据
int specialDepartmentId_All = Integer.parseInt(CommonSqlUtil.getSystemParamValue("specialDepartmentId_All",rs));
if(userDepartment == specialDepartmentId_All){
logger.info("userDepartment == specialDepartmentId_All");
return " sfyx = 0 ";
}
String teId = CommonSqlUtil.getSystemParamValue("teDepartmentId",rs);
String lyDepartmentId = CommonSqlUtil.getSystemParamValue("lyDepartmentId",rs);
//若用户为te及te下级部门的用户 则相关权限部门选择里必须包含te 或 te下级 或路易13
boolean isTe = false;
if(teId.equals(userDepartment+"")){
isTe = true;
}
List<String> teAllSonId = new ArrayList<>();
CommonSqlUtil.getAllSonDepartment(teAllSonId,teId);
for(String i : teAllSonId){
if(i.equals(userDepartment+"")){
isTe = true;
}
}
if(isTe){
String sqlCondition = "";
String whereSql = "','+cast(t1.xgqxbmxz as nvarchar(2000))+',' like '%," + teId + ",%' ";
for(String id : teAllSonId){
whereSql = whereSql + " or (','+cast(t1.xgqxbmxz as nvarchar(2000))+',' like '%," + id + ",%') ";
}
sqlCondition =
"( " +
whereSql + " or (','+cast(t1.xgqxbmxz as nvarchar(2000))+',' like '%," + lyDepartmentId + ",%') " +
") and sfyx = 0 ";
logger.info("sqlCondition:" + sqlCondition);
return sqlCondition;
}
String sqlCondition = "";
String specialDepartmentId_first = CommonSqlUtil.getSystemParamValue("specialDepartmentId_first",rs);
String specialDepartmentId_second = CommonSqlUtil.getSystemParamValue("specialDepartmentId_second",rs);
//若用户为特殊部门1下的用户则选择部门需要包含特殊部门1
boolean sp1 = false;
if(specialDepartmentId_first.equals(userDepartment+"")){
sp1 = true;
}
List<String> specila1AllSonId = new ArrayList<>();
CommonSqlUtil.getAllSonDepartment(specila1AllSonId,specialDepartmentId_first);
for(String i : specila1AllSonId){
if(i.equals(userDepartment+"")){
sp1 = true;
}
}
if(sp1){
sqlCondition =
"','+cast(t1.xgqxbmxz as nvarchar(2000))+',' like '%," + specialDepartmentId_first + ",%' and sfyx = 0 ";
logger.info("sqlCondition:" + sqlCondition);
return sqlCondition;
}
//若用户为特殊部门2下的用户则选择部门需要包含特殊部门1
boolean sp2= false;
if(specialDepartmentId_second.equals(userDepartment+"")){
sp2 = true;
}
List<String> specila2AllSonId = new ArrayList<>();
CommonSqlUtil.getAllSonDepartment(specila2AllSonId, specialDepartmentId_second);
for(String i : specila2AllSonId){
if(i.equals(userDepartment+"")){
sp2 = true;
}
}
if(sp2){
sqlCondition =
"','+cast(t1.xgqxbmxz as nvarchar(2000))+',' like '%," + specialDepartmentId_second + ",%' and sfyx = 0 ";
logger.info("sqlCondition:" + sqlCondition);
return sqlCondition;
}
List<String> allParentId = new ArrayList<>();
CommonSqlUtil.getAllParentDepartment(allParentId, String.valueOf(userDepartment));
List<String> allSonId = new ArrayList<>();
CommonSqlUtil.getAllSonDepartment(allSonId, String.valueOf(userDepartment));
String whereSql = "','+cast(t1.xgqxbmxz as nvarchar(2000))+',' like '%," + userDepartment + ",%' ";
for(String id : allParentId){
whereSql = whereSql + " or (','+cast(t1.xgqxbmxz as nvarchar(2000))+',' like '%," + id + ",%') ";
}
for(String id : allSonId){
whereSql = whereSql + " or (','+cast(t1.xgqxbmxz as nvarchar(2000))+',' like '%," + id + ",%') ";
}
sqlCondition =
"(" +
whereSql +
") and sfyx = 0 ";
logger.info("sqlCondition:" + sqlCondition);
return sqlCondition;
}catch(Throwable e){
logger.error("LeimiModeCusSearch.generateSqlCondition error;message:" + e.getMessage() + ";e:" + e);
return "";
}
}
}

View File

@ -0,0 +1,87 @@
package com.api.taojw.liangxin;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.logging.MyLogger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import java.util.List;
import java.util.Map;
/**
*
*/
@Path("/liangxintjw")
public class GetDetailDataApi {
Logger logger = MyLogger.getLogger();
@POST
@Path("/getDetailData")
@Produces(MediaType.APPLICATION_JSON)
public String getDetailData(@Context HttpServletRequest request, @Context HttpServletResponse response){
String userId = request.getParameter("userId");
//需求说是取上周一的数据,放在前端处理
String tbksrq = request.getParameter("tbksrq");
try{
JSONObject result = new JSONObject();
RecordSet rs = new RecordSet();
String getMaxLccjsjSql = "select max(lccjsj) as lccjsj from uf_gstzbd where tbr = ?";
Map<String, String> firstData = DaoUtil.getFirstData(rs, getMaxLccjsjSql, userId);
String lccjsj = firstData.get("lccjsj");
String getDetailDataSql =
"select " +
"t1.xmmc as xmmcid," +
"t2.xmmc as xmmcname," +
"t1.xmfzr as xmfzrid," +
"t3.lastname as xmfzrname," +
"t1.zygs, " +
"t1.zegs, " +
"t1.zsgs, " +
"t1.zsgs1, " +
"t1.zwgs, " +
"t1.zlgs, " +
"t1.ztgs," +
"t1.gznr " +
"from " +
"uf_gstzbd t1 " +
"left join uf_xmzsjtzb t2 on t2.id = t1.xmmc " +
"left join hrmresource t3 on t3.id = t1.xmfzr " +
"where " +
"t1.tbr = ? " +
"and t1.lccjsj = ?";
List<Map<String, String>> data = DaoUtil.getData(rs, getDetailDataSql, userId, lccjsj);
JSONArray dataArray = new JSONArray();
for(Map<String, String> m : data){
JSONObject o = new JSONObject();
o.put("xmmcid",m.get("xmmcid"));
o.put("xmmcname",m.get("xmmcname"));
o.put("xmfzrid",m.get("xmfzrid"));
o.put("xmfzrname",m.get("xmfzrname"));
o.put("zygs",m.get("zygs"));
o.put("zegs",m.get("zegs"));
o.put("zsgs",m.get("zsgs"));
o.put("zsgs1",m.get("zsgs1"));
o.put("zwgs",m.get("zwgs"));
o.put("zlgs",m.get("zlgs"));
o.put("ztgs",m.get("ztgs"));
o.put("gznr",m.get("gznr"));
dataArray.add(o);
}
result.put("data",dataArray);
return result.toJSONString();
}catch(Exception e){
logger.error("GetDetailDataApi.getDetailData exception;userId:" + userId + ";tbksrq:" + tbksrq);
}
return "";
}
}

View File

@ -0,0 +1,334 @@
package com.api.taojw.liangxin.baseinfocronjob;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.api.taojw.liangxin.baseinfocronjob.syncbaseinfowebservice.ISysSynchroGetOrgWebServiceServiceLocator;
import com.api.taojw.liangxin.baseinfocronjob.syncbaseinfowebservice.ISysSynchroGetOrgWebServiceServiceSoapBindingStub;
import com.api.taojw.liangxin.baseinfocronjob.syncbaseinfowebservice.SysSynchroGetOrgBaseInfoContextV2;
import com.api.taojw.liangxin.baseinfocronjob.syncbaseinfowebservice.SysSynchroOrgResult;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.interfaces.schedule.BaseCronJob;
import weaver.taojw.common.DaoUtil;
import weaver.taojw.common.TjwModelUtil;
import weaver.taojw.common.logging.MyLogger;
import java.lang.Exception;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
public class SyncBaseInfoCronJob extends BaseCronJob {
//接口提供方webservice地址
private String serviceUrl = "";
//存储人员信息的建模表表名
private String personInfoTable = "";
//存储分部信息的建模表表名
private String orgInfoTable = "";
//存储部门信息的建模表表名
private String deptInfoTable = "";
//存储岗位信息的建模表表名
private String jobInfoTable = "";
public String getServiceUrl() {
return serviceUrl;
}
public void setServiceUrl(String serviceUrl) {
this.serviceUrl = serviceUrl;
}
public String getPersonInfoTable() {
return personInfoTable;
}
public void setPersonInfoTable(String personInfoTable) {
this.personInfoTable = personInfoTable;
}
public String getOrgInfoTable() {
return orgInfoTable;
}
public void setOrgInfoTable(String orgInfoTable) {
this.orgInfoTable = orgInfoTable;
}
public String getDeptInfoTable() {
return deptInfoTable;
}
public void setDeptInfoTable(String deptInfoTable) {
this.deptInfoTable = deptInfoTable;
}
public String getJobInfoTable() {
return jobInfoTable;
}
public void setJobInfoTable(String jobInfoTable) {
this.jobInfoTable = jobInfoTable;
}
Logger logger = MyLogger.getLogger();
@Override
public void execute() {
try{
logger.info("SyncBaseInfoCronJob.execute() begin222");
RecordSet rs = new RecordSet();
String deletePersonSql = "delete from " + personInfoTable + " where bh is null or bh = ''";
String deleteDeptSql = "delete from " + deptInfoTable + " where bh is null or bh = ''";
String deleteOrgSql = "delete from " + orgInfoTable + " where subcompanycode is null or subcompanycode = ''";
String deletePostSql = "delete from " + jobInfoTable + " where gwbm is null or gwbm = ''";
DaoUtil.updateData(rs,deletePersonSql);
DaoUtil.updateData(rs,deleteDeptSql);
DaoUtil.updateData(rs,deleteOrgSql);
DaoUtil.updateData(rs,deletePostSql);
URL wbUrl = new URL(serviceUrl);
ISysSynchroGetOrgWebServiceServiceLocator locator = new ISysSynchroGetOrgWebServiceServiceLocator();
ISysSynchroGetOrgWebServiceServiceSoapBindingStub stub = new ISysSynchroGetOrgWebServiceServiceSoapBindingStub(wbUrl,locator);
SysSynchroGetOrgBaseInfoContextV2 orgContext = new SysSynchroGetOrgBaseInfoContextV2();
//获取人员信息
String returnOrgType = "[{\"type\":\"person\"}]";
orgContext.setReturnOrgType(returnOrgType);
SysSynchroOrgResult elementsBaseInfoV2 = stub.getElementsBaseInfoV2(orgContext);
logger.info("SyncBaseInfoCronJob.execute().getPersonInfo response;ReturnState:" + elementsBaseInfoV2.getReturnState() + ";Count:" + elementsBaseInfoV2.getCount() + ";TimeStamp:" + elementsBaseInfoV2.getTimeStamp() + ";Message:" + elementsBaseInfoV2.getMessage());
//处理人员信息
String personResponseMessage = elementsBaseInfoV2.getMessage();
JSONArray personJsonArray = JSONArray.parseArray(personResponseMessage);
dealPersonInfo(rs,personJsonArray);
//获取部门信息
String returnOrgType2 = "[{\"type\":\"dept\"}]";
orgContext.setReturnOrgType(returnOrgType2);
elementsBaseInfoV2 = stub.getElementsBaseInfoV2(orgContext);
logger.info("SyncBaseInfoCronJob.execute().getDeptInfo response;ReturnState:" + elementsBaseInfoV2.getReturnState() + ";Count:" + elementsBaseInfoV2.getCount() + ";TimeStamp:" + elementsBaseInfoV2.getTimeStamp() + ";Message:" + elementsBaseInfoV2.getMessage());
//处理部门信息
String deptResponseMessage = elementsBaseInfoV2.getMessage();
JSONArray deptJsonArray = JSONArray.parseArray(deptResponseMessage);
dealDeptInfo(rs,deptJsonArray);
//获取岗位信息
String returnOrgType3 = "[{\"type\":\"post\"}]";
orgContext.setReturnOrgType(returnOrgType3);
elementsBaseInfoV2 = stub.getElementsBaseInfoV2(orgContext);
logger.info("SyncBaseInfoCronJob.execute().getPostInfo response;ReturnState:" + elementsBaseInfoV2.getReturnState() + ";Count:" + elementsBaseInfoV2.getCount() + ";TimeStamp:" + elementsBaseInfoV2.getTimeStamp() + ";Message:" + elementsBaseInfoV2.getMessage());
//处理岗位信息
String postResponseMessage = elementsBaseInfoV2.getMessage();
JSONArray postJsonArray = JSONArray.parseArray(postResponseMessage);
dealPostInfo(rs,postJsonArray);
//获取分部信息
String returnOrgType4 = "[{\"type\":\"org\"}]";
orgContext.setReturnOrgType(returnOrgType4);
elementsBaseInfoV2 = stub.getElementsBaseInfoV2(orgContext);
logger.info("SyncBaseInfoCronJob.execute().getOrgInfo response;ReturnState:" + elementsBaseInfoV2.getReturnState() + ";Count:" + elementsBaseInfoV2.getCount() + ";TimeStamp:" + elementsBaseInfoV2.getTimeStamp() + ";Message:" + elementsBaseInfoV2.getMessage());
//处理分部信息
String orgResponseMessage = elementsBaseInfoV2.getMessage();
JSONArray orgJsonArray = JSONArray.parseArray(orgResponseMessage);
dealOrgInfo(rs,orgJsonArray);
//处理人员直接上级
/*String updateManageridSql =
"update " + personInfoTable + " t1 " +
"set t1.managerid = " +
"(select max(workcode) from " + personInfoTable + " t2 where t2.id = " +
"(select max(zzjgbmfzr) from " + deptInfoTable + " t3 where t3.departmentcode = t1.departmentid))";
DaoUtil.updateData(rs,updateManageridSql);*/
}catch(Throwable e){
logger.error("SyncBaseInfoCronJob.execute() exception;messgae:" + e.getMessage() + ";e:" + e);
}
}
private void dealOrgInfo(RecordSet rs,JSONArray orgJsonArray){
for(int i = 0;i< orgJsonArray.size(); i++){
JSONObject org = (JSONObject) orgJsonArray.get(i);
JSONObject orgData = new JSONObject();
//分布简称
orgData.put("subcompanyname",org.get("name"));
//分布编码
orgData.put("subcompanycode",org.get("no"));
//上级分部编码
orgData.put("sjfbbm","");
//分部全称
orgData.put("subcompanydesc",org.get("name"));
//封存标识
boolean isAvailable = (boolean) org.get("isAvailable");
orgData.put("canceled",isAvailable?0:1);
//插入时间
orgData.put("Createdate",new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
//机构负责人
orgData.put("jgfzr",org.get("thisLeader"));
TjwModelUtil.addOrUpdateModelData(rs,orgInfoTable,orgData,"subcompanycode");
}
}
private void dealPostInfo(RecordSet rs,JSONArray postJsonArray){
for(int i = 0;i< postJsonArray.size(); i++){
JSONObject post = (JSONObject) postJsonArray.get(i);
JSONObject postData = new JSONObject();
//封存标识
try{
boolean isAvailable = (boolean) post.get("isAvailable");
postData.put("canceled",isAvailable?0:1);
}catch (Exception e){
logger.error("post isAvailable exception; message:" + e.getMessage() + ";");
}
//岗位编码
postData.put("gwbm",post.get("id"));
//岗位简称
postData.put("departmentid",post.get("name"));
//岗位全称
postData.put("gwqc",post.get("name"));
//插入时间
postData.put("Createdate",new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
TjwModelUtil.addOrUpdateModelData(rs,jobInfoTable,postData,"gwbm");
}
}
private void dealDeptInfo(RecordSet rs,JSONArray deptJsonArray){
for(int i = 0;i< deptJsonArray.size(); i++){
JSONObject dept = (JSONObject) deptJsonArray.get(i);
JSONObject deptData = new JSONObject();
//部门全称
deptData.put("departmentname",dept.get("name"));
//部门简称
deptData.put("departmentmark",dept.get("name"));
//所属分部
deptData.put("subcompanyid1",dept.get("orgCode"));
//上级部门
deptData.put("supdepid",dept.get("parent"));
//部门编码
deptData.put("departmentcode",dept.get("lunid"));
//插入时间
deptData.put("createdate",new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
//部门负责人
deptData.put("zzjgbmfzr",dept.get("thisLeader"));
//封存标识
try{
boolean isAvailable = (boolean) dept.get("isAvailable");
deptData.put("canceled",isAvailable?0:1);
}catch (Exception e){
logger.error("dept isAvailable exception; message:" + e.getMessage() + ";" + dept.get("isAvailable"));
}
//编号
deptData.put("bh",dept.get("no"));
//上级部门编码
deptData.put("sjbmbm",dept.get("parent"));
//部门层级
deptData.put("bmcj",dept.get("fdHierarchyLeve"));
//层级id
deptData.put("cjid",dept.get("fdHierarchyId"));
TjwModelUtil.addOrUpdateModelData(rs,deptInfoTable,deptData,"departmentcode");
}
}
private void dealPersonInfo(RecordSet rs,JSONArray personJsonArray){
for(int i = 0;i< personJsonArray.size(); i++){
JSONObject person = (JSONObject) personJsonArray.get(i);
JSONObject personData = new JSONObject();
//工号
personData.put("workcode",person.get("no"));
//姓名
personData.put("lastname",person.get("name"));
//性别
personData.put("sex",person.get("sex"));
//所在部门
personData.put("departmentid",person.get("parent"));
//所在分部
personData.put("subcompanyid1",person.get("orgCode"));
//直接上级
personData.put("managerid","");
//安全级别
personData.put("seclevl","");
//人员状态
try{
boolean isAvailable = (boolean) person.get("isAvailable");
if(isAvailable){
personData.put("status","1");
}else{
personData.put("status","5");
}
}catch (Exception e){
logger.error("isAvailable exception;isAvailable:" + person.get("isAvailable"));
personData.put("status","1");
}
//国籍
personData.put("nationalID","");
//民族
personData.put("folk","");
//身份证号码
personData.put("certificatenum",person.get("fdIdCard"));
//工作地点
personData.put("locationid","");
//电子邮件
personData.put("email",person.get("email"));
//手机
personData.put("mobile",person.get("mobileNo"));
//岗位
personData.put("jobtitle","");
//岗位级别
personData.put("joblevel","");
//入职日期
String hiredate = (String) person.get("hiredate");
if(hiredate != null && !"".equals(hiredate)){
hiredate = hiredate.substring(0,10);
}
personData.put("Com_date",hiredate );
//离职日期
String fdLeaveTime = (String) person.get("fdLeaveTime");
if(fdLeaveTime != null && !"".equals(fdLeaveTime)){
fdLeaveTime = fdLeaveTime.substring(0,10);
}
personData.put("quitdate",fdLeaveTime);
//插入时间
personData.put("Createdate",new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
//班组
personData.put("bz",person.get("fdWorkTeam"));
//部门编码
personData.put("bmbm",person.get("parent"));
//工作性质
personData.put("gzxz",person.get("fdWorkType"));
//编号
personData.put("bh",person.get("lunid"));
//层级ID
personData.put("cjid",person.get("fdHierarchyId"));
//员工类型
try{
String yglx = "";
String fdPersonType = (String) person.get("fdPersonType");
if("1".equals(fdPersonType)){
yglx = "0";
}else if("2".equals(fdPersonType)){
yglx = "1";
}else if("3".equals(fdPersonType)){
yglx = "2";
}else if("4".equals(fdPersonType)){
yglx = "3";
}
if("".equals(yglx) || "1".equals(yglx) || "2".equals(yglx) || "3".equals(yglx)){
continue;
}
personData.put("yglx",yglx);
}catch(Exception e){
logger.error("yglx exception;message:" + e.getMessage());
}
//机构编码
personData.put("jgbm",person.get("orgCode"));
//劳务关系
personData.put("lwgx",person.get("fdLaborRelation"));
//keyword
personData.put("keyword",person.get("keyword"));
//order
personData.put("order1",person.get("order"));
//数据类型
personData.put("sjlx",person.get("type"));
//id
personData.put("personid",person.get("id"));
TjwModelUtil.addOrUpdateModelData(rs,personInfoTable,personData,"workcode");
}
}
}

View File

@ -0,0 +1,127 @@
/**
* Exception.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.api.taojw.liangxin.baseinfocronjob.syncbaseinfowebservice;
public class Exception extends org.apache.axis.AxisFault implements java.io.Serializable {
private java.lang.String message1;
public Exception() {
}
public Exception(
java.lang.String message1) {
this.message1 = message1;
}
/**
* Gets the message1 value for this Exception.
*
* @return message1
*/
public java.lang.String getMessage1() {
return message1;
}
/**
* Sets the message1 value for this Exception.
*
* @param message1
*/
public void setMessage1(java.lang.String message1) {
this.message1 = message1;
}
private java.lang.Object __equalsCalc = null;
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof Exception)) return false;
Exception other = (Exception) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = true &&
((this.message1==null && other.getMessage1()==null) ||
(this.message1!=null &&
this.message1.equals(other.getMessage1())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = 1;
if (getMessage1() != null) {
_hashCode += getMessage1().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(Exception.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("message1");
elemField.setXmlName(new javax.xml.namespace.QName("", "message"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
/**
* Writes the exception data to the faultDetails
*/
public void writeDetails(javax.xml.namespace.QName qname, org.apache.axis.encoding.SerializationContext context) throws java.io.IOException {
context.serialize(qname, null, this);
}
}

View File

@ -0,0 +1,24 @@
/**
* ISysSynchroGetOrgWebService.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.api.taojw.liangxin.baseinfocronjob.syncbaseinfowebservice;
public interface ISysSynchroGetOrgWebService extends java.rmi.Remote {
public SysSynchroOrgResult getRoleLineInfo(SysSynchroGetOrgInfoContext arg0) throws java.rmi.RemoteException, com.api.taojw.liangxin.baseinfocronjob.syncbaseinfowebservice.Exception;
public SysSynchroOrgResult getOrgStaffingLevelInfo(SysSynchroGetOrgInfoContext arg0) throws java.rmi.RemoteException, com.api.taojw.liangxin.baseinfocronjob.syncbaseinfowebservice.Exception;
public SysSynchroOrgResult getRoleLineDefaultRoleInfo(SysSynchroGetOrgInfoContext arg0) throws java.rmi.RemoteException, com.api.taojw.liangxin.baseinfocronjob.syncbaseinfowebservice.Exception;
public SysSynchroOrgResult getRoleInfo(SysSynchroGetOrgInfoContext arg0) throws java.rmi.RemoteException, com.api.taojw.liangxin.baseinfocronjob.syncbaseinfowebservice.Exception;
public SysSynchroOrgResult getUpdatedElementsV2(SysSynchroGetOrgInfoContextV2 arg0) throws java.rmi.RemoteException, com.api.taojw.liangxin.baseinfocronjob.syncbaseinfowebservice.Exception;
public SysSynchroOrgResult getUpdatedElements(SysSynchroGetOrgInfoContext arg0) throws java.rmi.RemoteException, com.api.taojw.liangxin.baseinfocronjob.syncbaseinfowebservice.Exception;
public SysSynchroOrgTokenResult getUpdatedElementsByToken(SysSynchroGetOrgInfoTokenContext arg0) throws java.rmi.RemoteException, com.api.taojw.liangxin.baseinfocronjob.syncbaseinfowebservice.Exception;
public SysSynchroOrgResult getRoleConfMemberInfo(SysSynchroGetOrgInfoContext arg0) throws java.rmi.RemoteException, com.api.taojw.liangxin.baseinfocronjob.syncbaseinfowebservice.Exception;
public SysSynchroOrgResult getOrgGroupCateInfo(SysSynchroGetOrgInfoContext arg0) throws java.rmi.RemoteException, com.api.taojw.liangxin.baseinfocronjob.syncbaseinfowebservice.Exception;
public SysSynchroOrgResult getRoleConfInfo(SysSynchroGetOrgInfoContext arg0) throws java.rmi.RemoteException, com.api.taojw.liangxin.baseinfocronjob.syncbaseinfowebservice.Exception;
public SysSynchroOrgResult getElementsBaseInfo(SysSynchroGetOrgBaseInfoContext arg0) throws java.rmi.RemoteException, com.api.taojw.liangxin.baseinfocronjob.syncbaseinfowebservice.Exception;
public SysSynchroOrgResult getElementsBaseInfoV2(SysSynchroGetOrgBaseInfoContextV2 arg0) throws java.rmi.RemoteException, com.api.taojw.liangxin.baseinfocronjob.syncbaseinfowebservice.Exception;
public SysSynchroOrgResult getRoleConfCateInfo(SysSynchroGetOrgInfoContext arg0) throws java.rmi.RemoteException, Exception;
}

View File

@ -0,0 +1,16 @@
/**
* ISysSynchroGetOrgWebServiceService.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.api.taojw.liangxin.baseinfocronjob.syncbaseinfowebservice;
public interface ISysSynchroGetOrgWebServiceService extends javax.xml.rpc.Service {
public java.lang.String getISysSynchroGetOrgWebServicePortAddress();
public com.api.taojw.liangxin.baseinfocronjob.syncbaseinfowebservice.ISysSynchroGetOrgWebService getISysSynchroGetOrgWebServicePort() throws javax.xml.rpc.ServiceException;
public ISysSynchroGetOrgWebService getISysSynchroGetOrgWebServicePort(java.net.URL portAddress) throws javax.xml.rpc.ServiceException;
}

View File

@ -0,0 +1,142 @@
/**
* ISysSynchroGetOrgWebServiceServiceLocator.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.api.taojw.liangxin.baseinfocronjob.syncbaseinfowebservice;
public class ISysSynchroGetOrgWebServiceServiceLocator extends org.apache.axis.client.Service implements ISysSynchroGetOrgWebServiceService {
public ISysSynchroGetOrgWebServiceServiceLocator() {
}
public ISysSynchroGetOrgWebServiceServiceLocator(org.apache.axis.EngineConfiguration config) {
super(config);
}
public ISysSynchroGetOrgWebServiceServiceLocator(java.lang.String wsdlLoc, javax.xml.namespace.QName sName) throws javax.xml.rpc.ServiceException {
super(wsdlLoc, sName);
}
// Use to get a proxy class for ISysSynchroGetOrgWebServicePort
private java.lang.String ISysSynchroGetOrgWebServicePort_address = "http://oa.sh-liangxin.com/sys/webservice/sysSynchroGetOrgWebService";
public java.lang.String getISysSynchroGetOrgWebServicePortAddress() {
return ISysSynchroGetOrgWebServicePort_address;
}
// The WSDD service name defaults to the port name.
private java.lang.String ISysSynchroGetOrgWebServicePortWSDDServiceName = "ISysSynchroGetOrgWebServicePort";
public java.lang.String getISysSynchroGetOrgWebServicePortWSDDServiceName() {
return ISysSynchroGetOrgWebServicePortWSDDServiceName;
}
public void setISysSynchroGetOrgWebServicePortWSDDServiceName(java.lang.String name) {
ISysSynchroGetOrgWebServicePortWSDDServiceName = name;
}
public ISysSynchroGetOrgWebService getISysSynchroGetOrgWebServicePort() throws javax.xml.rpc.ServiceException {
java.net.URL endpoint;
try {
endpoint = new java.net.URL(ISysSynchroGetOrgWebServicePort_address);
}
catch (java.net.MalformedURLException e) {
throw new javax.xml.rpc.ServiceException(e);
}
return getISysSynchroGetOrgWebServicePort(endpoint);
}
public ISysSynchroGetOrgWebService getISysSynchroGetOrgWebServicePort(java.net.URL portAddress) throws javax.xml.rpc.ServiceException {
try {
ISysSynchroGetOrgWebServiceServiceSoapBindingStub _stub = new ISysSynchroGetOrgWebServiceServiceSoapBindingStub(portAddress, this);
_stub.setPortName(getISysSynchroGetOrgWebServicePortWSDDServiceName());
return _stub;
}
catch (org.apache.axis.AxisFault e) {
return null;
}
}
public void setISysSynchroGetOrgWebServicePortEndpointAddress(java.lang.String address) {
ISysSynchroGetOrgWebServicePort_address = address;
}
/**
* For the given interface, get the stub implementation.
* If this service has no port for the given interface,
* then ServiceException is thrown.
*/
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
try {
if (ISysSynchroGetOrgWebService.class.isAssignableFrom(serviceEndpointInterface)) {
ISysSynchroGetOrgWebServiceServiceSoapBindingStub _stub = new ISysSynchroGetOrgWebServiceServiceSoapBindingStub(new java.net.URL(ISysSynchroGetOrgWebServicePort_address), this);
_stub.setPortName(getISysSynchroGetOrgWebServicePortWSDDServiceName());
return _stub;
}
}
catch (java.lang.Throwable t) {
throw new javax.xml.rpc.ServiceException(t);
}
throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface: " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
}
/**
* For the given interface, get the stub implementation.
* If this service has no port for the given interface,
* then ServiceException is thrown.
*/
public java.rmi.Remote getPort(javax.xml.namespace.QName portName, Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
if (portName == null) {
return getPort(serviceEndpointInterface);
}
java.lang.String inputPortName = portName.getLocalPart();
if ("ISysSynchroGetOrgWebServicePort".equals(inputPortName)) {
return getISysSynchroGetOrgWebServicePort();
}
else {
java.rmi.Remote _stub = getPort(serviceEndpointInterface);
((org.apache.axis.client.Stub) _stub).setPortName(portName);
return _stub;
}
}
public javax.xml.namespace.QName getServiceName() {
return new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "ISysSynchroGetOrgWebServiceService");
}
private java.util.HashSet ports = null;
public java.util.Iterator getPorts() {
if (ports == null) {
ports = new java.util.HashSet();
ports.add(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "ISysSynchroGetOrgWebServicePort"));
}
return ports.iterator();
}
/**
* Set the endpoint address for the specified port name.
*/
public void setEndpointAddress(java.lang.String portName, java.lang.String address) throws javax.xml.rpc.ServiceException {
if ("ISysSynchroGetOrgWebServicePort".equals(portName)) {
setISysSynchroGetOrgWebServicePortEndpointAddress(address);
}
else
{ // Unknown Port Name
throw new javax.xml.rpc.ServiceException(" Cannot set Endpoint Address for Unknown Port" + portName);
}
}
/**
* Set the endpoint address for the specified port name.
*/
public void setEndpointAddress(javax.xml.namespace.QName portName, java.lang.String address) throws javax.xml.rpc.ServiceException {
setEndpointAddress(portName.getLocalPart(), address);
}
}

View File

@ -0,0 +1,972 @@
/**
* ISysSynchroGetOrgWebServiceServiceSoapBindingStub.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.api.taojw.liangxin.baseinfocronjob.syncbaseinfowebservice;
public class ISysSynchroGetOrgWebServiceServiceSoapBindingStub extends org.apache.axis.client.Stub implements ISysSynchroGetOrgWebService {
private java.util.Vector cachedSerClasses = new java.util.Vector();
private java.util.Vector cachedSerQNames = new java.util.Vector();
private java.util.Vector cachedSerFactories = new java.util.Vector();
private java.util.Vector cachedDeserFactories = new java.util.Vector();
static org.apache.axis.description.OperationDesc [] _operations;
static {
_operations = new org.apache.axis.description.OperationDesc[13];
_initOperationDesc1();
_initOperationDesc2();
}
private static void _initOperationDesc1(){
org.apache.axis.description.OperationDesc oper;
org.apache.axis.description.ParameterDesc param;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("getOrgStaffingLevelInfo");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "arg0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroGetOrgInfoContext"), SysSynchroGetOrgInfoContext.class, false, false);
param.setOmittable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroOrgResult"));
oper.setReturnClass(SysSynchroOrgResult.class);
oper.setReturnQName(new javax.xml.namespace.QName("", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
oper.addFault(new org.apache.axis.description.FaultDesc(
new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception"),
"weaver.taojw.liangxin.cronjob.webservice.Exception",
new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception"),
true
));
_operations[0] = oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("getRoleLineInfo");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "arg0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroGetOrgInfoContext"), SysSynchroGetOrgInfoContext.class, false, false);
param.setOmittable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroOrgResult"));
oper.setReturnClass(SysSynchroOrgResult.class);
oper.setReturnQName(new javax.xml.namespace.QName("", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
oper.addFault(new org.apache.axis.description.FaultDesc(
new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception"),
"weaver.taojw.liangxin.cronjob.webservice.Exception",
new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception"),
true
));
_operations[1] = oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("getRoleLineDefaultRoleInfo");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "arg0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroGetOrgInfoContext"), SysSynchroGetOrgInfoContext.class, false, false);
param.setOmittable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroOrgResult"));
oper.setReturnClass(SysSynchroOrgResult.class);
oper.setReturnQName(new javax.xml.namespace.QName("", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
oper.addFault(new org.apache.axis.description.FaultDesc(
new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception"),
"weaver.taojw.liangxin.cronjob.webservice.Exception",
new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception"),
true
));
_operations[2] = oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("getRoleInfo");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "arg0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroGetOrgInfoContext"), SysSynchroGetOrgInfoContext.class, false, false);
param.setOmittable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroOrgResult"));
oper.setReturnClass(SysSynchroOrgResult.class);
oper.setReturnQName(new javax.xml.namespace.QName("", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
oper.addFault(new org.apache.axis.description.FaultDesc(
new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception"),
"weaver.taojw.liangxin.cronjob.webservice.Exception",
new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception"),
true
));
_operations[3] = oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("getUpdatedElementsV2");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "arg0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroGetOrgInfoContextV2"), SysSynchroGetOrgInfoContextV2.class, false, false);
param.setOmittable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroOrgResult"));
oper.setReturnClass(SysSynchroOrgResult.class);
oper.setReturnQName(new javax.xml.namespace.QName("", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
oper.addFault(new org.apache.axis.description.FaultDesc(
new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception"),
"weaver.taojw.liangxin.cronjob.webservice.Exception",
new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception"),
true
));
_operations[4] = oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("getUpdatedElements");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "arg0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroGetOrgInfoContext"), SysSynchroGetOrgInfoContext.class, false, false);
param.setOmittable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroOrgResult"));
oper.setReturnClass(SysSynchroOrgResult.class);
oper.setReturnQName(new javax.xml.namespace.QName("", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
oper.addFault(new org.apache.axis.description.FaultDesc(
new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception"),
"weaver.taojw.liangxin.cronjob.webservice.Exception",
new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception"),
true
));
_operations[5] = oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("getUpdatedElementsByToken");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "arg0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroGetOrgInfoTokenContext"), SysSynchroGetOrgInfoTokenContext.class, false, false);
param.setOmittable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroOrgTokenResult"));
oper.setReturnClass(SysSynchroOrgTokenResult.class);
oper.setReturnQName(new javax.xml.namespace.QName("", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
oper.addFault(new org.apache.axis.description.FaultDesc(
new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception"),
"weaver.taojw.liangxin.cronjob.webservice.Exception",
new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception"),
true
));
_operations[6] = oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("getRoleConfMemberInfo");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "arg0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroGetOrgInfoContext"), SysSynchroGetOrgInfoContext.class, false, false);
param.setOmittable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroOrgResult"));
oper.setReturnClass(SysSynchroOrgResult.class);
oper.setReturnQName(new javax.xml.namespace.QName("", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
oper.addFault(new org.apache.axis.description.FaultDesc(
new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception"),
"weaver.taojw.liangxin.cronjob.webservice.Exception",
new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception"),
true
));
_operations[7] = oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("getOrgGroupCateInfo");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "arg0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroGetOrgInfoContext"), SysSynchroGetOrgInfoContext.class, false, false);
param.setOmittable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroOrgResult"));
oper.setReturnClass(SysSynchroOrgResult.class);
oper.setReturnQName(new javax.xml.namespace.QName("", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
oper.addFault(new org.apache.axis.description.FaultDesc(
new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception"),
"weaver.taojw.liangxin.cronjob.webservice.Exception",
new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception"),
true
));
_operations[8] = oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("getRoleConfInfo");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "arg0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroGetOrgInfoContext"), SysSynchroGetOrgInfoContext.class, false, false);
param.setOmittable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroOrgResult"));
oper.setReturnClass(SysSynchroOrgResult.class);
oper.setReturnQName(new javax.xml.namespace.QName("", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
oper.addFault(new org.apache.axis.description.FaultDesc(
new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception"),
"weaver.taojw.liangxin.cronjob.webservice.Exception",
new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception"),
true
));
_operations[9] = oper;
}
private static void _initOperationDesc2(){
org.apache.axis.description.OperationDesc oper;
org.apache.axis.description.ParameterDesc param;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("getElementsBaseInfo");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "arg0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroGetOrgBaseInfoContext"), SysSynchroGetOrgBaseInfoContext.class, false, false);
param.setOmittable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroOrgResult"));
oper.setReturnClass(SysSynchroOrgResult.class);
oper.setReturnQName(new javax.xml.namespace.QName("", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
oper.addFault(new org.apache.axis.description.FaultDesc(
new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception"),
"weaver.taojw.liangxin.cronjob.webservice.Exception",
new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception"),
true
));
_operations[10] = oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("getElementsBaseInfoV2");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "arg0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroGetOrgBaseInfoContextV2"), SysSynchroGetOrgBaseInfoContextV2.class, false, false);
param.setOmittable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroOrgResult"));
oper.setReturnClass(SysSynchroOrgResult.class);
oper.setReturnQName(new javax.xml.namespace.QName("", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
oper.addFault(new org.apache.axis.description.FaultDesc(
new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception"),
"weaver.taojw.liangxin.cronjob.webservice.Exception",
new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception"),
true
));
_operations[11] = oper;
oper = new org.apache.axis.description.OperationDesc();
oper.setName("getRoleConfCateInfo");
param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "arg0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroGetOrgInfoContext"), SysSynchroGetOrgInfoContext.class, false, false);
param.setOmittable(true);
oper.addParameter(param);
oper.setReturnType(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroOrgResult"));
oper.setReturnClass(SysSynchroOrgResult.class);
oper.setReturnQName(new javax.xml.namespace.QName("", "return"));
oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
oper.setUse(org.apache.axis.constants.Use.LITERAL);
oper.addFault(new org.apache.axis.description.FaultDesc(
new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception"),
"weaver.taojw.liangxin.cronjob.webservice.Exception",
new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception"),
true
));
_operations[12] = oper;
}
public ISysSynchroGetOrgWebServiceServiceSoapBindingStub() throws org.apache.axis.AxisFault {
this(null);
}
public ISysSynchroGetOrgWebServiceServiceSoapBindingStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
this(service);
super.cachedEndpoint = endpointURL;
}
public ISysSynchroGetOrgWebServiceServiceSoapBindingStub(javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
if (service == null) {
super.service = new org.apache.axis.client.Service();
} else {
super.service = service;
}
((org.apache.axis.client.Service)super.service).setTypeMappingVersion("1.2");
java.lang.Class cls;
javax.xml.namespace.QName qName;
javax.xml.namespace.QName qName2;
java.lang.Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class;
java.lang.Class beandf = org.apache.axis.encoding.ser.BeanDeserializerFactory.class;
java.lang.Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class;
java.lang.Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class;
java.lang.Class arraysf = org.apache.axis.encoding.ser.ArraySerializerFactory.class;
java.lang.Class arraydf = org.apache.axis.encoding.ser.ArrayDeserializerFactory.class;
java.lang.Class simplesf = org.apache.axis.encoding.ser.SimpleSerializerFactory.class;
java.lang.Class simpledf = org.apache.axis.encoding.ser.SimpleDeserializerFactory.class;
java.lang.Class simplelistsf = org.apache.axis.encoding.ser.SimpleListSerializerFactory.class;
java.lang.Class simplelistdf = org.apache.axis.encoding.ser.SimpleListDeserializerFactory.class;
qName = new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "Exception");
cachedSerQNames.add(qName);
cls = Exception.class;
cachedSerClasses.add(cls);
cachedSerFactories.add(beansf);
cachedDeserFactories.add(beandf);
qName = new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroGetOrgBaseInfoContext");
cachedSerQNames.add(qName);
cls = SysSynchroGetOrgBaseInfoContext.class;
cachedSerClasses.add(cls);
cachedSerFactories.add(beansf);
cachedDeserFactories.add(beandf);
qName = new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroGetOrgBaseInfoContextV2");
cachedSerQNames.add(qName);
cls = SysSynchroGetOrgBaseInfoContextV2.class;
cachedSerClasses.add(cls);
cachedSerFactories.add(beansf);
cachedDeserFactories.add(beandf);
qName = new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroGetOrgContext");
cachedSerQNames.add(qName);
cls = SysSynchroGetOrgContext.class;
cachedSerClasses.add(cls);
cachedSerFactories.add(beansf);
cachedDeserFactories.add(beandf);
qName = new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroGetOrgInfoContext");
cachedSerQNames.add(qName);
cls = SysSynchroGetOrgInfoContext.class;
cachedSerClasses.add(cls);
cachedSerFactories.add(beansf);
cachedDeserFactories.add(beandf);
qName = new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroGetOrgInfoContextV2");
cachedSerQNames.add(qName);
cls = SysSynchroGetOrgInfoContextV2.class;
cachedSerClasses.add(cls);
cachedSerFactories.add(beansf);
cachedDeserFactories.add(beandf);
qName = new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroGetOrgInfoTokenContext");
cachedSerQNames.add(qName);
cls = SysSynchroGetOrgInfoTokenContext.class;
cachedSerClasses.add(cls);
cachedSerFactories.add(beansf);
cachedDeserFactories.add(beandf);
qName = new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroOrgResult");
cachedSerQNames.add(qName);
cls = SysSynchroOrgResult.class;
cachedSerClasses.add(cls);
cachedSerFactories.add(beansf);
cachedDeserFactories.add(beandf);
qName = new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroOrgTokenResult");
cachedSerQNames.add(qName);
cls = SysSynchroOrgTokenResult.class;
cachedSerClasses.add(cls);
cachedSerFactories.add(beansf);
cachedDeserFactories.add(beandf);
}
protected org.apache.axis.client.Call createCall() throws java.rmi.RemoteException {
try {
org.apache.axis.client.Call _call = super._createCall();
if (super.maintainSessionSet) {
_call.setMaintainSession(super.maintainSession);
}
if (super.cachedUsername != null) {
_call.setUsername(super.cachedUsername);
}
if (super.cachedPassword != null) {
_call.setPassword(super.cachedPassword);
}
if (super.cachedEndpoint != null) {
_call.setTargetEndpointAddress(super.cachedEndpoint);
}
if (super.cachedTimeout != null) {
_call.setTimeout(super.cachedTimeout);
}
if (super.cachedPortName != null) {
_call.setPortName(super.cachedPortName);
}
java.util.Enumeration keys = super.cachedProperties.keys();
while (keys.hasMoreElements()) {
java.lang.String key = (java.lang.String) keys.nextElement();
_call.setProperty(key, super.cachedProperties.get(key));
}
// All the type mapping information is registered
// when the first call is made.
// The type mapping information is actually registered in
// the TypeMappingRegistry of the service, which
// is the reason why registration is only needed for the first call.
synchronized (this) {
if (firstCall()) {
// must set encoding style before registering serializers
_call.setEncodingStyle(null);
for (int i = 0; i < cachedSerFactories.size(); ++i) {
java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i);
javax.xml.namespace.QName qName =
(javax.xml.namespace.QName) cachedSerQNames.get(i);
java.lang.Object x = cachedSerFactories.get(i);
if (x instanceof Class) {
java.lang.Class sf = (java.lang.Class)
cachedSerFactories.get(i);
java.lang.Class df = (java.lang.Class)
cachedDeserFactories.get(i);
_call.registerTypeMapping(cls, qName, sf, df, false);
}
else if (x instanceof javax.xml.rpc.encoding.SerializerFactory) {
org.apache.axis.encoding.SerializerFactory sf = (org.apache.axis.encoding.SerializerFactory)
cachedSerFactories.get(i);
org.apache.axis.encoding.DeserializerFactory df = (org.apache.axis.encoding.DeserializerFactory)
cachedDeserFactories.get(i);
_call.registerTypeMapping(cls, qName, sf, df, false);
}
}
}
}
return _call;
}
catch (java.lang.Throwable _t) {
throw new org.apache.axis.AxisFault("Failure trying to get the Call object", _t);
}
}
public SysSynchroOrgResult getOrgStaffingLevelInfo(SysSynchroGetOrgInfoContext arg0) throws java.rmi.RemoteException, Exception {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[0]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "getOrgStaffingLevelInfo"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {arg0});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (SysSynchroOrgResult) _resp;
} catch (java.lang.Exception _exception) {
return (SysSynchroOrgResult) org.apache.axis.utils.JavaUtils.convert(_resp, SysSynchroOrgResult.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
if (axisFaultException.detail != null) {
if (axisFaultException.detail instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException) axisFaultException.detail;
}
if (axisFaultException.detail instanceof Exception) {
throw (Exception) axisFaultException.detail;
}
}
throw axisFaultException;
}
}
public SysSynchroOrgResult getRoleLineInfo(SysSynchroGetOrgInfoContext arg0) throws java.rmi.RemoteException, Exception {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[1]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "getRoleLineInfo"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {arg0});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (SysSynchroOrgResult) _resp;
} catch (java.lang.Exception _exception) {
return (SysSynchroOrgResult) org.apache.axis.utils.JavaUtils.convert(_resp, SysSynchroOrgResult.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
if (axisFaultException.detail != null) {
if (axisFaultException.detail instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException) axisFaultException.detail;
}
if (axisFaultException.detail instanceof Exception) {
throw (Exception) axisFaultException.detail;
}
}
throw axisFaultException;
}
}
public SysSynchroOrgResult getRoleLineDefaultRoleInfo(SysSynchroGetOrgInfoContext arg0) throws java.rmi.RemoteException, Exception {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[2]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "getRoleLineDefaultRoleInfo"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {arg0});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (SysSynchroOrgResult) _resp;
} catch (java.lang.Exception _exception) {
return (SysSynchroOrgResult) org.apache.axis.utils.JavaUtils.convert(_resp, SysSynchroOrgResult.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
if (axisFaultException.detail != null) {
if (axisFaultException.detail instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException) axisFaultException.detail;
}
if (axisFaultException.detail instanceof Exception) {
throw (Exception) axisFaultException.detail;
}
}
throw axisFaultException;
}
}
public SysSynchroOrgResult getRoleInfo(SysSynchroGetOrgInfoContext arg0) throws java.rmi.RemoteException, Exception {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[3]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "getRoleInfo"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {arg0});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (SysSynchroOrgResult) _resp;
} catch (java.lang.Exception _exception) {
return (SysSynchroOrgResult) org.apache.axis.utils.JavaUtils.convert(_resp, SysSynchroOrgResult.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
if (axisFaultException.detail != null) {
if (axisFaultException.detail instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException) axisFaultException.detail;
}
if (axisFaultException.detail instanceof Exception) {
throw (Exception) axisFaultException.detail;
}
}
throw axisFaultException;
}
}
public SysSynchroOrgResult getUpdatedElementsV2(SysSynchroGetOrgInfoContextV2 arg0) throws java.rmi.RemoteException, Exception {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[4]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "getUpdatedElementsV2"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {arg0});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (SysSynchroOrgResult) _resp;
} catch (java.lang.Exception _exception) {
return (SysSynchroOrgResult) org.apache.axis.utils.JavaUtils.convert(_resp, SysSynchroOrgResult.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
if (axisFaultException.detail != null) {
if (axisFaultException.detail instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException) axisFaultException.detail;
}
if (axisFaultException.detail instanceof Exception) {
throw (Exception) axisFaultException.detail;
}
}
throw axisFaultException;
}
}
public SysSynchroOrgResult getUpdatedElements(SysSynchroGetOrgInfoContext arg0) throws java.rmi.RemoteException, Exception {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[5]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "getUpdatedElements"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {arg0});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (SysSynchroOrgResult) _resp;
} catch (java.lang.Exception _exception) {
return (SysSynchroOrgResult) org.apache.axis.utils.JavaUtils.convert(_resp, SysSynchroOrgResult.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
if (axisFaultException.detail != null) {
if (axisFaultException.detail instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException) axisFaultException.detail;
}
if (axisFaultException.detail instanceof Exception) {
throw (Exception) axisFaultException.detail;
}
}
throw axisFaultException;
}
}
public SysSynchroOrgTokenResult getUpdatedElementsByToken(SysSynchroGetOrgInfoTokenContext arg0) throws java.rmi.RemoteException, Exception {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[6]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "getUpdatedElementsByToken"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {arg0});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (SysSynchroOrgTokenResult) _resp;
} catch (java.lang.Exception _exception) {
return (SysSynchroOrgTokenResult) org.apache.axis.utils.JavaUtils.convert(_resp, SysSynchroOrgTokenResult.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
if (axisFaultException.detail != null) {
if (axisFaultException.detail instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException) axisFaultException.detail;
}
if (axisFaultException.detail instanceof Exception) {
throw (Exception) axisFaultException.detail;
}
}
throw axisFaultException;
}
}
public SysSynchroOrgResult getRoleConfMemberInfo(SysSynchroGetOrgInfoContext arg0) throws java.rmi.RemoteException, Exception {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[7]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "getRoleConfMemberInfo"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {arg0});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (SysSynchroOrgResult) _resp;
} catch (java.lang.Exception _exception) {
return (SysSynchroOrgResult) org.apache.axis.utils.JavaUtils.convert(_resp, SysSynchroOrgResult.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
if (axisFaultException.detail != null) {
if (axisFaultException.detail instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException) axisFaultException.detail;
}
if (axisFaultException.detail instanceof Exception) {
throw (Exception) axisFaultException.detail;
}
}
throw axisFaultException;
}
}
public SysSynchroOrgResult getOrgGroupCateInfo(SysSynchroGetOrgInfoContext arg0) throws java.rmi.RemoteException, Exception {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[8]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "getOrgGroupCateInfo"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {arg0});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (SysSynchroOrgResult) _resp;
} catch (java.lang.Exception _exception) {
return (SysSynchroOrgResult) org.apache.axis.utils.JavaUtils.convert(_resp, SysSynchroOrgResult.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
if (axisFaultException.detail != null) {
if (axisFaultException.detail instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException) axisFaultException.detail;
}
if (axisFaultException.detail instanceof Exception) {
throw (Exception) axisFaultException.detail;
}
}
throw axisFaultException;
}
}
public SysSynchroOrgResult getRoleConfInfo(SysSynchroGetOrgInfoContext arg0) throws java.rmi.RemoteException, Exception {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[9]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "getRoleConfInfo"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {arg0});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (SysSynchroOrgResult) _resp;
} catch (java.lang.Exception _exception) {
return (SysSynchroOrgResult) org.apache.axis.utils.JavaUtils.convert(_resp, SysSynchroOrgResult.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
if (axisFaultException.detail != null) {
if (axisFaultException.detail instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException) axisFaultException.detail;
}
if (axisFaultException.detail instanceof Exception) {
throw (Exception) axisFaultException.detail;
}
}
throw axisFaultException;
}
}
public SysSynchroOrgResult getElementsBaseInfo(SysSynchroGetOrgBaseInfoContext arg0) throws java.rmi.RemoteException, Exception {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[10]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "getElementsBaseInfo"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {arg0});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (SysSynchroOrgResult) _resp;
} catch (java.lang.Exception _exception) {
return (SysSynchroOrgResult) org.apache.axis.utils.JavaUtils.convert(_resp, SysSynchroOrgResult.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
if (axisFaultException.detail != null) {
if (axisFaultException.detail instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException) axisFaultException.detail;
}
if (axisFaultException.detail instanceof Exception) {
throw (Exception) axisFaultException.detail;
}
}
throw axisFaultException;
}
}
public SysSynchroOrgResult getElementsBaseInfoV2(SysSynchroGetOrgBaseInfoContextV2 arg0) throws java.rmi.RemoteException, Exception {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[11]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "getElementsBaseInfoV2"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {arg0});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (SysSynchroOrgResult) _resp;
} catch (java.lang.Exception _exception) {
return (SysSynchroOrgResult) org.apache.axis.utils.JavaUtils.convert(_resp, SysSynchroOrgResult.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
if (axisFaultException.detail != null) {
if (axisFaultException.detail instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException) axisFaultException.detail;
}
if (axisFaultException.detail instanceof Exception) {
throw (Exception) axisFaultException.detail;
}
}
throw axisFaultException;
}
}
public SysSynchroOrgResult getRoleConfCateInfo(SysSynchroGetOrgInfoContext arg0) throws java.rmi.RemoteException, Exception {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[12]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "getRoleConfCateInfo"));
setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {arg0});
if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return (SysSynchroOrgResult) _resp;
} catch (java.lang.Exception _exception) {
return (SysSynchroOrgResult) org.apache.axis.utils.JavaUtils.convert(_resp, SysSynchroOrgResult.class);
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
if (axisFaultException.detail != null) {
if (axisFaultException.detail instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException) axisFaultException.detail;
}
if (axisFaultException.detail instanceof Exception) {
throw (Exception) axisFaultException.detail;
}
}
throw axisFaultException;
}
}
}

View File

@ -0,0 +1,162 @@
/**
* SysSynchroGetOrgBaseInfoContext.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.api.taojw.liangxin.baseinfocronjob.syncbaseinfowebservice;
public class SysSynchroGetOrgBaseInfoContext extends SysSynchroGetOrgContext implements java.io.Serializable {
private java.lang.String beginTimeStamp;
private java.lang.String returnType;
public SysSynchroGetOrgBaseInfoContext() {
}
public SysSynchroGetOrgBaseInfoContext(
java.lang.String returnOrgType,
java.lang.String specifiedDate,
java.lang.String beginTimeStamp,
java.lang.String returnType) {
super(
returnOrgType,
specifiedDate);
this.beginTimeStamp = beginTimeStamp;
this.returnType = returnType;
}
/**
* Gets the beginTimeStamp value for this SysSynchroGetOrgBaseInfoContext.
*
* @return beginTimeStamp
*/
public java.lang.String getBeginTimeStamp() {
return beginTimeStamp;
}
/**
* Sets the beginTimeStamp value for this SysSynchroGetOrgBaseInfoContext.
*
* @param beginTimeStamp
*/
public void setBeginTimeStamp(java.lang.String beginTimeStamp) {
this.beginTimeStamp = beginTimeStamp;
}
/**
* Gets the returnType value for this SysSynchroGetOrgBaseInfoContext.
*
* @return returnType
*/
public java.lang.String getReturnType() {
return returnType;
}
/**
* Sets the returnType value for this SysSynchroGetOrgBaseInfoContext.
*
* @param returnType
*/
public void setReturnType(java.lang.String returnType) {
this.returnType = returnType;
}
private java.lang.Object __equalsCalc = null;
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof SysSynchroGetOrgBaseInfoContext)) return false;
SysSynchroGetOrgBaseInfoContext other = (SysSynchroGetOrgBaseInfoContext) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = super.equals(obj) &&
((this.beginTimeStamp==null && other.getBeginTimeStamp()==null) ||
(this.beginTimeStamp!=null &&
this.beginTimeStamp.equals(other.getBeginTimeStamp()))) &&
((this.returnType==null && other.getReturnType()==null) ||
(this.returnType!=null &&
this.returnType.equals(other.getReturnType())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = super.hashCode();
if (getBeginTimeStamp() != null) {
_hashCode += getBeginTimeStamp().hashCode();
}
if (getReturnType() != null) {
_hashCode += getReturnType().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(SysSynchroGetOrgBaseInfoContext.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroGetOrgBaseInfoContext"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("beginTimeStamp");
elemField.setXmlName(new javax.xml.namespace.QName("", "beginTimeStamp"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("returnType");
elemField.setXmlName(new javax.xml.namespace.QName("", "returnType"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}

View File

@ -0,0 +1,166 @@
/**
* SysSynchroGetOrgBaseInfoContextV2.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package com.api.taojw.liangxin.baseinfocronjob.syncbaseinfowebservice;
public class SysSynchroGetOrgBaseInfoContextV2 extends SysSynchroGetOrgBaseInfoContext implements java.io.Serializable {
private java.lang.String extendPara;
private java.lang.Boolean isBusiness;
public SysSynchroGetOrgBaseInfoContextV2() {
}
public SysSynchroGetOrgBaseInfoContextV2(
java.lang.String returnOrgType,
java.lang.String specifiedDate,
java.lang.String beginTimeStamp,
java.lang.String returnType,
java.lang.String extendPara,
java.lang.Boolean isBusiness) {
super(
returnOrgType,
specifiedDate,
beginTimeStamp,
returnType);
this.extendPara = extendPara;
this.isBusiness = isBusiness;
}
/**
* Gets the extendPara value for this SysSynchroGetOrgBaseInfoContextV2.
*
* @return extendPara
*/
public java.lang.String getExtendPara() {
return extendPara;
}
/**
* Sets the extendPara value for this SysSynchroGetOrgBaseInfoContextV2.
*
* @param extendPara
*/
public void setExtendPara(java.lang.String extendPara) {
this.extendPara = extendPara;
}
/**
* Gets the isBusiness value for this SysSynchroGetOrgBaseInfoContextV2.
*
* @return isBusiness
*/
public java.lang.Boolean getIsBusiness() {
return isBusiness;
}
/**
* Sets the isBusiness value for this SysSynchroGetOrgBaseInfoContextV2.
*
* @param isBusiness
*/
public void setIsBusiness(java.lang.Boolean isBusiness) {
this.isBusiness = isBusiness;
}
private java.lang.Object __equalsCalc = null;
public synchronized boolean equals(java.lang.Object obj) {
if (!(obj instanceof SysSynchroGetOrgBaseInfoContextV2)) return false;
SysSynchroGetOrgBaseInfoContextV2 other = (SysSynchroGetOrgBaseInfoContextV2) obj;
if (obj == null) return false;
if (this == obj) return true;
if (__equalsCalc != null) {
return (__equalsCalc == obj);
}
__equalsCalc = obj;
boolean _equals;
_equals = super.equals(obj) &&
((this.extendPara==null && other.getExtendPara()==null) ||
(this.extendPara!=null &&
this.extendPara.equals(other.getExtendPara()))) &&
((this.isBusiness==null && other.getIsBusiness()==null) ||
(this.isBusiness!=null &&
this.isBusiness.equals(other.getIsBusiness())));
__equalsCalc = null;
return _equals;
}
private boolean __hashCodeCalc = false;
public synchronized int hashCode() {
if (__hashCodeCalc) {
return 0;
}
__hashCodeCalc = true;
int _hashCode = super.hashCode();
if (getExtendPara() != null) {
_hashCode += getExtendPara().hashCode();
}
if (getIsBusiness() != null) {
_hashCode += getIsBusiness().hashCode();
}
__hashCodeCalc = false;
return _hashCode;
}
// Type metadata
private static org.apache.axis.description.TypeDesc typeDesc =
new org.apache.axis.description.TypeDesc(SysSynchroGetOrgBaseInfoContextV2.class, true);
static {
typeDesc.setXmlType(new javax.xml.namespace.QName("http://out.webservice.organization.sys.kmss.landray.com/", "sysSynchroGetOrgBaseInfoContextV2"));
org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("extendPara");
elemField.setXmlName(new javax.xml.namespace.QName("", "extendPara"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("isBusiness");
elemField.setXmlName(new javax.xml.namespace.QName("", "isBusiness"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
elemField.setMinOccurs(0);
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);
}
/**
* Return type metadata object
*/
public static org.apache.axis.description.TypeDesc getTypeDesc() {
return typeDesc;
}
/**
* Get Custom Serializer
*/
public static org.apache.axis.encoding.Serializer getSerializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanSerializer(
_javaType, _xmlType, typeDesc);
}
/**
* Get Custom Deserializer
*/
public static org.apache.axis.encoding.Deserializer getDeserializer(
java.lang.String mechType,
java.lang.Class _javaType,
javax.xml.namespace.QName _xmlType) {
return
new org.apache.axis.encoding.ser.BeanDeserializer(
_javaType, _xmlType, typeDesc);
}
}

Some files were not shown because too many files have changed in this diff Show More