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 { ...@@ -49,5 +49,5 @@ public interface AppletNewsServeBiz {
*/ */
void deleteById(Long id); 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 { ...@@ -87,29 +87,31 @@ public class AppletNewsServeBizImpl implements AppletNewsServeBiz {
} }
@Override @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<>(); List<ExportClickDTO> exportClickDTOS = new ArrayList<>();
String excelUrl = null; String excelUrl = null;
Date date4Query = DateUtils.getDateByStr(date); Date start = DateUtils.getDateByStr(startDate);
Date end = DateUtils.getDateByStr(endDate);
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
String time = simpleDateFormat.format(start)+"至"+simpleDateFormat.format(end);
if (Objects.equals(SourceTypeEnum.NEWS.value, sourceType)) { if (Objects.equals(SourceTypeEnum.NEWS.value, sourceType)) {
exportClickDTOS = appletLinkClickDao.getNews(count, date); exportClickDTOS = appletLinkClickDao.getNews(count, startDate, endDate);
String fileName ="资讯点击量top50-研发-" + simpleDateFormat.format(date4Query); String fileName ="资讯点击量top"+ count +"-研发-" + time;
excelUrl = getExcelUrl4News(exportClickDTOS, fileName); excelUrl = getExcelUrl4News(exportClickDTOS, fileName);
result.put("fileUrl", excelUrl); result.put("fileUrl", excelUrl);
result.put("fileName", fileName); result.put("fileName", fileName);
return result; return result;
} else if (Objects.equals(SourceTypeEnum.THIRD_GROUP.value, sourceType)) { } else if (Objects.equals(SourceTypeEnum.THIRD_GROUP.value, sourceType)) {
exportClickDTOS = appletLinkClickDao.getThirdGroup(count, date); exportClickDTOS = appletLinkClickDao.getThirdGroup(count, startDate, endDate);
String fileName ="第三方群点击量top50-研发-" + simpleDateFormat.format(date4Query); String fileName ="第三方群点击量top"+ count +"-研发-" + time;
excelUrl = getExcelUrl4Group(exportClickDTOS, fileName); excelUrl = getExcelUrl4Group(exportClickDTOS, fileName);
result.put("fileUrl", excelUrl); result.put("fileUrl", excelUrl);
result.put("fileName", fileName); result.put("fileName", fileName);
return result; return result;
} else if (Objects.equals(SourceTypeEnum.NORMAL_GROUP.value, sourceType)) { } else if (Objects.equals(SourceTypeEnum.NORMAL_GROUP.value, sourceType)) {
exportClickDTOS = appletLinkClickDao.getNormalGroup(count, date); exportClickDTOS = appletLinkClickDao.getNormalGroup(count, startDate, endDate);
String fileName ="群分类点击量top50-研发-" + simpleDateFormat.format(date4Query); String fileName ="群分类点击量top"+ count +"-研发-" + time;
excelUrl = getExcelUrl4Group(exportClickDTOS, fileName); excelUrl = getExcelUrl4Group(exportClickDTOS, fileName);
result.put("fileUrl", excelUrl); result.put("fileUrl", excelUrl);
result.put("fileName", fileName); result.put("fileName", fileName);
......
...@@ -39,10 +39,10 @@ public interface AppletLinkClickDao extends BaseDao<AppletLinkClick> { ...@@ -39,10 +39,10 @@ public interface AppletLinkClickDao extends BaseDao<AppletLinkClick> {
*/ */
Map<Long, PvuvDTO> mapCouponUseCount(List<Long> fromIds); 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 ...@@ -50,26 +50,29 @@ public class AppletLinkClickDaoImpl extends BaseDaoImpl<AppletLinkClick> impleme
} }
@Override @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<String,Object> map = new HashMap<>();
map.put("count", count); map.put("count", count);
map.put("date", date); map.put("startDate", startDate);
map.put("endDate", endDate);
return getSessionTemplate().selectList(getStatement("getThirdGroup"), map); return getSessionTemplate().selectList(getStatement("getThirdGroup"), map);
} }
@Override @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<String,Object> map = new HashMap<>();
map.put("count", count); map.put("count", count);
map.put("date", date); map.put("startDate", startDate);
map.put("endDate", endDate);
return getSessionTemplate().selectList(getStatement("getNormalGroup"), map); return getSessionTemplate().selectList(getStatement("getNormalGroup"), map);
} }
@Override @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<String,Object> map = new HashMap<>();
map.put("count", count); map.put("count", count);
map.put("date", date); map.put("startDate", startDate);
map.put("endDate", endDate);
return getSessionTemplate().selectList(getStatement("getNews"), map); return getSessionTemplate().selectList(getStatement("getNews"), map);
} }
} }
...@@ -73,9 +73,10 @@ public class AppletNewsServeFacade { ...@@ -73,9 +73,10 @@ public class AppletNewsServeFacade {
@GetMapping("exportClickCountExcel") @GetMapping("exportClickCountExcel")
public ResponseDto<Map<String, Object>> exportClickCountExcel(@RequestParam(value = "count", required = false, defaultValue = "50") Integer count, 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) { @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); return new ResponseDto<>(map);
} }
......
...@@ -123,7 +123,8 @@ ...@@ -123,7 +123,8 @@
WHERE WHERE
type_id = 4 type_id = 4
AND record_type = 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 GROUP BY
from_id from_id
ORDER BY ORDER BY
...@@ -142,7 +143,8 @@ ...@@ -142,7 +143,8 @@
WHERE WHERE
type_id = 3 type_id = 3
AND record_type = 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 GROUP BY
from_id from_id
ORDER BY ORDER BY
...@@ -164,7 +166,8 @@ ...@@ -164,7 +166,8 @@
WHERE WHERE
type_id = 1 type_id = 1
AND record_type = 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 GROUP BY
from_id from_id
ORDER BY 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