|
@@ -56,7 +56,7 @@ public class AppRedemptionCodeServiceImpl extends ServiceImpl<RedemptionCodeDao,
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public List<AppRedemptionCode> importRedemptionCode(MultipartFile file) throws Exception {
|
|
|
+ public String importRedemptionCode(MultipartFile file) throws Exception {
|
|
|
Map<String, List<Map<String, Object>>> sheetsListMap = POIUtil.importExcel(
|
|
|
new ByteArrayInputStream(file.getBytes()), 0, file.getOriginalFilename());
|
|
|
|
|
@@ -96,11 +96,12 @@ public class AppRedemptionCodeServiceImpl extends ServiceImpl<RedemptionCodeDao,
|
|
|
try {
|
|
|
redemptionCodeDao.insertBatch(redemptionCodesList);
|
|
|
} catch (DuplicateKeyException dupKeyEx) {
|
|
|
- throw new BizException("数据重复:" + dupKeyEx.getCause(), dupKeyEx);
|
|
|
+ logger.error("数据导入重复: " + dupKeyEx.getCause());
|
|
|
+ return "数据重复:" + dupKeyEx;
|
|
|
} catch (Exception ex) {
|
|
|
throw new BizException("导入数据出错:" + ex, ex);
|
|
|
}
|
|
|
- return redemptionCodesList;
|
|
|
+ return "成功导入 " + redemptionCodesList.size() + "条";
|
|
|
}
|
|
|
|
|
|
@Override
|