采购单 报价单 物料

new
Agoni 1 year ago
parent 3fb990a4bd
commit d42448aa50

@ -1,5 +1,7 @@
package cn.iocoder.yudao.module.bs.controller.admin.quotationsheet; package cn.iocoder.yudao.module.bs.controller.admin.quotationsheet;
import cn.iocoder.yudao.module.bs.service.suppliercompany.SupplierCompanyService;
import com.alibaba.fastjson.JSON;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;

@ -13,9 +13,9 @@ import javax.validation.constraints.*;
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
public class QuotationSheetCreateReqVO extends QuotationSheetBaseVO { public class QuotationSheetCreateReqVO extends QuotationSheetBaseVO {
/* @Schema(description = "物料id集合", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "供应商id集合", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "物料id集合不能为空") @NotEmpty(message = "供应商id集合不能为空")
private List<Long> suppliesIdList;*/ private List<Long> supplierIdList;
@NotEmpty(message = "物料不能为空") @NotEmpty(message = "物料不能为空")
private List<QuotationSheetDetailDO> quotationDetails; private List<QuotationSheetDetailDO> quotationDetails;

@ -2,8 +2,12 @@ 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.quotationsheetdetail.QuotationSheetDetailDO; import cn.iocoder.yudao.module.bs.dal.dataobject.quotationsheetdetail.QuotationSheetDetailDO;
import cn.iocoder.yudao.module.bs.dal.dataobject.suppliercompany.SupplierCompanyDO;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import org.apache.poi.ss.formula.functions.T;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
@ -19,6 +23,10 @@ public class QuotationSheetRespVO extends QuotationSheetBaseVO {
@Schema(description = "创建时间") @Schema(description = "创建时间")
private LocalDateTime createTime; private LocalDateTime createTime;
/**
*
*/
private List<SupplierCompanyDO> supplierList;
private List<QuotationSheetDetailDO> quotationDetails; private List<QuotationSheetDetailDO> quotationDetails;

@ -16,6 +16,9 @@ public class QuotationSheetUpdateReqVO extends QuotationSheetBaseVO {
@NotNull(message = "主键不能为空") @NotNull(message = "主键不能为空")
private Long id; private Long id;
@Schema(description = "供应商id集合", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "供应商id集合不能为空")
private List<Long> supplierIdList;
@NotEmpty(message = "物料不能为空") @NotEmpty(message = "物料不能为空")
private List<QuotationSheetDetailDO> quotationDetails; private List<QuotationSheetDetailDO> quotationDetails;

@ -31,7 +31,7 @@ public class QuotationSheetDetailBaseVO {
private Long companyId; private Long companyId;
@Schema(description = "规格") @Schema(description = "规格")
private String desc; private String getDescStr;
@Schema(description = "用量") @Schema(description = "用量")
private Integer dosage; private Integer dosage;

@ -30,6 +30,9 @@ public class MaterielDO extends TenantBaseDO {
*/ */
@TableId @TableId
private Long id; private Long id;
private Long tenantId;
/** /**
* *
*/ */

@ -2,6 +2,8 @@ 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.quotationsheetdetail.QuotationSheetDetailDO;
import cn.iocoder.yudao.module.bs.dal.dataobject.suppliercompany.SupplierCompanyDO;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
@ -14,6 +16,9 @@ import java.time.LocalDateTime;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import org.apache.poi.ss.formula.functions.T;
import javax.validation.constraints.NotEmpty;
/** /**
* DO * DO
@ -137,12 +142,22 @@ public class QuotationSheetDO extends TenantBaseDO {
*/ */
private Long applicant; private Long applicant;
/** /**
* id * id
*/ */
private String materialIdList; private String supplierIdAll;
/** /**
* id * id
*/ */
private Long deptId; private Long deptId;
/**
*
*/
@TableField(exist = false)
private List<SupplierCompanyDO> supplierList;
/**
*
*/
@TableField(exist = false)
private List<QuotationSheetDetailDO> quotationDetails;
} }

@ -27,6 +27,8 @@ public class QuotationSheetDetailDO extends BaseDO {
*/ */
@TableId @TableId
private Long id; private Long id;
private Long tenantId;
/** /**
* *
*/ */
@ -50,7 +52,7 @@ public class QuotationSheetDetailDO extends BaseDO {
/** /**
* *
*/ */
private String desc; private String descStr;
/** /**
* *
*/ */

@ -45,7 +45,7 @@ public interface QuotationSheetMapper extends BaseMapperX<QuotationSheetDO> {
.eqIfPresent(QuotationSheetDO::getPurchaseContent, reqVO.getPurchaseContent()) .eqIfPresent(QuotationSheetDO::getPurchaseContent, reqVO.getPurchaseContent())
.betweenIfPresent(QuotationSheetDO::getApplyTime, reqVO.getApplyTime()) .betweenIfPresent(QuotationSheetDO::getApplyTime, reqVO.getApplyTime())
.eqIfPresent(QuotationSheetDO::getApplicant, reqVO.getApplicant()) .eqIfPresent(QuotationSheetDO::getApplicant, reqVO.getApplicant())
.eqIfPresent(QuotationSheetDO::getMaterialIdList, reqVO.getMaterialIdList()) .eqIfPresent(QuotationSheetDO::getSupplierIdAll, reqVO.getMaterialIdList())
.eqIfPresent(QuotationSheetDO::getDeptId, reqVO.getDeptId()) .eqIfPresent(QuotationSheetDO::getDeptId, reqVO.getDeptId())
.orderByDesc(QuotationSheetDO::getId)); .orderByDesc(QuotationSheetDO::getId));
} }
@ -78,7 +78,7 @@ public interface QuotationSheetMapper extends BaseMapperX<QuotationSheetDO> {
.eqIfPresent(QuotationSheetDO::getPurchaseContent, reqVO.getPurchaseContent()) .eqIfPresent(QuotationSheetDO::getPurchaseContent, reqVO.getPurchaseContent())
.betweenIfPresent(QuotationSheetDO::getApplyTime, reqVO.getApplyTime()) .betweenIfPresent(QuotationSheetDO::getApplyTime, reqVO.getApplyTime())
.eqIfPresent(QuotationSheetDO::getApplicant, reqVO.getApplicant()) .eqIfPresent(QuotationSheetDO::getApplicant, reqVO.getApplicant())
.eqIfPresent(QuotationSheetDO::getMaterialIdList, reqVO.getMaterialIdList()) .eqIfPresent(QuotationSheetDO::getSupplierIdAll, reqVO.getMaterialIdList())
.eqIfPresent(QuotationSheetDO::getDeptId, reqVO.getDeptId()) .eqIfPresent(QuotationSheetDO::getDeptId, reqVO.getDeptId())
.orderByDesc(QuotationSheetDO::getId)); .orderByDesc(QuotationSheetDO::getId));
} }

