问题描述
static{Timertimer=newTimer();System.out.println("1111111111111");SMSHelpersms=newSMSHelper();System.out.println("2222222222222222222");timer.schedule(sms,30000,30000);}@Overridepublicvoidrun(){Filefile=newFile(Message.class.getResource("/").getPath()+"smg.properties");System.out.println(file);longtime=file.lastModified();System.out.println(time);//判断时间是否相等if(time!=date){InputStreamin=SMSHelper.class.getClassLoader().getResourceAsStream("smg.properties");System.out.println(in);Propertiesp=newProperties();try{p.load(in);//smsUrl=p.getProperty("sms.url");dirtyMobiles=p.getProperty("sms.dirtymobiles");smsTemplatePrepaid=p.getProperty("sms.content.prepaid");smsTemplatePrepaidRomotion=p.getProperty("sms.content.prepaid.romotion");smsTemplateWithdraw=p.getProperty("sms.content.withdraw");smswebTemplateWithdraw=p.getProperty("sms.content.webWithdraw");smsTemplate306Open=p.getProperty("sms.content.306.open");smsTemplate306Prepaid=p.getProperty("sms.content.306.prepaid");smsTemplatePresentOpen=p.getProperty("sms.content.present.open");smsTemplatePresentPrepaid=p.getProperty("sms.content.present.prepaid");smsTemplateUpw=p.getProperty("sms.content.upw");smsTemplateAccountOpen=p.getProperty("sms.content.accountOpen");smsTemplateValidateCode=p.getProperty("sms.content.validateCode");//smsTemplateUserOpenRegister=p.getProperty("sms.content.userRegister");engineerMobiles=p.getProperty("sms.engineermobiles");send_betscheme_insufficient=p.getProperty("sms.content.betscheme.insufficient");sendStationStatus_1=p.getProperty("sms.content.stationApply.status_1");sendStationStatus_2=p.getProperty("sms.content.stationApply.status_2");sendStationStatus_3=p.getProperty("sms.content.stationApply.status_3");sendStationStatus_4=p.getProperty("sms.content.stationApply.status_4");sendStationStatus_6=p.getProperty("sms.content.stationApply.status_6");sendStationApplySuccessManager=p.getProperty("sms.content.stationApply.status_success_manager");sendStationApplySuccessSells=p.getProperty("sms.content.stationApply.status_success_sells");sendStationCancel=p.getProperty("sms.content.submitStationCancel");sendStationCancelStatus_1=p.getProperty("sms.content.StationCancel.status_1");sendStationCancelStatus_2=p.getProperty("sms.content.StationCancel.status_2");sendStationCancelMessage=p.getProperty("sms.content.StationCancel.message");sendStationCancelSuccess=p.getProperty("sms.content.StationCancel.success");//短信通知站点客服经理sendStationCancelCsm=p.getProperty("sms.content.StationCancel.csm");sendStationCancelSuccessCsm=p.getProperty("sms.content.StationCancel.success.csm");sendStationApplySuccessCsm=p.getProperty("sms.content.StationApply.success.csm");sendStationApplyObsolete=p.getProperty("sms.stationApply.obsolete");sendStationCancelObsolete=p.getProperty("sms.stationCancel.obsolete");sendStationApplyBack_6=p.getProperty("sms.content.stationApply.back_6");sendStationApplyBack_3=p.getProperty("sms.content.stationApply.back_3");//sendStationApply=p.getProperty("sms.content.submitStationApply");//连接短信平台login();//心跳hearbeat();date=time;System.out.println(date);}catch(IOExceptione){//TODOAuto-generatedcatchblocke.printStackTrace();}}else{}}我这样弄是出得来但是老大说太复杂要我弄个线程重新建个类继承我没搞懂求大神支援!!!
解决方案
解决方案二:
看着逻辑没什么复杂的,你把大量的sendStationCancelStatus_2=p.getProperty("sms.content.StationCancel.status_2");这种代码用方法或类封装一下..
解决方案三:
我封装了再怎么弄?