|
@@ -3,30 +3,37 @@ package com.fjhx.sale.service.sale.impl;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.alibaba.fastjson2.JSONObject;
|
|
|
+import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
|
|
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fjhx.account.controller.utils.DateUtils;
|
|
|
-import com.fjhx.account.entity.write.vo.WriteOffRecordsVo;
|
|
|
import com.fjhx.area.utils.CustomizeAreaUtil;
|
|
|
import com.fjhx.common.constant.SourceConstant;
|
|
|
-import com.fjhx.common.entity.contract.po.ContractTemplate;
|
|
|
-import com.fjhx.common.entity.corporation.po.Corporation;
|
|
|
+import com.fjhx.common.enums.CodingRuleEnum;
|
|
|
import com.fjhx.common.enums.FlowStatusEnum1;
|
|
|
-import com.fjhx.common.service.contract.ContractTemplateService;
|
|
|
+import com.fjhx.common.enums.PushBusinessTypeEnum;
|
|
|
+import com.fjhx.common.service.coding.CodingRuleService;
|
|
|
import com.fjhx.common.service.corporation.CorporationService;
|
|
|
+import com.fjhx.common.utils.Utils;
|
|
|
import com.fjhx.customer.entity.customer.dto.CustomerDto;
|
|
|
import com.fjhx.customer.entity.customer.dto.CustomerSelectDto;
|
|
|
import com.fjhx.customer.entity.customer.po.Customer;
|
|
|
import com.fjhx.customer.entity.customer.vo.CustomerVo;
|
|
|
import com.fjhx.customer.service.customer.CustomerService;
|
|
|
-import com.fjhx.flow.service.flow.FlowExampleService;
|
|
|
+import com.fjhx.item.service.product.ProductInfoService;
|
|
|
import com.fjhx.sale.entity.contract.vo.ContractVo;
|
|
|
+import com.fjhx.sale.entity.quotation.dto.QuotationProductBomDto;
|
|
|
+import com.fjhx.sale.entity.quotation.dto.QuotationProductDto;
|
|
|
import com.fjhx.sale.entity.quotation.po.QuotationPay;
|
|
|
import com.fjhx.sale.entity.quotation.po.QuotationProduct;
|
|
|
+import com.fjhx.sale.entity.quotation.po.QuotationProductBom;
|
|
|
+import com.fjhx.sale.entity.quotation.vo.QuotationProductBomVo;
|
|
|
+import com.fjhx.sale.entity.quotation.vo.QuotationProductVo;
|
|
|
import com.fjhx.sale.entity.sale.dto.SaleQuotationDto;
|
|
|
import com.fjhx.sale.entity.sale.dto.SaleQuotationSelectDto;
|
|
|
import com.fjhx.sale.entity.sale.po.SaleQuotation;
|
|
@@ -34,16 +41,21 @@ import com.fjhx.sale.entity.sale.vo.SaleQuotationVo;
|
|
|
import com.fjhx.sale.mapper.sale.SaleQuotationMapper;
|
|
|
import com.fjhx.sale.service.contract.ContractService;
|
|
|
import com.fjhx.sale.service.quotation.QuotationPayService;
|
|
|
+import com.fjhx.sale.service.quotation.QuotationProductBomService;
|
|
|
import com.fjhx.sale.service.quotation.QuotationProductService;
|
|
|
import com.fjhx.sale.service.sale.SaleQuotationService;
|
|
|
import com.fjhx.sale.util.code.CodeEnum;
|
|
|
+import com.fjhx.socket.core.PushTypeEnum;
|
|
|
+import com.fjhx.socket.core.WebSocketPush;
|
|
|
import com.fjhx.tenant.entity.dict.dto.DictTenantDataSelectDto;
|
|
|
import com.fjhx.tenant.entity.dict.vo.DictTenantDataVo;
|
|
|
import com.fjhx.tenant.service.dict.DictTenantDataService;
|
|
|
import com.ruoyi.common.core.domain.BasePo;
|
|
|
+import com.ruoyi.common.core.domain.entity.SysDept;
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
+import com.ruoyi.system.service.ISysDeptService;
|
|
|
import com.ruoyi.system.utils.UserUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -79,12 +91,16 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
|
|
|
private DictTenantDataService dictTenantDataService;
|
|
|
|
|
|
@Autowired
|
|
|
- private FlowExampleService flowExampleService;
|
|
|
+ private CodingRuleService codingRuleService;
|
|
|
|
|
|
@Autowired
|
|
|
private CorporationService corporationService;
|
|
|
@Autowired
|
|
|
- private ContractTemplateService contractTemplateService;
|
|
|
+ private QuotationProductBomService quotationProductBomService;
|
|
|
+ @Autowired
|
|
|
+ private ISysDeptService sysDeptService;
|
|
|
+ @Autowired
|
|
|
+ private ProductInfoService productInfoService;
|
|
|
|
|
|
/**
|
|
|
* 报价表分页
|
|
@@ -92,88 +108,241 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
|
|
|
@Override
|
|
|
public Page<SaleQuotationVo> getPage(SaleQuotationSelectDto dto) {
|
|
|
|
|
|
- List<Long> authIdList = customerService.getAuthIdList();
|
|
|
+// List<Long> authIdList = customerService.getAuthIdList();
|
|
|
+//
|
|
|
+// if (authIdList.size() == 0) {
|
|
|
+// return new Page<>();
|
|
|
+// }
|
|
|
|
|
|
- if (authIdList.size() == 0) {
|
|
|
- return new Page<>();
|
|
|
- }
|
|
|
+ IWrapper<SaleQuotation> wrapper = IWrapper.getWrapper();
|
|
|
+// wrapper.eq(ObjectUtil.isNotEmpty(dto.getStatus()), SaleQuotation::getStatus, dto.getStatus());
|
|
|
+// wrapper.orderByDesc(SaleQuotation::getCreateTime);
|
|
|
+// wrapper.in(SaleQuotation::getBuyCorporationId, authIdList);
|
|
|
+
|
|
|
+
|
|
|
+ //报价状态
|
|
|
+ wrapper.eq(SaleQuotation::getQuotationStatus, dto.getQuotationStatus());
|
|
|
+ //报价公司
|
|
|
+ wrapper.eq(SaleQuotation::getCompanyId, dto.getCompanyId());
|
|
|
+ //报价单类型
|
|
|
+ wrapper.eq(SaleQuotation::getType, dto.getType());
|
|
|
|
|
|
- LambdaQueryWrapper<SaleQuotation> wrapper = Wrappers.lambdaQuery();
|
|
|
- wrapper.eq(ObjectUtil.isNotEmpty(dto.getSellCorporationId()),
|
|
|
- SaleQuotation::getSellCorporationId, dto.getSellCorporationId());
|
|
|
- wrapper.eq(ObjectUtil.isNotEmpty(dto.getStatus()), SaleQuotation::getStatus, dto.getStatus());
|
|
|
- wrapper.orderByDesc(SaleQuotation::getCreateTime);
|
|
|
- wrapper.in(SaleQuotation::getBuyCorporationId, authIdList);
|
|
|
+ //报价时间-时间范围过滤
|
|
|
+ wrapper.ge("sq", SaleQuotation::getQuotationTime, dto.getQuotationTimeSta());
|
|
|
+ wrapper.le("sq", SaleQuotation::getQuotationTime, dto.getQuotationTimeEnd());
|
|
|
+ //创建时间-时间范围过滤
|
|
|
+ wrapper.ge("sq", SaleQuotation::getCreateTime, dto.getBeginTime());
|
|
|
+ wrapper.le("sq", SaleQuotation::getCreateTime, dto.getEndTime());
|
|
|
+
|
|
|
+ wrapper.ne("sq", SaleQuotation::getStatus, FlowStatusEnum1.UPDATE);
|
|
|
|
|
|
Page<SaleQuotationVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
- List<SaleQuotationVo> saleQuotationVoList = page.getRecords();
|
|
|
+ List<SaleQuotationVo> records = page.getRecords();
|
|
|
+
|
|
|
+ if (ObjectUtil.isEmpty(records)) {
|
|
|
+ return page;
|
|
|
+ }
|
|
|
|
|
|
// 赋值用户名称
|
|
|
- UserUtil.assignmentNickName(saleQuotationVoList, BasePo::getCreateUser, SaleQuotationVo::setUserName);
|
|
|
+ UserUtil.assignmentNickName(records, BasePo::getCreateUser, SaleQuotationVo::setUserName);
|
|
|
// 赋值买方公司名称(客户)
|
|
|
- customerService.attributeAssign(saleQuotationVoList, SaleQuotationVo::getBuyCorporationId, (item, customer) -> {
|
|
|
+ customerService.attributeAssign(records, SaleQuotationVo::getBuyCorporationId, (item, customer) -> {
|
|
|
item.setBuyCorporationName(customer.getName());
|
|
|
- item.setTag(customer.getTag());
|
|
|
});
|
|
|
- // 赋值卖方公司名称
|
|
|
- corporationService.attributeAssign(saleQuotationVoList, SaleQuotationVo::getSellCorporationId, (item, corporation) -> {
|
|
|
- item.setSellCorporationName(corporation.getName());
|
|
|
+
|
|
|
+
|
|
|
+ List<Long> companyIds = records.stream().map(SaleQuotation::getCompanyId).collect(Collectors.toList());
|
|
|
+ List<SysDept> companyList = sysDeptService.list(Wrappers.<SysDept>query().in("dept_id", companyIds));
|
|
|
+ Map<Long, String> companyMap = companyList.stream().collect(Collectors.toMap(SysDept::getDeptId, SysDept::getDeptName));
|
|
|
+
|
|
|
+ List<Long> ids = records.stream().map(SaleQuotationVo::getId).collect(Collectors.toList());
|
|
|
+ List<QuotationProduct> pList = quotationProductService.list(q -> q.in(QuotationProduct::getSaleQuotationId, ids));
|
|
|
+ List<QuotationProductVo> quotationPayVos = BeanUtil.copyToList(pList, QuotationProductVo.class);
|
|
|
+ //赋值产品信息
|
|
|
+ productInfoService.attributeAssign(quotationPayVos, QuotationProductVo::getProductId, (item, productInfo) -> {
|
|
|
+ item.setProductCode(productInfo.getCustomCode());
|
|
|
+ item.setProductName(productInfo.getName());
|
|
|
});
|
|
|
- // 赋值流程id
|
|
|
- flowExampleService.setFlowId(saleQuotationVoList, SaleQuotationVo::setFlowId);
|
|
|
+ Map<Long, List<QuotationProductVo>> pMap = quotationPayVos.stream().collect(Collectors.groupingBy(QuotationProduct::getSaleQuotationId));
|
|
|
+
|
|
|
+ for (SaleQuotationVo saleQuotationVo : records) {
|
|
|
+ //赋值报价公司名称
|
|
|
+ saleQuotationVo.setCompanyName(companyMap.get(saleQuotationVo.getCompanyId()));
|
|
|
+
|
|
|
+ //赋值产品列表
|
|
|
+ saleQuotationVo.setQuotationProductList(pMap.get(saleQuotationVo.getId()));
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
return page;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @DSTransactional
|
|
|
+ public void add(SaleQuotationDto saleQuotationDto) {
|
|
|
+ //添加报价编码
|
|
|
+ if (ObjectUtil.isEmpty(saleQuotationDto.getCode())) {
|
|
|
+ saleQuotationDto.setCode(codingRuleService.createCode(CodingRuleEnum.SALE_QUOTATION.getKey(), saleQuotationDto.getBuyCorporationId()));
|
|
|
+ }
|
|
|
+
|
|
|
+ long id = IdWorker.getId();
|
|
|
+ saleQuotationDto.setId(id);
|
|
|
+ saleQuotationDto.setGroupId(id);//赋值数据分组id
|
|
|
+ if (ObjectUtil.isEmpty(saleQuotationDto.getStatus())) {
|
|
|
+ saleQuotationDto.setStatus(30);//默认审批通过
|
|
|
+ }
|
|
|
+ saleQuotationDto.setQuotationStatus(0);//报价状态未报价
|
|
|
+ saveOrEdit(saleQuotationDto);
|
|
|
+
|
|
|
+ //消息推送 给归属公司的 总经理
|
|
|
+ JSONObject meassage = new JSONObject();
|
|
|
+ meassage.put("msg", "您有新的报价单待报价,请尽快处理!");
|
|
|
+ meassage.put("business_id", saleQuotationDto.getId());
|
|
|
+ List<Long> generalManagerIds = UserUtil.getUserIdsByRoleKey("general_manager", saleQuotationDto.getCompanyId());
|
|
|
+ WebSocketPush.byUsers(PushTypeEnum.MESSAGE, generalManagerIds, meassage.toString(), PushBusinessTypeEnum.NEW_QUOTATION.getType());
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @DSTransactional
|
|
|
+ public void edit(SaleQuotationDto saleQuotationDto) {
|
|
|
+ if (Objects.equals(saleQuotationDto.getQuotationStatus(), 2)) {
|
|
|
+ saleQuotationDto.setQuotationTime(new Date());
|
|
|
+ }
|
|
|
+ saveOrEdit(saleQuotationDto);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
- * 报价表明细
|
|
|
+ * 变更
|
|
|
*/
|
|
|
@Override
|
|
|
- public SaleQuotationVo detail(Long id) {
|
|
|
- //查询报价表详情
|
|
|
- SaleQuotation SaleQuotation = this.getById(id);
|
|
|
- SaleQuotationVo result = BeanUtil.toBean(SaleQuotation, SaleQuotationVo.class);
|
|
|
- if (ObjectUtil.isNotEmpty(result)) {
|
|
|
- //赋值合同模板名称
|
|
|
- ContractTemplate contractTemplate = contractTemplateService.getById(result.getContractTemplateId());
|
|
|
- if (ObjectUtil.isNotEmpty(contractTemplate)) {
|
|
|
- result.setContractTemplateName(contractTemplate.getTemplateName());
|
|
|
- }
|
|
|
- //赋值买方公司名称(客户)
|
|
|
- Customer customer = customerService.getById(result.getBuyCorporationId());
|
|
|
- if (ObjectUtil.isNotEmpty(customer)) {
|
|
|
- result.setBuyCorporationName(customer.getName());
|
|
|
+ public void changeSaleQuotation(SaleQuotationDto saleQuotationDto) {
|
|
|
+ SaleQuotation saleQuotation = this.getById(saleQuotationDto.getId());
|
|
|
+ if (ObjectUtil.isEmpty(saleQuotation)) {
|
|
|
+ throw new ServiceException("查询不到原报价单信息");
|
|
|
+ }
|
|
|
+ saleQuotation.setStatus(FlowStatusEnum1.UPDATE.getKey());
|
|
|
+ this.updateById(saleQuotation);
|
|
|
+
|
|
|
+ saleQuotationDto.setOldQuotationId(saleQuotation.getId());
|
|
|
+
|
|
|
+ //变更清除id信息
|
|
|
+ saleQuotationDto.setId(null);
|
|
|
+ saleQuotationDto.setStatus(30);
|
|
|
+ saleQuotationDto.setQuotationStatus(0);
|
|
|
+ saleQuotationDto.setCode(Utils.getNewCode(saleQuotation.getCode()));//赋值新合同号
|
|
|
+ List<QuotationProductDto> quotationProductList = saleQuotationDto.getQuotationProductList();
|
|
|
+ for (QuotationProductDto quotationProductDto : quotationProductList) {
|
|
|
+ quotationProductDto.setId(null);
|
|
|
+ List<QuotationProductBomDto> quotationProductBomList = quotationProductDto.getQuotationProductBomList();
|
|
|
+ for (QuotationProductBomDto quotationProductBomDto : quotationProductBomList) {
|
|
|
+ quotationProductBomDto.setId(null);
|
|
|
}
|
|
|
- //赋值卖方公司名称(多公司)
|
|
|
- Corporation corporation = corporationService.getById(result.getSellCorporationId());
|
|
|
- if (ObjectUtil.isNotEmpty(corporation)) {
|
|
|
- result.setSellCorporationName(corporation.getName());
|
|
|
+ quotationProductDto.setQuotationProductBomList(quotationProductBomList);
|
|
|
+ }
|
|
|
+ saleQuotationDto.setQuotationProductList(quotationProductList);
|
|
|
+ //调用创建方法
|
|
|
+ saveOrEdit(saleQuotationDto);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 作废
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void cancellation(Long id) {
|
|
|
+ SaleQuotation saleQuotation = this.getById(id);
|
|
|
+ saleQuotation.setStatus(FlowStatusEnum1.CANCELLATION.getKey());
|
|
|
+ this.updateById(saleQuotation);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加修改公共方法
|
|
|
+ */
|
|
|
+ private void saveOrEdit(SaleQuotationDto saleQuotationDto) {
|
|
|
+ this.saveOrUpdate(saleQuotationDto);
|
|
|
+
|
|
|
+ List<QuotationProductDto> quotationProductList = saleQuotationDto.getQuotationProductList();
|
|
|
+ for (QuotationProductDto quotationProductDto : quotationProductList) {
|
|
|
+ //手动创建id
|
|
|
+ if (ObjectUtil.isEmpty(quotationProductDto.getId())) {
|
|
|
+ quotationProductDto.setId(IdWorker.getId());
|
|
|
}
|
|
|
+ quotationProductDto.setSaleQuotationId(saleQuotationDto.getId());
|
|
|
|
|
|
- //赋值买方公司地址
|
|
|
- setArea(result);
|
|
|
- //查询报价-商品表的详情
|
|
|
- List<QuotationProduct> quotationProductList = quotationProductService.list(Wrappers.<QuotationProduct>lambdaQuery()
|
|
|
- .eq(QuotationProduct::getSaleQuotationId, result.getId()));
|
|
|
- result.setQuotationProductList(quotationProductList);
|
|
|
-
|
|
|
- //查询报价-收费项目表的详情
|
|
|
- List<QuotationPay> quotationPayList = quotationPayService.list(Wrappers.<QuotationPay>lambdaQuery()
|
|
|
- .eq(QuotationPay::getSaleQuotationId, result.getId()));
|
|
|
- result.setQuotationPayList(quotationPayList);
|
|
|
+ //保存配件
|
|
|
+ List<QuotationProductBom> quotationProductBomList = BeanUtil.copyToList(quotationProductDto.getQuotationProductBomList(), QuotationProductBom.class);
|
|
|
+ for (QuotationProductBom quotationProductBom : quotationProductBomList) {
|
|
|
+ quotationProductBom.setProductId(quotationProductDto.getProductId());
|
|
|
+ quotationProductBom.setQuotationProductId(quotationProductDto.getId());
|
|
|
+ }
|
|
|
+ quotationProductBomService.editLinked(quotationProductBomList, QuotationProductBom::getQuotationProductId, quotationProductDto.getId());
|
|
|
}
|
|
|
|
|
|
- return result;
|
|
|
+ List<QuotationProduct> quotationProducts = BeanUtil.copyToList(quotationProductList, QuotationProduct.class);
|
|
|
+ quotationProductService.editLinked(quotationProducts, QuotationProduct::getSaleQuotationId, saleQuotationDto.getId());
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 报价表明细
|
|
|
+ */
|
|
|
@Override
|
|
|
- public void add(SaleQuotationDto saleQuotationDto) {
|
|
|
- this.save(saleQuotationDto);
|
|
|
- }
|
|
|
+ public SaleQuotationVo detail(Long id) {
|
|
|
+ //查询报价表详情
|
|
|
+ SaleQuotation saleQuotation = this.getById(id);
|
|
|
+ SaleQuotationVo result = BeanUtil.toBean(saleQuotation, SaleQuotationVo.class);
|
|
|
+ if (ObjectUtil.isEmpty(result)) {
|
|
|
+ throw new ServiceException("查询不到明细信息请检查");
|
|
|
+ }
|
|
|
+ //赋值买方公司名称(客户)
|
|
|
+ Customer customer = customerService.getById(result.getBuyCorporationId());
|
|
|
+ if (ObjectUtil.isNotEmpty(customer)) {
|
|
|
+ result.setBuyCorporationName(customer.getName());
|
|
|
+ }
|
|
|
|
|
|
- @Override
|
|
|
- public void edit(SaleQuotationDto saleQuotationDto) {
|
|
|
- this.updateById(saleQuotationDto);
|
|
|
+ //赋值买方公司地址
|
|
|
+ setArea(result);
|
|
|
+ //查询报价-商品表的详情
|
|
|
+ List<QuotationProduct> quotationProductList = quotationProductService.list(Wrappers.<QuotationProduct>lambdaQuery()
|
|
|
+ .eq(QuotationProduct::getSaleQuotationId, result.getId()));
|
|
|
+
|
|
|
+ List<QuotationProductVo> quotationProductVos = BeanUtil.copyToList(quotationProductList, QuotationProductVo.class);
|
|
|
+ //赋值产品信息
|
|
|
+ productInfoService.attributeAssign(quotationProductVos, QuotationProductVo::getProductId, (item, productInfo) -> {
|
|
|
+ item.setProductCode(productInfo.getCustomCode());
|
|
|
+ item.setProductName(productInfo.getName());
|
|
|
+ item.setProductLength(productInfo.getLength());
|
|
|
+ item.setProductWidth(productInfo.getWidth());
|
|
|
+ item.setProductHeight(productInfo.getHeight());
|
|
|
+ });
|
|
|
+
|
|
|
+ //获取配件列表
|
|
|
+ List<Long> ids = quotationProductVos.stream().map(QuotationProduct::getId).collect(Collectors.toList());
|
|
|
+ List<QuotationProductBom> list = quotationProductBomService.list(q -> q.in(QuotationProductBom::getQuotationProductId, ids));
|
|
|
+ List<QuotationProductBomVo> quotationProductBomVos = BeanUtil.copyToList(list, QuotationProductBomVo.class);
|
|
|
+ //赋值产品信息
|
|
|
+ productInfoService.attributeAssign(quotationProductBomVos, QuotationProductBom::getProductId, (item, productInfo) -> {
|
|
|
+ item.setProductCode(productInfo.getCustomCode());
|
|
|
+ item.setProductName(productInfo.getName());
|
|
|
+ item.setProductLength(productInfo.getLength());
|
|
|
+ item.setProductWidth(productInfo.getWidth());
|
|
|
+ item.setProductHeight(productInfo.getHeight());
|
|
|
+ });
|
|
|
+
|
|
|
+ Map<Long, List<QuotationProductBomVo>> qpbMap = quotationProductBomVos.stream().collect(Collectors.groupingBy(QuotationProductBom::getQuotationProductId));
|
|
|
+
|
|
|
+ for (QuotationProductVo quotationProductVo : quotationProductVos) {
|
|
|
+ quotationProductVo.setQuotationProductBomList(qpbMap.get(quotationProductVo.getId()));
|
|
|
+ }
|
|
|
+ result.setQuotationProductList(quotationProductVos);
|
|
|
+
|
|
|
+ //赋值报价金额趋势
|
|
|
+ List<SaleQuotation> quotationTrendList = this.list(q -> q
|
|
|
+ .eq(SaleQuotation::getGroupId, result.getGroupId())
|
|
|
+ .ne(SaleQuotation::getStatus, FlowStatusEnum1.CANCELLATION.getKey())
|
|
|
+ .orderByAsc(SaleQuotation::getCreateTime)
|
|
|
+ );
|
|
|
+ result.setQuotationTrendList(quotationTrendList);
|
|
|
+
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -266,7 +435,7 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
|
|
|
//查询这个客户的销售额(合同总金额)及成交合同数量
|
|
|
ContractVo contractVo = contractService.getSalesTotal(dto.getId());
|
|
|
map.put("contractVo", contractVo);
|
|
|
- Page<ContractVo> page = contractService.getSalesTotalList(dto.getPage(),dto.getId());
|
|
|
+ Page<ContractVo> page = contractService.getSalesTotalList(dto.getPage(), dto.getId());
|
|
|
List<ContractVo> contractVoList = page.getRecords();
|
|
|
// 赋值用户名称
|
|
|
UserUtil.assignmentNickName(contractVoList, BasePo::getCreateUser, ContractVo::setUserName);
|
|
@@ -278,7 +447,7 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
|
|
|
corporationService.attributeAssign(contractVoList, ContractVo::getSellCorporationId, (item, corporation) -> {
|
|
|
item.setSellCorporationName(corporation.getName());
|
|
|
});
|
|
|
- map.put("contractList",page);
|
|
|
+ map.put("contractList", page);
|
|
|
//查询这个客户的报价次数
|
|
|
Integer count = this.getCount(dto.getId());
|
|
|
// DynamicDataSourceContextHolder.poll();
|
|
@@ -349,9 +518,9 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
|
|
|
@Override
|
|
|
public Page<SaleQuotationVo> saleDetail(CustomerSelectDto dto) {
|
|
|
IWrapper<SaleQuotation> wrapper = IWrapper.getWrapper();
|
|
|
- wrapper.eq("t1",SaleQuotation::getBuyCorporationId,dto.getId());
|
|
|
+ wrapper.eq("t1", SaleQuotation::getBuyCorporationId, dto.getId());
|
|
|
wrapper.eq("t1.status", FlowStatusEnum1.PASS.getKey());
|
|
|
- wrapper.orderByDesc("t1",SaleQuotation::getCreateTime);
|
|
|
+ wrapper.orderByDesc("t1", SaleQuotation::getCreateTime);
|
|
|
Page<SaleQuotationVo> saleQuotationVoPage = baseMapper.saleDetail(dto.getPage(), wrapper);
|
|
|
List<SaleQuotationVo> records = saleQuotationVoPage.getRecords();
|
|
|
// 赋值用户名称
|
|
@@ -466,25 +635,25 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
|
|
|
query.eq(ObjectUtil.isNotEmpty(dto.getProvinceId()), "c.province_id", dto.getProvinceId());
|
|
|
query.eq(ObjectUtil.isNotEmpty(dto.getCityId()), "c.city_id", dto.getCityId());
|
|
|
query.eq("sq.status", 30);
|
|
|
- //类型询盘统计(报价)
|
|
|
- List<SaleQuotationVo> saleStatisticsList = baseMapper.saleStatistics(query);
|
|
|
- Map<String, List<SaleQuotationVo>> saleStatisticsMap = saleStatisticsList.stream().collect(Collectors.groupingBy(SaleQuotationVo::getStatus));
|
|
|
-
|
|
|
- //查询成交单统计(合同)
|
|
|
- List<SaleQuotationVo> contractStatisticsList = contractService.contractStatistics(query);
|
|
|
- Map<String, List<SaleQuotationVo>> contractStatisticsMap = contractStatisticsList.stream()
|
|
|
- .collect(Collectors.groupingBy(SaleQuotationVo::getStatus));
|
|
|
-
|
|
|
- //获取询盘总计
|
|
|
- Integer saleAmount = saleStatisticsList.stream().map(saleQuotationVo -> saleQuotationVo.getCount())
|
|
|
- .reduce(Integer::sum).orElse(0);
|
|
|
-
|
|
|
- //获取成交单总计
|
|
|
- Integer contractAmount = contractStatisticsList.stream().map(saleQuotationVo -> saleQuotationVo.getCount())
|
|
|
- .reduce(Integer::sum).orElse(0);
|
|
|
-
|
|
|
- map.put("saleAmount", saleAmount);
|
|
|
- map.put("contractAmount", contractAmount);
|
|
|
+// //类型询盘统计(报价)
|
|
|
+// List<SaleQuotationVo> saleStatisticsList = baseMapper.saleStatistics(query);
|
|
|
+// Map<String, List<SaleQuotationVo>> saleStatisticsMap = saleStatisticsList.stream().collect(Collectors.groupingBy(SaleQuotationVo::getStatus));
|
|
|
+//
|
|
|
+// //查询成交单统计(合同)
|
|
|
+// List<SaleQuotationVo> contractStatisticsList = contractService.contractStatistics(query);
|
|
|
+// Map<String, List<SaleQuotationVo>> contractStatisticsMap = contractStatisticsList.stream()
|
|
|
+// .collect(Collectors.groupingBy(SaleQuotationVo::getStatus));
|
|
|
+
|
|
|
+// //获取询盘总计
|
|
|
+// Integer saleAmount = saleStatisticsList.stream().map(saleQuotationVo -> saleQuotationVo.getCount())
|
|
|
+// .reduce(Integer::sum).orElse(0);
|
|
|
+//
|
|
|
+// //获取成交单总计
|
|
|
+// Integer contractAmount = contractStatisticsList.stream().map(saleQuotationVo -> saleQuotationVo.getCount())
|
|
|
+// .reduce(Integer::sum).orElse(0);
|
|
|
+
|
|
|
+// map.put("saleAmount", saleAmount);
|
|
|
+// map.put("contractAmount", contractAmount);
|
|
|
|
|
|
//获取类型的字典数据
|
|
|
DynamicDataSourceContextHolder.push(SourceConstant.BASE);
|
|
@@ -503,17 +672,17 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
|
|
|
saleMap.put("contractAmount", 0);
|
|
|
saleMap.put("saleAmount", 0);
|
|
|
|
|
|
- //赋值询盘数据
|
|
|
- List<SaleQuotationVo> saleQuotationVoList = saleStatisticsMap.get(dictTenantDataVo.getDictKey());
|
|
|
- if (ObjectUtil.isNotEmpty(saleQuotationVoList)) {
|
|
|
- saleMap.put("saleAmount", saleQuotationVoList.get(0).getCount());
|
|
|
- }
|
|
|
-
|
|
|
- //赋值成交单数据
|
|
|
- List<SaleQuotationVo> saleQuotationList = contractStatisticsMap.get(dictTenantDataVo.getDictKey());
|
|
|
- if (ObjectUtil.isNotEmpty(saleQuotationList)) {
|
|
|
- saleMap.put("contractAmount", saleQuotationList.get(0).getCount());
|
|
|
- }
|
|
|
+// //赋值询盘数据
|
|
|
+// List<SaleQuotationVo> saleQuotationVoList = saleStatisticsMap.get(dictTenantDataVo.getDictKey());
|
|
|
+// if (ObjectUtil.isNotEmpty(saleQuotationVoList)) {
|
|
|
+// saleMap.put("saleAmount", saleQuotationVoList.get(0).getCount());
|
|
|
+// }
|
|
|
+//
|
|
|
+// //赋值成交单数据
|
|
|
+// List<SaleQuotationVo> saleQuotationList = contractStatisticsMap.get(dictTenantDataVo.getDictKey());
|
|
|
+// if (ObjectUtil.isNotEmpty(saleQuotationList)) {
|
|
|
+// saleMap.put("contractAmount", saleQuotationList.get(0).getCount());
|
|
|
+// }
|
|
|
saleList.add(saleMap);
|
|
|
}
|
|
|
map.put("saleList", saleList);
|