08-20-供应商入库增加字段,完成招标计划

This commit is contained in:
2025-08-21 00:47:06 +08:00
parent b295b09fe9
commit 4660a18dbd
10 changed files with 182 additions and 90 deletions

View File

@ -2,11 +2,15 @@ package org.dromara.tender.controller;
import java.util.List;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.tender.domain.TenderPlanFile;
import org.dromara.tender.service.impl.TenderPlanFileServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
@ -37,6 +41,8 @@ public class BusSegmentedIndicatorPlanningController extends BaseController {
private final IBusSegmentedIndicatorPlanningService busSegmentedIndicatorPlanningService;
private final TenderPlanFileServiceImpl tenderPlanFileService;
/**
* 查询分标策划列表
*/
@ -72,7 +78,10 @@ public class BusSegmentedIndicatorPlanningController extends BaseController {
@GetMapping("/{id}")
public R<BusSegmentedIndicatorPlanningVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Long id) {
return R.ok(busSegmentedIndicatorPlanningService.queryById(id));
BusSegmentedIndicatorPlanningVo busSegmentedIndicatorPlanningVo = busSegmentedIndicatorPlanningService.queryById(id);
List<TenderPlanFile> list = tenderPlanFileService.list(Wrappers.<TenderPlanFile>lambdaQuery().eq(TenderPlanFile::getPlanId, id));
busSegmentedIndicatorPlanningVo.setFile(list);
return R.ok(busSegmentedIndicatorPlanningVo);
}
/**

View File

@ -1,36 +1,36 @@
package org.dromara.tender.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.web.core.BaseController;
import org.dromara.system.domain.vo.SysOssVo;
import org.dromara.system.service.impl.SysOssServiceImpl;
import org.dromara.tender.domain.TenderPlanFile;
import org.dromara.tender.domain.bo.BusSegmentedIndicatorPlanningBo;
import org.dromara.tender.domain.bo.TenderPlanFileBo;
import org.dromara.tender.domain.vo.BusSegmentedIndicatorPlanningVo;
import org.dromara.tender.service.IBusSegmentedIndicatorPlanningService;
import org.dromara.tender.service.impl.TenderPlanFileServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.ArrayList;
import java.util.List;
import lombok.RequiredArgsConstructor;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import org.dromara.system.domain.vo.SysOssVo;
import org.dromara.system.service.ISysOssService;
import org.dromara.system.service.impl.SysOssServiceImpl;
import org.dromara.tender.domain.TenderPlanFile;
import org.dromara.tender.service.impl.TenderPlanFileServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.web.core.BaseController;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.excel.utils.ExcelUtil;
import org.dromara.tender.domain.vo.BusSegmentedIndicatorPlanningVo;
import org.dromara.tender.domain.bo.BusSegmentedIndicatorPlanningBo;
import org.dromara.tender.service.IBusSegmentedIndicatorPlanningService;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/**
* 招标计划
*
@ -44,8 +44,10 @@ import org.springframework.web.multipart.MultipartFile;
public class TenderPlanController extends BaseController {
private final IBusSegmentedIndicatorPlanningService busSegmentedIndicatorPlanningService;
@Autowired private SysOssServiceImpl sysOssService;
@Autowired private TenderPlanFileServiceImpl tenderPlanFileService;
@Autowired
private SysOssServiceImpl sysOssService;
@Autowired
private TenderPlanFileServiceImpl tenderPlanFileService;
/**
* 查询招标计划列表
@ -98,22 +100,32 @@ public class TenderPlanController extends BaseController {
@Log(title = "招标计划", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@RequestBody BusSegmentedIndicatorPlanningBo bo, @RequestParam(value = "files", required = false) List<MultipartFile> files) {
if ( files != null &&!files.isEmpty()){
List<TenderPlanFile> tenderPlanFiles = new ArrayList<>();
for (MultipartFile file : files) {
SysOssVo upload = sysOssService.upload(file);
TenderPlanFile tenderPlanFile = new TenderPlanFile();
tenderPlanFile.setFileId(upload.getOssId());
tenderPlanFile.setFileUrl(upload.getUrl());
tenderPlanFile.setPlanId(bo.getId());
tenderPlanFiles.add(tenderPlanFile);
}
boolean b = tenderPlanFileService.saveBatch(tenderPlanFiles);
if (!b){
throw new RuntimeException("保存多个文件失败");
}
public R<Void> edit(@RequestBody BusSegmentedIndicatorPlanningBo bo) {
if (CollectionUtil.isNotEmpty(bo.getFile())) {
tenderPlanFileService.remove(Wrappers.<TenderPlanFile>lambdaQuery().eq(TenderPlanFile::getPlanId, bo.getId()));
List<TenderPlanFile> convert = MapstructUtils.convert(bo.getFile(), TenderPlanFile.class);
convert.forEach(item -> {
item.setPlanId(bo.getId());
});
tenderPlanFileService.saveBatch(convert);
}
// if (files != null && !files.isEmpty()) {
// List<TenderPlanFile> tenderPlanFiles = new ArrayList<>();
// for (MultipartFile file : files) {
// SysOssVo upload = sysOssService.upload(file);
// TenderPlanFile tenderPlanFile = new TenderPlanFile();
// tenderPlanFile.setFileId(upload.getOssId());
// tenderPlanFile.setFileUrl(upload.getUrl());
// tenderPlanFile.setPlanId(bo.getId());
// tenderPlanFile.setFileType(bo.getFileType());
// tenderPlanFiles.add(tenderPlanFile);
// }
// boolean b = tenderPlanFileService.saveBatch(tenderPlanFiles);
// if (!b) {
// throw new RuntimeException("保存多个文件失败");
// }
// }
return toAjax(busSegmentedIndicatorPlanningService.updateByBo(bo));
}

View File

@ -1,6 +1,12 @@
package org.dromara.tender.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import lombok.RequiredArgsConstructor;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.tender.domain.bo.TenderPlanFileBo;
import org.dromara.tender.domain.vo.TenderPlanFileVo;
import org.dromara.tender.service.ITenderPlanFileService;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.dromara.common.web.core.BaseController;
@ -17,16 +23,16 @@ import org.dromara.common.web.core.BaseController;
@RequestMapping("/planFile")
public class TenderPlanFileController extends BaseController {
// private final ITenderPlanFileService tenderPlanFileService;
private final ITenderPlanFileService tenderPlanFileService;
//
// /**
// * 查询招标计划-招标文件列表
// */
// @SaCheckPermission("/:planFile:list")
// @GetMapping("/list")
// public TableDataInfo<TenderPlanFileVo> list(TenderPlanFileBo bo, PageQuery pageQuery) {
// return tenderPlanFileService.queryPageList(bo, pageQuery);
// }
/**
* 查询招标计划-招标文件列表
*/
@SaCheckPermission("/:planFile:list")
@GetMapping("/list")
public TableDataInfo<TenderPlanFileVo> list(TenderPlanFileBo bo, PageQuery pageQuery) {
return tenderPlanFileService.queryPageList(bo, pageQuery);
}
//
// /**
// * 导出招标计划-招标文件列表

View File

@ -1,11 +1,11 @@
package org.dromara.tender.domain;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
import java.io.Serializable;
/**
* 招标计划-招标文件对象 tender_plan_file
@ -14,9 +14,8 @@ import java.io.Serial;
* @date 2025-08-20
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("tender_plan_file")
public class TenderPlanFile extends BaseEntity {
public class TenderPlanFile implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@ -42,5 +41,10 @@ public class TenderPlanFile extends BaseEntity {
*/
private String fileUrl;
/**
* 文件类型 1-招标文件 2-中标文件
*/
private String fileType;
}

View File

@ -1,21 +1,19 @@
package org.dromara.tender.domain.bo;
import org.dromara.tender.domain.BusSegmentedIndicatorPlanning;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.tender.domain.BusSegmentedIndicatorPlanning;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
* 分标策划业务对象 bus_segmented_indicator_planning
*
@ -30,7 +28,7 @@ public class BusSegmentedIndicatorPlanningBo extends BaseEntity {
/**
* 主键ID
*/
@NotNull(message = "主键ID不能为空", groups = { EditGroup.class })
@NotNull(message = "主键ID不能为空", groups = {EditGroup.class})
private Long id;
/**
@ -40,11 +38,10 @@ public class BusSegmentedIndicatorPlanningBo extends BaseEntity {
// private Long projectId;
/**
* 分包类型名称
*/
@NotBlank(message = "分包类型不能为空", groups = { AddGroup.class, EditGroup.class })
@NotBlank(message = "分包类型不能为空", groups = {AddGroup.class, EditGroup.class})
private String dictName;
/**
@ -93,5 +90,14 @@ public class BusSegmentedIndicatorPlanningBo extends BaseEntity {
*/
private List<BusIndicatorPlanningLimitListBo> limitListBos;
/**
* 文件类型
*/
private String fileType;
/**
* 文件
*/
private List<TenderPlanFileBo> file;
}

View File

@ -40,5 +40,10 @@ public class TenderPlanFileBo extends BaseEntity {
*/
private String fileUrl;
/**
* 文件类型
*/
private String fileType;
}

View File

@ -11,11 +11,12 @@ import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.dromara.tender.domain.TenderPlanFile;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
@ -27,7 +28,8 @@ import java.util.Date;
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = BusSegmentedIndicatorPlanning.class)
public class BusSegmentedIndicatorPlanningVo implements Serializable {
public class
BusSegmentedIndicatorPlanningVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
@ -100,5 +102,6 @@ public class BusSegmentedIndicatorPlanningVo implements Serializable {
@ExcelProperty(value = "中标通知书")
private String bidFile;
private List<TenderPlanFile> file;
}

View File

@ -51,5 +51,7 @@ public class TenderPlanFileVo implements Serializable {
@ExcelProperty(value = "文件地址")
private String fileUrl;
private String fileName;
}

View File

@ -1,36 +1,34 @@
package org.dromara.tender.service.impl;
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 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.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.common.mybatis.core.page.TableDataInfo;
import org.dromara.tender.domain.BusIndicatorPlanningLimitList;
import org.dromara.tender.domain.BusSegmentedIndicatorPlanning;
import org.dromara.tender.domain.bo.BusIndicatorPlanningLimitListBo;
import org.dromara.tender.domain.bo.BusSegmentedIndicatorPlanningBo;
import org.dromara.tender.domain.vo.BusBillofquantitiesLimitListVo;
import org.dromara.tender.domain.vo.BusSegmentedIndicatorPlanningVo;
import org.dromara.tender.mapper.BusIndicatorPlanningLimitListMapper;
import org.dromara.tender.mapper.BusSegmentedIndicatorPlanningMapper;
import org.dromara.tender.service.IBusBillofquantitiesLimitListService;
import org.dromara.tender.service.IBusIndicatorPlanningLimitListService;
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;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Collection;
/**
* 分标策划Service业务层处理
@ -55,7 +53,7 @@ public class BusSegmentedIndicatorPlanningServiceImpl extends ServiceImpl<BusSeg
* @return 分标策划
*/
@Override
public BusSegmentedIndicatorPlanningVo queryById(Long id){
public BusSegmentedIndicatorPlanningVo queryById(Long id) {
return baseMapper.selectVoById(id);
}
@ -124,7 +122,7 @@ public class BusSegmentedIndicatorPlanningServiceImpl extends ServiceImpl<BusSeg
throw new ServiceException("限价一览数据不存在");
}
if (busBillofquantitiesLimitListVo.getQuantity().compareTo(limitListBo.getNum().add(count)) < 0) {
throw new ServiceException(busBillofquantitiesLimitListVo.getName()+"数量超过了总数量");
throw new ServiceException(busBillofquantitiesLimitListVo.getName() + "数量超过了总数量");
}
planningLimitListList.add(busIndicatorPlanningLimitList);
}
@ -150,8 +148,48 @@ public class BusSegmentedIndicatorPlanningServiceImpl extends ServiceImpl<BusSeg
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(BusSegmentedIndicatorPlanning entity){
private void validEntityBeforeSave(BusSegmentedIndicatorPlanning entity) {
//TODO 做一些数据校验,如唯一约束
String dictName = entity.getDictName();
BigDecimal contractPrice = entity.getContractPrice();
switch (dictName) {
case "1" -> {
if (contractPrice.compareTo(BigDecimal.valueOf(100000000)) > 0) {
entity.setPlannedBiddingMethod("1");
} else {
entity.setPlannedBiddingMethod("2");
}
}
case "2" -> {
if (contractPrice.compareTo(BigDecimal.valueOf(10000000)) > 0) {
entity.setPlannedBiddingMethod("1");
} else {
entity.setPlannedBiddingMethod("2");
}
}
case "3" -> {
if (contractPrice.compareTo(BigDecimal.valueOf(1000000)) > 0) {
entity.setPlannedBiddingMethod("1");
} else {
entity.setPlannedBiddingMethod("2");
}
}
case "4" -> {
if (contractPrice.compareTo(BigDecimal.valueOf(100000)) > 0) {
entity.setPlannedBiddingMethod("1");
} else {
entity.setPlannedBiddingMethod("2");
}
}
case "5" -> {
if (contractPrice.compareTo(BigDecimal.valueOf(10000)) > 0) {
entity.setPlannedBiddingMethod("1");
} else {
entity.setPlannedBiddingMethod("2");
}
}
default -> throw new ServiceException("未知分包类型");
}
}
/**
@ -163,7 +201,7 @@ public class BusSegmentedIndicatorPlanningServiceImpl extends ServiceImpl<BusSeg
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
if (isValid) {
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteByIds(ids) > 0;

View File

@ -9,6 +9,7 @@ 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.system.service.ISysOssService;
import org.springframework.stereotype.Service;
import org.dromara.tender.domain.bo.TenderPlanFileBo;
import org.dromara.tender.domain.vo.TenderPlanFileVo;
@ -32,6 +33,8 @@ public class TenderPlanFileServiceImpl extends ServiceImpl<TenderPlanFileMapper,
private final TenderPlanFileMapper baseMapper;
private final ISysOssService ossService;
/**
* 查询招标计划-招标文件
*
@ -54,6 +57,10 @@ public class TenderPlanFileServiceImpl extends ServiceImpl<TenderPlanFileMapper,
public TableDataInfo<TenderPlanFileVo> queryPageList(TenderPlanFileBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<TenderPlanFile> lqw = buildQueryWrapper(bo);
Page<TenderPlanFileVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
result.getRecords().forEach(v -> {
v.setFileName(ossService.getById(v.getFileId()).getFileName());
});
return TableDataInfo.build(result);
}