Răsfoiți Sursa

Merge remote-tracking branch 'origin/dev' into dev

caozj 2 ani în urmă
părinte
comite
6fd6339860
17 a modificat fișierele cu 245 adăugiri și 112 ștergeri
  1. 15 5
      hx-account/src/main/java/com/fjhx/account/controller/account/AccountRequestFundsController.java
  2. 8 2
      hx-account/src/main/java/com/fjhx/account/mapper/account/AccountRequestFundsMapper.java
  3. 12 5
      hx-account/src/main/java/com/fjhx/account/service/account/AccountRequestFundsService.java
  4. 8 0
      hx-account/src/main/java/com/fjhx/account/service/account/impl/AccountRequestFundsServiceImpl.java
  5. 40 27
      hx-account/src/main/resources/mapper/account/AccountRequestFundsMapper.xml
  6. 2 0
      hx-common/src/main/java/com/fjhx/common/service/coding/impl/CodingRuleServiceImpl.java
  7. 14 0
      hx-customer/src/main/java/com/fjhx/customer/entity/customer/vo/CustomerFollowRecordsVo.java
  8. 1 2
      hx-customer/src/main/java/com/fjhx/customer/entity/customer/vo/CustomerVo.java
  9. 2 2
      hx-customer/src/main/java/com/fjhx/customer/mapper/customer/CustomerFollowRecordsMapper.java
  10. 6 3
      hx-customer/src/main/java/com/fjhx/customer/mapper/customer/CustomerMapper.java
  11. 4 3
      hx-customer/src/main/java/com/fjhx/customer/service/customer/impl/CustomerFollowRecordsServiceImpl.java
  12. 9 7
      hx-customer/src/main/java/com/fjhx/customer/service/customer/impl/CustomerServiceImpl.java
  13. 31 10
      hx-customer/src/main/resources/mapper/customer/CustomerFollowRecordsMapper.xml
  14. 55 21
      hx-customer/src/main/resources/mapper/customer/CustomerMapper.xml
  15. 4 3
      hx-sale/src/main/java/com/fjhx/sale/mapper/sale/SaleQuotationMapper.java
  16. 8 3
      hx-sale/src/main/java/com/fjhx/sale/service/sale/impl/SaleQuotationServiceImpl.java
  17. 26 19
      hx-sale/src/main/resources/mapper/sale/SaleQuotationMapper.xml

+ 15 - 5
hx-account/src/main/java/com/fjhx/account/controller/account/AccountRequestFundsController.java

@@ -1,15 +1,17 @@
 package com.fjhx.account.controller.account;
 
 import com.baomidou.dynamic.datasource.annotation.DS;
-import com.fjhx.common.constant.SourceConstant;
-import org.springframework.web.bind.annotation.*;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.fjhx.account.entity.account.vo.AccountRequestFundsVo;
-import com.fjhx.account.entity.account.dto.AccountRequestFundsSelectDto;
 import com.fjhx.account.entity.account.dto.AccountRequestFundsDto;
-import com.ruoyi.common.core.domain.BaseSelectDto;
+import com.fjhx.account.entity.account.dto.AccountRequestFundsSelectDto;
+import com.fjhx.account.entity.account.vo.AccountRequestFundsVo;
 import com.fjhx.account.service.account.AccountRequestFundsService;
+import com.fjhx.common.constant.SourceConstant;
+import com.ruoyi.common.core.domain.BaseSelectDto;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
 
 
 /**
@@ -68,4 +70,12 @@ public class AccountRequestFundsController {
         accountRequestFundsService.delete(dto.getId());
     }
 
+    /**
+     * 获取历史付款信息
+     */
+    @GetMapping("/getPayHistoricalInfo")
+    public List<AccountRequestFundsVo> getPayHistoricalInfo() {
+        return accountRequestFundsService.getPayHistoricalInfo();
+    }
+
 }

+ 8 - 2
hx-account/src/main/java/com/fjhx/account/mapper/account/AccountRequestFundsMapper.java

@@ -1,13 +1,14 @@
 package com.fjhx.account.mapper.account;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.fjhx.account.entity.account.po.AccountRequestFunds;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.account.entity.account.po.AccountRequestFunds;
 import com.fjhx.account.entity.account.vo.AccountRequestFundsVo;
