Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/feature/0721-tenant' into feature/0721-tenant

Eric 2 rokov pred
rodič
commit
b9a25134da

+ 4 - 7
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TenantActivationCodeServiceImpl.java

@@ -239,7 +239,6 @@ public class TenantActivationCodeServiceImpl extends ServiceImpl<TenantActivatio
         dataList.sort(Comparator.comparingInt(ExcelDataReaderProperty::getRowIndex));
 
         List<String> errMsg = new ArrayList<>();
-        Set<String> codeSet = new HashSet<>();
         Map<String, Integer> codeRowMap = new HashMap<>();
         Map<String, String> codePhoneMap = new HashMap<>();
         // 校验数据格式是否错误
@@ -249,10 +248,8 @@ public class TenantActivationCodeServiceImpl extends ServiceImpl<TenantActivatio
 
             int msgRowNo = rowIndex + 1;
             code.checkIsIllegal().forEach(err -> errMsg.add(String.format("第%s行%s", msgRowNo, err)));
-            if (codeSet.contains(code.getCode())) {
+            if (codeRowMap.containsKey(code.getCode())) {
                 errMsg.add(String.format("第%s行%s", msgRowNo, "激活码重复"));
-            } else {
-                codeSet.add(code.getCode());
             }
             codeRowMap.put(code.getCode().trim(), msgRowNo);
             codePhoneMap.put(code.getCode().trim(), code.getPhone().trim());
@@ -293,8 +290,8 @@ public class TenantActivationCodeServiceImpl extends ServiceImpl<TenantActivatio
             List<TenantActivationCode> updateDataList = activationCodes.stream().map(next -> {
                 TenantActivationCode tenantActivationCode = new TenantActivationCode();
                 tenantActivationCode.setId(next.getId());
-                next.setActivationPhone(codePhoneMap.get(next.getActivationCode()));
-                next.setSendStatus(EActivationCode.SEND);
+                tenantActivationCode.setActivationPhone(codePhoneMap.get(next.getActivationCode()));
+                tenantActivationCode.setSendStatus(EActivationCode.SEND);
                 return tenantActivationCode;
             }).collect(Collectors.toList());
 
@@ -303,7 +300,7 @@ public class TenantActivationCodeServiceImpl extends ServiceImpl<TenantActivatio
         if (!errMsg.isEmpty()) {
             throw new BizException(String.join(",", errMsg));
         }
-        if (tenantActivationCodes.isEmpty()) {
+        if (!tenantActivationCodes.isEmpty()) {
             this.updateBatchById(tenantActivationCodes, 50);
         }
     }