New file |
| | |
| | | package com.panzhihua.applets.api; |
| | | |
| | | import static java.util.Objects.isNull; |
| | | import static java.util.Objects.nonNull; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | |
| | | import com.panzhihua.common.model.dtos.community.fms.AddFmsServiceAdminDTO; |
| | | import com.panzhihua.common.model.dtos.community.fms.ApplyFmsServiceDTO; |
| | | import com.panzhihua.common.model.dtos.community.fms.ApprovalFmsServiceAdminDTO; |
| | | import com.panzhihua.common.model.dtos.community.fms.EvaluationFmsServiceDTO; |
| | | import com.panzhihua.common.model.dtos.community.fms.FeedbackFmsServiceDTO; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.community.ComActActEvaluateVO; |
| | | import com.panzhihua.common.model.vos.community.fms.CascadeCommVO; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.model.dtos.community.fms.PageFmsClassroomAdminDTO; |
| | | import com.panzhihua.common.model.dtos.community.fms.PageFmsEventAdminDTO; |
| | | import com.panzhihua.common.model.dtos.community.fms.PageFmsServiceAppletsDTO; |
| | | import com.panzhihua.common.model.dtos.community.fms.PageFmsTeamDTO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.fms.ComFmsClassroomVO; |
| | | import com.panzhihua.common.model.vos.community.fms.ComFmsServiceVO; |
| | | import com.panzhihua.common.model.vos.community.fms.ComFmsTeamTypeVO; |
| | | import com.panzhihua.common.model.vos.community.fms.ComFmsTeamVO; |
| | | import com.panzhihua.common.model.vos.grid.EventDetailsVO; |
| | | import com.panzhihua.common.model.vos.grid.EventVO; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | import com.panzhihua.common.service.grid.GridService; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | /** |
| | | * @title: ComFmsApi |
| | | * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 |
| | | * @description: 五微服务相关接口 |
| | | * @author: hans |
| | | * @date: 2022/02/11 13:23 |
| | | */ |
| | | @Slf4j |
| | | @Api(tags = {"五微服务"}) |
| | | @RestController |
| | | @RequestMapping("/fms") |
| | | public class ComFmsApi extends BaseController { |
| | | |
| | | @Resource |
| | | private CommunityService communityService; |
| | | @Resource |
| | | private GridService gridService; |
| | | |
| | | @ApiOperation(value = "获取团队类型列表", response = ComFmsTeamTypeVO.class) |
| | | @ApiImplicitParam(name = "communityId", value = "社区id", required = true) |
| | | @GetMapping("/teamType/list") |
| | | public R listFmsTeamType(@RequestParam(value = "communityId", required = false) Long communityId) { |
| | | LoginUserInfoVO userInfo = this.getLoginUserInfoSureNoLogin(); |
| | | if (isNull(userInfo) && isNull(communityId)) { |
| | | return R.fail("社区id不能为空"); |
| | | } |
| | | if (nonNull(userInfo)) { |
| | | communityId = userInfo.getCommunityId(); |
| | | } |
| | | return communityService.listFmsTeamType(communityId); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页/全部查询团队信息", response = ComFmsTeamVO.class) |
| | | @PostMapping("/team/page") |
| | | public R pageFmsTeam(@RequestBody PageFmsTeamDTO pageFmsTeamDTO) { |
| | | LoginUserInfoVO userInfo = this.getLoginUserInfoSureNoLogin(); |
| | | if (isNull(userInfo) && isNull(pageFmsTeamDTO.getCommunityId())) { |
| | | return R.fail("社区id不能为空"); |
| | | } |
| | | if (nonNull(userInfo)) { |
| | | pageFmsTeamDTO.setCommunityId(userInfo.getCommunityId()); |
| | | } |
| | | return communityService.pageFmsTeamApplets(pageFmsTeamDTO); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询微讲堂", response = ComFmsClassroomVO.class) |
| | | @PostMapping("/classroom/page") |
| | | public R pageFmsClassroom(@RequestBody @Valid PageFmsClassroomAdminDTO adminDTO) { |
| | | LoginUserInfoVO userInfo = this.getLoginUserInfoSureNoLogin(); |
| | | if (isNull(userInfo) && isNull(adminDTO.getCommunityId())) { |
| | | return R.fail("社区id不能为空"); |
| | | } |
| | | if (nonNull(userInfo)) { |
| | | adminDTO.setCommunityId(userInfo.getCommunityId()); |
| | | } |
| | | return communityService.pageFmsClassroomAdmin(adminDTO); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取微讲堂详情", response = ComFmsClassroomVO.class) |
| | | @ApiImplicitParam(name = "id", value = "微讲堂id", required = true) |
| | | @GetMapping("/classroom/detail") |
| | | public R detailFmsClassroom(@RequestParam("id") Long id) { |
| | | return communityService.detailFmsClassroomApplets(id); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询微调节/微防控", response = EventVO.class) |
| | | @PostMapping("/event/page") |
| | | public R pageFmsEvent(@RequestBody @Valid PageFmsEventAdminDTO adminDTO) { |
| | | LoginUserInfoVO userInfo = this.getLoginUserInfoSureNoLogin(); |
| | | if (isNull(userInfo) && isNull(adminDTO.getCommunityId())) { |
| | | return R.fail("社区id不能为空"); |
| | | } |
| | | if (nonNull(userInfo)) { |
| | | adminDTO.setCommunityId(userInfo.getCommunityId()); |
| | | } |
| | | return communityService.pageFmsEventApplets(adminDTO); |
| | | } |
| | | |
| | | @ApiOperation(value = "微调节/微防控事件详情", response = EventDetailsVO.class) |
| | | @ApiImplicitParam(name = "eventId", value = "事件id", required = true) |
| | | @GetMapping("/event/detail") |
| | | public R detailFmsEvent(@RequestParam("eventId") Long eventId) { |
| | | return gridService.eventDetails(eventId); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询微服务", response = ComFmsServiceVO.class) |
| | | @PostMapping("/service/page") |
| | | public R pageFmsService(@RequestBody @Valid PageFmsServiceAppletsDTO adminDTO) { |
| | | LoginUserInfoVO userInfo = this.getLoginUserInfoSureNoLogin(); |
| | | if (isNull(userInfo) && isNull(adminDTO.getCommunityId())) { |
| | | return R.fail("社区id不能为空"); |
| | | } |
| | | if (nonNull(userInfo)) { |
| | | adminDTO.setCommunityId(userInfo.getCommunityId()); |
| | | } |
| | | return communityService.pageFmsServiceApplets(adminDTO); |
| | | } |
| | | |
| | | @ApiOperation(value = "查看微服务详情", response = ComFmsServiceVO.class) |
| | | @ApiImplicitParam(name = "serviceId", value = "服务id", required = true) |
| | | @GetMapping("/service/detail") |
| | | public R detailFmsService(@RequestParam("serviceId") Long serviceId) { |
| | | LoginUserInfoVO userInfo = this.getLoginUserInfoSureNoLogin(); |
| | | Long userId = null; |
| | | if (nonNull(userInfo)) { |
| | | userId = userInfo.getUserId(); |
| | | } |
| | | return communityService.detailFmsServiceApplets(serviceId, userId); |
| | | } |
| | | |
| | | @ApiOperation("微服务申请") |
| | | @PostMapping("/service/apply") |
| | | public R applyFmsService(@RequestBody @Valid ApplyFmsServiceDTO adminDTO) { |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | adminDTO.setUserInfo(loginUserInfo); |
| | | return communityService.applyFmsService(adminDTO); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询我的微服务", response = ComFmsServiceVO.class) |
| | | @PostMapping("/service/pageMy") |
| | | public R pageMyFmsService(@RequestBody @Valid PageFmsServiceAppletsDTO adminDTO) { |
| | | adminDTO.setCommunityId(this.getCommunityId()); |
| | | adminDTO.setUserId(this.getUserId()); |
| | | return communityService.pageMyFmsService(adminDTO); |
| | | } |
| | | |
| | | @ApiOperation(value = "微服务评价") |
| | | @PostMapping("/service/evaluate") |
| | | public R evaluateFmsService(@RequestBody @Valid EvaluationFmsServiceDTO evaluationFmsServiceDTO) { |
| | | evaluationFmsServiceDTO.setUserId(this.getUserId()); |
| | | return communityService.evaluateFmsService(evaluationFmsServiceDTO); |
| | | } |
| | | |
| | | @ApiOperation(value = "微团队成员分页查询服务处理", response = ComFmsServiceVO.class) |
| | | @PostMapping("/service/pageDeal") |
| | | public R pageDealFmsService(@RequestBody @Valid PageFmsServiceAppletsDTO adminDTO) { |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | adminDTO.setCommunityId(loginUserInfo.getCommunityId()); |
| | | adminDTO.setUserId(loginUserInfo.getUserId()); |
| | | adminDTO.setUserInfo(loginUserInfo); |
| | | return communityService.pageDealFmsService(adminDTO); |
| | | } |
| | | |
| | | @ApiOperation(value = "微团队成员服务反馈", response = ComFmsServiceVO.class) |
| | | @PostMapping("/service/feedback") |
| | | public R feedbackFmsService(@RequestBody @Valid FeedbackFmsServiceDTO adminDTO) { |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | adminDTO.setUserId(loginUserInfo.getUserId()); |
| | | adminDTO.setUserInfo(loginUserInfo); |
| | | return communityService.feedbackFmsService(adminDTO); |
| | | } |
| | | |
| | | @ApiOperation("核实微服务") |
| | | @PostMapping("/service/approval") |
| | | public R approvalFmsService(@RequestBody @Valid ApprovalFmsServiceAdminDTO adminDTO) { |
| | | if (adminDTO.getIsPass() && isNull(adminDTO.getMemberId())) { |
| | | return R.fail("未分配服务人员"); |
| | | } |
| | | adminDTO.setUpdatedBy(this.getUserId()); |
| | | return communityService.approvalFmsService(adminDTO); |
| | | } |
| | | |
| | | @ApiOperation("后台新增微服务") |
| | | @PostMapping("/service/add") |
| | | public R addFmsService(@RequestBody @Valid AddFmsServiceAdminDTO adminDTO) { |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | adminDTO.setCommunityId(loginUserInfo.getCommunityId()); |
| | | adminDTO.setCreatedBy(loginUserInfo.getUserId()); |
| | | adminDTO.setUpdatedBy(loginUserInfo.getUserId()); |
| | | return communityService.addFmsServiceAdmin(adminDTO); |
| | | } |
| | | |
| | | } |