From ac9a9743d185d46ec7dca7577402dfef6a553eed Mon Sep 17 00:00:00 2001
From: 101captain <237651143@qq.com>
Date: 星期三, 27 四月 2022 11:09:00 +0800
Subject: [PATCH] Merge branch 'huacheng' of http://gitlab.nhys.cdnhxx.com/root/zhihuishequ into huacheng
---
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ScreenWorkServiceImpl.java | 257 ++++++++++++++++++++++++++------------------------
1 files changed, 133 insertions(+), 124 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 c121e20..e978d53 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
@@ -1,9 +1,14 @@
package com.panzhihua.service_community.service.impl;
-import cn.hutool.core.date.DateTime;
-import cn.hutool.core.date.DateUtil;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.*;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Service;
+
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.panzhihua.common.model.dtos.partybuilding.ComPbActivityDTO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.screen.*;
import com.panzhihua.common.utlis.DateUtils;
@@ -12,15 +17,9 @@
import com.panzhihua.service_community.model.dos.ComActDO;
import com.panzhihua.service_community.model.dos.ComActDynDO;
import com.panzhihua.service_community.service.ScreenWorkService;
-import org.apache.commons.net.ntp.TimeStamp;
-import org.springframework.stereotype.Service;
-import javax.annotation.Resource;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.util.*;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
/**
* @author xyh
@@ -30,7 +29,8 @@
public class ScreenWorkServiceImpl implements ScreenWorkService {
private static final Integer pageSize = 200;
-
+ private final String moth_format_str = "yyyy-MM";
+ private final String[] monthStr = new String[] {"一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"};
@Resource
private ComActDAO comActDAO;
@Resource
@@ -48,57 +48,55 @@
@Resource
private ComActEasyPhotoDAO comActEasyPhotoDAO;
- private final String moth_format_str = "yyyy-MM";
-
- private final String[] monthStr = new String[]{"一","二","三","四","五","六","七","八","九","十","十一","十二"};
-
@Override
public R statisticNeighborCircle(Long communityId) {
ComActNeighborCircleScreenVO comActNeighborCircleScreenVO = new ComActNeighborCircleScreenVO();
- String date = DateUtils.getDateFormatString(new Date(),moth_format_str);
- Map<String,Long> countMap = comActNeighborCircleDAO.countByCommunityId(communityId,date);
+ String date = DateUtils.getDateFormatString(new Date(), moth_format_str);
+ Map<String, Long> countMap = comActNeighborCircleDAO.countByCommunityId(communityId, date);
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));
- //查询最近发布的邻里圈图片
- comActNeighborCircleScreenVO.setImgs(convertStringList(comActNeighborCircleDAO.screenNeighborCircleImgs(communityId,pageSize)));
+ 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));
+ // 查询最近发布的邻里圈图片
+ comActNeighborCircleScreenVO
+ .setImgs(convertStringList(comActNeighborCircleDAO.screenNeighborCircleImgs(communityId, pageSize)));
return R.ok(comActNeighborCircleScreenVO);
}
@Override
public R wish(Long communityId) {
ComActMicroWishScreenVO wishScreenVO = new ComActMicroWishScreenVO();
- String date = DateUtils.getDateFormatString(new Date(),moth_format_str);
- //统计本月新增,累计实现,待实现
- Map<String,Long> countMap = comActMicroWishDAO.countByCommunityId(communityId,date);
+ String date = DateUtils.getDateFormatString(new Date(), moth_format_str);
+ // 统计本月新增,累计实现,待实现
+ Map<String, Long> countMap = comActMicroWishDAO.countByCommunityId(communityId, date);
wishScreenVO.setCompletedNum(countMap.get("completedNum") == null ? 0L : countMap.get("completedNum"));
wishScreenVO.setWillNum(countMap.get("willNum") == null ? 0L : countMap.get("willNum"));
wishScreenVO.setCurrentNum(countMap.get("currentNum") == null ? 0L : countMap.get("currentNum"));
- //微心愿轮播图片
- wishScreenVO.setImgs(convertStringList(comActMicroWishDAO.getAllImgs(communityId,pageSize)));
+ // 微心愿轮播图片
+ wishScreenVO.setImgs(convertStringList(comActMicroWishDAO.getAllImgs(communityId, pageSize)));
return R.ok(wishScreenVO);
}
-
-
private List<String> convertStringList(List<String> imgList) {
List<String> imgs = new ArrayList<>();
- for(String img:imgList){
- if(StringUtils.isEmpty(img)){
+ for (String img : imgList) {
+ if (StringUtils.isEmpty(img)) {
continue;
}
String[] arrs = img.split(",");
- if(arrs.length > 1){
- for(String arr: arrs){
+ if (arrs.length > 1) {
+ for (String arr : arrs) {
imgs.add(arr);
}
- }else{
+ } else {
imgs.add(img);
}
}
@@ -110,49 +108,52 @@
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);
+ // 统计本月新增、居民活动,志愿者活动
+ 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.setList(actActivityDAO.screenActivity(communityId,pageSize));
+ 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.setList(actActivityDAO.screenActivity(communityId, pageSize));
return R.ok(comActActivityScreenVO);
}
@Override
public R discuss(Long communityId) {
ComActDiscussScreenVO discussScreenVO = new ComActDiscussScreenVO();
- //统计本月新增,总共,图文,投票
- String date = DateUtils.getDateFormatString(new Date(),moth_format_str);
- Map<String,Long> countMap = comActDiscussDAO.countByCommunityId(communityId,date);
+ // 统计本月新增,总共,图文,投票
+ 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.setVotePeopleNum(countMap.get("votePeopleNum") == null ? 0L : countMap.get("votePeopleNum"));
- discussScreenVO.setList(comActDiscussDAO.screenDiscuss(communityId,pageSize));
+ discussScreenVO.setList(comActDiscussDAO.screenDiscuss(communityId, pageSize));
return R.ok(discussScreenVO);
}
@Override
public R pbWork(Long communityId) {
ComPbWorkScreenVO pbWorkScreenVO = new ComPbWorkScreenVO();
- String date = DateUtils.getDateFormatString(new Date(),moth_format_str);
- Map<String,Long> countMap = comPbDynDAO.countByCommunityId(communityId,date);
+ String date = DateUtils.getDateFormatString(new Date(), moth_format_str);
+ Map<String, Long> countMap = comPbDynDAO.countByCommunityId(communityId, date);
pbWorkScreenVO.setActivityNum(countMap.get("activityNum") == null ? 0L : countMap.get("activityNum"));
pbWorkScreenVO.setDynNum(countMap.get("dynNum") == null ? 0L : countMap.get("dynNum"));
pbWorkScreenVO.setTotalNum(pbWorkScreenVO.getActivityNum() + pbWorkScreenVO.getDynNum());
pbWorkScreenVO.setCurrentNum(countMap.get("currentNum") == null ? 0L : countMap.get("currentNum"));
- //统计近半年数据
+ // 统计近半年数据
List<PbWorkVO> list = new ArrayList<>();
- for(PbWorkVO workVO: listHalfYear()){
- PbWorkVO result = comPbDynDAO.countByTime(workVO.getStart(),workVO.getEnd(),communityId);
+ for (PbWorkVO workVO : listHalfYear()) {
+ PbWorkVO result = comPbDynDAO.countByTime(workVO.getStart(), workVO.getEnd(), communityId);
result.setMonth(workVO.getMonth());
list.add(result);
}
@@ -160,31 +161,30 @@
return R.ok(pbWorkScreenVO);
}
-
private List<PbWorkVO> listHalfYear() {
List<PbWorkVO> dateList = new ArrayList<>();
- Date now = new Date();
- for(int i= 6;i>=1;i--){
- Date date = DateUtils.getDateM(now,-i);
+ Date now = new Date();
+ for (int i = 6; i >= 1; i--) {
+ Date date = DateUtils.getDateM(now, -i);
DateTime endDay = DateUtil.endOfMonth(date);
int m = DateUtil.month(endDay);
- if(m == 0){
+ if (m == 0) {
m = 12;
}
m--;
int day = DateUtil.dayOfMonth(endDay);
- int half = day/2;
- String month = DateUtil.format(date,moth_format_str);
+ int half = day / 2;
+ String month = DateUtil.format(date, moth_format_str);
PbWorkVO pbWorkVO = new PbWorkVO();
- pbWorkVO.setMonth(monthStr[m]+"月上旬");
- pbWorkVO.setStart(month+ "-01 00:00:00");
- pbWorkVO.setEnd(month+ "-"+half+" 23:59:58");
+ pbWorkVO.setMonth(monthStr[m] + "月上旬");
+ pbWorkVO.setStart(month + "-01 00:00:00");
+ pbWorkVO.setEnd(month + "-" + half + " 23:59:58");
dateList.add(pbWorkVO);
PbWorkVO pbWorkVO2 = new PbWorkVO();
- pbWorkVO2.setMonth(monthStr[m]+"月下旬");
- pbWorkVO2.setStart(month+ "-"+half+" 23:59:58");
- pbWorkVO2.setEnd(DateUtils.getDateFormatString(endDay,"yyyy-MM-dd HH:mm:ss"));
+ pbWorkVO2.setMonth(monthStr[m] + "月下旬");
+ pbWorkVO2.setStart(month + "-" + half + " 23:59:58");
+ pbWorkVO2.setEnd(DateUtils.getDateFormatString(endDay, "yyyy-MM-dd HH:mm:ss"));
dateList.add(pbWorkVO2);
}
return dateList;
@@ -197,16 +197,21 @@
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());
+ 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);
+ 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());
list.add(result);
}
@@ -215,10 +220,10 @@
}
private List<EasyPhotoPointVO> getList(Map<String, Long> dealMap) {
- Set<Map.Entry<String,Long>> entrySet = dealMap.entrySet();
+ Set<Map.Entry<String, Long>> entrySet = dealMap.entrySet();
List<EasyPhotoPointVO> list = new ArrayList<>();
- for(Map.Entry<String,Long> en:entrySet){
+ for (Map.Entry<String, Long> en : entrySet) {
EasyPhotoPointVO easyPhotoPointVO = new EasyPhotoPointVO();
easyPhotoPointVO.setTypeName(en.getKey());
easyPhotoPointVO.setPoint(en.getValue().intValue());
@@ -231,72 +236,79 @@
@Override
public R workCount(Long communityId) {
ComActWorkScreenVO comActWorkScreenVO = new ComActWorkScreenVO();
- //已完成
+ // 已完成
comActWorkScreenVO.setCompletetList(comActNeighborCircleDAO.countAllCompletedWorkByCommunityId(communityId));
- //未完成
+ // 未完成
comActWorkScreenVO.setNoneList(comActNeighborCircleDAO.countAllNoneCompletedWorkByCommunityId(communityId));
- comActWorkScreenVO.setTotalCompleted(comActWorkScreenVO.getCompletetList().stream().mapToInt(PieElementVO::getNum).sum());
- comActWorkScreenVO.setTotalNoneCompleted(comActWorkScreenVO.getNoneList().stream().mapToInt(PieElementVO::getNum).sum());
+ comActWorkScreenVO
+ .setTotalCompleted(comActWorkScreenVO.getCompletetList().stream().mapToInt(PieElementVO::getNum).sum());
+ comActWorkScreenVO
+ .setTotalNoneCompleted(comActWorkScreenVO.getNoneList().stream().mapToInt(PieElementVO::getNum).sum());
- //统计平均耗时、平均每天完成个数
- Map<String,Object> avgMap = comActNeighborCircleDAO.countAvgByCommunityId(communityId);
- comActWorkScreenVO.setAvgTime(avgMap.get("avgTime") == null?"0h":convertTimeStr(Double.valueOf(avgMap.get("avgTime").toString()).intValue()));
+ // 统计平均耗时、平均每天完成个数
+ Map<String, Object> avgMap = comActNeighborCircleDAO.countAvgByCommunityId(communityId);
+ comActWorkScreenVO.setAvgTime(avgMap.get("avgTime") == null ? "0h"
+ : convertTimeStr(Double.valueOf(avgMap.get("avgTime").toString()).intValue()));
ComActDO comActDO = comActDAO.selectById(communityId);
- BigDecimal days = new BigDecimal(DateUtil.betweenDay(comActDO.getCreateAt(),new Date(),false));
+ BigDecimal days = new BigDecimal(DateUtil.betweenDay(comActDO.getCreateAt(), new Date(), false));
BigDecimal num = new BigDecimal(comActWorkScreenVO.getTotalCompleted());
- BigDecimal rt = num.divide(days,1, RoundingMode.HALF_UP);
+ BigDecimal rt = num.divide(days, 1, RoundingMode.HALF_UP);
comActWorkScreenVO.setEveryDayNum(rt.toString());
return R.ok(comActWorkScreenVO);
}
private String convertTimeStr(int minute) {
- int hour = minute/60;
- int min = minute%60;
+ int hour = minute / 60;
+ int min = minute % 60;
StringBuilder timestr = new StringBuilder();
- if(hour > 0){
+ if (hour > 0) {
timestr.append(hour).append("h");
}
- if(min > 0){
+ if (min > 0) {
timestr.append(min).append("min");
}
return timestr.toString();
}
@Override
- public R dynamicWork(Long communityId){
+ public R dynamicWork(Long communityId) {
ComDynamicWorkScreenVO workScreenVO = new ComDynamicWorkScreenVO();
- String date = DateUtils.getDateFormatString(new Date(),moth_format_str);
- Map<String,Long> countMap = comActDynDAO.countByCommunityId(communityId,date);
- if(!countMap.isEmpty()){
- workScreenVO.setTotalNum(countMap.get("dynTotal")== null ? 0L : Long.valueOf(countMap.get("dynTotal").toString()));
- workScreenVO.setCurrentNum(countMap.get("currentNum")== null ? 0L : Long.valueOf(countMap.get("currentNum").toString()));
+ String date = DateUtils.getDateFormatString(new Date(), moth_format_str);
+ Map<String, Long> countMap = comActDynDAO.countByCommunityId(communityId, date);
+ if (!countMap.isEmpty()) {
+ workScreenVO
+ .setTotalNum(countMap.get("dynTotal") == null ? 0L : Long.valueOf(countMap.get("dynTotal").toString()));
+ workScreenVO.setCurrentNum(
+ countMap.get("currentNum") == null ? 0L : Long.valueOf(countMap.get("currentNum").toString()));
}
- //计算平均每天动态
+ // 计算平均每天动态
DateScreenVO countAvg = comActDynDAO.countByAvgCommunityId(communityId);
- if(countAvg != null){
- int day = DateUtils.differentDays(countAvg.getStartTime(),countAvg.getEndTime());
- if(day > 0){
- workScreenVO.setCurrentAvgNum(workScreenVO.getTotalNum().intValue()/day);
+ if (countAvg != null) {
+ int day = DateUtils.differentDays(countAvg.getStartTime(), countAvg.getEndTime());
+ if (day > 0) {
+ workScreenVO.setCurrentAvgNum(workScreenVO.getTotalNum().intValue() / day);
}
}
- //查询最新的10条社区动态
+ // 查询最新的10条社区动态
List<String> dynList = new ArrayList<>();
- List<ComActDynDO> actDynDOList = comActDynDAO.selectList(new QueryWrapper<ComActDynDO>().lambda().eq(ComActDynDO::getCommunityId,communityId).orderByDesc(ComActDynDO::getCreateAt).last("limit 10"));
- if(!actDynDOList.isEmpty()){
+ List<ComActDynDO> actDynDOList = comActDynDAO.selectList(new QueryWrapper<ComActDynDO>().lambda()
+ .eq(ComActDynDO::getCommunityId, communityId).orderByDesc(ComActDynDO::getCreateAt).last("limit 10"));
+ if (!actDynDOList.isEmpty()) {
actDynDOList.forEach(actDyn -> {
dynList.add(actDyn.getTitle());
});
}
workScreenVO.setDynList(dynList);
- //统计近半年数据
+ // 统计近半年数据
List<DynamicWorkVO> list = new ArrayList<>();
- for(DynamicWorkVO dynamicWorkVO: listHalfYearByDyn()){
- DynamicWorkVO result = comActDynDAO.countByTime(dynamicWorkVO.getStart(),dynamicWorkVO.getEnd(),communityId);
+ for (DynamicWorkVO dynamicWorkVO : listHalfYearByDyn()) {
+ DynamicWorkVO result =
+ comActDynDAO.countByTime(dynamicWorkVO.getStart(), dynamicWorkVO.getEnd(), communityId);
result.setMonth(dynamicWorkVO.getMonth());
list.add(result);
}
@@ -307,32 +319,29 @@
private List<DynamicWorkVO> listHalfYearByDyn() {
List<DynamicWorkVO> dateList = new ArrayList<>();
- Date now = new Date();
- for(int i= 6;i>=1;i--){
- Date date = DateUtils.getDateM(now,-i);
+ Date now = new Date();
+ for (int i = 5; i >= 0; i--) {
+ Date date = DateUtils.getDateM(now, -i);
DateTime endDay = DateUtil.endOfMonth(date);
int m = DateUtil.month(endDay);
m++;
- if(m == 12){
- m = 0;
- }
int day = DateUtil.dayOfMonth(endDay);
- int half = day/2;
- String month = DateUtil.format(date,moth_format_str);
+ int half = day / 2;
+ String month = DateUtil.format(date, moth_format_str);
DynamicWorkVO dynamicWorkVO = new DynamicWorkVO();
- dynamicWorkVO.setMonth(monthStr[m]+"月上旬");
- dynamicWorkVO.setStart(month+ "-01 00:00:00");
- dynamicWorkVO.setEnd(month+ "-"+half+" 23:59:58");
+ dynamicWorkVO.setMonth(monthStr[m-1] + "月上旬");
+ dynamicWorkVO.setStart(month + "-01 00:00:00");
+ dynamicWorkVO.setEnd(month + "-" + half + " 23:59:58");
dateList.add(dynamicWorkVO);
DynamicWorkVO dynamicWorkVO1 = new DynamicWorkVO();
- dynamicWorkVO1.setMonth(monthStr[m]+"月下旬");
- dynamicWorkVO1.setStart(month+ "-"+half+" 23:59:58");
- dynamicWorkVO1.setEnd(DateUtils.getDateFormatString(endDay,"yyyy-MM-dd HH:mm:ss"));
+ dynamicWorkVO1.setMonth(monthStr[m-1] + "月下旬");
+ dynamicWorkVO1.setStart(month + "-" + half + " 23:59:58");
+ dynamicWorkVO1.setEnd(DateUtils.getDateFormatString(endDay, "yyyy-MM-dd HH:mm:ss"));
dateList.add(dynamicWorkVO1);
}
return dateList;
-
}
+
}
--
Gitblit v1.7.1