Sfoglia il codice sorgente

利润结算BUG修复、利润预算利润结算分页过滤、客户画像统计销售额明细列表修改

caozj 1 anno fa
parent
commit
459d066666

+ 1 - 1
hx-sale/src/main/java/com/fjhx/sale/controller/sale/SaleQuotationController.java

@@ -66,7 +66,7 @@ public class SaleQuotationController {
      * 销售统计(客户画像)
      */
     @PostMapping("/salesStatistics")
-    public Map<String, Object> salesStatistics(@RequestBody CustomerDto dto) {
+    public Map<String, Object> salesStatistics(@RequestBody SaleQuotationSelectDto dto) {
         return saleQuotationService.salesStatistics(dto);
     }
 

+ 8 - 0
hx-sale/src/main/java/com/fjhx/sale/entity/contract/vo/ContractVo.java

@@ -80,6 +80,11 @@ public class ContractVo extends Contract {
     private BigDecimal sumPackQuantity;
 
     /**
+     * 总额
+     */
+    private BigDecimal sumAmount;
+
+    /**
      * 合同产品ID
      */
     private Long contractProductId;
@@ -196,5 +201,8 @@ public class ContractVo extends Contract {
      * 跟单条数
      */
     private Integer documentaryCount;
+
+
+
 }
 

+ 1 - 1
hx-sale/src/main/java/com/fjhx/sale/mapper/contract/ContractMapper.java

@@ -60,7 +60,7 @@ public interface ContractMapper extends BaseMapper<Contract> {
      * @param id
      * @return
      */
-    List<ContractVo> getSalesTotalList(Long id);
+    Page<ContractVo> getSalesTotalList(@Param("page") Page<Object> page,Long id);
     /**
      * 查询指定客户的每月合同总额
      * @param dto

+ 2 - 1
hx-sale/src/main/java/com/fjhx/sale/service/contract/ContractService.java

@@ -14,6 +14,7 @@ import com.fjhx.sale.entity.contract.po.Contract;
 import com.fjhx.sale.entity.contract.vo.*;
 import com.fjhx.sale.entity.sale.vo.SaleQuotationVo;
 import com.ruoyi.common.core.service.BaseService;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 import java.util.Map;
@@ -98,7 +99,7 @@ public interface ContractService extends BaseService<Contract> {
      * 查询销售额(合同总金额)
      * @param id(买方公司ID)
      */
-    List<ContractVo>  getSalesTotalList(Long id);
+    Page<ContractVo>  getSalesTotalList(Page<Object> page, Long id);
     /**
      * 查询指定客户的每月合同总额
      * @param dto

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

@@ -97,6 +97,7 @@ import com.ruoyi.framework.config.ThreadPoolConfig;
 import com.ruoyi.system.service.ISysUserService;
 import com.ruoyi.system.utils.UserUtil;
 import org.apache.commons.collections4.MapUtils;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.security.core.context.SecurityContext;
@@ -369,6 +370,8 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
     public Page<ContractBudgetVo> getProfitBudgetPage(ContractSelectDto dto) {
         IWrapper<Contract> wrapper = getWrapper();
         wrapper.orderByDesc("t1", Contract::getCreateTime);
+        wrapper.eq("t1", Contract::getIsChange, "0");//列表只展示未变更得数据
+        wrapper.ne("t1", Contract::getIsShow, 1);
         wrapper.between("t1", Contract::getStatus, FlowStatusEnum1.PASS.getKey(), FlowStatusEnum1.CANCELLATION.getKey() - 1);
         if (StringUtils.isNotEmpty(dto.getCustomerId())) {
             wrapper.eq("t1", Contract::getBuyCorporationId, dto.getCustomerId());
@@ -480,6 +483,8 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
     public Page<ContractBudgetVo> getProfitClearingPage(ContractSelectDto dto) {
         IWrapper<Contract> wrapper = getWrapper();
         wrapper.orderByDesc("t1", Contract::getCreateTime);
+        wrapper.eq("t1", Contract::getIsChange, "0");//列表只展示未变更得数据
+        wrapper.ne("t1", Contract::getIsShow, 1);
         wrapper.between("t1", Contract::getStatus, FlowStatusEnum1.PASS.getKey(), FlowStatusEnum1.CANCELLATION.getKey() - 1);
         if (StringUtils.isNotEmpty(dto.getCustomerId())) {
             wrapper.eq("t1", Contract::getBuyCorporationId, dto.getCustomerId());
@@ -753,8 +758,8 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
      * @param id (买方公司ID)
      */
     @Override
-    public List<ContractVo> getSalesTotalList(Long id) {
-        return baseMapper.getSalesTotalList(id);
+    public Page<ContractVo> getSalesTotalList(Page<Object> page, Long id) {
+        return baseMapper.getSalesTotalList(page,id);
     }
 
     /**
@@ -1608,10 +1613,10 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
      * @return
      */
     private void getSumPurchaseContractMoney(ContractBudgetVo v, List<EhsdPurchase> purchaseList, Map<String, BigDecimal> assignCurrencyRatesMap) {
+        v.setAccountPaid(BigDecimal.ZERO);
         BigDecimal purchaseSumMoney = BigDecimal.ZERO;
         if (CollectionUtils.isEmpty(purchaseList)) {
             v.setSumPurchaseContractMoney(BigDecimal.ZERO);
-            v.setAccountPaid(BigDecimal.ZERO);
             return;
         }
         List<Long> purchaseIds = purchaseList.stream().map(EhsdPurchase::getId).collect(Collectors.toList());

+ 1 - 1
hx-sale/src/main/java/com/fjhx/sale/service/sale/SaleQuotationService.java

@@ -75,7 +75,7 @@ public interface SaleQuotationService extends BaseService<SaleQuotation> {
     /**
      * 销售统计(客户画像)
      */
-    Map<String, Object> salesStatistics(CustomerDto dto);
+    Map<String, Object> salesStatistics(SaleQuotationSelectDto dto);
 
     /**
      * 销售走势(客户画像)

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

@@ -10,6 +10,7 @@ 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;
@@ -258,21 +259,26 @@ public class SaleQuotationServiceImpl extends ServiceImpl<SaleQuotationMapper, S
      * 销售统计(客户画像)
      */
     @Override
-    public Map<String, Object> salesStatistics(CustomerDto dto) {
+    public Map<String, Object> salesStatistics(SaleQuotationSelectDto dto) {
         Map<String, Object> map = new HashMap<>();
         //切换数据源
         DynamicDataSourceContextHolder.push(SourceConstant.SALE);
         //查询这个客户的销售额(合同总金额)及成交合同数量
         ContractVo contractVo = contractService.getSalesTotal(dto.getId());
         map.put("contractVo", contractVo);
-        List<ContractVo> contractVoList = contractService.getSalesTotalList(dto.getId());
+        Page<ContractVo> page = contractService.getSalesTotalList(dto.getPage(),dto.getId());
+        List<ContractVo> contractVoList = page.getRecords();
         // 赋值用户名称
         UserUtil.assignmentNickName(contractVoList, BasePo::getCreateUser, ContractVo::setUserName);
         // 赋值买方公司名称(客户)
         customerService.attributeAssign(contractVoList, ContractVo::getBuyCorporationId, (item, customer) -> {
             item.setBuyCorporationName(customer.getName());
         });
-        map.put("contractList",contractVoList);
+        //赋值归属公司
+        corporationService.attributeAssign(contractVoList, ContractVo::getSellCorporationId, (item, corporation) -> {
+            item.setSellCorporationName(corporation.getName());
+        });
+        map.put("contractList",page);
         //查询这个客户的报价次数
         Integer count = this.getCount(dto.getId());
         DynamicDataSourceContextHolder.poll();

+ 6 - 2
hx-sale/src/main/resources/mapper/contract/ContractMapper.xml

@@ -74,8 +74,8 @@
 
     <select id="getSalesTotal" resultType="com.fjhx.sale.entity.contract.vo.ContractVo">
         SELECT
-            SUM( amount ),
-            SUM( contractCount )
+            SUM( amount ) AS sumAmount,
+            SUM( contractCount ) AS contractCount
         FROM
             (
                 SELECT
@@ -115,6 +115,8 @@
         FROM
             (
                 SELECT
+                    currency,
+                    sell_corporation_id,
                     id,
                     "外销合同" AS type,
                     create_time,
@@ -145,6 +147,8 @@
 		AND is_change = 0
 		AND del_flag = 0 UNION ALL
                 SELECT
+                    currency,
+                    sell_corporation_id,
                     id,
                     "样品单" AS type,
                     create_time,