Эх сурвалжийг харах

外部报价单添加近期跟进记录

yzc 1 жил өмнө
parent
commit
9a23e222b9

+ 5 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/ext/dto/ExtQuotationSelectDto.java

@@ -45,4 +45,9 @@ public class ExtQuotationSelectDto extends BaseSelectDto {
      */
     private Integer status;
 
+    /**
+     * 近期跟进天数过滤
+     */
+    private Integer followDay;
+
 }

+ 5 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/ext/vo/ExtQuotationVo.java

@@ -59,4 +59,9 @@ public class ExtQuotationVo extends ExtQuotation {
      */
     private String userName;
 
+    /**
+     * 内部报价单号
+     */
+    private String internalCode;
+
 }

+ 16 - 5
hx-sale/src/main/java/com/fjhx/sale/service/ext/impl/ExtQuotationServiceImpl.java

@@ -111,6 +111,9 @@ public class ExtQuotationServiceImpl extends ServiceImpl<ExtQuotationMapper, Ext
             );
         }
 
+        //最近有跟进的数据
+        wrapper.le("DATEDIFF( NOW(), last_follow_time )", dto.getFollowDay());
+
         wrapper.orderByDesc("eq", ExtQuotation::getId);
 
         Page<ExtQuotationVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
@@ -120,6 +123,11 @@ public class ExtQuotationServiceImpl extends ServiceImpl<ExtQuotationMapper, Ext
             return page;
         }
 
+        //获取对内报价单号
+        List<Long> internalIds = records.stream().map(ExtQuotation::getSaleQuotationId).collect(Collectors.toList());
+        Map<Long, String> internalMap = saleQuotationService.mapKV(SaleQuotation::getId, SaleQuotation::getCode,
+                q -> q.in(SaleQuotation::getId, internalIds));
+
         // 赋值用户名称
         UserUtil.assignmentNickName(records, BasePo::getCreateUser, ExtQuotationVo::setUserName);
 
@@ -148,16 +156,19 @@ public class ExtQuotationServiceImpl extends ServiceImpl<ExtQuotationMapper, Ext
                 .orderByDesc(ExtQuotationFollow::getFollowTime)
         );
 
-        for (ExtQuotationVo saleQuotationVo : records) {
+        for (ExtQuotationVo esq : records) {
             //赋值报价公司名称
-            saleQuotationVo.setCompanyName(companyMap.get(saleQuotationVo.getCompanyId()));
+            esq.setCompanyName(companyMap.get(esq.getCompanyId()));
 
             //赋值产品列表
-            saleQuotationVo.setQuotationProductList(pMap.get(saleQuotationVo.getId()));
+            esq.setQuotationProductList(pMap.get(esq.getId()));
 
             //赋值跟进信息
-            List<ExtQuotationFollow> extQuotationFollows = followMap.get(saleQuotationVo.getId());
-            saleQuotationVo.setExtQuotationFollowList(extQuotationFollows);
+            List<ExtQuotationFollow> extQuotationFollows = followMap.get(esq.getId());
+            esq.setExtQuotationFollowList(extQuotationFollows);
+
+            //赋值内部报价单号
+            esq.setInternalCode(internalMap.get(esq.getSaleQuotationId()));
         }
 
         return page;