From ad5f1d1056ba118f4ed7c769a8cbbe1e6690e695 Mon Sep 17 00:00:00 2001
From: huanghongfa <huanghongfa123456>
Date: 星期四, 17 六月 2021 14:37:09 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/test_screen' into test_screen
---
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ScreenWorkServiceImpl.java | 128 +++++++++++++++++++++++-------------------
1 files changed, 71 insertions(+), 57 deletions(-)
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ScreenWorkServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ScreenWorkServiceImpl.java
index 236d874..3c521f9 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ScreenWorkServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ScreenWorkServiceImpl.java
@@ -43,7 +43,16 @@
@Resource
private ComActEasyPhotoDAO comActEasyPhotoDAO;
+ /**
+ * 项目开始时间,超过的不统计
+ */
+ private final String initMonth = "2020-12";
+
private final String moth_format_str = "yyyy-MM";
+
+ private final String moth_format_ch = "yyyy年MM月";
+
+ private final String[] monthStr = new String[]{"一","二","三","四","五","六","七","八","九","十","十一","十二"};
@Override
public R statisticNeighborCircle(Long communityId) {
@@ -51,12 +60,12 @@
ComActNeighborCircleScreenVO comActNeighborCircleScreenVO = new ComActNeighborCircleScreenVO();
String date = DateUtils.getDateFormatString(new Date(),moth_format_str);
Map<String,Long> countMap = comActNeighborCircleDAO.countByCommunityId(communityId,date);
- comActNeighborCircleScreenVO.setCurrentNum(countMap.get("currentNum") == null ? 0L : countMap.get("currentNum"));
- comActNeighborCircleScreenVO.setTotalNum(countMap.get("totalNum") == null ? 0L : countMap.get("totalNum"));
- Map<String,Long> sumMap = comActNeighborCircleDAO.sumScreenNum(communityId);
- comActNeighborCircleScreenVO.setFabulousNum(sumMap.get("fabulousNum") == null ? 0L : sumMap.get("fabulousNum"));
- comActNeighborCircleScreenVO.setCommentNum(sumMap.get("commentNum") == null ? 0L : sumMap.get("commentNum"));
- comActNeighborCircleScreenVO.setSharedNum(sumMap.get("forwardNum") == null ? 0L : sumMap.get("forwardNum"));
+ comActNeighborCircleScreenVO.setCurrentNum(countMap.get("currentNum"));
+ comActNeighborCircleScreenVO.setTotalNum(countMap.get("totalNum"));
+ Map<String,Object> sumMap = comActNeighborCircleDAO.sumScreenNum(communityId);
+ comActNeighborCircleScreenVO.setFabulousNum(sumMap.get("fabulousNum") == null?0L:Long.valueOf(sumMap.get("fabulousNum").toString()));
+ comActNeighborCircleScreenVO.setCommentNum(sumMap.get("commentNum") == null?0L:Long.valueOf(sumMap.get("commentNum").toString()));
+ comActNeighborCircleScreenVO.setSharedNum(sumMap.get("forwardNum") == null?0L:Long.valueOf(sumMap.get("forwardNum").toString()));
//查询最近发布的邻里圈
comActNeighborCircleScreenVO.setList(comActNeighborCircleDAO.screenNeighborCircle(communityId,pageSize));
//查询最近发布的邻里圈图片
@@ -101,15 +110,17 @@
@Override
public R activity(Long communityId) {
ComActActivityScreenVO comActActivityScreenVO = new ComActActivityScreenVO();
+
+ comActActivityScreenVO.setImgs(convertStringList(actActivityDAO.listImg(communityId)));
//统计本月新增、居民活动,志愿者活动
String date = DateUtils.getDateFormatString(new Date(),moth_format_str);
Map<String,Long> countMap = actActivityDAO.countByCommunityId(communityId,date);
- comActActivityScreenVO.setTotalNum(countMap.get("totalNum") == null ? 0L : countMap.get("totalNum"));
comActActivityScreenVO.setCurrentNum(countMap.get("currentNum") == null ? 0L : countMap.get("currentNum"));
comActActivityScreenVO.setCommonNum(countMap.get("commonNum") == null ? 0L : countMap.get("commonNum"));
comActActivityScreenVO.setCommonPeopleNum(countMap.get("commonPeopleNum") == null ? 0L : countMap.get("commonPeopleNum"));
comActActivityScreenVO.setVolunteerNum(countMap.get("volunteerNum") == null ? 0L : countMap.get("volunteerNum"));
comActActivityScreenVO.setVolunteerPeopleNum(countMap.get("volunteerPeopleNum") == null ? 0L : countMap.get("volunteerPeopleNum"));
+ comActActivityScreenVO.setTotalNum(comActActivityScreenVO.getCommonNum()+comActActivityScreenVO.getVolunteerNum());
//最近活动
comActActivityScreenVO.setList(actActivityDAO.screenActivity(communityId,pageSize));
return R.ok(comActActivityScreenVO);
@@ -122,11 +133,11 @@
String date = DateUtils.getDateFormatString(new Date(),moth_format_str);
Map<String,Long> countMap = comActDiscussDAO.countByCommunityId(communityId,date);
discussScreenVO.setCurrentNum(countMap.get("currentNum") == null ? 0L : countMap.get("currentNum"));
- discussScreenVO.setTotalNum(countMap.get("totalNum") == null ? 0L : countMap.get("totalNum"));
discussScreenVO.setImgNum(countMap.get("imgNum") == null ? 0L : countMap.get("imgNum"));
discussScreenVO.setImgPeopleNum(countMap.get("imgPeopleNum") == null ? 0L : countMap.get("imgPeopleNum"));
- discussScreenVO.setVoteNum(discussScreenVO.getTotalNum() - discussScreenVO.getImgNum());
+ discussScreenVO.setVoteNum(countMap.get("voteNum") == null ? 0L : countMap.get("voteNum"));
discussScreenVO.setVotePeopleNum(countMap.get("votePeopleNum") == null ? 0L : countMap.get("votePeopleNum"));
+ discussScreenVO.setTotalNum(discussScreenVO.getImgNum()+discussScreenVO.getVoteNum());
discussScreenVO.setList(comActDiscussDAO.screenDiscuss(communityId,pageSize));
return R.ok(discussScreenVO);
}
@@ -141,10 +152,11 @@
pbWorkScreenVO.setTotalNum(pbWorkScreenVO.getActivityNum() + pbWorkScreenVO.getDynNum());
pbWorkScreenVO.setCurrentNum(countMap.get("currentNum") == null ? 0L : countMap.get("currentNum"));
//统计近半年数据
+ int n = 6;
List<PbWorkVO> list = new ArrayList<>();
- for(PbWorkVO workVO: listHalfYear()){
- PbWorkVO result = comPbDynDAO.countByTime(workVO.getStart(),workVO.getEnd(),communityId);
- result.setMonth(workVO.getMonth());
+ for(Map<String,String> map : listHalfYear(n)){
+ PbWorkVO result = comPbDynDAO.countByTime(map.get("start"),map.get("end"),communityId);
+ result.setMonth(map.get("name"));
list.add(result);
}
pbWorkScreenVO.setList(list);
@@ -152,26 +164,30 @@
}
- private List<PbWorkVO> listHalfYear() {
- List<PbWorkVO> dateList = new ArrayList<>();
+ private List<Map<String,String>> listHalfYear(int num) {
+ List<Map<String,String>> dateList = new ArrayList<>();
Date now = new Date();
- for(int i= 6;i>=1;i--){
- Date date = DateUtils.getDateM(now,i);
+ for(int i= num;i>=1;i--){
+ Date date = DateUtils.getDateM(now,-i);
DateTime endDay = DateUtil.endOfMonth(date);
- int m = endDay.month();//月份
- int day = DateUtil.dayOfMonth(date);
+
+ int m = DateUtil.month(endDay);
+ int day = DateUtil.dayOfMonth(endDay);
int half = day/2;
String month = DateUtil.format(date,moth_format_str);
- PbWorkVO pbWorkVO = new PbWorkVO();
- pbWorkVO.setMonth(m+"月上旬");
- pbWorkVO.setStart(month+ "-01 00:00:00");
- pbWorkVO.setEnd(month+ "-"+half+" 23:59:58");
- dateList.add(pbWorkVO);
- PbWorkVO pbWorkVO2 = new PbWorkVO();
- pbWorkVO2.setMonth(m+"月下旬");
- pbWorkVO2.setStart(month+ "-"+half+" 23:59:58");
- pbWorkVO2.setEnd(DateUtils.getDateFormatString(endDay,"yyyy-MM-dd HH:mm:ss"));
- dateList.add(pbWorkVO2);
+ if(Objects.equals(month,initMonth)){
+ continue;
+ }
+ Map<String,String> startMap = new HashMap<>();
+ startMap.put("name",monthStr[m]+"月上旬");
+ startMap.put("start",month+ "-01 00:00:00");
+ startMap.put("end",month+ "-"+half+" 23:59:58");
+ dateList.add(startMap);
+ Map<String,String> endMap = new HashMap<>();
+ endMap.put("name",monthStr[m]+"月下旬");
+ endMap.put("start",month+ "-"+half+" 23:59:58");
+ endMap.put("end",DateUtils.getDateFormatString(endDay,"yyyy-MM-dd HH:mm:ss"));
+ dateList.add(endMap);
}
return dateList;
@@ -180,48 +196,46 @@
@Override
public R easyPhoto(Long communityId) {
ComActEasyPhotoScreenVO comActEasyPhotoScreenVO = new ComActEasyPhotoScreenVO();
- Map<String,Long> dealMap = comActEasyPhotoDAO.countDeal(communityId);
- comActEasyPhotoScreenVO.setDeal(getList(dealMap));
- Map<String,Long> pubMap = comActEasyPhotoDAO.countPub(communityId);
- comActEasyPhotoScreenVO.setPub(getList(pubMap));
- Map<String,Long> approvedMap = comActEasyPhotoDAO.countApproved(communityId);
- comActEasyPhotoScreenVO.setApproved(getList(approvedMap));
-
- Map<String,Long> countMap = comActEasyPhotoDAO.countByCommunityId(communityId);
- comActEasyPhotoScreenVO.setNoneDeal(countMap.get("noneDeal") == null ? 0L : countMap.get("noneDeal"));
- comActEasyPhotoScreenVO.setPubPoint(countMap.get("pubPoint") == null ? 0L : countMap.get("pubPoint"));
- comActEasyPhotoScreenVO.setDealTime(countMap.get("dealTime") == null ? 0L : countMap.get("dealTime"));
+ comActEasyPhotoScreenVO.setDeal(comActEasyPhotoDAO.countDeal(communityId));
+ comActEasyPhotoScreenVO.setPub(comActEasyPhotoDAO.countPub(communityId));
+ comActEasyPhotoScreenVO.setApproved(comActEasyPhotoDAO.countApproved(communityId));
+ String date = DateUtils.getDateFormatString(new Date(),moth_format_str);
+ Map<String,Object> countMap = comActEasyPhotoDAO.countByCommunityId(communityId,date);
+ comActEasyPhotoScreenVO.setCurrentNum(countMap.get("currentNum") == null ? 0L : Long.valueOf(countMap.get("currentNum").toString()));
+ comActEasyPhotoScreenVO.setNoneDeal(countMap.get("noneDeal") == null ? 0L : Long.valueOf(countMap.get("noneDeal").toString()));
+ comActEasyPhotoScreenVO.setPubPoint(countMap.get("pubPoint") == null ? 0 : Integer.valueOf(countMap.get("pubPoint").toString()));
+ comActEasyPhotoScreenVO.setDealTime(countMap.get("dealTime") == null ? 0 : Double.valueOf(countMap.get("dealTime").toString()).intValue());
List<EastPhotoVO> list = new ArrayList<>();
- for(PbWorkVO workVO: listHalfYear()){
- String nowDate = DateUtils.getDateFormatString(DateUtil.parseDate(workVO.getStart()),moth_format_str);
- EastPhotoVO result = comActEasyPhotoDAO.countByTime(workVO.getStart(),workVO.getEnd(),nowDate,communityId);
- result.setMonth(workVO.getMonth());
+ //统计半年数据
+ int n = 6;
+ for(Map<String,String> map : listHalfYear(n)){
+ String nowDate = DateUtils.getDateFormatString(DateUtil.parseDate(map.get("start")),moth_format_str);
+ EastPhotoVO result = comActEasyPhotoDAO.countByTime(map.get("start"),map.get("end"),nowDate,communityId);
+ result.setMonth(map.get("name"));
list.add(result);
}
comActEasyPhotoScreenVO.setList(list);
+
+ Date start = DateUtil.parseTime(DateUtil.format(DateUtils.getDateM(new Date(),-n),moth_format_str)+" 00:00:00");
+ Date initTime = DateUtil.parseTime(initMonth +" 00:00:00");
+ if(DateUtils.before(start,initTime)){
+ start = initTime;
+ }
+ comActEasyPhotoScreenVO.setListTimes(DateUtil.format(start,moth_format_ch)+"-"+DateUtil.format(DateUtils.getDateM(new Date(),-1),moth_format_ch));
return R.ok(comActEasyPhotoScreenVO);
}
- private List<EasyPhotoPointVO> getList(Map<String, Long> dealMap) {
- Set<Map.Entry<String,Long>> entrySet = dealMap.entrySet();
-
- List<EasyPhotoPointVO> list = new ArrayList<>();
- for(Map.Entry<String,Long> en:entrySet){
- EasyPhotoPointVO easyPhotoPointVO = new EasyPhotoPointVO();
- easyPhotoPointVO.setTypeName(en.getKey());
- easyPhotoPointVO.setPoint(en.getValue().intValue());
- list.add(easyPhotoPointVO);
- }
- return list;
-
- }
-
@Override
public R workCount(Long communityId) {
ComActWorkScreenVO comActWorkScreenVO = new ComActWorkScreenVO();
+ //已完成
+// Map<String,Long> countMap = comActNeighborCircleDAO.countAllWorkBy(communityId);
+
+
+
comActWorkScreenVO.setAvgTime("1小时");
comActWorkScreenVO.setTotalCompletedPoint(70);
comActWorkScreenVO.setEveryDayNum("0.3");
--
Gitblit v1.7.1