Browse Source

结算单-查询账户数量过滤消耗为0

yangzian 3 years ago
parent
commit
9ddaea6da0

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

@@ -44,6 +44,8 @@ public interface ReportSettlementMapper {
      * @return
      */
    List<String> getAccountIdBytedance(@Param("sales") Set<String> sales, @Param("mediaId")String mediaId, @Param("advertiserId")String advertiserId, @Param("productId")String productId);
+   List<String> getAccountIdBytedanceRepeat(@Param("accountIds") List<String> accountIds,@Param("uploadYears")String uploadYears);
+   List<String> getAccountIdKuaiShouRepeat(@Param("accountIds") List<String> accountIds,@Param("uploadYears")String uploadYears);
 
     /**
      * 查询 头条 账户 图片

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

@@ -15,6 +15,7 @@
             )t
       LEFT JOIN ctop_user_allocation c on t.advertiser_id = c.account_id
         where uploadYears = #{uploadYears}
+        ORDER BY date
     </select>
 
     <!-- 查询 头条 账户id-->
@@ -43,6 +44,61 @@
 
     </select>
 
+
+    <!-- 查询  账户id 消耗不为0-->
+    <select id="getAccountIdBytedanceRepeat" resultType="java.lang.String">
+        SELECT
+        advertiser_id
+        FROM
+        ctop_account_transaction_day
+        WHERE
+        cost > 0
+    <if test="uploadYears !=null and uploadYears != ''">
+        AND DATE_FORMAT( date, '%Y-%m' ) =  #{uploadYears}
+    </if>
+    <if test="accountIds !=null and accountIds != ''">
+        AND advertiser_id in
+        <foreach collection="accountIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+    </if>
+        GROUP BY
+        advertiser_id
+    </select>
+
+    <!-- 查询  账户id 消耗不为0-->
+    <select id="getAccountIdKuaiShouRepeat" resultType="java.lang.String">
+        SELECT
+        account_id AS accountId
+        FROM
+        ctop_kuaishou_daily_agent
+        WHERE
+        total_charged_in_yuan > 0
+     <if test="uploadYears !=null and uploadYears != ''">
+        AND DATE_FORMAT( date_time, '%Y-%m' ) =  #{uploadYears}
+    </if>
+    <if test="accountIds !=null and accountIds != ''">
+        AND account_id in
+        <foreach collection="accountIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+    </if>
+        GROUP BY
+        account_id
+    </select>
+
+
+
+
+
+
+
+
+
+
+
     <!-- 查询 头条 账户 图片-->
     <select id="getAccountImagesBytedance" resultType="java.lang.String">
         SELECT

+ 9 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/serviceImpl/SettlementFileInfoServiceImpl.java

@@ -11,6 +11,7 @@ import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.ctop.finance.policy.utils.Check;
 import org.jeecg.ctop.finance.settlement.entity.pojo.CtopCwjsSettlementFileInfo;
 import org.jeecg.ctop.finance.settlement.entity.vo.SettlementFileParamsVo;
+import org.jeecg.ctop.finance.settlement.mapper.ReportSettlementMapper;
 import org.jeecg.ctop.finance.settlement.mapper.SettlementFileInfoMapper;
 import org.jeecg.ctop.finance.settlement.mapper.SettlementInfoMapper;
 import org.jeecg.ctop.finance.settlement.service.IReportSettlementService;
@@ -185,6 +186,8 @@ public class SettlementFileInfoServiceImpl extends ServiceImpl<SettlementFileInf
 
     @Autowired
     private IReportSettlementService reportSettlementService;
+    @Autowired
+    private ReportSettlementMapper reportSettlementMapper;
 
     /**
      * @description: 查询账户数量以及图片数量
@@ -196,6 +199,12 @@ public class SettlementFileInfoServiceImpl extends ServiceImpl<SettlementFileInf
     public Result getAccountNumAndImgNum(SettlementFileParamsVo paramsVo, SysUser user) {
         Map<String,String> map =  settlementFileInfoMapper.getAccountNumAndImgNum(paramsVo);
         List<String>accountIds = reportSettlementService.getAccountId(paramsVo,user);
+        //过滤消耗为0 的账户 1-头条 2-快手
+        if (paramsVo.getMediaId().equals(1)){
+            accountIds = reportSettlementMapper.getAccountIdBytedanceRepeat(accountIds,paramsVo.getUploadYears());
+        }else if (paramsVo.getMediaId().equals(2)){
+            accountIds = reportSettlementMapper.getAccountIdKuaiShouRepeat(accountIds,paramsVo.getUploadYears());
+        }
         if(null == accountIds||accountIds.isEmpty()){
             map.put("accountNum","0");
         }else{