diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/WxCUserBasicInfoController.java b/mallinkAdmin/src/main/java/com/iformall/controller/WxCUserBasicInfoController.java index 8629100aa..a08a72f38 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/WxCUserBasicInfoController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/WxCUserBasicInfoController.java @@ -257,7 +257,7 @@ public class WxCUserBasicInfoController extends BaseController { } stringRedisTemplate.opsForHash().putIfAbsent(importKey, "allCount", 0 + ""); stringRedisTemplate.opsForHash().putIfAbsent(importKey, "allSuccessCount", 0 + ""); - stringRedisTemplate.opsForHash().putIfAbsent(importKey, "successCount", ""); + stringRedisTemplate.opsForHash().putIfAbsent(importKey, "processCount", ""); stringRedisTemplate.opsForHash().putIfAbsent(importKey, "failCount", ""); wxCUserBasicInfoService.importTemplate(file, getTenantId(), importKey); stringRedisTemplate.expire(importKey,30,TimeUnit.MINUTES); @@ -275,7 +275,7 @@ public class WxCUserBasicInfoController extends BaseController { } String allCount = entries.get("allCount").toString(); String allSuccessCount = entries.get("allSuccessCount").toString(); - String successCount = entries.get("successCount").toString(); + String processCount = entries.get("processCount").toString(); String failCount = entries.get("failCount").toString(); if (StringUtils.isNotBlank(failCount) && allCount.equals(failCount)) {//stringRedisTemplate.expire(userId,1,TimeUnit.SECONDS); @@ -283,16 +283,16 @@ public class WxCUserBasicInfoController extends BaseController { //完全失败 stringRedisTemplate.opsForHash().delete(importKey, "allCount"); stringRedisTemplate.opsForHash().delete(importKey, "allSuccessCount"); - stringRedisTemplate.opsForHash().delete(importKey, "successCount"); + stringRedisTemplate.opsForHash().delete(importKey, "processCount"); stringRedisTemplate.opsForHash().delete(importKey, "failCount"); return new ResultData(ErrorCode.MEM_IMPORT_ERR); } //导入完成 - if (StringUtils.isNotBlank(allSuccessCount) && allSuccessCount.equals(successCount)) { + if (StringUtils.isNotBlank(allSuccessCount) && allSuccessCount.equals(processCount)) { ResultData ok = new ResultData(Result.SUCCESS, "ok", entries); stringRedisTemplate.opsForHash().delete(importKey, "allCount"); stringRedisTemplate.opsForHash().delete(importKey, "allSuccessCount"); - stringRedisTemplate.opsForHash().delete(importKey, "successCount"); + stringRedisTemplate.opsForHash().delete(importKey, "processCount"); stringRedisTemplate.opsForHash().delete(importKey, "failCount"); return ok; } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java index d8d84c6aa..203399f79 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java @@ -529,7 +529,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { } catch (Exception e) { stringRedisTemplate.opsForHash().put(importKey, "allCount", "1"); stringRedisTemplate.opsForHash().put(importKey, "allSuccessCount", "0"); - stringRedisTemplate.opsForHash().put(importKey, "successCount", "0"); + stringRedisTemplate.opsForHash().put(importKey, "processCount", "0"); stringRedisTemplate.opsForHash().put(importKey, "failCount", "1"); logger.error(e.getMessage()); return new ResultData(ErrorCode.MEM_IMPORT_ERR); @@ -547,27 +547,29 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { int all_success = successList.size(); int all_fail = failList.size(); + //添加到redis里 + stringRedisTemplate.opsForHash().put(importKey, "allCount", "" + total); + stringRedisTemplate.opsForHash().put(importKey, "allSuccessCount", "" + all_success); + stringRedisTemplate.opsForHash().put(importKey, "processCount", "0"); + stringRedisTemplate.opsForHash().put(importKey, "failCount", "" + all_fail); + + logger.info("验证通过的数量: " + successList.size()); + logger.info("验证未通过的数量: " + failList.size()); + WxTags wxTagsQ = new WxTags(); List tagList = wxTagsMapper.findList(wxTagsQ); try { - //添加到redis里 - stringRedisTemplate.opsForHash().put(importKey, "allCount", "" + total); - stringRedisTemplate.opsForHash().put(importKey, "allSuccessCount", "" + all_success); - stringRedisTemplate.opsForHash().put(importKey, "successCount", "0"); - stringRedisTemplate.opsForHash().put(importKey, "failCount", "" + all_fail); - - logger.info("验证通过的数量: " + successList.size()); - logger.info("验证未通过的数量: " + failList.size()); - successList.parallelStream().forEach(uBase -> { if (StringUtils.isBlank(uBase.getPhone())) { + stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); logger.error("手机号为空", uBase.toString()); return; } WxCUserBasicInfo userBase = InitUserBaseInfo(uBase, tenantId); if (userBase == null) { + stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); logger.error("userBase为null", uBase.toString()); return; } @@ -626,6 +628,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { try { wxCUserBasicInfoMapper.insertSelective(userBase); } catch (Exception e) { + stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); logger.error(e.getMessage()); return; } @@ -671,11 +674,10 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService { } catch (Exception e) { logger.error(e.getMessage()); logger.error("打标签+成长值失败--继续导入"); - return; } //记数 - stringRedisTemplate.opsForHash().increment(importKey,"successCount",1); + stringRedisTemplate.opsForHash().increment(importKey,"processCount",1); }); } catch (Exception e) { stringRedisTemplate.opsForHash().put(importKey, "allCount", "" + all_fail);