Commit 6e5c9f7e by Administrator

Merge branch 'feature/export' into 'master'

feat: [none] 导出改为时间段

See merge request rays/pcloud-book!970
parents 924b28a9 23c0e5d0
......@@ -49,5 +49,5 @@ public interface AppletNewsServeBiz {
*/
void deleteById(Long id);
Map<String, Object> exportClickCountExcel(Integer count, String date, Integer sourceType);
Map<String, Object> exportClickCountExcel(Integer count,String startDate, String endDate, Integer sourceType);
}
\ No newline at end of file
......@@ -87,29 +87,31 @@ public class AppletNewsServeBizImpl implements AppletNewsServeBiz {
}
@Override
public Map<String, Object> exportClickCountExcel(Integer count, String date, Integer sourceType) {
public Map<String, Object> exportClickCountExcel(Integer count, String startDate, String endDate, Integer sourceType) {
List<ExportClickDTO> exportClickDTOS = new ArrayList<>();
String excelUrl = null;
Date date4Query = DateUtils.getDateByStr(date);
Date start = DateUtils.getDateByStr(startDate);
Date end = DateUtils.getDateByStr(endDate);
Map<String, Object> result = new HashMap<>();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
String time = simpleDateFormat.format(start)+"至"+simpleDateFormat.format(end);
if (Objects.equals(SourceTypeEnum.NEWS.value, sourceType)) {
exportClickDTOS = appletLinkClickDao.getNews(count, date);
String fileName ="资讯点击量top50-研发-" + simpleDateFormat.format(date4Query);
exportClickDTOS = appletLinkClickDao.getNews(count, startDate, endDate);
String fileName ="资讯点击量top"+ count +"-研发-" + time;
excelUrl = getExcelUrl4News(exportClickDTOS, fileName);
result.put("fileUrl", excelUrl);
result.put("fileName", fileName);
return result;
} else if (Objects.equals(SourceTypeEnum.THIRD_GROUP.value, sourceType)) {
exportClickDTOS = appletLinkClickDao.getThirdGroup(count, date);
String fileName ="第三方群点击量top50-研发-" + simpleDateFormat.format(date4Query);
exportClickDTOS = appletLinkClickDao.getThirdGroup(count, startDate, endDate);
String fileName ="第三方群点击量top"+ count +"-研发-" + time;
excelUrl = getExcelUrl4Group(exportClickDTOS, fileName);
result.put("fileUrl", excelUrl);
result.put("fileName", fileName);
return result;
} else if (Objects.equals(SourceTypeEnum.NORMAL_GROUP.value, sourceType)) {
exportClickDTOS = appletLinkClickDao.getNormalGroup(count, date);
String fileName ="群分类点击量top50-研发-" + simpleDateFormat.format(date4Query);
exportClickDTOS = appletLinkClickDao.getNormalGroup(count, startDate, endDate);
String fileName ="群分类点击量top"+ count +"-研发-" + time;
excelUrl = getExcelUrl4Group(exportClickDTOS, fileName);
result.put("fileUrl", excelUrl);
result.put("fileName", fileName);
......
......@@ -39,10 +39,10 @@ public interface AppletLinkClickDao extends BaseDao<AppletLinkClick> {
*/
Map<Long, PvuvDTO> mapCouponUseCount(List<Long> fromIds);
List<ExportClickDTO> getThirdGroup(Integer count, String date);
List<ExportClickDTO> getThirdGroup(Integer count, String startDate, String endDate);
List<ExportClickDTO> getNormalGroup(Integer count, String date);
List<ExportClickDTO> getNormalGroup(Integer count, String startDate, String endDate);
List<ExportClickDTO> getNews(Integer count, String date);
List<ExportClickDTO> getNews(Integer count, String startDate, String endDate);
}
\ No newline at end of file
......@@ -50,26 +50,29 @@ public class AppletLinkClickDaoImpl extends BaseDaoImpl<AppletLinkClick> impleme
}
@Override
public List<ExportClickDTO> getThirdGroup(Integer count, String date) {
public List<ExportClickDTO> getThirdGroup(Integer count, String startDate, String endDate) {
Map<String,Object> map = new HashMap<>();
map.put("count", count);
map.put("date", date);
map.put("startDate", startDate);
map.put("endDate", endDate);
return getSessionTemplate().selectList(getStatement("getThirdGroup"), map);
}
@Override
public List<ExportClickDTO> getNormalGroup(Integer count, String date) {
public List<ExportClickDTO> getNormalGroup(Integer count, String startDate, String endDate) {
Map<String,Object> map = new HashMap<>();
map.put("count", count);
map.put("date", date);
map.put("startDate", startDate);
map.put("endDate", endDate);
return getSessionTemplate().selectList(getStatement("getNormalGroup"), map);
}
@Override
public List<ExportClickDTO> getNews(Integer count, String date) {
public List<ExportClickDTO> getNews(Integer count, String startDate, String endDate) {
Map<String,Object> map = new HashMap<>();
map.put("count", count);
map.put("date", date);
map.put("startDate", startDate);
map.put("endDate", endDate);
return getSessionTemplate().selectList(getStatement("getNews"), map);
}
}
......@@ -73,9 +73,10 @@ public class AppletNewsServeFacade {
@GetMapping("exportClickCountExcel")
public ResponseDto<Map<String, Object>> exportClickCountExcel(@RequestParam(value = "count", required = false, defaultValue = "50") Integer count,
@RequestParam("date") String date,
@RequestParam("startDate") String startDate,
@RequestParam("endDate") String endDate,
@RequestParam("sourceType") Integer sourceType) {
Map<String, Object> map = appletNewsServeBiz.exportClickCountExcel(count, date,sourceType);
Map<String, Object> map = appletNewsServeBiz.exportClickCountExcel(count, startDate, endDate, sourceType);
return new ResponseDto<>(map);
}
......
......@@ -123,7 +123,8 @@
WHERE
type_id = 4
AND record_type = 1
AND DATE_FORMAT(create_date,"%Y-%m-%d") = #{date}
AND DATE_FORMAT(create_date,"%Y-%m-%d") >= #{startDate}
AND DATE_FORMAT(create_date,"%Y-%m-%d") &lt;= #{endDate}
GROUP BY
from_id
ORDER BY
......@@ -142,7 +143,8 @@
WHERE
type_id = 3
AND record_type = 1
AND DATE_FORMAT(create_date,"%Y-%m-%d") = #{date}
AND DATE_FORMAT(create_date,"%Y-%m-%d") >= #{startDate}
AND DATE_FORMAT(create_date,"%Y-%m-%d") &lt;= #{endDate}
GROUP BY
from_id
ORDER BY
......@@ -164,7 +166,8 @@
WHERE
type_id = 1
AND record_type = 1
AND DATE_FORMAT(create_date,"%Y-%m-%d") = #{date}
AND DATE_FORMAT(create_date,"%Y-%m-%d") >= #{startDate}
AND DATE_FORMAT(create_date,"%Y-%m-%d") &lt;= #{endDate}
GROUP BY
from_id
ORDER BY
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment