报价单的

new
Agoni 1 year ago
parent 52dd628b70
commit c5f1d8e03f

@ -102,4 +102,21 @@ public class QuotationSheetController {
ExcelUtils.write(response, "报价单.xls", "数据", QuotationSheetExcelVO.class, datas); ExcelUtils.write(response, "报价单.xls", "数据", QuotationSheetExcelVO.class, datas);
} }
@GetMapping("/pageBidding")
@Operation(summary = "报价单中标管理列表接口")
@PreAuthorize("@ss.hasPermission('bs:quotation-sheet:query')")
public CommonResult<PageResult<QuotationSheetRespVO>> pageBidding(@Valid QuotationSheetPageReqVO pageVO) {
PageResult<QuotationSheetDO> pageResult = quotationSheetService.getQuotationSheetPageBidding(pageVO);
return success(QuotationSheetConvert.INSTANCE.convertPage(pageResult));
}
@PostMapping("/approvalBidding")
@Operation(summary = "中标审批发起接口")
@PreAuthorize("@ss.hasPermission('bs:quotation-sheet:approvalBidding')")
public CommonResult<String> approvalBidding(@Valid QuotationSheetPageReqVO pageVO) {
return success(quotationSheetService.approvalBidding(pageVO));
}
} }

@ -102,7 +102,13 @@ public class QuotationSheetPageReqVO extends PageParam {
@Schema(description = "供应商id") @Schema(description = "供应商id")
private String supplierCompanyId; private String supplierCompanyId;
@Schema(description = "供应商中标id")
private String supplierBiddingId;
@Schema(description = "申请人部门id", example = "10907") @Schema(description = "申请人部门id", example = "10907")
private Long deptId; private Long deptId;
@Schema(description = "供应商中标id集合发起审批的时候添加此参数")
private List<Long> approvalBiddingIdList;
} }

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.bs.controller.admin.quotationsheet.vo; package cn.iocoder.yudao.module.bs.controller.admin.quotationsheet.vo;
import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheet.QuotationSheetDO; import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheet.QuotationSheetDO;
import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetbidding.QuotationSheetBiddingDO;
import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetdetail.QuotationSheetDetailDO; import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetdetail.QuotationSheetDetailDO;
import cn.iocoder.yudao.module.bs.dal.dataobject.suppliercompany.SupplierCompanyDO; import cn.iocoder.yudao.module.bs.dal.dataobject.suppliercompany.SupplierCompanyDO;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
@ -31,5 +32,21 @@ public class QuotationSheetRespVO extends QuotationSheetBaseVO {
private String supplierNameList; private String supplierNameList;
private List<QuotationSheetDetailDO> quotationDetails; private List<QuotationSheetDetailDO> quotationDetails;
/**
*
*/
@Schema(description = "供应商竞标集合")
private List<QuotationSheetBiddingDO> quotationSheetBiddingDOList;
@Schema(description = "是否中标")
private Integer isWin;
/**
* id
*/
@Schema(description = "供应商中标id")
private String supplierBiddingId;
@Schema(description = "中标供应商名称")
private String biddingSupplierName;
} }

@ -29,18 +29,22 @@ public class QuotationSheetBiddingBaseVO {
private String remark; private String remark;
@Schema(description = "物料明细", example = "27461") @Schema(description = "物料明细", example = "27461")
@NotNull(message = "物料明细不能为空")
private Long quotationDetailId; private Long quotationDetailId;
@Schema(description = "物料编码") @Schema(description = "物料编码")
@NotBlank(message = "物料编码不能为空")
private String materialCode; private String materialCode;
@Schema(description = "物料id", example = "18066") @Schema(description = "物料id", example = "18066")
private Long materialId; private Long materialId;
@Schema(description = "物料名称", example = "芋艿") @Schema(description = "物料名称", example = "芋艿")
@NotBlank(message = "物料名称不能为空")
private String materialName; private String materialName;
@Schema(description = "供应商id", example = "2920") @Schema(description = "供应商id", example = "2920")
@NotNull(message = "供应商不能为空")
private Long companyId; private Long companyId;
@Schema(description = "供应商名称", example = "李四") @Schema(description = "供应商名称", example = "李四")
@ -65,4 +69,8 @@ public class QuotationSheetBiddingBaseVO {
@Schema(description = "流程实例的编号", example = "1130") @Schema(description = "流程实例的编号", example = "1130")
private Long processInstanceId; private Long processInstanceId;
@Schema(description = "报价单id", example = "2")
@NotNull(message = "报价单不能为空")
private Long quotationId;
} }

@ -65,6 +65,11 @@ public class QuotationSheetBiddingExcelVO {
@Schema(description = "附件", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "附件", requiredMode = Schema.RequiredMode.REQUIRED)
private List<ImageVo> files; private List<ImageVo> files;
/**
* id
*/
private Long quotationId;
@ExcelProperty("流程实例的编号") @ExcelProperty("流程实例的编号")
private Long processInstanceId; private Long processInstanceId;

@ -65,4 +65,10 @@ public class QuotationSheetBiddingPageReqVO extends PageParam {
@Schema(description = "流程实例的编号", example = "1130") @Schema(description = "流程实例的编号", example = "1130")
private Long processInstanceId; private Long processInstanceId;
/**
* id
*/
@Schema(description = "报价单id")
private Long quotationId;
} }

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheet;
import cn.iocoder.yudao.framework.common.pojo.ImageVo; import cn.iocoder.yudao.framework.common.pojo.ImageVo;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetbidding.QuotationSheetBiddingDO;
import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetdetail.QuotationSheetDetailDO; import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetdetail.QuotationSheetDetailDO;
import cn.iocoder.yudao.module.bs.dal.dataobject.suppliercompany.SupplierCompanyDO; import cn.iocoder.yudao.module.bs.dal.dataobject.suppliercompany.SupplierCompanyDO;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
@ -163,4 +164,23 @@ public class QuotationSheetDO extends TenantBaseDO {
*/ */
@TableField(exist = false) @TableField(exist = false)
private List<QuotationSheetDetailDO> quotationDetails; private List<QuotationSheetDetailDO> quotationDetails;
@TableField(exist = false)
private Integer isWin;
/**
* id
*/
private String supplierBiddingId;
/**
*
*/
@TableField(exist = false)
private String biddingSupplierName;
/**
*
*/
@TableField(exist = false)
private List<QuotationSheetBiddingDO> quotationSheetBiddingDOList;
} }

@ -90,5 +90,9 @@ public class QuotationSheetBiddingDO extends BaseDO {
* *
*/ */
private Long processInstanceId; private Long processInstanceId;
/**
* id
*/
private Long quotationId;
} }

@ -47,6 +47,7 @@ public interface QuotationSheetMapper extends BaseMapperX<QuotationSheetDO> {
.eqIfPresent(QuotationSheetDO::getApplicant, reqVO.getApplicant()) .eqIfPresent(QuotationSheetDO::getApplicant, reqVO.getApplicant())
.likeIfPresent(QuotationSheetDO::getSupplierIdAll,reqVO.getSupplierCompanyId()) .likeIfPresent(QuotationSheetDO::getSupplierIdAll,reqVO.getSupplierCompanyId())
.eqIfPresent(QuotationSheetDO::getDeptId, reqVO.getDeptId()) .eqIfPresent(QuotationSheetDO::getDeptId, reqVO.getDeptId())
.likeIfPresent(QuotationSheetDO::getSupplierBiddingId, reqVO.getSupplierBiddingId())
.orderByDesc(QuotationSheetDO::getId)); .orderByDesc(QuotationSheetDO::getId));
} }

@ -73,4 +73,17 @@ public interface QuotationSheetService extends MPJBaseService<QuotationSheetDO>
*/ */
List<QuotationSheetDO> getQuotationSheetList(QuotationSheetExportReqVO exportReqVO); List<QuotationSheetDO> getQuotationSheetList(QuotationSheetExportReqVO exportReqVO);
/**
*
* @param pageVO
* @return
*/
PageResult<QuotationSheetDO> getQuotationSheetPageBidding(QuotationSheetPageReqVO pageVO);
/**
*
* @param pageVO
* @return
*/
String approvalBidding(QuotationSheetPageReqVO pageVO);
} }

