소스 검색

加入防止下标越界的判断逻辑

hgw 3 년 전
부모
커밋
fe392b5059
1개의 변경된 파일5개의 추가작업 그리고 4개의 파일을 삭제
  1. 5 4
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java

+ 5 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java

@@ -22,7 +22,6 @@ import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.redis.service.RedisCache;
 import com.ym.mec.common.service.IdGeneratorService;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
-import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
@@ -1824,7 +1823,9 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         } else {
             userDefaultSubjectIds = new ArrayList<>();
         }
-        Collections.swap(subjects, 6, 7);
+        if (subjects.size() > 7) {
+            Collections.swap(subjects, 6, 7);
+        }
         PracticeGroupSellPrice practiceGroupSellPrice = practiceGroupSellPriceDao.get(organId);
         result.put("subjects", subjects);
 //        result.put("practiceApplyStartTime", practiceApplyStartTimeConfig);
@@ -4051,7 +4052,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             if (report.getVersion().equals(2)) {
                 pushUrl.append("/#/reportDetailNew?id=").append(report.getId()).append("&classGroupId=").append(report.getClassGroupId());
                 smsUrl.append("/#/transfer?url=").append(baseApiUrl).append("&hash=reportDetailNew&id=").append(report.getId()).append("&classGroupId=").append(report.getClassGroupId());
-            }else {
+            } else {
                 pushUrl.append("/#/reportDetail?classGroupId=").append(report.getClassGroupId());
                 smsUrl.append("/#/transfer?url=").append(baseApiUrl).append("&hash=reportDetail&classGroupId=").append(report.getClassGroupId());
             }
@@ -4060,7 +4061,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
                 Map<Integer, String> userMap = new HashMap<>();
                 userMap.put(userFreePracticeGroup.getStudentId(), userFreePracticeGroup.getStudentId().toString());
                 sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_SMS_PUSH_PRACTICE_COMPLETED_STUDY_REPORT,
-                        userMap, null, 0, pushUrl.insert(0,"5?").toString(), "STUDENT", pushUrl.toString());
+                        userMap, null, 0, pushUrl.insert(0, "5?").toString(), "STUDENT", pushUrl.toString());
             }
 
             if (pushType.equals("ALL") || pushType.equals("SMS")) {