@ -25,7 +25,7 @@ public interface QuotationSheetDetailMapper extends BaseMapperX<QuotationSheetDe
.eqIfPresent(QuotationSheetDetailDO::getMaterialCode, reqVO.getMaterialCode()) .eqIfPresent(QuotationSheetDetailDO::getMaterialCode, reqVO.getMaterialCode())
.eqIfPresent(QuotationSheetDetailDO::getMaterialId, reqVO.getMaterialId()) .eqIfPresent(QuotationSheetDetailDO::getMaterialId, reqVO.getMaterialId())
.eqIfPresent(QuotationSheetDetailDO::getCompanyId, reqVO.getCompanyId()) .eqIfPresent(QuotationSheetDetailDO::getCompanyId, reqVO.getCompanyId())
.eqIfPresent(QuotationSheetDetailDO::getDesc, reqVO.getDesc()) .eqIfPresent(QuotationSheetDetailDO::getDescStr, reqVO.getDesc())
.eqIfPresent(QuotationSheetDetailDO::getDosage, reqVO.getDosage()) .eqIfPresent(QuotationSheetDetailDO::getDosage, reqVO.getDosage())
.eqIfPresent(QuotationSheetDetailDO::getUnti, reqVO.getUnti()) .eqIfPresent(QuotationSheetDetailDO::getUnti, reqVO.getUnti())
.eqIfPresent(QuotationSheetDetailDO::getQuality, reqVO.getQuality()) .eqIfPresent(QuotationSheetDetailDO::getQuality, reqVO.getQuality())
@ -40,7 +40,7 @@ public interface QuotationSheetDetailMapper extends BaseMapperX<QuotationSheetDe
.eqIfPresent(QuotationSheetDetailDO::getMaterialCode, reqVO.getMaterialCode()) .eqIfPresent(QuotationSheetDetailDO::getMaterialCode, reqVO.getMaterialCode())
.eqIfPresent(QuotationSheetDetailDO::getMaterialId, reqVO.getMaterialId()) .eqIfPresent(QuotationSheetDetailDO::getMaterialId, reqVO.getMaterialId())
.eqIfPresent(QuotationSheetDetailDO::getCompanyId, reqVO.getCompanyId()) .eqIfPresent(QuotationSheetDetailDO::getCompanyId, reqVO.getCompanyId())
.eqIfPresent(QuotationSheetDetailDO::getDesc, reqVO.getDesc()) .eqIfPresent(QuotationSheetDetailDO::getDescStr, reqVO.getDesc())
.eqIfPresent(QuotationSheetDetailDO::getDosage, reqVO.getDosage()) .eqIfPresent(QuotationSheetDetailDO::getDosage, reqVO.getDosage())
.eqIfPresent(QuotationSheetDetailDO::getUnti, reqVO.getUnti()) .eqIfPresent(QuotationSheetDetailDO::getUnti, reqVO.getUnti())
.eqIfPresent(QuotationSheetDetailDO::getQuality, reqVO.getQuality()) .eqIfPresent(QuotationSheetDetailDO::getQuality, reqVO.getQuality())

