@ -931,159 +931,4 @@ public class HrmSelfHelpController {
return requestCountInfo ;
}
@GetMapping ( "/testSapi80" )
@WeaPermission ( publicPermission = true )
public WeaResult < Object > testSapi80 ( HttpServletRequest request ) {
log . error ( "testSapi80" ) ;
String field_id = "977306579913818114" ;
String groupId = "weaver-ebuilder-form-service" ;
String sourceType = "LOGIC" ;
String employeeId = request . getParameter ( "employeeId" ) ;
if ( StringUtils . isBlank ( employeeId ) ) {
employeeId = String . valueOf ( UserContext . getCurrentEmployeeId ( ) ) ;
}
List < Map < String , Object > > dataList = new ArrayList < Map < String , Object > > ( ) ;
try {
String sql = " select distinct taby from uf_zzfwrkpz where ry='" + employeeId + "' and qy is not null and taby is not null and delete_type=0 and tenant_key ='" + tenant_key + "'" ;
log . error ( "sql:" + sql ) ;
Map < String , Object > result = databaseUtils . execute ( sourceType , groupId , sql ) ;
List < Map < String , Object > > recordList = databaseUtils . getDataSourceList ( result ) ;
if ( recordList . size ( ) > 0 ) {
// /api/file/preview?type=redirect&imgFormat=small&fileId=977697615197618177&module=ebuilderform&authModule=ebuilderform&source=form&fieldId=977686869110833154&customParam=%7B%22dataId%22%3A%22977697666574729218%22%7D&refId=977697666574729218&folderId=8120831157448215424
dataList = getCustomeServiceData ( groupId , sourceType , field_id , recordList , employeeId ) ;
} else {
dataList = getDefaultServiceData ( groupId , sourceType , field_id ) ;
}
} catch ( Exception e ) {
log . error ( "testSapi51-Exception:" + e . getMessage ( ) ) ;
return WeaResult . fail ( 500 , "程序执行异常" ) ;
}
return WeaResult . success ( dataList ) ;
}
/ * * *
*
* @param groupId
* @param sourceType
* @return
* /
public Map < String , String > getCustomServiceTypeName ( String groupId , String sourceType , String employeeId ) {
Map < String , String > optionMap = new HashMap < String , String > ( ) ;
String sql = " select id,tabymmc from uf_zzfwrktaby where qy is not null and ry='" + employeeId + "' and delete_type=0 and tenant_key = '" + tenant_key + "'" ;
log . error ( "getCustomServiceTypeName-sql:" + sql ) ;
Map < String , Object > result = databaseUtils . execute ( sourceType , groupId , sql ) ;
List < Map < String , Object > > recordList = databaseUtils . getDataSourceList ( result ) ;
for ( int i = 0 ; i < recordList . size ( ) ; i + + ) {
Map < String , Object > recordMap = recordList . get ( i ) ;
String value = String . valueOf ( recordMap . get ( "id" ) ) ;
String name = String . valueOf ( recordMap . get ( "tabymmc" ) ) ;
log . error ( "getCustomServiceTypeName-value:" + value + " name:" + name ) ;
optionMap . put ( value , name ) ;
}
return optionMap ;
}
public List < Map < String , Object > > getCustomeServiceData ( String groupId , String sourceType , String field_id , List < Map < String , Object > > recordList , String employeeId ) {
Map < String , String > optionMap = getCustomServiceTypeName ( groupId , sourceType , employeeId ) ;
for ( int i = 0 ; i < recordList . size ( ) ; i + + ) {
Map < String , Object > recordMap = recordList . get ( i ) ;
String taby = String . valueOf ( recordMap . get ( "taby" ) ) ;
log . error ( "getCustemSelfServiceType-taby:" + taby ) ;
String tabyName = optionMap . get ( taby ) ;
List < Map < String , Object > > customList = getCustomeServiceDataByType ( groupId , sourceType , taby , employeeId ) ;
log . error ( "getCustemSelfServiceType-tabyName:" + tabyName ) ;
log . error ( "getCustemSelfServiceType-taby:" + taby ) ;
recordMap . put ( "menus" , customList ) ;
recordMap . put ( "name" , tabyName ) ;
}
return recordList ;
}
public List < Map < String , Object > > getCustomeServiceDataByType ( String groupId , String sourceType , String value , String employeeId ) {
String sql = " select fwmc,fwdz,fwtb,taby from uf_zzfwrkpz where ry='" + employeeId + "' and qy is not null and taby is not null and taby=" + value + " and delete_type=0 and tenant_key = '" + tenant_key + "'" ;
log . info ( "getSelfServiceData--sql:" + sql ) ;
Map < String , Object > result = databaseUtils . execute ( sourceType , groupId , sql ) ;
List < Map < String , Object > > recordList = databaseUtils . getDataSourceList ( result ) ;
for ( int i = 0 ; i < recordList . size ( ) ; i + + ) {
Map < String , Object > recordMap = recordList . get ( i ) ;
String fwtb = String . valueOf ( recordMap . get ( "fwtb" ) ) ;
String fwtburl = "" ;
if ( StringUtils . isNotBlank ( fwtb ) ) {
fwtburl = "/api/file/preview?fileId=" + fwtb + "&module=ebuilderform&authModule=ebuilderform&type=imgs&source=form&fieldId=" + fwtb + "&imgFormat=small" ;
}
recordMap . put ( "fwtburl" , fwtburl ) ;
}
return recordList ;
}
/ * * *
* 默 认 数 据
* @param groupId
* @param sourceType
* @return
* /
public List < Map < String , Object > > getDefaultServiceData ( String groupId , String sourceType , String field_id ) {
String sql = " select name,value_key as taby from field_option where field_id='" + field_id + "' and delete_type=0 and tenant_key = '" + tenant_key + "'" ;
log . info ( "sql:" + sql ) ;
Map < String , Object > result = databaseUtils . execute ( sourceType , groupId , sql ) ;
List < Map < String , Object > > recordList = databaseUtils . getDataSourceList ( result ) ;
for ( int i = 0 ; i < recordList . size ( ) ; i + + ) {
Map < String , Object > recordMap = recordList . get ( i ) ;
String taby = String . valueOf ( recordMap . get ( "taby" ) ) ;
List < Map < String , Object > > defaultList = getDefaultServiceDataByType ( groupId , sourceType , taby ) ;
recordMap . put ( "menus" , defaultList ) ;
}
return recordList ;
}
/ * * *
* 默 认 数 据
* @param groupId
* @param sourceType
* @param value
* @return
* /
public List < Map < String , Object > > getDefaultServiceDataByType ( String groupId , String sourceType , String value ) {
String sql = " select t.taby,t.fwtb,t.fwmc,t.fwdz\n" +
" from uf_zzfwcsh t \n" +
" where t.delete_type=0 \n" +
" and t.taby=" + value +
" and t.tenant_key = '" + tenant_key + "'" ;
log . error ( "getSelfServiceData--sql:" + sql ) ;
Map < String , Object > result = databaseUtils . execute ( sourceType , groupId , sql ) ;
List < Map < String , Object > > recordList = databaseUtils . getDataSourceList ( result ) ;
for ( int i = 0 ; i < recordList . size ( ) ; i + + ) {
Map < String , Object > recordMap = recordList . get ( i ) ;
String fwtb = String . valueOf ( recordMap . get ( "fwtb" ) ) ;
String fwtburl = "" ;
if ( StringUtils . isNotBlank ( fwtb ) ) {
fwtburl = "/api/file/preview?fileId=" + fwtb + "&module=ebuilderform&authModule=ebuilderform&type=imgs&source=form&fieldId=" + fwtb + "&imgFormat=small" ;
}
recordMap . put ( "fwtburl" , fwtburl ) ;
}
return recordList ;
}
}