lcq

lcq

V2EX 第 456266 号会员,加入于 2019-11-29 14:20:53 +08:00
今日活跃度排名 15607
根据 lcq 的设置,主题列表被隐藏
二手交易 相关的信息,包括已关闭的交易,不会被隐藏
lcq 最近回复了
6 天前
回复了 lcq 创建的主题 程序员 微服务架构,怎么输出报表的?
@thtznet 用什么搭建
List<CouponCodeExchangeListVO> list;

public ExportCouponCodeTask(List<CouponCodeExchangeListVO> list){
this.list = list;
}

@Override
public List<CouponCodeExchangeListExcelVO> call() throws Exception {
log.info("执行任务");
List<CouponCodeExchangeListExcelVO> couponCodeExchangeListExcelVOS = new ArrayList<>();
for (CouponCodeExchangeListVO couponCodeExchangeListVO : list) {
CouponCodeExchangeListExcelVO couponCodeExchangeListExcelVO = new CouponCodeExchangeListExcelVO();
BeanUtils.copyProperties(couponCodeExchangeListVO, couponCodeExchangeListExcelVO);
couponCodeExchangeListExcelVO.setByteArray(generateJpg(couponCodeExchangeListVO.getQrCodeUrl(), 500, 500));
if (StringUtils.isNotBlank(couponCodeExchangeListVO.getSuWxSubscribe())){
couponCodeExchangeListExcelVO.setSuWxSubscribe(couponCodeExchangeListVO.getSuWxSubscribe().split(":")[1]);
}
if (StringUtils.isNotBlank(couponCodeExchangeListVO.getEnterpriseWechat())){
couponCodeExchangeListExcelVO.setEnterpriseWechat(couponCodeExchangeListVO.getEnterpriseWechat().split(":")[1]);
}
couponCodeExchangeListExcelVOS.add(couponCodeExchangeListExcelVO);
}
return couponCodeExchangeListExcelVOS;
}

private static byte[] generateJpg(String content, int width, int height) {
final ByteArrayOutputStream out = new ByteArrayOutputStream();
generate(content, width, height, ImgUtil.IMAGE_TYPE_JPG, out);
return out.toByteArray();
}
//获取全部数据
ResultBody<List<CouponCodeExchangeListVO>> resultBody = couponCodeFeignClientService.getListByRuleId(map.get("ruleId").toString());
List<CouponCodeExchangeListVO> records = resultBody.getData();
List<CouponCodeExchangeListExcelVO> couponCodeExchangeListExcelVOS = new ArrayList<>();
List<Future<List<CouponCodeExchangeListExcelVO>>> futures = new ArrayList<>();
if (CollectionUtil.isNotEmpty(records)) {
int totalNum = records.size();
int batchNum;
if (totalNum <= 1000){
batchNum = 200;
}else {
batchNum = 500;
}
int pageNum = totalNum % batchNum == 0 ? totalNum / batchNum : totalNum / batchNum + 1;
List<CouponCodeExchangeListVO> subData;
int toIndex, fromIndex;
List<ExportCouponCodeTask> tasks = new ArrayList<>();
for (int i = 0; i < pageNum; i++) {
fromIndex = i * batchNum;
toIndex = Math.min(totalNum, fromIndex + batchNum);
subData = records.subList(fromIndex, toIndex);
tasks.add(new ExportCouponCodeTask(subData));
}
//分批使用多线程处理
if(!exportCouponCodeThreadPoolExecutor.isShutdown()){
futures = exportCouponCodeThreadPoolExecutor.invokeAll(tasks);
}
}
for (Future<List<CouponCodeExchangeListExcelVO>> future : futures) {
List<CouponCodeExchangeListExcelVO> couponCodeExchangeListExcelVOS1 = future.get();
couponCodeExchangeListExcelVOS.addAll(couponCodeExchangeListExcelVOS1);
}
@bingheath 教育优惠不是只能分三期吗
301 天前
回复了 glacial 创建的主题 MacBook Pro spring 全干工程师,选 14 寸 还是 16 寸的
14 寸乞丐版 32G 感觉够了
@CharmingCheung 是的 断电可以买 UPS 通知服务 断网的话这个是怎么处理的
@midpoint 划水大王
2020-09-14 16:05:20 +08:00
回复了 lcq 创建的主题 Java 类似百度百科的弹出词条功能该怎么实现比较好?
@RiESA 想知道这种是怎么实现的,是你刚刚说的就是编辑的时候去维护的还是用另外一种方式做的?
2020-09-14 16:04:07 +08:00
回复了 lcq 创建的主题 Java 类似百度百科的弹出词条功能该怎么实现比较好?
@RiESA 就类似百度百科那种,这段话里有包含其他词条的就显示高亮且能跳转
关于   ·   帮助文档   ·   API   ·   FAQ   ·   我们的愿景   ·   广告投放   ·   感谢   ·   实用小工具   ·   2414 人在线   最高记录 5497   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 13ms · UTC 15:42 · PVG 23:42 · LAX 08:42 · JFK 11:42
Developed with CodeLauncher
♥ Do have faith in what you're doing.