| | |
| | | package com.panzhihua.timejob.jobhandler; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.panzhihua.common.model.dtos.community.integral.admin.AddComActIntegralUserDTO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.ActivitySignVO; |
| | | import com.panzhihua.common.model.vos.community.ComActActivityVO; |
| | | import com.panzhihua.common.model.vos.community.ComMngCarExcelVO; |
| | | import com.panzhihua.common.model.vos.community.integral.admin.ComActActivityPeopleVO; |
| | | import com.panzhihua.common.model.vos.user.SysUserNoticeVO; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import com.xxl.job.core.biz.model.ReturnT; |
| | | import com.xxl.job.core.handler.annotation.XxlJob; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | |
| | | |
| | | /** |
| | | * 定时任务刷新社区动态置顶状态 |
| | | * |
| | | * @return 刷新个数 |
| | | * @throws Exception 出现的异常 |
| | | * @throws Exception |
| | | * 出现的异常 |
| | | */ |
| | | @XxlJob("timedTaskDynIstoppingJobHandler") |
| | | public ReturnT<String> timedTaskDynIstoppingJobHandler(String param) throws Exception { |
| | | log.info("定时任务刷新社区动态置顶状态"); |
| | | R r=communityService.timedTaskDynIstopping(); |
| | | log.info("执行结果【{}】",r.toString()); |
| | | R r = communityService.timedTaskDynIstopping(); |
| | | log.info("执行结果【{}】", r.toString()); |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | /** |
| | | * 定时任务刷新社区动态发布状态 |
| | | * |
| | | * @return 刷新个数 |
| | | * @throws Exception 出现的异常 |
| | | * @throws Exception |
| | | * 出现的异常 |
| | | */ |
| | | @XxlJob("timedTaskDynStatusJobHandler") |
| | | public ReturnT<String> timedTaskDynStatusJobHandler(String param) throws Exception { |
| | | log.info("定时任务刷新社区动态发布状态"); |
| | | R r=communityService.timedTaskDynStatus(); |
| | | log.info("执行结果【{}】",r.toString()); |
| | | R r = communityService.timedTaskDynStatus(); |
| | | log.info("执行结果【{}】", r.toString()); |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | /** |
| | | * 定时任务取消社区活动 |
| | | * |
| | | * @return 刷新个数 |
| | | * @throws Exception 出现的异常 |
| | | * @throws Exception |
| | | * 出现的异常 |
| | | */ |
| | | @XxlJob("timedTaskActActivityJobHandler") |
| | | public ReturnT<String> timedTaskActActivityJobHandler(String param) throws Exception { |
| | | log.info("定时任务取消社区活动"); |
| | | R r=communityService.timedTaskActActivity(); |
| | | R r = communityService.timedTaskActActivity(); |
| | | if (R.isOk(r)) { |
| | | Object data = r.getData(); |
| | | if (!ObjectUtils.isEmpty(data)) { |
| | | List<ComActActivityVO> comActActivityVOS= JSONArray.parseArray(JSONArray.toJSONString(data),ComActActivityVO.class); |
| | | List<ComActActivityVO> comActActivityVOS = |
| | | JSONArray.parseArray(JSONArray.toJSONString(data), ComActActivityVO.class); |
| | | if (!ObjectUtils.isEmpty(comActActivityVOS)) { |
| | | comActActivityVOS.forEach(comActActivityVO -> { |
| | | List<ActivitySignVO> activitySignVOList = comActActivityVO.getActivitySignVOList(); |
| | |
| | | sysUserNoticeVO.setTitle("活动因故取消"); |
| | | sysUserNoticeVO.setBusinessContent("报名人数不足活动自动取消"); |
| | | sysUserNoticeVO.setBusinessStatus(1); |
| | | sysUserNoticeVO.setActivityType(activitySignVO.getIsVolunteer().intValue()==1?1:2); |
| | | sysUserNoticeVO |
| | | .setActivityType(activitySignVO.getIsVolunteer().intValue() == 1 ? 1 : 2); |
| | | R r2 = userService.addNotice(sysUserNoticeVO); |
| | | if (R.isOk(r2)) { |
| | | log.info("新增社区活动取消通知成功【{}】", JSONObject.toJSONString(sysUserNoticeVO)); |
| | |
| | | } |
| | | } |
| | | } |
| | | log.info("执行结果【{}】",r.toString()); |
| | | log.info("执行结果【{}】", r.toString()); |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | /** |
| | | * 定时任务刷新社区活动的各个状态 除取消外 |
| | | * |
| | | * @return 刷新个数 |
| | | * @throws Exception 出现的异常 |
| | | * @throws Exception |
| | | * 出现的异常 |
| | | */ |
| | | @XxlJob("timedTaskActActivityAllJobHandler") |
| | | public ReturnT<String> timedTaskActActivityAllJobHandler(String param) throws Exception { |
| | | log.info("定时任务刷新社区活动的各个状态 除取消外"); |
| | | R r=communityService.timedTaskActActivityAll(); |
| | | if(R.isOk(r)){ |
| | | //获取待结束的活动列表 |
| | | R r = communityService.timedTaskActActivityAll(); |
| | | if (R.isOk(r)) { |
| | | // 获取待结束的活动列表 |
| | | List<Long> activityList = JSONArray.parseArray(JSONArray.toJSONString(r.getData()), Long.class); |
| | | if(!activityList.isEmpty()){ |
| | | if (!activityList.isEmpty()) { |
| | | log.info("社区活动结束时计算积分"); |
| | | activityList.forEach(activityId -> { |
| | | R r1 = communityService.getTaskActivityPeopleList(activityId); |
| | | if (R.isOk(r1)){ |
| | | List<ComActActivityPeopleVO> peopleList = JSONArray.parseArray(JSONArray.toJSONString(r1.getData()), ComActActivityPeopleVO.class); |
| | | if (!peopleList.isEmpty()){ |
| | | if (R.isOk(r1)) { |
| | | List<ComActActivityPeopleVO> peopleList = |
| | | JSONArray.parseArray(JSONArray.toJSONString(r1.getData()), ComActActivityPeopleVO.class); |
| | | if (!peopleList.isEmpty()) { |
| | | peopleList.forEach(people -> { |
| | | if(people.getIsVolunteer().equals(1)){ |
| | | communityService.addIntegralTradeAdmin(new AddComActIntegralUserDTO(people.getActivityId() |
| | | ,AddComActIntegralUserDTO.integralType.cyzyzhd,people.getCommunityId(),people.getUserId())); |
| | | }else{ |
| | | communityService.addIntegralTradeAdmin(new AddComActIntegralUserDTO(people.getActivityId() |
| | | ,AddComActIntegralUserDTO.integralType.cysqhd,people.getCommunityId(),people.getUserId())); |
| | | if (people.getIsVolunteer().equals(1)) { |
| | | communityService.addIntegralTradeAdmin(new AddComActIntegralUserDTO( |
| | | people.getActivityId(), AddComActIntegralUserDTO.integralType.cyzyzhd, |
| | | people.getCommunityId(), people.getUserId())); |
| | | } else { |
| | | communityService.addIntegralTradeAdmin(new AddComActIntegralUserDTO( |
| | | people.getActivityId(), AddComActIntegralUserDTO.integralType.cysqhd, |
| | | people.getCommunityId(), people.getUserId())); |
| | | } |
| | | }); |
| | | } |
| | |
| | | }); |
| | | } |
| | | } |
| | | log.info("执行结果【{}】",r.toString()); |
| | | log.info("执行结果【{}】", r.toString()); |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 定时任务刷新社区活动的各个状态 除取消外 |
| | | * |
| | | * @return 刷新个数 |
| | | * @throws Exception 出现的异常 |
| | | * @throws Exception |
| | | * 出现的异常 |
| | | */ |
| | | @XxlJob("timedTaskActMicroWishAllJobHandler") |
| | | public ReturnT<String> timedTaskActMicroWishAllJobHandler(String param) throws Exception { |
| | | log.info("定时任务刷新微心愿 待自动确认的状态"); |
| | | R r=communityService.timedTaskActMicroWishAll(); |
| | | log.info("执行结果【{}】",r.toString()); |
| | | R r = communityService.timedTaskActMicroWishAll(); |
| | | log.info("执行结果【{}】", r.toString()); |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | |
| | | * 定时任务检测即将开始的社区活动,并使用订阅消息通知用户 |
| | | */ |
| | | @XxlJob("timedTaskActivityNoticeJobHandler") |
| | | public ReturnT<String> timedTaskActivityNoticeJobHandler(String param){ |
| | | public ReturnT<String> timedTaskActivityNoticeJobHandler(String param) { |
| | | log.info("定时任务检测即将开始的社区活动,并使用订阅消息通知用户"); |
| | | R r=communityService.timedTaskActivityNotice(); |
| | | log.info("执行结果【{}】",r.toString()); |
| | | R r = communityService.timedTaskActivityNotice(); |
| | | log.info("执行结果【{}】", r.toString()); |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | |
| | | * 定时任务检测待发布,调研中的问卷调查状态 |
| | | */ |
| | | @XxlJob("timedTaskQuestionnaireJobHandler") |
| | | public ReturnT<String> timedTaskQuestionnaireJobHandler(String param){ |
| | | public ReturnT<String> timedTaskQuestionnaireJobHandler(String param) { |
| | | log.info("定时任务检测待发布,调研中的问卷调查状态"); |
| | | R r=communityService.timedTaskQuestionnaire(); |
| | | log.info("执行结果【{}】",r.toString()); |
| | | R r = communityService.timedTaskQuestionnaire(); |
| | | log.info("执行结果【{}】", r.toString()); |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | /** |
| | | * 定时任务针对活动结束后7天还未评价的用户默认好评 |
| | | */ |
| | | @XxlJob("timedTaskActivityDefaultPraiseJobHandler") |
| | | public ReturnT<String> timedTaskActivityDefaultPraiseJobHandler(String param) throws Exception { |
| | | log.info("定时任务针对活动结束后7天还未评价的用户默认好评"); |
| | | R r = communityService.timedTaskActivityDefaultPraise(); |
| | | log.info("执行结果【{}】", r.toString()); |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | } |