Commit e1faf7dc authored by liuChang's avatar liuChang

添加默认监控分批传参

parent 6a97e08f
......@@ -29,6 +29,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.time.Duration;
import java.util.*;
import java.util.stream.Collectors;
/**
* @ClassName MonitorServiceImpl
......@@ -359,6 +360,9 @@ public class MonitorServiceImpl implements MonitorService {
idList.add(companyId);
}
}
//去除重复企业id
idList = idList.stream().distinct().collect(Collectors.toList());
log.info("获取供应商企业id数量:"+idList.size());
RedisUtils.setCacheList("monitorCompanyList",idList);
//设置过期时间两天
RedisUtils.expire("monitorCompanyList",172800);
......@@ -366,10 +370,6 @@ public class MonitorServiceImpl implements MonitorService {
PushMonitorCompanyAddVo addVo = new PushMonitorCompanyAddVo();
addVo.setSystemCode("ZJYJ");
Long userId = LoginHelper.getUserId();
if (ObjectUtil.isNotEmpty(userId)) {
addVo.setUserId(userId);
}
int size = idList.size();
if (size<=200){
addVo.setCid(idList);
......@@ -380,14 +380,14 @@ public class MonitorServiceImpl implements MonitorService {
//循环次数
int num = (size+(200-1))/200;
for (int i = 0; i < num; i++) {
List<Integer> list = new ArrayList<>();
List<Integer> newList = new ArrayList<>();
if (((i+1)*200)>=size){
//如果下标索引大于 list容量
list = idList.subList(i*200, size);
newList = idList.subList(i*200, size);
}else {
list = idList.subList(i*200, (i+1)*200);
newList = idList.subList(i*200, (i+1)*200);
}
addVo.setCid(list);
addVo.setCid(newList);
log.info("中建一局用户添加默认监控企业------->循环添加:"+i*200+"----"+(i+1)*200);
Map<String, Object> map = dskOpenApiUtil.requestBody("/operate/monitor/company/addDefaultCompany", BeanUtil.beanToMap(addVo, false, false));
log.info("addDefaultCompany 循环添加返回值map====================》"+map.toString());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment