Browse Source

Merge remote-tracking branch 'origin/test' into test

huangxuechao 4 năm trước cách đây
mục cha
commit
b27990b0a3

+ 10 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/controller/ExportReportController.java

@@ -44,4 +44,14 @@ public class ExportReportController {
     }
 
 
+
+    @ApiOperation(value = "财务结算-利润表导出-头条", notes = "财务结算-利润表导出-头条")
+    @GetMapping(value = "/porfitReportBytedance")
+    public Result porfitReportBytedance(SettlementFileParamsVo paramsVo, HttpServletResponse response) {
+
+        return reportSettlementService.porfitReportBytedance(paramsVo,response);
+
+    }
+
+
 }

+ 49 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/entity/vo/ProfitReportBytedanceVo.java

@@ -0,0 +1,49 @@
+package org.jeecg.ctop.finance.settlement.entity.vo;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ *
+ * @description: 头条 利润表
+ * @return:
+ * @author: zianY
+ */
+@Data
+public class ProfitReportBytedanceVo implements Serializable {
+
+    @Excel(name = "广告主公司名称")
+    private String advertiserName;
+
+    @Excel(name = "产品名称")
+    private String productName;
+
+    @Excel(name = "总消耗")
+    private String cost;
+
+    @Excel(name = "现金消耗")
+    private String cashCost;
+
+    @Excel(name = "赠款消耗")
+    private String rewardCost;
+
+    @Excel(name = "返点类型")
+    private String rebateType;
+
+    @Excel(name = "返点比列")
+    private String rebateRate;
+
+    @Excel(name = "销售")
+    private String saleName;
+
+    @Excel(name = "运营")
+    private String operateName;
+
+    @Excel(name = "运营所属区域")
+    private String transferIn;
+
+
+
+}

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

@@ -8,6 +8,7 @@ import org.jeecg.ctop.finance.settlement.entity.vo.SettlementReportBytedanceVo;
 import org.jeecg.ctop.finance.settlement.entity.vo.SettlementReportKuaiShouVo;
 
 import java.util.List;
+import java.util.Map;
 
 
 /**
@@ -48,4 +49,23 @@ public interface ReportSettlementMapper {
      */
    List<String> getAccountImagesBytedance(String accountId);
 
+
+    /**
+     * 查询 头条利润表 总花费
+     * @return
+     */
+    List<Map<String,String>> getProfitBytedanceCost(@Param("startTime") String startTime,@Param("endTime") String endTime);
+
+    /**
+     * 查询 头条利润表  销售人员姓名 以及 返点类型和比列
+     * @param productId
+     * @return
+     */
+    Map<String,String> getProfitBytedanceSale(String productId);
+
+
+
+
+
+
 }

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

@@ -74,5 +74,61 @@
 
 
 
+    <!-- 查询 头条利润表 总花费-->
+    <select id="getProfitBytedanceCost" resultType="java.util.LinkedHashMap">
+        SELECT
+            d.advertiser_id AS accountId,
+            SUM( d.cost ) AS cost,
+            SUM( d.cash_cost ) AS cashCost,
+            SUM( d.reward_cost ) rewardCost,
+            cwjs.product_id as productId,
+            p.product_name AS productName
+        FROM
+            ctop_account_transaction_day d
+                LEFT JOIN ctop_cwjs_settlement_info cwjs ON d.advertiser_id = cwjs.account_id
+                LEFT JOIN ctop_product p ON cwjs.product_id = p.id
+        WHERE
+            cwjs.del_flag = 0
+        <if test="startTime !=null and startTime != ''">
+            AND d.date &gt;= #{startTime}
+        </if>
+        <if test="endTime !=null and endTime != ''">
+            AND d.date &lt;= #{endTime}
+        </if>
+        GROUP BY
+            d.advertiser_id;
+
+    </select>
+
+
+
+    <!-- 查询 头条利润表  销售人员姓名 以及 返点类型和比列-->
+    <select id="getProfitBytedanceSale" resultType="java.util.LinkedHashMap">
+        SELECT
+            pp.create_user_id,
+            su.realname AS saleName,
+            cp.rebate_type AS rebateType,
+            cp.rebate_rate AS rebateRate,
+            cp.approved_status AS approvedStatus
+        FROM
+            ctop_cwjs_policy_product pp,
+            sys_user su,
+            ctop_cwjs_policy_info cp
+        WHERE
+            pp.del_flag = 0
+          AND cp.del_flag = 0
+          AND pp.create_user_id = su.id
+          AND cp.id = pp.policy_id
+        <if test="productId !=null and productId != ''">
+            AND pp.id = #{productId}
+        </if>
+
+
+    </select>
+
+
+
+
+
 
 </mapper>

