|
@@ -1,7 +1,9 @@
|
|
|
package org.jeecg.modules.ctop.service.impl;
|
|
|
|
|
|
import cn.com.ctop.common.utils.CsvUtils;
|
|
|
+import cn.com.ctop.common.utils.OSSUtils;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import org.apache.http.client.ClientProtocolException;
|
|
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
|
|
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
|
|
@@ -9,18 +11,34 @@ import org.apache.http.entity.ContentType;
|
|
|
import org.apache.http.entity.StringEntity;
|
|
|
import org.apache.http.impl.client.CloseableHttpClient;
|
|
|
import org.apache.http.impl.client.HttpClientBuilder;
|
|
|
+import org.apache.poi.hssf.usermodel.HSSFDataFormat;
|
|
|
+import org.apache.poi.ss.usermodel.Cell;
|
|
|
+import org.apache.poi.ss.usermodel.CellStyle;
|
|
|
+import org.apache.poi.ss.usermodel.Row;
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
+import org.jeecg.common.util.ResultMapUtils;
|
|
|
+import org.jeecg.common.util.StatusCode;
|
|
|
import org.jeecg.modules.ctop.entity.CTopOauthToken;
|
|
|
import org.jeecg.modules.ctop.entity.CustomerPlanStatisticInfo;
|
|
|
+import org.jeecg.modules.ctop.entity.PlatformCampaignStatisticInfo;
|
|
|
import org.jeecg.modules.ctop.mapper.CustomerPlanStatisticInfoMapper;
|
|
|
+import org.jeecg.modules.ctop.mapper.PlatformCampaignStatisticInfoMapper;
|
|
|
import org.jeecg.modules.ctop.service.ICTopOauthTokenService;
|
|
|
+import org.jeecg.modules.ctop.service.ICustomerPlanStatisticInfoService;
|
|
|
+import org.jeecg.modules.ctop.service.IPlatformCampaignStatisticInfoService;
|
|
|
import org.jeecg.modules.ctop.service.IReportService;
|
|
|
+import org.jeecg.modules.ctop.vo.StatisticCampaignVo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.io.BufferedReader;
|
|
|
-import java.io.IOException;
|
|
|
-import java.io.InputStreamReader;
|
|
|
+import java.io.*;
|
|
|
+import java.net.HttpURLConnection;
|
|
|
import java.net.URI;
|
|
|
+import java.net.URL;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -147,14 +165,14 @@ public class ReportServiceImpl implements IReportService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void insertCustomerInfo(String csvPath) {
|
|
|
+ public void insertCustomerInfo(String csvPath, String charset) {
|
|
|
try {
|
|
|
- List<String[]> data = CsvUtils.ReadCSV(csvPath);
|
|
|
+ List<String[]> data = CsvUtils.ReadCSV(csvPath, charset);
|
|
|
if (null != data && data.size() > 1) {
|
|
|
for (int i = 1; i < data.size(); i++) {
|
|
|
String[] record = data.get(i);
|
|
|
CustomerPlanStatisticInfo statisticInfo = new CustomerPlanStatisticInfo(record);
|
|
|
- statisticInfoMapper.insert(statisticInfo);
|
|
|
+ customerPlanStatisticInfoMapper.insert(statisticInfo);
|
|
|
}
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
@@ -162,8 +180,393 @@ public class ReportServiceImpl implements IReportService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void insertPlatformInfo(String csvPath, String charset, Long accountId) {
|
|
|
+ try {
|
|
|
+ List<String[]> data = CsvUtils.ReadCSV(csvPath, charset);
|
|
|
+ if (null != data && data.size() > 1) {
|
|
|
+ for (int i = 1; i < data.size(); i++) {
|
|
|
+ String[] record = data.get(i);
|
|
|
+ PlatformCampaignStatisticInfo statisticInfo = new PlatformCampaignStatisticInfo(record, accountId);
|
|
|
+ platformCampaignStatisticInfoMapper.insert(statisticInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Value("${jeecg.path.csv-upload}")
|
|
|
+ private String csvUploadPath;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> debitAuto(JSONObject data) {
|
|
|
+ Map<String, Object> resultMap = new HashMap<>();
|
|
|
+ String accountOneKsDataUrl = data.getString("accountOneKsDataUrl");
|
|
|
+ String accountFourKsDataUrl = data.getString("accountFourKsDataUrl");
|
|
|
+ String debitDataUrl = data.getString("debitDataUrl");
|
|
|
+ //1:文件下载入库
|
|
|
+ String accountOneKsDataPath = downLoadByURL(accountOneKsDataUrl);
|
|
|
+ String accountFourKsDataPath = downLoadByURL(accountFourKsDataUrl);
|
|
|
+ String debitDataPath = downLoadByURL(debitDataUrl);
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy/M/dd");
|
|
|
+ //2:文件入库
|
|
|
+ //2.1 清除数据库原始数据
|
|
|
+ QueryWrapper<CustomerPlanStatisticInfo> planWrapper = new QueryWrapper<>();
|
|
|
+ planWrapper.eq("statistic_date", simpleDateFormat.format(new Date()));
|
|
|
+ customerPlanStatisticInfoService.remove(planWrapper);
|
|
|
+
|
|
|
+ QueryWrapper<PlatformCampaignStatisticInfo> campaignWrapper = new QueryWrapper<>();
|
|
|
+ campaignWrapper.eq("statistic_date", simpleDateFormat.format(new Date()));
|
|
|
+ platformCampaignStatisticInfoService.remove(campaignWrapper);
|
|
|
+
|
|
|
+ this.insertPlatformInfo(accountOneKsDataPath, "gb2312", 1L);
|
|
|
+ this.insertPlatformInfo(accountFourKsDataPath, "gb2312", 4L);
|
|
|
+ this.insertCustomerInfo(debitDataPath, "utf8");
|
|
|
+ //3:根据模板生成相应的excel模板文件
|
|
|
+ try {
|
|
|
+ String platformReportPath = getExcelDataPath(simpleDateFormat.format(new Date()), 1L, 4L);
|
|
|
+// //4:同步上传到oss文件服务器
|
|
|
+// String ossPath = OSSUtils.uploadFile2Oss(new File(platformReportPath));
|
|
|
+// //5: 返回文件服务器访问链接
|
|
|
+ ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
|
|
|
+ resultMap.put("path", platformReportPath);
|
|
|
+ return resultMap;
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SERVER_ERROR.getCode());
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IPlatformCampaignStatisticInfoService platformCampaignStatisticInfoService;
|
|
|
+ @Autowired
|
|
|
+ private ICustomerPlanStatisticInfoService customerPlanStatisticInfoService;
|
|
|
+
|
|
|
+ public String getExcelDataPath(String date, Long accountId1, Long accountId4) throws Exception {
|
|
|
+
|
|
|
+ List<StatisticCampaignVo> statisticCampaign4Vos = statisticInfoMapper.getVoByParams(date, accountId4);
|
|
|
+ List<StatisticCampaignVo> statisticCampaign1Vos = statisticInfoMapper.getVoByParams(date, accountId1);
|
|
|
+
|
|
|
+ File f = new File(csvUploadPath + "template.xlsx");
|
|
|
+ InputStream inputStream = new FileInputStream(f);
|
|
|
+ XSSFWorkbook xssfWorkbook = new XSSFWorkbook(inputStream);
|
|
|
+// //获取第一个sheet
|
|
|
+ XSSFSheet xssfSheet = xssfWorkbook.getSheetAt(0);
|
|
|
+ CellStyle numbericCellStyle = xssfWorkbook.createCellStyle();
|
|
|
+ numbericCellStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("0.00"));
|
|
|
+ int index;
|
|
|
+ for (index = 1; index < statisticCampaign1Vos.size() + 1; index++) {
|
|
|
+ StatisticCampaignVo vo = statisticCampaign1Vos.get(index - 1);
|
|
|
+ System.out.println(vo.toString());
|
|
|
+ String content = vo.getContent();
|
|
|
+ String[] contents = content.split("-");
|
|
|
+ Row row = xssfSheet.getRow(index);
|
|
|
+ setExcelRow(numbericCellStyle, vo, contents, row, "single");
|
|
|
+ }
|
|
|
+ Row totalRow1 = xssfSheet.getRow(index);
|
|
|
+ StatisticCampaignVo total = statisticInfoMapper.getTotalStatisticVoByparams(date, accountId1);
|
|
|
+ if (null != total) {
|
|
|
+ setExcelRow(numbericCellStyle, total, new String[]{}, totalRow1, "total1");
|
|
|
+ }
|
|
|
+ index++;
|
|
|
+ for (int j = 0; j < statisticCampaign4Vos.size(); j++) {
|
|
|
+ index++;
|
|
|
+ StatisticCampaignVo vo = statisticCampaign4Vos.get(j);
|
|
|
+ System.out.println(vo.toString());
|
|
|
+ String content = vo.getContent();
|
|
|
+ String[] contents = content.split("-");
|
|
|
+ Row row = xssfSheet.getRow(index);
|
|
|
+ setExcelRow(numbericCellStyle, vo, contents, row, "single");
|
|
|
+ }
|
|
|
+ index++;
|
|
|
+ Row totalRow4 = xssfSheet.getRow(index);
|
|
|
+ StatisticCampaignVo total1 = statisticInfoMapper.getTotalStatisticVoByparams(date, accountId4);
|
|
|
+ if (null != total1) {
|
|
|
+ setExcelRow(numbericCellStyle, total1, new String[]{}, totalRow4, "total4");
|
|
|
+ }
|
|
|
+
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-m-dd");
|
|
|
+ String path = csvUploadPath + "report_" + dateFormat.format(new Date()) + ".xlsx";
|
|
|
+ FileOutputStream fileOutputStream = new FileOutputStream(path);
|
|
|
+ xssfWorkbook.write(fileOutputStream);
|
|
|
+ fileOutputStream.close();
|
|
|
+ return path;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PlatformCampaignStatisticInfoMapper statisticInfoMapper;
|
|
|
+
|
|
|
+ private void setExcelRow(CellStyle numbericCellStyle, StatisticCampaignVo vo, String[] contents, Row row, String type) {
|
|
|
+ for (int j = 0; j < 38; j++) {
|
|
|
+ Cell cell = row.createCell(j);
|
|
|
+ if (j == 0) {
|
|
|
+ //日期
|
|
|
+ if (null != type && type.equals("single")) {
|
|
|
+ cell.setCellValue(vo.getStatisticDate());
|
|
|
+ } else if (null != type && type.equals("total1")) {
|
|
|
+ cell.setCellValue("户一总计");
|
|
|
+ } else {
|
|
|
+ cell.setCellValue("户四总计");
|
|
|
+ }
|
|
|
+ } else if (j == 1) {
|
|
|
+ //代理
|
|
|
+ cell.setCellValue(vo.getProxy());
|
|
|
+ } else if (j == 2) {
|
|
|
+ //投放系统
|
|
|
+ if (null != contents && contents.length > 3) {
|
|
|
+ cell.setCellValue(contents[2]);
|
|
|
+ } else {
|
|
|
+ cell.setCellValue("");
|
|
|
+ }
|
|
|
+ } else if (j == 3) {
|
|
|
+ //渠道号
|
|
|
+ if (null != contents && contents.length > 2) {
|
|
|
+ cell.setCellValue(contents[1]);
|
|
|
+ } else {
|
|
|
+ cell.setCellValue("");
|
|
|
+ }
|
|
|
+ } else if (j == 4) {
|
|
|
+ //content
|
|
|
+ if (null != contents && contents.length > 0) {
|
|
|
+ cell.setCellValue(contents[0]);
|
|
|
+ } else {
|
|
|
+ cell.setCellValue("");
|
|
|
+ }
|
|
|
+// cell.setCellValue(vo.getContent());
|
|
|
+ } else if (j == 5) {
|
|
|
+ if (null != contents && contents.length > 5) {
|
|
|
+ cell.setCellValue(contents[4]);
|
|
|
+ } else {
|
|
|
+ cell.setCellValue("");
|
|
|
+ }
|
|
|
+ } else if (j == 6) {
|
|
|
+ //出价方式
|
|
|
+ if (null != contents && contents.length > 6) {
|
|
|
+ cell.setCellValue(contents[5]);
|
|
|
+ } else {
|
|
|
+ cell.setCellValue("");
|
|
|
+ }
|
|
|
+ } else if (j == 7) {
|
|
|
+ //定向条件
|
|
|
+ if (null != contents && contents.length > 4) {
|
|
|
+ cell.setCellValue(contents[3]);
|
|
|
+ } else {
|
|
|
+ cell.setCellValue("");
|
|
|
+ }
|
|
|
+ } else if (j == 8) {
|
|
|
+ //定向条件
|
|
|
+ if (null != contents && contents.length > 7) {
|
|
|
+ cell.setCellValue(contents[6]);
|
|
|
+ } else {
|
|
|
+ cell.setCellValue("");
|
|
|
+ }
|
|
|
+ } else if (j == 9) {
|
|
|
+ //花费
|
|
|
+ if (null != vo.getCost() && !"".equals(vo.getCost())) {
|
|
|
+ cell.setCellValue(Float.parseFloat(vo.getCost()));
|
|
|
+ cell.setCellStyle(numbericCellStyle);
|
|
|
+ }
|
|
|
+ } else if (j == 10) {
|
|
|
+ //封面曝光数
|
|
|
+ if (null != vo.getCoverViews() && !"".equals(vo.getCoverViews())) {
|
|
|
+ cell.setCellValue(Integer.parseInt(vo.getCoverViews()));
|
|
|
+ }
|
|
|
+ } else if (j == 11) {
|
|
|
+ //封面点击数
|
|
|
+ if (null != vo.getCoverClick() && !"".equals(vo.getCoverClick())) {
|
|
|
+ cell.setCellValue(Integer.parseInt(vo.getCoverClick()));
|
|
|
+ }
|
|
|
+ } else if (j == 12) {
|
|
|
+ //素材曝光数
|
|
|
+ if (null != vo.getMaterialViews() && !"".equals(vo.getMaterialViews())) {
|
|
|
+ cell.setCellValue(Integer.parseInt(vo.getMaterialViews()));
|
|
|
+ }
|
|
|
+ } else if (j == 13) {
|
|
|
+ //行为数
|
|
|
+ if (null != vo.getActions() && !"".equals(vo.getActions())) {
|
|
|
+ cell.setCellValue(Integer.parseInt(vo.getActions()));
|
|
|
+ }
|
|
|
+ } else if (j == 14) {
|
|
|
+ //点击率
|
|
|
+ if (null != vo.getClickRate() && !"".equals(vo.getClickRate())) {
|
|
|
+ cell.setCellValue(Float.parseFloat(vo.getClickRate()));
|
|
|
+ cell.setCellStyle(numbericCellStyle);
|
|
|
+ }
|
|
|
+ } else if (j == 15) {
|
|
|
+ //行为点击率
|
|
|
+ if (null != vo.getActionClickRate() && !"".equals(vo.getActionClickRate())) {
|
|
|
+ cell.setCellValue(Float.parseFloat(vo.getActionClickRate()));
|
|
|
+ cell.setCellStyle(numbericCellStyle);
|
|
|
+ }
|
|
|
+ } else if (j == 16) {
|
|
|
+ //ACTR*BCTR
|
|
|
+ if (null != vo.getAbctr() && !"".equals(vo.getAbctr())) {
|
|
|
+ cell.setCellValue(Float.parseFloat(vo.getAbctr()));
|
|
|
+ cell.setCellStyle(numbericCellStyle);
|
|
|
+ }
|
|
|
+ } else if (j == 17) {
|
|
|
+ //点击成本
|
|
|
+ if (null != vo.getClickPrice() && !"".equals(vo.getClickPrice())) {
|
|
|
+ cell.setCellValue(Float.parseFloat(vo.getClickPrice()));
|
|
|
+ cell.setCellStyle(numbericCellStyle);
|
|
|
+ }
|
|
|
+ } else if (j == 18) {
|
|
|
+ //行为成本
|
|
|
+ if (null != vo.getActionPrice() && !"".equals(vo.getActionPrice())) {
|
|
|
+ cell.setCellValue(Float.parseFloat(vo.getActionPrice()));
|
|
|
+ cell.setCellStyle(numbericCellStyle);
|
|
|
+ }
|
|
|
+ } else if (j == 19) {
|
|
|
+ //注册用户
|
|
|
+ if (null != vo.getRegistUserNum() && !"".equals(vo.getRegistUserNum())) {
|
|
|
+ cell.setCellValue(Integer.parseInt(vo.getRegistUserNum()));
|
|
|
+ }
|
|
|
+ } else if (j == 20) {
|
|
|
+ //完件用户
|
|
|
+ if (null != vo.getComplateUserNum() && !"".equals(vo.getComplateUserNum())) {
|
|
|
+ cell.setCellValue(Integer.parseInt(vo.getComplateUserNum()));
|
|
|
+ }
|
|
|
+ } else if (j == 21) {
|
|
|
+ //授信用户
|
|
|
+ if (null != vo.getCreditUserNum() && !"".equals(vo.getCreditUserNum())) {
|
|
|
+ cell.setCellValue(Integer.parseInt(vo.getCreditUserNum()));
|
|
|
+ }
|
|
|
+ } else if (j == 22) {
|
|
|
+ //当日注册且完件数
|
|
|
+ if (null != vo.getRegistCompleteNum() && !"".equals(vo.getRegistCompleteNum())) {
|
|
|
+ cell.setCellValue(Integer.parseInt(vo.getRegistCompleteNum()));
|
|
|
+ }
|
|
|
+ } else if (j == 23) {
|
|
|
+ //当日注册且授信数
|
|
|
+ if (null != vo.getRegistCreditNum() && !"".equals(vo.getRegistCreditNum())) {
|
|
|
+ cell.setCellValue(Integer.parseInt(vo.getRegistCreditNum()));
|
|
|
+ }
|
|
|
+ } else if (j == 25) {
|
|
|
+ //注册成本
|
|
|
+ if (null != vo.getRegistPrice() && !"".equals(vo.getRegistPrice())) {
|
|
|
+ cell.setCellValue(Float.parseFloat(vo.getRegistPrice()));
|
|
|
+ cell.setCellStyle(numbericCellStyle);
|
|
|
+ }
|
|
|
+ } else if (j == 26) {
|
|
|
+ //完件成本
|
|
|
+ if (null != vo.getCompletePrice() && !"".equals(vo.getCompletePrice())) {
|
|
|
+ cell.setCellValue(Float.parseFloat(vo.getCompletePrice()));
|
|
|
+ cell.setCellStyle(numbericCellStyle);
|
|
|
+ }
|
|
|
+ } else if (j == 27) {
|
|
|
+ //授信成本
|
|
|
+ if (null != vo.getCreditPrice() && !"".equals(vo.getCreditPrice())) {
|
|
|
+ cell.setCellValue(Float.parseFloat(vo.getCreditPrice()));
|
|
|
+ cell.setCellStyle(numbericCellStyle);
|
|
|
+ }
|
|
|
+ } else if (j == 28) {
|
|
|
+ //当日注册且完件成本
|
|
|
+ if (null != vo.getRegistCompletePrice() && !"".equals(vo.getRegistCompletePrice())) {
|
|
|
+ cell.setCellValue(Float.parseFloat(vo.getRegistCompletePrice()));
|
|
|
+ cell.setCellStyle(numbericCellStyle);
|
|
|
+ }
|
|
|
+ } else if (j == 29) {
|
|
|
+ //当日注册且授信成本
|
|
|
+ if (null != vo.getRegistCreditPrice() && !"".equals(vo.getRegistCreditPrice())) {
|
|
|
+ cell.setCellValue(Float.parseFloat(vo.getRegistCreditPrice()));
|
|
|
+ cell.setCellStyle(numbericCellStyle);
|
|
|
+ }
|
|
|
+ } else if (j == 30) {
|
|
|
+ //点击注册率
|
|
|
+ if (null != vo.getClickRegistRate() && !"".equals(vo.getClickRegistRate())) {
|
|
|
+ cell.setCellValue(Float.parseFloat(vo.getClickRegistRate()));
|
|
|
+ cell.setCellStyle(numbericCellStyle);
|
|
|
+ }
|
|
|
+ } else if (j == 31) {
|
|
|
+ //行为注册率
|
|
|
+ if (null != vo.getActionRegistRate() && !"".equals(vo.getActionRegistRate())) {
|
|
|
+ cell.setCellValue(Float.parseFloat(vo.getActionRegistRate()));
|
|
|
+ cell.setCellStyle(numbericCellStyle);
|
|
|
+ }
|
|
|
+ } else if (j == 32) {
|
|
|
+ //完件率
|
|
|
+ if (null != vo.getCompleteRate() && !"".equals(vo.getCompleteRate())) {
|
|
|
+ cell.setCellValue(Float.parseFloat(vo.getCompleteRate()));
|
|
|
+ cell.setCellStyle(numbericCellStyle);
|
|
|
+ }
|
|
|
+ } else if (j == 33) {
|
|
|
+ //授信率
|
|
|
+ if (null != vo.getCreditRate() && !"".equals(vo.getCreditRate())) {
|
|
|
+ cell.setCellValue(Float.parseFloat(vo.getCreditRate()));
|
|
|
+ cell.setCellStyle(numbericCellStyle);
|
|
|
+ }
|
|
|
+ } else if (j == 34) {
|
|
|
+ //当日完件率
|
|
|
+ if (null != vo.getRegistCompleteRate() && !"".equals(vo.getRegistCompleteRate())) {
|
|
|
+ cell.setCellValue(Float.parseFloat(vo.getRegistCompleteRate()));
|
|
|
+ cell.setCellStyle(numbericCellStyle);
|
|
|
+ }
|
|
|
+ } else if (j == 35) {
|
|
|
+ //当日授信率
|
|
|
+ if (null != vo.getRegistCreditRate() && !"".equals(vo.getRegistCreditRate())) {
|
|
|
+ cell.setCellValue(Float.parseFloat(vo.getRegistCreditRate()));
|
|
|
+ cell.setCellStyle(numbericCellStyle);
|
|
|
+ }
|
|
|
+ } else if (j == 36) {
|
|
|
+ //当日完件/完件
|
|
|
+ if (null != vo.getCompleteRateDay() && !"".equals(vo.getCompleteRateDay())) {
|
|
|
+ cell.setCellValue(Float.parseFloat(vo.getCompleteRateDay()));
|
|
|
+ cell.setCellStyle(numbericCellStyle);
|
|
|
+ }
|
|
|
+ } else if (j == 37) {
|
|
|
+ //当日授信/授信
|
|
|
+ if (null != vo.getCreditRateDay() && !"".equals(vo.getCreditRateDay())) {
|
|
|
+ cell.setCellValue(Float.parseFloat(vo.getCreditRateDay()));
|
|
|
+ cell.setCellStyle(numbericCellStyle);
|
|
|
+ }
|
|
|
+ } else if (j == 38) {
|
|
|
+ //当日授信/注册
|
|
|
+ if (null != vo.getCreditRegistRateDay() && !"".equals(vo.getCreditRegistRateDay())) {
|
|
|
+ cell.setCellValue(Float.parseFloat(vo.getCreditRegistRateDay()));
|
|
|
+ cell.setCellStyle(numbericCellStyle);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public String downLoadByURL(String fileUrl) {
|
|
|
+ //获取文件名,文件名实际上在URL中可以找到
|
|
|
+ String fileName = fileUrl.substring(fileUrl.lastIndexOf("/") + 1);
|
|
|
+ //这里服务器上要将此图保存的路径
|
|
|
+ String savePath = this.csvUploadPath + fileName;
|
|
|
+ try {
|
|
|
+ URL url = new URL("https:" + fileUrl);/*将网络资源地址传给,即赋值给url*/
|
|
|
+ /*此为联系获得网络资源的固定格式用法,以便后面的in变量获得url截取网络资源的输入流*/
|
|
|
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
|
|
+ DataInputStream in = new DataInputStream(connection.getInputStream());
|
|
|
+ /*此处也可用BufferedInputStream与BufferedOutputStream*/
|
|
|
+ DataOutputStream out = new DataOutputStream(new FileOutputStream(savePath));
|
|
|
+ /*将参数savePath,即将截取的图片的存储在本地地址赋值给out输出流所指定的地址*/
|
|
|
+ byte[] buffer = new byte[4096];
|
|
|
+ int count = 0;
|
|
|
+ /*将输入流以字节的形式读取并写入buffer中*/
|
|
|
+ while ((count = in.read(buffer)) > 0) {
|
|
|
+ out.write(buffer, 0, count);
|
|
|
+ }
|
|
|
+ out.close();/*后面三行为关闭输入输出流以及网络资源的固定格式*/
|
|
|
+ in.close();
|
|
|
+ connection.disconnect();
|
|
|
+ //返回内容是保存后的完整的URL
|
|
|
+ return savePath;/*网络资源截取并存储本地成功返回true*/
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ System.out.println(e + fileUrl + savePath);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CustomerPlanStatisticInfoMapper customerPlanStatisticInfoMapper;
|
|
|
@Autowired
|
|
|
- private CustomerPlanStatisticInfoMapper statisticInfoMapper;
|
|
|
+ private PlatformCampaignStatisticInfoMapper platformCampaignStatisticInfoMapper;
|
|
|
|
|
|
public JSONObject getAgentStat(CTopOauthToken token, JSONObject conditions) {
|
|
|
// 请求地址
|