修改分标策划、招标计划新增接口

This commit is contained in:
2025-08-30 04:59:51 +08:00
parent b44de3ff49
commit a588b94310
4 changed files with 74 additions and 33 deletions

View File

@ -105,4 +105,6 @@ public interface IBusBillofquantitiesLimitListService extends IService<BusBillof
* @return
*/
BusBLimitListVersionsVo getVersionDetail(Long versions);
BusBillofquantitiesLimitListVo queryBySId(String pid);
}

View File

@ -3,10 +3,6 @@ package org.dromara.tender.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.domain.event.ProcessDeleteEvent;
import org.dromara.common.core.domain.event.ProcessEvent;
import org.dromara.common.core.domain.event.ProcessTaskEvent;
import org.dromara.common.core.enums.BusinessStatusEnum;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
@ -16,11 +12,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.dromara.common.oss.core.OssClient;
import org.dromara.common.oss.factory.OssFactory;
import org.dromara.design.domain.BusBillofquantities;
import org.dromara.design.domain.BusBillofquantitiesVersions;
import org.dromara.formalities.domain.BusFormalitiesAnnex;
import org.dromara.system.domain.vo.SysOssUploadVo;
import org.dromara.system.service.ISysOssService;
import org.dromara.tender.domain.*;
@ -34,7 +25,6 @@ import org.dromara.tender.service.IBusBiddingPlanAnnexService;
import org.dromara.tender.service.IBusBillofquantitiesLimitListService;
import org.dromara.tender.service.ITenderSupplierInputService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;
import org.dromara.tender.domain.bo.BusBiddingPlanBo;
import org.dromara.tender.domain.vo.BusBiddingPlanVo;
@ -148,7 +138,7 @@ public class BusBiddingPlanServiceImpl extends ServiceImpl<BusBiddingPlanMapper,
bo.setId(add.getId());
if (bo.getLimitListBos() != null && !bo.getLimitListBos().isEmpty()) {
//生成分标策划-限价一览对象集合
List<BusTenderPlanningLimitList> planningLimitListList = new ArrayList<>();
Set<BusTenderPlanningLimitList> planningLimitListList = new HashSet<>();
for (BusTenderPlanningLimitListBo limitListBo : bo.getLimitListBos()) {
BusTenderPlanningLimitList busTenderPlanningLimitList = new BusTenderPlanningLimitList();
busTenderPlanningLimitList.setLimitListId(limitListBo.getLimitListId());
@ -167,6 +157,7 @@ public class BusBiddingPlanServiceImpl extends ServiceImpl<BusBiddingPlanMapper,
}
busTenderPlanningLimitList.setNum(limitListBo.getNum());
planningLimitListList.add(busTenderPlanningLimitList);
getPidVO(busBillofquantitiesLimitListVo.getPid(),planningLimitListList,bo.getId());
}
add.setPlannedBiddingMethod(price.compareTo(BigDecimal.valueOf(10000000)) > 0 ? "公招":"邀标");
add.setPrice(price);
@ -391,4 +382,34 @@ public class BusBiddingPlanServiceImpl extends ServiceImpl<BusBiddingPlanMapper,
return children;
}
private Set<BusTenderPlanningLimitList> getPidVO(String pId, Set<BusTenderPlanningLimitList> planningLimitListList, Long id) {
// 终止条件pId 为 null 或等于 "0",表示已到达根节点
if (pId == null || Objects.equals(pId, "0")) {
return planningLimitListList;
}
try {
// 查询当前节点的 VO
BusBillofquantitiesLimitListVo vo = busBillofquantitiesLimitListService.queryBySId(pId);
if (vo == null) {
return planningLimitListList; // 当前节点不存在,直接返回已有集合
}
// 创建关联对象并添加到集合
BusTenderPlanningLimitList tenderPlanningLimitList = new BusTenderPlanningLimitList();
tenderPlanningLimitList.setBiddingPlanId(id);
tenderPlanningLimitList.setLimitListId(vo.getId());
planningLimitListList.add(tenderPlanningLimitList);
// 递归处理父节点
return getPidVO(vo.getPid(), planningLimitListList, id);
} catch (Exception e) {
// 异常处理(可选)
log.error("Error while getting parent nodes: ", e);
return planningLimitListList;
}
}
}

View File

