feat: 手动触发更新各个层级数量换算

dev_drug_dmyh250207
chenhc 3 months ago
parent 7d22d44c38
commit 499da281d6

@ -29,6 +29,7 @@ import com.glxp.api.service.basic.UdiProductService;
import com.glxp.api.util.DateUtil; import com.glxp.api.util.DateUtil;
import com.glxp.api.util.alihealth.AlihealthUtils; import com.glxp.api.util.alihealth.AlihealthUtils;
import com.glxp.api.util.alihealth.AlihealthYljgUtils; import com.glxp.api.util.alihealth.AlihealthYljgUtils;
import com.glxp.api.util.page.PageQuery;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@ -174,32 +175,25 @@ public class TestCodeController {
try { try {
int pageSize = 100; List<UdiRelevanceEntity> batch = udiRelevanceDao.selectList(new QueryWrapper<UdiRelevanceEntity>());
Long total = udiRelevanceDao.selectCount(new QueryWrapper<UdiRelevanceEntity>());
result.put("total", total);
for (int pageNum = 1; pageNum <= (total + pageSize - 1) / pageSize; pageNum++) {
Page<UdiRelevanceEntity> page = new Page<>(pageNum, pageSize);
List<UdiRelevanceEntity> batch = udiRelevanceDao.selectPage(page, new QueryWrapper<UdiRelevanceEntity>()).getRecords();
if (CollUtil.isNotEmpty(batch)) {
result.put("total", batch.size());
if (CollUtil.isNotEmpty(batch)) { if (CollUtil.isNotEmpty(batch)) {
if (CollUtil.isNotEmpty(batch)) { batch.forEach(udiRelevanceEntity -> {
batch.forEach(udiRelevanceEntity -> { udiProductService.updateLevelCount(udiRelevanceEntity);
udiProductService.updateLevelCount(udiRelevanceEntity); Object successCount = result.get("successCount");
}); result.put("successCount", successCount == null ? 1 : Integer.valueOf((Integer) successCount) + 1);
} });
Object successCount = result.get("successCount");
result.put("successCount", successCount == null ? batch.size() : Integer.valueOf((Integer) successCount) + batch.size());
} }
} }
} catch (Exception e) { } catch (Exception e) {
return ResultVOUtils.error("处理过程中发生异常: " + e.getMessage()); return ResultVOUtils.error("处理过程中发生异常: " + e.getMessage());
} finally { } finally {
// 计算耗时 // 计算耗时
result.put("executionTime", "耗时:" + (System.currentTimeMillis() - startTime)/ 1000.0 + " 秒"); result.put("executionTime", "耗时:" + (System.currentTimeMillis() - startTime)/ 1000.0 + " 秒");
result.put("恭喜你成功完成【手动触发更新各个层级数量换算】接口", "666666666666666666666666666666666666666666"); result.put("恭喜你成功完成【手动触发更新各个层级数量换算】接口", "无敌咯");
return ResultVOUtils.success(result); return ResultVOUtils.success(result);
} }
} }

Loading…
Cancel
Save