Browse Source

快手 下载结算单,日期参数变更

zhaoxian 2 years ago
parent
commit
d8ee023be3

+ 2 - 7
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/ICreateSheetService.java

@@ -1,23 +1,18 @@
 package org.jeecg.ctop.finance.policy.service;
 
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.extension.service.IService;
 import org.apache.poi.hssf.usermodel.HSSFCellStyle;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.jeecg.ctop.finance.policy.entity.CwjsPolicyInfo;
 
 import java.util.List;
-import java.util.Map;
 
 /**
- *
  * @author jeecg-boot
  * 2021-07-27
  * @version V1.0
  */
 public interface ICreateSheetService {
 
-    void createBytedance(HSSFWorkbook wb, HSSFCellStyle style, List<String> accountIdList,String uploadYears);
+    void createBytedance(HSSFWorkbook wb, HSSFCellStyle style, List<String> accountIdList, String uploadYears);
 
-    void createKuaiShou(HSSFWorkbook wb, HSSFCellStyle style, List<String> accountIdList,String uploadYears);
+    void createKuaiShou(HSSFWorkbook wb, HSSFCellStyle style, List<String> accountIdList, String startTime, String endTime);
 }

+ 69 - 70
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/impl/CreateSheetServiceImpl.java

@@ -26,7 +26,6 @@ import java.util.*;
 import java.util.stream.Collectors;
 
 /**
- *
  * @author jeecg-boot
  * 2021-07-27
  * @version V1.0
@@ -38,15 +37,15 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
     private ReportSettlementMapper reportSettlementMapper;
 
 
-    public void createBytedance(HSSFWorkbook wb, HSSFCellStyle style, List<String> accountIdList,String uploadYears){
-        DecimalFormat sf  = new DecimalFormat("#.####");//保留四位小数
+    public void createBytedance(HSSFWorkbook wb, HSSFCellStyle style, List<String> accountIdList, String uploadYears) {
+        DecimalFormat sf = new DecimalFormat("#.####");//保留四位小数
         //2:创建sheet 设置sheet名称
         HSSFSheet sheet = wb.createSheet("汇总页");
         //3:添加 第一行单元格
         HSSFRow row0 = sheet.createRow(0);
         HSSFCell cell0 = row0.createCell(0);
         //设置 第一行 表头
-        cell0.setCellValue(uploadYears+"-头条结算单汇总");
+        cell0.setCellValue(uploadYears + "-头条结算单汇总");
         CellRangeAddress region = new CellRangeAddress(0, 0, 0, 10);
         sheet.addMergedRegion(region);//合并行
         cell0.setCellStyle(style);
@@ -118,21 +117,21 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
         sheet.autoSizeColumn(0, true);
         List<SheetBytedanceVo> resultList = new ArrayList<>(accountIdList.size());
         //获取当前年月的 第一天 和 最后一天
-        Map<String,String> timeMap = SettlementUtil.getFirstAndLastDayOfMonth(uploadYears);
+        Map<String, String> timeMap = SettlementUtil.getFirstAndLastDayOfMonth(uploadYears);
         //查看账户数据
-        List<Map<String,Object>> list = reportSettlementMapper.getAccountTransactionDayBytedanceSheet(accountIdList,uploadYears);
-        for (Map<String,Object> map : list) {
+        List<Map<String, Object>> list = reportSettlementMapper.getAccountTransactionDayBytedanceSheet(accountIdList, uploadYears);
+        for (Map<String, Object> map : list) {
             SheetBytedanceVo voSource = new SheetBytedanceVo();
-            voSource.setAgentId(map.get("agentId")+"");
-            voSource.setAgentName(map.get("agentName")+"");
-            voSource.setAccountId(map.get("accountId")+"");
-            voSource.setAccountName(map.get("accountName")+"");
+            voSource.setAgentId(map.get("agentId") + "");
+            voSource.setAgentName(map.get("agentName") + "");
+            voSource.setAccountId(map.get("accountId") + "");
+            voSource.setAccountName(map.get("accountName") + "");
 
             //政策所有时间点
             List<String> policyDaysList = new ArrayList<>();
-            if (!Check.isNull(map.get("productName"))){
+            if (!Check.isNull(map.get("productName"))) {
                 //查询 头条利润表  返点类型和比列
-                List<Map<String,Object>> rateMap = reportSettlementMapper.getProfitBytedance(map.get("advertiserName")+"",map.get("productName")+"",null,"1",timeMap.get("startTime"),timeMap.get("endTime"));
+                List<Map<String, Object>> rateMap = reportSettlementMapper.getProfitBytedance(map.get("advertiserName") + "", map.get("productName") + "", null, "1", timeMap.get("startTime"), timeMap.get("endTime"));
                 List listPolicyTIme = new ArrayList();
                 for (Map<String, Object> rate : rateMap) {
                     listPolicyTIme.add(rate.get("policyStartDate"));
@@ -142,56 +141,56 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
                 List<Object> times = SettlementUtil.sortlistTest(listPolicyTIme);
                 // 使用政策的时间段 拼接 开始 和 截至 时间
                 List<Map<String, String>> arrayList = new ArrayList<>();
-                for ( int i = 0; i < times.size(); i++) {
+                for (int i = 0; i < times.size(); i++) {
                     HashMap<String, String> mapTime = new HashMap<>();
                     mapTime.put("startDate", times.get(i).toString());
-                    mapTime.put("endDate",  times.size() < 2 ? times.get(i).toString() : times.get(i + 1).toString());
+                    mapTime.put("endDate", times.size() < 2 ? times.get(i).toString() : times.get(i + 1).toString());
                     i += 1;
                     arrayList.add(mapTime);
                 }
                 for (Map<String, String> stringMap : arrayList) {
                     SheetBytedanceVo vo = new SheetBytedanceVo();
                     //使用政策 返点类型和比例
-                    Map<String,Object>  policyRateMap = reportSettlementMapper.getProfitRebate(map.get("advertiserName")+"",map.get("productName")+"",null,"1",stringMap.get("startDate"),stringMap.get("endDate"));
-                    if (!Check.isNull(policyRateMap)){
-                        if(Integer.valueOf(policyRateMap.get("rebateType").toString())== 0){
+                    Map<String, Object> policyRateMap = reportSettlementMapper.getProfitRebate(map.get("advertiserName") + "", map.get("productName") + "", null, "1", stringMap.get("startDate"), stringMap.get("endDate"));
+                    if (!Check.isNull(policyRateMap)) {
+                        if (Integer.valueOf(policyRateMap.get("rebateType").toString()) == 0) {
                             vo.setRebateType("返现");//返点类型
-                        }else if (Integer.valueOf(policyRateMap.get("rebateType").toString())== 1){
+                        } else if (Integer.valueOf(policyRateMap.get("rebateType").toString()) == 1) {
                             vo.setRebateType("返货");
-                        }else if (Integer.valueOf(policyRateMap.get("rebateType").toString())== 2){
+                        } else if (Integer.valueOf(policyRateMap.get("rebateType").toString()) == 2) {
                             vo.setRebateType("返现+返货");
-                        }else if(Integer.valueOf(policyRateMap.get("rebateType").toString())== 3){
+                        } else if (Integer.valueOf(policyRateMap.get("rebateType").toString()) == 3) {
                             vo.setRebateType("服务费");
                         }
-                        vo.setRebateRate(policyRateMap.getOrDefault("rebateRate","")+"%");//返点比列
-                    }else {
+                        vo.setRebateRate(policyRateMap.getOrDefault("rebateRate", "") + "%");//返点比列
+                    } else {
                         vo.setRebateType("");
                     }
                     // 时间段内 账户流水 信息
-                    List<Map<String,Object>> listAccount = reportSettlementMapper.getProfitBytedanceCost(map.get("accountId")+"",stringMap.get("startDate"),stringMap.get("endDate"));
+                    List<Map<String, Object>> listAccount = reportSettlementMapper.getProfitBytedanceCost(map.get("accountId") + "", stringMap.get("startDate"), stringMap.get("endDate"));
                     listAccount.removeAll(Collections.singleton(null));
-                    vo.setCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("cost","")+"");//总消耗
-                    vo.setCashCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("cashCost","")+"");//现金消耗
-                    vo.setRewardCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("rewardCost","")+"");//赠款消耗
-                    vo.setBalance(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("balance","")+"");//日终结余
-                    vo.setFrozen(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("frozen","")+"");//冻结
-                    vo.setIncome(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("income","")+"");//总存入
-                    vo.setSharedWalletCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("sharedWalletCost","")+"");//共享钱包支出
-                    vo.setTransferIn(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("transferIn","")+"");//总转入
-                    vo.setTransferOut(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("transferOut","")+"");//总转出
-                    BeanUtils.copyProperties(voSource,vo,SettlementUtil.getNullPropertyNames(voSource));
-                    vo.setTime(stringMap.get("startDate")+"----"+stringMap.get("endDate"));
+                    vo.setCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("cost", "") + "");//总消耗
+                    vo.setCashCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("cashCost", "") + "");//现金消耗
+                    vo.setRewardCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("rewardCost", "") + "");//赠款消耗
+                    vo.setBalance(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("balance", "") + "");//日终结余
+                    vo.setFrozen(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("frozen", "") + "");//冻结
+                    vo.setIncome(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("income", "") + "");//总存入
+                    vo.setSharedWalletCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("sharedWalletCost", "") + "");//共享钱包支出
+                    vo.setTransferIn(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("transferIn", "") + "");//总转入
+                    vo.setTransferOut(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("transferOut", "") + "");//总转出
+                    BeanUtils.copyProperties(voSource, vo, SettlementUtil.getNullPropertyNames(voSource));
+                    vo.setTime(stringMap.get("startDate") + "----" + stringMap.get("endDate"));
                     resultList.add(vo);
-                    policyDaysList.addAll(SettlementUtil.getAllDatesOfTwoTimes(stringMap.get("startDate"),stringMap.get("endDate")));
+                    policyDaysList.addAll(SettlementUtil.getAllDatesOfTwoTimes(stringMap.get("startDate"), stringMap.get("endDate")));
                 }
 
             }
 
             //不使用政策 的时间段
             // 获取两个日期之间 所有的 时间 年-月-日
-            List<String> betweenDaysList = SettlementUtil.getAllDatesOfTwoTimes(timeMap.get("startTime"),timeMap.get("endTime"));
+            List<String> betweenDaysList = SettlementUtil.getAllDatesOfTwoTimes(timeMap.get("startTime"), timeMap.get("endTime"));
             // 时间差集(所有时间段 - 使用政策的时间段)
-            List<String>  reduceList = betweenDaysList.stream().filter(item -> !policyDaysList.contains(item)).collect(Collectors.toList());
+            List<String> reduceList = betweenDaysList.stream().filter(item -> !policyDaysList.contains(item)).collect(Collectors.toList());
             //差集拼接  开始 和 结束时间
             List<Map<String, String>> stringList = SettlementUtil.getTime(reduceList);
             for (Map<String, String> stringMap : stringList) {
@@ -201,19 +200,19 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
                 vo.setRebateType("");//返点类型
                 vo.setRebateRate("");//返点比列
                 //账户流水 信息
-                List<Map<String,Object>> listAccount = reportSettlementMapper.getProfitBytedanceCost(map.get("accountId")+"",stringMap.get("startDate"),stringMap.get("endDate"));
+                List<Map<String, Object>> listAccount = reportSettlementMapper.getProfitBytedanceCost(map.get("accountId") + "", stringMap.get("startDate"), stringMap.get("endDate"));
                 listAccount.removeAll(Collections.singleton(null));
-                vo.setCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("cost","")+"");//总消耗
-                vo.setCashCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("cashCost","")+"");//现金消耗
-                vo.setRewardCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("rewardCost","")+"");//赠款消耗
-                vo.setBalance(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("balance","")+"");//日终结余
-                vo.setFrozen(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("frozen","")+"");//冻结
-                vo.setIncome(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("income","")+"");//总存入
-                vo.setSharedWalletCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("sharedWalletCost","")+"");//共享钱包支出
-                vo.setTransferIn(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("transferIn","")+"");//总转入
-                vo.setTransferOut(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("transferOut","")+"");//总转出
-                BeanUtils.copyProperties(voSource,vo, SettlementUtil.getNullPropertyNames(voSource));
-                vo.setTime((!Check.isNull(vo.getRebateType()) ? stringMap.get("startDate")+"----"+stringMap.get("endDate") : ""));
+                vo.setCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("cost", "") + "");//总消耗
+                vo.setCashCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("cashCost", "") + "");//现金消耗
+                vo.setRewardCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("rewardCost", "") + "");//赠款消耗
+                vo.setBalance(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("balance", "") + "");//日终结余
+                vo.setFrozen(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("frozen", "") + "");//冻结
+                vo.setIncome(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("income", "") + "");//总存入
+                vo.setSharedWalletCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("sharedWalletCost", "") + "");//共享钱包支出
+                vo.setTransferIn(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("transferIn", "") + "");//总转入
+                vo.setTransferOut(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("transferOut", "") + "");//总转出
+                BeanUtils.copyProperties(voSource, vo, SettlementUtil.getNullPropertyNames(voSource));
+                vo.setTime((!Check.isNull(vo.getRebateType()) ? stringMap.get("startDate") + "----" + stringMap.get("endDate") : ""));
                 resultList.add(vo);
             }
         }
@@ -241,20 +240,20 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
             row.createCell(13).setCellValue(vo.getRebateType());
             row.createCell(14).setCellValue(vo.getRebateRate());
             row.createCell(15).setCellValue(vo.getTime());
-           // row.setRowStyle(style);
+            // row.setRowStyle(style);
         }
     }
 
     @Override
-    public void createKuaiShou(HSSFWorkbook wb, HSSFCellStyle style, List<String> accountIdList, String uploadYears) {
-        DecimalFormat sf  = new DecimalFormat("#.####");//保留四位小数
+    public void createKuaiShou(HSSFWorkbook wb, HSSFCellStyle style, List<String> accountIdList, String startTime, String endTime) {
+        DecimalFormat sf = new DecimalFormat("#.####");//保留四位小数
         //2:创建sheet 设置sheet名称
         HSSFSheet sheet = wb.createSheet("汇总页");
         //3:添加 第一行单元格
         HSSFRow row0 = sheet.createRow(0);
         HSSFCell cell0 = row0.createCell(0);
         //设置 第一行 表头
-        cell0.setCellValue(uploadYears+"-快手结算单汇总");
+        cell0.setCellValue(startTime + "~" + endTime + "-快手结算单汇总");
         CellRangeAddress region = new CellRangeAddress(0, 0, 0, 10);
         sheet.addMergedRegion(region);//合并行
         cell0.setCellStyle(style);
@@ -340,19 +339,19 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
         List<SheetKuaiShouVo> resultList = new ArrayList<>(accountIdList.size());
         //查询该时段 快手 数据
         //获取当前年月的 第一天 和 最后一天
-        Map<String,String> timeMap = SettlementUtil.getFirstAndLastDayOfMonth(uploadYears);
-        List<Map<String,Object>> accountList = reportSettlementMapper.getProfitKuaiShouAccountCostSheet(accountIdList,timeMap.get("startTime"),timeMap.get("endTime"));
-        for (Map<String,Object> map : accountList) {
+//        Map<String,String> timeMap = SettlementUtil.getFirstAndLastDayOfMonth(uploadYears);
+        List<Map<String, Object>> accountList = reportSettlementMapper.getProfitKuaiShouAccountCostSheet(accountIdList, startTime, endTime);
+        for (Map<String, Object> map : accountList) {
             SheetKuaiShouVo voSource = new SheetKuaiShouVo();
-            voSource.setAccountId(map.get("accountId")+"");
-            voSource.setKsId(map.get("ksId")+"");
-            voSource.setAccountName(map.get("accountName")+"");
+            voSource.setAccountId(map.get("accountId") + "");
+            voSource.setKsId(map.get("ksId") + "");
+            voSource.setAccountName(map.get("accountName") + "");
 
             //政策所有时间点
             List<String> policyDaysList = new ArrayList<>();
             if (!Check.isNull(map.get("productName"))) {
                 //查询 快手利润表  返点类型和比列
-                List<Map<String, Object>> rateMap = reportSettlementMapper.getProfitBytedance(map.get("advertiserName")+"",map.get("productName") + "", null,"2", timeMap.get("startTime"),timeMap.get("endTime"));
+                List<Map<String, Object>> rateMap = reportSettlementMapper.getProfitBytedance(map.get("advertiserName") + "", map.get("productName") + "", null, "2", startTime, endTime);
                 List listPolicyTIme = new ArrayList();
                 for (Map<String, Object> rate : rateMap) {
                     listPolicyTIme.add(rate.get("policyStartDate"));
@@ -363,7 +362,7 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
                 List<Object> times = SettlementUtil.sortlistTest(listPolicyTIme);
                 // 使用政策的时间段 拼接 开始 和 截至 时间
                 List<Map<String, String>> arrayList = new ArrayList<>();
-                if (!Check.isNull(times)){
+                if (!Check.isNull(times)) {
                     for (int i = 0; i < times.size(); i++) {
                         HashMap<String, String> mapTime = new HashMap<>();
                         mapTime.put("startDate", times.get(i).toString());
@@ -376,7 +375,7 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
                 for (Map<String, String> stringMap : arrayList) {
                     SheetKuaiShouVo vo = new SheetKuaiShouVo();
                     //使用政策 返点类型和比例
-                    Map<String, Object> policyRateMap = reportSettlementMapper.getProfitRebate(map.get("advertiserName")+"",map.get("productName") + "", null,"2",stringMap.get("startDate"), stringMap.get("endDate"));
+                    Map<String, Object> policyRateMap = reportSettlementMapper.getProfitRebate(map.get("advertiserName") + "", map.get("productName") + "", null, "2", stringMap.get("startDate"), stringMap.get("endDate"));
                     if (!Check.isNull(policyRateMap)) {
                         if (Integer.valueOf(policyRateMap.get("rebateType").toString()) == 0) {
                             vo.setRebateType("返现");//返点类型
@@ -384,7 +383,7 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
                             vo.setRebateType("返货");
                         } else if (Integer.valueOf(policyRateMap.get("rebateType").toString()) == 2) {
                             vo.setRebateType("返现+返货");
-                        }else if(Integer.valueOf(policyRateMap.get("rebateType").toString())== 3){
+                        } else if (Integer.valueOf(policyRateMap.get("rebateType").toString()) == 3) {
                             vo.setRebateType("服务费");
                         }
                         vo.setRebateRate(policyRateMap.getOrDefault("rebateRate", "") + "%");//返点比列
@@ -393,7 +392,7 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
                     }
 
                     // 时间段内 账户流水 信息
-                    List<SheetKuaiShouVo>  listInfo = reportSettlementMapper.getTransactionDayKuaiShouSheet(map.get("accountId") + "", stringMap.get("startDate"), stringMap.get("endDate"));
+                    List<SheetKuaiShouVo> listInfo = reportSettlementMapper.getTransactionDayKuaiShouSheet(map.get("accountId") + "", stringMap.get("startDate"), stringMap.get("endDate"));
 
                     listInfo.removeAll(Collections.singleton(null));
                     vo.setDailyCharge(listInfo.stream().filter(v -> !Check.isNull(v.getDailyCharge())).map(SheetKuaiShouVo::getDailyCharge).reduce(BigDecimal.ZERO, BigDecimal::add));
@@ -404,7 +403,7 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
                     vo.setDailyTransferIn(listInfo.stream().filter(v -> !Check.isNull(v.getDailyTransferIn())).map(SheetKuaiShouVo::getDailyTransferIn).reduce(BigDecimal.ZERO, BigDecimal::add));
                     vo.setDailyTransferOut(listInfo.stream().filter(v -> !Check.isNull(v.getDailyTransferOut())).map(SheetKuaiShouVo::getDailyTransferOut).reduce(BigDecimal.ZERO, BigDecimal::add));
                     //vo.setBalance(listInfo.stream().filter(v -> !Check.isNull(v.getBalance())).map(SheetKuaiShouVo::getBalance).reduce(BigDecimal.ZERO, BigDecimal::add));
-                    vo.setBalance(Check.isNull(listInfo) ? new BigDecimal(0) : listInfo.stream().filter(v ->!Check.isNull(v.getBalance())).min((u1,u2) -> u1.getBalance().compareTo(u2.getBalance())).get().getBalance());
+                    vo.setBalance(Check.isNull(listInfo) ? new BigDecimal(0) : listInfo.stream().filter(v -> !Check.isNull(v.getBalance())).min((u1, u2) -> u1.getBalance().compareTo(u2.getBalance())).get().getBalance());
                     vo.setRealRecharged(listInfo.stream().filter(v -> !Check.isNull(v.getRealRecharged())).map(SheetKuaiShouVo::getRealRecharged).reduce(BigDecimal.ZERO, BigDecimal::add));
                     vo.setContractRebateRealRecharged(listInfo.stream().filter(v -> !Check.isNull(v.getContractRebateRealRecharged())).map(SheetKuaiShouVo::getContractRebateRealRecharged).reduce(BigDecimal.ZERO, BigDecimal::add));
                     vo.setDirectRebateRealRecharged(listInfo.stream().filter(v -> !Check.isNull(v.getDirectRebateRealRecharged())).map(SheetKuaiShouVo::getDirectRebateRealRecharged).reduce(BigDecimal.ZERO, BigDecimal::add));
@@ -417,7 +416,7 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
 
             //不使用政策 的时间段
             // 获取两个日期之间 所有的 时间 年-月-日
-            List<String> betweenDaysList = SettlementUtil.getAllDatesOfTwoTimes(timeMap.get("startTime"),timeMap.get("endTime"));
+            List<String> betweenDaysList = SettlementUtil.getAllDatesOfTwoTimes(startTime, endTime);
             // 时间差集(所有时间段 - 使用政策的时间段)
             List<String> reduceList = betweenDaysList.stream().filter(item -> !policyDaysList.contains(item)).collect(Collectors.toList());
             //差集拼接  开始 和 结束时间
@@ -429,7 +428,7 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
                 vo.setRebateType("");//返点类型
                 vo.setRebateRate("");//返点比列
                 // 时间段内 账户流水 信息
-                List<SheetKuaiShouVo>  listInfo = reportSettlementMapper.getTransactionDayKuaiShouSheet(map.get("accountId") + "", stringMap.get("startDate"), stringMap.get("endDate"));
+                List<SheetKuaiShouVo> listInfo = reportSettlementMapper.getTransactionDayKuaiShouSheet(map.get("accountId") + "", stringMap.get("startDate"), stringMap.get("endDate"));
                 listInfo.removeAll(Collections.singleton(null));
                 vo.setDailyCharge(listInfo.stream().filter(v -> !Check.isNull(v.getDailyCharge())).map(SheetKuaiShouVo::getDailyCharge).reduce(BigDecimal.ZERO, BigDecimal::add));
                 vo.setFlowDailyCharge(listInfo.stream().filter(v -> !Check.isNull(v.getFlowDailyCharge())).map(SheetKuaiShouVo::getFlowDailyCharge).reduce(BigDecimal.ZERO, BigDecimal::add));
@@ -439,7 +438,7 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
                 vo.setDailyTransferIn(listInfo.stream().filter(v -> !Check.isNull(v.getDailyTransferIn())).map(SheetKuaiShouVo::getDailyTransferIn).reduce(BigDecimal.ZERO, BigDecimal::add));
                 vo.setDailyTransferOut(listInfo.stream().filter(v -> !Check.isNull(v.getDailyTransferOut())).map(SheetKuaiShouVo::getDailyTransferOut).reduce(BigDecimal.ZERO, BigDecimal::add));
                 //vo.setBalance(listInfo.stream().filter(v -> !Check.isNull(v.getBalance())).map(SheetKuaiShouVo::getBalance).reduce(BigDecimal.ZERO, BigDecimal::add));
-                vo.setBalance(Check.isNull(listInfo) ? new BigDecimal(0) : listInfo.stream().filter(v ->!Check.isNull(v.getBalance())).min((u1,u2) -> u1.getBalance().compareTo(u2.getBalance())).get().getBalance());
+                vo.setBalance(Check.isNull(listInfo) ? new BigDecimal(0) : listInfo.stream().filter(v -> !Check.isNull(v.getBalance())).min((u1, u2) -> u1.getBalance().compareTo(u2.getBalance())).get().getBalance());
                 vo.setRealRecharged(listInfo.stream().filter(v -> !Check.isNull(v.getRealRecharged())).map(SheetKuaiShouVo::getRealRecharged).reduce(BigDecimal.ZERO, BigDecimal::add));
                 vo.setContractRebateRealRecharged(listInfo.stream().filter(v -> !Check.isNull(v.getContractRebateRealRecharged())).map(SheetKuaiShouVo::getContractRebateRealRecharged).reduce(BigDecimal.ZERO, BigDecimal::add));
                 vo.setDirectRebateRealRecharged(listInfo.stream().filter(v -> !Check.isNull(v.getDirectRebateRealRecharged())).map(SheetKuaiShouVo::getDirectRebateRealRecharged).reduce(BigDecimal.ZERO, BigDecimal::add));
@@ -456,7 +455,7 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
             sheet.autoSizeColumn(0, true);
             sheet.autoSizeColumn(i + 1, true);
             //创建单元格并且添加数据
-            row.createCell(0).setCellValue(uploadYears);
+            row.createCell(0).setCellValue(startTime + "~" + endTime);
             row.createCell(1).setCellValue(vo.getKsId());
             row.createCell(2).setCellValue(vo.getAccountId());
             row.createCell(3).setCellValue(vo.getAccountName());

+ 11 - 12
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/controller/ExportReportController.java

@@ -36,13 +36,13 @@ public class ExportReportController {
     //结算单-日期修改-master
     @ApiOperation(value = "财务结算-结算单导出-头条", notes = "财务结算-结算单导出-头条")
     @GetMapping(value = "/settlementReportBytedance")
-    public Result settlementReportBytedance(SettlementFileParamsVo paramsVo, HttpServletResponse response) throws Exception{
+    public Result settlementReportBytedance(SettlementFileParamsVo paramsVo, HttpServletResponse response) throws Exception {
         SysUser user = userService.getById(paramsVo.getUserId());
         String date = paramsVo.getUploadYears();
-        if(null == date||date.equals("")){
-            paramsVo.setUploadYears(DateUtils.formatDate(new Date(),"yyyy-MM"));
+        if (null == date || date.equals("")) {
+            paramsVo.setUploadYears(DateUtils.formatDate(new Date(), "yyyy-MM"));
         }
-        return reportSettlementService.settlementReportBytedance(paramsVo,response,user);
+        return reportSettlementService.settlementReportBytedance(paramsVo, response, user);
     }
 
 
@@ -50,26 +50,25 @@ public class ExportReportController {
     @GetMapping(value = "/settlementReportKuaiShou")
     public Result settlementReportKuaiShou(SettlementFileParamsVo paramsVo, HttpServletResponse response) {
         SysUser user = userService.getById(paramsVo.getUserId());
-        String date = paramsVo.getUploadYears();
-        if(null == date||date.equals("")){
-            paramsVo.setUploadYears(DateUtils.formatDate(new Date(),"yyyy-MM"));
+        String date = paramsVo.getStartTime();
+        if (null == date || date.equals("")) {
+            return Result.errorMsg("请选择日期");
         }
-        return reportSettlementService.settlementReportKuaiShou(paramsVo,response,user);
+        return reportSettlementService.settlementReportKuaiShou(paramsVo, response, user);
     }
 
 
-
     @ApiOperation(value = "财务结算-利润表导出-头条", notes = "财务结算-利润表导出-头条")
     @GetMapping(value = "/porfitReportBytedance")
     public Result porfitReportBytedance(SettlementFileParamsVo paramsVo, HttpServletResponse response) {
-        return reportSettlementService.porfitReportBytedance(paramsVo,response);
+        return reportSettlementService.porfitReportBytedance(paramsVo, response);
     }
 
 
     @ApiOperation(value = "财务结算-利润表导出-快手", notes = "财务结算-利润表导出-快手")
     @GetMapping(value = "/porfitReportKuaiShou")
     public Result porfitReportKuaiShou(SettlementFileParamsVo paramsVo, HttpServletResponse response) {
-        return reportSettlementService.porfitReportKuaiShou(paramsVo,response);
+        return reportSettlementService.porfitReportKuaiShou(paramsVo, response);
     }
 
 
@@ -81,7 +80,7 @@ public class ExportReportController {
 
     @ApiOperation(value = "财务结算-给运营发送消息-demo", notes = "财务结算-给运营发送消息-demo")
     @GetMapping(value = "/sendMessageToOperateDemo")
-    public Result sendMessageToOperateDemo(@RequestParam(value = "userId",required = false) String userId) {
+    public Result sendMessageToOperateDemo(@RequestParam(value = "userId", required = false) String userId) {
         return reportSettlementService.sendMessageToOperateDemo(userId);
 
     }

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

@@ -1,6 +1,6 @@
 package org.jeecg.ctop.finance.settlement.mapper;
 
-import io.lettuce.core.dynamic.annotation.Param;
+import org.apache.ibatis.annotations.Param;
 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;
@@ -28,7 +28,7 @@ public interface ReportSettlementMapper {
      */
     List<SettlementReportBytedanceVo> getAccountTransactionDayBytedance(SettlementFileParamsVo paramsVo);
 
-    List<Map<String,Object>> getAccountTransactionDayBytedanceSheet(@Param("accountIds") List<String> accountIds,@Param("uploadYears")String uploadYears);
+    List<Map<String,Object>> getAccountTransactionDayBytedanceSheet(@Param("accountIds") List<String> accountIds, @Param("uploadYears")String uploadYears);
 
 
 
@@ -62,7 +62,7 @@ public interface ReportSettlementMapper {
      * @param accountId
      * @return
      */
-   List<String> getAccountImagesBytedance(@Param("accountId") String accountId,@Param("uploadYears")String uploadYears);
+   List<String> getAccountImagesBytedance(@Param("accountId") String accountId,@Param("time")String time);
 
 
     /**

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

@@ -31,11 +31,11 @@
                           and account_id = #{accountId}
                     ) t
                 WHERE
-                    DATE_FORMAT( t.date, '%Y-%m' ) = #{uploadYears}
+                    t.date >= DATE_FORMAT( #{startTime}, '%Y%m%d' )
+                    and t.date &lt;= DATE_FORMAT(#{endTime}, '%Y%m%d' )
                 ORDER BY
                     t.date
-                    LIMIT 31
-            ) a
+             ) a
                 LEFT JOIN (
                 SELECT
                     t.*,
@@ -61,16 +61,12 @@
                         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}
+                    DATE_FORMAT( t.date, '%Y-%m-%d' ) >= #{startTime}
+                    AND DATE_FORMAT( t.date, '%Y-%m-%d' ) &lt;= #{endTime}
                 ORDER BY
                     date
-                    LIMIT 31
-            ) b ON a.accountId = b.accountIdF
+             ) b ON a.accountId = b.accountIdF
                 AND a.date = b.date
-            LIMIT 31
-
     </select>
-
-
 </mapper>
 

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

@@ -5,34 +5,38 @@
     <!-- 获取头条 账户 日流水信息 -->
     <select id="getAccountTransactionDayBytedance"
             resultType="org.jeecg.ctop.finance.settlement.entity.vo.SettlementReportBytedanceVo">
-        select t.*,c.auth_name 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,
-        (
-        SELECT
-        DISTINCT ag.agent_id
-        from
-        ctop_cwjs_agent_info ag
-        LEFT JOIN ctop_agent_account ac on ag.agent_id = ac.agent_id
-        where ag.`status` = 0
-        and ag.enabled = 0
-        and ac.account_id = #{accountId} limit 1) as agentId,
-        (
-        SELECT
-        DISTINCT ag.name
-        from
-        ctop_cwjs_agent_info ag
-        LEFT JOIN ctop_agent_account ac on ag.agent_id = ac.agent_id
-        where ag.`status` = 0
-        and ag.enabled = 0
-        and ac.account_id = #{accountId} limit 1) as agentName
-         from
-        ctop_account_transaction_day
-        where cost >0
-        and advertiser_id = #{accountId}
-            )t
-      LEFT JOIN ctop_user_allocation c on t.advertiser_id = c.account_id
+        select t.*, c.auth_name 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,
+                  (
+                  SELECT
+                  DISTINCT ag.agent_id
+                  from
+                  ctop_cwjs_agent_info ag
+                  LEFT JOIN ctop_agent_account ac on ag.agent_id = ac.agent_id
+                  where ag.`status` = 0
+                  and ag.enabled = 0
+                  and ac.account_id =
+                     #{accountId} limit 1) as agentId,
+                  (
+                  SELECT
+                  DISTINCT ag.name
+                  from
+                  ctop_cwjs_agent_info ag
+                  LEFT JOIN ctop_agent_account ac on ag.agent_id = ac.agent_id
+                  where ag.`status` = 0
+                  and ag.enabled = 0
+                  and ac.account_id =
+                     #{accountId} limit 1) as agentName
+              from
+                  ctop_account_transaction_day
+              where cost
+                  >0
+                and advertiser_id = #{accountId}
+             ) t
+                 LEFT JOIN ctop_user_allocation c on t.advertiser_id = c.account_id
         where uploadYears = #{uploadYears}
         ORDER BY date
     </select>
@@ -167,32 +171,32 @@
 
     <!-- 查询 头条 账户 图片-->
     <select id="getAccountImagesBytedance" resultType="java.lang.String">
-        SELECT
-        file_url as fileUrl
-        FROM
-        ctop_cwjs_settlement_file_info
+        SELECT file_url as fileUrl
+        FROM ctop_cwjs_settlement_file_info
         where del_flag = 0
-        AND account_id = #{accountId}
-        AND upload_years = #{uploadYears}
+          AND account_id = #{accountId}
+          AND upload_years = DATE_FORMAT(#{time}, '%Y-%m')
     </select>
 
     <!-- 获取快手 账户 日流水信息  账户维度-->
     <select id="getAccountTransactionDayKuaiShou"
             resultType="org.jeecg.ctop.finance.settlement.entity.vo.SettlementReportKuaiShouVo">
-        select t.*,c.auth_name as accountName,
-               base.user_id as ksId from (select id,
-                                                           advertiser_id,
-                                                        date,DATE_FORMAT(date,'%Y-%m') as uploadYears,
-                                                        daily_charge,real_charged,contract_rebate_real_charged,direct_rebate_real_charged,
-                                                        daily_transfer_in,daily_transfer_out,balance,
-                                                        real_recharged,contract_rebate_real_recharged,direct_rebate_real_recharged,
-                                                      create_time
-                                                    from
-                                                        `application`.kuaishou_advertiser_fund_daily_flows
-                                                    where advertiser_id = #{accountId}
-                                                   )t
-                                                       LEFT JOIN ctop_user_allocation c on t.account_id = c.account_id
-                                                       LEFT JOIN ctop_kuaishou_advertiser_base_info base on base.account_id = t.account_id
+        select t.*,
+               c.auth_name  as accountName,
+               base.user_id as ksId
+        from (select id,
+                     advertiser_id,
+                  date, DATE_FORMAT(date, '%Y-%m') as uploadYears,
+                  daily_charge, real_charged, contract_rebate_real_charged, direct_rebate_real_charged,
+                  daily_transfer_in, daily_transfer_out, balance,
+                  real_recharged, contract_rebate_real_recharged, direct_rebate_real_recharged,
+                  create_time
+              from
+                  `application`.kuaishou_advertiser_fund_daily_flows
+              where advertiser_id = #{accountId}
+             ) t
+                 LEFT JOIN ctop_user_allocation c on t.account_id = c.account_id
+                 LEFT JOIN ctop_kuaishou_advertiser_base_info base on base.account_id = t.account_id
         where uploadYears = #{uploadYears}
     </select>
 
@@ -200,13 +204,10 @@
     <select id="getAccountTransactionDayKuaiShouAgent"
             resultType="org.jeecg.ctop.finance.settlement.entity.vo.SettlementReportKuaiShouVo">
 
-        SELECT
-            t.*
-        FROM
-            (
-                SELECT
-                    account_id,
-                    date_time AS date,
+        SELECT t.*
+        FROM (
+                 SELECT account_id,
+                        date_time AS date,
 		DATE_FORMAT( date_time, '%Y-%m' ) AS uploadYears,
 		user_id AS ksId,
 		total_charged_in_yuan AS dailyCharge,
@@ -215,30 +216,23 @@
 		(real_charged_in_yuan + total_rebate_real_charged_in_yuan + credit_real_charged_in_yuan) as realCharged,
 		account_name as accountName,
 		create_time
-                FROM
-                    ctop_kuaishou_daily_agent
-                WHERE
-                    account_id = #{accountId}
-            ) t
-        WHERE
-            t.uploadYears = #{uploadYears}
-        ORDER BY
-            t.date
+                 FROM
+                     ctop_kuaishou_daily_agent
+                 WHERE
+                     account_id = #{accountId}
+             ) t
+        WHERE t.uploadYears = #{uploadYears}
+        ORDER BY t.date
     </select>
 
     <!-- 获取快手 账户 日流水信息  代理商 和 账户 维度-->
     <select id="getTransactionDayKuaiShouAgentAndAccount"
             resultType="org.jeecg.ctop.finance.settlement.entity.vo.SettlementReportKuaiShouVo">
-        SELECT
-            *
-        FROM
-            (
-                SELECT
-                    t.*
-                FROM
-                    (
-                        SELECT
-                            date_time as date,
+        SELECT *
+        FROM (
+                 SELECT t.*
+                 FROM (
+                          SELECT date_time as date,
                             account_id AS accountId,
                             total_charged_in_yuan as dailyCharge,
                             contract_rebate_real_charged_in_yuan as contractRebateRealCharged,
@@ -246,49 +240,42 @@
                             ( real_charged_in_yuan + total_rebate_real_charged_in_yuan + credit_real_charged_in_yuan ) realCharged,
                             account_name AS accountName,
                             user_id AS ksId
-                        FROM
-                            ctop_kuaishou_daily_agent
-                        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
-                           `application`.kuaishou_advertiser_fund_daily_flows
-                        WHERE
-                            advertiser_id = #{accountId}
-                    ) t
-                        LEFT JOIN ctop_user_allocation c ON t.accountIdF = c.account_id
-                        LEFT JOIN 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
+                          FROM
+                              ctop_kuaishou_daily_agent
+                          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
+                         `application`.kuaishou_advertiser_fund_daily_flows
+                     WHERE
+                         advertiser_id = #{accountId}
+                 ) t
+                     LEFT JOIN ctop_user_allocation c ON t.accountIdF = c.account_id
+                     LEFT JOIN 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>
 
@@ -445,29 +432,21 @@
 
     <!-- 查询 利润表  销售人员姓名 -->
     <select id="getProfitReportSale" resultType="java.util.LinkedHashMap">
-        ( SELECT
-        p.sale_id AS saleId,
-        y.realname AS saleName
-        FROM
-        ctop_user_allocation u
-        LEFT JOIN ctop_project p ON u.project_id = p.id
-        LEFT JOIN sys_user y ON y.id = p.sale_id
-        WHERE
-        u.account_id = #{accountId}
-        LIMIT 1
+        (SELECT p.sale_id  AS saleId,
+                y.realname AS saleName
+         FROM ctop_user_allocation u
+                  LEFT JOIN ctop_project p ON u.project_id = p.id
+                  LEFT JOIN sys_user y ON y.id = p.sale_id
+         WHERE u.account_id = #{accountId} LIMIT 1
         )
         UNION ALL
         (
-        SELECT
-        f.create_user_id,
-        u.realname AS saleName
-        FROM
-        ctop_cwjs_settlement_info f
-        LEFT JOIN sys_user u ON u.id = f.create_user_id
-        WHERE
-        f.del_flag = 0
-        AND f.account_id = #{accountId}
-        LIMIT 1
+            SELECT f.create_user_id,
+                   u.realname AS saleName
+            FROM ctop_cwjs_settlement_info f
+                     LEFT JOIN sys_user u ON u.id = f.create_user_id
+            WHERE f.del_flag = 0
+              AND f.account_id = #{accountId} LIMIT 1
         )
         LIMIT 1
     </select>
@@ -545,6 +524,7 @@
     <!-- 查询 快手 利润表 总花费 结算单-->
     <select id="getProfitKuaiShouAccountCostSheet" resultType="java.util.LinkedHashMap">
         SELECT
+        d.date_time as 'time',
         d.account_id as accountId,
         (SELECT ua.auth_name from ctop_user_allocation ua where ua.account_id = d.account_id) as accountName,
         d.user_id AS ksId,
@@ -650,45 +630,37 @@
 
     <!--  查询 所有已绑定用户的运营人员id -->
     <select id="getAccountOperateUserId" resultType="java.util.LinkedHashMap">
-        SELECT user_id userId,user_name userName
+        SELECT user_id userId, user_name userName
         from ctop_user_allocation
         GROUP BY user_id
     </select>
 
     <!-- 查询运营人员 绑定的账户 以及产品 -->
     <select id="getAccountAndProductByOperate" resultType="java.util.LinkedHashMap">
-        SELECT
-            c.user_id as userId,
-            c.user_name as userName,
-            c.account_id as accountId,
-            c.project_id as projectId,
-            p.product_id as productId,
-            d.product_name as productName
-        FROM
-            ctop_user_allocation c
-                LEFT JOIN ctop_project p ON c.project_id = p.id
-                LEFT JOIN ctop_product d ON p.product_id = d.id
-        WHERE
-            c.account_status = 0
-        AND p.product_id IS NOT NULL
-	AND c.user_id = #{userId}
+        SELECT c.user_id      as userId,
+               c.user_name    as userName,
+               c.account_id   as accountId,
+               c.project_id   as projectId,
+               p.product_id   as productId,
+               d.product_name as productName
+        FROM ctop_user_allocation c
+                 LEFT JOIN ctop_project p ON c.project_id = p.id
+                 LEFT JOIN ctop_product d ON p.product_id = d.id
+        WHERE c.account_status = 0
+          AND p.product_id IS NOT NULL
+          AND c.user_id = #{userId}
     </select>
 
 
     <!-- 获取快手 账户 日流水信息  代理商 和 账户 结算单 -汇总页-->
     <select id="getTransactionDayKuaiShouSheet"
             resultType="org.jeecg.ctop.finance.settlement.entity.vo.SheetKuaiShouVo">
-        SELECT
-            *,
-            IFNULL(b.balance1,0) as balance
-        FROM
-            (
-                SELECT
-                    t.*
-                FROM
-                    (
-                        SELECT
-                            date_time as date,
+        SELECT *,
+               IFNULL(b.balance1, 0) as balance
+        FROM (
+                 SELECT t.*
+                 FROM (
+                          SELECT date_time as date,
                             account_id AS accountId,
                             total_charged_in_yuan as dailyCharge,
                             contract_rebate_real_charged_in_yuan as contractRebateRealCharged,
@@ -696,52 +668,45 @@
                             ( real_charged_in_yuan + total_rebate_real_charged_in_yuan + credit_real_charged_in_yuan ) realCharged,
                             account_name AS accountName,
                             user_id AS ksId
-                        FROM
-                            ctop_kuaishou_daily_agent
-                        WHERE
-                            total_charged_in_yuan >0
-                          and account_id = #{accountId}
-                    ) t
-                WHERE
-                   t.date &gt;= #{startTime}
-                  AND t.date &lt;= #{endTime}
-                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,
-                             daily_charge as flowDailyCharge,
-                            date,
-                            daily_transfer_in as dailyTransferIn,
-                            daily_transfer_out as dailyTransferOut,
-                            IFNULL(balance,0) as balance1,
-                            real_recharged as realRecharged,
-                            contract_rebate_real_recharged as contractRebateRealRecharged,
-                            direct_rebate_real_recharged as directRebateRealRecharged
-                        FROM
-                             `application`.kuaishou_advertiser_fund_daily_flows
-                        WHERE
-                            advertiser_id = #{accountId}
-                    ) t
-                        LEFT JOIN ctop_user_allocation c ON t.accountIdF = c.account_id
-                        LEFT JOIN ctop_kuaishou_advertiser_base_info base ON base.account_id = t.accountIdF
-                WHERE
-                   t.date &gt;= #{startTime}
-                  AND t.date &lt;= #{endTime}
-                ORDER BY
-                    date
-                    LIMIT 31
-            ) b ON a.accountId = b.accountIdF
-                AND a.date = b.date
-            LIMIT 31
+                          FROM
+                              ctop_kuaishou_daily_agent
+                          WHERE
+                              total_charged_in_yuan
+                              >0
+                            and account_id = #{accountId}
+                      ) t
+                 WHERE t.date &gt;= #{startTime}
+                   AND t.date &lt;= #{endTime}
+                 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,
+                            daily_charge  as flowDailyCharge,
+                         date,
+                         daily_transfer_in as dailyTransferIn,
+                         daily_transfer_out as dailyTransferOut,
+                         IFNULL(balance, 0) as balance1,
+                         real_recharged as realRecharged,
+                         contract_rebate_real_recharged as contractRebateRealRecharged,
+                         direct_rebate_real_recharged as directRebateRealRecharged
+                     FROM
+                         `application`.kuaishou_advertiser_fund_daily_flows
+                     WHERE
+                         advertiser_id = #{accountId}
+                 ) t
+                     LEFT JOIN ctop_user_allocation c ON t.accountIdF = c.account_id
+                     LEFT JOIN ctop_kuaishou_advertiser_base_info base ON base.account_id = t.accountIdF
+            WHERE t.date &gt;= #{startTime}
+              AND t.date &lt;= #{endTime}
+            ORDER BY
+                date
+                LIMIT 31
+        ) b ON a.accountId = b.accountIdF
+            AND a.date = b.date LIMIT 31
 
     </select>
 

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

@@ -60,6 +60,7 @@ import java.io.*;
 import java.net.URL;
 import java.net.URLEncoder;
 import java.text.MessageFormat;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.List;
@@ -97,6 +98,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
     public List<SettlementReportBytedanceVo> getAccountTransactionDayBytedance() {
         return reportSettlementMapper.getAccountTransactionDayBytedance(null);
     }
+
     @Override
     public Result settlementReportBytedance(SettlementFileParamsVo paramsVo, HttpServletResponse response, SysUser user) {
         try {
@@ -118,9 +120,9 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
 
 
             //查询 账户id
-            List<String> accountIdList = this.getAccountId(paramsVo,user);
+            List<String> accountIdList = this.getAccountId(paramsVo, user);
 
-            if (Check.isNull(accountIdList)){
+            if (Check.isNull(accountIdList)) {
                 return Result.errorMsg("该广告主和产品下无法查询到绑定的账户信息");
             }
 
@@ -128,9 +130,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
 
 
             //设置第一个sheet页 汇总页
-            createSheetService.createBytedance(wb,style,accountIdList,paramsVo.getUploadYears());
-
-
+            createSheetService.createBytedance(wb, style, accountIdList, paramsVo.getUploadYears());
 
 
             for (int k = 0; k < accountIdList.size(); k++) {
@@ -139,7 +139,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
 
                 //获取账户 日流水数据  根据账户id 和 年月 查询数据
                 List<SettlementReportBytedanceVo> settlementList = reportSettlementMapper.getAccountTransactionDayBytedance(paramsVo);
-                if (Check.isNull(settlementList)){
+                if (Check.isNull(settlementList)) {
                     num++;
                     continue;
                 }
@@ -154,7 +154,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                 HSSFRow row0 = sheet.createRow(0);
                 HSSFCell cell0 = row0.createCell(0);
                 //设置 第一行 表头
-                cell0.setCellValue(paramsVo.getUploadYears()+"-头条结算单");
+                cell0.setCellValue(paramsVo.getUploadYears() + "-头条结算单");
                 CellRangeAddress region = new CellRangeAddress(0, 0, 0, 10);
                 sheet.addMergedRegion(region);//合并行
                 cell0.setCellStyle(style);
@@ -238,9 +238,9 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                 }
 
                 //查询 图片 url
-                List<String> imageUrlList = reportSettlementMapper.getAccountImagesBytedance(accountId,paramsVo.getUploadYears());
+                List<String> imageUrlList = reportSettlementMapper.getAccountImagesBytedance(accountId, paramsVo.getUploadYears());
 
-                if (!Check.isNull(imageUrlList)){
+                if (!Check.isNull(imageUrlList)) {
                     for (int j = 0; j < imageUrlList.size(); j++) {
                         //先把读进来的图片放到一个ByteArrayOutputStream中,以便产生ByteArray
                         ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
@@ -253,11 +253,11 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                         Image imageTookittitle = Toolkit.getDefaultToolkit().createImage(url);
                         BufferedImage bufferImg = createExcelByTemplate.toBufferedImage(imageTookittitle);
                         ImageIO.write(bufferImg, imagePath.substring(imagePath.lastIndexOf(".") + 1), byteArrayOut);
-                        int startIndex = settlementList.size() +6;
-                        int hight = (int)Math.round(bufferImg.getHeight() / 28.35 / (sheet.getDefaultRowHeightInPoints() / 28.35));
-                        int width = (int)Math.round(bufferImg.getWidth() / (96/2.54) / ((sheet.getColumnWidthInPixels(settlementList.size()) / (96 / 2.54))));
+                        int startIndex = settlementList.size() + 6;
+                        int hight = (int) Math.round(bufferImg.getHeight() / 28.35 / (sheet.getDefaultRowHeightInPoints() / 28.35));
+                        int width = (int) Math.round(bufferImg.getWidth() / (96 / 2.54) / ((sheet.getColumnWidthInPixels(settlementList.size()) / (96 / 2.54))));
                         //anchor主要用于设置图片的属性
-                        HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 255, 255, (short) 0, startIndex+(5*j)+hight*j, (short) width, startIndex+(5*j)+hight*(j+1));
+                        HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 255, 255, (short) 0, startIndex + (5 * j) + hight * j, (short) width, startIndex + (5 * j) + hight * (j + 1));
                         //HSSFClientAnchor anchor2 = new HSSFClientAnchor(0, 0, 255, 255, (short) 5, settlementList.size() + 40, (short) 10, 40 * 2);
                         anchor.setAnchorType(ClientAnchor.AnchorType.DONT_MOVE_AND_RESIZE);
                         //插入图片
@@ -267,7 +267,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
 
             }
 
-            if(accountIdList.size() == num){
+            if (accountIdList.size() == num) {
                 return Result.errorMsg("暂无账户流水数据");
             }
 
@@ -276,7 +276,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
             response.setHeader("Pragma", "no-cache");
             response.setHeader("Cache-Control", "no-cache");
             response.setDateHeader("Expires", 0);
-            response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(paramsVo.getUploadYears()+"-头条结算单.xlsx", "UTF-8"));
+            response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(paramsVo.getUploadYears() + "-头条结算单.xlsx", "UTF-8"));
             OutputStream output = response.getOutputStream();
             BufferedOutputStream bufferedOutPut = new BufferedOutputStream(output);
             wb.write(bufferedOutPut);
@@ -289,53 +289,67 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
         }
         return null;
     }
+
     /**
      * @param paramsVo
      * @param user
      * @return
      */
     @Override
-    public List<String> getAccountId(SettlementFileParamsVo paramsVo,SysUser user) {
+    public List<String> getAccountId(SettlementFileParamsVo paramsVo, SysUser user) {
         String uploadYears = paramsVo.getUploadYears();
+        String startTime = paramsVo.getStartTime();
         //1:区分媒体(头条:1 快手:2)
         Integer mediaId = paramsVo.getMediaId();
         String roleCode = roleMapper.getRoleCodeByUserId(user.getId());
-        Set<String>sales = new HashSet<>();
+        Set<String> sales = new HashSet<>();
         List<String> userIds = new ArrayList<>();
-        List<UserAllocation>allocations ;
-        if("admin".equals(roleCode)|| "finance".equals(roleCode)){
+        List<UserAllocation> allocations;
+        if ("admin".equals(roleCode) || "finance".equals(roleCode)) {
             //查询所有可用的账户
             sales = null;
-        }else {
+        } else {
             //查询 销售及助理 关联对应的人员
             userIds = cwjsSaleAssistantInfoService.getCwSaleAndAssistantListStr(user.getId());
-            if (Check.isNull(userIds)){
+            if (Check.isNull(userIds)) {
                 userIds.add(user.getId());
             }
             sales.addAll(new HashSet<>(userIds));
         }
         //查询财务模块中已上传的账户
-        List<String> settlementAccountList = reportSettlementMapper.getAccountIdBytedance(sales,String.valueOf(mediaId),paramsVo.getAdvertiserId(),paramsVo.getProductId(),paramsVo.getProjectId());
+        List<String> settlementAccountList = reportSettlementMapper.getAccountIdBytedance(sales, String.valueOf(mediaId), paramsVo.getAdvertiserId(), paramsVo.getProductId(), paramsVo.getProjectId());
         //查询已绑定账户
-        allocations = userAllocationMapper.getAccountInfoBySalesId(sales,String.valueOf(mediaId),paramsVo.getAdvertiserId(),paramsVo.getProductId(),paramsVo.getProjectId());
-        return mergeAccountId(settlementAccountList,allocations,uploadYears);
+        allocations = userAllocationMapper.getAccountInfoBySalesId(sales, String.valueOf(mediaId), paramsVo.getAdvertiserId(), paramsVo.getProductId(), paramsVo.getProjectId());
+        return mergeAccountId(settlementAccountList, allocations, uploadYears, startTime);
     }
 
     //账户处理
-    private List<String> mergeAccountId(List<String> settlementAccountList, List<UserAllocation> allocations,String downloadYear) {
-        List<String>salesAccount = new ArrayList<>();
+    private List<String> mergeAccountId(List<String> settlementAccountList, List<UserAllocation> allocations, String downloadYear, String startTime) {
+        List<String> salesAccount = new ArrayList<>();
         // 账户状态 0 启动 1 禁用
-        for(UserAllocation allocation : allocations){
-            if(allocation.getAccountStatus() == 0){
-                salesAccount.add(allocation.getAccountId()+"");
+        for (UserAllocation allocation : allocations) {
+            if (allocation.getAccountStatus() == 0) {
+                salesAccount.add(allocation.getAccountId() + "");
             }
-            if(allocation.getAccountStatus() == 1){
+            if (allocation.getAccountStatus() == 1) {
                 //被关停的账户
-                Long updateDateNum = Long.parseLong(DateUtils.formatDate(allocation.getUpdateTime(),"yyyyMM"));
-                downloadYear = downloadYear.replace("-","");
-                Long downloadYearNum = Long.parseLong(downloadYear);
-                if(updateDateNum >= downloadYearNum){
-                    salesAccount.add(allocation.getAccountId()+"");
+                Long updateDateNum = Long.parseLong(DateUtils.formatDate(allocation.getUpdateTime(), "yyyyMM"));
+                if (!Check.isNull(downloadYear)) {
+                    downloadYear = downloadYear.replace("-", "");
+                    Long downloadYearNum = Long.parseLong(downloadYear);
+                    if (updateDateNum >= downloadYearNum) {
+                        salesAccount.add(allocation.getAccountId() + "");
+                    }
+                } else if (!Check.isNull(startTime)) {
+                    try {
+                        Long startTimeNum = Long.parseLong(DateUtils.formatDate(startTime, "yyyyMM"));
+                        if (updateDateNum >= startTimeNum) {
+                            salesAccount.add(allocation.getAccountId() + "");
+                        }
+                    } catch (ParseException e) {
+                        e.printStackTrace();
+                    }
+
                 }
             }
         }
@@ -366,22 +380,22 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
             style.setFont(font);
 
             //查询 需要导出的数据的账户id
-            List<String> accountIdList = this.getAccountId(paramsVo,user);
+            List<String> accountIdList = this.getAccountId(paramsVo, user);
 
 
-            if (Check.isNull(accountIdList)){
+            if (Check.isNull(accountIdList)) {
                 return Result.errorMsg("该广告主和产品下无法查询到绑定的快手账户信息");
             }
             //设置第一个sheet 汇总页-快手
-            createSheetService.createKuaiShou(wb,style,accountIdList,paramsVo.getUploadYears());
+            createSheetService.createKuaiShou(wb, style, accountIdList, paramsVo.getStartTime(), paramsVo.getEndTime());
             int num = 0;
             for (int k = 0; k < accountIdList.size(); k++) {
                 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)){
+                if (Check.isNull(settlementList)) {
                     num++;
                     continue;
                 }
@@ -396,7 +410,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                 HSSFRow row0 = sheet.createRow(0);
                 HSSFCell cell0 = row0.createCell(0);
                 //设置 第一行 表头
-                cell0.setCellValue(paramsVo.getUploadYears()+"-快手结算单");
+                cell0.setCellValue(paramsVo.getStartTime() + "~" + paramsVo.getEndTime() + "-快手结算单");
                 CellRangeAddress region = new CellRangeAddress(0, 0, 0, 10);
                 sheet.addMergedRegion(region);//合并行
                 cell0.setCellStyle(style);
@@ -486,11 +500,10 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                 }
 
 
-
                 //查询 图片 url
-                List<String> imageUrlList = reportSettlementMapper.getAccountImagesBytedance(accountId,paramsVo.getUploadYears());
+                List<String> imageUrlList = reportSettlementMapper.getAccountImagesBytedance(accountId, paramsVo.getEndTime());
 
-                if (!Check.isNull(imageUrlList)){
+                if (!Check.isNull(imageUrlList)) {
                     for (int j = 0; j < imageUrlList.size(); j++) {
                         //先把读进来的图片放到一个ByteArrayOutputStream中,以便产生ByteArray
                         ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
@@ -504,10 +517,10 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                         BufferedImage bufferImg = createExcelByTemplate.toBufferedImage(imageTookittitle);
                         ImageIO.write(bufferImg, imagePath.substring(imagePath.lastIndexOf(".") + 1), byteArrayOut);
                         //anchor主要用于设置图片的属性
-                        int startIndex = settlementList.size()+7;
-                        int hight = (int)Math.round(bufferImg.getHeight() / 28.35 / (sheet.getDefaultRowHeightInPoints() / 28.35));
-                        int width = (int)Math.round(bufferImg.getWidth() / (96/2.54) / ((sheet.getColumnWidthInPixels(settlementList.size()) / (96 / 2.54))));
-                        HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 255, 255, (short) 0, startIndex+(5*j)+hight*j, (short) width, startIndex+(5*j)+hight*(j+1));
+                        int startIndex = settlementList.size() + 7;
+                        int hight = (int) Math.round(bufferImg.getHeight() / 28.35 / (sheet.getDefaultRowHeightInPoints() / 28.35));
+                        int width = (int) Math.round(bufferImg.getWidth() / (96 / 2.54) / ((sheet.getColumnWidthInPixels(settlementList.size()) / (96 / 2.54))));
+                        HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 255, 255, (short) 0, startIndex + (5 * j) + hight * j, (short) width, startIndex + (5 * j) + hight * (j + 1));
 
                         //HSSFClientAnchor anchor2 = new HSSFClientAnchor(0, 0, 255, 255, (short) 5, settlementList.size() + 40, (short) 10, 40 * 2);
                         anchor.setAnchorType(ClientAnchor.AnchorType.DONT_MOVE_AND_RESIZE);
@@ -518,7 +531,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
 
             }
 
-            if(accountIdList.size() == num){
+            if (accountIdList.size() == num) {
                 return Result.errorMsg("暂无数据");
             }
 
@@ -527,7 +540,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
             response.setHeader("Pragma", "no-cache");
             response.setHeader("Cache-Control", "no-cache");
             response.setDateHeader("Expires", 0);
-            response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(paramsVo.getUploadYears()+"-快手结算单.xlsx", "UTF-8"));
+            response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(paramsVo.getStartTime() + "~" + paramsVo.getEndTime() + "-快手结算单.xlsx", "UTF-8"));
             OutputStream output = response.getOutputStream();
             BufferedOutputStream bufferedOutPut = new BufferedOutputStream(output);
             wb.write(bufferedOutPut);
@@ -542,10 +555,9 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
     }
 
     /**
-     *
-     * @description: 财务结算 利润表导出 头条
      * @param paramsVo
      * @param response
+     * @description: 财务结算 利润表导出 头条
      * @return: org.jeecg.common.api.vo.Result
      * @author: zianY
      */
@@ -553,38 +565,38 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
     public Result porfitReportBytedance(SettlementFileParamsVo paramsVo, HttpServletResponse response) {
         try {
             //查询 头条利润表 时间段内 所有 账户
-            List<Map<String,Object>> list = reportSettlementMapper.getProfitBytedanceAccount(paramsVo.getStartTime(),paramsVo.getEndTime());
-            if (Check.isNull(list)){
+            List<Map<String, Object>> list = reportSettlementMapper.getProfitBytedanceAccount(paramsVo.getStartTime(), paramsVo.getEndTime());
+            if (Check.isNull(list)) {
                 return Result.errorMsg("暂无数据");
             }
             List<ProfitReportBytedanceVo> resultList = new ArrayList<>(list.size());
             for (Map<String, Object> mapList : list) {
 
                 //查看账户数据
-                Map<String,Object> map = reportSettlementMapper.getProfitBytedanceAccountCost(mapList.get("accountId").toString(),paramsVo.getStartTime(),paramsVo.getEndTime());
+                Map<String, Object> map = reportSettlementMapper.getProfitBytedanceAccountCost(mapList.get("accountId").toString(), paramsVo.getStartTime(), paramsVo.getEndTime());
 
                 ProfitReportBytedanceVo voSource = new ProfitReportBytedanceVo();
-                voSource.setAccountId(map.get("accountId")+"");
+                voSource.setAccountId(map.get("accountId") + "");
 
-                voSource.setAdvertiserName(!Check.isNull(map.get("advertiserName")) ? map.getOrDefault("advertiserName","")+"" : "" );//广告主名称
+                voSource.setAdvertiserName(!Check.isNull(map.get("advertiserName")) ? map.getOrDefault("advertiserName", "") + "" : "");//广告主名称
                 //产品名称
-                voSource.setProductName(!Check.isNull(map.get("productName")) ? map.getOrDefault("productName","")+"" : "" );
+                voSource.setProductName(!Check.isNull(map.get("productName")) ? map.getOrDefault("productName", "") + "" : "");
 
 
                 //查询销售
-                Map<String,Object> slaeMap = reportSettlementMapper.getProfitReportSale(map.get("accountId")+"");
-                voSource.setSaleName(Check.isNull(slaeMap) ? "" : slaeMap.getOrDefault("saleName","")+"");//销售
+                Map<String, Object> slaeMap = reportSettlementMapper.getProfitReportSale(map.get("accountId") + "");
+                voSource.setSaleName(Check.isNull(slaeMap) ? "" : slaeMap.getOrDefault("saleName", "") + "");//销售
                 //查询运营
-                Map<String,Object> operateMap = reportSettlementMapper.getProfitReportOperateAndArea(map.get("accountId")+"");
-                if (!Check.isNull(operateMap)){
-                    voSource.setOperateName(operateMap.getOrDefault("operateName","")+"");//运营
-                    voSource.setOperateArea(operateMap.getOrDefault("operateArea","")+"");//运营所属区域
+                Map<String, Object> operateMap = reportSettlementMapper.getProfitReportOperateAndArea(map.get("accountId") + "");
+                if (!Check.isNull(operateMap)) {
+                    voSource.setOperateName(operateMap.getOrDefault("operateName", "") + "");//运营
+                    voSource.setOperateArea(operateMap.getOrDefault("operateArea", "") + "");//运营所属区域
                 }
                 //政策所有时间点
                 List<String> policyDaysList = new ArrayList<>();
-                if (!Check.isNull(map.get("productName"))){
+                if (!Check.isNull(map.get("productName"))) {
                     //查询 头条利润表  返点类型和比列
-                    List<Map<String,Object>> rateMap = reportSettlementMapper.getProfitBytedance(map.get("advertiserName")+"",map.get("productName")+"",slaeMap.get("saleId")+"","1",paramsVo.getStartTime(),paramsVo.getEndTime());
+                    List<Map<String, Object>> rateMap = reportSettlementMapper.getProfitBytedance(map.get("advertiserName") + "", map.get("productName") + "", slaeMap.get("saleId") + "", "1", paramsVo.getStartTime(), paramsVo.getEndTime());
                     List listPolicyTIme = new ArrayList();
                     for (Map<String, Object> rate : rateMap) {
                         listPolicyTIme.add(rate.get("policyStartDate"));
@@ -594,10 +606,10 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                     List<Object> times = SettlementUtil.sortlistTest(listPolicyTIme);
                     // 使用政策的时间段 拼接 开始 和 截至 时间
                     List<Map<String, String>> arrayList = new ArrayList<>();
-                    for ( int i = 0; i < times.size(); i++) {
+                    for (int i = 0; i < times.size(); i++) {
                         HashMap<String, String> mapTime = new HashMap<>();
                         mapTime.put("startDate", times.get(i).toString());
-                        mapTime.put("endDate",  times.size() < 2 ? times.get(i).toString() : times.get(i + 1).toString());
+                        mapTime.put("endDate", times.size() < 2 ? times.get(i).toString() : times.get(i + 1).toString());
                         i += 1;
                         arrayList.add(mapTime);
                     }
@@ -606,64 +618,64 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                     for (Map<String, String> stringMap : arrayList) {
                         ProfitReportBytedanceVo vo = new ProfitReportBytedanceVo();
                         //使用政策 返点类型和比例
-                        Map<String,Object>  policyRateMap = reportSettlementMapper.getProfitRebate(map.get("advertiserName")+"",map.get("productName")+"",slaeMap.get("saleId")+"","1",stringMap.get("startDate"),stringMap.get("endDate"));
-                        if (!Check.isNull(policyRateMap)){
-                            if(Integer.valueOf(policyRateMap.get("rebateType").toString())== 0){
+                        Map<String, Object> policyRateMap = reportSettlementMapper.getProfitRebate(map.get("advertiserName") + "", map.get("productName") + "", slaeMap.get("saleId") + "", "1", stringMap.get("startDate"), stringMap.get("endDate"));
+                        if (!Check.isNull(policyRateMap)) {
+                            if (Integer.valueOf(policyRateMap.get("rebateType").toString()) == 0) {
                                 vo.setRebateType("返现");//返点类型
-                            }else if (Integer.valueOf(policyRateMap.get("rebateType").toString())== 1){
+                            } else if (Integer.valueOf(policyRateMap.get("rebateType").toString()) == 1) {
                                 vo.setRebateType("返货");
-                            }else if (Integer.valueOf(policyRateMap.get("rebateType").toString())== 2){
+                            } else if (Integer.valueOf(policyRateMap.get("rebateType").toString()) == 2) {
                                 vo.setRebateType("返现+返货");
-                            }else if(Integer.valueOf(policyRateMap.get("rebateType").toString())== 3){
+                            } else if (Integer.valueOf(policyRateMap.get("rebateType").toString()) == 3) {
                                 vo.setRebateType("服务费");
                             }
-                            vo.setRebateRate(policyRateMap.getOrDefault("rebateRate","")+"%");//返点比列
-                        }else {
+                            vo.setRebateRate(policyRateMap.getOrDefault("rebateRate", "") + "%");//返点比列
+                        } else {
                             vo.setRebateType("");
                         }
                         // 时间段内 账户流水 信息
-                        List<Map<String,Object>> listAccount = reportSettlementMapper.getProfitBytedanceCost(map.get("accountId")+"",stringMap.get("startDate"),stringMap.get("endDate"));
+                        List<Map<String, Object>> listAccount = reportSettlementMapper.getProfitBytedanceCost(map.get("accountId") + "", stringMap.get("startDate"), stringMap.get("endDate"));
                         listAccount.removeAll(Collections.singleton(null));
-                        vo.setCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("cost","")+"");//总消耗
-                        vo.setCost(String.format("%.3f",new Double(vo.getCost())));
-                        vo.setCashCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("cashCost","")+"");//现金消耗
-                        vo.setCashCost(String.format("%.3f",new Double(vo.getCashCost())));
-                        vo.setRewardCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("rewardCost","")+"");//赠款消耗
-                        vo.setRewardCost(String.format("%.3f",new Double(vo.getRewardCost())));
-                        BeanUtils.copyProperties(voSource,vo,SettlementUtil.getNullPropertyNames(voSource));
-                        vo.setTime(stringMap.get("startDate")+"----"+stringMap.get("endDate"));
+                        vo.setCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("cost", "") + "");//总消耗
+                        vo.setCost(String.format("%.3f", new Double(vo.getCost())));
+                        vo.setCashCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("cashCost", "") + "");//现金消耗
+                        vo.setCashCost(String.format("%.3f", new Double(vo.getCashCost())));
+                        vo.setRewardCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("rewardCost", "") + "");//赠款消耗
+                        vo.setRewardCost(String.format("%.3f", new Double(vo.getRewardCost())));
+                        BeanUtils.copyProperties(voSource, vo, SettlementUtil.getNullPropertyNames(voSource));
+                        vo.setTime(stringMap.get("startDate") + "----" + stringMap.get("endDate"));
                         resultList.add(vo);
-                        policyDaysList.addAll(SettlementUtil.getAllDatesOfTwoTimes(stringMap.get("startDate"),stringMap.get("endDate")));
+                        policyDaysList.addAll(SettlementUtil.getAllDatesOfTwoTimes(stringMap.get("startDate"), stringMap.get("endDate")));
                     }
 
                 }
 
                 //不使用政策 的时间段
                 // 获取两个日期之间 所有的 时间 年-月-日
-                List<String> betweenDaysList = SettlementUtil.getAllDatesOfTwoTimes(paramsVo.getStartTime(),paramsVo.getEndTime());
+                List<String> betweenDaysList = SettlementUtil.getAllDatesOfTwoTimes(paramsVo.getStartTime(), paramsVo.getEndTime());
                 // 时间差集(所有时间段 - 使用政策的时间段)
-                List<String>  reduceList = betweenDaysList.stream().filter(item -> !policyDaysList.contains(item)).collect(Collectors.toList());
+                List<String> reduceList = betweenDaysList.stream().filter(item -> !policyDaysList.contains(item)).collect(Collectors.toList());
                 //差集拼接  开始 和 结束时间
                 List<Map<String, String>> stringList = SettlementUtil.getTime(reduceList);
                 for (Map<String, String> stringMap : stringList) {
                     ProfitReportBytedanceVo vo = new ProfitReportBytedanceVo();
                     // 不使用 政策 则 返点为空
                     //政策 返点类型和比例
-                   /* Map<String,Object>  policyRateMap = reportSettlementMapper.getProfitRebate(map.get("productName")+"",stringMap.get("startDate"),stringMap.get("endDate"));
-                  */
+                    /* Map<String,Object>  policyRateMap = reportSettlementMapper.getProfitRebate(map.get("productName")+"",stringMap.get("startDate"),stringMap.get("endDate"));
+                     */
                     vo.setRebateType("");//返点类型
                     vo.setRebateRate("");//返点比列
                     //账户流水 信息
-                    List<Map<String,Object>> listAccount = reportSettlementMapper.getProfitBytedanceCost(map.get("accountId")+"",stringMap.get("startDate"),stringMap.get("endDate"));
+                    List<Map<String, Object>> listAccount = reportSettlementMapper.getProfitBytedanceCost(map.get("accountId") + "", stringMap.get("startDate"), stringMap.get("endDate"));
                     listAccount.removeAll(Collections.singleton(null));
-                    vo.setCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("cost","")+"");//总消耗
-                    vo.setCost(String.format("%.3f",new Double(vo.getCost())));
-                    vo.setCashCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("cashCost","")+"");//现金消耗
-                    vo.setCashCost(String.format("%.3f",new Double(vo.getCashCost())));
-                    vo.setRewardCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("rewardCost","")+"");//赠款消耗
-                    vo.setRewardCost(String.format("%.3f",new Double(vo.getRewardCost())));
-                    BeanUtils.copyProperties(voSource,vo,SettlementUtil.getNullPropertyNames(voSource));
-                    vo.setTime((!Check.isNull(vo.getRebateType()) ? stringMap.get("startDate")+"----"+stringMap.get("endDate") : ""));
+                    vo.setCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("cost", "") + "");//总消耗
+                    vo.setCost(String.format("%.3f", new Double(vo.getCost())));
+                    vo.setCashCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("cashCost", "") + "");//现金消耗
+                    vo.setCashCost(String.format("%.3f", new Double(vo.getCashCost())));
+                    vo.setRewardCost(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("rewardCost", "") + "");//赠款消耗
+                    vo.setRewardCost(String.format("%.3f", new Double(vo.getRewardCost())));
+                    BeanUtils.copyProperties(voSource, vo, SettlementUtil.getNullPropertyNames(voSource));
+                    vo.setTime((!Check.isNull(vo.getRebateType()) ? stringMap.get("startDate") + "----" + stringMap.get("endDate") : ""));
                     resultList.add(vo);
                 }
             }
@@ -685,10 +697,9 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
     }
 
     /**
-     *
-     * @description: 财务结算 利润表导出 快手
      * @param paramsVo
      * @param response
+     * @description: 财务结算 利润表导出 快手
      * @return: org.jeecg.common.api.vo.Result
      * @author: zianY
      */
@@ -697,18 +708,18 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
 
         try {
             //查询 快手利润表  时间段内的 所有账户
-            List<Map<String,Object>> list = reportSettlementMapper.getProfitKuaiShouAgentAccount(paramsVo.getStartTime(),paramsVo.getEndTime());
-            if (Check.isNull(list)){
+            List<Map<String, Object>> list = reportSettlementMapper.getProfitKuaiShouAgentAccount(paramsVo.getStartTime(), paramsVo.getEndTime());
+            if (Check.isNull(list)) {
                 return Result.errorMsg("暂无数据");
             }
             List<ProfitReportKuaiShouVo> resultList = new ArrayList<>(list.size());
             for (Map<String, Object> mapList : list) {
 
                 //查询账户数据信息
-               Map<String,Object> map = reportSettlementMapper.getProfitKuaiShouAccountCost(mapList.get("account_id").toString(),paramsVo.getStartTime(),paramsVo.getEndTime());
+                Map<String, Object> map = reportSettlementMapper.getProfitKuaiShouAccountCost(mapList.get("account_id").toString(), paramsVo.getStartTime(), paramsVo.getEndTime());
                 ProfitReportKuaiShouVo voSource = new ProfitReportKuaiShouVo();
                 voSource.setAccountId(map.getOrDefault("accountId", "") + "");//账户id
-                voSource.setProductName( !Check.isNull(map.get("productName")) ? map.getOrDefault("productName", "") + "" : "");//产品名称
+                voSource.setProductName(!Check.isNull(map.get("productName")) ? map.getOrDefault("productName", "") + "" : "");//产品名称
                 voSource.setKsId(map.getOrDefault("ksId", "") + "");//快手id
                 voSource.setAdvertiserName(!Check.isNull(map.get("advertiserName")) ? map.getOrDefault("advertiserName", "") + "" : "");//广告主名称
 
@@ -726,7 +737,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                 List<String> policyDaysList = new ArrayList<>();
                 if (!Check.isNull(map.get("productName"))) {
                     //查询 快手利润表  返点类型和比列
-                    List<Map<String, Object>> rateMap = reportSettlementMapper.getProfitBytedance(map.get("advertiserName")+"",map.get("productName") + "", slaeMap.get("saleId")+"","2", paramsVo.getStartTime(), paramsVo.getEndTime());
+                    List<Map<String, Object>> rateMap = reportSettlementMapper.getProfitBytedance(map.get("advertiserName") + "", map.get("productName") + "", slaeMap.get("saleId") + "", "2", paramsVo.getStartTime(), paramsVo.getEndTime());
                     List listPolicyTIme = new ArrayList();
                     for (Map<String, Object> rate : rateMap) {
                         listPolicyTIme.add(rate.get("policyStartDate"));
@@ -736,8 +747,8 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                     //政策时间 去重 排序
                     List<Object> times = SettlementUtil.sortlistTest(listPolicyTIme);
                     // 使用政策的时间段 拼接 开始 和 截至 时间
-                     List<Map<String, String>> arrayList = new ArrayList<>();
-                    if (!Check.isNull(times)){
+                    List<Map<String, String>> arrayList = new ArrayList<>();
+                    if (!Check.isNull(times)) {
                         for (int i = 0; i < times.size(); i++) {
                             HashMap<String, String> mapTime = new HashMap<>();
                             mapTime.put("startDate", times.get(i).toString());
@@ -750,7 +761,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                     for (Map<String, String> stringMap : arrayList) {
                         ProfitReportKuaiShouVo vo = new ProfitReportKuaiShouVo();
                         //使用政策 返点类型和比例
-                        Map<String, Object> policyRateMap = reportSettlementMapper.getProfitRebate(map.get("advertiserName")+"",map.get("productName") + "", slaeMap.get("saleId")+"","2",stringMap.get("startDate"), stringMap.get("endDate"));
+                        Map<String, Object> policyRateMap = reportSettlementMapper.getProfitRebate(map.get("advertiserName") + "", map.get("productName") + "", slaeMap.get("saleId") + "", "2", stringMap.get("startDate"), stringMap.get("endDate"));
                         if (!Check.isNull(policyRateMap)) {
                             if (Integer.valueOf(policyRateMap.get("rebateType").toString()) == 0) {
                                 vo.setRebateType("返现");//返点类型
@@ -758,7 +769,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                                 vo.setRebateType("返货");
                             } else if (Integer.valueOf(policyRateMap.get("rebateType").toString()) == 2) {
                                 vo.setRebateType("返现+返货");
-                            }else if(Integer.valueOf(policyRateMap.get("rebateType").toString())== 3){
+                            } else if (Integer.valueOf(policyRateMap.get("rebateType").toString()) == 3) {
                                 vo.setRebateType("服务费");
                             }
                             vo.setRebateRate(policyRateMap.getOrDefault("rebateRate", "") + "%");//返点比列
@@ -823,10 +834,8 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
 
 
     /**
-     *
-     * @description: 给运营发送消息
-     *
      * @param
+     * @description: 给运营发送消息
      * @return: org.jeecg.common.api.vo.Result
      * @author: zianY
      */
@@ -837,27 +846,27 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
         int productNum = 0;
         int accountNum = 0;
         String productInfo = null;
-        String message =  "{0},您好!您{1}月份有{2}个产品的账户需要进行媒体后台消耗截图上传,共计{3}个账户。产品分别为:{4}。请及时上传,多谢配合!";
+        String message = "{0},您好!您{1}月份有{2}个产品的账户需要进行媒体后台消耗截图上传,共计{3}个账户。产品分别为:{4}。请及时上传,多谢配合!";
         //查询所有 运营绑定的账户
-        List<Map<String,Object>> userList = reportSettlementMapper.getAccountOperateUserId();
+        List<Map<String, Object>> userList = reportSettlementMapper.getAccountOperateUserId();
         for (Map<String, Object> userMap : userList) {
-             String userId = userMap.get("userId").toString();
+            String userId = userMap.get("userId").toString();
             //查询运营下的 账户 和 产品信息
-            List<Map<String,Object>> productList = reportSettlementMapper.getAccountAndProductByOperate(userId);
-            if (Check.isNull(productList)){
+            List<Map<String, Object>> productList = reportSettlementMapper.getAccountAndProductByOperate(userId);
+            if (Check.isNull(productList)) {
                 continue;
             }
             //产品名称
             List product = productList.stream().map(map -> map.get("productName")).distinct().collect(Collectors.toList());
             productNum = product.size();
             accountNum = productList.size();
-            productInfo = StringUtils.join(product.toArray(),"、");
+            productInfo = StringUtils.join(product.toArray(), "、");
             //发送微信通知
-            JSONObject jsonObject =  mailLogMapper.getWChatIdByUserId(userId);
-            String msg = MessageFormat.format(message,userMap.get("userName").toString(),month,productNum,accountNum,productInfo);
-            corpWexinUtils.sendMessageByWeChatId(jsonObject,msg);
+            JSONObject jsonObject = mailLogMapper.getWChatIdByUserId(userId);
+            String msg = MessageFormat.format(message, userMap.get("userName").toString(), month, productNum, accountNum, productInfo);
+            corpWexinUtils.sendMessageByWeChatId(jsonObject, msg);
         }
-        return Result.successMsg("成功",null);
+        return Result.successMsg("成功", null);
     }
 
     @Override
@@ -867,28 +876,28 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
         int productNum = 0;
         int accountNum = 0;
         String productInfo = null;
-        String message =  "{0},您好!您{1}月份有{2}个产品的账户需要进行媒体后台消耗截图上传,共计{3}个账户。产品分别为:{4}。请及时上传,多谢配合!";
+        String message = "{0},您好!您{1}月份有{2}个产品的账户需要进行媒体后台消耗截图上传,共计{3}个账户。产品分别为:{4}。请及时上传,多谢配合!";
 
         //查询所有 运营绑定的账户
-        List<Map<String,Object>> userList = reportSettlementMapper.getAccountOperateUserId();
+        List<Map<String, Object>> userList = reportSettlementMapper.getAccountOperateUserId();
         for (Map<String, Object> userMap : userList) {
-             String realUserId = userMap.get("userId").toString();
+            String realUserId = userMap.get("userId").toString();
             //查询运营下的 账户 和 产品信息
-            List<Map<String,Object>> productList = reportSettlementMapper.getAccountAndProductByOperate(realUserId);
-            if (Check.isNull(productList)){
+            List<Map<String, Object>> productList = reportSettlementMapper.getAccountAndProductByOperate(realUserId);
+            if (Check.isNull(productList)) {
                 continue;
             }
             //产品名称
             List product = productList.stream().map(map -> map.get("productName")).distinct().collect(Collectors.toList());
             productNum = product.size();
             accountNum = productList.size();
-            productInfo = StringUtils.join(product.toArray(),"、");
+            productInfo = StringUtils.join(product.toArray(), "、");
             //发送微信通知
-            JSONObject jsonObject =  mailLogMapper.getWChatIdByUserId(Check.isNull(userId) ? "f990f815ecef43fab9cbe1bb22bb6d63" : userId);
-            String msg = MessageFormat.format(message,userMap.get("userName").toString(),month,productNum,accountNum,productInfo);
-            corpWexinUtils.sendMessageByWeChatId(jsonObject,msg);
+            JSONObject jsonObject = mailLogMapper.getWChatIdByUserId(Check.isNull(userId) ? "f990f815ecef43fab9cbe1bb22bb6d63" : userId);
+            String msg = MessageFormat.format(message, userMap.get("userName").toString(), month, productNum, accountNum, productInfo);
+            corpWexinUtils.sendMessageByWeChatId(jsonObject, msg);
         }
-        return Result.successMsg("发送微信通知成功-test",null);
+        return Result.successMsg("发送微信通知成功-test", null);
     }
 
     @Resource
@@ -900,11 +909,11 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
     @Override
     public void cwjsPRofit(CwjsPolicyInfo cwjsPolicyInfo) {
         // 获取两个日期之间 所有的 时间 年-月-日
-        List<String> betweenDaysList = SettlementUtil.getAllDatesOfTwoTimes(cwjsPolicyInfo.getPolicyStartDate(),cwjsPolicyInfo.getPolicyEndDate());
+        List<String> betweenDaysList = SettlementUtil.getAllDatesOfTwoTimes(cwjsPolicyInfo.getPolicyStartDate(), cwjsPolicyInfo.getPolicyEndDate());
         //查看 政策下的产品
         List<CwjsPolicyProduct> productList = cwjsPolicyProductMapper.queryProductsByPolicyId(cwjsPolicyInfo.getId());
-        if (!Check.isNull(productList)){
-            if (!Check.isNull(betweenDaysList)){
+        if (!Check.isNull(productList)) {
+            if (!Check.isNull(betweenDaysList)) {
                 List<CtopCwjsSlettementReport> reportList = new ArrayList<>();
                 for (CwjsPolicyProduct product : productList) {
                     for (String day : betweenDaysList) {
@@ -933,7 +942,6 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
         policyApprovalLogMapper.insert(policyApprovalLog);
 
 
-
     }
 
     @Resource
@@ -959,10 +967,10 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
             }
 
             for (PolicyImportVo importVo : importResult.getList()) {
-                if (cn.com.ctop.common.module.utils.Check.isNull(importVo.getCompanyName())){
+                if (cn.com.ctop.common.module.utils.Check.isNull(importVo.getCompanyName())) {
                     continue;
                 }
-                if (cn.com.ctop.common.module.utils.Check.isNull(importVo.getPolicyProductName())){
+                if (cn.com.ctop.common.module.utils.Check.isNull(importVo.getPolicyProductName())) {
                     continue;
                 }
                 List<String> productNameList = Arrays.asList(importVo.getPolicyProductName().split("-"));
@@ -989,16 +997,16 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
 
                 CwjsPolicyInfo policy = cwjsPolicyInfoMapper.getPolicyInfo(cwjsPolicyInfo);
 
-                if (cn.com.ctop.common.module.utils.Check.isNull(policy)){
+                if (cn.com.ctop.common.module.utils.Check.isNull(policy)) {
                     cwjsPolicyInfoMapper.insert(cwjsPolicyInfo);
                     policy = cwjsPolicyInfoMapper.getPolicyInfo(cwjsPolicyInfo);
                 }
 
                 //查看 政策下的产品
                 List<CwjsPolicyProduct> productList = cwjsPolicyProductMapper.queryProductsByPolicyId(policy.getId());
-                List proList = productList.stream().map(CwjsPolicyProduct:: getPolicyProductName).collect(Collectors.toList());
+                List proList = productList.stream().map(CwjsPolicyProduct::getPolicyProductName).collect(Collectors.toList());
                 for (String str : productNameList) {
-                    if (!proList.contains(str)){
+                    if (!proList.contains(str)) {
                         //新增产品
                         CwjsPolicyProduct policyProduct = new CwjsPolicyProduct();
                         policyProduct.setPolicyId(policy.getId());
@@ -1018,7 +1026,4 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
     }
 
 
-
-
-
 }