| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.vci.client.mw.ClientContextVariable; |
| | | import com.vci.client.mw.LaunchModeEnum; |
| | | import com.vci.corba.common.PLException; |
| | | import com.vci.corba.omd.data.AttributeValue; |
| | | import com.vci.frameworkcore.constant.FrameWorkBtmTypeConstant; |
| | | import com.vci.frameworkcore.properties.VciFramworkCompatibilityProperties; |
| | | import com.vci.starter.web.annotation.config.VciConfigField; |
| | | import com.vci.starter.web.annotation.config.VciConfigModule; |
| | | import com.vci.starter.web.enumpck.DataSecretEnum; |
| | | import com.vci.starter.web.enumpck.SessionStorageTypeEnum; |
| | | import com.vci.starter.web.enumpck.UserSecretEnum; |
| | | import com.vci.starter.web.interceptor.VciSessionForLoginI; |
| | |
| | | import com.vci.starter.web.wrapper.VciQueryWrapperForDO; |
| | | import com.vci.web.pageModel.OsAttributeVO; |
| | | import com.vci.web.properties.WebProperties; |
| | | import com.vci.web.service.*; |
| | | import com.vci.web.service.OsAttributeServiceI; |
| | | import com.vci.web.service.VciMdServiceI; |
| | | import com.vci.web.service.WebSecretServiceI; |
| | | import com.vci.web.service.impl.UIEngineServiceImpl; |
| | | import com.vci.web.service.impl.WebContextInfoFetcher; |
| | | import com.vci.web.service.impl.WebInitServiceImpl; |
| | |
| | | import java.io.FileNotFoundException; |
| | | import java.io.IOException; |
| | | import java.lang.reflect.Field; |
| | | import java.lang.reflect.InvocationTargetException; |
| | | import java.lang.reflect.Method; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | public void initSetting() { |
| | | System.out.println("----初始化用于查询配置的用户----"); |
| | | ClientContextVariable.setClientLanuchMode(LaunchModeEnum.WebApp); |
| | | InvocationUtility.registerIInvocationContext(contextInfoFetcher); |
| | | JacorbClientRequestInterceptor.sessionContext = contextInfoFetcher; |
| | | // InvocationUtility.registerIInvocationContext(contextInfoFetcher); |
| | | // JacorbClientRequestInterceptor.sessionContext = contextInfoFetcher; |
| | | System.out.println("----初始化用于查询配置的用户完成----"); |
| | | System.out.println("----开始扫描有VciConfigModule注解的类----"); |
| | | String[] namesForAnnotation = ApplicationContextProvider.getApplicationContext().getBeanNamesForAnnotation(VciConfigModule.class); |
| | |
| | | } |
| | | configFieldMap.put(vciConfigField.value(),field); |
| | | }); |
| | | // configFieldMap.forEach((configField,field)->{ |
| | | // String configValue = null; |
| | | // try { |
| | | // configValue = platformClientUtil.getLogonFactoryService().getFrameworkService().getConfigValue("",configField); |
| | | // } catch (VCIError vciError) { |
| | | // if(logger.isErrorEnabled()){ |
| | | // logger.error(vciError.error_code,vciError); |
| | | // } |
| | | // } |
| | | // Class<?> fieldType = field.getType(); |
| | | // Method method = WebUtil.getSetmethod(bean.getClass(), field); |
| | | // Object value = null; |
| | | // if(fieldType.equals(Boolean.class) || fieldType.equals(boolean.class)){ |
| | | // value = ("on".equalsIgnoreCase(configValue) || "true".equalsIgnoreCase(configValue))?true:false; |
| | | // }else if(fieldType.equals(Double.class) || fieldType.equals(double.class)){ |
| | | // value = WebUtil.getDouble(configValue); |
| | | // }else if(fieldType.equals(Long.class) || fieldType.equals(long.class)){ |
| | | // value = WebUtil.getLong(configValue); |
| | | // }else if(fieldType.equals(Float.class) || fieldType.equals(float.class)){ |
| | | // value = WebUtil.getFloat(configValue); |
| | | // }else if(fieldType.equals(Integer.class) || fieldType.equals(int.class)){ |
| | | // value = WebUtil.getInt(configValue); |
| | | // }else{ |
| | | // value = configValue; |
| | | // } |
| | | // try { |
| | | // method.invoke(bean,value); |
| | | // } catch (IllegalAccessException e) { |
| | | // if(logger.isErrorEnabled()){ |
| | | // logger.error(e.getMessage(),e); |
| | | // } |
| | | // } catch (InvocationTargetException e) { |
| | | // if(logger.isErrorEnabled()){ |
| | | // logger.error(e.getMessage(),e); |
| | | // } |
| | | // } |
| | | // }); |
| | | configFieldMap.forEach((configField,field)->{ |
| | | String configValue = null; |
| | | try { |
| | | configValue = platformClientUtil.getFrameworkService().getConfigValue(configField); |
| | | } catch (PLException vciError) { |
| | | if(logger.isErrorEnabled()){ |
| | | logger.error(vciError.code,vciError); |
| | | } |
| | | } |
| | | Class<?> fieldType = field.getType(); |
| | | Method method = WebUtil.getSetmethod(bean.getClass(), field); |
| | | Object value = null; |
| | | if(fieldType.equals(Boolean.class) || fieldType.equals(boolean.class)){ |
| | | value = ("on".equalsIgnoreCase(configValue) || "true".equalsIgnoreCase(configValue))?true:false; |
| | | }else if(fieldType.equals(Double.class) || fieldType.equals(double.class)){ |
| | | value = WebUtil.getDouble(configValue); |
| | | }else if(fieldType.equals(Long.class) || fieldType.equals(long.class)){ |
| | | value = WebUtil.getLong(configValue); |
| | | }else if(fieldType.equals(Float.class) || fieldType.equals(float.class)){ |
| | | value = WebUtil.getFloat(configValue); |
| | | }else if(fieldType.equals(Integer.class) || fieldType.equals(int.class)){ |
| | | value = WebUtil.getInt(configValue); |
| | | }else{ |
| | | value = configValue; |
| | | } |
| | | try { |
| | | method.invoke(bean,value); |
| | | } catch (IllegalAccessException e) { |
| | | if(logger.isErrorEnabled()){ |
| | | logger.error(e.getMessage(),e); |
| | | } |
| | | } catch (InvocationTargetException e) { |
| | | if(logger.isErrorEnabled()){ |
| | | logger.error(e.getMessage(),e); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | } |