|
@@ -261,11 +261,28 @@ public class EmailParseService {
|
|
Integer fileId = emailFundNavCollectionVOList.get(0).getFileId();
|
|
Integer fileId = emailFundNavCollectionVOList.get(0).getFileId();
|
|
Long count = emailFundNavCollectionMapper.countByFileId(fileId);
|
|
Long count = emailFundNavCollectionMapper.countByFileId(fileId);
|
|
if(count == 0L){
|
|
if(count == 0L){
|
|
- emailFundNavCollectionMapper.batchInsert(emailFundNavCollectionVOList);
|
|
|
|
|
|
+ //过滤空数据
|
|
|
|
+ emailFundNavCollectionVOList = emailFundNavCollectionVOList.stream().filter(e -> (StringUtil.isNotEmpty(e.getNav())||
|
|
|
|
+ StringUtil.isNotEmpty(e.getCumulativeNavWithdrawal()) || StringUtil.isNotEmpty(e.getPriceDate()) || StringUtil.isNotEmpty(e.getFundName()) || StringUtil.isNotEmpty(e.getRegisterNumber()))).collect(Collectors.toList());
|
|
|
|
+ try{
|
|
|
|
+ emailFundNavCollectionMapper.batchInsert(emailFundNavCollectionVOList);
|
|
|
|
+ }catch (Exception ex){
|
|
|
|
+ //如果批量插入报错,可能是因为解析的数据超过限制长度,这种情况基本是垃圾数据,直接跳过
|
|
|
|
+ emailFundNavCollectionVOList.forEach(e -> saveEmailFundNavCollection(e));
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void saveEmailFundNavCollection(EmailFundNavCollectionDO fundNavCollectionDO) {
|
|
|
|
+ try{
|
|
|
|
+ emailFundNavCollectionMapper.batchInsert(CollUtil.toList(fundNavCollectionDO));
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ //如果是异常,说明是垃圾数据
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
private EmailFundNavCollectionDO toEmailFundNavCollectionVO(EmailFundNavDTO fundNavDTO, Integer fileId,Date parseDate) {
|
|
private EmailFundNavCollectionDO toEmailFundNavCollectionVO(EmailFundNavDTO fundNavDTO, Integer fileId,Date parseDate) {
|
|
EmailFundNavCollectionDO vo = new EmailFundNavCollectionDO();
|
|
EmailFundNavCollectionDO vo = new EmailFundNavCollectionDO();
|
|
vo.setFileId(fileId);
|
|
vo.setFileId(fileId);
|