+ 5 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/IReportSettlementService.java

@@ -18,4 +18,9 @@ public interface IReportSettlementService {
 
     Result settlementReportKuaiShou(SettlementFileParamsVo paramsVo,HttpServletResponse response);
 
+
+
+
+    Result porfitReportBytedance(SettlementFileParamsVo paramsVo,HttpServletResponse response);
+
 }

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

@@ -1,12 +1,17 @@
 package org.jeecg.ctop.finance.settlement.service.serviceImpl;
 
+import cn.afterturn.easypoi.excel.ExcelExportUtil;
+import cn.afterturn.easypoi.excel.entity.ExportParams;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.hssf.usermodel.*;
 import org.apache.poi.ss.usermodel.ClientAnchor;
 import org.apache.poi.ss.usermodel.HorizontalAlignment;
+import org.apache.poi.ss.usermodel.Workbook;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.ctop.finance.policy.utils.Check;
+import org.jeecg.ctop.finance.settlement.entity.vo.ProfitReportBytedanceVo;
 import org.jeecg.ctop.finance.settlement.entity.vo.SettlementFileParamsVo;
 import org.jeecg.ctop.finance.settlement.entity.vo.SettlementReportBytedanceVo;
 import org.jeecg.ctop.finance.settlement.entity.vo.SettlementReportKuaiShouVo;
@@ -19,12 +24,10 @@ import javax.annotation.Resource;
 import javax.imageio.ImageIO;
 import javax.servlet.http.HttpServletResponse;
 import java.awt.image.BufferedImage;
-import java.io.BufferedOutputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
+import java.io.*;
 import java.net.URLEncoder;
 import java.util.List;
+import java.util.Map;
 
 
 @Slf4j
@@ -409,4 +412,75 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
         return null;
     }
 
+
+
+
+    /**
+     *
+     * @description: 财务结算 利润表导出 头条
+     * @param paramsVo
+     * @param response
+     * @return: org.jeecg.common.api.vo.Result
+     * @author: zianY
+     */
+    @Override
+    public Result porfitReportBytedance(SettlementFileParamsVo paramsVo, HttpServletResponse response) {
+
+        try {
+
+            //查询 头条利润表 总花费
+            List<Map<String,String>> list = reportSettlementMapper.getProfitBytedanceCost(paramsVo.getStartTime(),paramsVo.getEndTime());
+            for (Map<String, String> map : list) {
+                ProfitReportBytedanceVo vo = new ProfitReportBytedanceVo();
+                vo.setCost(map.get("cost"));//总消耗
+                vo.setCashCost(map.get("cashCost"));//现金消耗
+                vo.setRewardCost(map.get("rewardCost"));//赠款消耗
+                vo.setProductName(map.get("productName"));//产品名称
+                //查询 头条利润表  销售人员姓名 以及 返点类型和比列
+                Map<String,String> slaeMap = reportSettlementMapper.getProfitBytedanceSale(map.get("productId"));
+
+                vo.setSaleName(slaeMap.get("saleName"));//销售
+
+                ////销售政策状态
+                if (StringUtils.equals(slaeMap.get("approvedStatus"),"3")){
+                    vo.setRebateType(slaeMap.get("rebateType"));//返点类型
+                    vo.setRebateRate(slaeMap.get("rebateRate"));//返点比列
+
+                }
+
+
+
+
+            }
+
+
+
+
+
+
+            Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("这是表头", "这是sheet名称"), SettlementReportBytedanceVo.class, list);
+
+
+            try {
+                response.setCharacterEncoding("UTF-8");
+                response.setHeader("content-Type", "application/vnd.ms-excel");
+                response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("文件名称.xlsx", "UTF-8"));
+                workbook.write(response.getOutputStream());
+            } catch (IOException e) {
+                throw new RuntimeException(e);
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("====>>>>", e.getMessage());
+            return Result.errorMsg(e.getMessage());
+        }
+        return null;
+    }
+
+
+
+
+
+
 }