-import com.ruoyi.common.utils.wrapper.IWrapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 
 /**
  * <p>
@@ -24,4 +25,9 @@ public interface AccountRequestFundsMapper extends BaseMapper<AccountRequestFund
      */
     Page<AccountRequestFundsVo> getPage(@Param("page") Page<Object> page, @Param("ew") QueryWrapper<Object> wrapper);
 
+    /**
+     * 获取历史付款信息
+     */
+    List<AccountRequestFundsVo> getPayHistoricalInfo();
+
 }

+ 12 - 5
hx-account/src/main/java/com/fjhx/account/service/account/AccountRequestFundsService.java

@@ -1,11 +1,13 @@
 package com.fjhx.account.service.account;
 
-import com.fjhx.account.entity.account.po.AccountRequestFunds;
-import com.ruoyi.common.core.service.BaseService;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.fjhx.account.entity.account.vo.AccountRequestFundsVo;
-import com.fjhx.account.entity.account.dto.AccountRequestFundsSelectDto;
 import com.fjhx.account.entity.account.dto.AccountRequestFundsDto;
+import com.fjhx.account.entity.account.dto.AccountRequestFundsSelectDto;
+import com.fjhx.account.entity.account.po.AccountRequestFunds;
+import com.fjhx.account.entity.account.vo.AccountRequestFundsVo;
+import com.ruoyi.common.core.service.BaseService;
+
+import java.util.List;
 
 
 /**
@@ -13,7 +15,7 @@ import com.fjhx.account.entity.account.dto.AccountRequestFundsDto;
  * 请款表 服务类
  * </p>
  *
- * @author 
+ * @author
  * @since 2023-04-10
  */
 public interface AccountRequestFundsService extends BaseService<AccountRequestFunds> {
@@ -43,4 +45,9 @@ public interface AccountRequestFundsService extends BaseService<AccountRequestFu
      */
     void delete(Long id);
 
+    /**
+     * 获取历史付款信息
+     */
+    List<AccountRequestFundsVo> getPayHistoricalInfo();
+
 }

+ 8 - 0
hx-account/src/main/java/com/fjhx/account/service/account/impl/AccountRequestFundsServiceImpl.java

@@ -211,4 +211,12 @@ public class AccountRequestFundsServiceImpl extends ServiceImpl<AccountRequestFu
         this.removeById(id);
     }
 
+    /**
+     * 获取历史付款信息
+     */
+    @Override
+    public List<AccountRequestFundsVo> getPayHistoricalInfo() {
+        return baseMapper.getPayHistoricalInfo();
+    }
+
 }

+ 40 - 27
hx-account/src/main/resources/mapper/account/AccountRequestFundsMapper.xml

@@ -2,37 +2,50 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fjhx.account.mapper.account.AccountRequestFundsMapper">
     <select id="getPage" resultType="com.fjhx.account.entity.account.vo.AccountRequestFundsVo">
-        select
-            arf.id,
-            arf.department_id,
-            arf.corporation_id,
-            arf.account_management_id,
-            arf.payment_time,
-            arf.payment_remarks,
-            arf.currency,
-            arf.status,
-            arf.type,
-            arf.total,
-            arf.quantity,
-            arf.payment_method,
-            arf.name,
-            arf.opening_bank,
-            arf.account_opening,
-            arf.interbank_number,
-            arf.remarks,
-            arf.create_user,
-            arf.create_time,
-            arf.update_user,
-            arf.update_time,
-            arf.write_off_status,
-            arf.advance_id,
-            arf.advance_amounts,
-            ap.`status` accountPaymentStatus,
-            am.alias accountManagementName
+        select arf.id,
+               arf.department_id,
+               arf.corporation_id,
+               arf.account_management_id,
+               arf.payment_time,
+               arf.payment_remarks,
+               arf.currency,
+               arf.status,
+               arf.type,
+               arf.total,
+               arf.quantity,
+               arf.payment_method,
+               arf.name,
+               arf.opening_bank,
+               arf.account_opening,
+               arf.interbank_number,
+               arf.remarks,
+               arf.create_user,
+               arf.create_time,
+               arf.update_user,
+               arf.update_time,
+               arf.write_off_status,
+               arf.advance_id,
+               arf.advance_amounts,
+               ap.`status` accountPaymentStatus,
+               am.alias    accountManagementName
         from account_request_funds arf
                  left join account_payment ap on arf.id = ap.business_id
                  left join account_management am on arf.account_management_id = am.id
             ${ew.customSqlSegment}
     </select>
