| | |
| | | package org.springblade.modules.eCallEventTwo.service.impl; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean SynchronizeData(EcOrderParamDTO ecOrderParamDTO) { |
| | | processPages(100, ecOrderParamDTO); |
| | | return true; |
| | |
| | | |
| | | public void processPages(int pageSize, EcOrderParamDTO ecOrderParamDTO) { |
| | | QueryWrapper<EcOrder> ecOrderQueryWrapper = new QueryWrapper<>(); |
| | | ecOrderQueryWrapper.between("import_time", ecOrderParamDTO.getStartTime(), ecOrderParamDTO.getEndTime()); |
| | | long count = baseMapper.selectCount(ecOrderQueryWrapper); |
| | | if (ecOrderParamDTO.getStartTime() != null) { |
| | | ecOrderQueryWrapper.between("import_time", ecOrderParamDTO.getStartTime(), ecOrderParamDTO.getEndTime()); |
| | | } |
| | | long count = count(ecOrderQueryWrapper); |
| | | int totalPages = (int) Math.ceil((double) count / pageSize); // 计算总页数 |
| | | |
| | | for (int pageNum = 1; pageNum <= totalPages; pageNum++) { |
| | |
| | | IPage<EcOrder> resultPage = baseMapper.selectPage(page, objectQueryWrapper); |
| | | List<EcOrder> records = resultPage.getRecords(); |
| | | List<ECallEventTwoEntity> recordEntityList = BeanUtil.copy(records, ECallEventTwoEntity.class); |
| | | recordEntityList.forEach(ecOrderEntity -> { |
| | | // 点落面 设置警格网格信息 |
| | | setGridInfo(ecOrderEntity); |
| | | }); |
| | | boolean b = ecOrderService.saveBatch(recordEntityList); |
| | | boolean b = ecOrderService.saveOrUpdateBatch(recordEntityList); |
| | | System.out.println("更新第" + pageNum + "页" + b); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @DS("master") |
| | | public boolean saveEcOrder(List<ECallEventTwoEntity> recordEntityList) { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置警格网格信息 |
| | | * |