Pārlūkot izejas kodu

合同头部统计

caozj 1 gadu atpakaļ
vecāks
revīzija
227a43f603

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

@@ -102,5 +102,5 @@ public interface ContractMapper extends BaseMapper<Contract> {
     List<AccountRunningWaterVo> getAccountRunningWaterByContractId(@Param("contractId") Long contractId);
 
     void updateContract(Contract contract);
-    List<ContractVo> getCustomerMoney();
+    List<ContractVo> getCustomerMoney(@Param("authIds")List<Long> authIds);
 }

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

@@ -1677,7 +1677,13 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
         map.put("sumArrivalAmount",BigDecimal.ZERO);
         map.put("sumQuantity",BigDecimal.ZERO);
         map.put("list",new ArrayList<>());
-        List<ContractVo> list = baseMapper.getCustomerMoney();
+        List<Long> authIdList = customerService.getAuthIdList();
+        List<ContractVo> list;
+        if(CollectionUtils.isNotEmpty(authIdList)){
+            list = baseMapper.getCustomerMoney(authIdList);
+        }else{
+            list = baseMapper.getCustomerMoney(null);
+        }
         if(CollectionUtils.isNotEmpty(list)){
             BigDecimal sumAmount = list.stream().map(ContractVo::getSumAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
             BigDecimal sumQuantity = list.stream().map(ContractVo::getSumQuantity).reduce(BigDecimal.ZERO,BigDecimal::add);
@@ -1687,8 +1693,8 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
                 item.setSellCorporationName(corporation.getName());
             });
             map.put("sumAmount",sumAmount);
-            map.put("sumArrivalAmount",sumQuantity);
-            map.put("sumQuantity",sumClaimMoney);
+            map.put("sumArrivalAmount",sumClaimMoney);
+            map.put("sumQuantity",sumQuantity);
             map.put("list",list);
         }
         return map;

+ 7 - 3
hx-sale/src/main/resources/mapper/contract/ContractMapper.xml

@@ -243,7 +243,7 @@
     <select id="getCustomerMoney" resultType="com.fjhx.sale.entity.contract.vo.ContractVo">
         SELECT
             t1.sell_corporation_id AS sellCorporationId,
-            IFNULL( SUM( t2.amount * t1.rate ), 0 ) AS sumAmount,
+            IFNULL( SUM( t1.amount * t1.rate ), 0 ) AS sumAmount,
             IFNULL( count(1) ,0 ) AS sumQuantity,
             (
                 SELECT
@@ -255,12 +255,16 @@
             ) AS sumClaimMoney
         FROM
             contract t1
-                LEFT JOIN contract_product t2 ON t1.id = t2.contract_id
         WHERE
             t1.is_show != 1
             AND t1.is_change = 0
             AND t1.`status` >= 30
-            AND t1.`status` &lt; 70
+            AND t1.`status` &lt; 88
+            <if test="authIds neq null and authIds.size() > 0">
+                <foreach collection="authIds" item="authId" open="AND t1.buy_corporation_id IN (" separator="," close=")">
+                    #{authId}
+                </foreach>
+            </if>
         GROUP BY sell_corporation_id
     </select>
     <update id="updateContract" parameterType="com.fjhx.sale.entity.contract.po.Contract">