| | |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.panzhihua.applets.weixin.CheckService; |
| | | import com.panzhihua.applets.model.dtos.ComPbMemberCertificationDTO; |
| | | import com.panzhihua.common.model.dtos.user.SysUserFeedbackDTO; |
| | | import com.panzhihua.common.model.vos.community.*; |
| | | import com.panzhihua.common.model.vos.partybuilding.PartyBuildingMemberVO; |
| | | import com.panzhihua.common.model.vos.user.ComMngFamilyInfoVO; |
| | | import com.panzhihua.common.model.vos.user.SysUserNoticeVO; |
| | | import com.panzhihua.common.model.vos.user.UserPhoneVO; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | import com.panzhihua.common.service.partybuilding.PartyBuildingService; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.exceptions.UnAuthenticationException; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.validated.AddGroup; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-24 12:03 |
| | | **/ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/user/") |
| | | @Api(tags = {"我的模块"}) |
| | |
| | | private CommunityService communityService; |
| | | @Resource |
| | | private PartyBuildingService partyBuildingService; |
| | | @Resource |
| | | private CheckService checkService; |
| | | |
| | | @ApiOperation(value = "当前登录用户信息", response = LoginUserInfoVO.class) |
| | | @GetMapping("info") |
| | |
| | | Long userId = loginUserInfo.getUserId(); |
| | | Long areaId = loginUserInfo.getAreaId(); |
| | | R<LoginUserInfoVO> r = userService.getUserInfoByUserId(userId + ""); |
| | | String phone = loginUserInfo.getPhone(); |
| | | if (R.isOk(r)) { |
| | | Object data = r.getData(); |
| | | if (!ObjectUtils.isEmpty(data)) { |
| | |
| | | public R putUserAuthentication(@RequestBody @Validated(AddGroup.class) LoginUserInfoVO loginUserInfoVO) { |
| | | Long userId = this.getUserId(); |
| | | loginUserInfoVO.setUserId(userId); |
| | | return userService.putUserAuthentication(loginUserInfoVO); |
| | | R r = userService.putUserAuthentication(loginUserInfoVO); |
| | | if (R.isOk(r)) { |
| | | //通过不发通知 |
| | | } else { |
| | | SysUserNoticeVO sysUserNoticeVO=new SysUserNoticeVO(); |
| | | sysUserNoticeVO.setUserId(userId); |
| | | sysUserNoticeVO.setType(3); |
| | | sysUserNoticeVO.setTitle("实名制审核未通过"); |
| | | sysUserNoticeVO.setBusinessType(6); |
| | | // sysUserNoticeVO.setBusinessTitle(comActActivityVO.getActivityName()); |
| | | sysUserNoticeVO.setBusinessContent(String.format("驳回原因:%s",r.getMsg())); |
| | | // sysUserNoticeVO.setBusinessId(activityId);R |
| | | sysUserNoticeVO.setStatus(0); |
| | | sysUserNoticeVO.setBusinessStatus(1); |
| | | R r1 = userService.addNotice(sysUserNoticeVO); |
| | | if (R.isOk(r1)) { |
| | | log.info("新增实名认证未通过通知成功【{}】", JSONObject.toJSONString(sysUserNoticeVO)); |
| | | } |
| | | } |
| | | return r; |
| | | } |
| | | |
| | | @ApiOperation(value = "修改用户手机号") |
| | |
| | | @ApiOperation(value = "我的活动",response =ComActActivityVO.class ) |
| | | @GetMapping("listactivity") |
| | | public R listActivity() { |
| | | Long userId = this.getUserId(); |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | Long userId = loginUserInfo.getUserId(); |
| | | Long communityId = loginUserInfo.getCommunityId(); |
| | | List<ComActActivityVO> comActActivityVOS=new ArrayList<>(); |
| | | R r=communityService.listActivity(userId); |
| | | if (R.isOk(r)) { |
| | | comActActivityVOS =(List<ComActActivityVO>) r.getData(); |
| | | } |
| | | R r1=partyBuildingService.listActivity(userId); |
| | | R r1=partyBuildingService.listActivity(userId,communityId); |
| | | if (R.isOk(r1)) { |
| | | List<ComActActivityVO> data = (List<ComActActivityVO>) r1.getData(); |
| | | comActActivityVOS.addAll(data); |
| | |
| | | List<ComActActivityVO> collect = comActActivityVOS1.stream().sorted(Comparator.comparing(ComActActivityVO::getBeginAt).reversed()).collect(Collectors.toList()); |
| | | comActActivityVOS=collect; |
| | | } |
| | | if (!ObjectUtils.isEmpty(comActActivityVOS)) { |
| | | List<ComActActivityVO> collect = comActActivityVOS.stream().sorted(Comparator.comparing(ComActActivityVO::getSingDate).reversed()).collect(Collectors.toList()); |
| | | return R.ok(collect); |
| | | } |
| | | return R.ok(comActActivityVOS); |
| | | } |
| | | |
| | |
| | | @PostMapping("pageeasyphoto") |
| | | public R pageEasyPhoto(@RequestBody ComActEasyPhotoVO comActEasyPhotoVO) { |
| | | Long userId = this.getUserId(); |
| | | comActEasyPhotoVO.setUserId(userId); |
| | | comActEasyPhotoVO.setLogInUserId(userId); |
| | | comActEasyPhotoVO.setSponsorId(userId); |
| | | comActEasyPhotoVO.setCommunityId(null); |
| | | return communityService.pageEasyPhoto(comActEasyPhotoVO); |
| | | return communityService.pageEasyPhotoApplets(comActEasyPhotoVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询我的微心愿",response = ComActMicroWishVO.class ) |
| | |
| | | Long userId = this.getUserId(); |
| | | comActMicroWishVO.setUserId(userId); |
| | | comActMicroWishVO.setCommunityId(null); |
| | | Integer status = comActMicroWishVO.getStatus(); |
| | | if (null!=status&&status==1) { |
| | | comActMicroWishVO.setIsPageMyWish(1); |
| | | }else{ |
| | | comActMicroWishVO.setIsPageMyWish(null); |
| | | } |
| | | |
| | | return communityService.pageMicroWish(comActMicroWishVO); |
| | | } |
| | | |
| | |
| | | return userService.deleteUserTest(userId); |
| | | } |
| | | |
| | | @ApiOperation(value = "意见反馈" ) |
| | | @PostMapping("feedback") |
| | | public R addFeedback(@RequestBody @Validated(AddGroup.class) SysUserFeedbackDTO sysUserFeedbackDTO) { |
| | | // 微信内容审核 |
| | | String msg = sysUserFeedbackDTO.getContent(); |
| | | if (!checkService.checkMessage(msg)) { |
| | | return R.fail("内容违规"); |
| | | } |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | Long userId = loginUserInfo.getUserId(); |
| | | Long communityId = loginUserInfo.getCommunityId(); |
| | | Long areaId = loginUserInfo.getAreaId(); |
| | | if (null==communityId||0==communityId) { |
| | | return R.fail("未绑定社区"); |
| | | } |
| | | sysUserFeedbackDTO.setCommunityId(communityId); |
| | | sysUserFeedbackDTO.setAreaId(areaId); |
| | | sysUserFeedbackDTO.setUserId(userId); |
| | | return userService.addFeedback(sysUserFeedbackDTO); |
| | | } |
| | | |
| | | @ApiOperation(value = "党员认证" ) |
| | | @PostMapping("partybuildingembercertification") |
| | | public R partybuildingembercertification(@RequestBody @Validated(AddGroup.class) ComPbMemberCertificationDTO comPbMemberCertificationDTO) { |
| | | //totest 党员认证 |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | Long userId = loginUserInfo.getUserId(); |
| | | Long communityId = loginUserInfo.getCommunityId(); |
| | | if (null==communityId||0==communityId) { |
| | | return R.fail("未绑定社区"); |
| | | } |
| | | |
| | | //判断用户是否已认证成功 |
| | | R certUser = partyBuildingService.userCertification(userId); |
| | | |
| | | Object certUserInfo = certUser.getData(); |
| | | boolean userCertified = false; |
| | | if(certUserInfo!=null){ |
| | | PartyBuildingMemberVO certUserVo = (PartyBuildingMemberVO) certUserInfo; |
| | | //已认证党员身份,直接返回 |
| | | userCertified = certUserVo.getAuditResult()==1; |
| | | } |
| | | //匹配手机,验证是否进行自动确认 |
| | | if(userCertified){ |
| | | return R.fail("用户已完成党员认证"); |
| | | } |
| | | |
| | | PartyBuildingMemberVO partyBuildingMemberVO = new PartyBuildingMemberVO(); |
| | | BeanUtils.copyProperties(comPbMemberCertificationDTO, partyBuildingMemberVO); |
| | | |
| | | //用户实名认证信息判断 |
| | | String idCard = loginUserInfo.getIdCard(); |
| | | partyBuildingMemberVO.setUserId(userId); |
| | | if(idCard==null) { |
| | | return R.fail("用户未完成实名认证"); |
| | | }else{ |
| | | partyBuildingMemberVO.setIdCard(loginUserInfo.getIdCard()); |
| | | partyBuildingMemberVO.setName(loginUserInfo.getName()); |
| | | } |
| | | |
| | | R r = partyBuildingService.addPartyBuildingMember(partyBuildingMemberVO); |
| | | return r; |
| | | } |
| | | |
| | | @ApiOperation(value = "党员认证查询" ) |
| | | @GetMapping("partybuildingembercertification") |
| | | public R partybuildingembercertification() { |
| | | //totest 党员认证查询 |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | Long userId = loginUserInfo.getUserId(); |
| | | return partyBuildingService.userCertification(userId); |
| | | } |
| | | |
| | | } |