Prechádzať zdrojové kódy

报价单买方名称问题处理

yzc 1 rok pred
rodič
commit
836bdc880e

+ 25 - 26
hx-sale/src/main/java/com/fjhx/sale/service/sale/impl/SaleQuotationServiceImpl.java

@@ -22,7 +22,6 @@ 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.sale.entity.contract.vo.ContractProductVo;
 import com.fjhx.sale.entity.contract.vo.ContractVo;
 import com.fjhx.sale.entity.quotation.po.QuotationPay;
 import com.fjhx.sale.entity.quotation.po.QuotationProduct;
@@ -110,8 +109,8 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
         // 赋值用户名称
         UserUtil.assignmentNickName(saleQuotationVoList, BasePo::getCreateUser, SaleQuotationVo::setUserName);
         // 赋值买方公司名称(客户)
-        customerService.attributeAssign(saleQuotationVoList, SaleQuotationVo::getSellCorporationId, (item, corporation) -> {
-            item.setSellCorporationName(corporation.getName());
+        customerService.attributeAssign(saleQuotationVoList, SaleQuotationVo::getBuyCorporationId, (item, customer) -> {
+            item.setSellCorporationName(customer.getName());
         });
         // 赋值卖方公司名称
         corporationService.attributeAssign(saleQuotationVoList, SaleQuotationVo::getSellCorporationId, (item, corporation) -> {
@@ -134,17 +133,17 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
         if (ObjectUtil.isNotEmpty(result)) {
             //赋值合同模板名称
             ContractTemplate contractTemplate = contractTemplateService.getById(result.getContractTemplateId());
-            if(ObjectUtil.isNotEmpty(contractTemplate)){
+            if (ObjectUtil.isNotEmpty(contractTemplate)) {
                 result.setContractTemplateName(contractTemplate.getTemplateName());
             }
             //赋值买方公司名称(客户)
             Customer customer = customerService.getById(result.getBuyCorporationId());
-            if(ObjectUtil.isNotEmpty(customer)){
+            if (ObjectUtil.isNotEmpty(customer)) {
                 result.setBuyCorporationName(customer.getName());
             }
             //赋值卖方公司名称(多公司)
             Corporation corporation = corporationService.getById(result.getSellCorporationId());
-            if(ObjectUtil.isNotEmpty(corporation)){
+            if (ObjectUtil.isNotEmpty(corporation)) {
                 result.setSellCorporationName(corporation.getName());
             }
 
@@ -353,7 +352,7 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
         Map<String, Object> map = new HashMap<>();
 
         //存放来源存量与增量的数据列表
-        List<Map<String,Object>> stockList = new ArrayList<>();
+        List<Map<String, Object>> stockList = new ArrayList<>();
 
 
         //来源存量(在指定时间外的数量)
@@ -397,28 +396,28 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
 
         Map<String, List<CustomerVo>> sourceStockMap = sourceStockList.stream().collect(Collectors.groupingBy(Customer::getSource));
 
-        if (dictTenantDataVos.size()==0){
+        if (dictTenantDataVos.size() == 0) {
             throw new ServiceException("数据有误:该租户没有配客户来源字典");
         }
 
         //赋值 增量 存量数据
         for (DictTenantDataVo dictTenantDataVo : dictTenantDataVos) {
             //存放来源存量与增量的数据
-            Map<String,Object>  stockMap = new HashMap<>();
+            Map<String, Object> stockMap = new HashMap<>();
             //赋值初使值
-            stockMap.put("source",dictTenantDataVo.getDictValue());
-            stockMap.put("stockAmount",0);
-            stockMap.put("incrementAmount",0);
+            stockMap.put("source", dictTenantDataVo.getDictValue());
+            stockMap.put("stockAmount", 0);
+            stockMap.put("incrementAmount", 0);
 
             //赋值增量数据
             List<CustomerVo> customers = sourceIncrementMap.get(dictTenantDataVo.getDictKey());
-            if (ObjectUtil.isNotEmpty(customers)){
-                stockMap.put("incrementAmount",customers.get(0).getCount());
+            if (ObjectUtil.isNotEmpty(customers)) {
+                stockMap.put("incrementAmount", customers.get(0).getCount());
             }
             //赋值存量数据
             List<CustomerVo> customerVos = sourceStockMap.get(dictTenantDataVo.getDictKey());
-            if (ObjectUtil.isNotEmpty(customerVos)){
-                stockMap.put("stockAmount",customerVos.get(0).getCount());
+            if (ObjectUtil.isNotEmpty(customerVos)) {
+                stockMap.put("stockAmount", customerVos.get(0).getCount());
             }
             stockList.add(stockMap);
         }
@@ -439,7 +438,7 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
         Map<String, Object> map = new HashMap<>();
 
         //存放询盘数据 成交单的列表
-        List<Map<String,Object>> saleList = new ArrayList<>();
+        List<Map<String, Object>> saleList = new ArrayList<>();
 
         QueryWrapper<Object> query = Wrappers.query();
         query.ge("DATE_FORMAT(sq.create_time,'%Y-%m')", dto.getBeginTime());
@@ -472,7 +471,7 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
         DynamicDataSourceContextHolder.push(SourceConstant.BASE);
         List<DictTenantDataVo> dictTenantDataVoList = getDict("customer_status");
 
-        if (dictTenantDataVoList.size()==0){
+        if (dictTenantDataVoList.size() == 0) {
             throw new ServiceException("数据有误:该租户没有配客户类型字典");
         }
 
@@ -481,20 +480,20 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
             //存放询盘数据 成交单的数据
             Map<String, Object> saleMap = new HashMap<>();
             //赋值初使值
-            saleMap.put("status",dictTenantDataVo.getDictValue());
-            saleMap.put("contractAmount",0);
-            saleMap.put("saleAmount",0);
+            saleMap.put("status", dictTenantDataVo.getDictValue());
+            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());
+            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());
+            if (ObjectUtil.isNotEmpty(saleQuotationList)) {
+                saleMap.put("contractAmount", saleQuotationList.get(0).getCount());
             }
             saleList.add(saleMap);
         }
@@ -641,7 +640,7 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
 
 
     //根据字典编码获取字典的数据
-    private List<DictTenantDataVo> getDict(String code){
+    private List<DictTenantDataVo> getDict(String code) {
         DictTenantDataSelectDto dto = new DictTenantDataSelectDto();
         dto.setDictCode(code);
         return dictTenantDataService.getList(dto);