更新代码

This commit is contained in:
付庆吉
2021-03-02 16:38:48 +08:00
parent 328d9d2366
commit e62a21cf29
3 changed files with 29 additions and 2 deletions

View File

@ -72,4 +72,10 @@ public class BizBidShared extends BaseEntity implements Serializable {
@ApiModelProperty("逻辑删除normal表示正常默认deleted表示删除")
private String deleteFlag;
@TableField(exist = false)
private String fileName;
@TableField(exist = false)
private String fileSuffix;
}

View File

@ -1,19 +1,27 @@
package com.chinaunicom.mall.ebtp.extend.bizbidshared.service.impl;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.api.AttachmentClient;
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.model.AttachmentDetail;
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.model.AttachmentEntity;
import com.chinaunicom.mall.ebtp.common.base.service.impl.BaseServiceImpl;
import com.chinaunicom.mall.ebtp.extend.bizbidshared.dao.BizBidSharedMapper;
import com.chinaunicom.mall.ebtp.extend.bizbidshared.entity.BizBidShared;
import com.chinaunicom.mall.ebtp.extend.bizbidshared.entity.BizBidSharedVO;
import com.chinaunicom.mall.ebtp.extend.bizbidshared.service.IBizBidSharedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* 对数据表 biz_bid_shared 操作的 serviceImpl
*
@ -22,6 +30,8 @@ import org.springframework.stereotype.Service;
@Service
public class BizBidSharedServiceImpl extends BaseServiceImpl<BizBidSharedMapper, BizBidShared> implements IBizBidSharedService {
@Autowired
private AttachmentClient attachmentClient;
@Override
public IPage<BizBidShared> getList(BizBidSharedVO bizBidNotice) {
@ -29,7 +39,17 @@ public class BizBidSharedServiceImpl extends BaseServiceImpl<BizBidSharedMapper,
wrapper.like(StrUtil.isNotEmpty(bizBidNotice.getSharedName()), BizBidShared::getSharedName, bizBidNotice.getSharedName())
.like(StrUtil.isNotEmpty(bizBidNotice.getSharedRole()), BizBidShared::getSharedRole, bizBidNotice.getSharedRole());
return this.page(new Page<>(bizBidNotice.getPageNo(), bizBidNotice.getPageSize()), wrapper);
Page<BizBidShared> page = this.page(new Page<>(bizBidNotice.getPageNo(), bizBidNotice.getPageSize()), wrapper);
List<String> collect = page.getRecords().stream().map(BizBidShared::getSharedFile).distinct().collect(Collectors.toList());
Optional<AttachmentDetail> optional = attachmentClient.findByBusinessId(collect);
optional.ifPresent(o -> {
page.getRecords().forEach(r -> {
Optional<AttachmentEntity> first = o.get(r.getSharedFile()).stream().findFirst();
first.ifPresent(f -> r.setFileName(f.getFilename()).setFileSuffix(FileUtil.getSuffix(f.getFilename())));
});
});
return page;
}

View File

@ -148,6 +148,7 @@ mconfig:
project: biz-service-ebtp-project #项目服务
resps: biz-service-ebtp-resps #应答结构化服务
rsms: biz-service-ebtp-rsms #评审结构化服务
tender: biz-service-ebtp-tender #投标服务
# 用户暴露给 prometheus 的健康数据
management:
endpoints: