|
@@ -5,6 +5,7 @@ import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|
import cn.com.ctop.common.module.mapper.MailLogMapper;
|
|
import cn.com.ctop.common.module.mapper.MailLogMapper;
|
|
import cn.com.ctop.common.module.utils.CorpWexinUtils;
|
|
import cn.com.ctop.common.module.utils.CorpWexinUtils;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.google.gson.JsonObject;
|
|
import com.google.gson.JsonObject;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -14,25 +15,32 @@ import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
import org.apache.poi.ss.util.CellRangeAddress;
|
|
import org.apache.poi.ss.util.CellRangeAddress;
|
|
import org.jeecg.common.api.vo.Result;
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
|
+import org.jeecg.ctop.finance.policy.entity.CwjsPolicyInfo;
|
|
|
|
+import org.jeecg.ctop.finance.policy.entity.CwjsPolicyProduct;
|
|
|
|
+import org.jeecg.ctop.finance.policy.mapper.CwjsPolicyProductMapper;
|
|
import org.jeecg.ctop.finance.policy.utils.Check;
|
|
import org.jeecg.ctop.finance.policy.utils.Check;
|
|
|
|
+import org.jeecg.ctop.finance.settlement.entity.pojo.CtopCwjsSettlementInfo;
|
|
|
|
+import org.jeecg.ctop.finance.settlement.entity.pojo.CtopCwjsSlettementReport;
|
|
import org.jeecg.ctop.finance.settlement.entity.vo.*;
|
|
import org.jeecg.ctop.finance.settlement.entity.vo.*;
|
|
|
|
+import org.jeecg.ctop.finance.settlement.mapper.CwjsProfitMapper;
|
|
import org.jeecg.ctop.finance.settlement.mapper.ReportSettlementMapper;
|
|
import org.jeecg.ctop.finance.settlement.mapper.ReportSettlementMapper;
|
|
|
|
+import org.jeecg.ctop.finance.settlement.mapper.SettlementInfoMapper;
|
|
import org.jeecg.ctop.finance.settlement.service.IReportSettlementService;
|
|
import org.jeecg.ctop.finance.settlement.service.IReportSettlementService;
|
|
import org.jeecg.ctop.finance.utils.SettlementUtil;
|
|
import org.jeecg.ctop.finance.utils.SettlementUtil;
|
|
import org.jeecg.ctop.finance.utils.createExcelByTemplate;
|
|
import org.jeecg.ctop.finance.utils.createExcelByTemplate;
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import javax.imageio.ImageIO;
|
|
import javax.imageio.ImageIO;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
+import javax.swing.*;
|
|
import java.awt.image.BufferedImage;
|
|
import java.awt.image.BufferedImage;
|
|
import java.io.*;
|
|
import java.io.*;
|
|
import java.net.URLEncoder;
|
|
import java.net.URLEncoder;
|
|
import java.text.MessageFormat;
|
|
import java.text.MessageFormat;
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.Calendar;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
+import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
@@ -48,6 +56,9 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
|
|
@Resource
|
|
@Resource
|
|
private MailLogMapper mailLogMapper;
|
|
private MailLogMapper mailLogMapper;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private CwjsProfitMapper cwjsProfitMapper;
|
|
|
|
+
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public List<SettlementReportBytedanceVo> getAccountTransactionDayBytedance() {
|
|
public List<SettlementReportBytedanceVo> getAccountTransactionDayBytedance() {
|
|
@@ -193,7 +204,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
|
|
ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
|
|
ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
|
|
|
|
|
|
//查询 图片 url
|
|
//查询 图片 url
|
|
- List<String> imageUrlList = reportSettlementMapper.getAccountImagesBytedance(accountId);
|
|
|
|
|
|
+ List<String> imageUrlList = reportSettlementMapper.getAccountImagesBytedance(accountId,paramsVo.getUploadYears());
|
|
|
|
|
|
if (!Check.isNull(imageUrlList)){
|
|
if (!Check.isNull(imageUrlList)){
|
|
for (int j = 0; j < imageUrlList.size(); j++) {
|
|
for (int j = 0; j < imageUrlList.size(); j++) {
|
|
@@ -202,8 +213,9 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
|
|
InputStream is = createExcelByTemplate.getInputStreamByUrl(imagePath);
|
|
InputStream is = createExcelByTemplate.getInputStreamByUrl(imagePath);
|
|
BufferedImage bufferImg = ImageIO.read(is);
|
|
BufferedImage bufferImg = ImageIO.read(is);
|
|
ImageIO.write(bufferImg, imagePath.substring(imagePath.lastIndexOf(".") + 1), byteArrayOut);
|
|
ImageIO.write(bufferImg, imagePath.substring(imagePath.lastIndexOf(".") + 1), byteArrayOut);
|
|
|
|
+ int startIndex = settlementList.size() +6;
|
|
//anchor主要用于设置图片的属性
|
|
//anchor主要用于设置图片的属性
|
|
- HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 255, 255, (short) 2, settlementList.size() + 6 +(j*40), (short) 10, 90*(j+1));
|
|
|
|
|
|
+ HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 255, 255, (short) 2, startIndex+(5*j)+50*j, (short) 10, startIndex+(5*j)+50*(j+1));
|
|
//HSSFClientAnchor anchor2 = new HSSFClientAnchor(0, 0, 255, 255, (short) 5, settlementList.size() + 40, (short) 10, 40 * 2);
|
|
//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);
|
|
anchor.setAnchorType(ClientAnchor.AnchorType.DONT_MOVE_AND_RESIZE);
|
|
//插入图片
|
|
//插入图片
|
|
@@ -214,7 +226,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
|
|
}
|
|
}
|
|
|
|
|
|
if(accountIdList.size() == num){
|
|
if(accountIdList.size() == num){
|
|
- return Result.errorMsg("暂无数据。");
|
|
|
|
|
|
+ return Result.errorMsg("暂无账户流水数据。");
|
|
}
|
|
}
|
|
|
|
|
|
response.setCharacterEncoding("UTF-8");
|
|
response.setCharacterEncoding("UTF-8");
|
|
@@ -222,7 +234,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
|
|
response.setHeader("Pragma", "no-cache");
|
|
response.setHeader("Pragma", "no-cache");
|
|
response.setHeader("Cache-Control", "no-cache");
|
|
response.setHeader("Cache-Control", "no-cache");
|
|
response.setDateHeader("Expires", 0);
|
|
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();
|
|
OutputStream output = response.getOutputStream();
|
|
BufferedOutputStream bufferedOutPut = new BufferedOutputStream(output);
|
|
BufferedOutputStream bufferedOutPut = new BufferedOutputStream(output);
|
|
wb.write(bufferedOutPut);
|
|
wb.write(bufferedOutPut);
|
|
@@ -378,7 +390,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
|
|
ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
|
|
ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
|
|
|
|
|
|
//查询 图片 url
|
|
//查询 图片 url
|
|
- List<String> imageUrlList = reportSettlementMapper.getAccountImagesBytedance(accountId);
|
|
|
|
|
|
+ List<String> imageUrlList = reportSettlementMapper.getAccountImagesBytedance(accountId,paramsVo.getUploadYears());
|
|
|
|
|
|
if (!Check.isNull(imageUrlList)){
|
|
if (!Check.isNull(imageUrlList)){
|
|
for (int j = 0; j < imageUrlList.size(); j++) {
|
|
for (int j = 0; j < imageUrlList.size(); j++) {
|
|
@@ -409,7 +421,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
|
|
response.setHeader("Pragma", "no-cache");
|
|
response.setHeader("Pragma", "no-cache");
|
|
response.setHeader("Cache-Control", "no-cache");
|
|
response.setHeader("Cache-Control", "no-cache");
|
|
response.setDateHeader("Expires", 0);
|
|
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();
|
|
OutputStream output = response.getOutputStream();
|
|
BufferedOutputStream bufferedOutPut = new BufferedOutputStream(output);
|
|
BufferedOutputStream bufferedOutPut = new BufferedOutputStream(output);
|
|
wb.write(bufferedOutPut);
|
|
wb.write(bufferedOutPut);
|
|
@@ -426,7 +438,8 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private SettlementInfoMapper settlementInfoMapper;
|
|
/**
|
|
/**
|
|
*
|
|
*
|
|
* @description: 财务结算 利润表导出 头条
|
|
* @description: 财务结算 利润表导出 头条
|
|
@@ -439,47 +452,108 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
|
|
public Result porfitReportBytedance(SettlementFileParamsVo paramsVo, HttpServletResponse response) {
|
|
public Result porfitReportBytedance(SettlementFileParamsVo paramsVo, HttpServletResponse response) {
|
|
|
|
|
|
try {
|
|
try {
|
|
- //查询 头条利润表 总花费
|
|
|
|
- List<Map<String,Object>> list = reportSettlementMapper.getProfitBytedanceCost(paramsVo.getUploadYears());
|
|
|
|
|
|
+ //查询 头条利润表 时间段内 所有 账户
|
|
|
|
+ List<Map<String,Object>> list = reportSettlementMapper.getProfitBytedanceAccountCost(null,paramsVo.getStartTime(),paramsVo.getEndTime());
|
|
if (Check.isNull(list)){
|
|
if (Check.isNull(list)){
|
|
return Result.errorMsg("暂无数据。");
|
|
return Result.errorMsg("暂无数据。");
|
|
}
|
|
}
|
|
List<ProfitReportBytedanceVo> resultList = new ArrayList<>(list.size());
|
|
List<ProfitReportBytedanceVo> resultList = new ArrayList<>(list.size());
|
|
for (Map<String, Object> map : list) {
|
|
for (Map<String, Object> map : list) {
|
|
- ProfitReportBytedanceVo vo = new ProfitReportBytedanceVo();
|
|
|
|
- vo.setCost(map.getOrDefault("cost","")+"");//总消耗
|
|
|
|
- vo.setCashCost(map.getOrDefault("cashCost","")+"");//现金消耗
|
|
|
|
- vo.setRewardCost(map.getOrDefault("rewardCost","")+"");//赠款消耗
|
|
|
|
- vo.setProductName(map.getOrDefault("productName","")+"");//产品名称
|
|
|
|
- //查询 头条利润表 销售人员姓名 以及 返点类型和比列
|
|
|
|
- Map<String,Object> slaeMap = reportSettlementMapper.getProfitBytedanceSale(map.get("productId")+"");
|
|
|
|
- if (!Check.isNull(slaeMap)){
|
|
|
|
- vo.setSaleName(slaeMap.getOrDefault("saleName","")+"");//销售
|
|
|
|
- // 当前查询时间 与 销售政策 开始 截至时间 是否匹配
|
|
|
|
- if (SettlementUtil.isEffectiveDate(paramsVo.getUploadYears(),slaeMap.get("policyStart")+"",slaeMap.get("policyEnd")+"")){
|
|
|
|
- //销售政策状态 为 通过 显示 返点类型 和 返点比列
|
|
|
|
- if (StringUtils.equals(slaeMap.getOrDefault("approvedStatus","")+"","3")){
|
|
|
|
- vo.setRebateType(slaeMap.getOrDefault("rebateType","")+"");//返点类型
|
|
|
|
- vo.setRebateRate(slaeMap.getOrDefault("rebateRate","")+"");//返点比列
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ //查看该账户 状态信息
|
|
|
|
+ QueryWrapper<CtopCwjsSettlementInfo> settlementAccountQw = new QueryWrapper<>();
|
|
|
|
+ settlementAccountQw.eq("account_id",map.get("accountId"));
|
|
|
|
+ //账户状态 0-开 1-关
|
|
|
|
+ settlementAccountQw.eq("status",0);
|
|
|
|
+ //(0,正常,1已删除)
|
|
|
|
+ settlementAccountQw.eq("del_flag",0);
|
|
|
|
+ List<CtopCwjsSettlementInfo> settlementAccountList = settlementInfoMapper.selectList(settlementAccountQw);
|
|
|
|
+ if (Check.isNull(settlementAccountList)){
|
|
|
|
+ continue;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ ProfitReportBytedanceVo voSource = new ProfitReportBytedanceVo();
|
|
|
|
+ //查询销售
|
|
|
|
+ Map<String,Object> slaeMap = reportSettlementMapper.getProfitBytedanceSale(map.get("accountId")+"");
|
|
|
|
+ voSource.setSaleName(Check.isNull(slaeMap) ? "" : slaeMap.getOrDefault("saleName","")+"");//销售
|
|
|
|
+
|
|
|
|
+ //产品名称
|
|
|
|
+ voSource.setProductName(map.getOrDefault("productName","")+"");
|
|
|
|
+
|
|
Map<String,Object> operateMap = reportSettlementMapper.getProfitBytedanceOperate(map.get("accountId")+"");
|
|
Map<String,Object> operateMap = reportSettlementMapper.getProfitBytedanceOperate(map.get("accountId")+"");
|
|
if (!Check.isNull(operateMap)){
|
|
if (!Check.isNull(operateMap)){
|
|
- vo.setAdvertiserName(operateMap.getOrDefault("advertiserName","")+"");//广告主名称
|
|
|
|
- vo.setOperateName(operateMap.getOrDefault("operateName","")+"");//运营
|
|
|
|
- vo.setOperateArea(operateMap.getOrDefault("operateArea","")+"");//运营所属区域
|
|
|
|
|
|
+ voSource.setAdvertiserName(operateMap.getOrDefault("advertiserName","")+"");//广告主名称
|
|
|
|
+ voSource.setOperateName(operateMap.getOrDefault("operateName","")+"");//运营
|
|
|
|
+ voSource.setOperateArea(operateMap.getOrDefault("operateArea","")+"");//运营所属区域
|
|
}
|
|
}
|
|
- resultList.add(vo);
|
|
|
|
- }
|
|
|
|
|
|
|
|
- Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("头条利润单", "头条利润单"), ProfitReportBytedanceVo.class, resultList);
|
|
|
|
|
|
+ //查询 头条利润表 返点类型和比列
|
|
|
|
+ List<Map<String,Object>> rateMap = reportSettlementMapper.getProfitBytedance(map.get("productName")+"","1",paramsVo.getStartTime(),paramsVo.getEndTime());
|
|
|
|
+ List listPolicyTIme = new ArrayList();
|
|
|
|
+ for (Map<String, Object> rate : rateMap) {
|
|
|
|
+ listPolicyTIme.add(rate.get("policyStartDate"));
|
|
|
|
+ listPolicyTIme.add(rate.get("policyEndDate"));
|
|
|
|
+ }
|
|
|
|
+ //政策时间 去重 排序
|
|
|
|
+ List<Object> times = SettlementUtil.sortlistTest(listPolicyTIme);
|
|
|
|
+ // 使用政策的时间段 拼接 开始 和 截至 时间
|
|
|
|
+ List<Map<String, String>> arrayList = new ArrayList<>();
|
|
|
|
+ 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.get(i+1).toString());
|
|
|
|
+ i += 1;
|
|
|
|
+ arrayList.add(mapTime);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //政策所有时间点
|
|
|
|
+ List<String> policyDaysList = new ArrayList<>();
|
|
|
|
+ for (Map<String, String> stringMap : arrayList) {
|
|
|
|
+ ProfitReportBytedanceVo vo = new ProfitReportBytedanceVo();
|
|
|
|
+ //使用政策 返点类型和比例
|
|
|
|
+ Map<String,Object> policyRateMap = reportSettlementMapper.getProfitRebate(map.get("productName")+"",stringMap.get("startDate"),stringMap.get("endDate"));
|
|
|
|
+ vo.setRebateType(policyRateMap.getOrDefault("rebateType","")+"");//返点类型
|
|
|
|
+ vo.setRebateRate(policyRateMap.getOrDefault("rebateRate","")+"");//返点比列
|
|
|
|
+ // 时间段内 账户流水 信息
|
|
|
|
+ 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","")+"");//赠款消耗
|
|
|
|
+ BeanUtils.copyProperties(voSource,vo,SettlementUtil.getNullPropertyNames(voSource));
|
|
|
|
+ resultList.add(vo);
|
|
|
|
+ policyDaysList.addAll(SettlementUtil.getAllDatesOfTwoTimes(stringMap.get("startDate"),stringMap.get("endDate")));
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ //不使用政策 的时间段
|
|
|
|
+ // 获取两个日期之间 所有的 时间 年-月-日
|
|
|
|
+ List<String> betweenDaysList = SettlementUtil.getAllDatesOfTwoTimes(paramsVo.getStartTime(),paramsVo.getEndTime());
|
|
|
|
+ // 时间差集(所有时间段 - 使用政策的时间段)
|
|
|
|
+ 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"));
|
|
|
|
+ */
|
|
|
|
+ vo.setRebateType("");//返点类型
|
|
|
|
+ vo.setRebateRate("");//返点比列
|
|
|
|
+ //账户流水 信息
|
|
|
|
+ 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","")+"");//赠款消耗
|
|
|
|
+ BeanUtils.copyProperties(voSource,vo,SettlementUtil.getNullPropertyNames(voSource));
|
|
|
|
+ resultList.add(vo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("头条利润单", "头条利润单"), ProfitReportBytedanceVo.class, resultList);
|
|
try {
|
|
try {
|
|
response.setCharacterEncoding("UTF-8");
|
|
response.setCharacterEncoding("UTF-8");
|
|
response.setHeader("content-Type", "application/vnd.ms-excel");
|
|
response.setHeader("content-Type", "application/vnd.ms-excel");
|
|
- response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("头条利润单.xls", "UTF-8"));
|
|
|
|
|
|
+ response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("头条利润单.xlsx", "UTF-8"));
|
|
workbook.write(response.getOutputStream());
|
|
workbook.write(response.getOutputStream());
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
throw new RuntimeException(e);
|
|
throw new RuntimeException(e);
|
|
@@ -519,19 +593,24 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
|
|
vo.setCost(map.getOrDefault("cost","")+"");//总消耗
|
|
vo.setCost(map.getOrDefault("cost","")+"");//总消耗
|
|
vo.setCashCost(map.getOrDefault("cashCost","")+"");//现金消耗
|
|
vo.setCashCost(map.getOrDefault("cashCost","")+"");//现金消耗
|
|
vo.setProductName(map.getOrDefault("productName","")+"");//产品名称
|
|
vo.setProductName(map.getOrDefault("productName","")+"");//产品名称
|
|
|
|
+
|
|
|
|
+ //查询销售
|
|
|
|
+ Map<String,Object> slaeMap = reportSettlementMapper.getProfitBytedanceSale(map.get("accountId")+"");
|
|
|
|
+ vo.setSaleName(Check.isNull(slaeMap) ? "" : slaeMap.getOrDefault("saleName","")+"");//销售
|
|
|
|
+
|
|
//查询 销售人员姓名 以及 返点类型和比列
|
|
//查询 销售人员姓名 以及 返点类型和比列
|
|
- Map<String,Object> slaeMap = reportSettlementMapper.getProfitBytedanceSale(map.get("productId")+"");
|
|
|
|
- if (!Check.isNull(slaeMap)){
|
|
|
|
- vo.setSaleName(slaeMap.getOrDefault("saleName","")+"");//销售
|
|
|
|
|
|
+ List<Map<String,Object>> rateMap = reportSettlementMapper.getProfitBytedance(map.get("productId")+"","2",paramsVo.getStartTime(),paramsVo.getEndTime());
|
|
|
|
+ /* if (!Check.isNull(slaeMap)){
|
|
|
|
+
|
|
// 当前查询时间 与 销售政策 开始 截至时间 是否匹配
|
|
// 当前查询时间 与 销售政策 开始 截至时间 是否匹配
|
|
- if (SettlementUtil.isEffectiveDate(paramsVo.getUploadYears(),slaeMap.get("policyStart")+"",slaeMap.get("policyEnd")+"")){
|
|
|
|
|
|
+ if (SettlementUtil.isEffectiveDate(paramsVo.getUploadYears(),rateMap.get("policyStart")+"",rateMap.get("policyEnd")+"")){
|
|
//销售政策状态 为 通过 显示 返点类型 和 返点比列
|
|
//销售政策状态 为 通过 显示 返点类型 和 返点比列
|
|
- if (StringUtils.equals(slaeMap.getOrDefault("approvedStatus","")+"","3")){
|
|
|
|
- vo.setRebateType(slaeMap.getOrDefault("rebateType","")+"");//返点类型
|
|
|
|
- vo.setRebateRate(slaeMap.getOrDefault("rebateRate","")+"");//返点比列
|
|
|
|
|
|
+ if (StringUtils.equals(rateMap.getOrDefault("approvedStatus","")+"","3")){
|
|
|
|
+ vo.setRebateType(rateMap.getOrDefault("rebateType","")+"");//返点类型
|
|
|
|
+ vo.setRebateRate(rateMap.getOrDefault("rebateRate","")+"");//返点比列
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
Map<String,Object> operateMap = reportSettlementMapper.getProfitKuaiShouOperate(map.get("accountId")+"");
|
|
Map<String,Object> operateMap = reportSettlementMapper.getProfitKuaiShouOperate(map.get("accountId")+"");
|
|
if (!Check.isNull(operateMap)){
|
|
if (!Check.isNull(operateMap)){
|
|
@@ -603,11 +682,94 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private CwjsPolicyProductMapper cwjsPolicyProductMapper;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void cwjsPRofit(CwjsPolicyInfo cwjsPolicyInfo) {
|
|
|
|
+
|
|
|
|
+ // 获取两个日期之间 所有的 时间 年-月-日
|
|
|
|
+ List<String> betweenDaysList = SettlementUtil.getAllDatesOfTwoTimes(cwjsPolicyInfo.getPolicyStartDate(),cwjsPolicyInfo.getPolicyEndDate());
|
|
|
|
+ //查看 政策下的产品
|
|
|
|
+ List<CwjsPolicyProduct> productList = cwjsPolicyProductMapper.queryProductsByPolicyId(cwjsPolicyInfo.getId());
|
|
|
|
+ if (!Check.isNull(productList)){
|
|
|
|
+ if (!Check.isNull(betweenDaysList)){
|
|
|
|
+ List<CtopCwjsSlettementReport> reportList = new ArrayList<>();
|
|
|
|
+ for (CwjsPolicyProduct product : productList) {
|
|
|
|
+ for (String day : betweenDaysList) {
|
|
|
|
+ CtopCwjsSlettementReport report = new CtopCwjsSlettementReport();
|
|
|
|
+ report.setPolicyId(cwjsPolicyInfo.getId());
|
|
|
|
+ report.setAdvertiserName(cwjsPolicyInfo.getAdvertiserName());
|
|
|
|
+ report.setProductName(product.getPolicyProductName());
|
|
|
|
+ report.setMediaType(cwjsPolicyInfo.getMediaType());
|
|
|
|
+ report.setCreateUserId(cwjsPolicyInfo.getCreateUserId());
|
|
|
|
+ report.setPolicyDate(day);
|
|
|
|
+ reportList.add(report);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ cwjsProfitMapper.replaceCwjsSlettementProfit(reportList);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|
|
- String a = "woshiwoshi{1}woshi{2}111{3}===";
|
|
|
|
|
|
+ /* String a = "woshiwoshi{1}woshi{2}111{3}===";
|
|
String b = MessageFormat.format(a,"测试","我","你","结束");
|
|
String b = MessageFormat.format(a,"测试","我","你","结束");
|
|
System.out.println(a);
|
|
System.out.println(a);
|
|
- System.out.println(b);
|
|
|
|
|
|
+ System.out.println(b);*/
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ List list = new ArrayList();
|
|
|
|
+
|
|
|
|
+ list.add("2021-07-01");
|
|
|
|
+ // list.add("2021-07-02");
|
|
|
|
+ list.add("2021-07-10");
|
|
|
|
+ list.add("2021-07-05");
|
|
|
|
+ list.add("2021-07-15");
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 获取两个日期之间 所有的 时间 年-月-日
|
|
|
|
+ List<String> betweenDaysList = SettlementUtil.getAllDatesOfTwoTimes("2021-07-01","2021-07-20");
|
|
|
|
+
|
|
|
|
+ List<Object> times = SettlementUtil.sortlistTest(list);
|
|
|
|
+
|
|
|
|
+ //差集
|
|
|
|
+ List<String> reduceList = betweenDaysList.stream().filter(item -> !times.contains(item)).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ System.out.println(betweenDaysList);
|
|
|
|
+ System.out.println(times);
|
|
|
|
+ System.out.println(reduceList);
|
|
|
|
+
|
|
|
|
+ List<Map<String,String>> stringList = SettlementUtil.getTime(reduceList);
|
|
|
|
+
|
|
|
|
+ System.out.println(stringList);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|