Commit 6f7e9cb1 authored by zhangfeng's avatar zhangfeng

bugfix(reward): 兑换信息导入修改

parent 22eab725
...@@ -260,8 +260,7 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper, ...@@ -260,8 +260,7 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper,
} }
List<RewardRedeemDO> saveDataList = dataList.stream().map(data -> { List<RewardRedeemDO> saveDataList = dataList.stream().map(data -> {
RewardRedeemDO rewardRedeemDO = new RewardRedeemDO(); RewardRedeemDO rewardRedeemDO = rewardRedeemMapper.selectOne(RewardRedeemDO::getRedemptionNumber, data.getId());
rewardRedeemDO.setId(Long.parseLong(data.getId()));
DictDataRespDTO redeemTypeDict = DictFrameworkUtils.parseDictDataFromCacheWithMultiLang("way_of_receiving", data.getRedeemType()); DictDataRespDTO redeemTypeDict = DictFrameworkUtils.parseDictDataFromCacheWithMultiLang("way_of_receiving", data.getRedeemType());
rewardRedeemDO.setRedeemType(Integer.parseInt(redeemTypeDict.getValue())); rewardRedeemDO.setRedeemType(Integer.parseInt(redeemTypeDict.getValue()));
rewardRedeemDO.setExpenses(data.getExpenses()); rewardRedeemDO.setExpenses(data.getExpenses());
...@@ -362,25 +361,18 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper, ...@@ -362,25 +361,18 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper,
Map<String, CurrencyRespDTO> titleEnCurrencyMap, Map<String, CurrencyRespDTO> titleEnCurrencyMap,
Map<String, ExpressRespDTO> nameExpressMap) { Map<String, ExpressRespDTO> nameExpressMap) {
LambdaQueryWrapper<RewardRedeemDO> wrapper = Wrappers.lambdaQuery(); LambdaQueryWrapper<RewardRedeemDO> wrapper = Wrappers.lambdaQuery();
wrapper.in(RewardRedeemDO::getId, dataList.stream().map(RedeemInfoImportExcelVO::getId).collect(Collectors.toSet())); wrapper.in(RewardRedeemDO::getRedemptionNumber, dataList.stream().map(RedeemInfoImportExcelVO::getId).collect(Collectors.toSet()));
Map<Long, RewardRedeemDO> idRewardRedeemDOMap = rewardRedeemMapper.selectList(wrapper).stream() Map<String, RewardRedeemDO> idRewardRedeemDOMap = rewardRedeemMapper.selectList(wrapper).stream()
.collect(Collectors.toMap(RewardRedeemDO::getId, Function.identity(), (c1, c2) -> c1)); .collect(Collectors.toMap(RewardRedeemDO::getRedemptionNumber, Function.identity(), (c1, c2) -> c1));
Map<String, String> failedInfoMap = new HashMap<>(); Map<String, String> failedInfoMap = new HashMap<>();
dataList.forEach(data -> { dataList.forEach(data -> {
long id;
try {
id = Long.parseLong(data.getId());
} catch (Exception e) {
failedInfoMap.put(data.getId() == null ? "" : data.getId(), I18nMessage.getMessage("reward.redeem.not.exist"));
return;
}
try { try {
DateUtil.parse(data.getExpressDate(), NORM_DATETIME_PATTERN); DateUtil.parse(data.getExpressDate(), NORM_DATETIME_PATTERN);
} catch (Exception e) { } catch (Exception e) {
failedInfoMap.put(data.getId() == null ? "" : data.getId(), I18nMessage.getMessage("date.format.error")); failedInfoMap.put(data.getId() == null ? "" : data.getId(), I18nMessage.getMessage("date.format.error"));
return; return;
} }
RewardRedeemDO rewardRedeemDO = idRewardRedeemDOMap.get(id); RewardRedeemDO rewardRedeemDO = idRewardRedeemDOMap.get(data.getId());
if (rewardRedeemDO == null) { if (rewardRedeemDO == null) {
failedInfoMap.put(data.getId() == null ? "" : data.getId(), I18nMessage.getMessage("reward.redeem.not.exist")); failedInfoMap.put(data.getId() == null ? "" : data.getId(), I18nMessage.getMessage("reward.redeem.not.exist"));
return; return;
...@@ -408,7 +400,6 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper, ...@@ -408,7 +400,6 @@ public class RewardRedeemServiceImpl extends AbstractService<RewardRedeemMapper,
return; return;
} }
if (!canVerify(RewardRedeemVerifyDTO.builder() if (!canVerify(RewardRedeemVerifyDTO.builder()
.id(Long.parseLong(data.getId()))
.redeemType(Integer.parseInt(redeemTypeDict.getValue())) .redeemType(Integer.parseInt(redeemTypeDict.getValue()))
.status(rewardRedeemDO.getStatus()) .status(rewardRedeemDO.getStatus())
.expense(data.getExpenses()) .expense(data.getExpenses())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment