| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.google.common.collect.ImmutableMap; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.system.dto.TCommunityActivityDTO; |
| | | import com.ruoyi.system.model.TCommunityActivity; |
| | | import com.ruoyi.system.model.TCommunityActivityRegistration; |
| | | import com.ruoyi.system.query.RegistrationPageListQuery; |
| | | import com.ruoyi.system.query.TCommunityActivityQuery; |
| | | import com.ruoyi.system.service.TCommunityActivityRegistrationService; |
| | | import com.ruoyi.system.service.TCommunityActivityService; |
| | | import com.ruoyi.system.task.base.QuartzManager; |
| | | import com.ruoyi.system.task.base.TimeJobType; |
| | | import com.ruoyi.system.task.jobs.ActivityPush; |
| | | import com.ruoyi.system.vo.TCommunityActivityVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author xiaochen |
| | | * @since 2025-11-06 |
| | | */ |
| | | @Api(tags = "社区活动管理") |
| | | @RestController |
| | | @RequestMapping("/t-community-activity") |
| | | public class TCommunityActivityController { |
| | | |
| | | private final TCommunityActivityService communityActivityService; |
| | | private final TCommunityActivityRegistrationService communityActivityRegistrationService; |
| | | @Autowired |
| | | public TCommunityActivityController(TCommunityActivityService communityActivityService, TCommunityActivityRegistrationService communityActivityRegistrationService) { |
| | | this.communityActivityService = communityActivityService; |
| | | this.communityActivityRegistrationService = communityActivityRegistrationService; |
| | | } |
| | | |
| | | /** |
| | | * 获取社区活动管理管理列表 |
| | | */ |
| | | @ApiOperation(value = "获取社区活动管理分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TCommunityActivityVO>> pageList(@RequestBody TCommunityActivityQuery query) { |
| | | return R.ok(communityActivityService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 获取社区活动管理管理列表 |
| | | */ |
| | | @ApiOperation(value = "获取社区活动报名信息分页列表") |
| | | @PostMapping(value = "/registrationPageList") |
| | | public R<PageInfo<TCommunityActivityRegistration>> registrationPageList(@RequestBody RegistrationPageListQuery query) { |
| | | return R.ok(communityActivityRegistrationService.registrationPageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 添加社区活动管理管理 |
| | | */ |
| | | @Log(title = "社区活动管理信息-新增社区活动管理", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "添加社区活动管理") |
| | | @PostMapping(value = "/add") |
| | | public R<Boolean> add(@Validated @RequestBody TCommunityActivityDTO dto) { |
| | | if (communityActivityService.isExit(dto)) { |
| | | return R.fail("社区活动标题已存在"); |
| | | } |
| | | LocalDateTime startTime = dto.getStartTime(); |
| | | LocalDateTime endTime = dto.getEndTime(); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | if(now.isBefore(startTime)){ |
| | | dto.setStatus(1); |
| | | } |
| | | if(now.isAfter(startTime) && now.isBefore(endTime)){ |
| | | dto.setStatus(2); |
| | | } |
| | | if(now.isAfter(endTime)){ |
| | | dto.setStatus(3); |
| | | } |
| | | communityActivityService.save(dto); |
| | | if(now.isBefore(startTime)){ |
| | | // 添加定时任务 |
| | | Map<String, ? extends Object> maps = |
| | | new ImmutableMap.Builder<String, String>(). |
| | | put("id", dto.getId()).put("type","1") |
| | | .build(); |
| | | QuartzManager.addJob( |
| | | ActivityPush.class, |
| | | (ActivityPush.name+dto.getId()).toUpperCase(), |
| | | TimeJobType.ACTIVITY_PUSH, |
| | | DateUtils.localDateTimeToDate(dto.getStartTime()), |
| | | maps |
| | | ); |
| | | } |
| | | if(now.isAfter(startTime) && now.isBefore(endTime)){ |
| | | // 添加定时任务 |
| | | Map<String, ? extends Object> maps = |
| | | new ImmutableMap.Builder<String, String>(). |
| | | put("id", dto.getId()).put("type","2") |
| | | .build(); |
| | | QuartzManager.addJob( |
| | | ActivityPush.class, |
| | | (ActivityPush.name+dto.getId()).toUpperCase(), |
| | | TimeJobType.ACTIVITY_PUSH, |
| | | DateUtils.localDateTimeToDate(dto.getEndTime()), |
| | | maps |
| | | ); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 修改社区活动管理 |
| | | */ |
| | | @Log(title = "社区活动管理信息-修改社区活动管理", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "修改社区活动管理") |
| | | @PostMapping(value = "/update") |
| | | public R<Boolean> update(@Validated @RequestBody TCommunityActivityDTO dto) { |
| | | if (communityActivityService.isExit(dto)) { |
| | | return R.fail("社区活动标题已存在"); |
| | | } |
| | | TCommunityActivity communityActivity = communityActivityService.getById(dto.getId()); |
| | | if(communityActivity.getStatus() == 2 || communityActivity.getStatus() == 3){ |
| | | return R.fail("投票正在进行中或已结束,无法修改"); |
| | | } |
| | | LocalDateTime startTime = dto.getStartTime(); |
| | | LocalDateTime endTime = dto.getEndTime(); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | if(now.isBefore(startTime)){ |
| | | dto.setStatus(1); |
| | | // 添加定时任务 |
| | | Map<String, ? extends Object> maps = |
| | | new ImmutableMap.Builder<String, String>(). |
| | | put("id", communityActivity.getId()).put("type","1") |
| | | .build(); |
| | | QuartzManager.addJob( |
| | | ActivityPush.class, |
| | | (ActivityPush.name+communityActivity.getId()).toUpperCase(), |
| | | TimeJobType.ACTIVITY_PUSH, |
| | | DateUtils.localDateTimeToDate(communityActivity.getStartTime()), |
| | | maps |
| | | ); |
| | | } |
| | | if(now.isAfter(startTime) && now.isBefore(endTime)){ |
| | | dto.setStatus(2); |
| | | // 添加定时任务 |
| | | Map<String, ? extends Object> maps = |
| | | new ImmutableMap.Builder<String, String>(). |
| | | put("id", communityActivity.getId()).put("type","2") |
| | | .build(); |
| | | QuartzManager.addJob( |
| | | ActivityPush.class, |
| | | (ActivityPush.name+communityActivity.getId()).toUpperCase(), |
| | | TimeJobType.ACTIVITY_PUSH, |
| | | DateUtils.localDateTimeToDate(communityActivity.getEndTime()), |
| | | maps |
| | | ); |
| | | } |
| | | if(now.isAfter(endTime)){ |
| | | dto.setStatus(3); |
| | | } |
| | | communityActivityService.updateById(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 查看社区活动管理详情 |
| | | */ |
| | | @ApiOperation(value = "查看社区活动管理详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TCommunityActivity> getDetailById(@RequestParam String id) { |
| | | TCommunityActivity communityActivity = communityActivityService.getById(id); |
| | | return R.ok(communityActivity); |
| | | } |
| | | |
| | | /** |
| | | * 删除社区活动管理 |
| | | */ |
| | | @Log(title = "社区活动管理信息-删除社区活动管理", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除社区活动管理") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public R<Boolean> deleteById(@RequestParam String id) { |
| | | return R.ok(communityActivityService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除社区活动管理 |
| | | */ |
| | | @Log(title = "社区活动管理信息-删除社区活动管理", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除社区活动管理") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public R<Boolean> deleteByIds(@RequestBody List<String> ids) { |
| | | return R.ok(communityActivityService.removeByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | | * 社区活动发布和完成 |
| | | */ |
| | | @Log(title = "社区活动管理信息-社区活动发布和完成", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "社区活动发布和完成") |
| | | @PostMapping(value = "/updateReleaseFinish") |
| | | public R<Boolean> updateReleaseFinish(@RequestParam(value = "id") String id, |
| | | @RequestParam(value = "status") Integer status) { |
| | | |
| | | TCommunityActivity communityActivity = communityActivityService.getById(id); |
| | | if(status == 2){ |
| | | // 添加定时任务 |
| | | Map<String, ? extends Object> maps = |
| | | new ImmutableMap.Builder<String, String>(). |
| | | put("id", communityActivity.getId()).put("type","2") |
| | | .build(); |
| | | QuartzManager.addJob( |
| | | ActivityPush.class, |
| | | (ActivityPush.name+communityActivity.getId()).toUpperCase(), |
| | | TimeJobType.DELIBERATION_VOTE_PUSH, |
| | | DateUtils.localDateTimeToDate(communityActivity.getEndTime()), |
| | | maps |
| | | ); |
| | | } |
| | | communityActivityService.update(Wrappers.lambdaUpdate(TCommunityActivity.class) |
| | | .set(TCommunityActivity::getStatus, status) |
| | | .eq(TCommunityActivity::getId, id)); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | return R.ok(courseService.removeByIds(ids)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 课程已完成 |
| | | */ |
| | | @Log(title = "课程管理信息-课程已完成", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "课程已完成") |
| | | @PostMapping(value = "/updateFinish") |
| | | public R<Boolean> updateFinish(@RequestParam(value = "id") String id) { |
| | | courseService.update(Wrappers.lambdaUpdate(TCourse.class) |
| | | .set(TCourse::getStatus, 2) |
| | | .eq(TCourse::getId, id)); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.google.common.collect.ImmutableMap; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.system.dto.TDeliberationVoteDTO; |
| | | import com.ruoyi.system.model.TCourse; |
| | | import com.ruoyi.system.model.TDeliberationVote; |
| | | import com.ruoyi.system.model.TDeliberationVoteOption; |
| | | import com.ruoyi.system.query.TDeliberationVoteQuery; |
| | | import com.ruoyi.system.service.TDeliberationVoteOptionService; |
| | | import com.ruoyi.system.service.TDeliberationVoteService; |
| | | import com.ruoyi.system.task.base.QuartzManager; |
| | | import com.ruoyi.system.task.base.TimeJobType; |
| | | import com.ruoyi.system.task.jobs.DeliberationVotePush; |
| | | import com.ruoyi.system.vo.TDeliberationVoteVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author xiaochen |
| | | * @since 2025-11-06 |
| | | */ |
| | | @Api(tags = "议事投票") |
| | | @RestController |
| | | @RequestMapping("/t-deliberation-vote") |
| | | public class TDeliberationVoteController { |
| | | private final TDeliberationVoteService deliberationVoteService; |
| | | private final TDeliberationVoteOptionService deliberationVoteOptionService; |
| | | @Autowired |
| | | public TDeliberationVoteController(TDeliberationVoteService deliberationVoteService, TDeliberationVoteOptionService deliberationVoteOptionService) { |
| | | this.deliberationVoteService = deliberationVoteService; |
| | | this.deliberationVoteOptionService = deliberationVoteOptionService; |
| | | } |
| | | |
| | | /** |
| | | * 获取议事投票管理管理列表 |
| | | */ |
| | | @ApiOperation(value = "获取议事投票管理分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TDeliberationVoteVO>> pageList(@RequestBody TDeliberationVoteQuery query) { |
| | | return R.ok(deliberationVoteService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 获取议事投票管理管理列表 |
| | | */ |
| | | @ApiOperation(value = "获取议事投票管理列表") |
| | | @PostMapping(value = "/list") |
| | | public R<List<TDeliberationVote>> list() { |
| | | return R.ok(deliberationVoteService.list(Wrappers.lambdaQuery(TDeliberationVote.class).orderByDesc(TDeliberationVote::getCreateTime))); |
| | | } |
| | | |
| | | /** |
| | | * 添加议事投票管理管理 |
| | | */ |
| | | @Log(title = "议事投票管理信息-新增议事投票管理", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "添加议事投票管理") |
| | | @PostMapping(value = "/add") |
| | | public R<Boolean> add(@Validated @RequestBody TDeliberationVoteDTO dto) { |
| | | if (deliberationVoteService.isExit(dto)) { |
| | | return R.fail("议事投票标题已存在"); |
| | | } |
| | | LocalDateTime startTime = dto.getStartTime(); |
| | | LocalDateTime endTime = dto.getEndTime(); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | if(now.isBefore(startTime)){ |
| | | dto.setStatus(1); |
| | | } |
| | | if(now.isAfter(startTime) && now.isBefore(endTime)){ |
| | | dto.setStatus(2); |
| | | } |
| | | if(now.isAfter(endTime)){ |
| | | dto.setStatus(3); |
| | | } |
| | | deliberationVoteService.save(dto); |
| | | if(now.isBefore(startTime)){ |
| | | // 添加定时任务 |
| | | Map<String, ? extends Object> maps = |
| | | new ImmutableMap.Builder<String, String>(). |
| | | put("id", dto.getId()).put("type","1") |
| | | .build(); |
| | | QuartzManager.addJob( |
| | | DeliberationVotePush.class, |
| | | (DeliberationVotePush.name+dto.getId()).toUpperCase(), |
| | | TimeJobType.DELIBERATION_VOTE_PUSH, |
| | | DateUtils.localDateTimeToDate(dto.getStartTime()), |
| | | maps |
| | | ); |
| | | } |
| | | if(now.isAfter(startTime) && now.isBefore(endTime)){ |
| | | // 添加定时任务 |
| | | Map<String, ? extends Object> maps = |
| | | new ImmutableMap.Builder<String, String>(). |
| | | put("id", dto.getId()).put("type","2") |
| | | .build(); |
| | | QuartzManager.addJob( |
| | | DeliberationVotePush.class, |
| | | (DeliberationVotePush.name+dto.getId()).toUpperCase(), |
| | | TimeJobType.DELIBERATION_VOTE_PUSH, |
| | | DateUtils.localDateTimeToDate(dto.getEndTime()), |
| | | maps |
| | | ); |
| | | } |
| | | // 存储选项 |
| | | List<TDeliberationVoteOption> deliberationVoteOptions = dto.getDeliberationVoteOptions(); |
| | | for (TDeliberationVoteOption deliberationVoteOption : deliberationVoteOptions) { |
| | | deliberationVoteOption.setVoteId(dto.getId()); |
| | | } |
| | | deliberationVoteOptionService.saveBatch(deliberationVoteOptions); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 修改议事投票管理 |
| | | */ |
| | | @Log(title = "议事投票管理信息-修改议事投票管理", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "修改议事投票管理") |
| | | @PostMapping(value = "/update") |
| | | public R<Boolean> update(@Validated @RequestBody TDeliberationVoteDTO dto) { |
| | | if (deliberationVoteService.isExit(dto)) { |
| | | return R.fail("议事投票标题已存在"); |
| | | } |
| | | TDeliberationVote deliberationVote = deliberationVoteService.getById(dto.getId()); |
| | | if(deliberationVote.getStatus() == 2 || deliberationVote.getStatus() == 3){ |
| | | return R.fail("投票正在进行中或已结束,无法修改"); |
| | | } |
| | | LocalDateTime startTime = dto.getStartTime(); |
| | | LocalDateTime endTime = dto.getEndTime(); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | if(now.isBefore(startTime)){ |
| | | dto.setStatus(1); |
| | | // 添加定时任务 |
| | | Map<String, ? extends Object> maps = |
| | | new ImmutableMap.Builder<String, String>(). |
| | | put("id", deliberationVote.getId()).put("type","1") |
| | | .build(); |
| | | QuartzManager.addJob( |
| | | DeliberationVotePush.class, |
| | | (DeliberationVotePush.name+deliberationVote.getId()).toUpperCase(), |
| | | TimeJobType.DELIBERATION_VOTE_PUSH, |
| | | DateUtils.localDateTimeToDate(deliberationVote.getStartTime()), |
| | | maps |
| | | ); |
| | | } |
| | | if(now.isAfter(startTime) && now.isBefore(endTime)){ |
| | | dto.setStatus(2); |
| | | // 添加定时任务 |
| | | Map<String, ? extends Object> maps = |
| | | new ImmutableMap.Builder<String, String>(). |
| | | put("id", deliberationVote.getId()).put("type","2") |
| | | .build(); |
| | | QuartzManager.addJob( |
| | | DeliberationVotePush.class, |
| | | (DeliberationVotePush.name+deliberationVote.getId()).toUpperCase(), |
| | | TimeJobType.DELIBERATION_VOTE_PUSH, |
| | | DateUtils.localDateTimeToDate(deliberationVote.getEndTime()), |
| | | maps |
| | | ); |
| | | } |
| | | if(now.isAfter(endTime)){ |
| | | dto.setStatus(3); |
| | | } |
| | | deliberationVoteService.updateById(dto); |
| | | // 删除所有选项 |
| | | deliberationVoteOptionService.remove(Wrappers.lambdaQuery(TDeliberationVoteOption.class).eq(TDeliberationVoteOption::getVoteId, dto.getId())); |
| | | // 存储选项 |
| | | List<TDeliberationVoteOption> deliberationVoteOptions = dto.getDeliberationVoteOptions(); |
| | | for (TDeliberationVoteOption deliberationVoteOption : deliberationVoteOptions) { |
| | | deliberationVoteOption.setVoteId(dto.getId()); |
| | | } |
| | | deliberationVoteOptionService.saveBatch(deliberationVoteOptions); |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 查看议事投票管理详情 |
| | | */ |
| | | @ApiOperation(value = "查看议事投票管理详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TDeliberationVote> getDetailById(@RequestParam String id) { |
| | | TDeliberationVote deliberationVote = deliberationVoteService.getById(id); |
| | | // 查询选项 |
| | | List<TDeliberationVoteOption> deliberationVoteOptions = deliberationVoteOptionService.list(Wrappers.lambdaQuery(TDeliberationVoteOption.class) |
| | | .eq(TDeliberationVoteOption::getVoteId, id)); |
| | | if(!CollectionUtils.isEmpty(deliberationVoteOptions)){ |
| | | // 查看选项人数 |
| | | for (TDeliberationVoteOption deliberationVoteOption : deliberationVoteOptions) { |
| | | String voteCount = deliberationVoteOption.getVoteCount(); |
| | | deliberationVoteOption.setVoteCountNum(voteCount == null ? 0 : voteCount.split(",").length); |
| | | } |
| | | } |
| | | deliberationVote.setOptions(deliberationVoteOptions); |
| | | return R.ok(deliberationVote); |
| | | } |
| | | |
| | | /** |
| | | * 删除议事投票管理 |
| | | */ |
| | | @Log(title = "议事投票管理信息-删除议事投票管理", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除议事投票管理") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public R<Boolean> deleteById(@RequestParam String id) { |
| | | // 先删除选项 |
| | | deliberationVoteOptionService.remove(Wrappers.lambdaQuery(TDeliberationVoteOption.class).eq(TDeliberationVoteOption::getVoteId, id)); |
| | | return R.ok(deliberationVoteService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除议事投票管理 |
| | | */ |
| | | @Log(title = "议事投票管理信息-删除议事投票管理", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除议事投票管理") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public R<Boolean> deleteByIds(@RequestBody List<String> ids) { |
| | | // 先删除选项 |
| | | deliberationVoteOptionService.remove(Wrappers.lambdaQuery(TDeliberationVoteOption.class).in(TDeliberationVoteOption::getVoteId, ids)); |
| | | return R.ok(deliberationVoteService.removeByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | | * 议事投票发布和完成 |
| | | */ |
| | | @Log(title = "议事投票管理信息-议事投票发布和完成", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "议事投票发布和完成") |
| | | @PostMapping(value = "/updateReleaseFinish") |
| | | public R<Boolean> updateReleaseFinish(@RequestParam(value = "id") String id, |
| | | @RequestParam(value = "status") Integer status) { |
| | | |
| | | TDeliberationVote deliberationVote = deliberationVoteService.getById(id); |
| | | if(status == 2){ |
| | | // 添加定时任务 |
| | | Map<String, ? extends Object> maps = |
| | | new ImmutableMap.Builder<String, String>(). |
| | | put("id", deliberationVote.getId()).put("type","2") |
| | | .build(); |
| | | QuartzManager.addJob( |
| | | DeliberationVotePush.class, |
| | | (DeliberationVotePush.name+deliberationVote.getId()).toUpperCase(), |
| | | TimeJobType.DELIBERATION_VOTE_PUSH, |
| | | DateUtils.localDateTimeToDate(deliberationVote.getEndTime()), |
| | | maps |
| | | ); |
| | | } |
| | | deliberationVoteService.update(Wrappers.lambdaUpdate(TDeliberationVote.class) |
| | | .set(TDeliberationVote::getStatus, status) |
| | | .eq(TDeliberationVote::getId, id)); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.system.dto.HandlingWishesDTO; |
| | | import com.ruoyi.system.dto.ReviewWishesDTO; |
| | | import com.ruoyi.system.model.TCourse; |
| | | import com.ruoyi.system.model.TMicroWish; |
| | | import com.ruoyi.system.query.TMicroWishQuery; |
| | | import com.ruoyi.system.service.TMicroWishService; |
| | | import com.ruoyi.system.service.TMicroWishService; |
| | | import com.ruoyi.system.vo.TMicroWishVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author xiaochen |
| | | * @since 2025-11-06 |
| | | */ |
| | | @Api(tags = "心愿发布") |
| | | @RestController |
| | | @RequestMapping("/t-micro-wish") |
| | | public class TMicroWishController { |
| | | |
| | | private final TMicroWishService microWishService; |
| | | @Autowired |
| | | public TMicroWishController(TMicroWishService microWishService) { |
| | | this.microWishService = microWishService; |
| | | } |
| | | |
| | | /** |
| | | * 获取心愿发布管理列表 |
| | | */ |
| | | @ApiOperation(value = "获取心愿发布分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TMicroWishVO>> pageList(@RequestBody TMicroWishQuery query) { |
| | | return R.ok(microWishService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 查看心愿发布详情 |
| | | */ |
| | | @ApiOperation(value = "查看心愿发布详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TMicroWish> getDetailById(@RequestParam String id) { |
| | | return R.ok(microWishService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 删除心愿发布 |
| | | */ |
| | | @Log(title = "心愿发布信息-删除心愿发布", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除心愿发布") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public R<Boolean> deleteById(@RequestParam String id) { |
| | | return R.ok(microWishService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除心愿发布 |
| | | */ |
| | | @Log(title = "心愿发布信息-删除心愿发布", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除心愿发布") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public R<Boolean> deleteByIds(@RequestBody List<String> ids) { |
| | | return R.ok(microWishService.removeByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | | * 审核心愿 |
| | | */ |
| | | @Log(title = "心愿发布信息-审核心愿", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "审核心愿") |
| | | @PostMapping(value = "/reviewWishes") |
| | | public R<Boolean> reviewWishes(@RequestBody ReviewWishesDTO dto) { |
| | | microWishService.update(Wrappers.lambdaUpdate(TMicroWish.class) |
| | | .set(TMicroWish::getStatus, dto.getStatus()) |
| | | .set(TMicroWish::getAuditRemark, dto.getAuditRemark()) |
| | | .eq(TMicroWish::getId, dto.getId())); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 处理心愿 |
| | | */ |
| | | @Log(title = "心愿发布信息-处理心愿", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "处理心愿") |
| | | @PostMapping(value = "/handlingWishes") |
| | | public R<Boolean> handlingWishes(@RequestBody HandlingWishesDTO dto) { |
| | | microWishService.update(Wrappers.lambdaUpdate(TMicroWish.class) |
| | | .set(TMicroWish::getStatus, dto.getStatus()) |
| | | .set(TMicroWish::getProcessResult, dto.getProcessResult()) |
| | | .set(TMicroWish::getProcessPictures, dto.getProcessPictures()) |
| | | .eq(TMicroWish::getId, dto.getId())); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.system.model.TOldster; |
| | | import com.ruoyi.system.model.TOldsterWarning; |
| | | import com.ruoyi.system.model.TPartyBuilding; |
| | | import com.ruoyi.system.query.OldsterListQuery; |
| | | import com.ruoyi.system.query.TPartyBuildingQuery; |
| | | import com.ruoyi.system.service.TOldsterService; |
| | | import com.ruoyi.system.service.TOldsterWarningService; |
| | | import com.ruoyi.system.service.TPartyBuildingService; |
| | | import com.ruoyi.system.vo.TOldsterWarningVO; |
| | | import com.ruoyi.system.vo.TPartyBuildingVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author xiaochen |
| | | * @since 2025-11-06 |
| | | */ |
| | | @Api(tags = "老人预警管理") |
| | | @RestController |
| | | @RequestMapping("/t-oldster-warning") |
| | | public class TOldsterWarningController { |
| | | |
| | | private final TOldsterWarningService oldsterWarningService; |
| | | private final TOldsterService oldsterService; |
| | | @Autowired |
| | | public TOldsterWarningController(TOldsterWarningService oldsterWarningService, TOldsterService oldsterService) { |
| | | this.oldsterWarningService = oldsterWarningService; |
| | | this.oldsterService = oldsterService; |
| | | } |
| | | |
| | | /** |
| | | * 获取老人预警管理列表 |
| | | */ |
| | | @ApiOperation(value = "获取老人预警管理分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TOldsterWarningVO>> pageList(@RequestBody OldsterListQuery query) { |
| | | return R.ok(oldsterWarningService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 查看老人预警管理详情 |
| | | */ |
| | | @ApiOperation(value = "查看老人预警管理详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TOldsterWarningVO> getDetailById(@RequestParam String id) { |
| | | TOldsterWarning oldsterWarning = oldsterWarningService.getById(id); |
| | | TOldsterWarningVO oldsterWarningVO = new TOldsterWarningVO(); |
| | | BeanUtils.copyProperties(oldsterWarning, oldsterWarningVO); |
| | | // 查询老人信息 |
| | | TOldster oldster = oldsterService.getById(oldsterWarning.getOldsterId()); |
| | | if(Objects.nonNull(oldster)){ |
| | | oldsterWarningVO.setOldsterName(oldster.getOldsterName()); |
| | | oldsterWarningVO.setOldsterAge(oldster.getOldsterAge()); |
| | | oldsterWarningVO.setOldsterSex(oldster.getOldsterSex()); |
| | | oldsterWarningVO.setContactPhone(oldster.getContactPhone()); |
| | | oldsterWarningVO.setGuardianName(oldster.getGuardianName()); |
| | | oldsterWarningVO.setGuardianPhone(oldster.getGuardianPhone()); |
| | | oldsterWarningVO.setAddress(oldster.getAddress()); |
| | | oldsterWarningVO.setPassportPhoto(oldster.getPassportPhoto()); |
| | | oldsterWarningVO.setIdCard(oldster.getIdCard()); |
| | | oldsterWarningVO.setBirthDate(oldster.getBirthDate()); |
| | | oldsterWarningVO.setOldsterType(oldster.getOldsterType()); |
| | | } |
| | | return R.ok(oldsterWarningVO); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.system.model.TOtherConfig; |
| | | import com.ruoyi.system.model.TPartyBuilding; |
| | | import com.ruoyi.system.service.TOtherConfigService; |
| | | import com.ruoyi.system.service.TPartyBuildingService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author xiaochen |
| | | * @since 2025-11-06 |
| | | */ |
| | | @Api(tags = "系统其他设置") |
| | | @RestController |
| | | @RequestMapping("/t-other-config") |
| | | public class TOtherConfigController { |
| | | private final TOtherConfigService otherConfigService; |
| | | @Autowired |
| | | public TOtherConfigController(TOtherConfigService otherConfigService) { |
| | | this.otherConfigService = otherConfigService; |
| | | } |
| | | |
| | | /** |
| | | * 修改系统其他设置 |
| | | */ |
| | | @Log(title = "系统其他设置管理信息-修改系统其他设置", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "修改系统其他设置-通知阈值管理") |
| | | @PostMapping(value = "/update") |
| | | public R<Boolean> update(@Validated @RequestBody TOtherConfig dto) { |
| | | return R.ok(otherConfigService.updateById(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 查看系统其他设置详情 |
| | | */ |
| | | @ApiOperation(value = "查看系统其他设置详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TOtherConfig> getDetailById() { |
| | | return R.ok(otherConfigService.getById(1)); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | return LocalDate.parse(time, DateTimeFormatter.ofPattern("yyyy-MM-dd")); |
| | | } |
| | | |
| | | /** |
| | | * LocalDateTime转为Date |
| | | * @param time |
| | | * @return |
| | | */ |
| | | public static Date localDateTimeToDate(LocalDateTime time) { |
| | | return Date.from(time.atZone(ZoneId.systemDefault()).toInstant()); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | @ApiModel(value = "处理心愿DTO") |
| | | public class HandlingWishesDTO implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "心愿id") |
| | | private String id; |
| | | |
| | | @ApiModelProperty(value = "状态 1=待审核 2=已公开 3=已驳回 4=待处理 5=已处理") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "处理结果") |
| | | private String processResult; |
| | | |
| | | @ApiModelProperty(value = "处理凭证") |
| | | private String processPictures; |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.dto; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | @ApiModel(value = "审核心愿DTO") |
| | | public class ReviewWishesDTO implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "心愿id") |
| | | private String id; |
| | | |
| | | @ApiModelProperty(value = "状态 1=待审核 2=已公开 3=已驳回 4=待处理 5=已处理") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "审核意见") |
| | | private String auditRemark; |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.dto; |
| | | |
| | | import com.ruoyi.system.model.TCommunityActivity; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value="TCommunityActivity对象", description="社区活动") |
| | | public class TCommunityActivityDTO extends TCommunityActivity { |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.dto; |
| | | |
| | | import com.ruoyi.system.model.TDeliberationVote; |
| | | import com.ruoyi.system.model.TDeliberationVoteOption; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "TDeliberationVote对象", description = "议事投票") |
| | | public class TDeliberationVoteDTO extends TDeliberationVote { |
| | | |
| | | @ApiModelProperty(value = "选项集合") |
| | | private List<TDeliberationVoteOption> deliberationVoteOptions; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.model.TCommunityActivity; |
| | | import com.ruoyi.system.query.TCommunityActivityQuery; |
| | | import com.ruoyi.system.vo.TCommunityActivityVO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TCommunityActivityMapper extends BaseMapper<TCommunityActivity> { |
| | | |
| | | /** |
| | | * 获取社区活动分页列表 |
| | | * |
| | | * @param query |
| | | * @return |
| | | */ |
| | | List<TCommunityActivityVO> pageList(@Param("query") TCommunityActivityQuery query, @Param("pageInfo")PageInfo<TCommunityActivityVO> pageInfo); |
| | | |
| | | } |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.model.TCommunityActivityRegistration; |
| | | import com.ruoyi.system.query.RegistrationPageListQuery; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TCommunityActivityRegistrationMapper extends BaseMapper<TCommunityActivityRegistration> { |
| | | |
| | | /** |
| | | * 获取列表 |
| | | * |
| | | * @param query |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TCommunityActivityRegistration> registrationPageList(@Param("query") RegistrationPageListQuery query, @Param("pageInfo")PageInfo<TCommunityActivityRegistration> pageInfo); |
| | | } |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.model.TDeliberationVote; |
| | | import com.ruoyi.system.query.TDeliberationVoteQuery; |
| | | import com.ruoyi.system.vo.TDeliberationVoteVO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TDeliberationVoteMapper extends BaseMapper<TDeliberationVote> { |
| | | |
| | | /** |
| | | * 获取议事投票管理分页列表 |
| | | */ |
| | | List<TDeliberationVoteVO> pageList(@Param("query")TDeliberationVoteQuery query, @Param("pageInfo")PageInfo<TDeliberationVoteVO> pageInfo); |
| | | } |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.model.TMicroWish; |
| | | import com.ruoyi.system.query.TMicroWishQuery; |
| | | import com.ruoyi.system.vo.TMicroWishVO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TMicroWishMapper extends BaseMapper<TMicroWish> { |
| | | |
| | | /** |
| | | * 获取心愿发布分页列表 |
| | | */ |
| | | List<TMicroWishVO> pageList(@Param("query") TMicroWishQuery query, @Param("pageInfo")PageInfo<TMicroWishVO> pageInfo); |
| | | } |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.model.TOldsterWarning; |
| | | import com.ruoyi.system.query.OldsterListQuery; |
| | | import com.ruoyi.system.vo.TOldsterWarningVO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TOldsterWarningMapper extends BaseMapper<TOldsterWarning> { |
| | | |
| | | /** |
| | | * 获取老人预警管理列表 |
| | | * @param query |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TOldsterWarningVO> pageList(@Param("query") OldsterListQuery query, @Param("pageInfo")PageInfo<TOldsterWarningVO> pageInfo); |
| | | } |
| | |
| | | @TableField("vote_count") |
| | | private String voteCount; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "投票人数") |
| | | @TableField(exist = false) |
| | | private Integer voteCountNum; |
| | |
| | | package com.ruoyi.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.domain.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | private String idCard; |
| | | |
| | | @ApiModelProperty(value = "出生日期") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | @TableField("birth_date") |
| | | private LocalDate birthDate; |
| | | |
| | |
| | | package com.ruoyi.system.query; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.ruoyi.common.core.domain.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | |
| | | @Data |
| | | @ApiModel(value = "老人户籍信息分页列表query") |
| | | public class OldsterListQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "老人姓名") |
| | | private String oldsterName; |
| | | |
| | | @ApiModelProperty(value = "人员类型 1=独居老人 2=高龄老人 3=散居特困供养老人 4=失能老人") |
| | | private Integer oldsterType; |
| | | |
| New file |
| | |
| | | package com.ruoyi.system.query; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.ruoyi.common.core.domain.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "报名列表查询参数RegistrationPageListQuery") |
| | | public class RegistrationPageListQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "用户姓名") |
| | | private String userName; |
| | | |
| | | @ApiModelProperty(value = "用户联系方式") |
| | | private String userPhone; |
| | | |
| | | @ApiModelProperty(value = "活动id") |
| | | private String activityId; |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.query; |
| | | |
| | | import com.ruoyi.common.core.domain.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "社区活动管理查询参数TCommunityActivityQuery") |
| | | public class TCommunityActivityQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "活动标题") |
| | | private String activityTitle; |
| | | |
| | | @ApiModelProperty(value = "状态 1=待发布 2=已发布 3=已结束") |
| | | private Integer status; |
| | | |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.query; |
| | | |
| | | import com.ruoyi.common.core.domain.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "议事投票查询参数TDeliberationVoteQuery") |
| | | public class TDeliberationVoteQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "议事标题") |
| | | private String discussionTitle; |
| | | |
| | | @ApiModelProperty(value = "状态 1=待发布 2=进行中 3=已结束") |
| | | private Integer status; |
| | | |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.query; |
| | | |
| | | import com.ruoyi.common.core.domain.BasePage; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "心愿发布查询参数TMicroWishQuery") |
| | | public class TMicroWishQuery extends BasePage { |
| | | |
| | | @ApiModelProperty(value = "心愿类型 1=闲置 2=互助 3=其他") |
| | | private Integer wishType; |
| | | |
| | | @ApiModelProperty(value = "联系人") |
| | | private String contactPerson; |
| | | |
| | | @ApiModelProperty(value = "联系电话") |
| | | private String contactPhone; |
| | | |
| | | @ApiModelProperty(value = "状态 1=待审核 2=已公开 3=已驳回 4=待处理 5=已处理") |
| | | private Integer status; |
| | | |
| | | } |
| | |
| | | package com.ruoyi.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.model.TCommunityActivityRegistration; |
| | | import com.ruoyi.system.query.RegistrationPageListQuery; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TCommunityActivityRegistrationService extends IService<TCommunityActivityRegistration> { |
| | | |
| | | /** |
| | | * 获取报名信息分页列表 |
| | | */ |
| | | PageInfo<TCommunityActivityRegistration> registrationPageList(RegistrationPageListQuery query); |
| | | |
| | | } |
| | |
| | | package com.ruoyi.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.dto.TCommunityActivityDTO; |
| | | import com.ruoyi.system.model.TCommunityActivity; |
| | | import com.ruoyi.system.query.TCommunityActivityQuery; |
| | | import com.ruoyi.system.vo.TCommunityActivityVO; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TCommunityActivityService extends IService<TCommunityActivity> { |
| | | |
| | | /** |
| | | * 判断社区活动 |
| | | * |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | boolean isExit(TCommunityActivityDTO dto); |
| | | |
| | | /** |
| | | * 获取社区活动分页列表 |
| | | * |
| | | * @param query |
| | | * @return |
| | | */ |
| | | PageInfo<TCommunityActivityVO> pageList(TCommunityActivityQuery query); |
| | | |
| | | } |
| | |
| | | package com.ruoyi.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.model.TDeliberationVote; |
| | | import com.ruoyi.system.query.TDeliberationVoteQuery; |
| | | import com.ruoyi.system.vo.TDeliberationVoteVO; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TDeliberationVoteService extends IService<TDeliberationVote> { |
| | | |
| | | /** |
| | | * 判断数据是否存在 |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | boolean isExit(TDeliberationVote dto); |
| | | |
| | | /** |
| | | * 获取列表 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | PageInfo<TDeliberationVoteVO> pageList(TDeliberationVoteQuery query); |
| | | } |
| | |
| | | package com.ruoyi.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.model.TMicroWish; |
| | | import com.ruoyi.system.query.TMicroWishQuery; |
| | | import com.ruoyi.system.vo.TMicroWishVO; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TMicroWishService extends IService<TMicroWish> { |
| | | |
| | | /** |
| | | * 获取心愿发布分页列表 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | PageInfo<TMicroWishVO> pageList(TMicroWishQuery query); |
| | | } |
| | |
| | | package com.ruoyi.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.model.TOldsterWarning; |
| | | import com.ruoyi.system.query.OldsterListQuery; |
| | | import com.ruoyi.system.vo.TOldsterWarningVO; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface TOldsterWarningService extends IService<TOldsterWarning> { |
| | | |
| | | /** |
| | | * 获取老人预警管理分页列表 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | PageInfo<TOldsterWarningVO> pageList(OldsterListQuery query); |
| | | } |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.mapper.TCommunityActivityRegistrationMapper; |
| | | import com.ruoyi.system.model.TCommunityActivityRegistration; |
| | | import com.ruoyi.system.query.RegistrationPageListQuery; |
| | | import com.ruoyi.system.service.TCommunityActivityRegistrationService; |
| | | import com.ruoyi.system.vo.SysOperLogVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TCommunityActivityRegistrationServiceImpl extends ServiceImpl<TCommunityActivityRegistrationMapper, TCommunityActivityRegistration> implements TCommunityActivityRegistrationService { |
| | | |
| | | @Override |
| | | public PageInfo<TCommunityActivityRegistration> registrationPageList(RegistrationPageListQuery query) { |
| | | PageInfo<TCommunityActivityRegistration> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TCommunityActivityRegistration> list = this.baseMapper.registrationPageList(query,pageInfo); |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.dto.TCommunityActivityDTO; |
| | | import com.ruoyi.system.mapper.TCommunityActivityMapper; |
| | | import com.ruoyi.system.mapper.TCommunityActivityRegistrationMapper; |
| | | import com.ruoyi.system.model.TCommunityActivity; |
| | | import com.ruoyi.system.model.TCommunityActivityRegistration; |
| | | import com.ruoyi.system.query.TCommunityActivityQuery; |
| | | import com.ruoyi.system.service.TCommunityActivityService; |
| | | import com.ruoyi.system.vo.TCommunityActivityVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TCommunityActivityServiceImpl extends ServiceImpl<TCommunityActivityMapper, TCommunityActivity> implements TCommunityActivityService { |
| | | |
| | | @Autowired |
| | | private TCommunityActivityRegistrationMapper communityActivityRegistrationMapper; |
| | | |
| | | @Override |
| | | public boolean isExit(TCommunityActivityDTO dto) { |
| | | if(StringUtils.isNotEmpty(dto.getId())){ |
| | | // 修改 |
| | | return this.count(Wrappers.lambdaQuery(TCommunityActivity.class).ne(TCommunityActivity::getId, dto.getId()).eq(TCommunityActivity::getActivityTitle, dto.getActivityTitle())) > 0; |
| | | }else { |
| | | // 新增 |
| | | return this.count(Wrappers.lambdaQuery(TCommunityActivity.class).eq(TCommunityActivity::getActivityTitle, dto.getActivityTitle())) > 0; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<TCommunityActivityVO> pageList(TCommunityActivityQuery query) { |
| | | PageInfo<TCommunityActivityVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TCommunityActivityVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | if(CollectionUtils.isEmpty(list)){ |
| | | return pageInfo; |
| | | } |
| | | |
| | | List<String> activityIds = list.stream().map(TCommunityActivity::getId).collect(Collectors.toList()); |
| | | List<TCommunityActivityRegistration> communityActivityRegistrationList = communityActivityRegistrationMapper.selectList(Wrappers.lambdaQuery(TCommunityActivityRegistration.class) |
| | | .in(TCommunityActivityRegistration::getActivityId, activityIds)); |
| | | for (TCommunityActivityVO tCommunityActivityVO : list) { |
| | | List<TCommunityActivityRegistration> communityActivityRegistrations = communityActivityRegistrationList.stream().filter(tCommunityActivityRegistration -> tCommunityActivityVO.getId().equals(tCommunityActivityRegistration.getActivityId())).collect(Collectors.toList()); |
| | | tCommunityActivityVO.setRegistrationCount(communityActivityRegistrations.size()); |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.entity.SysRole; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.mapper.TDeliberationVoteMapper; |
| | | import com.ruoyi.system.mapper.TDeliberationVoteOptionMapper; |
| | | import com.ruoyi.system.model.TDeliberationVote; |
| | | import com.ruoyi.system.model.TDeliberationVote; |
| | | import com.ruoyi.system.model.TDeliberationVoteOption; |
| | | import com.ruoyi.system.query.TDeliberationVoteQuery; |
| | | import com.ruoyi.system.service.TDeliberationVoteService; |
| | | import com.ruoyi.system.vo.TDeliberationVoteVO; |
| | | import io.jsonwebtoken.lang.Collections; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TDeliberationVoteServiceImpl extends ServiceImpl<TDeliberationVoteMapper, TDeliberationVote> implements TDeliberationVoteService { |
| | | |
| | | @Autowired |
| | | private TDeliberationVoteOptionMapper deliberationVoteOptionMapper; |
| | | |
| | | @Override |
| | | public boolean isExit(TDeliberationVote dto) { |
| | | if(StringUtils.isNotEmpty(dto.getId())){ |
| | | // 修改 |
| | | return this.count(Wrappers.lambdaQuery(TDeliberationVote.class).ne(TDeliberationVote::getId, dto.getId()).eq(TDeliberationVote::getDiscussionTitle, dto.getDiscussionTitle())) > 0; |
| | | }else { |
| | | // 新增 |
| | | return this.count(Wrappers.lambdaQuery(TDeliberationVote.class).eq(TDeliberationVote::getDiscussionTitle, dto.getDiscussionTitle())) > 0; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<TDeliberationVoteVO> pageList(TDeliberationVoteQuery query) { |
| | | PageInfo<TDeliberationVoteVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TDeliberationVoteVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | if(CollectionUtils.isEmpty(list)){ |
| | | return pageInfo; |
| | | } |
| | | List<String> voteIds = list.stream().map(TDeliberationVoteVO::getId).collect(Collectors.toList()); |
| | | List<TDeliberationVoteOption> deliberationVoteOptions = deliberationVoteOptionMapper.selectList(Wrappers.lambdaQuery(TDeliberationVoteOption.class).in(TDeliberationVoteOption::getVoteId, voteIds)); |
| | | for (TDeliberationVoteVO deliberationVoteVO : list) { |
| | | List<TDeliberationVoteOption> deliberationVoteOptionList = deliberationVoteOptions.stream().filter(deliberationVoteOption -> deliberationVoteVO.getId().equals(deliberationVoteOption.getVoteId())).collect(Collectors.toList()); |
| | | int count = 0; |
| | | for (TDeliberationVoteOption tDeliberationVoteOption : deliberationVoteOptionList) { |
| | | String voteCount = tDeliberationVoteOption.getVoteCount(); |
| | | if(StringUtils.isNotEmpty(voteCount)){ |
| | | String[] split = voteCount.split(","); |
| | | count += split.length; |
| | | } |
| | | } |
| | | deliberationVoteVO.setVotersTotal(count); |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.mapper.TMicroWishMapper; |
| | | import com.ruoyi.system.model.TAdvertisement; |
| | | import com.ruoyi.system.model.TMicroWish; |
| | | import com.ruoyi.system.query.TMicroWishQuery; |
| | | import com.ruoyi.system.service.TMicroWishService; |
| | | import com.ruoyi.system.vo.TMicroWishVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TMicroWishServiceImpl extends ServiceImpl<TMicroWishMapper, TMicroWish> implements TMicroWishService { |
| | | |
| | | @Override |
| | | public PageInfo<TMicroWishVO> pageList(TMicroWishQuery query) { |
| | | PageInfo<TMicroWishVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TMicroWishVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.mapper.TOldsterWarningMapper; |
| | | import com.ruoyi.system.model.TAdvertisement; |
| | | import com.ruoyi.system.model.TOldsterWarning; |
| | | import com.ruoyi.system.query.OldsterListQuery; |
| | | import com.ruoyi.system.service.TOldsterWarningService; |
| | | import com.ruoyi.system.vo.TOldsterWarningVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TOldsterWarningServiceImpl extends ServiceImpl<TOldsterWarningMapper, TOldsterWarning> implements TOldsterWarningService { |
| | | |
| | | @Override |
| | | public PageInfo<TOldsterWarningVO> pageList(OldsterListQuery query) { |
| | | PageInfo<TOldsterWarningVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TOldsterWarningVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.task.base; |
| | | |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.system.model.TCommunityActivity; |
| | | import com.ruoyi.system.model.TDeliberationVote; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.ruoyi.system.service.TCommunityActivityService; |
| | | import com.ruoyi.system.service.TDeliberationVoteService; |
| | | import com.ruoyi.system.task.utils.SpringContextsUtil; |
| | | import org.quartz.Job; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobExecutionException; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | public abstract class AbstractJob implements Job{ |
| | | protected Logger logger = LoggerFactory.getLogger(getClass()); |
| | | |
| | | @Override |
| | | public abstract void execute(JobExecutionContext context) throws JobExecutionException; |
| | | |
| | | protected ISysUserService sysUserService; |
| | | protected RedisCache redisCache; |
| | | protected TDeliberationVoteService deliberationVoteService; |
| | | protected TCommunityActivityService communityActivityService; |
| | | |
| | | public AbstractJob(){ |
| | | this.sysUserService = SpringContextsUtil.getBean(ISysUserService.class); |
| | | this.redisCache = SpringContextsUtil.getBean(RedisCache.class); |
| | | this.deliberationVoteService = SpringContextsUtil.getBean(TDeliberationVoteService.class); |
| | | this.communityActivityService = SpringContextsUtil.getBean(TCommunityActivityService.class); |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.task.base; |
| | | |
| | | import org.quartz.*; |
| | | import org.quartz.impl.StdSchedulerFactory; |
| | | |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | |
| | | public class QuartzManager { |
| | | private static SchedulerFactory factory = new StdSchedulerFactory(); |
| | | private static final String TRIGGER_NAME_PREFIX = "TRIGGER_PREFIX_"; |
| | | private static final String JOB_NAME_PREFIX = "JOB_PREFIX_"; |
| | | |
| | | /** |
| | | * 添加定时任务:具体某个时间点执行一次的任务,如:在某个2015-06-01 12:00发送一条消息 |
| | | * |
| | | * @param jobName |
| | | * 具体的任务名+ID标识唯一 |
| | | * @param jobType |
| | | * @param date |
| | | * @param jp |
| | | */ |
| | | public synchronized static void addJob(Class<? extends Job> jobClass, String jobName, TimeJobType jobType, Date date, |
| | | Map<String, ? extends Object> jp) { |
| | | //logger.debug("ADD JOB {},jobName={},jobTyep={},jobDate={},",jobClass.getName(),jobName,jobType,date); |
| | | try { |
| | | Scheduler sched = factory.getScheduler(); |
| | | JobDetail job = JobBuilder.newJob(jobClass).withIdentity(JOB_NAME_PREFIX + jobName, jobType.getType()) |
| | | .setJobData(new JobDataMap(jp)).build(); |
| | | |
| | | SimpleTrigger trigger = (SimpleTrigger) TriggerBuilder.newTrigger() |
| | | .withIdentity(TRIGGER_NAME_PREFIX + jobName, jobType.getType()).startAt(date).build(); |
| | | removeJob(jobName, jobType); |
| | | |
| | | sched.scheduleJob(job, trigger); |
| | | |
| | | if (!sched.isShutdown()) { |
| | | sched.start(); |
| | | } |
| | | } catch (Exception e) { |
| | | //logger.error("ADD JOB exception {},jobName={},jobTyep={},jobDate={},",jobClass.getName(),jobName,jobType,date); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 修改一个任务的触发时间(使用默认的任务组名,触发器名,触发器组名) |
| | | * @param jobName |
| | | * @param time |
| | | */ |
| | | public synchronized static void modifyJobTime(String jobName,TimeJobType jobType, Date time) { |
| | | //logger.error("Update JOB exception,jobName={},jobTyep={},jobDate={}," ,jobName,jobType,time); |
| | | try { |
| | | JobKey jobKey = new JobKey(JOB_NAME_PREFIX + jobName, jobType.getType()); |
| | | TriggerKey key = new TriggerKey(TRIGGER_NAME_PREFIX + jobName, jobType.getType()); |
| | | |
| | | |
| | | Scheduler sched = factory.getScheduler(); |
| | | SimpleTrigger trigger = (SimpleTrigger) sched.getTrigger(key); |
| | | if(trigger == null) { |
| | | return; |
| | | } |
| | | Date oldTime = trigger.getStartTime(); |
| | | |
| | | if (oldTime.getTime() != time.getTime()) { |
| | | JobDetail jobDetail = sched.getJobDetail(jobKey); |
| | | Class<? extends Job> objJobClass = jobDetail.getJobClass(); |
| | | removeJob(jobName,jobType); |
| | | Map<String, Object> jp = jobDetail.getJobDataMap(); |
| | | addJob(objJobClass, jobName, jobType, time, jp); |
| | | } |
| | | } catch (Exception e) { |
| | | // logger.error("Update JOB exception,jobName={},jobTyep={},jobDate={}," ,jobName,jobType,time); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 移除一个任务 |
| | | * |
| | | * @param jobName |
| | | */ |
| | | public synchronized static void removeJob(String jobName, TimeJobType jobType) { |
| | | try { |
| | | JobKey jobKey = new JobKey(JOB_NAME_PREFIX + jobName, jobType.getType()); |
| | | TriggerKey key = new TriggerKey(TRIGGER_NAME_PREFIX + jobName, jobType.getType()); |
| | | Scheduler sched = factory.getScheduler(); |
| | | |
| | | JobDetail detail = sched.getJobDetail(jobKey); |
| | | if (detail != null) { |
| | | sched.pauseJob(jobKey); |
| | | sched.pauseTrigger(key);// 停止触发器 |
| | | sched.unscheduleJob(key);// 移除触发器 |
| | | sched.deleteJob(jobKey);// 删除任务 |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 启动所有定时任务 |
| | | */ |
| | | public synchronized static void startJobs() { |
| | | try { |
| | | Scheduler sched = factory.getScheduler(); |
| | | sched.start(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 关闭所有定时任务 |
| | | */ |
| | | public synchronized static void shutdownJobs() { |
| | | try { |
| | | Scheduler sched = factory.getScheduler(); |
| | | if (!sched.isShutdown()) { |
| | | sched.shutdown(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new RuntimeException(e); |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.task.base; |
| | | |
| | | /** |
| | | * @Description 按时间点发布的任务类型 |
| | | * @date 2025年2月17日 下午7:22:28 |
| | | */ |
| | | public enum TimeJobType { |
| | | DELIBERATION_VOTE_PUSH("deliberation_vote_push","议事投票"), |
| | | ACTIVITY_PUSH("activity_push","社区活动"); |
| | | private String type; |
| | | private String desc; |
| | | private TimeJobType(String type, String desc) { |
| | | this.type = type; |
| | | this.desc = desc; |
| | | } |
| | | public String getType() { |
| | | return type; |
| | | } |
| | | public void setType(String type) { |
| | | this.type = type; |
| | | } |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | public void setDesc(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.task.exceptions; |
| | | |
| | | /** |
| | | * @文件说明:定时器任务执行异常 |
| | | * @版权所有:成都喜来达 |
| | | * @项目名称: fengsheng |
| | | * @创建者: Leeyns |
| | | * @创建日期: 2016年5月18日 |
| | | * @最近修改者:Leeyns |
| | | * @最近修改日期:2016年5月18日 |
| | | */ |
| | | public class TimeException extends Exception { |
| | | |
| | | /** |
| | | * TODO |
| | | */ |
| | | private static final long serialVersionUID = 5703430073981692250L; |
| | | |
| | | private String message; |
| | | |
| | | public TimeException() { |
| | | super(); |
| | | } |
| | | |
| | | public TimeException(String message) { |
| | | super(message); |
| | | this.message = message; |
| | | } |
| | | |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | public void setMessage(String message) { |
| | | this.message = message; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.task.jobs; |
| | | |
| | | import com.google.common.collect.ImmutableMap; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.system.model.TCommunityActivity; |
| | | import com.ruoyi.system.model.TDeliberationVote; |
| | | import com.ruoyi.system.task.base.AbstractJob; |
| | | import com.ruoyi.system.task.base.QuartzManager; |
| | | import com.ruoyi.system.task.base.TimeJobType; |
| | | import org.quartz.JobDataMap; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobExecutionException; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 直播推送定时任务 |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | public class ActivityPush extends AbstractJob { |
| | | |
| | | public static final String name = "activityPush_"; |
| | | |
| | | @Override |
| | | public void execute(JobExecutionContext context) |
| | | throws JobExecutionException { |
| | | JobDataMap maps = context.getMergedJobDataMap(); |
| | | String activityId = maps.getString("id"); |
| | | String type = maps.getString("type"); |
| | | try { |
| | | TCommunityActivity communityActivity = communityActivityService.getById(activityId); |
| | | if(Objects.isNull(communityActivity)){ |
| | | return; |
| | | } |
| | | LocalDateTime startTime = communityActivity.getStartTime(); |
| | | LocalDateTime endTime = communityActivity.getEndTime(); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | |
| | | if("1".equals(type) && now.compareTo(startTime) > -1 && now.compareTo(endTime) < 1){ |
| | | communityActivity.setStatus(2); |
| | | // 添加定时任务 |
| | | Map<String, ? extends Object> map = |
| | | new ImmutableMap.Builder<String, String>(). |
| | | put("id", communityActivity.getId()).put("type","2") |
| | | .build(); |
| | | QuartzManager.addJob( |
| | | ActivityPush.class, |
| | | (DeliberationVotePush.name+communityActivity.getId()).toUpperCase(), |
| | | TimeJobType.ACTIVITY_PUSH, |
| | | DateUtils.localDateTimeToDate(communityActivity.getEndTime()), |
| | | map |
| | | ); |
| | | } |
| | | |
| | | if("2".equals(type) && now.isAfter(endTime)){ |
| | | communityActivity.setStatus(3); |
| | | } |
| | | communityActivityService.updateById(communityActivity); |
| | | }catch(Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.task.jobs; |
| | | |
| | | import com.google.common.collect.ImmutableMap; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.system.model.TDeliberationVote; |
| | | import com.ruoyi.system.task.base.AbstractJob; |
| | | import com.ruoyi.system.task.base.QuartzManager; |
| | | import com.ruoyi.system.task.base.TimeJobType; |
| | | import org.quartz.JobDataMap; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobExecutionException; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 直播推送定时任务 |
| | | * @author Administrator |
| | | * |
| | | */ |
| | | public class DeliberationVotePush extends AbstractJob { |
| | | |
| | | public static final String name = "deliberationVotePush_"; |
| | | |
| | | @Override |
| | | public void execute(JobExecutionContext context) |
| | | throws JobExecutionException { |
| | | JobDataMap maps = context.getMergedJobDataMap(); |
| | | String voteId = maps.getString("id"); |
| | | String type = maps.getString("type"); |
| | | try { |
| | | TDeliberationVote deliberationVote = deliberationVoteService.getById(voteId); |
| | | if(Objects.isNull(deliberationVote)){ |
| | | return; |
| | | } |
| | | LocalDateTime startTime = deliberationVote.getStartTime(); |
| | | LocalDateTime endTime = deliberationVote.getEndTime(); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | |
| | | if("1".equals(type) && now.compareTo(startTime) > -1 && now.compareTo(endTime) < 1){ |
| | | deliberationVote.setStatus(2); |
| | | // 添加定时任务 |
| | | Map<String, ? extends Object> map = |
| | | new ImmutableMap.Builder<String, String>(). |
| | | put("id", deliberationVote.getId()).put("type","2") |
| | | .build(); |
| | | QuartzManager.addJob( |
| | | DeliberationVotePush.class, |
| | | (DeliberationVotePush.name+deliberationVote.getId()).toUpperCase(), |
| | | TimeJobType.DELIBERATION_VOTE_PUSH, |
| | | DateUtils.localDateTimeToDate(deliberationVote.getEndTime()), |
| | | map |
| | | ); |
| | | } |
| | | |
| | | if("2".equals(type) && now.isAfter(endTime)){ |
| | | deliberationVote.setStatus(3); |
| | | } |
| | | deliberationVoteService.updateById(deliberationVote); |
| | | }catch(Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.task.utils; |
| | | |
| | | import org.springframework.beans.BeansException; |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.context.ApplicationContextAware; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Component |
| | | public class SpringContextsUtil implements ApplicationContextAware{ |
| | | |
| | | private static ApplicationContext applicationContext; |
| | | |
| | | @Override |
| | | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { |
| | | if (SpringContextsUtil.applicationContext == null) { |
| | | SpringContextsUtil.applicationContext = applicationContext; |
| | | } |
| | | } |
| | | // 获取applicationContext |
| | | public static ApplicationContext getApplicationContext() { |
| | | return applicationContext; |
| | | } |
| | | // 通过name获取 Bean. |
| | | public static Object getBean(String name) { |
| | | return getApplicationContext().getBean(name); |
| | | } |
| | | // 通过class获取Bean. |
| | | public static <T> T getBean(Class<T> clazz) { |
| | | return getApplicationContext().getBean(clazz); |
| | | } |
| | | // 通过name,以及Clazz返回指定的Bean |
| | | public static <T> T getBean(String name, Class<T> clazz) { |
| | | System.out.println(getApplicationContext().getBean(name, clazz)); |
| | | return getApplicationContext().getBean(name, clazz); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import com.ruoyi.system.model.TCommunityActivity; |
| | | import com.ruoyi.system.model.TCommunityActivityRegistration; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel(value = "TCommunityActivity对象", description = "社区活动") |
| | | public class TCommunityActivityVO extends TCommunityActivity { |
| | | |
| | | @ApiModelProperty(value = "报名人数") |
| | | private Integer registrationCount; |
| | | |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import com.ruoyi.system.model.TDeliberationVote; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "TDeliberationVote对象", description = "议事投票") |
| | | public class TDeliberationVoteVO extends TDeliberationVote { |
| | | |
| | | @ApiModelProperty(value = "总投票人数") |
| | | private Integer votersTotal; |
| | | |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import com.ruoyi.system.model.TMicroWish; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "心愿发布视图对象TMicroWishVO") |
| | | public class TMicroWishVO extends TMicroWish { |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.system.model.TOldsterWarning; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDate; |
| | | |
| | | @Data |
| | | @ApiModel(value = "TOldsterWarning对象", description = "老人预警") |
| | | public class TOldsterWarningVO extends TOldsterWarning { |
| | | |
| | | @ApiModelProperty(value = "老人姓名") |
| | | private String oldsterName; |
| | | |
| | | @ApiModelProperty(value = "老人年龄") |
| | | private Integer oldsterAge; |
| | | |
| | | @ApiModelProperty(value = "性别 1=男 2=女") |
| | | private Integer oldsterSex; |
| | | |
| | | @ApiModelProperty(value = "联系方式") |
| | | private String contactPhone; |
| | | |
| | | @ApiModelProperty(value = "监护人姓名") |
| | | private String guardianName; |
| | | |
| | | @ApiModelProperty(value = "监护人电话") |
| | | private String guardianPhone; |
| | | |
| | | @ApiModelProperty(value = "证件照") |
| | | private String passportPhoto; |
| | | |
| | | @ApiModelProperty(value = "身份证") |
| | | private String idCard; |
| | | |
| | | @ApiModelProperty(value = "出生日期") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private LocalDate birthDate; |
| | | |
| | | @ApiModelProperty(value = "人员类型 1=独居老人 2=高龄老人 3=散居特困供养老人 4=失能老人") |
| | | private Integer oldsterType; |
| | | |
| | | @ApiModelProperty(value = "居住地址") |
| | | private String address; |
| | | |
| | | } |
| | |
| | | <sql id="Base_Column_List"> |
| | | id, activity_title, activity_time, address, activity_cover, start_time, end_time, activity_content, status, create_time, update_time, create_by, update_by, disabled |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.system.vo.TCommunityActivityVO"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM t_community_activity |
| | | <where> |
| | | <if test="query.activityTitle != null and query.activityTitle != ''"> |
| | | AND activity_title LIKE concat('%',#{query.activityTitle},'%') |
| | | </if> |
| | | <if test="query.status != null"> |
| | | AND status = #{query.status} |
| | | </if> |
| | | AND disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | order by create_time desc |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.system.model.TCommunityActivityRegistration"> |
| | | <id column="id" property="id" /> |
| | | <result column="activity_id" property="activityId" /> |
| | | <result column="uesr_name" property="uesrName" /> |
| | | <result column="user_name" property="userName" /> |
| | | <result column="user_phone" property="userPhone" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_time" property="updateTime" /> |
| | |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, activity_id, uesr_name, user_phone, create_time, update_time, create_by, update_by, disabled |
| | | id, activity_id, user_name, user_phone, create_time, update_time, create_by, update_by, disabled |
| | | </sql> |
| | | <select id="registrationPageList" resultType="com.ruoyi.system.model.TCommunityActivityRegistration"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from t_community_activity_registration |
| | | <where> |
| | | <if test="query.activityId != null and query.activityId != ''"> |
| | | and activity_id = #{query.activityId} |
| | | </if> |
| | | <if test="query.userName != null and query.userName != ''"> |
| | | and user_name like concat('%',#{query.userName},'%') |
| | | </if> |
| | | <if test="query.userPhone != null and query.userPhone != ''"> |
| | | and user_phone like concat('%',#{query.userPhone},'%') |
| | | </if> |
| | | and disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | order by create_time desc |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <sql id="Base_Column_List"> |
| | | id, discussion_title, start_time, end_time, is_open_result, status, create_time, update_time, create_by, update_by, disabled |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.system.vo.TDeliberationVoteVO"> |
| | | SELECT |
| | | id, discussion_title, start_time, end_time, is_open_result, status, create_time, update_time, create_by, update_by, disabled |
| | | FROM t_deliberation_vote |
| | | <where> |
| | | <if test="discussionTitle != null and discussionTitle != ''"> |
| | | AND discussion_title LIKE concat('%',#{discussionTitle},'%') |
| | | </if> |
| | | <if test="status != null"> |
| | | AND status = #{status} |
| | | </if> |
| | | AND disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | ORDER BY create_time DESC |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, app_user_id, wish_type, wish_description, pictures, contact_person, contact_phone, address, status, audit_remark, process_result, process_pictures, process_time, create_time, update_time, create_by, update_by, disabled |
| | | id, app_user_id, wish_type, wish_description, pictures, contact_person, contact_phone, address, status, audit_remark, |
| | | process_result, process_pictures, process_time, create_time, update_time, create_by, update_by, disabled |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.system.vo.TMicroWishVO"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from t_micro_wish |
| | | <where> |
| | | <if test="query.wishType != null"> |
| | | and wish_type = #{query.wishType} |
| | | </if> |
| | | <if test="query.status != null"> |
| | | and status = #{query.status} |
| | | </if> |
| | | <if test="query.contactPerson != null and query.contactPerson != ''"> |
| | | and contact_person like concat('%',#{query.contactPerson},'%') |
| | | </if> |
| | | <if test="query.contactPhone != null and query.contactPhone != ''"> |
| | | and contact_phone like concat('%',#{query.contactPhone},'%') |
| | | </if> |
| | | AND disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | ORDER BY create_time DESC |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | <sql id="Base_Column_List"> |
| | | id, oldster_id, warning_time, create_time, update_time, create_by, update_by, disabled |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.system.vo.TOldsterWarningVO"> |
| | | select t.id, t.oldster_id, t.warning_time, t.create_time, t.update_time, t.create_by, t.update_by, t.disabled, |
| | | tow.oldster_name, tow.oldster_age, tow.oldster_sex, tow.contact_phone, tow.guardian_name, tow.guardian_phone, |
| | | tow.passport_photo, tow.id_card, tow.birth_date, tow.oldster_type, tow.address |
| | | from t_oldster_warning tow |
| | | left join t_oldster t on tow.oldster_id = t.id |
| | | <where> |
| | | <if test="query.oldsterName != null and query.oldsterName != ''"> |
| | | and t.oldster_name like concat('%',#{query.oldsterName},'%') |
| | | </if> |
| | | <if test="query.oldsterType != null and query.oldsterType != ''"> |
| | | and t.oldster_type = #{query.oldsterType} |
| | | </if> |
| | | <if test="query.contactPhone != null and query.contactPhone != ''"> |
| | | and t.contact_phone like concat('%',#{query.contactPhone},'%') |
| | | </if> |
| | | AND tow.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | </where> |
| | | order by tow.warning_time desc |
| | | </select> |
| | | |
| | | </mapper> |