Browse Source

政策-快手结算单数据源修改为内网

yangzian 3 years ago
parent
commit
583b272326

+ 29 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/mapper/IntranetSettlementMapper.java

@@ -0,0 +1,29 @@
+package org.jeecg.ctop.finance.settlement.mapper;
+
+import io.lettuce.core.dynamic.annotation.Param;
+import org.jeecg.ctop.finance.settlement.entity.pojo.CtopCwjsSlettementReport;
+import org.jeecg.ctop.finance.settlement.entity.vo.SettlementFileParamsVo;
+import org.jeecg.ctop.finance.settlement.entity.vo.SettlementReportKuaiShouVo;
+
+import java.util.List;
+
+
+/**
+ *
+ * @description:
+ *
+ * @return:
+ * @author: zianY
+ */
+public interface IntranetSettlementMapper {
+
+
+    // 获取快手 结算单 账户 和 代理商 维度
+    List<SettlementReportKuaiShouVo> getTransactionDayKuaiShouAgentAndAccountInrtanet(SettlementFileParamsVo paramsVo);
+
+
+
+
+
+
+}

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

@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.ctop.finance.settlement.mapper.IntranetSettlementMapper">
+
+
+    <!-- 获取快手 账户 日流水信息  代理商 和 账户 维度-->
+    <select id="getTransactionDayKuaiShouAgentAndAccountInrtanet" resultType="org.jeecg.ctop.finance.settlement.entity.vo.SettlementReportKuaiShouVo">
+
+        SELECT
+            *
+        FROM
+            (
+                SELECT
+                    t.*
+                FROM
+                    (
+                        SELECT
+                            stat_date as date,
+                            account_id AS accountId,
+                            total_charged_in_yuan as dailyCharge,
+                            contract_rebate_real_charged_in_yuan as contractRebateRealCharged,
+                            direct_rebate_real_charged_in_yuan as directRebateRealCharged,
+                            ( real_charged_in_yuan + total_rebate_real_charged_in_yuan + credit_real_charged_in_yuan ) realCharged,
+                            account_name AS accountName,
+                            kuaishou_id AS ksId
+                        FROM
+                            application.app_kuaishou_agent_report_d
+                        WHERE
+                            total_charged_in_yuan >0
+                          and account_id = #{accountId}
+                    ) t
+                WHERE
+                    DATE_FORMAT( t.date, '%Y-%m' ) = #{uploadYears}
+                ORDER BY
+                    t.date
+                    LIMIT 31
+            ) a
+                LEFT JOIN (
+                SELECT
+                    t.*,
+                    c.auth_name AS accountNameF,
+                    base.user_id AS ksIdF
+                FROM
+                    (
+                        SELECT
+                            advertiser_id AS accountIdF,
+                            date,
+                            daily_transfer_in as dailyTransferIn,
+                            daily_transfer_out as dailyTransferOut,
+                            balance as balance,
+                            real_recharged as realRecharged,
+                            contract_rebate_real_recharged as contractRebateRealRecharged,
+                            direct_rebate_real_recharged as directRebateRealRecharged
+                        FROM
+                            media_api.kuaishou_advertiser_fund_daily_flows
+                        WHERE
+                            advertiser_id = #{accountId}
+                    ) t
+                        LEFT JOIN `jeecg-boot`.ctop_user_allocation c ON t.accountIdF = c.account_id
+                        LEFT JOIN `jeecg-boot`.ctop_kuaishou_advertiser_base_info base ON base.account_id = t.accountIdF
+                WHERE
+                    DATE_FORMAT( t.date, '%Y-%m' ) = #{uploadYears}
+                ORDER BY
+                    date
+                    LIMIT 31
+            ) b ON a.accountId = b.accountIdF
+                AND a.date = b.date
+            LIMIT 31
+
+    </select>
+
+
+</mapper>

+ 21 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/IntranetSettlementService.java

@@ -0,0 +1,21 @@
+package org.jeecg.ctop.finance.settlement.service;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.ctop.finance.settlement.entity.pojo.CtopCwjsSettlementInfo;
+import org.jeecg.ctop.finance.settlement.entity.vo.SettlementFileParamsVo;
+import org.jeecg.ctop.finance.settlement.entity.vo.SettlementReportKuaiShouVo;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+
+public interface IntranetSettlementService{
+
+    // 获取快手 结算单 账户 和 代理商 维度---内网
+    List<SettlementReportKuaiShouVo> getTransactionDayKuaiShouAgentAndAccountIntranet(SettlementFileParamsVo paramsVo);
+
+}

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

@@ -0,0 +1,29 @@
+package org.jeecg.ctop.finance.settlement.service.serviceImpl;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import org.jeecg.ctop.finance.settlement.entity.vo.SettlementFileParamsVo;
+import org.jeecg.ctop.finance.settlement.entity.vo.SettlementReportKuaiShouVo;
+import org.jeecg.ctop.finance.settlement.mapper.IntranetSettlementMapper;
+import org.jeecg.ctop.finance.settlement.service.IntranetSettlementService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * Administrator
+ * 2022/5/5
+ **/
+@DS("multi-datasource1")
+@Service
+public class IntranetSettlementServiceImpl implements IntranetSettlementService {
+
+    @Resource
+    private IntranetSettlementMapper intranetSettlementMapper;
+
+
+    @Override
+    public List<SettlementReportKuaiShouVo> getTransactionDayKuaiShouAgentAndAccountIntranet(SettlementFileParamsVo paramsVo) {
+        return intranetSettlementMapper.getTransactionDayKuaiShouAgentAndAccountInrtanet(paramsVo);
+    }
+}

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

@@ -345,6 +345,10 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
         return settlementAccountList;
     }
 
+
+    @Resource
+    private IntranetSettlementServiceImpl intranetSettlementService;
+
     @Override
     public Result settlementReportKuaiShou(SettlementFileParamsVo paramsVo, HttpServletResponse response, SysUser user) {
         try {
@@ -375,7 +379,8 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                 String accountId = accountIdList.get(k);
                 paramsVo.setAccountId(accountId);
 
-                List<SettlementReportKuaiShouVo> settlementList = reportSettlementMapper.getTransactionDayKuaiShouAgentAndAccount(paramsVo);
+               // List<SettlementReportKuaiShouVo> settlementList = reportSettlementMapper.getTransactionDayKuaiShouAgentAndAccount(paramsVo);
+                List<SettlementReportKuaiShouVo> settlementList = intranetSettlementService.getTransactionDayKuaiShouAgentAndAccountIntranet(paramsVo);
                 if (Check.isNull(settlementList)){
                     num++;
                     continue;

+ 5 - 5
jeecg-boot-finance/src/main/resources/application-dev.yml

@@ -111,11 +111,11 @@ spring:
           password: hcst@2020
           driver-class-name: com.mysql.jdbc.Driver
           # 多数据源配置
-          #multi-datasource1:
-          #url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
-          #username: root
-          #password: root
-          #driver-class-name: com.mysql.cj.jdbc.Driver
+        multi-datasource1:
+          url: jdbc:mysql://192.168.0.184:3390/jeecg-boot?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+          username: hcst
+          password: hcst@2021
+          driver-class-name: com.mysql.cj.jdbc.Driver
   #redis 配置
   redis:
     database: 0