|
@@ -45,8 +45,9 @@ public class CmMarketShopServiceImpl implements CmMarketShopService {
|
|
private final static String ZIP_FILE = "zip";
|
|
private final static String ZIP_FILE = "zip";
|
|
private final static String RAR_FILE = "octet";
|
|
private final static String RAR_FILE = "octet";
|
|
|
|
|
|
-// private final static String extract = "/mnt/newdatadrive/data/runtime/jar-instance/manager-api/extract";
|
|
|
|
- private final static String extract = "E:\\Users\\Desktop\\extract";
|
|
|
|
|
|
+ private final static String extract = "/mnt/newdatadrive/data/runtime/jar-instance/manager-api/extract";
|
|
|
|
+
|
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:dd");
|
|
|
|
|
|
@Resource private CmMarketShopDao marketShopDao;
|
|
@Resource private CmMarketShopDao marketShopDao;
|
|
|
|
|
|
@@ -78,6 +79,17 @@ public class CmMarketShopServiceImpl implements CmMarketShopService {
|
|
public ResponseJson<PaginationVo<CmMarketReport>> getMarketReport(Integer marketId, String reportName, int pageNum, int pageSize) {
|
|
public ResponseJson<PaginationVo<CmMarketReport>> getMarketReport(Integer marketId, String reportName, int pageNum, int pageSize) {
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
List<CmMarketReport> marketReport = marketShopDao.getMarketReport(marketId, reportName);
|
|
List<CmMarketReport> marketReport = marketShopDao.getMarketReport(marketId, reportName);
|
|
|
|
+ if (null != marketReport && marketReport.size() > 0) {
|
|
|
|
+ marketReport.forEach(report -> {
|
|
|
|
+ try {
|
|
|
|
+ if (StringUtils.isNotBlank(report.getReportTime())) {
|
|
|
|
+ report.setReportTime(simpleDateFormat.format(simpleDateFormat.parse(report.getReportTime())));
|
|
|
|
+ }
|
|
|
|
+ } catch (ParseException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
PaginationVo<CmMarketReport> page = new PaginationVo<>(marketReport);
|
|
PaginationVo<CmMarketReport> page = new PaginationVo<>(marketReport);
|
|
return ResponseJson.success(page);
|
|
return ResponseJson.success(page);
|
|
}
|
|
}
|
|
@@ -90,7 +102,17 @@ public class CmMarketShopServiceImpl implements CmMarketShopService {
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public ResponseJson<CmMarketReport> getMarketReportById(Integer id) {
|
|
public ResponseJson<CmMarketReport> getMarketReportById(Integer id) {
|
|
- return ResponseJson.success(marketShopDao.getMarketReportById(id));
|
|
|
|
|
|
+ CmMarketReport marketReportById = marketShopDao.getMarketReportById(id);
|
|
|
|
+ if (null != marketReportById) {
|
|
|
|
+ try {
|
|
|
|
+ if (StringUtils.isNotBlank(marketReportById.getReportTime())) {
|
|
|
|
+ marketReportById.setReportTime(simpleDateFormat.format(simpleDateFormat.parse(marketReportById.getReportTime())));
|
|
|
|
+ }
|
|
|
|
+ } catch (ParseException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return ResponseJson.success(marketReportById);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -116,17 +138,17 @@ public class CmMarketShopServiceImpl implements CmMarketShopService {
|
|
// 删除数据报表
|
|
// 删除数据报表
|
|
marketShopDao.updateMarketReport(id);
|
|
marketShopDao.updateMarketReport(id);
|
|
// 删除数据报表具体数据
|
|
// 删除数据报表具体数据
|
|
- marketShopDao.updateMarketStage(id, null);
|
|
|
|
- marketShopDao.updateMarketFunnelModel(id, null);
|
|
|
|
- marketShopDao.updateMarketArticleReadVolume(id, null);
|
|
|
|
- marketShopDao.updateMarketImpressions(id, null);
|
|
|
|
- marketShopDao.updateMarketReadVolume(id, null);
|
|
|
|
- marketShopDao.updateMarketSummary(id, null);
|
|
|
|
- marketShopDao.updateMarketVisits(id, null);
|
|
|
|
- marketShopDao.updateMarketProportion(id, null);
|
|
|
|
- marketShopDao.updateMarketPageDuration(id, null);
|
|
|
|
- marketShopDao.updateMarketAdvertHits(id, null);
|
|
|
|
- marketShopDao.updateMarketRemark(id, null);
|
|
|
|
|
|
+ marketShopDao.updateMarketStage(id);
|
|
|
|
+ marketShopDao.updateMarketFunnelModel(id);
|
|
|
|
+ marketShopDao.updateMarketArticleReadVolume(id);
|
|
|
|
+ marketShopDao.updateMarketImpressions(id);
|
|
|
|
+ marketShopDao.updateMarketReadVolume(id);
|
|
|
|
+ marketShopDao.updateMarketSummary(id);
|
|
|
|
+ marketShopDao.updateMarketVisits(id);
|
|
|
|
+ marketShopDao.updateMarketProportion(id);
|
|
|
|
+ marketShopDao.updateMarketPageDuration(id);
|
|
|
|
+ marketShopDao.updateMarketAdvertHits(id);
|
|
|
|
+ marketShopDao.updateMarketRemark(id);
|
|
return ResponseJson.success();
|
|
return ResponseJson.success();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -210,29 +232,33 @@ public class CmMarketShopServiceImpl implements CmMarketShopService {
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
|
|
try {
|
|
try {
|
|
String reportTime = dateFormat.format(dateFormat.parse(reportDate));
|
|
String reportTime = dateFormat.format(dateFormat.parse(reportDate));
|
|
|
|
+ File file = new File(filePath);
|
|
if (id == null) {
|
|
if (id == null) {
|
|
CmMarketReport marketReport = new CmMarketReport();
|
|
CmMarketReport marketReport = new CmMarketReport();
|
|
marketReport.setMarketId(marketId);
|
|
marketReport.setMarketId(marketId);
|
|
marketReport.setReportDate(reportTime);
|
|
marketReport.setReportDate(reportTime);
|
|
marketReport.setReportName(reportName);
|
|
marketReport.setReportName(reportName);
|
|
|
|
+ marketReport.setFileName(file.getName());
|
|
marketShopDao.insertMarketReport(marketReport);
|
|
marketShopDao.insertMarketReport(marketReport);
|
|
// 读取文件,处理数据
|
|
// 读取文件,处理数据
|
|
readFile(marketReport.getId(), filePath);
|
|
readFile(marketReport.getId(), filePath);
|
|
|
|
+ file.delete();
|
|
} else {
|
|
} else {
|
|
// 删除数据报表具体数据
|
|
// 删除数据报表具体数据
|
|
- marketShopDao.updateMarketStage(id, reportTime);
|
|
|
|
- marketShopDao.updateMarketFunnelModel(id, reportTime);
|
|
|
|
- marketShopDao.updateMarketArticleReadVolume(id, reportTime);
|
|
|
|
- marketShopDao.updateMarketImpressions(id, reportTime);
|
|
|
|
- marketShopDao.updateMarketReadVolume(id, reportTime);
|
|
|
|
- marketShopDao.updateMarketSummary(id, reportTime);
|
|
|
|
- marketShopDao.updateMarketVisits(id, reportTime);
|
|
|
|
- marketShopDao.updateMarketProportion(id, reportTime);
|
|
|
|
- marketShopDao.updateMarketPageDuration(id, reportTime);
|
|
|
|
- marketShopDao.updateMarketAdvertHits(id, reportTime);
|
|
|
|
- marketShopDao.updateMarketRemark(id, reportTime);
|
|
|
|
|
|
+ marketShopDao.updateMarketStage(id);
|
|
|
|
+ marketShopDao.updateMarketFunnelModel(id);
|
|
|
|
+ marketShopDao.updateMarketArticleReadVolume(id);
|
|
|
|
+ marketShopDao.updateMarketImpressions(id);
|
|
|
|
+ marketShopDao.updateMarketReadVolume(id);
|
|
|
|
+ marketShopDao.updateMarketSummary(id);
|
|
|
|
+ marketShopDao.updateMarketVisits(id);
|
|
|
|
+ marketShopDao.updateMarketProportion(id);
|
|
|
|
+ marketShopDao.updateMarketPageDuration(id);
|
|
|
|
+ marketShopDao.updateMarketAdvertHits(id);
|
|
|
|
+ marketShopDao.updateMarketRemark(id);
|
|
// 读取文件,处理数据
|
|
// 读取文件,处理数据
|
|
readFile(id, filePath);
|
|
readFile(id, filePath);
|
|
|
|
+ file.delete();
|
|
}
|
|
}
|
|
} catch (ParseException e) {
|
|
} catch (ParseException e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
@@ -562,30 +588,38 @@ public class CmMarketShopServiceImpl implements CmMarketShopService {
|
|
for (File fileSpecific: file.listFiles()) {
|
|
for (File fileSpecific: file.listFiles()) {
|
|
if (fileSpecific.getName().equals("SEO汇总图片") && fileSpecific.exists() && fileSpecific.isDirectory()) {
|
|
if (fileSpecific.getName().equals("SEO汇总图片") && fileSpecific.exists() && fileSpecific.isDirectory()) {
|
|
for (File fileSpecificContain : fileSpecific.listFiles()) {
|
|
for (File fileSpecificContain : fileSpecific.listFiles()) {
|
|
- if (fileSpecificContain.getName().contains("SEO")) {
|
|
|
|
- // 上传图到服务器并获取图链接,存入数据库,图片顺序需与 SEO 列表顺序一致
|
|
|
|
|
|
+ if (fileSpecificContain.getName().contains("seo")) {
|
|
|
|
+ // 上传图到服务器并获取图链接,存入数据库,图片名称需与 SEO 列表名称一致
|
|
MultipartFile filex = FileUtil.fileToMultipartFileConverter(fileSpecificContain);
|
|
MultipartFile filex = FileUtil.fileToMultipartFileConverter(fileSpecificContain);
|
|
String seoImagePath = formDataUtils.saveShopFile(filex);
|
|
String seoImagePath = formDataUtils.saveShopFile(filex);
|
|
- seoImagePathList.put(filex.getName(), seoImagePath);
|
|
|
|
|
|
+ String name = fileSpecificContain.getName().substring(0, fileSpecificContain.getName().lastIndexOf("."));
|
|
|
|
+ seoImagePathList.put(name, seoImagePath);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (fileSpecific.getName().equals("广告图片") && fileSpecific.exists() && fileSpecific.isDirectory()) {
|
|
|
|
|
|
+ log.info("fileSpecific.getName()======"+fileSpecific.getName());
|
|
|
|
+ if (fileSpecific.getName().equals("advert广告图片") && fileSpecific.exists() && fileSpecific.isDirectory()) {
|
|
for (File fileSpecificContain : fileSpecific.listFiles()) {
|
|
for (File fileSpecificContain : fileSpecific.listFiles()) {
|
|
|
|
+ log.info("fileSpecificContain.getName()======"+fileSpecificContain.getName());
|
|
if (fileSpecificContain.getName().contains("首页")) {
|
|
if (fileSpecificContain.getName().contains("首页")) {
|
|
- // 上传图到服务器并获取图链接,存入数据库,图片顺序需与 广告图点击量 列表顺序一致
|
|
|
|
|
|
+ // 上传图到服务器并获取图链接,存入数据库,图片名称需与 广告图点击量 列表名称一致
|
|
MultipartFile filex = FileUtil.fileToMultipartFileConverter(fileSpecificContain);
|
|
MultipartFile filex = FileUtil.fileToMultipartFileConverter(fileSpecificContain);
|
|
String advertImagePath = formDataUtils.saveShopFile(filex);
|
|
String advertImagePath = formDataUtils.saveShopFile(filex);
|
|
- advertImageHomeList.put(filex.getName(), advertImagePath);
|
|
|
|
|
|
+ String name = fileSpecificContain.getName().substring(0, fileSpecificContain.getName().lastIndexOf("."));
|
|
|
|
+ advertImageHomeList.put(name, advertImagePath);
|
|
}
|
|
}
|
|
if (fileSpecificContain.getName().contains("信息中心")) {
|
|
if (fileSpecificContain.getName().contains("信息中心")) {
|
|
- // 上传图到服务器并获取图链接,存入数据库,图片顺序需与 广告图点击量 列表顺序一致
|
|
|
|
|
|
+ // 上传图到服务器并获取图链接,存入数据库,图片名称需与 广告图点击量 列表名称一致
|
|
MultipartFile filex = FileUtil.fileToMultipartFileConverter(fileSpecificContain);
|
|
MultipartFile filex = FileUtil.fileToMultipartFileConverter(fileSpecificContain);
|
|
String advertImagePath = formDataUtils.saveShopFile(filex);
|
|
String advertImagePath = formDataUtils.saveShopFile(filex);
|
|
- advertImageInfoList.put(filex.getName(), advertImagePath);
|
|
|
|
|
|
+ String name = fileSpecificContain.getName().substring(0, fileSpecificContain.getName().lastIndexOf("."));
|
|
|
|
+ advertImageInfoList.put(name, advertImagePath);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
+ // 读取完图片文件后在读取数据文件 xlsx
|
|
|
|
+ for (File fileSpecific: file.listFiles()) {
|
|
if (fileSpecific.getName().endsWith(".xlsx") || fileSpecific.getName().endsWith(".xls")) {
|
|
if (fileSpecific.getName().endsWith(".xlsx") || fileSpecific.getName().endsWith(".xls")) {
|
|
readExcel(marketReportId, fileSpecific, seoImagePathList, advertImageHomeList, advertImageInfoList);
|
|
readExcel(marketReportId, fileSpecific, seoImagePathList, advertImageHomeList, advertImageInfoList);
|
|
}
|
|
}
|
|
@@ -615,7 +649,7 @@ public class CmMarketShopServiceImpl implements CmMarketShopService {
|
|
is = new BufferedInputStream(multipartFile.getInputStream());
|
|
is = new BufferedInputStream(multipartFile.getInputStream());
|
|
EasyExcel.read(is, FunnelModel.class, new FunnelModelListener(marketReportId, marketShopDao)).excelType(ExcelTypeEnum.valueOf(excelType)).sheet("漏斗模型数据").doRead();
|
|
EasyExcel.read(is, FunnelModel.class, new FunnelModelListener(marketReportId, marketShopDao)).excelType(ExcelTypeEnum.valueOf(excelType)).sheet("漏斗模型数据").doRead();
|
|
is = new BufferedInputStream(multipartFile.getInputStream());
|
|
is = new BufferedInputStream(multipartFile.getInputStream());
|
|
- EasyExcel.read(is, ArticleReadVolume.class, new ArticleReadVolumeListener(marketReportId, marketShopDao)).excelType(ExcelTypeEnum.valueOf(excelType)).sheet("推文阅读量").doRead();
|
|
|
|
|
|
+ EasyExcel.read(is, ArticleReadVolume.class, new ArticleReadVolumeListener(marketReportId, marketShopDao)).excelType(ExcelTypeEnum.valueOf(excelType)).sheet("推文数据").doRead();
|
|
is = new BufferedInputStream(multipartFile.getInputStream());
|
|
is = new BufferedInputStream(multipartFile.getInputStream());
|
|
EasyExcel.read(is, Impressions.class, new ImpressionsListener(marketReportId, marketShopDao)).excelType(ExcelTypeEnum.valueOf(excelType)).sheet("展现量").doRead();
|
|
EasyExcel.read(is, Impressions.class, new ImpressionsListener(marketReportId, marketShopDao)).excelType(ExcelTypeEnum.valueOf(excelType)).sheet("展现量").doRead();
|
|
is = new BufferedInputStream(multipartFile.getInputStream());
|
|
is = new BufferedInputStream(multipartFile.getInputStream());
|