Преглед изворни кода

[A端会员列表导入][修复]:会员导入修复

release_toaliyun_real
Stormeye Wu пре 7 година
родитељ
комит
fcb58afa52
2 измењених фајлова са 19 додато и 17 уклоњено
  1. +5
    -5
      mallinkAdmin/src/main/java/com/iformall/controller/WxCUserBasicInfoController.java
  2. +14
    -12
      mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java

+ 5
- 5
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, "allCount", 0 + "");
stringRedisTemplate.opsForHash().putIfAbsent(importKey, "allSuccessCount", 0 + ""); stringRedisTemplate.opsForHash().putIfAbsent(importKey, "allSuccessCount", 0 + "");
stringRedisTemplate.opsForHash().putIfAbsent(importKey, "successCount", "");
stringRedisTemplate.opsForHash().putIfAbsent(importKey, "processCount", "");
stringRedisTemplate.opsForHash().putIfAbsent(importKey, "failCount", ""); stringRedisTemplate.opsForHash().putIfAbsent(importKey, "failCount", "");
wxCUserBasicInfoService.importTemplate(file, getTenantId(), importKey); wxCUserBasicInfoService.importTemplate(file, getTenantId(), importKey);
stringRedisTemplate.expire(importKey,30,TimeUnit.MINUTES); stringRedisTemplate.expire(importKey,30,TimeUnit.MINUTES);
@@ -275,7 +275,7 @@ public class WxCUserBasicInfoController extends BaseController {
} }
String allCount = entries.get("allCount").toString(); String allCount = entries.get("allCount").toString();
String allSuccessCount = entries.get("allSuccessCount").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(); String failCount = entries.get("failCount").toString();


if (StringUtils.isNotBlank(failCount) && allCount.equals(failCount)) {//stringRedisTemplate.expire(userId,1,TimeUnit.SECONDS); 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, "allCount");
stringRedisTemplate.opsForHash().delete(importKey, "allSuccessCount"); stringRedisTemplate.opsForHash().delete(importKey, "allSuccessCount");
stringRedisTemplate.opsForHash().delete(importKey, "successCount");
stringRedisTemplate.opsForHash().delete(importKey, "processCount");
stringRedisTemplate.opsForHash().delete(importKey, "failCount"); stringRedisTemplate.opsForHash().delete(importKey, "failCount");
return new ResultData(ErrorCode.MEM_IMPORT_ERR); 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); ResultData ok = new ResultData(Result.SUCCESS, "ok", entries);
stringRedisTemplate.opsForHash().delete(importKey, "allCount"); stringRedisTemplate.opsForHash().delete(importKey, "allCount");
stringRedisTemplate.opsForHash().delete(importKey, "allSuccessCount"); stringRedisTemplate.opsForHash().delete(importKey, "allSuccessCount");
stringRedisTemplate.opsForHash().delete(importKey, "successCount");
stringRedisTemplate.opsForHash().delete(importKey, "processCount");
stringRedisTemplate.opsForHash().delete(importKey, "failCount"); stringRedisTemplate.opsForHash().delete(importKey, "failCount");
return ok; return ok;
} }


+ 14
- 12
mallinkService/src/main/java/com/iformall/service/impl/WxCUserBasicInfoServiceImpl.java Прегледај датотеку

@@ -529,7 +529,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService {
} catch (Exception e) { } catch (Exception e) {
stringRedisTemplate.opsForHash().put(importKey, "allCount", "1"); stringRedisTemplate.opsForHash().put(importKey, "allCount", "1");
stringRedisTemplate.opsForHash().put(importKey, "allSuccessCount", "0"); stringRedisTemplate.opsForHash().put(importKey, "allSuccessCount", "0");
stringRedisTemplate.opsForHash().put(importKey, "successCount", "0");
stringRedisTemplate.opsForHash().put(importKey, "processCount", "0");
stringRedisTemplate.opsForHash().put(importKey, "failCount", "1"); stringRedisTemplate.opsForHash().put(importKey, "failCount", "1");
logger.error(e.getMessage()); logger.error(e.getMessage());
return new ResultData(ErrorCode.MEM_IMPORT_ERR); return new ResultData(ErrorCode.MEM_IMPORT_ERR);
@@ -547,27 +547,29 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService {
int all_success = successList.size(); int all_success = successList.size();
int all_fail = failList.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(); WxTags wxTagsQ = new WxTags();
List<WxTags> tagList = wxTagsMapper.findList(wxTagsQ); List<WxTags> tagList = wxTagsMapper.findList(wxTagsQ);


try { 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 -> { successList.parallelStream().forEach(uBase -> {


if (StringUtils.isBlank(uBase.getPhone())) { if (StringUtils.isBlank(uBase.getPhone())) {
stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1);
logger.error("手机号为空", uBase.toString()); logger.error("手机号为空", uBase.toString());
return; return;
} }
WxCUserBasicInfo userBase = InitUserBaseInfo(uBase, tenantId); WxCUserBasicInfo userBase = InitUserBaseInfo(uBase, tenantId);
if (userBase == null) { if (userBase == null) {
stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1);
logger.error("userBase为null", uBase.toString()); logger.error("userBase为null", uBase.toString());
return; return;
} }
@@ -626,6 +628,7 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService {
try { try {
wxCUserBasicInfoMapper.insertSelective(userBase); wxCUserBasicInfoMapper.insertSelective(userBase);
} catch (Exception e) { } catch (Exception e) {
stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1);
logger.error(e.getMessage()); logger.error(e.getMessage());
return; return;
} }
@@ -671,11 +674,10 @@ public class WxCUserBasicInfoServiceImpl implements WxCUserBasicInfoService {
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
logger.error("打标签+成长值失败--继续导入"); logger.error("打标签+成长值失败--继续导入");
return;
} }


//记数 //记数
stringRedisTemplate.opsForHash().increment(importKey,"successCount",1);
stringRedisTemplate.opsForHash().increment(importKey,"processCount",1);
}); });
} catch (Exception e) { } catch (Exception e) {
stringRedisTemplate.opsForHash().put(importKey, "allCount", "" + all_fail); stringRedisTemplate.opsForHash().put(importKey, "allCount", "" + all_fail);


Loading…
Откажи
Сачувај