yzc 1 жил өмнө
parent
commit
d24912ca75
16 өөрчлөгдсөн 213 нэмэгдсэн , 43 устгасан
  1. 10 0
      hx-account/src/main/java/com/fjhx/account/controller/account/AccountRequestFundsController.java
  2. 5 0
      hx-account/src/main/java/com/fjhx/account/mapper/account/AccountRequestFundsMapper.java
  3. 7 0
      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. 16 0
      hx-account/src/main/resources/mapper/account/AccountRequestFundsMapper.xml
  6. 25 0
      hx-customer/src/main/java/com/fjhx/customer/entity/customer/vo/CustomerFollowRecordsVo.java
  7. 1 1
      hx-customer/src/main/java/com/fjhx/customer/entity/customer/vo/CustomerVo.java
  8. 1 1
      hx-customer/src/main/java/com/fjhx/customer/mapper/customer/CustomerFollowRecordsMapper.java
  9. 6 0
      hx-customer/src/main/java/com/fjhx/customer/mapper/customer/CustomerMapper.java
  10. 8 3
      hx-customer/src/main/java/com/fjhx/customer/service/customer/impl/CustomerFollowRecordsServiceImpl.java
  11. 5 6
      hx-customer/src/main/java/com/fjhx/customer/service/customer/impl/CustomerServiceImpl.java
  12. 37 10
      hx-customer/src/main/resources/mapper/customer/CustomerFollowRecordsMapper.xml
  13. 41 0
      hx-customer/src/main/resources/mapper/customer/CustomerMapper.xml
  14. 2 1
      hx-sale/src/main/java/com/fjhx/sale/mapper/sale/SaleQuotationMapper.java
  15. 8 2
      hx-sale/src/main/java/com/fjhx/sale/service/sale/impl/SaleQuotationServiceImpl.java
  16. 33 19
      hx-sale/src/main/resources/mapper/sale/SaleQuotationMapper.xml

+ 10 - 0
hx-account/src/main/java/com/fjhx/account/controller/account/AccountRequestFundsController.java

@@ -11,6 +11,8 @@ import com.ruoyi.common.core.domain.BaseSelectDto;
 import com.fjhx.account.service.account.AccountRequestFundsService;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.util.List;
+
 
 /**
  * <p>
@@ -68,4 +70,12 @@ public class AccountRequestFundsController {
         accountRequestFundsService.delete(dto.getId());
     }
 
+    /**
+     * 获取历史付款信息
+     */
+    @GetMapping("/getPayHistoricalInfo")
+    public List<AccountRequestFundsVo> getPayHistoricalInfo() {
+        return accountRequestFundsService.getPayHistoricalInfo();
+    }
+
 }

+ 5 - 0
hx-account/src/main/java/com/fjhx/account/mapper/account/AccountRequestFundsMapper.java

@@ -8,6 +8,8 @@ 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 +26,7 @@ public interface AccountRequestFundsMapper extends BaseMapper<AccountRequestFund
      */
     Page<AccountRequestFundsVo> getPage(@Param("page") Page<Object> page, @Param("ew") QueryWrapper<Object> wrapper);
 
+    List<AccountRequestFundsVo> getPayHistoricalInfo(@Param("userId") Long userId);
+
+
 }

+ 7 - 0
hx-account/src/main/java/com/fjhx/account/service/account/AccountRequestFundsService.java

@@ -7,6 +7,8 @@ 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 java.util.List;
+
 
 /**
  * <p>
@@ -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(SecurityUtils.getUserId());
+    }
+
 }

+ 16 - 0
hx-account/src/main/resources/mapper/account/AccountRequestFundsMapper.xml

@@ -35,4 +35,20 @@
             ${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, '')
+                  ) != ''
+        and arf.create_user = #{userId}
+    </select>
+
 </mapper>

+ 25 - 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,28 @@ public class CustomerFollowRecordsVo extends CustomerFollowRecords {
      * 客户名称
      */
     private String customerName;
+
+
+    /**
+     * 合同金额
+     */
+    private BigDecimal amount;
+    /**
+     * 合同编号
+     */
+    private String contractCode;
+    /**
+     * 跟进类型
+     */
+    private String type;
+
+    /**
+     * 跟进人名称
+     */
+    private String followUpUserName;
+
+    /**
+     * 报价单code
+     */
+    private String code;
 }

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

@@ -46,7 +46,7 @@ public class CustomerVo extends Customer implements SetCustomizeAreaName {
     /**
      * 客户跟进记录
      */
-    private List<CustomerFollowRecords> customerFollowRecordsList;
+    private List<CustomerFollowRecordsVo> customerFollowRecordsList;
 
     /**
      * 是否置顶

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

@@ -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 - 0
hx-customer/src/main/java/com/fjhx/customer/mapper/customer/CustomerMapper.java

@@ -6,6 +6,7 @@ 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.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 +53,9 @@ public interface CustomerMapper extends BaseMapper<Customer> {
      * 客户分配
      */
     void customerAllocation(CustomerDto dto);
+
+    /**
+     * 跟进记录获取
+     */
+    List<CustomerFollowRecordsVo> getFollowUp(@Param("id") Long id, @Param("tenantId") String tenantId);
 }

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

@@ -19,7 +19,9 @@ 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 com.ruoyi.system.utils.UserUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -47,9 +49,8 @@ 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.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());
@@ -61,6 +62,10 @@ public class CustomerFollowRecordsServiceImpl extends ServiceImpl<CustomerFollow
                 record.setFileList(obsFiles);
             }
         }
+
+        //赋值跟进人名称
+        UserUtil.assignmentNickName(records, CustomerFollowRecordsVo::getCreateUser, CustomerFollowRecordsVo::setFollowUpUserName);
+
         //赋值客户名称
         customerService.attributeAssign(records, CustomerFollowRecordsVo::getCustomerId, (item, customer) -> {
             item.setCustomerName(customer.getName());

+ 5 - 6
hx-customer/src/main/java/com/fjhx/customer/service/customer/impl/CustomerServiceImpl.java

@@ -19,6 +19,7 @@ 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;
@@ -158,12 +159,10 @@ 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());
+            //赋值跟进人名称
+            UserUtil.assignmentNickName(followUp, CustomerFollowRecordsVo::getCreateUser, CustomerFollowRecordsVo::setFollowUpUserName);
+            record.setCustomerFollowRecordsList(followUp);
 
             //赋值客户状态字典值
             record.setStatusVal(customerStatusDic.get(record.getStatus()));

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

@@ -2,16 +2,43 @@
 <!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,
+                      code,
+                      10   AS     type,
+                      NULL AS     content,
+                      create_user
+               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,
+                      null as     code,
+                      20   AS     type,
+                      NULL AS     content,
+                      create_user
+               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,
+                      null as code,
+                      30   AS type,
+                      content,
+                      create_user
+               FROM customer_follow_records cfr
+               WHERE cfr.customer_id = #{id})) t1
             ${ew.customSqlSegment}
     </select>
 

+ 41 - 0
hx-customer/src/main/resources/mapper/customer/CustomerMapper.xml

@@ -70,5 +70,46 @@
             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,
+                      code,
+                      10   AS     type,
+                      NULL AS     content,
+                      create_user
+               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,
+                      null as     code,
+                      20   AS     type,
+                      NULL AS     content,
+                      create_user
+               FROM bytesailing_sale.contract c
+               WHERE c.status = 30
+                 and 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,
+                      null as code,
+                      30   AS type,
+                      content,
+                      create_user
+               FROM customer_follow_records cfr
+               WHERE cfr.customer_id = #{id})) t1
+        ORDER BY t1.date DESC LIMIT 3
+    </select>
 
 </mapper>

+ 2 - 1
hx-sale/src/main/java/com/fjhx/sale/mapper/sale/SaleQuotationMapper.java

@@ -8,6 +8,7 @@ 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 - 2
hx-sale/src/main/java/com/fjhx/sale/service/sale/impl/SaleQuotationServiceImpl.java

@@ -38,6 +38,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;
@@ -220,8 +222,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;
     }

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

@@ -33,6 +33,8 @@
     </select>
     <select id="saleDetail" resultType="com.fjhx.sale.entity.sale.vo.SaleQuotationVo">
         SELECT
+            id,
+            code,
             create_time,
             create_user,
             IFNULL(advance_ratio,0) advanceRatio,
@@ -46,6 +48,8 @@
             buy_corporation_id = #{dto.id}
         UNION
         SELECT
+            id,
+            code,
             create_time,
             create_user,
             IFNULL(advance_ratio,0) advanceRatio,
@@ -59,25 +63,35 @@
     </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,
+                      code,
+                      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,
+                      null as code,
+                      20   as type,
+                      NULL AS remark
+               FROM contract c
+               where c.status = 30
+                 and c.buy_corporation_id = #{id})
+              UNION
+              (SELECT id,
+                      NULL AS amount, date AS create_time, NULL AS contractCode, null as code, 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">