@ -38,7 +38,7 @@ public class WfUtil {
String poolname = CONN_TYPE . ebuilder . getType ( ) ;
rs . setTenantKey ( jtzhTenantKey ) ;
//从集团租户 根据传入的wfid获取有效的wfid
validWfif = getValidWfid ( jtzhTenantKey , currentWfid );
validWfif = getValidWfid ( jtzhTenantKey , currentWfid ,"E10JTZH" , jtzhTenantKey );
log . error ( "getZhWfMap validWfif : " + validWfif ) ;
if ( "" . equals ( validWfif ) ) { //如果为空就是其他租户的新流程
validWfif = currentWfid ;
@ -64,26 +64,31 @@ public class WfUtil {
String zhbs = getZhbs ( workcode , jtzhTenantKey ) ;
sszh = getZhbsInfo ( zhbs , jtzhTenantKey ) ;
}
Map < String , String > zhmap = getZhTenantKey ( sszh , jtzhTenantKey ) ;
//log.error(JSON.toJSONString(zhmap));
tenantKey = zhmap . get ( "zzkey" ) ;
String zhsjy = zhmap . get ( "zhsjy" ) ; ;
if ( "0" . equals ( sszh ) ) { //集团
workflowid = jtwfid ;
tenantKey = getZhTenantKey ( sszh , jtzhTenantKey ) ;
} else if ( "1" . equals ( sszh ) ) { //光电
workflowid = gdwfid ;
tenantKey = getZhTenantKey ( sszh , jtzhTenantKey ) ;
} else if ( "2" . equals ( sszh ) ) { //华海租户
workflowid = hhwfid ;
tenantKey = getZhTenantKey ( sszh , jtzhTenantKey ) ;
}
log . error ( "getZhWfMap workflowid : " + workflowid ) ;
if ( "" . equals ( workflowid ) ) {
workflowid = validWfif ;
tenantKey = jtzhTenantKey ;
zhsjy = "E10JTZH" ;
}
validWfif = getValidWfid ( tenantKey , workflowid ) ;
validWfif = getValidWfid ( tenantKey , workflowid , zhsjy , jtzhTenantKey ) ;
Map < String , String > map = new HashMap < > ( ) ;
Map < String , String > map = new HashMap < > ( ) ;
map . put ( "workflowid" , validWfif ) ;
map . put ( "tenantKey" , tenantKey ) ;
map . put ( "zhsjy" , zhsjy ) ;
log . error ( "map : " + map ) ;
return map ;
}
@ -99,7 +104,7 @@ public class WfUtil {
String poolname = CONN_TYPE . ebuilder . getType ( ) ;
rs . setTenantKey ( jtzhTenantKey ) ;
//从集团租户 根据传入的wfid获取有效的wfid
validWfif = getValidWfid ( jtzhTenantKey , currentWfid );
validWfif = getValidWfid ( jtzhTenantKey , currentWfid ,"E10JTZH" , jtzhTenantKey );
log . error ( "getZhWfMapNoUser validWfif : " + validWfif ) ;
if ( "" . equals ( validWfif ) ) { //如果为空就是其他租户的新流程
validWfif = currentWfid ;
@ -125,27 +130,32 @@ public class WfUtil {
// String zhbs = getZhbs(workcode,jtzhTenantKey);
// sszh = getZhbsInfo(zhbs,jtzhTenantKey);
// }
Map < String , String > zhmap = getZhTenantKey ( sszh , jtzhTenantKey ) ;
//log.error(JSON.toJSONString(zhmap));
tenantKey = zhmap . get ( "zzkey" ) ;
String zhsjy = zhmap . get ( "zhsjy" ) ;
if ( "0" . equals ( sszh ) ) { //集团
workflowid = jtwfid ;
tenantKey = getZhTenantKey ( sszh , jtzhTenantKey ) ;
} else if ( "1" . equals ( sszh ) ) { //光电
workflowid = gdwfid ;
tenantKey = getZhTenantKey ( sszh , jtzhTenantKey ) ;
} else if ( "2" . equals ( sszh ) ) { //华海租户
workflowid = hhwfid ;
tenantKey = getZhTenantKey ( sszh , jtzhTenantKey ) ;
}
log . error ( "getZhWfMapNoUser workflowid : " + workflowid ) ;
if ( "" . equals ( workflowid ) ) {
workflowid = validWfif ;
tenantKey = jtzhTenantKey ;
}
validWfif = getValidWfid ( tenantKey , workflowid ) ;
validWfif = getValidWfid ( tenantKey , workflowid , zhsjy , jtzhTenantKey ) ;
Map < String , String > map = new HashMap < > ( ) ;
map . put ( "workflowid" , validWfif ) ;
map . put ( "tenantKey" , tenantKey ) ;
map . put ( "zhsjy" , zhsjy ) ;
log . error ( "map : " + map ) ;
return map ;
}
@ -179,32 +189,39 @@ public class WfUtil {
return sszh ;
}
public String getZhTenantKey ( String sszh , String jtzhTenantKey ) {
public Map < String , String > getZhTenantKey ( String sszh , String jtzhTenantKey ) {
String zzkey = "" ;
RecordSet rs = I18nContextUtil . getBean ( RecordSet . class ) ;
String poolname = CONN_TYPE . ebuilder . getType ( ) ;
rs . setTenantKey ( jtzhTenantKey ) ;
String sql = "select zzkey from e10_common.dbo.uf_tenant_mt where sszh='" + sszh + "' and delete_type ='0'" ;
String zhsjy = "" ;
String sql = "select zzkey,zhsjy from e10_common.dbo.uf_tenant_mt where sszh='" + sszh + "' and delete_type ='0'" ;
rs . executeSql ( sql , poolname ) ;
if ( rs . next ( ) ) {
zzkey = Util . null2String ( rs . getString ( "zzkey" ) ) ;
zhsjy = Util . null2String ( rs . getString ( "zhsjy" ) ) ;
}
return zzkey ;
Map < String , String > map = new HashMap < > ( ) ;
map . put ( "zzkey" , zzkey ) ;
map . put ( "zhsjy" , zhsjy ) ;
return map ;
}
public String getValidWfid ( String tenantKey , String wfid ) {
public String getValidWfid ( String tenantKey , String wfid , String zhsjy , String jtzhTenantKey ) {
String workflowid = "" ;
RecordSet rs = I18nContextUtil . getBean ( RecordSet . class ) ;
rs . setTenantKey ( tenantKey ) ;
String sql = "SELECT CASE WHEN status = 1 THEN id ELSE activewfid END AS workflowid FROM e10_core_business.dbo.wfp_base WHERE id like '%" + wfid + "' AND delete_type = 0 AND tenant_key = '" + tenantKey + "'" ;
// log.error("oaflowid:"+sql);
rs . executeSql ( sql , CONN_TYPE . workflow . getType ( ) ) ;
if ( rs . next ( ) ) {
rs . setTenantKey ( jtzhTenantKey ) ;
String sql = "SELECT CASE WHEN status = 1 THEN id ELSE activewfid END AS workflowid FROM e10_core_business.dbo.wfp_base WHERE id like '%" + wfid + "' AND delete_type = 0 AND tenant_key = '" + tenantKey + "'" ;
//log.error("oaflowid:"+sql+" zhsjy:"+zhsjy);
rs . executeSql ( sql , zhsjy ) ;
//log.error(JSON.toJSONString(rs.getExecuteResult()));
if ( rs . next ( ) ) {
workflowid = Util . null2String ( rs . getString ( "workflowid" ) ) ;
}
return workflowid ;
}