New file |
| | |
| | | package com.panzhihua.applets.api; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.validation.Valid; |
| | | |
| | | import org.springframework.util.ObjectUtils; |
| | | 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.alibaba.fastjson.JSONObject; |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.model.dtos.community.dpc.PageDpcDTO; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.ComActDpcVO; |
| | | import com.panzhihua.common.model.vos.community.ComActEasyPhotoFeedbackVO; |
| | | import com.panzhihua.common.model.vos.community.ComActEasyPhotoVO; |
| | | import com.panzhihua.common.model.vos.user.SysUserNoticeVO; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import static java.util.Objects.isNull; |
| | | import static java.util.Objects.nonNull; |
| | | |
| | | /** |
| | | * @title: ComActDpcApi |
| | | * @projectName: 成都呐喊信息技术有限公司-智慧社区项目 |
| | | * @description: 人大代表 |
| | | * @author: hans |
| | | * @date: 2022/06/07 10:57 |
| | | */ |
| | | @Slf4j |
| | | @Api(tags = {"人大代表相关"}) |
| | | @RestController |
| | | @RequestMapping("/dpc") |
| | | public class ComActDpcApi extends BaseController { |
| | | |
| | | @Resource |
| | | private CommunityService communityService; |
| | | @Resource |
| | | private UserService userService; |
| | | |
| | | @ApiOperation(value = "获取人大代表详情", response = ComActDpcVO.class) |
| | | @ApiImplicitParam(name = "id", value = "人大代表id", required = true) |
| | | @GetMapping("/detail") |
| | | public R detailDpc(@RequestParam("id") Long id) { |
| | | return communityService.detailDpc(id); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询人大代表", response = ComActDpcVO.class) |
| | | @PostMapping("/page") |
| | | public R pageDpc(@RequestBody @Valid PageDpcDTO pageDpcDTO) { |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfoSureNoLogin(); |
| | | if (nonNull(loginUserInfo)) { |
| | | pageDpcDTO.setCommunityId(loginUserInfo.getCommunityId()); |
| | | } else if (isNull(pageDpcDTO.getCommunityId())) { |
| | | return R.fail("未指定社区"); |
| | | } |
| | | return communityService.pageDpc(pageDpcDTO); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取人大代表反馈记录", response = ComActEasyPhotoFeedbackVO.class) |
| | | @ApiImplicitParam(name = "id", value = "随手拍id", required = true) |
| | | @GetMapping("/feedback") |
| | | public R getFeedbackList(@RequestParam("id") Long id) { |
| | | return communityService.getFeedbackList(id); |
| | | } |
| | | |
| | | @ApiOperation(value = "人大代表反馈随手拍") |
| | | @PostMapping("/feedback") |
| | | public R addFeedback(@RequestBody ComActEasyPhotoVO comActEasyPhotoVO) { |
| | | LoginUserInfoVO loginUserInfo = userService.getUserInfoByUserId(this.getLoginUserInfo().getUserId().toString()).getData(); |
| | | Integer isDpcMember = loginUserInfo.getIsDpcMember(); |
| | | if (isNull(isDpcMember) || !isDpcMember.equals(1)) { |
| | | return R.fail("暂无权限"); |
| | | } |
| | | Long userId = loginUserInfo.getUserId(); |
| | | Integer type = comActEasyPhotoVO.getType(); |
| | | if (null == type || type != 3) { |
| | | return R.fail("操作类型错误"); |
| | | } |
| | | Long id = comActEasyPhotoVO.getId(); |
| | | if (ObjectUtils.isEmpty(id)) { |
| | | return R.fail("随手拍主键不能为空"); |
| | | } |
| | | comActEasyPhotoVO.setUserId(userId); |
| | | R r = communityService.addEasyPhotoFeedbackForDpc(comActEasyPhotoVO); |
| | | if (R.isOk(r)) { |
| | | R r1 = communityService.detailEasyPhoto(id, userId); |
| | | if (R.isOk(r1)) { |
| | | ComActEasyPhotoVO comActEasyPhotoVO1 = |
| | | JSONObject.parseObject(JSONObject.toJSONString(r1.getData()), ComActEasyPhotoVO.class); |
| | | SysUserNoticeVO sysUserNoticeVO = new SysUserNoticeVO(); |
| | | sysUserNoticeVO.setUserId(comActEasyPhotoVO1.getSponsorId()); |
| | | sysUserNoticeVO.setType(2); |
| | | sysUserNoticeVO.setBusinessType(4); |
| | | sysUserNoticeVO.setBusinessTime(comActEasyPhotoVO1.getExamineAt()); |
| | | sysUserNoticeVO.setBusinessId(id); |
| | | sysUserNoticeVO.setStatus(0); |
| | | if (type.intValue() == 3) { |
| | | sysUserNoticeVO.setTitle("随手拍有反馈"); |
| | | sysUserNoticeVO.setBusinessTitle(comActEasyPhotoVO.getHandleResult()); |
| | | sysUserNoticeVO.setBusinessContent("社区已经处理好了具体的事宜,将变成现在更好看的样子找到更好的自己……"); |
| | | sysUserNoticeVO.setBusinessStatus(2); |
| | | R r2 = userService.addNotice(sysUserNoticeVO); |
| | | if (R.isOk(r2)) { |
| | | log.info("新增随手拍有反馈通知成功【{}】", JSONObject.toJSONString(sysUserNoticeVO)); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return r; |
| | | } |
| | | |
| | | } |
| | | |
| | | |