@ -267,15 +267,9 @@ public class BusBillofquantitiesLimitListServiceImpl extends ServiceImpl<BusBill
@Override
public List<BusBillofquantitiesLimitListVo> getListByIds(List<Long> ids) {
List<BusBillofquantitiesLimitList> limitListList = baseMapper.selectBatchIds(ids);
List<String> sids = new ArrayList<>();
limitListList.forEach(item -> {
sids.add(item.getSid());
});
if (sids.isEmpty()) {
return new ArrayList<>();
}
List<BusBillofquantitiesLimitListVo> listVoList = baseMapper.selectListBySids(sids);
List<BusBillofquantitiesLimitListVo> listVoList = baseMapper.selectVoList(new LambdaQueryWrapper<BusBillofquantitiesLimitList>()
.in(BusBillofquantitiesLimitList::getId, ids)
.orderByAsc(BusBillofquantitiesLimitList::getSid));
return listVoList;
}
@ -285,6 +279,11 @@ public class BusBillofquantitiesLimitListServiceImpl extends ServiceImpl<BusBill
return busBLimitListVersionsService.queryById(id);
}
@Override
public BusBillofquantitiesLimitListVo queryBySId(String pid) {
return baseMapper.selectVoOne(new LambdaQueryWrapper<BusBillofquantitiesLimitList>().eq(BusBillofquantitiesLimitList::getSid, pid));
}
/**
* 递归构建树形结构
*

View File

@ -4,19 +4,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.core.page.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.dromara.common.translation.annotation.Translation;
import org.dromara.tender.domain.BusBillofquantitiesLimitList;
import org.dromara.tender.domain.BusIndicatorPlanningLimitList;
import org.dromara.tender.domain.BusSegmentedIndicatorPlanning;
import org.dromara.tender.domain.bo.BusIndicatorPlanningLimitListBo;
@ -29,11 +23,6 @@ import org.dromara.tender.service.IBusBillofquantitiesLimitListService;
import org.dromara.tender.service.IBusSegmentedIndicatorPlanningService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.dromara.tender.domain.bo.BusSegmentedIndicatorPlanningBo;
import org.dromara.tender.domain.vo.BusSegmentedIndicatorPlanningVo;
import org.dromara.tender.domain.BusSegmentedIndicatorPlanning;
import org.dromara.tender.mapper.BusSegmentedIndicatorPlanningMapper;
import org.dromara.tender.service.IBusSegmentedIndicatorPlanningService;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
@ -124,7 +113,7 @@ public class BusSegmentedIndicatorPlanningServiceImpl extends ServiceImpl<BusSeg
bo.setId(add.getId());
if (bo.getLimitListBos() != null && !bo.getLimitListBos().isEmpty()) {
//生成分标策划-限价一览对象集合
List<BusIndicatorPlanningLimitList> planningLimitListList = new ArrayList<>();
Set<BusIndicatorPlanningLimitList> planningLimitListList = new HashSet<>();
for (BusIndicatorPlanningLimitListBo limitListBo : bo.getLimitListBos()) {
BusIndicatorPlanningLimitList busIndicatorPlanningLimitList = new BusIndicatorPlanningLimitList();
busIndicatorPlanningLimitList.setLimitListId(limitListBo.getLimitListId());
@ -139,6 +128,7 @@ public class BusSegmentedIndicatorPlanningServiceImpl extends ServiceImpl<BusSeg
}
busIndicatorPlanningLimitList.setNum(limitListBo.getNum());
planningLimitListList.add(busIndicatorPlanningLimitList);
getPidVO(busBillofquantitiesLimitListVo.getPid(),planningLimitListList,bo.getId());
if (busBillofquantitiesLimitListVo.getUnitPrice() != null && limitListBo.getNum() != null){
price = price.add(busBillofquantitiesLimitListVo.getUnitPrice().multiply(limitListBo.getNum()).setScale(2, RoundingMode.HALF_UP));
}
@ -296,4 +286,33 @@ public class BusSegmentedIndicatorPlanningServiceImpl extends ServiceImpl<BusSeg
return children;
}
private Set<BusIndicatorPlanningLimitList> getPidVO(String pId, Set<BusIndicatorPlanningLimitList> planningLimitListList, Long id) {
// 终止条件pId 为 null 或等于 "0",表示已到达根节点
if (pId == null || Objects.equals(pId, "0")) {
return planningLimitListList;
}
try {
// 查询当前节点的 VO
BusBillofquantitiesLimitListVo vo = busBillofquantitiesLimitListService.queryBySId(pId);
if (vo == null) {
return planningLimitListList; // 当前节点不存在,直接返回已有集合
}
// 创建关联对象并添加到集合
BusIndicatorPlanningLimitList busIndicatorPlanningLimitList = new BusIndicatorPlanningLimitList();
busIndicatorPlanningLimitList.setSegmentedIndicatorId(id);
busIndicatorPlanningLimitList.setLimitListId(vo.getId());
planningLimitListList.add(busIndicatorPlanningLimitList);
// 递归处理父节点
return getPidVO(vo.getPid(), planningLimitListList, id);
} catch (Exception e) {
// 异常处理(可选)
log.error("Error while getting parent nodes: ", e);
return planningLimitListList;
}
}
}