Browse Source

暂时批量插入 还需优化

dev_shibei_match
jianjun 5 years ago
parent
commit
2bd0098d66
  1. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java

@ -32,6 +32,7 @@ import com.epmet.support.normalizing.batch.IndexInputVO;
import com.epmet.support.normalizing.batch.IndexOutputVO;
import com.epmet.support.normalizing.batch.SampleValue;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -359,7 +360,11 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
}
if (!CollectionUtils.isEmpty(gridScoreEntityList)) {
gridScoreDao.deleteByCusAndMonthId(formDTO.getCustomerId(), formDTO.getMonthId(), indexCode, isTotal);
gridScoreDao.insertBatches(gridScoreEntityList);
//批量插入
List<List<GridScoreEntity>> partition = ListUtils.partition(gridScoreEntityList, 100);
partition.forEach(list -> {
gridScoreDao.insertBatches(list);
});
}
}
@ -628,7 +633,11 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
}
if (!CollectionUtils.isEmpty(gridScoreEntityList)) {
gridScoreDao.deleteByCusAndMonthId(formDTO.getCustomerId(), formDTO.getMonthId(), indexCode, NumConstant.ONE_STR);
gridScoreDao.insertBatches(gridScoreEntityList);
//批量插入
List<List<GridScoreEntity>> partition = ListUtils.partition(gridScoreEntityList, 100);
partition.forEach(list -> {
gridScoreDao.insertBatches(list);
});
}
}

Loading…
Cancel
Save