+    <select id="getPayHistoricalInfo" resultType="com.fjhx.account.entity.account.vo.AccountRequestFundsVo">
+        SELECT DISTINCT COALESCE
+                            (arf.`name`, '')               name,
+                        COALESCE(arf.account_opening, '')  accountOpening,
+                        COALESCE(arf.opening_bank, '')     openingBank,
+                        COALESCE(arf.interbank_number, '') interbankNumber
+        FROM account_request_funds arf
+        WHERE CONCAT(
+                      COALESCE(arf.`name`, ''),
+                      COALESCE(arf.account_opening, ''),
+                      COALESCE(arf.opening_bank, ''),
+                      COALESCE(arf.interbank_number, '')
+                  ) != ''
+    </select>
 
 </mapper>

+ 2 - 0
hx-common/src/main/java/com/fjhx/common/service/coding/impl/CodingRuleServiceImpl.java

@@ -241,9 +241,11 @@ public class CodingRuleServiceImpl extends ServiceImpl<CodingRuleMapper, CodingR
     }
 
     private String getCountryCode(Long countryId) {
+        DynamicDataSourceContextHolder.push(SourceConstant.BASE);
         CustomizeArea customizeArea = customizeAreaService.getOne(q -> q
                 .eq(BaseIdPo::getId, countryId)
                 .eq(CustomizeArea::getLevelCode, 1));
+        DynamicDataSourceContextHolder.poll();
 
         if (customizeArea == null) {
             throw new ServiceException("国家为空");

+ 14 - 0
hx-customer/src/main/java/com/fjhx/customer/entity/customer/vo/CustomerFollowRecordsVo.java

@@ -5,6 +5,7 @@ import com.fjhx.file.entity.ObsFile;
 import lombok.Getter;
 import lombok.Setter;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 /**
@@ -25,4 +26,17 @@ public class CustomerFollowRecordsVo extends CustomerFollowRecords {
      * 客户名称
      */
     private String customerName;
+
+    /**
+     * 合同金额
+     */
+    private BigDecimal amount;
+    /**
+     * 合同编号
+     */
+    private String contractCode;
+    /**
+     * 跟进类型
+     */
+    private String type;
 }

+ 1 - 2
hx-customer/src/main/java/com/fjhx/customer/entity/customer/vo/CustomerVo.java

@@ -2,7 +2,6 @@ package com.fjhx.customer.entity.customer.vo;
 
 import com.fjhx.area.service.SetCustomizeAreaName;
 import com.fjhx.customer.entity.customer.po.Customer;
-import com.fjhx.customer.entity.customer.po.CustomerFollowRecords;
 import com.fjhx.customer.entity.customer.po.CustomerUser;
 import lombok.Getter;
 import lombok.Setter;
@@ -46,7 +45,7 @@ public class CustomerVo extends Customer implements SetCustomizeAreaName {
     /**
      * 客户跟进记录
      */
-    private List<CustomerFollowRecords> customerFollowRecordsList;
+    private List<CustomerFollowRecordsVo> customerFollowRecordsList;
 
     /**
      * 是否置顶

+ 2 - 2
hx-customer/src/main/java/com/fjhx/customer/mapper/customer/CustomerFollowRecordsMapper.java

@@ -1,8 +1,8 @@
 package com.fjhx.customer.mapper.customer;
 
-import com.fjhx.customer.entity.customer.po.CustomerFollowRecords;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.customer.entity.customer.po.CustomerFollowRecords;
 import com.fjhx.customer.entity.customer.vo.CustomerFollowRecordsVo;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 import org.apache.ibatis.annotations.Param;
@@ -21,6 +21,6 @@ public interface CustomerFollowRecordsMapper extends BaseMapper<CustomerFollowRe
     /**
      * 客户跟进记录分页
      */
-    Page<CustomerFollowRecordsVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<CustomerFollowRecords> wrapper);
+    Page<CustomerFollowRecordsVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<CustomerFollowRecords> wrapper, @Param("id") Long id, @Param("tenantId") String tenantId);
 
 }

+ 6 - 3
hx-customer/src/main/java/com/fjhx/customer/mapper/customer/CustomerMapper.java

