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

dev_drug_dmyh250207
chenhc 3 days ago
parent 3f0dd8d59f
commit 65bb433a7d

@ -1,15 +1,20 @@
package com.glxp.api.controller.test;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.glxp.api.annotation.Log;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.BusinessType;
import com.glxp.api.controller.inout.IoOrderReviewController;
import com.glxp.api.dao.AliCodeTestMapper;
import com.glxp.api.dao.basic.UdiRelevanceDao;
import com.glxp.api.dao.inout.IoOrderDao;
import com.glxp.api.entity.alihealth.*;
import com.glxp.api.entity.basic.UdiRelevanceEntity;
import com.glxp.api.entity.inout.IoOrderEntity;
import com.glxp.api.entity.system.CompanyEntity;
import com.glxp.api.entity.thrsys.ThirdAliDrug;
import com.glxp.api.req.alihealth.AlihealthKytDrugrescodeReqeust;
import com.glxp.api.req.alihealth.AlihealthKytSearchbillReqeust;
@ -18,17 +23,21 @@ import com.glxp.api.req.alihealth.AlihealthYljgListupoutReqeust;
import com.glxp.api.req.alihealth.local.AliBillsDisposeReqeust;
import com.glxp.api.req.alihealth.local.AlihealthKytThirdAliSearchbillInsertReqeust;
import com.glxp.api.req.alihealth.local.AlihealthThirdAliDrugInsertReqeust;
import com.glxp.api.req.system.CompanyRequest;
import com.glxp.api.res.inout.OrderNoResult;
import com.glxp.api.service.basic.UdiProductService;
import com.glxp.api.util.DateUtil;
import com.glxp.api.util.alihealth.AlihealthUtils;
import com.glxp.api.util.alihealth.AlihealthYljgUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -146,4 +155,51 @@ public class TestCodeController {
}
@Resource
UdiRelevanceDao udiRelevanceDao;
@Resource
UdiProductService udiProductService;
/**
*
*/
@GetMapping("/test/handMovement/updateLevelCount")
public BaseResponse updateLevelCount() {
// 初始化计时器和计数器
long startTime = System.currentTimeMillis();
HashMap<String, Object> result = new HashMap();
try {
int pageSize = 100;
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)) {
if (CollUtil.isNotEmpty(batch)) {
batch.forEach(udiRelevanceEntity -> {
udiProductService.updateLevelCount(udiRelevanceEntity);
});
}
Object successCount = result.get("successCount");
result.put("successCount", successCount == null ? batch.size() : Integer.valueOf((Integer) successCount) + batch.size());
}
}
} catch (Exception e) {
return ResultVOUtils.error("处理过程中发生异常: " + e.getMessage());
} finally {
// 计算耗时
result.put("executionTime", "耗时:" + (System.currentTimeMillis() - startTime)/ 1000.0 + " 秒");
return ResultVOUtils.success(result);
}
}
}

Loading…
Cancel
Save