@ -1,10 +1,14 @@
package cn.iocoder.yudao.module.bs.service.quotationsheet; package cn.iocoder.yudao.module.bs.service.quotationsheet;
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.module.bs.dal.dataobject.expenseapplytrip.ExpenseApplyTripDO; import cn.iocoder.yudao.module.bs.dal.dataobject.expenseapplytrip.ExpenseApplyTripDO;
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.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 com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.yulichang.base.MPJBaseServiceImpl; import com.github.yulichang.base.MPJBaseServiceImpl;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
@ -13,6 +17,8 @@ import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
import cn.iocoder.yudao.module.bs.controller.admin.quotationsheet.vo.*; import 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.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
@ -38,10 +44,14 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl<QuotationSheet
@Resource @Resource
private QuotationSheetDetailService quotationSheetDetailService; private QuotationSheetDetailService quotationSheetDetailService;
@Resource
private SupplierCompanyService supplierCompanyService;
@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());
saveOrUpdate(quotationSheet); saveOrUpdate(quotationSheet);
if (createReqVO.getQuotationDetails().size() > 0){ if (createReqVO.getQuotationDetails().size() > 0){
//中间表插入数据 //中间表插入数据
@ -63,6 +73,7 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl<QuotationSheet
.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);
updateObj.setSupplierIdAll(updateReqVO.getSupplierIdList().toString());
saveOrUpdate(updateObj); saveOrUpdate(updateObj);
if (updateReqVO.getQuotationDetails().size() > 0){ if (updateReqVO.getQuotationDetails().size() > 0){
//中间表插入数据 //中间表插入数据
@ -89,22 +100,74 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl<QuotationSheet
@Override @Override
public QuotationSheetDO getQuotationSheet(Long id) { public QuotationSheetDO getQuotationSheet(Long id) {
return quotationSheetMapper.selectById(id); QuotationSheetDO quotationSheetDO = quotationSheetMapper.selectById(id);
List<QuotationSheetDetailDO> quotationSheetDetailDOList = quotationSheetDetailService.list(new QueryWrapper<QuotationSheetDetailDO>().eq("company_id", id));
if (null==quotationSheetDetailDOList){
quotationSheetDetailDOList = new ArrayList<>();
}
quotationSheetDO.setSupplierList(supplierCompanyService.listByIds(JSON.parseArray(quotationSheetDO.getSupplierIdAll(),Long.class)));
quotationSheetDO.setQuotationDetails(quotationSheetDetailDOList);
return quotationSheetDO;
} }
@Override @Override
public List<QuotationSheetDO> getQuotationSheetList(Collection<Long> ids) { public List<QuotationSheetDO> getQuotationSheetList(Collection<Long> ids) {
return quotationSheetMapper.selectBatchIds(ids); List<QuotationSheetDO> quotationSheetDOList = quotationSheetMapper.selectBatchIds(ids);
if (null!=quotationSheetDOList){
quotationSheetDOList.forEach(a->{
List<QuotationSheetDetailDO> quotationSheetDetailDOList = quotationSheetDetailService.list(new QueryWrapper<QuotationSheetDetailDO>().eq("company_id", a.getId()));
if (null==quotationSheetDetailDOList){
quotationSheetDetailDOList = new ArrayList<>();
}
a.setSupplierList(supplierCompanyService.listByIds(JSON.parseArray(a.getSupplierIdAll(),Long.class)));
a.setQuotationDetails(quotationSheetDetailDOList);
});
}
return quotationSheetDOList;
} }
@Override @Override
public PageResult<QuotationSheetDO> getQuotationSheetPage(QuotationSheetPageReqVO pageReqVO) { public PageResult<QuotationSheetDO> getQuotationSheetPage(QuotationSheetPageReqVO pageReqVO) {
return quotationSheetMapper.selectPage(pageReqVO); PageResult<QuotationSheetDO> sheetDOPageResult = quotationSheetMapper.selectPage(pageReqVO);
if (sheetDOPageResult.getList()!=null){
sheetDOPageResult.getList().forEach(a->{
List<QuotationSheetDetailDO> quotationSheetDetailDOList = quotationSheetDetailService.list(new QueryWrapper<QuotationSheetDetailDO>().eq("company_id", a.getId()));
if (null==quotationSheetDetailDOList){
quotationSheetDetailDOList = new ArrayList<>();
}
a.setSupplierList(supplierCompanyService.listByIds(JSON.parseArray(a.getSupplierIdAll(),Long.class)));
a.setQuotationDetails(quotationSheetDetailDOList);
});
}
return sheetDOPageResult;
} }
@Override @Override
public List<QuotationSheetDO> getQuotationSheetList(QuotationSheetExportReqVO exportReqVO) { public List<QuotationSheetDO> getQuotationSheetList(QuotationSheetExportReqVO exportReqVO) {
return quotationSheetMapper.selectList(exportReqVO); List<QuotationSheetDO> quotationSheetDOList = quotationSheetMapper.selectList(exportReqVO);
if (quotationSheetDOList!=null){
List<QuotationSheetDetailDO> quotationSheetDetailDOList = quotationSheetDetailService.list(new QueryWrapper<QuotationSheetDetailDO>().eq("tenantId", quotationSheetDOList.get(0).getTenantId()));
Map<Long, List<QuotationSheetDetailDO>> sheetDetailMap =new HashMap<>(3);
if (null!=quotationSheetDetailDOList){
sheetDetailMap = quotationSheetDetailDOList.stream().collect(Collectors.groupingBy(QuotationSheetDetailDO::getCompanyId));
}
Map<Long, List<QuotationSheetDetailDO>> finalSheetDetailMap = sheetDetailMap;
quotationSheetDOList.forEach(a->{
if (finalSheetDetailMap.size()>0){
List<QuotationSheetDetailDO> quotationSheetDetailDOS = finalSheetDetailMap.get(a.getId());
if (null==quotationSheetDetailDOS){
quotationSheetDetailDOS=new ArrayList<>();
}
a.setQuotationDetails(quotationSheetDetailDOS);
}else {
a.setQuotationDetails(new ArrayList<>());
}
a.setSupplierList(supplierCompanyService.listByIds(JSON.parseArray(a.getSupplierIdAll(),Long.class)));
a.setQuotationDetails(quotationSheetDetailDOList);
});
}
return quotationSheetDOList;
} }
} }

Loading…
Cancel
Save