@@ -1,11 +1,11 @@
 package com.fjhx.customer.mapper.customer;
 
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.fjhx.customer.entity.customer.dto.CustomerDto;
-import com.fjhx.customer.entity.customer.po.Customer;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.customer.entity.customer.dto.CustomerDto;
+import com.fjhx.customer.entity.customer.po.Customer;
+import com.fjhx.customer.entity.customer.vo.CustomerFollowRecordsVo;
 import com.fjhx.customer.entity.customer.vo.CustomerVo;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 import org.apache.ibatis.annotations.Param;
@@ -52,4 +52,7 @@ public interface CustomerMapper extends BaseMapper<Customer> {
      * 客户分配
      */
     void customerAllocation(CustomerDto dto);
+
+    List<CustomerFollowRecordsVo> getFollowUp(@Param("id") Long id, @Param("tenantId") String tenantId);
+
 }

+ 4 - 3
hx-customer/src/main/java/com/fjhx/customer/service/customer/impl/CustomerFollowRecordsServiceImpl.java

@@ -19,6 +19,7 @@ import com.fjhx.file.entity.ObsFile;
 import com.fjhx.file.service.FileInfoService;
 import com.fjhx.file.utils.ObsFileUtil;
 import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -47,9 +48,9 @@ public class CustomerFollowRecordsServiceImpl extends ServiceImpl<CustomerFollow
     @Override
     public Page<CustomerFollowRecordsVo> getPage(CustomerFollowRecordsSelectDto dto) {
         IWrapper<CustomerFollowRecords> wrapper = getWrapper();
-        wrapper.eq("cfr", CustomerFollowRecords::getCustomerId, dto.getCustomerId());//根据客户id过滤
-        wrapper.orderByDesc("cfr", CustomerFollowRecords::getDate);
-        Page<CustomerFollowRecordsVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
+//        wrapper.eq("cfr", CustomerFollowRecords::getCustomerId, dto.getCustomerId());//根据客户id过滤
+        wrapper.orderByDesc("t1", CustomerFollowRecords::getDate);
+        Page<CustomerFollowRecordsVo> page = this.baseMapper.getPage(dto.getPage(), wrapper, dto.getCustomerId(), SecurityUtils.getTenantId());
         List<CustomerFollowRecordsVo> records = page.getRecords();
         //赋值文件列表信息
         List<Long> ids = records.stream().map(CustomerFollowRecordsVo::getId).filter(ObjectUtil::isNotNull).distinct().collect(Collectors.toList());

+ 9 - 7
hx-customer/src/main/java/com/fjhx/customer/service/customer/impl/CustomerServiceImpl.java

@@ -16,9 +16,9 @@ import com.fjhx.common.service.coding.CodingRuleCustomerService;
 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.po.CustomerFollowRecords;
 import com.fjhx.customer.entity.customer.po.CustomerTop;
 import com.fjhx.customer.entity.customer.po.CustomerUser;
+import com.fjhx.customer.entity.customer.vo.CustomerFollowRecordsVo;
 import com.fjhx.customer.entity.customer.vo.CustomerVo;
 import com.fjhx.customer.mapper.customer.CustomerMapper;
 import com.fjhx.customer.service.customer.CustomerFollowRecordsService;
@@ -145,12 +145,14 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
 
         // 赋值客户跟进记录
         for (CustomerVo record : records) {
-            List<CustomerFollowRecords> customerFollowRecordsList = customerFollowRecordsService.list(q -> q
-                    .eq(CustomerFollowRecords::getCustomerId, record.getId())
-                    .orderByDesc(CustomerFollowRecords::getDate)
-                    .last("limit 3")
-            );
-            record.setCustomerFollowRecordsList(customerFollowRecordsList);
+            List<CustomerFollowRecordsVo> followUp = baseMapper.getFollowUp(record.getId(), SecurityUtils.getTenantId());
+//            List<CustomerFollowRecords> customerFollowRecordsList = customerFollowRecordsService.list(q -> q
+//                    .eq(CustomerFollowRecords::getCustomerId, record.getId())
+//                    .orderByDesc(CustomerFollowRecords::getDate)
+//                    .last("limit 3")
+//            );
+//            record.setCustomerFollowRecordsList(customerFollowRecordsList);
+            record.setCustomerFollowRecordsList(followUp);
 
             //赋值客户状态字典值
             record.setStatusVal(customerStatusDic.get(record.getStatus()));

+ 31 - 10
hx-customer/src/main/resources/mapper/customer/CustomerFollowRecordsMapper.xml

@@ -2,16 +2,37 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fjhx.customer.mapper.customer.CustomerFollowRecordsMapper">
     <select id="getPage" resultType="com.fjhx.customer.entity.customer.vo.CustomerFollowRecordsVo">
-        select
-            cfr.id,
-            cfr.customer_id,
-            cfr.date,
-            cfr.content,
-            cfr.create_user,
-            cfr.create_time,
-            cfr.update_user,
-            cfr.update_time
-        from customer_follow_records cfr
+        SELECT t1.*
+        FROM ((SELECT id,
+                      amount,
+                      create_time `date`,
+                      NULL AS     contractCode,
+                      10   AS     type,
+                      NULL AS     remark
+               FROM bytesailing_sale.sale_quotation sq
+               WHERE sq.buy_corporation_id = #{id}
+                 and sq.tenant_id = #{tenantId}
+                 and sq.del_flag = 0)
+              UNION
+              (SELECT id,
+                      amount,
+                      create_time `date`,
+                      CODE AS     contractCode,
+                      20   AS     type,
+                      NULL AS     remark
+               FROM bytesailing_sale.contract c
+               WHERE c.buy_corporation_id = #{id}
+                 and c.tenant_id = #{tenantId}
+                 and c.del_flag = 0)
+              UNION
+              (SELECT id,
+                      NULL    AS amount,
+                      `date`,
+                      NULL    AS contractCode,
+                      30      AS type,
+                      content AS remark
+               FROM customer_follow_records cfr
+               WHERE cfr.customer_id = #{id})) t1
             ${ew.customSqlSegment}
     </select>
 

+ 55 - 21
hx-customer/src/main/resources/mapper/customer/CustomerMapper.xml

@@ -2,7 +2,9 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fjhx.customer.mapper.customer.CustomerMapper">
     <update id="customerAllocation">
-        update customer set user_id = #{userId},update_time = now() where id = #{id}
+        update customer set user_id     = #{userId},
+                            update_time = now()
+        where id = #{id}
     </update>
     <select id="getList" resultType="com.fjhx.customer.entity.customer.vo.CustomerVo">
         select
@@ -28,24 +30,23 @@
     </select>
 
     <select id="getPage" resultType="com.fjhx.customer.entity.customer.vo.CustomerVo">
-        select
-            c.id,
-            c.customer_code,
-            c.code,
-            c.country_id,
-            c.province_id,
-            c.city_id,
-            c.address,
-            c.zip_code,
-            c.name,
-            c.status,
-            c.source,
-            c.user_id,
-            c.create_user,
-            c.create_time,
-            c.update_user,
-            c.update_time,
-            c.tag
+        select c.id,
+               c.customer_code,
+               c.code,
+               c.country_id,
+               c.province_id,
+               c.city_id,
+               c.address,
+               c.zip_code,
+               c.name,
+               c.status,
+               c.source,
+               c.user_id,
+               c.create_user,
+               c.create_time,
+               c.update_user,
+               c.update_time,
+               c.tag
         from customer c
             ${ew.customSqlSegment}
     </select>
@@ -62,13 +63,46 @@
     </select>
 
     <select id="sourceIncrement" resultType="com.fjhx.customer.entity.customer.vo.CustomerVo">
-        SELECT
-            COUNT(*) count,
+        SELECT COUNT(*) count,
 	        ifnull(c.source,-1) source,
             ifnull(DATE_FORMAT(c.create_time,'%Y-%m'),-1) time
         FROM
             customer c
             ${ew.customSqlSegment}
     </select>
+    <select id="getFollowUp" resultType="com.fjhx.customer.entity.customer.vo.CustomerFollowRecordsVo">
+        SELECT t1.*
+        FROM ((SELECT id,
+                      amount,
+                      create_time `date`,
+                      NULL AS     contractCode,
+                      10   AS     type,
+                      NULL AS     remark
+               FROM bytesailing_sale.sale_quotation sq
+               WHERE sq.buy_corporation_id = #{id}
+                 and sq.tenant_id = #{tenantId}
+                 and sq.del_flag = 0)
+              UNION
+              (SELECT id,
+                      amount,
+                      create_time `date`,
+                      CODE AS     contractCode,
+                      20   AS     type,
+                      NULL AS     remark
+               FROM bytesailing_sale.contract c
+               WHERE c.buy_corporation_id = #{id}
+                 and c.tenant_id = #{tenantId}
+                 and c.del_flag = 0)
+              UNION
+              (SELECT id,
+                      NULL    AS amount,
+                      `date`,
+                      NULL    AS contractCode,
+                      30      AS type,
+                      content AS remark
+               FROM customer_follow_records cfr
+               WHERE cfr.customer_id = #{id})) t1
+        ORDER BY t1.date DESC LIMIT 3
+    </select>
 
 </mapper>

+ 4 - 3
hx-sale/src/main/java/com/fjhx/sale/mapper/sale/SaleQuotationMapper.java

@@ -2,12 +2,13 @@ package com.fjhx.sale.mapper.sale;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.customer.entity.customer.dto.CustomerDto;
 import com.fjhx.customer.entity.customer.dto.CustomerSelectDto;
 import com.fjhx.sale.entity.sale.po.SaleQuotation;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.sale.entity.sale.vo.SaleQuotationVo;
+import com.ruoyi.common.utils.wrapper.IWrapper;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -43,7 +44,7 @@ public interface SaleQuotationMapper extends BaseMapper<SaleQuotation> {
 
     Page<SaleQuotationVo> saleDetail(@Param("page") Page<Object> page,@Param("dto") CustomerSelectDto dto);
 
-    Page<SaleQuotationVo> latestFollowUp(@Param("page") Page<Object> page,@Param("ew") QueryWrapper<Object> orderByDesc);
+    Page<SaleQuotationVo> latestFollowUp(@Param("page") Page<Object> page, @Param("ew") IWrapper<Object> orderByDesc, @Param("id") Long id, @Param("tenantId") String tenantId);
 
     /**
      * 类型统计(客户分析)

+ 8 - 3
hx-sale/src/main/java/com/fjhx/sale/service/sale/impl/SaleQuotationServiceImpl.java

@@ -19,7 +19,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;
@@ -38,6 +37,8 @@ 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.exception.ServiceException;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.wrapper.IWrapper;
 import com.ruoyi.system.utils.UserUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -224,8 +225,12 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
      */
     @Override
     public Page<SaleQuotationVo> latestFollowUp(CustomerSelectDto dto) {
-        Page<SaleQuotationVo> saleQuotationVoPage = baseMapper.latestFollowUp(dto.getPage(), Wrappers.query().eq("buy_corporation_id", dto.getId())
-                .orderByDesc("create_time"));
+        Page<SaleQuotationVo> saleQuotationVoPage = baseMapper.latestFollowUp(
+                dto.getPage(),
+                IWrapper.getWrapper().orderByDesc("create_time"),
+                dto.getId(),
+                SecurityUtils.getTenantId()
+        );
 
         return saleQuotationVoPage;
     }

+ 26 - 19
hx-sale/src/main/resources/mapper/sale/SaleQuotationMapper.xml

@@ -59,25 +59,32 @@
     </select>
 
     <select id="latestFollowUp" resultType="com.fjhx.sale.entity.sale.vo.SaleQuotationVo">
-        (SELECT
-            id,
-            amount,
-            create_time,
-            NULL AS contractCode,
-            10 as type
-        FROM
-            sale_quotation
-        ${ew.customSqlSegment})
-        UNION
-        (SELECT
-            id,
-            amount,
-            create_time,
-            code as contractCode,
-            20 as type
-        FROM
-            contract
-        ${ew.customSqlSegment})
+        select t1.*
+        from ((SELECT id,
+                      amount,
+                      create_time,
+                      NULL AS contractCode,
+                      10   as type,
+                      NULL AS remark
+               FROM sale_quotation sq
+               where sq.buy_corporation_id = #{id})
+              UNION
+              (SELECT id,
+                      amount,
+                      create_time,
+                      code as contractCode,
+                      20   as type,
+                      NULL AS remark
+               FROM contract c
+               where c.buy_corporation_id = #{id})
+              UNION
+              (SELECT id,
+                      NULL AS amount, date AS create_time, NULL AS contractCode, 30 AS type, content AS remark
+               FROM
+                   bytesailing_customer.customer_follow_records cfr
+               where cfr.customer_id = #{id}
+                 and cfr.tenant_id = #{tenantId}
+                 and cfr.del_flag = 0)) t1 ${ew.customSqlSegment}
     </select>
 
     <select id="saleStatistics" resultType="com.fjhx.sale.entity.sale.vo.SaleQuotationVo">