|
|
@ -14,8 +14,6 @@ import org.jeecg.modules.communityActivityApply.entity.CommunityActivityApply; |
|
|
|
import org.jeecg.modules.communityActivityApply.service.ICommunityActivityApplyService; |
|
|
|
import org.jeecg.modules.communityActivityCollection.entity.CommunityActivityCollection; |
|
|
|
import org.jeecg.modules.communityActivityCollection.service.ICommunityActivityCollectionService; |
|
|
|
import org.jeecg.modules.communityGoods.entity.CommunityGoods; |
|
|
|
import org.jeecg.modules.communityGoodsCollection.entity.CommunityGoodsCollection; |
|
|
|
import org.jeecg.modules.communityScore.entity.CommunityScore; |
|
|
|
import org.jeecg.modules.communityScore.service.ICommunityScoreService; |
|
|
|
import org.jeecg.modules.hanHaiMember.entity.HanHaiMember; |
|
|
@ -23,6 +21,10 @@ import org.jeecg.modules.hanHaiMember.service.IHanHaiMemberService; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.time.DayOfWeek; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.util.Calendar; |
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
@Service |
|
|
|
@Slf4j |
|
|
@ -95,6 +97,12 @@ public class ActivityServiceImpl implements ActivityService { |
|
|
|
//获取活动信息 |
|
|
|
pageList = query.page(page); |
|
|
|
|
|
|
|
//判断活动日期是周几 |
|
|
|
for (CommunityActivity record : pageList.getRecords()) { |
|
|
|
String dayOfWeek = getDay(record.getActivityTime()); |
|
|
|
record.setDayOfWeek(dayOfWeek); |
|
|
|
} |
|
|
|
|
|
|
|
log.info("活动信息查询结束"); |
|
|
|
return Result.OK("活动列表", pageList); |
|
|
|
}catch (Exception e){ |
|
|
@ -401,7 +409,7 @@ public class ActivityServiceImpl implements ActivityService { |
|
|
|
CommunityActivity activity = communityActivityService |
|
|
|
.lambdaQuery() |
|
|
|
.eq(CommunityActivity::getId, activityId) |
|
|
|
.in(CommunityActivity::getStatus, 0, 1) |
|
|
|
.in(CommunityActivity::getStatus, 0) |
|
|
|
.one(); |
|
|
|
if(null == activity){ |
|
|
|
log.info("活动不存在或已经结束,请检查活动id:{}", activityId); |
|
|
@ -451,4 +459,46 @@ public class ActivityServiceImpl implements ActivityService { |
|
|
|
return Result.error("活动签到失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public String getDay(Date date){ |
|
|
|
|
|
|
|
String day = "周一"; |
|
|
|
// 将用户输入的日期解析为一个Date对象 |
|
|
|
Date date1 = date; |
|
|
|
|
|
|
|
// 创建一个Calendar对象 |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
|
|
|
// 设置日期 |
|
|
|
calendar.setTime(date); |
|
|
|
|
|
|
|
// 获取星期几 |
|
|
|
int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK) - 1; |
|
|
|
switch (dayOfWeek){ |
|
|
|
case 1: |
|
|
|
day = "周一"; |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
day = "周二"; |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
day = "周三"; |
|
|
|
break; |
|
|
|
case 4: |
|
|
|
day = "周四"; |
|
|
|
break; |
|
|
|
case 5: |
|
|
|
day = "周五"; |
|
|
|
break; |
|
|
|
case 6: |
|
|
|
day = "周六"; |
|
|
|
break; |
|
|
|
case 0: |
|
|
|
day = "周日"; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
return day; |
|
|
|
} |
|
|
|
|
|
|
|
} |