Browse Source

结算单

yangzian 3 năm trước cách đây
mục cha
commit
2c0687f5f3

+ 3 - 2
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/mapper/ReportSettlementMapper.java

@@ -7,6 +7,7 @@ import org.jeecg.ctop.finance.settlement.entity.vo.SettlementReportKuaiShouVo;
 
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 
 /**
@@ -39,10 +40,10 @@ public interface ReportSettlementMapper {
 
 
     /**
-     * 查询 头条 账户id
+     * 查询 账户id
      * @return
      */
-   List<String> getAccountIdBytedance(SettlementFileParamsVo paramsVo);
+   List<String> getAccountIdBytedance(@Param("sales") Set<String> sales, @Param("mediaId")String mediaId, @Param("advertiserId")String advertiserId, @Param("productId")String productId);
 
     /**
      * 查询 头条 账户 图片

+ 43 - 2
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/mapper/xml/ReportSettlementMapper.xml

@@ -10,10 +10,42 @@
         balance,cash_cost,cost,frozen,income,reward_cost,shared_wallet_cost,transfer_in,transfer_out,create_time
          from
         ctop_account_transaction_day
-        where advertiser_id = #{accountId}
+        where cost >0
+        and advertiser_id = #{accountId}
             )t
       LEFT JOIN ctop_user_allocation c on t.advertiser_id = c.account_id
         where uploadYears = #{uploadYears}
+
+       /* 账户流水信息 修改---------
+       SELECT
+            t.*,
+            IFNULL((SELECT c.auth_name  from ctop_user_allocation c where t.advertiser_id = c.account_id ),(SELECT c.account_name  from ctop_cwjs_settlement_info c where t.advertiser_id = c.account_id )) as accountName
+        FROM
+            (
+                SELECT
+                    id,
+                    advertiser_id,
+                    date,
+                    DATE_FORMAT( date, '%Y-%m' ) AS uploadYears,
+                    balance,
+                    cash_cost,
+                    cost,
+                    frozen,
+                    income,
+                    reward_cost,
+                    shared_wallet_cost,
+                    transfer_in,
+                    transfer_out,
+                    create_time
+                FROM
+                    ctop_account_transaction_day
+                WHERE cash_cost >0
+                  and advertiser_id = #{accountId}
+            ) t
+        WHERE
+            uploadYears = #{uploadYears}
+        ORDER BY date
+            limit 31*/
     </select>
 
     <!-- 查询 头条 账户id-->
@@ -32,6 +64,14 @@
         <if test="mediaId !=null and mediaId != ''">
             AND media_id = #{mediaId}
         </if>
+        <if test="sales !=null and sales != ''">
+            AND create_user_id in
+            <foreach collection="sales" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+
     </select>
 
     <!-- 查询 头条 账户 图片-->
@@ -115,7 +155,8 @@
                         FROM
                             ctop_kuaishou_daily_agent
                         WHERE
-                            account_id = #{accountId}
+                          and total_charged_in_yuan >0
+                          and account_id = #{accountId}
                     ) t
                 WHERE
                     DATE_FORMAT( t.date, '%Y-%m' ) = #{uploadYears}

+ 3 - 2
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/serviceImpl/ReportSettlementServiceImpl.java

@@ -272,7 +272,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
         String uploadYears = paramsVo.getUploadYears();
         //1:区分媒体(头条:1 快手:2)
         Integer mediaId = paramsVo.getMediaId();
-        List<String> settlementAccountList = reportSettlementMapper.getAccountIdBytedance(paramsVo);
+
         String roleCode = roleMapper.getRoleCodeByUserId(user.getId());
         Set<String>sales = new HashSet<>();
         List<UserAllocation>allocations ;
@@ -288,7 +288,8 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
         if(sales.isEmpty()){
             sales = null;
         }
-        allocations = userAllocationMapper.getAccountInfoBySalesId(sales,mediaId+"",paramsVo.getAdvertiserId(),paramsVo.getProductId());
+        List<String> settlementAccountList = reportSettlementMapper.getAccountIdBytedance(sales,String.valueOf(mediaId),paramsVo.getAdvertiserId(),paramsVo.getProductId());
+        allocations = userAllocationMapper.getAccountInfoBySalesId(sales,String.valueOf(mediaId),paramsVo.getAdvertiserId(),paramsVo.getProductId());
         return mergeAccountId(settlementAccountList,allocations,uploadYears);
     }