浏览代码

fit 身份证去重

tanzh 3 年之前
父节点
当前提交
b385477aa9

+ 15 - 15
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeServiceImpl.java

@@ -361,15 +361,19 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
     @Override
     @Override
     public List<ClassGradeStudentVo> listGrade(ClassGradeUserQueryBo bo) {
     public List<ClassGradeStudentVo> listGrade(ClassGradeUserQueryBo bo) {
         //身份证去重
         //身份证去重
-        String idCard = bo.getIdCard();
-        List<String> idCards = bo.getIdCards();
-        Set<String> set = new HashSet<>();
-        for (String id : idCards) {
-            set.add(id);
+        if (Validator.isNotEmpty(bo.getIdCard()) && Validator.isNotEmpty(bo.getIdCards())) {
+            String idCard = bo.getIdCard();
+            List<String> idCards = bo.getIdCards();
+            Set<String> set = new HashSet<>();
+            for (String id : idCards) {
+                set.add(id);
+            }
+            set.add(idCard);
+            if (Validator.isNotEmpty(set)) {
+                bo.setIdCards(new ArrayList<>(set));
+            }
+            bo.setIdCard(null);
         }
         }
-        set.add(idCard);
-        bo.setIdCards(new ArrayList<>(set));
-        bo.setIdCard(null);
         //查找班级学员
         //查找班级学员
         List<ClassGradeStudentVo> classGradeStudentVos = baseMapper.listGrade(bo);
         List<ClassGradeStudentVo> classGradeStudentVos = baseMapper.listGrade(bo);
         //得到每个学员的课程学习记录
         //得到每个学员的课程学习记录
@@ -581,7 +585,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
                         if (getProductHttpResponse.body().contains("{\"\"success\"\":true")) {
                         if (getProductHttpResponse.body().contains("{\"\"success\"\":true")) {
                             ProductRoot productRoot = com.alibaba.fastjson.JSONObject.parseObject(getProductHttpResponse.toString(), ProductRoot.class);
                             ProductRoot productRoot = com.alibaba.fastjson.JSONObject.parseObject(getProductHttpResponse.toString(), ProductRoot.class);
                             if (Validator.isEmpty(productRoot)) {
                             if (Validator.isEmpty(productRoot)) {
-                                //未获取到相关继教商品信息
+                                throw new CustomException("未获取到相关继教商品信息");
                             }
                             }
                             ProductsItem productsItem = productRoot.getProducts().get(0);
                             ProductsItem productsItem = productRoot.getProducts().get(0);
                             cookie = getProductHttpResponse.getCookie("jqb_cookies");
                             cookie = getProductHttpResponse.getCookie("jqb_cookies");
@@ -603,9 +607,6 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
                             sumitJsonObject.put("period", 0);
                             sumitJsonObject.put("period", 0);
                             sumitJsonObject.put("IsBuyBook", 1);
                             sumitJsonObject.put("IsBuyBook", 1);
                             sumitJsonObject.put("GetMethod", 1);
                             sumitJsonObject.put("GetMethod", 1);
-                            sumitJsonObject.put("Buyer", "");
-                            sumitJsonObject.put("BuyerPhoneNum", "");
-                            sumitJsonObject.put("BuyerAddress", "");
                             // 设置请求头
                             // 设置请求头
                             Map<String, String> sumitHead = new HashMap<>();
                             Map<String, String> sumitHead = new HashMap<>();
                             sumitHead.put("Content-Type", "application/json;charset=UTF-8");
                             sumitHead.put("Content-Type", "application/json;charset=UTF-8");
@@ -625,11 +626,10 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
                                 falseCount++;
                                 falseCount++;
                             }
                             }
                         } else {
                         } else {
-                            //获取相关继教商品信息失败
-                            throw new CustomException("");
+                            throw new CustomException("获取相关继教商品信息失败");
                         }
                         }
                     } else {
                     } else {
-                        // 根据身份证未获取相关数据失败
+                        throw new CustomException("根据身份证未获取相关数据失败");
                     }
                     }
                 }
                 }
                 Long[] id = new Long[]{};
                 Long[] id = new Long[]{};