From de466ba891048ab8d21ad59ffce0f9ab70161b25 Mon Sep 17 00:00:00 2001 From: liuguijing <123456> Date: Fri, 14 Feb 2025 20:27:51 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9F=AD=E4=BF=A1=E9=80=9A=E7=94=A8=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E4=BF=AE=E6=94=B9=E4=B8=AD=EF=BC=9A=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E5=8F=82=E6=95=B0=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E6=95=B0=E7=BB=84=E6=97=B6=E5=85=A8=E6=98=AF=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E4=B8=B2=E7=B1=BB=E5=9E=8B=E7=9A=84bug,=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=8F=91=E9=80=81=E7=9F=AD=E4=BF=A1=E7=A9=BA=E6=8C=87?= =?UTF-8?q?=E9=92=88=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xypower/common/MicroPhotoContext.java | 8 +- .../com/xypower/mpmaster/sms/SimUtil.java | 71 ++-- .../xypower/mpmaster/sms/SmsSendReceiver.java | 6 +- .../com/xypower/mpmaster/sms/StringUtils.java | 4 +- .../mpmaster/sms/UpdateSysConfigUtil.java | 314 +++++++++--------- 5 files changed, 216 insertions(+), 187 deletions(-) diff --git a/common/src/main/java/com/xypower/common/MicroPhotoContext.java b/common/src/main/java/com/xypower/common/MicroPhotoContext.java index d7596dce..3e33894b 100644 --- a/common/src/main/java/com/xypower/common/MicroPhotoContext.java +++ b/common/src/main/java/com/xypower/common/MicroPhotoContext.java @@ -83,7 +83,7 @@ public class MicroPhotoContext { public static String getPrimaryStoragePath(Context context) { try { StorageManager sm = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE); - Method getVolumePathsMethod = StorageManager.class.getMethod("getVolumePaths", (Class[])null); + Method getVolumePathsMethod = StorageManager.class.getMethod("getVolumePaths", (Class[]) null); Object[] args = null; String[] paths = (String[]) getVolumePathsMethod.invoke(sm, args); // first element in paths[] is primary storage path @@ -99,7 +99,7 @@ public class MicroPhotoContext { public static String getSecondaryStoragePath(Context context) { try { StorageManager sm = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE); - Method getVolumePathsMethod = StorageManager.class.getMethod("getVolumePaths", (Class[])null); + Method getVolumePathsMethod = StorageManager.class.getMethod("getVolumePaths", (Class[]) null); Object[] args = null; String[] paths = (String[]) getVolumePathsMethod.invoke(sm, args); // second element in paths[] is secondary storage path @@ -114,7 +114,7 @@ public class MicroPhotoContext { public String getStorageState(Context context, String path) { try { StorageManager sm = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE); - Method getVolumeStateMethod = StorageManager.class.getMethod("getVolumeState", new Class[] {String.class}); + Method getVolumeStateMethod = StorageManager.class.getMethod("getVolumeState", new Class[]{String.class}); String state = (String) getVolumeStateMethod.invoke(sm, path); return state; } catch (Exception e) { @@ -399,7 +399,7 @@ public class MicroPhotoContext { } intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent restartIntent = PendingIntent.getActivity(context, 0, intent, 0); - AlarmManager mgr = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE); + AlarmManager mgr = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); mgr.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + delayedTimeMs, restartIntent); } diff --git a/mpmaster/src/main/java/com/xypower/mpmaster/sms/SimUtil.java b/mpmaster/src/main/java/com/xypower/mpmaster/sms/SimUtil.java index 7241c667..1d81d28a 100644 --- a/mpmaster/src/main/java/com/xypower/mpmaster/sms/SimUtil.java +++ b/mpmaster/src/main/java/com/xypower/mpmaster/sms/SimUtil.java @@ -28,14 +28,18 @@ import androidx.core.app.ActivityCompat; import com.dev.devapi.api.SysApi; import com.xypower.common.FilesUtils; import com.xypower.common.JSONUtils; +import com.xypower.common.MicroPhotoContext; import com.xypower.common.NetworkUtils; import com.xypower.mpmaster.MpMasterService; +import org.json.JSONArray; import org.json.JSONObject; import java.io.File; +import java.lang.reflect.Field; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -55,9 +59,12 @@ public class SimUtil { // 自定义ACTION常数 作为广播的IntentFilter识别常数 public static String SMS_SEND_ACTION = "com.xypower.mpmaster.SMS_SEND_ACTION"; - public static String RESTARTTYPE = "restartType"; + public static String SMSRESTARTTYPE = "restartType"; private static int mRequestCode = 1; + private static String sendmessage = null;//要回复的短信 + + private static int restartType = -1;//重启类型 //短信解析 public static void analysisSMSInfo(final Context context, final Intent intent, final SmsMessage smsMessage) { @@ -70,19 +77,18 @@ public class SimUtil { } int slot = smsInfo.getSlot();//那张卡收到的短信 String sender = smsInfo.getSender();//收到的短信的手机号 - String sendmessage = null;//要回复的短信 - int restartType = 0;//重启类型 + if (StringUtils.isEmpty(content)) { return; } if (content.toLowerCase().contains(SmsTypeEnum.UPD_CFG_FILE.value().toLowerCase())) { //修改配置文件中参数 - updateConfig(sendmessage, restartType, context, content); + updateConfig(context, content); } else if (content.toLowerCase().contains(SmsTypeEnum.GET_CFG_FILE.value().toLowerCase())) {//获取配置文件中参数 - queryConfig(sendmessage, restartType, context, content); + queryConfig(context, content); } else if (content.toLowerCase().contains(SmsTypeEnum.UPD_FILE.value().toLowerCase())) {//替换配置文件 - updateFile(sendmessage, restartType, context, content); + updateFile(context, content); } else if (content.toLowerCase().contains(SmsTypeEnum.GET_FILE.value().toLowerCase())) {//获取整个配置文件 - queryFile(sendmessage, restartType, context, content); + queryFile(context, content); } sendSms(context, slot, sender, sendmessage, restartType); @@ -801,11 +807,11 @@ public class SimUtil { //修改配置文件中参数 - private static void updateConfig(String sendmessage, int restartType, Context context, String content) { + private static void updateConfig(Context context, String content) { boolean ifmessageCorrect = true; Map fields = new HashMap<>(); try { - String[] parts = StringUtils.splitStringByDh(SmsTypeEnum.UPD_CFG_FILE.value(), content); + String[] parts = StringUtils.splitStringByDh(content.substring(SmsTypeEnum.UPD_CFG_FILE.value().length())); int fileType = 0; int numberOfFields = 0; String filePath = null; @@ -847,11 +853,14 @@ public class SimUtil { if (configType == 0) { // Number Long val = Long.parseLong(configValue); JSONUtils.updateConfigFile(filePath, fileName, configName, configType, val); + } else if (configType == 1) { + JSONUtils.updateConfigFile(filePath, fileName, configName, configType, configValue); } else if (configType == 2) { // Float Float val = Float.parseFloat(configValue); JSONUtils.updateConfigFile(filePath, fileName, configName, configType, val); - } else { - JSONUtils.updateConfigFile(filePath, fileName, configName, configType, configValue); + } else if (configType == 3) { //数组 + JSONArray objects = new JSONArray(configValue); + JSONUtils.updateConfigFile(filePath, fileName, configName, configType, objects); } } else { ifmessageCorrect = false; @@ -883,11 +892,11 @@ public class SimUtil { } //替换配置文件 - private static void updateFile(String sendmessage, int restartType, Context context, String content) { + private static void updateFile(Context context, String content) { boolean ifmessageCorrect = true; Map fields = new HashMap<>(); try { - String[] parts = StringUtils.splitStringByDh(SmsTypeEnum.UPD_FILE.value(), content); + String[] parts = StringUtils.splitStringByDh(content.substring(SmsTypeEnum.UPD_FILE.value().length())); int fileType = 0; int numberOfFields = 0; String filePath = null; @@ -948,11 +957,11 @@ public class SimUtil { } //获取配置文件 - private static void queryFile(String sendmessage, int restartType, Context context, String content) { + private static void queryFile(Context context, String content) { boolean ifmessageCorrect = true; String result = null; try { - String[] parts = StringUtils.splitStringByDh(SmsTypeEnum.GET_FILE.value(), content); + String[] parts = StringUtils.splitStringByDh(content.substring(SmsTypeEnum.GET_FILE.value().length())); int fileType = 0; String filePath = null; String fileName = null; @@ -1008,10 +1017,10 @@ public class SimUtil { } //获取配置文件参数 - private static void queryConfig(String sendmessage, int restartType, Context context, String content) { + private static void queryConfig(Context context, String content) { boolean ifmessageCorrect = true; try { - String[] parts = StringUtils.splitStringByDh(SmsTypeEnum.GET_CFG_FILE.value(), content); + String[] parts = StringUtils.splitStringByDh(content.substring(SmsTypeEnum.GET_CFG_FILE.value().length())); int fileType = 0; String filePath = null; String fileName = null; @@ -1253,7 +1262,8 @@ public class SimUtil { } } Intent itSend = new Intent(SMS_SEND_ACTION); - itSend.putExtra(RESTARTTYPE, restartType); + itSend.putExtra(SMSRESTARTTYPE, restartType); +// itSend.putExtra(SMSIFCORRECT, true); // itSend.putExtra(SMSDATA, (Serializable) jsonArray); //sendIntent参数为传送后接受的广播信息PendingIntent PendingIntent sendPI = PendingIntent.getBroadcast(mContext, mRequestCode++, itSend, 0); @@ -1263,7 +1273,7 @@ public class SimUtil { // PendingIntent deliverPI = PendingIntent.getBroadcast(mContext,0,itDeliver,0); if (simInfoAnother != null) { SmsManager smsManager = SmsManager.getSmsManagerForSubscriptionId(simInfoAnother.getSubscriptionId()); - if (message.length() > 70) { + if (message != null && message.length() > 70) { ArrayList msgs = smsManager.divideMessage(message); ArrayList sentIntents = new ArrayList(); @@ -1384,6 +1394,29 @@ public class SimUtil { return getIcc(subID, getModelSlot(mContext)); } +// public static int saveConfig(Context mContext) { +// JSONObject jsonObject = MicroPhotoContext.getJsonObject(mContext); +// Field[] fields = masterConfig.getClass().getDeclaredFields(); +// for (Field field : fields) { +// if (key.equalsIgnoreCase(field.getName()) && !key.equalsIgnoreCase(SmsTypeEnum.CFGFILE.value())) { +// if (value != null) { +// try { +// if (field.getType() == String.class) { +// field.set(masterConfig, value); +// } else if (field.getType() == int.class) { +// Integer num = StringUtils.convert2Int(value); +// if (num != null) { +// field.set(masterConfig, num.intValue()); +// } +// } +// } catch (IllegalAccessException e) { +// } +// } +// } +// } +// MicroPhotoContext.saveMasterConfig(mContext, masterConfig); +// } + //获取对应的卡槽ID和iccID 关联 private static List getModelSlot(Context mContext) { List data = new ArrayList<>(); diff --git a/mpmaster/src/main/java/com/xypower/mpmaster/sms/SmsSendReceiver.java b/mpmaster/src/main/java/com/xypower/mpmaster/sms/SmsSendReceiver.java index 9e5b6c81..2e147017 100644 --- a/mpmaster/src/main/java/com/xypower/mpmaster/sms/SmsSendReceiver.java +++ b/mpmaster/src/main/java/com/xypower/mpmaster/sms/SmsSendReceiver.java @@ -25,11 +25,7 @@ public class SmsSendReceiver extends BroadcastReceiver { } if (SimUtil.SMS_SEND_ACTION.equals(action)) { - int restartType = intent.getIntExtra(SimUtil.RESTARTTYPE, -1); - if (restartType == -1) { - return; - } - + int restartType = intent.getIntExtra(SimUtil.SMSRESTARTTYPE, -1); Thread th = new Thread(new Runnable() { @Override public void run() { diff --git a/mpmaster/src/main/java/com/xypower/mpmaster/sms/StringUtils.java b/mpmaster/src/main/java/com/xypower/mpmaster/sms/StringUtils.java index 888eddbc..2f249bb8 100644 --- a/mpmaster/src/main/java/com/xypower/mpmaster/sms/StringUtils.java +++ b/mpmaster/src/main/java/com/xypower/mpmaster/sms/StringUtils.java @@ -346,9 +346,9 @@ public class StringUtils { /** * 排除outStr字段后,按照,号切割字符串 */ - public static String[] splitStringByDh(String outStr, String content) { + public static String[] splitStringByDh(String content) { String[] temp = null; - temp = TextUtils.split(content.substring(outStr.length()), "(\\s|,|,)"); + temp = TextUtils.split(content, "(\\s|,|,)"); return temp; } diff --git a/mpmaster/src/main/java/com/xypower/mpmaster/sms/UpdateSysConfigUtil.java b/mpmaster/src/main/java/com/xypower/mpmaster/sms/UpdateSysConfigUtil.java index 95c73cdd..dccdc568 100644 --- a/mpmaster/src/main/java/com/xypower/mpmaster/sms/UpdateSysConfigUtil.java +++ b/mpmaster/src/main/java/com/xypower/mpmaster/sms/UpdateSysConfigUtil.java @@ -340,7 +340,7 @@ public class UpdateSysConfigUtil { Intent intent = new Intent(MicroPhotoContext.ACTION_RESTART_MP); intent.putExtra("noDelay", 1); - intent.setPackage(PACKAGE_NAME_MPAPP); + intent.setPackage(MicroPhotoContext.PACKAGE_NAME_MPAPP); context.sendBroadcast(intent); try { @@ -411,161 +411,161 @@ public class UpdateSysConfigUtil { return msg; } -// public static void setCommon(Context context, String actType, ArrayList list, String restartType) { -// if (actType.toLowerCase().equalsIgnoreCase(SmsTypeEnum.SET.value().toLowerCase())) { -// for (int i = 0; i < list.size(); i++) { -// HashMap hashMap = list.get(i); -// String s = (String) hashMap.get(SmsTypeEnum.CFGFILE.value()); -// if (s.equalsIgnoreCase(SmsTypeEnum.APP.value())) { -// MicroPhotoContext.AppConfig mpAppConfig = MicroPhotoContext.getMpAppConfig(context); -// Field[] fields = mpAppConfig.getClass().getDeclaredFields(); -// for (Field field : fields) { -// hashMap.forEach((key, value) -> { -// if (key.equalsIgnoreCase(field.getName()) && !key.equalsIgnoreCase(SmsTypeEnum.CFGFILE.value())) { -// if (value != null) { -// try { -// if (field.getType() == String.class) { -// field.set(mpAppConfig, value); -// } else if (field.getType() == int.class) { -// Integer num = StringUtils.convert2Int(value); -// if (num != null) { -// field.set(mpAppConfig, num.intValue()); -// } -// } -// } catch (IllegalAccessException e) { -// } -// } -// } -// }); -// } -// MicroPhotoContext.saveMpAppConfig(context, mpAppConfig); -// } else if (s.equalsIgnoreCase(SmsTypeEnum.MASTER.value())) { -// MicroPhotoContext.MasterConfig masterConfig = MicroPhotoContext.getMasterConfig(context); -// Field[] fields = masterConfig.getClass().getDeclaredFields(); -// for (Field field : fields) { -// hashMap.forEach((key, value) -> { -// if (key.equalsIgnoreCase(field.getName()) && !key.equalsIgnoreCase(SmsTypeEnum.CFGFILE.value())) { -// if (value != null) { -// try { -// if (field.getType() == String.class) { -// field.set(masterConfig, value); -// } else if (field.getType() == int.class) { -// Integer num = StringUtils.convert2Int(value); -// if (num != null) { -// field.set(masterConfig, num.intValue()); -// } -// } -// } catch (IllegalAccessException e) { -// } -// } -// } -// }); -// } -// MicroPhotoContext.saveMasterConfig(context, masterConfig); -// } -// } -// } else if (actType.toLowerCase().equalsIgnoreCase(SmsTypeEnum.GET.value().toLowerCase())) { -// for (int i = 0; i < list.size(); i++) { -// HashMap hashMap = list.get(i); -// String s = (String) hashMap.get(SmsTypeEnum.CFGFILE.value()); -// if (s.equalsIgnoreCase(SmsTypeEnum.APP.value())) { -// MicroPhotoContext.AppConfig mpAppConfig = MicroPhotoContext.getMpAppConfig(context); -// Field[] fields = mpAppConfig.getClass().getDeclaredFields(); -// for (Field field : fields) { -// hashMap.forEach((key, value) -> { -// if (key.equalsIgnoreCase(field.getName()) && !key.equalsIgnoreCase(SmsTypeEnum.CFGFILE.value())) { -// try { -// if (field.getType() == String.class) { -// value = (String) field.get(mpAppConfig); -// } else if (field.getType() == int.class) { -// Integer num = StringUtils.convert2Int(value); -// if (num != null) { -// value = (String) field.get(mpAppConfig); -// } -// } -// } catch (IllegalAccessException e) { -// } -// } -// }); -// } -// } else if (s.equalsIgnoreCase(SmsTypeEnum.MASTER.value())) { -// MicroPhotoContext.MasterConfig masterConfig = MicroPhotoContext.getMasterConfig(context); -// Field[] fields = masterConfig.getClass().getDeclaredFields(); -// for (Field field : fields) { -// hashMap.forEach((key, value) -> { -// if (key.equalsIgnoreCase(field.getName()) && !key.equalsIgnoreCase(SmsTypeEnum.CFGFILE.value())) { -// try { -// if (field.getType() == String.class) { -// value = (String) field.get(masterConfig); -// } else if (field.getType() == int.class) { -// Integer num = StringUtils.convert2Int(value); -// if (num != null) { -// value = (String) field.get(masterConfig); -// } -// } -// } catch (IllegalAccessException e) { -// } -// } -// }); -// } -// } -// } -// } else if (actType.toLowerCase().equalsIgnoreCase(SmsTypeEnum.SETFILE.value().toLowerCase())) { -// for (int i = 0; i < list.size(); i++) { -// HashMap hashMap = list.get(i); -// String s = (String) hashMap.get(SmsTypeEnum.CFGFILE.value()); -// if (s.equalsIgnoreCase(SmsTypeEnum.APP.value())) { -// -// -// MicroPhotoContext.AppConfig mpAppConfig = MicroPhotoContext.getMpAppConfig(context); -// Field[] fields = mpAppConfig.getClass().getDeclaredFields(); -// for (Field field : fields) { -// hashMap.forEach((key, value) -> { -// if (key.equalsIgnoreCase(field.getName()) && !key.equalsIgnoreCase(SmsTypeEnum.CFGFILE.value())) { -// if (value != null) { -// try { -// if (field.getType() == String.class) { -// value = (String) field.get(mpAppConfig); -// } else if (field.getType() == int.class) { -// Integer num = StringUtils.convert2Int(value); -// if (num != null) { -// value = (String) field.get(mpAppConfig); -// } -// } -// } catch (IllegalAccessException e) { -// } -// } -// } -// }); -// } -// } else if (s.equalsIgnoreCase(SmsTypeEnum.MASTER.value())) { -// MicroPhotoContext.MasterConfig masterConfig = MicroPhotoContext.getMasterConfig(context); -// Field[] fields = masterConfig.getClass().getDeclaredFields(); -// for (Field field : fields) { -// hashMap.forEach((key, value) -> { -// if (key.equalsIgnoreCase(field.getName()) && !key.equalsIgnoreCase(SmsTypeEnum.CFGFILE.value())) { -// if (value != null) { -// try { -// if (field.getType() == String.class) { -// value = (String) field.get(masterConfig); -// } else if (field.getType() == int.class) { -// Integer num = StringUtils.convert2Int(value); -// if (num != null) { -// value = (String) field.get(masterConfig); -// } -// } -// } catch (IllegalAccessException e) { -// } -// } -// } -// }); -// } -// } -// } -// } else if (actType.toLowerCase().equalsIgnoreCase(SmsTypeEnum.GETFILE.value().toLowerCase())) { -// -// } -// -// } + public static void setCommon(Context context, String actType, ArrayList list, String restartType) { + if (actType.toLowerCase().equalsIgnoreCase(SmsTypeEnum.SET.value().toLowerCase())) { + for (int i = 0; i < list.size(); i++) { + HashMap hashMap = list.get(i); + String s = (String) hashMap.get(SmsTypeEnum.CFGFILE.value()); + if (s.equalsIgnoreCase(SmsTypeEnum.APP.value())) { + MicroPhotoContext.AppConfig mpAppConfig = MicroPhotoContext.getMpAppConfig(context); + Field[] fields = mpAppConfig.getClass().getDeclaredFields(); + for (Field field : fields) { + hashMap.forEach((key, value) -> { + if (key.equalsIgnoreCase(field.getName()) && !key.equalsIgnoreCase(SmsTypeEnum.CFGFILE.value())) { + if (value != null) { + try { + if (field.getType() == String.class) { + field.set(mpAppConfig, value); + } else if (field.getType() == int.class) { + Integer num = StringUtils.convert2Int(value); + if (num != null) { + field.set(mpAppConfig, num.intValue()); + } + } + } catch (IllegalAccessException e) { + } + } + } + }); + } + MicroPhotoContext.saveMpAppConfig(context, mpAppConfig); + } else if (s.equalsIgnoreCase(SmsTypeEnum.MASTER.value())) { + MicroPhotoContext.MasterConfig masterConfig = MicroPhotoContext.getMasterConfig(context); + Field[] fields = masterConfig.getClass().getDeclaredFields(); + for (Field field : fields) { + hashMap.forEach((key, value) -> { + if (key.equalsIgnoreCase(field.getName()) && !key.equalsIgnoreCase(SmsTypeEnum.CFGFILE.value())) { + if (value != null) { + try { + if (field.getType() == String.class) { + field.set(masterConfig, value); + } else if (field.getType() == int.class) { + Integer num = StringUtils.convert2Int(value); + if (num != null) { + field.set(masterConfig, num.intValue()); + } + } + } catch (IllegalAccessException e) { + } + } + } + }); + } + MicroPhotoContext.saveMasterConfig(context, masterConfig); + } + } + } else if (actType.toLowerCase().equalsIgnoreCase(SmsTypeEnum.GET.value().toLowerCase())) { + for (int i = 0; i < list.size(); i++) { + HashMap hashMap = list.get(i); + String s = (String) hashMap.get(SmsTypeEnum.CFGFILE.value()); + if (s.equalsIgnoreCase(SmsTypeEnum.APP.value())) { + MicroPhotoContext.AppConfig mpAppConfig = MicroPhotoContext.getMpAppConfig(context); + Field[] fields = mpAppConfig.getClass().getDeclaredFields(); + for (Field field : fields) { + hashMap.forEach((key, value) -> { + if (key.equalsIgnoreCase(field.getName()) && !key.equalsIgnoreCase(SmsTypeEnum.CFGFILE.value())) { + try { + if (field.getType() == String.class) { + value = (String) field.get(mpAppConfig); + } else if (field.getType() == int.class) { + Integer num = StringUtils.convert2Int(value); + if (num != null) { + value = (String) field.get(mpAppConfig); + } + } + } catch (IllegalAccessException e) { + } + } + }); + } + } else if (s.equalsIgnoreCase(SmsTypeEnum.MASTER.value())) { + MicroPhotoContext.MasterConfig masterConfig = MicroPhotoContext.getMasterConfig(context); + Field[] fields = masterConfig.getClass().getDeclaredFields(); + for (Field field : fields) { + hashMap.forEach((key, value) -> { + if (key.equalsIgnoreCase(field.getName()) && !key.equalsIgnoreCase(SmsTypeEnum.CFGFILE.value())) { + try { + if (field.getType() == String.class) { + value = (String) field.get(masterConfig); + } else if (field.getType() == int.class) { + Integer num = StringUtils.convert2Int(value); + if (num != null) { + value = (String) field.get(masterConfig); + } + } + } catch (IllegalAccessException e) { + } + } + }); + } + } + } + } else if (actType.toLowerCase().equalsIgnoreCase(SmsTypeEnum.SETFILE.value().toLowerCase())) { + for (int i = 0; i < list.size(); i++) { + HashMap hashMap = list.get(i); + String s = (String) hashMap.get(SmsTypeEnum.CFGFILE.value()); + if (s.equalsIgnoreCase(SmsTypeEnum.APP.value())) { + + + MicroPhotoContext.AppConfig mpAppConfig = MicroPhotoContext.getMpAppConfig(context); + Field[] fields = mpAppConfig.getClass().getDeclaredFields(); + for (Field field : fields) { + hashMap.forEach((key, value) -> { + if (key.equalsIgnoreCase(field.getName()) && !key.equalsIgnoreCase(SmsTypeEnum.CFGFILE.value())) { + if (value != null) { + try { + if (field.getType() == String.class) { + value = (String) field.get(mpAppConfig); + } else if (field.getType() == int.class) { + Integer num = StringUtils.convert2Int(value); + if (num != null) { + value = (String) field.get(mpAppConfig); + } + } + } catch (IllegalAccessException e) { + } + } + } + }); + } + } else if (s.equalsIgnoreCase(SmsTypeEnum.MASTER.value())) { + MicroPhotoContext.MasterConfig masterConfig = MicroPhotoContext.getMasterConfig(context); + Field[] fields = masterConfig.getClass().getDeclaredFields(); + for (Field field : fields) { + hashMap.forEach((key, value) -> { + if (key.equalsIgnoreCase(field.getName()) && !key.equalsIgnoreCase(SmsTypeEnum.CFGFILE.value())) { + if (value != null) { + try { + if (field.getType() == String.class) { + value = (String) field.get(masterConfig); + } else if (field.getType() == int.class) { + Integer num = StringUtils.convert2Int(value); + if (num != null) { + value = (String) field.get(masterConfig); + } + } + } catch (IllegalAccessException e) { + } + } + } + }); + } + } + } + } else if (actType.toLowerCase().equalsIgnoreCase(SmsTypeEnum.GETFILE.value().toLowerCase())) { + + } + + } }