|
|
|
@ -1,5 +1,10 @@
|
|
|
|
|
package cn.iocoder.yudao.module.bs.service.quotationsheet;
|
|
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
|
|
|
|
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.QuotationSheetDetailServiceImpl;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
|
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
@ -29,16 +34,21 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl<QuotationSheet
|
|
|
|
|
@Resource
|
|
|
|
|
private QuotationSheetMapper quotationSheetMapper;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private QuotationSheetDetailService quotationSheetDetailService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Long createQuotationSheet(QuotationSheetCreateReqVO createReqVO) {
|
|
|
|
|
// 插入
|
|
|
|
|
QuotationSheetDO quotationSheet = QuotationSheetConvert.INSTANCE.convert(createReqVO);
|
|
|
|
|
if (null != createReqVO.getSuppliesIdList()){
|
|
|
|
|
quotationSheet.setMaterialIdList(createReqVO.getSuppliesIdList().toString());
|
|
|
|
|
}
|
|
|
|
|
// SecurityFrameworkUtils.getLoginUser().
|
|
|
|
|
quotationSheetMapper.insert(quotationSheet);
|
|
|
|
|
// 返回
|
|
|
|
|
//
|
|
|
|
|
if (createReqVO.getQuotationDetails().size() > 0){
|
|
|
|
|
//中间表插入数据
|
|
|
|
|
createReqVO.getQuotationDetails().forEach(quotationSheetDetail -> {
|
|
|
|
|
quotationSheetDetail.setCompanyId(quotationSheet.getId());
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
return quotationSheet.getId();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -46,9 +56,22 @@ public class QuotationSheetServiceImpl extends MPJBaseServiceImpl<QuotationSheet
|
|
|
|
|
public void updateQuotationSheet(QuotationSheetUpdateReqVO updateReqVO) {
|
|
|
|
|
// 校验存在
|
|
|
|
|
validateQuotationSheetExists(updateReqVO.getId());
|
|
|
|
|
//删除原先
|
|
|
|
|
List<QuotationSheetDetailDO > quotationSheetDetailDOList =
|
|
|
|
|
quotationSheetDetailService.list(Wrappers.<QuotationSheetDetailDO> lambdaQuery()
|
|
|
|
|
.eq(QuotationSheetDetailDO::getCompanyId,updateReqVO.getId()).eq(BaseDO::getDeleted,0));
|
|
|
|
|
if (quotationSheetDetailDOList.size() > 0){
|
|
|
|
|
quotationSheetDetailService.saveBatch(quotationSheetDetailDOList);
|
|
|
|
|
}
|
|
|
|
|
// 更新
|
|
|
|
|
QuotationSheetDO updateObj = QuotationSheetConvert.INSTANCE.convert(updateReqVO);
|
|
|
|
|
quotationSheetMapper.updateById(updateObj);
|
|
|
|
|
if (updateReqVO.getQuotationDetails().size() > 0){
|
|
|
|
|
//中间表插入数据
|
|
|
|
|
updateReqVO.getQuotationDetails().forEach(quotationSheetDetail -> {
|
|
|
|
|
quotationSheetDetail.setCompanyId(updateObj.getId());
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|