|
|
@@ -4,10 +4,15 @@ import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import cn.hutool.core.io.FileUtil; |
|
|
|
import cn.hutool.core.lang.Assert; |
|
|
|
import cn.hutool.core.util.ReflectUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import cn.hutool.http.HttpUtil; |
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.support.SFunction; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.google.common.collect.Lists; |
|
|
|
import com.hz.pm.api.common.helper.UserInfoHelper; |
|
|
@@ -26,9 +31,12 @@ import com.hz.pm.api.projectdeclared.model.enumerization.PurchaseScopeEnum; |
|
|
|
import com.hz.pm.api.projectdeclared.model.req.SubmitPurchaseNoticeReq; |
|
|
|
import com.hz.pm.api.projectdeclared.model.req.SubmitPurchaseNoticeReq.PurchaseNoticeTenderDTO; |
|
|
|
import com.hz.pm.api.projectdeclared.model.req.SubmitPurchaseRecordReq; |
|
|
|
import com.hz.pm.api.projectdeclared.model.req.TestValidListReq; |
|
|
|
import com.hz.pm.api.projectdeclared.model.vo.PurchaseVO; |
|
|
|
import com.hz.pm.api.projectdeclared.model.vo.TestValidListVO; |
|
|
|
import com.hz.pm.api.projectdeclared.service.IContractService; |
|
|
|
import com.hz.pm.api.projectdeclared.service.IPurchaseService; |
|
|
|
import com.hz.pm.api.projectdeclared.utils.ProjectIdCodeCacheUtil; |
|
|
|
import com.hz.pm.api.projectlib.helper.ProjectHelper; |
|
|
|
import com.hz.pm.api.projectlib.model.entity.Project; |
|
|
|
import com.hz.pm.api.projectlib.model.enumeration.ProjectStatusEnum; |
|
|
@@ -49,6 +57,7 @@ import com.ningdatech.basic.util.NdDateUtils; |
|
|
|
import com.ningdatech.file.entity.File; |
|
|
|
import com.ningdatech.file.entity.vo.result.FileResultVO; |
|
|
|
import com.ningdatech.file.service.FileService; |
|
|
|
import io.swagger.models.auth.In; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
@@ -62,6 +71,8 @@ import java.time.LocalDateTime; |
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
import java.util.function.Consumer; |
|
|
|
import java.util.function.Function; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@@ -85,6 +96,8 @@ public class PurchaseManage { |
|
|
|
private final MhFileClient mhFileClient; |
|
|
|
private final FileService fileService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 待采购的-项目列表 |
|
|
|
* |
|
|
@@ -358,4 +371,47 @@ public class PurchaseManage { |
|
|
|
purchaseService.saveOrUpdate(purchase); |
|
|
|
} |
|
|
|
|
|
|
|
private PageVo<TestValidListVO> queryData(TestValidListReq req, |
|
|
|
SFunction<Purchase, Integer> function) { |
|
|
|
LambdaQueryWrapper<Purchase> query = Wrappers.lambdaQuery(Purchase.class) |
|
|
|
.like(StrUtil.isNotBlank(req.getBidName()), Purchase::getBidName, req.getBidName()) |
|
|
|
.le(req.getCreateOnMax() != null, Purchase::getCreateOn, req.getCreateOnMax()) |
|
|
|
.ge(req.getCreateOnMin() != null, Purchase::getCreateOn, req.getCreateOnMin()) |
|
|
|
.eq(req.getStatus() != null, function, req.getStatus()) |
|
|
|
.isNotNull(function) |
|
|
|
.orderByDesc(Purchase::getCreateOn); |
|
|
|
Page<Purchase> page = purchaseService.page(req.page(), query); |
|
|
|
if (page.getTotal() == 0) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
List<Purchase> records = page.getRecords(); |
|
|
|
List<Long> projectIds = CollUtils.fieldList(records, Purchase::getProjectId); |
|
|
|
Map<Long, Contract> contractMap = contractService.listByProjectIds(projectIds); |
|
|
|
List<TestValidListVO> data = records.stream().map(w -> { |
|
|
|
TestValidListVO item = new TestValidListVO(); |
|
|
|
item.setBidId(w.getId()); |
|
|
|
item.setBizName(w.getBidName()); |
|
|
|
item.setProjectId(w.getProjectId()); |
|
|
|
String projectCode = ProjectIdCodeCacheUtil.get(w.getProjectId()); |
|
|
|
item.setProjectCode(projectCode); |
|
|
|
Contract contract = contractMap.get(w.getId()); |
|
|
|
item.setContractAmount(contract.getTotalAmount()); |
|
|
|
item.setStatus(function.apply(w)); |
|
|
|
return item; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
return PageVo.of(data, page.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
public PageVo<TestValidListVO> testValidList(TestValidListReq req) { |
|
|
|
return queryData(req, Purchase::getTestValidStatus); |
|
|
|
} |
|
|
|
|
|
|
|
public PageVo<TestValidListVO> adaptList(TestValidListReq req) { |
|
|
|
return queryData(req, Purchase::getAdaptStatus); |
|
|
|
} |
|
|
|
|
|
|
|
public PageVo<TestValidListVO> selfTestList(TestValidListReq req) { |
|
|
|
return queryData(req, Purchase::getSelfTestStatus); |
|
|
|
} |
|
|
|
|
|
|
|
} |