@ -3,14 +3,20 @@ package cn.iocoder.yudao.module.bs.service.quotationsheet;
import cn.iocoder.yudao.framework.common.util.date.DateUtils; import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapplytrip.ExpenseApplyTripDO; import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapplytrip.ExpenseApplyTripDO;
import cn.iocoder.yudao.module.bs.dal.dataobject.materiel.MaterielDO; import cn.iocoder.yudao.module.bs.dal.dataobject.materiel.MaterielDO;
import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetbidding.QuotationSheetBiddingDO;
import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetdetail.QuotationSheetDetailDO; import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetdetail.QuotationSheetDetailDO;
import cn.iocoder.yudao.module.bs.dal.dataobject.suppliercompany.SupplierCompanyDO; import cn.iocoder.yudao.module.bs.dal.dataobject.suppliercompany.SupplierCompanyDO;
import cn.iocoder.yudao.module.bs.service.materiel.MaterielService; import cn.iocoder.yudao.module.bs.service.materiel.MaterielService;
import cn.iocoder.yudao.module.bs.service.quotationsheetbidding.QuotationSheetBiddingService;
import cn.iocoder.yudao.module.bs.service.quotationsheetdetail.QuotationSheetDetailService; import cn.iocoder.yudao.module.bs.service.quotationsheetdetail.QuotationSheetDetailService;
import cn.iocoder.yudao.module.bs.service.quotationsheetdetail.QuotationSheetDetailServiceImpl; import cn.iocoder.yudao.module.bs.service.quotationsheetdetail.QuotationSheetDetailServiceImpl;
import cn.iocoder.yudao.module.bs.service.suppliercompany.SupplierCompanyService; import cn.iocoder.yudao.module.bs.service.suppliercompany.SupplierCompanyService;
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -33,6 +39,7 @@ import cn.iocoder.yudao.module.bs.convert.quotationsheet.QuotationSheetConvert;
import cn.iocoder.yudao.module.bs.dal.mysql.quotationsheet.QuotationSheetMapper; import cn.iocoder.yudao.module.bs.dal.mysql.quotationsheet.QuotationSheetMapper;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
import static cn.iocoder.yudao.module.bs.enums.ErrorCodeConstants.*; import static cn.iocoder.yudao.module.bs.enums.ErrorCodeConstants.*;
/** /**
@ -56,12 +63,25 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl<QuotationSheet
@Resource @Resource
private MaterielService materielService; private MaterielService materielService;
@Resource
private AdminUserApi adminUserApi;
@Resource
private QuotationSheetBiddingService quotationSheetBiddingService;
@Resource
private DeptApi deptApi;
@Override @Override
public Long createQuotationSheet(QuotationSheetCreateReqVO createReqVO) { public Long createQuotationSheet(QuotationSheetCreateReqVO createReqVO) {
// 插入 // 插入
QuotationSheetDO quotationSheet = QuotationSheetConvert.INSTANCE.convert(createReqVO); QuotationSheetDO quotationSheet = QuotationSheetConvert.INSTANCE.convert(createReqVO);
quotationSheet.setSupplierIdAll(createReqVO.getSupplierIdList().toString()); quotationSheet.setSupplierIdAll(createReqVO.getSupplierIdList().toString());
quotationSheet.setNumber(numberCreate()); quotationSheet.setNumber(numberCreate());
LoginUser loginUser = getLoginUser();
AdminUserRespDTO user = adminUserApi.getUser(loginUser.getId());
quotationSheet.setDeptId(user.getDeptId());
quotationSheet.setApplicant(loginUser.getId());
saveOrUpdate(quotationSheet); saveOrUpdate(quotationSheet);
if (createReqVO.getQuotationDetails().size() > 0){ if (createReqVO.getQuotationDetails().size() > 0){
//中间表插入数据 //中间表插入数据
@ -79,7 +99,7 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl<QuotationSheet
// 校验存在 // 校验存在
validateQuotationSheetExists(updateReqVO.getId()); validateQuotationSheetExists(updateReqVO.getId());
//删除原先 //删除原先
quotationSheetDetailService.remove(Wrappers.<QuotationSheetDetailDO> lambdaQuery() quotationSheetDetailService.remove(Wrappers.<QuotationSheetDetailDO> lambdaQuery()
.eq(QuotationSheetDetailDO::getCompanyId,updateReqVO.getId()).eq(BaseDO::getDeleted,0)); .eq(QuotationSheetDetailDO::getCompanyId,updateReqVO.getId()).eq(BaseDO::getDeleted,0));
// 更新 // 更新
QuotationSheetDO updateObj = QuotationSheetConvert.INSTANCE.convert(updateReqVO); QuotationSheetDO updateObj = QuotationSheetConvert.INSTANCE.convert(updateReqVO);
@ -88,6 +108,7 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl<QuotationSheet
if (updateReqVO.getQuotationDetails().size() > 0){ if (updateReqVO.getQuotationDetails().size() > 0){
//中间表插入数据 //中间表插入数据
updateReqVO.getQuotationDetails().forEach(quotationSheetDetail -> { updateReqVO.getQuotationDetails().forEach(quotationSheetDetail -> {
quotationSheetDetail.setId(null);
quotationSheetDetail.setCompanyId(updateObj.getId()); quotationSheetDetail.setCompanyId(updateObj.getId());
}); });
quotationSheetDetailService.saveBatch(updateReqVO.getQuotationDetails()); quotationSheetDetailService.saveBatch(updateReqVO.getQuotationDetails());
@ -246,6 +267,74 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl<QuotationSheet
return quotationSheetDOList; return quotationSheetDOList;
} }
@Override
public PageResult<QuotationSheetDO> getQuotationSheetPageBidding(QuotationSheetPageReqVO pageVO) {
PageResult<QuotationSheetDO> sheetDOPageResult = quotationSheetMapper.selectPage(pageVO);
if (sheetDOPageResult.getList()!=null&&sheetDOPageResult.getList().size()>0){
List<MaterielDO> materielDOList = materielService.list(new QueryWrapper<MaterielDO>().eq("tenant_id",sheetDOPageResult.getList().get(0).getTenantId()));
List<QuotationSheetBiddingDO> quotationSheetBiddingDOList = quotationSheetBiddingService.list(new QueryWrapper<QuotationSheetBiddingDO>().eq("tenant_id", sheetDOPageResult.getList().get(0).getTenantId()));
Map<Long, MaterielDO> map=new HashMap<>(2);
if (null!=materielDOList){
map= materielDOList.stream().collect(Collectors.toMap(MaterielDO::getId, x ->x));
}
Map<Long, List<QuotationSheetBiddingDO>> biddingMap=new HashMap<>(2);
if (null!=quotationSheetBiddingDOList&&quotationSheetBiddingDOList.size()>0){
biddingMap= quotationSheetBiddingDOList.stream().collect(Collectors.groupingBy(QuotationSheetBiddingDO::getQuotationId));
}
Map<Long, MaterielDO> finalMap = map;
Map<Long, List<QuotationSheetBiddingDO>> finalBiddingMap = biddingMap;
sheetDOPageResult.getList().forEach(a->{
List<QuotationSheetDetailDO> quotationSheetDetailDOList = quotationSheetDetailService.list(new QueryWrapper<QuotationSheetDetailDO>().eq("company_id", a.getId()));
if (null==quotationSheetDetailDOList){
quotationSheetDetailDOList = new ArrayList<>();
}
if (finalBiddingMap.size()>0){
List<QuotationSheetBiddingDO> sheetBiddingDOList = finalBiddingMap.get(a.getId());
if (null!=sheetBiddingDOList){
a.setQuotationSheetBiddingDOList(sheetBiddingDOList);
}else {
a.setQuotationSheetBiddingDOList(new ArrayList<>());
}
}else {
a.setQuotationSheetBiddingDOList(new ArrayList<>());
}
if (quotationSheetDetailDOList.size()>0){
quotationSheetDetailDOList.forEach(q->{
if (finalMap.size()>0){
MaterielDO materielDO = finalMap.get(q.getMaterialId());
if (null!=materielDO){
q.setMaterielCode(materielDO.getMaterielCode());
q.setMaterielName(materielDO.getMaterielName());
}
}
});
}
List<SupplierCompanyDO> supplierCompanyDOList = supplierCompanyService.listByIds(JSON.parseArray(a.getSupplierIdAll(), Long.class));
if (null!=supplierCompanyDOList){
String collect = supplierCompanyDOList.stream().map(SupplierCompanyDO::getCompanyAme).collect(Collectors.toList()).stream().collect(Collectors.joining(","));
a.setSupplierNameList(collect);
}
if (null!=a.getSupplierBiddingId()&&!"".equals(a.getSupplierBiddingId())){
List<SupplierCompanyDO> supplierCompanyDO = supplierCompanyService.listByIds(JSON.parseArray(a.getSupplierBiddingId(), Long.class));
if (null!=supplierCompanyDO){
a.setBiddingSupplierName(supplierCompanyDO.stream().map(SupplierCompanyDO::getCompanyAme).collect(Collectors.toList()).stream().collect(Collectors.joining(",")));
}
a.setIsWin(1);
}else {
a.setIsWin(2);
}
a.setSupplierList(supplierCompanyDOList);
a.setQuotationDetails(quotationSheetDetailDOList);
});
}
return sheetDOPageResult;
}
@Override
public String approvalBidding(QuotationSheetPageReqVO pageVO) {
return null;
}
/** /**
* *
* @return * @return

Loading…
Cancel
Save